<jupyter_start><jupyter_text>Physical unitsAll variables in scipp have a physical unit.Variables are used for coordinates, labels, data, as well as attributes, i.e., all of these have a unit.When not specified explicitly the unit of a variable defaults to `scipp.units.dimensionless` (`scipp.units.one` is a shorter alias for this), i.e., the variable is considered dimensionless.`scipp.units` provides a number of pre-defined elementary units as well as operations between units.This can be used to create units that do not have a pre-defined identifier:<jupyter_code>import scipp as sc

length = sc.units.m
area = length * length
area
volume = length * length * length
volume
speed = length / sc.units.s
speed<jupyter_output><empty_output><jupyter_text>You can get a list of all predefined units (accessible through `sc.units`) with<jupyter_code>[unit for unit in dir(sc.units) if not unit.startswith('_')]<jupyter_output><empty_output><jupyter_text>Units can also be created directly from strings:<jupyter_code>sc.Unit('m/s')
sc.Unit('counts')<jupyter_output><empty_output><jupyter_text>To convert data between compatible units, such as `m` to `mm`, see [sc.to_unit](../generated/scipp.to_unit.rstscipp.to_unit).<jupyter_code>sc.to_unit(1 * sc.Unit('m'), 'mm')<jupyter_output><empty_output><jupyter_text>Supported Units Base UnitsAll SI base units are supported with the following names:Name | Unit---|---'m' | meter's' | second'kg' | kilogram'K' | kelvin'A' | ampere'mol' | mole'cd' | candela<jupyter_code>sc.Unit('K')<jupyter_output><empty_output><jupyter_text>In addition, these base units are supported for cases not covered by SI:name | Unit---|---'rad' | radian'count' | single object counting Derived unitsA great number of derived units can also be specified as arguments to `sc.Unit`.Some examples areName | Unit---|---'Hz' | hertz'J' | joule'V' | volt'W' | watt'angstrom' / 'Å' | ångström'eV' | electron volt'L' | liter'min' | minute'D' / 'day' | dayUnits can be modified with SI prefixes, for instance<jupyter_code>print(sc.Unit('mm'), sc.Unit('microsecond'), sc.Unit('micro s'), sc.Unit('MJ'))<jupyter_output><empty_output><jupyter_text>You can also specify exponents for units or exponentiate them explicitly:<jupyter_code>print(sc.Unit('m^2'), sc.Unit('m**2'), sc.Unit('m')**2)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup