Module csw.Units

Classes

class Unit (name: str, description: str)
Expand source code
@dataclass
class Unit:
    """
    A class representing units for TMT (Corresponds to the CSW Units Scala class)
    """
    name: str
    description: str

A class representing units for TMT (Corresponds to the CSW Units Scala class)

Instance variables

var description : str

The type of the None singleton.

var name : str

The type of the None singleton.

class Units (*args, **kwds)
Expand source code
class Units(Enum):
    # SI units
    angstrom = Unit("Angstrom", "angstrom")
    alpha = Unit("alpha", "alpha: fine structure constant")
    ampere = Unit("A", "ampere: unit of electric current")
    arcmin = Unit("arcmin", "arc minute; angular measurement")
    arcsec = Unit("arcsec", "arc second: angular measurement")
    bar = Unit("bar", "bar: metric ton of pressure")
    candela = Unit("candela", "candela(lumen/sr)")
    day = Unit("d", "day")
    degree = Unit("deg", "degree: angular measurement 1/360 of full rotation")
    degC = Unit("degC", "Degree Celsius K")
    degF = Unit("degF", "Fahrenheit")
    elvolt = Unit("eV", "electron volt")
    gauss = Unit("gauss", "gauss")
    gram = Unit("g", "gram")
    hertz = Unit("Hz", "frequency")
    henry = Unit("henry", "Henry")
    hour = Unit("h", "hour")
    joule = Unit("J", "Joule: energy")
    kelvin = Unit("K", "Kelvin: temperature with a null point at absolute zero")
    kilogram = Unit("kg", "kilogram, base unit of mass in SI")
    kilometer = Unit("km", "kilometers")
    liter = Unit("l", "liter, metric unit of volume")
    lm = Unit("lm", "lumen")
    lsun = Unit("lsun", "solar luminosity")
    lx = Unit("lx", "lux(lm/m2)")
    mas = Unit("mas", "milli arc second")
    me = Unit("me", "me(electron_mass)")
    meter = Unit("m", "meter: base unit of length in SI")
    microarcsec = Unit("µas", "micro arcsec: angular measurement")
    millimeter = Unit("mm", "millimeters")
    millisecond = Unit("ms", "milliseconds")
    micron = Unit("µm", "micron: alias for micrometer")
    micrometer = Unit("µm", "micron")
    minute = Unit("min", "minute")
    MJD = Unit("MJD", "Mod. Julian Date")
    mol = Unit("mol", "mole- unit of substance")
    month = Unit("month", "Month name or number")
    mmyy = Unit("mmyy", "mmyy: Month/Year")
    mu0 = Unit("mu0", "mu0: magnetic constant")
    muB = Unit("muB", "Bohr magneton")
    nanometer = Unit("nm", "nanometers")
    newton = Unit("N", "Newton: force")
    ohm = Unit("ohm", "Ohm")
    pascal = Unit("Pa", "Pascal: pressure")
    pi = Unit("pi", "pi")
    pc = Unit("pc", "parsec")
    ppm = Unit("ppm", "part per million")
    radian = Unit("rad", "radian: angular measurement of the ratio between the length of an arc and its radius")
    second = Unit("s", "second: base unit of time in SI")
    sday = Unit("sday", "sidereal day is the time of one rotation of the Earth")
    steradian = Unit("sr", "steradian: unit of solid angle in SI")
    volt = Unit("V", "Volt: electric potential or electromotive force")
    watt = Unit("W", "Watt: power")
    Wb = Unit("Wb", "Weber")
    week = Unit("wk", "week")
    year = Unit("yr", "year")

    # CGS units
    coulomb = Unit("C", "coulomb: electric charge")
    centimeter = Unit("cm", "centimeter")
    D = Unit("Debye", "Debye(dipole) A electric dipole moment ")
    dyn = Unit("dyne", "dyne: Unit of force ")
    erg = Unit("erg", "erg: CGS unit of energy")

    # Astropyhsics units
    au = Unit("AU", "astronomical unit: approximately the mean Earth-Sun distance")
    a0 = Unit("a0",
              "bohr radius: probable distance between the nucleus and the electron in a hydrogen atom in its ground state")
    c = Unit("c", "c: speed of light")
    cKayser = Unit("cKayser", "cKayser")
    crab = Unit("crab", "Crab: astrophotometrical unit for measurement of the intensity of Astrophysical X-ray sources")
    damas = Unit("d:m:s", "damas: degree arcminute arcsecond (sexagesimal angle from degree)")
    e = Unit("e", "electron charge")
    earth = Unit("earth", "earth (geo) unit")
    F = Unit("F", "Farad: F")
    G = Unit("G", "gravitation constant")
    geoMass = Unit("geoMass", "Earth Mass")
    hm = Unit("hm", "hour minutes (sexagesimal time from hours)")
    hms = Unit("hms", "hour minutes seconds (sexagesimal time from hours)")
    hhmmss = Unit("HH:MM:SS", "hour minutes seconds (sexagesimal time)")
    jansky = Unit("Jy", "Jansky: spectral flux density")
    jd = Unit("jd", "Julian Day")
    jovmass = Unit("jovMass", "Jupiter mass")
    lightyear = Unit("lyr", "light year")
    mag = Unit("mag", "stellar magnitude")
    mjup = Unit("Mjup", "Jupiter mass")
    mp = Unit("mp", "proton_mass")
    minsec = Unit("m:s", "minutes seconds (sexagesimal time from minutes)")
    msun = Unit("Msun", "solar mass")
    photon = Unit("photon", "photon")
    rgeo = Unit("Rgeo", "Earth radius (eq)")
    rjup = Unit("Rjup", "Jupiter Radius(eq)")
    rsun = Unit("Rsun", "solar radius")
    rydberg = Unit("Rydberg", "energy of the photon whose wavenumber is the Rydberg constant")
    seimens = Unit("seimens", "Seimens")
    tesla = Unit("tesla", "Tesla")
    u = Unit("u", "atomic mass unit")

    # Imperial units
    barn = Unit("barn", "barn: metric unit of area")
    cal = Unit("cal", "thermochemical calorie: pre-SI metric unit of energy")
    foot = Unit("ft", "international foot")
    inch = Unit("inch", "international inch")
    pound = Unit("lb", "international avoirdupois pound")
    mile = Unit("mi", "international mile")
    ounce = Unit("oz", "international avoirdupois ounce")
    yard = Unit("yd", "international yard")

    # Others - engineering
    NoUnits = Unit("none", "scalar - no units specified")
    bit = Unit("bit", "bit: binary value of 0 or 1")
    encoder = Unit("enc", "encoder counts")
    count = Unit("ct", "counts as for an encoder or detector")
    mmhg = Unit("mmHg", "millimetre of mercury is a manometric unit of pressure")
    percent = Unit("percent", "percentage")
    pix = Unit("pix", "pixel")

    # Datetime units
    tai = Unit("TAI", "TAI time unit")
    utc = Unit("UTC", "UTC time unit")
    date = Unit("date", "date")
    datetime = Unit("datetime", "date/time")

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Ancestors

  • enum.Enum

