Did I find the right examples for you? yes no

All Samples(21)  |  Call(19)  |  Derive(0)  |  Import(2)

src/p/y/pyHMSA-0.1/pyhmsa/fileformat/exporter/emsa.py   pyHMSA(Download)
from pyhmsa.spec.condition.acquisition import AcquisitionPoint
from pyhmsa.type.numerical import convert_unit
# Globals and constants variables.
        if probe:
            if probe.beam_voltage is not None:
                beamkv = float(convert_unit('kV', probe.beam_voltage))
                lines += self._create_keyword_line('BEAMKV', beamkv)
            if probe.emission_current is not None:
                emission = float(convert_unit('uA', probe.emission_current))
            if probe.beam_current is not None:
                probecur = float(convert_unit('nA', probe.beam_current))
                lines += self._create_keyword_line('PROBECUR', probecur)
            if probe.beam_diameter is not None:
                beamdiam = float(convert_unit('nm', probe.beam_diameter))

src/p/y/pyHMSA-0.1/pyhmsa/type/test_numerical.py   pyHMSA(Download)
# Local modules.
from pyhmsa.type.numerical import convert_value, validate_dtype, convert_unit
# Globals and constants variables.
    def testconvert_unit(self):
        u = convert_value(5.0, 'km')
        v = convert_unit('m', u)
        self.assertAlmostEqual(5000.0, v, 4)
        self.assertEqual('m', v.unit)
        u = convert_value(5.0, 'km')
        v = convert_unit('km', u)
        self.assertEqual('km', v.unit)
        v = convert_unit('m', 5.0, 'km')
        self.assertAlmostEqual(5000.0, v, 4)