def get_pipelines(exp_type, cal_ver=None, context=None, observatory=None): """Given `exp_type`, calibration software version `cal_ver`, CRDS context name `context`, and project / `observatory name, return the list of calibration software pipeline names (.cfgs) used to process that `exp_type` under version `cal_ver`. """ assert context or observatory, "Must define one of `context` or `observatory`." locator = utils.get_locator_module(observatory) return locator.get_pipelines(exp_type, cal_ver, context)
def _get_reffile_tpninfos(observatory, refpath): """Load just the TpnInfo objects for `observatory` and the given `refpath`. This entails both "class" TpnInfo's from CDBS as well as TpnInfo objects derived from the JWST data models. """ locator = utils.get_locator_module(observatory) instrument, filekind = locator.get_file_properties(refpath) tpns = list(locator.get_all_tpninfos(instrument, filekind, "tpn")) tpns.extend(locator.get_extra_tpninfos(refpath)) return tpns
def get_reffile_tpninfos(observatory, refpath): """Load just the TpnInfo objects for `observatory` and the given `refpath`. This entails both "class" TpnInfo's from CDBS as well as TpnInfo objects derived from the JWST data models. """ locator = utils.get_locator_module(observatory) instrument, filekind = locator.get_file_properties(refpath) tpns = list(locator.get_all_tpninfos(instrument, filekind, "tpn")) tpns.extend(locator.get_extra_tpninfos(refpath)) return tpns
def load_all_type_constraints(observatory): """Load all the type constraint files from `observatory` package. There are constraints that apply to: ALL instruments and types ALL types of one instrument ALL instruments of one type One instrument and type Generally these should be thought of as designed for successive refinement, so all constraints are applied, but as their scope narrows they can become stricter. Since increasing strictness and refinement require more knowledge, the development order of the constraints mirrored that. However, in the (revised) loading below, constraints are loaded by order of decreasing strictness; this makes it possible to define strict constants/replacements early in the loading process and to apply those to customize the more generalized constraints loaded later. """ from crds.core import rmap, heavy_client pmap_name = heavy_client.load_server_info(observatory).operational_context pmap = rmap.get_cached_mapping(pmap_name) locator = utils.get_locator_module(observatory) for instr in pmap.selections: imap = pmap.get_imap(instr) for filekind in imap.selections: if imap.selections[filekind] == "N/A": continue try: suffix = locator.TYPES.filekind_to_suffix(instr, filekind) except Exception as exc: log.warning("Missing suffix coverage for", repr((instr, filekind)), ":", exc) else: locator.get_all_tpninfos( instr, suffix, "tpn") # With core schema, one type loads all locator.get_all_tpninfos( instr, suffix, "ld_tpn") # With core schema, one type loads all locator.get_all_tpninfos( "all", suffix, "tpn") # With core schema, one type loads all locator.get_all_tpninfos( "all", suffix, "ld_tpn") # With core schema, one type loads all locator.get_all_tpninfos(instr, "all", "tpn") locator.get_all_tpninfos(instr, "all", "ld_tpn") locator.get_all_tpninfos("all", "all", "tpn") locator.get_all_tpninfos("all", "all", "ld_tpn")
def load_all_type_constraints(observatory): """Load all the type constraint files from `observatory` package. There are constraints that apply to: ALL instruments and types ALL types of one instrument ALL instruments of one type One instrument and type Generally these should be thought of as designed for successive refinement, so all constraints are applied, but as their scope narrows they can become stricter. Since increasing strictness and refinement require more knowledge, the development order of the constraints mirrored that. However, in the (revised) loading below, constraints are loaded by order of decreasing strictness; this makes it possible to define strict constants/replacements early in the loading process and to apply those to customize the more generalized constraints loaded later. """ from crds.core import rmap, heavy_client pmap_name = heavy_client.load_server_info(observatory).operational_context pmap = rmap.get_cached_mapping(pmap_name) locator = utils.get_locator_module(observatory) for instr in pmap.selections: imap = pmap.get_imap(instr) for filekind in imap.selections: if imap.selections[filekind] == "N/A": continue try: suffix = locator.TYPES.filekind_to_suffix(instr, filekind) except Exception as exc: log.warning("Missing suffix coverage for", repr((instr, filekind)), ":", exc) else: locator.get_all_tpninfos(instr, suffix, "tpn") # With core schema, one type loads all locator.get_all_tpninfos(instr, suffix, "ld_tpn") # With core schema, one type loads all locator.get_all_tpninfos("all", suffix, "tpn") # With core schema, one type loads all locator.get_all_tpninfos("all", suffix, "ld_tpn") # With core schema, one type loads all locator.get_all_tpninfos(instr, "all", "tpn") locator.get_all_tpninfos(instr, "all", "ld_tpn") locator.get_all_tpninfos("all","all","tpn") locator.get_all_tpninfos("all","all","ld_tpn")
def locator(self): """Deferred evaluation do to import orders.""" return utils.get_locator_module(self.observatory) # pluggable by observatory
def get_tpn_path(tpn, observatory): """Return the absolute path to the `tpn` file belonging to `observatory`.""" locator = utils.get_locator_module(observatory) return locator.tpn_path(tpn)
def locator(self): """Deferred evaluation do to import orders.""" return utils.get_locator_module( self.observatory) # pluggable by observatory
def get_tpn_path(tpn, observatory): """Return the absolute path to the `tpn` file belonging to `observatory`.""" locator = utils.get_locator_module(observatory) return locator.tpn_path(tpn)