Class variables

var D

The type of the None singleton.

var F

The type of the None singleton.

var G

The type of the None singleton.

var MJD

The type of the None singleton.

var NoUnits

The type of the None singleton.

var Wb

The type of the None singleton.

var a0

The type of the None singleton.

var alpha

The type of the None singleton.

var ampere

The type of the None singleton.

var angstrom

The type of the None singleton.

var arcmin

The type of the None singleton.

var arcsec

The type of the None singleton.

var au

The type of the None singleton.

var bar

The type of the None singleton.

var barn

The type of the None singleton.

var bit

The type of the None singleton.

var c

The type of the None singleton.

var cKayser

The type of the None singleton.

var cal

The type of the None singleton.

var candela

The type of the None singleton.

var centimeter

The type of the None singleton.

var coulomb

The type of the None singleton.

var count

The type of the None singleton.

var crab

The type of the None singleton.

var damas

The type of the None singleton.

var date

The type of the None singleton.

var datetime

The type of the None singleton.

var day

The type of the None singleton.

var degC

The type of the None singleton.

var degF

The type of the None singleton.

var degree

The type of the None singleton.

var dyn

The type of the None singleton.

var e

The type of the None singleton.

var earth

The type of the None singleton.

var elvolt

The type of the None singleton.

var encoder

The type of the None singleton.

var erg

The type of the None singleton.

var foot

The type of the None singleton.

var gauss

The type of the None singleton.

var geoMass

The type of the None singleton.

var gram

The type of the None singleton.

var henry

The type of the None singleton.

var hertz

The type of the None singleton.

var hhmmss

The type of the None singleton.

var hm

The type of the None singleton.

var hms

The type of the None singleton.

var hour

The type of the None singleton.

var inch

The type of the None singleton.

var jansky

The type of the None singleton.

var jd

The type of the None singleton.

var joule

The type of the None singleton.

var jovmass

The type of the None singleton.

var kelvin

The type of the None singleton.

var kilogram

The type of the None singleton.

var kilometer

The type of the None singleton.

var lightyear

The type of the None singleton.

var liter

The type of the None singleton.

var lm

The type of the None singleton.

var lsun

The type of the None singleton.

var lx

The type of the None singleton.

var mag

The type of the None singleton.

var mas

The type of the None singleton.

var me

The type of the None singleton.

var meter

The type of the None singleton.

var microarcsec

The type of the None singleton.

var micrometer

The type of the None singleton.

var micron

The type of the None singleton.

var mile

The type of the None singleton.

var millimeter

The type of the None singleton.

var millisecond

The type of the None singleton.

var minsec

The type of the None singleton.

var minute

The type of the None singleton.

var mjup

The type of the None singleton.

var mmhg

The type of the None singleton.

var mmyy

The type of the None singleton.

var mol

The type of the None singleton.

var month

The type of the None singleton.

var mp

The type of the None singleton.

var msun

The type of the None singleton.

var mu0

The type of the None singleton.

var muB

The type of the None singleton.

var nanometer

The type of the None singleton.

var newton

The type of the None singleton.

var ohm

The type of the None singleton.

var ounce

The type of the None singleton.

var pascal

The type of the None singleton.

var pc

The type of the None singleton.

var percent

The type of the None singleton.

var photon

The type of the None singleton.

var pi

The type of the None singleton.

var pix

The type of the None singleton.

var pound

The type of the None singleton.

var ppm

The type of the None singleton.

var radian

The type of the None singleton.

var rgeo

The type of the None singleton.

var rjup

The type of the None singleton.

var rsun

The type of the None singleton.

var rydberg

The type of the None singleton.

var sday

The type of the None singleton.

var second

The type of the None singleton.

var seimens

The type of the None singleton.

var steradian

The type of the None singleton.

var tai

The type of the None singleton.

var tesla

The type of the None singleton.

var u

The type of the None singleton.

var utc

The type of the None singleton.

var volt

The type of the None singleton.

var watt

The type of the None singleton.

var week

The type of the None singleton.

var yard

The type of the None singleton.

var year

The type of the None singleton.