def find_resistor(resistance, footprint, device="RES SMD", wattage=None): # TODO This should return a symbol instead, and usages should be adapted # accordingly to make consistent with find_capacitor if isinstance(resistance, str): try: resistance = Resistance(resistance) except ValueError: raise NoGedaSymbolException(resistance) if isinstance(resistance, Resistance): resistance = resistance._value if footprint[0:3] == "MY-": footprint = footprint[3:] if device == "RES THRU": resistances = iec60063.gen_vals(iec60063.get_series("E24"), iec60063.res_ostrs) if resistance in [parse_resistance(x) for x in resistances]: return construct_resistor(normalize_resistance(resistance), "0.25W") # noqa else: raise NoGedaSymbolException(resistance, device) for symbol in gsymlib: if symbol.device == device and symbol.footprint == footprint: res, watt = parse_resistor(symbol.value) sym_resistance = parse_resistance(res) if resistance == sym_resistance: return symbol.value raise NoGedaSymbolException(resistance)
def __init__(self, series, stype, start=None, end=None, device=None, footprint=None): super(IEC60063ValueSeries, self).__init__(stype, start, end, device, footprint) self._series = iec60063.get_series(series) self._ostrs = iec60063.get_ostr(stype)
def get_iec60063_contextpart(stype, series, start=None, end=None): return { "iec60063vals": [ i for i in iec60063.gen_vals( iec60063.get_series(series), iec60063.get_ostr(stype), start, end # noqa # noqa ) ], "iec60063stype": stype, "iec60063series": series, "iec60063start": start, "iec60063end": end, }
def get_iec60063_contextpart(stype, series, start=None, end=None): return { "iec60063vals": [ i for i in iec60063.gen_vals( iec60063.get_series(series), # noqa iec60063.get_ostr(stype), # noqa start, end) ], "iec60063stype": stype, "iec60063series": series, "iec60063start": start, "iec60063end": end, }