units module#

JITX uses the Pint library for units where applicable. Currently the support is limited, and primarily used for component values, but will be expanded over time.

The unit registry and shorthand units are available here.

rkm_code(value=None, /, *, digits=3, iec=False)[source]#

Render a quantity as an RKM code (IEC 60062): 4k7, 2n2, R47, 3V3.

Overloads:
  • value (PlainQuantity), /, *, digits (int) = 3, iec (bool) = False → str

  • *, digits (int) = 3, iec (bool) = False → Callable[[PlainQuantity], str]

Parameters:
  • value (PlainQuantity | None)

  • digits (int)

  • iec (bool)

The prefix letter takes the place of the decimal point, so the value survives a marking or a scan that would lose the point. Note that the unit is implied by context whenever a prefix letter is used: 1m is a milliohm, a milliamp or a millihenry depending on the part.

digits is significant digits; iec switches resistance to the standard’s uppercase spelling, 4K7 and 4L7. A dimension with no letter of its own falls back to the default value-string rendering.

If given no value, only options, a function is returned accepting a quantity, which can be used with valuestring() for example.

valuestring(value, quantity=None)[source]#

Common best-practice component-value-to-string conversion.

Parameters:
  • value (str | PlainQuantity) – the to component value to convert to a string

  • quantity (Callable[[PlainQuantity], str] | None) – optional rendering mechanism, e.g. rkm_code()