value2node#
- pyxem.utils.calibration.value2node(value: str | Quantity | int | float, metadata: DictionaryTreeBrowser, metadata_key: str, standard_unit: str | Unit = None) Quantity [source]#
Convert a value to a pint.Quantity and store it in the metadata along with a unit.
- Parameters:
value – The value to convert. This can be a string, pint.Quantity, or a number.
metadata (hs.metadata.Metadata) – The metadata object to store the value in.
metadata_key – The metadata key to store the value in.
standard_unit – The standard unit to convert to. If not provided, it will use the unit from the value if it is a pint.Quantity, or raise an error if the value is a number.