2022-02-10T13:26:00Z spectral-line-identification A mixin and other support material for LineTAP. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 True True ivo://ivoa.net/std/linetap#lines-1.0 # turn our LineTAP columns into apply params mixin = context.getById("table-0") dicts = [{}] for type, name, content, _ in mixin.events.events_: if type=="value": dicts[-1][name] = content elif type=="start": dicts.append({}) elif type=="end": res = dicts.pop() if name=="column": res["default"] = ( "" if res.get("required", False) else "None") if res.get("unit"): res["description"] += " (in {})".format(res["unit"]) yield res \default base.NotGiven INCHILIB = linetap.getILib() if inchikey is base.NotGiven: inchikey = INCHILIB.getInChIKey(inchi) vars.update(locals()) @element @ion_charge ... @inchi The apply caches the computed InChI; there is no need to do extra caching. ]]> 0 INCHILIB = linetap.getILib() def getInChI(element, charge): iin = INCHILIB.getInput([ INCHILIB.getAtom(element, charge=charge)]) return INCHILIB.getInChI(iin) getInChI = functools.cache(getInChI) @inchi = getInChI(element, charge)