Units

Listed below are Units of Measurement, supported by TMT observatory framework and are available as Enumerated values. Units are optionally attached to Parameter Keys.

Note

Units are made available via separate files, for consumption in Scala and Java code.

  • Import csw.messages.params.models.Units for Scala
  • Import csw.params.javadsl.JUnits for Java.
Note

The set of supported Units will be modified as more required Units are discovered.

Default Units for Keys

The default unit for UTCTimeKey and TAITimeKey (in Scala and Java both) is utc & tai respectively. For all the remaining keys, default unit is NoUnits.

SI Units

Name Abbreviation Description
angstrom Angstrom unit of length (10^-10 m)
alpha alpha fine structure constant
ampere A unit of electrical current
arcmin arcmin arc minute; angular measurement
arcsec arcsec arc second: angular measurement
bar bar unit of pressure
candela candela unit of luminous intensity
day d day - 24 hours
degree deg degree: agular measurement 1/360 of full rotation
degC degC degree celsius
degF degF Fahrenheit
elvolt eV electron volt
gauss gauss unit of measurement of magnetic induction
gram g unit of mass or weight
hertz Hz SI unit of frequency
henry henry unit of electrical inductance
hour h unit of time
joule J SI unit of energy
kelvin K base unit of temperature
kilogram kg base unit of mass in SI
kilometer km unit of length equal to 1,000 metres
liter l metric unit of volume
lm lm unit of luminous flux, or amount of light,
lsun Lsun solar luminosity
lx lx SI derived unit of illuminance measuring luminous flux per unit area
meter m meter: base unit of length in SI
mas mas milli arc second: angular measurement
me me electron mass - mass of a stationary electron
meter m unit of length
microarcsec µas micro arc second; angular measurement
millimeter mm unit of length equal to 0.001 metre
millisecond ms milliseconds
micron µm micron: alias for micrometer
micrometer µm micrometer
minute min minute is a unit of time
MJD MJD Modified Julian Date
mol mol mole: Unit of amount of substance
month month unit of time
mmyy mmyy Month/Year
mu0 mu0 magnetic constant
muB muB moment of electrons is bohr magneton
nanometer nm nanometers
newton N SI unit of force
ohm ohm unit of electric resistance
pascal Pa SI unit of pressure
pi pi pi is the ratio of the circumference of a circle to its diameter
pc pc unit for expressing distances to stars and galaxies,
ppm ppm part per million
radian rad radian: angular measurement of the ratio between the length of an arc and its radius
second s second: base unit of time in SI
sday sday sidereal day is the time of one rotation of the Earth
steradian sr steradian: unit of solid angle in SI
volt V Volt: electric potential or electromotive force
watt W Watt: power
Wb Wb Weber: SI derived unit of magnetic flux
week wk week: 7 days
year yr year

CGS Units

Name Abbreviation Description
coulomb C coulomb: electric charge
centimeter cm centimeter
D D Debye(dipole) - electric dipole moments of molecules
dyn dyn CGS unit of force
erg erg CGS unit of energy

Astrophysical Units

Name Abbreviation Description
au AU astronomical unit: approximately the mean Earth-Sun distance
a0 a0 bohr radius
c c speed of light
cKayser cKayser unit of wavenumber equal to reciprocal of a centimeter
crab crab unit for measurement of the intensity of Astrophysical X-ray sources
damas damas degree minute arcsecond
e e electron charge
earth earth earth unit
F F Farad: SI derived unit of electrical capacitance
G G Gravitation Constant gives the constant of proportionality
geoMass geoMass Earth Mass
hm hm hour minute
hms hms hour minute seconds
hhmmss HH:MM:SS hour minutes seconds(sexagesimal time)
jansky Jy Jansky: spectral flux density
jd jd Julian Day at an instant is Julian day number plus the fraction of a day since the preceding noon in Universal Time
jovMass jovMass Jupiter Mass
lightyear lyr light year
mag mag stellar magnitude
mjup mjup Jupiter mass
mp mp proton mass
minsec m:s minute second
msun msun solar mass
photon photon photon
rgeo Rgeo Earth radius
rjup Rjup Jupiter radius
rsun Rsun solar radius
rydberg Rydberg ionization energy of hydrogen in its ground state (~13.6 eV)
seimens seimens derived unit of electric conductance
tesla tesla unit of magnetic induction
u u atomic mass unit

