Пример #1
0
    def updatemetadata(self,filename,runID=None,cpmetadata=True,reffileflag=True):
        if runID==None:
            runID=self.runID

        if cpmetadata:
            # Update output model with meta data from input
            with pyfits.open(filename) as tmp:
                tmp['PRIMARY'].header['SUBARRAY'] = 'FULL'
                tmp.writeto(filename,overwrite=True)
            dummy4hdr = models.DataModel(filename)
            self.outputmodel.update(dummy4hdr) #, primary_only=True)
            dummy4hdr.close()

        print('within nircam2ssb, runID is',runID)
        if runID in ['CRYO1','CRYO2','CRYO3','OLD_DET']:
            self.updatemetadata_CRYOX(runID,filename=filename)
        elif  runID in ['TUCSONNEW','TUCSON_PARTNUM']:
            self.updatemetadata_TUCSONNEW(runID,filename=filename,reffileflag=reffileflag)
        elif  runID in ['CV2']:
            self.updatemetadata_CV2(runID,filename=filename,reffileflag=reffileflag)
        elif runID in ['CV3']:
            self.updatemetadata_CV3(runID,filename=filename,reffileflag=reffileflag)
        elif runID in ['OTIS']:
            self.updatemetadata_CV3(runID,filename=filename,reffileflag=reffileflag)
        else:
            print('ERROR: runID=%s not yet implemented into "updatemetadata"' % runID)
            sys.exit(0)
Пример #2
0
def get_datamodels():
    try:
        from jwst import datamodels  # this is fatal.
    except ImportError:
        log.error(
            "CRDS requires installation of the 'jwst' package to operate on JWST files.")
        raise
    global MODEL
    if MODEL is None:
        with log.error_on_exception(
                "Failed constructing basic JWST DataModel"):
            MODEL = datamodels.DataModel()
    return datamodels
Пример #3
0
    def process(self, input_file):
        from jwst import datamodels

        with datamodels.open(input_file) as dm:
            self.ref_filename = self.get_reference_file(dm, 'flat')
        return datamodels.DataModel()
Пример #4
0
def _load_schema(schema_name=None):
    """Return the core data model schema."""
    from jwst import datamodels
    model = datamodels.DataModel(schema=schema_name)
    return model.schema