ts_lib_units package#

Submodules#

Module contents#

class Unit[source]#

Bases: object

TetraScience standard units

ABSORBANCE_UNIT = TetraUnit(AbsorbanceUnit, None, http://purl.allotrope.org/ontology/qudt-ext/unit#AbsorbanceUnit)#
AMPERE = TetraUnit(Ampere, ampere, http://qudt.org/vocab/unit/A)#
ANGSTROM = TetraUnit(Angstrom, angstrom, http://qudt.org/vocab/unit/ANGSTROM)#
ARBITRARY_UNIT = TetraUnit(ArbitraryUnit, None, http://purl.allotrope.org/ontology/qudt-ext/unit#ArbitraryUnit)#
BAR = TetraUnit(Bar, bar, http://qudt.org/vocab/unit/BAR)#
BYTE = TetraUnit(Byte, byte, http://qudt.org/vocab/unit/BYTE)#
CENTIMETER = TetraUnit(Centimeter, centimeter, http://qudt.org/vocab/unit/CentiM)#
CENTIMETER_PER_HOUR = TetraUnit(CentimeterPerHour, centimeter / hour, None)#
CENTIPOISE = TetraUnit(Centipoise, centipoise, http://qudt.org/vocab/unit/CentiPOISE)#
COUNT = TetraUnit(Count, count, None)#
COUNT_PER_LITER = TetraUnit(CountPerLiter, count / liter, None)#
COUNT_PER_MICROLITER = TetraUnit(CountPerMicroliter, count / microliter, None)#
COUNT_PER_MILLILITER = TetraUnit(CountPerMilliliter, count / milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#CountsPerMilliliter)#
COUNT_PER_NANOLITER = TetraUnit(CountPerNanoliter, count / nanoliter, None)#
CUBIC_CENTIMETER_PER_MOLE = TetraUnit(CubicCentimeterPerMole, (centimeter ** 3) / mole, None)#
CYCLE_NUMBER = TetraUnit(CycleNumber, None, None)#
DALTON = TetraUnit(Dalton, dalton, http://qudt.org/vocab/unit/Da)#
DAY = TetraUnit(Day, day, http://qudt.org/vocab/unit/DAY)#
DECIBEL = TetraUnit(Decibel, decibel, http://qudt.org/vocab/unit/DeciB)#
DEGREE_ANGLE = TetraUnit(DegreeAngle, degree, http://qudt.org/vocab/unit/DEG)#
DEGREE_CELSIUS = TetraUnit(DegreeCelsius, degree_Celsius, http://qudt.org/vocab/unit/DEG_C)#
DEGREE_CELSIUS_PER_MINUTE = TetraUnit(DegreeCelsiusPerMinute, degree_Celsius / minute, http://qudt.org/vocab/unit/DEG_C-PER-MIN)#
DEGREE_FAHRENHEIT = TetraUnit(DegreeFahrenheit, degree_Fahrenheit, http://qudt.org/vocab/unit/DEG_F)#
ELECTRON_VOLT = TetraUnit(ElectronVolt, electron_volt, http://qudt.org/vocab/unit/EV)#
ENDOTOXIN_UNIT = TetraUnit(EndotoxinUnit, endotoxin_unit, None)#
ENDOTOXIN_UNIT_PER_NANOGRAM = TetraUnit(EndotoxinUnitPerNanogram, endotoxin_unit / nanogram, None)#
ENDOTOXIN_UNIT_PER_MICROGRAM = TetraUnit(EndotoxinUnitPerMicrogram, endotoxin_unit / microgram, None)#
ENDOTOXIN_UNIT_PER_GRAM = TetraUnit(EndotoxinUnitPerGram, endotoxin_unit / gram, None)#
ENDOTOXIN_UNIT_PER_MICROLITER = TetraUnit(EndotoxinUnitPerMicroliter, endotoxin_unit / microliter, None)#
ENDOTOXIN_UNIT_PER_MILLILITER = TetraUnit(EndotoxinUnitPerMilliliter, endotoxin_unit / milliliter, None)#
ENDOTOXIN_UNIT_PER_LITER = TetraUnit(EndotoxinUnitPerLiter, endotoxin_unit / liter, None)#
FEMTOGRAM = TetraUnit(Femtogram, femtogram, http://purl.allotrope.org/ontology/qudt-ext/unit#Femtogram)#
FEMTOLITER = TetraUnit(Femtoliter, femtoliter, http://purl.allotrope.org/ontology/qudt-ext/unit#Femtoliter)#
FRAME_PER_SECOND = TetraUnit(FramePerSecond, None, http://qudt.org/vocab/unit/FRAME-PER-SEC)#
GRAM = TetraUnit(Gram, gram, http://qudt.org/vocab/unit/GM)#
GRAM_PER_MILLILITER = TetraUnit(GramPerMilliliter, gram / milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#GramPerMilliliter)#
GRAM_PER_LITER = TetraUnit(GramPerLiter, gram / liter, http://purl.allotrope.org/ontology/qudt-ext/unit#GramPerLiter)#
GRAM_PER_LITER_SOLVENT = TetraUnit(GramPerLiterSolvent, None, None)#
GRAM_PER_LITER_SOLUTION = TetraUnit(GramPerLiterSolution, None, None)#
GRAM_PER_MOLE = TetraUnit(GramPerMole, gram / mole, http://purl.allotrope.org/ontology/qudt-ext/unit#GramPerMole)#
HERTZ = TetraUnit(Hertz, hertz, http://qudt.org/vocab/unit/HZ)#
HOUR = TetraUnit(Hour, hour, http://qudt.org/vocab/unit/HR)#
INCH = TetraUnit(Inch, inch, http://qudt.org/vocab/unit/IN)#
INTENSITY = TetraUnit(Intensity, None, None)#
JOULE = TetraUnit(Joule, joule, http://qudt.org/vocab/unit/J)#
JOULE_PER_MOLE = TetraUnit(JoulePerMole, joule / mole, None)#
KELVIN = TetraUnit(Kelvin, kelvin, http://qudt.org/vocab/unit/K)#
KILOCALORIE_PER_MOLE = TetraUnit(KilocaloriePerMole, kilocalorie / mole, http://qudt.org/vocab/unit/KiloCAL-PER-MOL)#
KILOCOUNT_PER_SECOND = TetraUnit(KilocountPerSecond, kilocount / second, None)#
KILODALTON = TetraUnit(KiloDalton, kilodalton, None)#
KILOGRAM = TetraUnit(Kilogram, kilogram, http://qudt.org/vocab/unit/KiloGM)#
KILOGRAM_PER_CUBIC_METER = TetraUnit(KilogramPerCubicMeter, kilogram / (meter ** 3), http://qudt.org/vocab/unit/KiloGM-PER-M3)#
KILOGRAM_PER_METER = TetraUnit(KilogramPerMeter, kilogram / meter, http://qudt.org/vocab/unit/KiloGM-PER-M)#
KILOGRAM_PER_MOLE = TetraUnit(KilogramPerMole, kilogram / mole, http://qudt.org/vocab/unit/KiloGM-PER-MOL)#
KILOGRAM_PER_SQUARE_METER = TetraUnit(KilogramPerSquareMeter, kilogram / (meter ** 2), http://qudt.org/vocab/unit/KiloGM-PER-M2)#
KILOJOULE_PER_MOLE = TetraUnit(KiloJoulePerMole, kilojoule / mole, None)#
KILOPOND = TetraUnit(KiloPond, kilopond, http://qudt.org/vocab/unit/KiloPOND)#
KILOVOLT = TetraUnit(KiloVolt, kilovolt, http://purl.allotrope.org/ontology/qudt-ext/unit#KiloVolt)#
LIGHT_SCATTERING_UNIT = TetraUnit(LightScatteringUnit, None, None)#
LITER = TetraUnit(Liter, liter, http://qudt.org/vocab/unit/L)#
LITER_PER_HOUR = TetraUnit(LiterPerHour, liter / hour, None)#
LITER_PER_MINUTE = TetraUnit(LiterPerMinute, liter / minute, http://purl.allotrope.org/ontology/qudt-ext/unit#LiterPerMinute)#
LITER_PER_SQUARE_METER = TetraUnit(LiterPerSquareMeter, liter / (meter ** 2), None)#
LMH_PER_PSI = TetraUnit(LiterPerSquareMeterPerHourPerPoundPerSquareInch, liter / ((meter**2) * hour * psi), None)#
LITER_PER_SQUARE_METER_PER_MINUTE = TetraUnit(LiterPerSquareMeterPerMinute, liter / ((meter**2) * minute), None)#
LITER_PER_SQUARE_METER_PER_HOUR = TetraUnit(LiterPerSquareMeterPerHour, liter / ((meter**2) * hour), None)#
MEGAHERTZ = TetraUnit(MegaHertz, megahertz, http://qudt.org/vocab/unit/MegaHZ)#
MEGAPASCAL = TetraUnit(MegaPascal, megapascal, http://purl.allotrope.org/ontology/qudt-ext/unit#MegaPascal)#
METER = TetraUnit(Meter, meter, http://qudt.org/vocab/unit/M)#
METER_PER_SECOND = TetraUnit(MeterPerSecond, meter / second, http://qudt.org/vocab/unit/M-PER-SEC)#
METER_PER_SECOND_SQUARED = TetraUnit(MeterPerSecondSquared, meter / (second ** 2), http://qudt.org/vocab/unit/M-PER-SEC2)#
MICROGRAM = TetraUnit(Microgram, microgram, http://purl.allotrope.org/ontology/qudt-ext/unit#Microgram)#
MICROGRAM_PER_MILLILITER = TetraUnit(MicrogramPerMilliliter, microgram / milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#MicrogramPerMilliliter)#
MICROGRAM_PER_LITER = TetraUnit(MicrogramPerLiter, microgram / liter, http://purl.allotrope.org/ontology/qudt-ext/unit#MicrogramPerLiter)#
MICROLITER = TetraUnit(Microliter, microliter, http://purl.allotrope.org/ontology/qudt-ext/unit#Microliter)#
MICROLITER_PER_MINUTE = TetraUnit(MicroliterPerMinute, microliter / minute, http://purl.allotrope.org/ontology/qudt-ext/unit#MicroliterPerMinute)#
MICROMETER = TetraUnit(Micrometer, micrometer, http://qudt.org/vocab/unit/MicroM)#
MICROMOLE = TetraUnit(Micromole, micromole, http://purl.allotrope.org/ontology/qudt-ext/unit#Micromole)#
MICROMOLAR = TetraUnit(Micromolar, micromolar, http://purl.allotrope.org/ontology/qudt-ext/unit#Micromolar)#
MICROSECOND = TetraUnit(MicroSecond, microsecond, http://qudt.org/vocab/unit/MicroSEC)#
MICROVOLT = TetraUnit(Microvolt, microvolt, http://purl.allotrope.org/ontology/qudt-ext/unit#Microvolt)#
MILLI_ABSORBANCE_UNIT = TetraUnit(MilliAbsorbanceUnit, None, http://purl.allotrope.org/ontology/qudt-ext/unit#MilliAbsorbanceUnit)#
MILLI_ABSORBANCE_UNIT_TIMES_MINUTE = TetraUnit(MilliAbsorbanceUnitTimesMinute, None, http://purl.allotrope.org/ontology/qudt-ext/unit#MilliAbsorbanceUnitTimesMinute)#
MILLI_ABSORBANCE_UNIT_TIMES_MILLILITER = TetraUnit(MilliAbsorbanceUnitTimesMilliliter, None, None)#
MILLIAMPERE = TetraUnit(MilliAmpere, milliampere, http://purl.allotrope.org/ontology/qudt-ext/unit#MilliAmpere)#
MILLIDEGREE = TetraUnit(MilliDegreeAngle, millidegree, None)#
MILLIGRAM = TetraUnit(Milligram, milligram, http://purl.allotrope.org/ontology/qudt-ext/unit#Milligram)#
MILLIGRAM_PER_KILOGRAM = TetraUnit(MilligramPerKilogram, milligram / kilogram, http://purl.allotrope.org/ontology/qudt-ext/unit#MilligramPerKilogram)#
MILLIGRAM_PER_LITER = TetraUnit(MilligramPerLiter, milligram / liter, http://purl.allotrope.org/ontology/qudt-ext/unit#MilligramPerLiter)#
MILLIGRAM_PER_MILLILITER = TetraUnit(MilligramPerMilliliter, milligram / milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#MilligramPerMilliliter)#
MILLILITER = TetraUnit(Milliliter, milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#Milliliter)#
MILLILITER_PER_GRAM = TetraUnit(MilliliterPerGram, milliliter / gram, None)#
MILLILITER_PER_MILLIGRAM_CENTIMETER = TetraUnit(MilliliterPerMilligramCentimeter, milliliter / (milligram * centimeter), None)#
MILLILITER_PER_MINUTE = TetraUnit(MilliliterPerMinute, milliliter / minute, http://purl.allotrope.org/ontology/qudt-ext/unit#MilliliterPerMinute)#
MILLILITER_PER_SECOND = TetraUnit(MilliliterPerSecond, milliliter / second, http://purl.allotrope.org/ontology/qudt-ext/unit#MilliliterPerSecond)#
MILLIMETER = TetraUnit(Millimeter, millimeter, http://qudt.org/vocab/unit/MilliM)#
MILLIMETER_OF_MERCURY = TetraUnit(MillimeterOfMercury, millimeter_Hg, http://qudt.org/vocab/unit/MilliM_HG)#
MILLIMETER_PER_SECOND_SQUARED = TetraUnit(MillimeterPerSecondSquared, millimeter / (second ** 2), None)#
MILLIMOLAR = TetraUnit(Millimolar, millimolar, http://purl.allotrope.org/ontology/qudt-ext/unit#Millimolar)#
MILLIMOLE = TetraUnit(Millimole, millimole, http://purl.allotrope.org/ontology/qudt-ext/unit#Millimole)#
MILLIMOLE_PER_LITER = TetraUnit(MillimolePerLiter, millimole / liter, http://purl.allotrope.org/ontology/qudt-ext/unit#MillimolePerLiter)#
MILLINORMAL = TetraUnit(MilliNormal, None, None)#
MILLION_CELLS_PER_MILLILITER = TetraUnit(MillionCellsPerMilliliter, megacount / milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#MillionCellsPerMilliliter)#
MILLIOSMOLE_PER_KILOGRAM = TetraUnit(MilliOsmolePerKilogram, None, None)#
MILLIPASCAL_SECOND = TetraUnit(MillipascalSecond, millipascal * second, None)#
MILLISECOND = TetraUnit(MilliSecond, millisecond, http://qudt.org/vocab/unit/MilliSEC)#
MILLISIEMEN = TetraUnit(Millisiemens, millisiemens, None)#
MILLISIEMENS_PER_CM = TetraUnit(MillisiemensPerCentimeter, millisiemens / centimeter, http://purl.allotrope.org/ontology/qudt-ext/unit#MillisiemenPerCentimeter)#
MILLIVOLT = TetraUnit(MilliVolt, millivolt, http://purl.allotrope.org/ontology/qudt-ext/unit#Millivolt)#
MILLIVOLT_PER_PH = TetraUnit(MillivoltPerPH, None, None)#
MILLIWATT = TetraUnit(MilliWatt, milliwatt, http://purl.allotrope.org/ontology/qudt-ext/unit#MilliWatt)#
MINUTE_TIME = TetraUnit(MinuteTime, minute, http://qudt.org/vocab/unit/MIN)#
MINUTE_TIME_SQUARED = TetraUnit(MinuteTimeSquared, minute ** 2, None)#
MOLE = TetraUnit(Mole, mole, http://qudt.org/vocab/unit/MOL)#
MOLAR = TetraUnit(Molar, molar, http://purl.allotrope.org/ontology/qudt-ext/unit#Molar)#
MOLE_FRACTION = TetraUnit(MoleFraction, None, None)#
NANOAMPERE = TetraUnit(NanoAmpere, nanoampere, http://purl.allotrope.org/ontology/qudt-ext/unit#NanoAmpere)#
NANOGRAM = TetraUnit(Nanogram, nanogram, http://purl.allotrope.org/ontology/qudt-ext/unit#Nanogram)#
NANOGRAM_PER_MICROLITER = TetraUnit(NanogramPerMicroliter, nanogram / microliter, http://purl.allotrope.org/ontology/qudt-ext/unit#NanogramPerMicroliter)#
NANOGRAM_PER_MILLILITER = TetraUnit(NanogramPerMilliliter, nanogram / milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#NanogramPerMilliliter)#
NANOGRAM_PER_LITER = TetraUnit(NanogramPerLiter, nanogram / liter, http://purl.allotrope.org/ontology/qudt-ext/unit#NanogramPerLiter)#
NANOMETER = TetraUnit(Nanometer, nanometer, http://purl.allotrope.org/ontology/qudt-ext/unit#Nanometer)#
NANOMETERPERMINUTE = TetraUnit(NanometerPerMinute, nanometer / minute, None)#
NANOMOLAR = TetraUnit(Nanomolar, nanomolar, http://purl.allotrope.org/ontology/qudt-ext/unit#Nanomolar)#
NANOLITER = TetraUnit(Nanoliter, nanoliter, http://purl.allotrope.org/ontology/qudt-ext/unit#Nanoliter)#
NANOMOLE = TetraUnit(Nanomole, nanomole, http://purl.allotrope.org/ontology/qudt-ext/unit#Nanomole)#
NANOSECOND = TetraUnit(NanoSecond, nanosecond, None)#
NEWTON = TetraUnit(Newton, newton, http://qudt.org/vocab/unit/N)#
OHM = TetraUnit(Ohm, ohm, http://qudt.org/vocab/unit/OHM)#
OSMOLE = TetraUnit(Osmole, None, None)#
OSMOLE_PER_KILOGRAM = TetraUnit(OsmolePerKilogram, None, None)#
OSMOLE_PER_LITER = TetraUnit(OsmolesPerLiter, None, http://purl.allotrope.org/ontology/qudt-ext/unit#OsmolesPerLiter)#
PARTS_PER_MILLION = TetraUnit(PartsPerMillion, ppm, http://purl.allotrope.org/ontology/qudt-ext/unit#PartsPerMillion)#
PASCAL = TetraUnit(Pascal, pascal, http://qudt.org/vocab/unit/PA)#
PASCAL_SECOND = TetraUnit(PascalSecond, pascal * second, http://qudt.org/vocab/unit/PA-SEC)#
PERCENT = TetraUnit(Percent, percent, http://qudt.org/vocab/unit/PERCENT)#
PERCENT_VOLUME = TetraUnit(PercentVolume, None, None)#
PERMITTIVITY#

A class to represent a deprecated unit in the TetraScience Unit Vocabulary

PER_SECOND = TetraUnit(PerSecond, 1 / second, http://qudt.org/vocab/unit/PER-SEC)#
PICOGRAM = TetraUnit(Picogram, picogram, http://purl.allotrope.org/ontology/qudt-ext/unit#Picogram)#
PICOGRAM_PER_MILLILITER = TetraUnit(PicogramPerMilliliter, picogram / milliliter, http://purl.allotrope.org/ontology/qudt-ext/unit#PicogramPerMilliliter)#
PICOGRAM_PER_LITER = TetraUnit(PicogramPerLiter, picogram / liter, http://purl.allotrope.org/ontology/qudt-ext/unit#PicogramPerLiter)#
PICOMETER = TetraUnit(Picometer, picometer, http://purl.allotrope.org/ontology/qudt-ext/unit#Picometer)#
PICOMOLE = TetraUnit(Picomole, picomole, http://purl.allotrope.org/ontology/qudt-ext/unit#Picomole)#
PICOMOLAR = TetraUnit(Picomolar, picomolar, http://purl.allotrope.org/ontology/qudt-ext/unit#Picomolar)#
POISE = TetraUnit(Poise, poise, http://qudt.org/vocab/unit/POISE)#
POUND_PER_SQUARE_FOOT = TetraUnit(PoundPerSquareFoot, pound / foot ** 2, http://qudt.org/vocab/unit/LB_F-PER-FT2)#
POUND_PER_SQUARE_INCH = TetraUnit(PoundPerSquareInch, psi, http://qudt.org/vocab/unit/LB_F-PER-IN2)#
RADIAN = TetraUnit(Radian, radian, http://qudt.org/vocab/unit/RAD)#
RECIPROCAL_CENTIMETER = TetraUnit(ReciprocalCentimeter, reciprocal_centimeter, http://purl.allotrope.org/ontology/qudt-ext/unit#ReciprocalCentimeter)#
RECIPROCAL_MINUTE#

A class to represent a deprecated unit in the TetraScience Unit Vocabulary

PER_MINUTE = TetraUnit(PerMinute, 1 / minute, http://purl.allotrope.org/ontology/qudt-ext/unit#PerMinute)#
RELATIVE_PERMITTIVITY = TetraUnit(RelativePermittivity, None, http://purl.allotrope.org/ontology/qudt-ext/unit#Unitless)#
REVOLUTION_PER_HOUR = TetraUnit(RevolutionPerHour, revolution / hour, http://qudt.org/vocab/unit/REV-PER-HR)#
REVOLUTION_PER_MINUTE = TetraUnit(RevolutionPerMinute, rpm, http://qudt.org/vocab/unit/REV-PER-MIN)#
REVOLUTION_PER_SECOND = TetraUnit(RevolutionPerSecond, rps, http://qudt.org/vocab/unit/REV-PER-SEC)#
SECOND_TIME = TetraUnit(SecondTime, second, http://qudt.org/vocab/unit/SEC)#
SIEMENS_PER_CENTIMETER_SECOND = TetraUnit(SiemensPerCentimeterSecond, siemens / (centimeter * second), None)#
SQUARE_CENTIMETER = TetraUnit(SquareCentimeter, centimeter ** 2, http://qudt.org/vocab/unit/CentiM2)#
SQUARE_CENTIMETER_PER_SECOND = TetraUnit(SquareCentimeterPerSecond, centimeter ** 2 / second, None)#
SQUARE_METER = TetraUnit(SquareMeter, meter ** 2, http://qudt.org/vocab/unit/M2)#
SQUARE_METER_PER_GRAM = TetraUnit(SquareMeterPerGram, meter ** 2 / gram, None)#
SQUARE_MICROMETER = TetraUnit(SquareMicrometer, micrometer ** 2, http://qudt.org/vocab/unit/MicroM2)#
SQUARE_ROOT_MEGAPASCAL = TetraUnit(SquareRootMegaPascal, megapascal ** 0.5, None)#
TON_OF_REFRIGERATION = TetraUnit(TonOfRefrigeration, None, http://qudt.org/vocab/unit/TON_FG)#
TORR = TetraUnit(Torr, torr, http://qudt.org/vocab/unit/TORR)#
UNITLESS = TetraUnit(Unitless, 1, http://purl.allotrope.org/ontology/qudt-ext/unit#Unitless)#
ENZYME_UNIT_PER_LITER = TetraUnit(InternationalUnitPerLiter, enzyme_unit / liter, http://qudt.org/vocab/unit/ENZ-PER-L)#
VOLT = TetraUnit(Volt, volt, http://qudt.org/vocab/unit/V)#
VOXEL = TetraUnit(Voxel, None, None)#
WATT = TetraUnit(Watt, watt, http://qudt.org/vocab/unit/W)#
classmethod get_all_units() Dict[str, TetraUnit][source]#

Get all units in the library

classmethod contains(ts_format: str) bool[source]#

Check if a unit is in the library

classmethod get(ts_format: str) TetraUnit[source]#

Get a unit by its ts_string

class UnitParser(mappings: Mapping[Hashable, str | None] | List[Mapping[Hashable, str | None]])[source]#

Bases: object

Class for parsing raw unit strings to standard unit strings

unmapped_units: Set[Hashable] = {}#
mapping: Mapping[Hashable, str | None] = {}#
parse(raw_unit: str | None) str | None[source]#

Parse a raw unit string to a standard unit string

If the raw unit string is not found in the mappings, it is returned as-is and is added to the unmapped_units set.

Parameters:

raw_unit (str) – Raw unit string

Returns:

Standard unit string

Return type:

str