コード例 #1
0
ファイル: utils.py プロジェクト: jhunkeler/crds
def file_to_instrument(filename):
    """Given reference or dataset `filename`,  return the associated instrument.
    A key aspect of this function versus get_file_properties() is that observatory is not known.
    """
    basename = os.path.basename(filename).lower()
    for (_obs, instr) in observatory_instrument_tuples():
        if ("_" + instr + "_" in basename) or basename.startswith(instr + "_"):
            return instr.upper()
    from crds import data_file
    header = data_file.get_unconditioned_header(filename, needed_keys=tuple(INSTRUMENT_KEYWORDS))
    return header_to_instrument(header)
コード例 #2
0
ファイル: utils.py プロジェクト: nden/crds
def file_to_instrument(filename):
    """Given reference or dataset `filename`,  return the associated instrument.
    A key aspect of this function versus get_file_properties() is that observatory is not known.
    """
    basename = os.path.basename(filename).lower()
    for (_obs, instr) in observatory_instrument_tuples():
        if ("_" + instr + "_" in basename) or basename.startswith(instr + "_"):
            return instr.upper()
    from crds import data_file
    header = data_file.get_unconditioned_header(filename, needed_keys=INSTRUMENT_KEYWORDS)
    return header_to_instrument(header)
コード例 #3
0
ファイル: list.py プロジェクト: jaytmiller/crds
 def _cat_header(self, path):
     """Dump out the header associated with a reference file."""
     old = config.ALLOW_SCHEMA_VIOLATIONS.set(True)
     header = data_file.get_unconditioned_header(path)
     if self.args.keywords:
         header2 = {}
         for keyword in header:
             for substr in self.args.keywords:
                 if substr in keyword:
                     header2[keyword] = header[keyword]
     else:
         header2 = header
     self._print_lines(path, _pp_lines(header2))
     config.ALLOW_SCHEMA_VIOLATIONS.set(old)
コード例 #4
0
 def _cat_header(self, path):
     """Dump out the header associated with a reference file."""
     old = config.ALLOW_SCHEMA_VIOLATIONS.set(True)
     header = data_file.get_unconditioned_header(path)
     if self.args.keywords:
         header2 = {}
         for keyword in header:
             for substr in self.args.keywords:
                 if substr in keyword:
                     header2[keyword] = header[keyword]
     else:
         header2 = header
     self._print_lines(path, _pp_lines(header2))
     config.ALLOW_SCHEMA_VIOLATIONS.set(old)