catalog module#
What the catalogue calls things#
The static half of the translation, shared by both sources in this package: which parameter name carries a JITX query key, and what unit the API states that parameter’s numbers in.
LCSC and JLCPCB are two front ends over one catalogue, so this table serves both. The parameter names are the same on either side, with the two exceptions aliases exists for. What is not shared is how a catalogue is identified - an LCSC wmCatalogId against a JLCPCB (first, second) sort pair - so each source module owns its own id table, keyed by Category.key.
Numbers come back in the parameter’s own standard unit rather than in an SI base unit: a capacitance in pF, an inductance in uH, a resistance in ohms. The response declares which in its unit list, and that declaration is what the values are read with; Param.unit and Param.scale are the fallback for a parameter stated without one, which is how a temperature coefficient in ppm is handled.
The parameter tables are not exhaustive. They name the parameters a JITX passive query can ask about; a catalogue reports plenty more, and those reach the component through the payload rather than being queryable.
- class Param(name, unit=None, scale=1.0, span=False, aliases=())[source]#
Bases:
objectOne queryable catalogue parameter.
- Parameters:
name (
str) – the parameter name as the filter vocabulary spells it. This is the spelling that goes into a request.unit (
str|None) – unit to read the numbers in when the API declares none, or None for a text parameter.scale (
float) – factor from the API’s number to unit, on that same fallback path.span (
bool) – whether the option is a symmetric range, such as a tolerance, in which case its magnitude is the half width rather than an endpoint.aliases (
tuple[str,...]) – other spellings the same parameter goes by, tried when reading a row. Needed because the two sources disagree in two places, and because JLCPCB itself spells saturation current with an extra space in a row than in its own vocabulary.
- class Category(key, name, params, polarized=False)[source]#
Bases:
objectHow one JITX category maps onto the catalogue’s vocabulary.
- Parameters:
key (
str) – this category’s name in a source’s catalogue id table. Distinct from name because polarized and ceramic capacitors are one JITX category served by two different sets of catalogues.name (
str) – the JITX category these catalogues serve.params (
dict[str,Param]) – JITX query key to the parameter carrying it.polarized (
bool) – whether parts from these catalogues are polarized.
- pint_unit(symbol)[source]#
A unit the registry understands, from the catalogue’s spelling of one.
None when the symbol is not a unit this package recognizes, which is how a parameter whose values are text rather than measurements stays text.
- quantity(magnitude, unit)[source]#
A quantity in engineering notation, as it should read on a schematic.
A raw base-unit number is unreadable on a drawing: 1e-07 F is not what anyone calls that part. to_compact picks the prefix, and the rounding is because the rescale is a float division that lands on 99.99999999999999 nanofarad without it.