Imperial Units

Name Abbreviation Description
barn barn unit of area for cross section of scattering (10^28 m^2)
cal cal thermochemical calorie: pre-SI metric unit of energy
foot ft international foot
inch inch international inch
pound lb international avoirdupois pound
mile mi international mile
ounce oz international avoirdupois ounce
yard yd international yard

Datetime units

Name Abbreviation Description
tai tai TAI Time unit
utc utc UTC Time unit
date date date
datetime datetime datetime

Others - Engineering

Name Abbreviation Description
NoUnits none scalar - no units specified
bit bit bit
encoder enc encoder counts
count ct counts as for an encoder or detector
mmhg mmHg millimetre of mercury
percent percent percentage
pix pix pixel

Usage Examples

Scala
source// declare keyname
val s1: String = "encoder"

// making 3 keys
val k1: Key[Boolean] = KeyType.BooleanKey.make(s1)
val k2: Key[Short]   = KeyType.ShortKey.make("RandomKeyName")
val k3: Key[String]  = KeyType.StringKey.make(s1)

// storing a single value, default unit is NoUnits
val bParam: Parameter[Boolean] = k1.set(true)
val bDefaultUnitSet: Boolean   = bParam.units === Units.NoUnits // true

// default unit for UTCTimeKey
val utcParam: Parameter[UTCTime] = KeyType.UTCTimeKey.make("now").set(UTCTime.now())
// default unit for TAITimeKey
val taiParam: Parameter[TAITime] = KeyType.TAITimeKey.make("now").set(TAITime.now())

// storing multiple values
val paramOfShorts: Parameter[Short] = k2.set(1, 2, 3, 4)

// values to store
val weekDays: Array[String] = Array("Sunday", "Monday", "Tuesday")

// default units via set
val paramWithUnits1: Parameter[String] = k3.setAll(weekDays)
// associating units via withUnits
val paramWithUnits2: Parameter[String] = k3.setAll(weekDays) withUnits Units.day
// change existing unit
val paramWithUnits3: Parameter[Short] = paramOfShorts.withUnits(Units.meter)
Java
source//declare keyname
String s1 = "encoder";

//making 3 keys
Key<Boolean> k1 = JKeyType.BooleanKey().make(s1);
Key<Short> k2 = JKeyType.ShortKey().make("RandomKeyName", JUnits.NoUnits);
Key<String> k3 = JKeyType.StringKey().make(s1, JUnits.NoUnits);

//storing a single value, default unit is NoUnits()
Parameter<Boolean> bParam = k1.set(true);
boolean bDefaultUnitSet = bParam.units() == JUnits.NoUnits; //true

//default unit for UTCTimeKey
Parameter<UTCTime> utcParam = JKeyType
        .UTCTimeKey()
        .make("now")
        .set(UTCTime.now());

//default unit for TAITimeKey
Parameter<TAITime> taiParam = JKeyType
        .TAITimeKey()
        .make("now")
        .set(TAITime.now());


//storing multiple values
Parameter<Short> paramOfShorts = k2.set(
        (short) 1,
        (short) 2,
        (short) 3,
        (short) 4
);

//values to store
String[] weekDays = {"Sunday", "Monday", "Tuesday"};

//defaults units via set
Parameter<String> paramWithUnits1 = k3.setAll(weekDays);
//associating units via withUnits
Parameter<String> paramWithUnits2 = k3.setAll(weekDays).withUnits(JUnits.day);
//change existing unit
Parameter<Short> paramWithUnits3 = paramOfShorts.withUnits(JUnits.meter);

Source Code for Examples