示例#1
0
 def storeProcessedFringe(self, adinputs=None, suffix=None):
     caltype = 'processed_fringe'
     self.log.debug(gt.log_message("primitive", self.myself(), "starting"))
     adinputs = gt.convert_to_cal_header(adinput=adinputs, caltype="fringe",
                                       keyword_comments=self.keyword_comments)
     adinputs = self._markAsCalibration(adinputs, suffix=suffix,
             primname=self.myself(), keyword="PROCFRNG", update_datalab=False)
     self.storeCalibration(adinputs, caltype=caltype)
     return adinputs
示例#2
0
 def storeBPM(self, adinputs=None, suffix=None):
     caltype = 'bpm'
     self.log.debug(gt.log_message("primitive", self.myself(), "starting"))
     adinputs = gt.convert_to_cal_header(adinput=adinputs, caltype="bpm",
                                         keyword_comments=self.keyword_comments)
     adinputs = self._markAsCalibration(adinputs, suffix=suffix,
                                        primname=self.myself(), update_datalab=False, keyword="BPM")
     self.storeCalibration(adinputs, caltype=caltype)
     return adinputs
示例#3
0
 def storeBPM(self, adinputs=None, suffix=None):
     caltype = 'bpm'
     self.log.debug(gt.log_message("primitive", self.myself(), "starting"))
     adinputs = gt.convert_to_cal_header(adinput=adinputs, caltype="bpm",
                                         keyword_comments=self.keyword_comments)
     adinputs = self._markAsCalibration(adinputs, suffix=suffix,
                 primname=self.myself(), update_datalab=False, keyword="BPM")
     self.storeCalibration(adinputs, caltype=caltype)
     return adinputs
示例#4
0
 def storeProcessedFlat(self, adinputs=None, suffix=None, force=False):
     caltype = 'processed_flat'
     self.log.debug(gt.log_message("primitive", self.myself(), "starting"))
     if force:
         adinputs = gt.convert_to_cal_header(adinput=adinputs, caltype="flat",
                                             keyword_comments=self.keyword_comments)
     adinputs = self._markAsCalibration(adinputs, suffix=suffix,
                                        primname=self.myself(), keyword="PROCFLAT")
     self.storeCalibration(adinputs, caltype=caltype)
     return adinputs
示例#5
0
 def storeProcessedFlat(self, adinputs=None, suffix=None, force=False):
     caltype = 'processed_flat'
     self.log.debug(gt.log_message("primitive", self.myself(), "starting"))
     if force:
         adinputs = gt.convert_to_cal_header(adinput=adinputs, caltype="flat",
                                             keyword_comments=self.keyword_comments)
     adinputs = self._markAsCalibration(adinputs, suffix=suffix,
                                 primname=self.myself(), keyword="PROCFLAT")
     self.storeCalibration(adinputs, caltype=caltype)
     return adinputs
示例#6
0
    def storeProcessedFringe(self, adinputs=None, suffix=None):
        caltype = 'processed_fringe'
        self.log.debug(gt.log_message("primitive", self.myself(), "starting"))

        # We only need to do this if we're uploading to the archive so the OBSTYPE
        # is set to FRINGE and OBSID, etc., are obscured. The frame will be tagged
        # as FRINGE and available locally.
        if self.upload and 'calibs' in self.upload:
            adinputs = gt.convert_to_cal_header(adinput=adinputs, caltype="fringe",
                                                keyword_comments=self.keyword_comments)
        adinputs = self._markAsCalibration(adinputs, suffix=suffix,
                                           primname=self.myself(), keyword="PROCFRNG", update_datalab=False)
        self.storeCalibration(adinputs, caltype=caltype)
        return adinputs
示例#7
0
 def storeProcessedFringe(self, adinputs=None, suffix=None):
     caltype = 'processed_fringe'
     self.log.debug(gt.log_message("primitive", self.myself(), "starting"))
     adinputs = gt.convert_to_cal_header(
         adinput=adinputs,
         caltype="fringe",
         keyword_comments=self.keyword_comments)
     adinputs = self._markAsCalibration(adinputs,
                                        suffix=suffix,
                                        primname=self.myself(),
                                        keyword="PROCFRNG",
                                        update_datalab=False)
     self.storeCalibration(adinputs, caltype=caltype)
     return adinputs
    def makeFlat(self,rc):

        # Instantiate the log
        log = logutils.get_logger(__name__)
        
        # Define the keyword to be used for the time stamp
        timestamp_key = self.timestamp_keys["makeFlat"]

        # Log the standard "starting primitive" debug message
        log.debug(gt.log_message("primitive", "makeFlat", "starting"))
                
        # Initialize the list of output AstroData objects
        adoutput_list = []

        # Check if inputs prepared
        for ad in rc.get_inputs_as_astrodata():
            if "PREPARED" not in ad.types:
                raise Errors.InputError("%s must be prepared" % ad.filename)

        # Instantiate ETI and then run the task 
        gsflat_task = eti.gsflateti.GsflatETI(rc)
        adout = gsflat_task.run()

        # Set any zero-values to 1 (to avoid dividing by zero)
        for sciext in adout["SCI"]:
            sciext.data[sciext.data==0] = 1.0

        # Blank out any position or program information in the
        # header (spectroscopy flats are often taken with science data)
        adout = gt.convert_to_cal_header(adinput=adout,caltype="flat")[0]

        # Add the appropriate time stamps to the PHU
        gt.mark_history(adinput=adout, keyword=timestamp_key)

        adoutput_list.append(adout)

        # Report the list of output AstroData objects to the reduction
        # context
        rc.report_output(adoutput_list)
        
        yield rc
 def storeProcessedFringe(self, rc):
     # Instantiate the log
     log = logutils.get_logger(__name__)
     
     # Log the standard "starting primitive" debug message
     log.debug(gt.log_message("primitive", "storeProcessedFringe",
                              "starting"))
     
     # Initialize the list of output AstroData objects
     adoutput_list = []
     
     # Loop over each input AstroData object in the input list
     for ad in rc.get_inputs_as_astrodata():
         
         # Updating the file name with the suffix for this primitive and
         # then report the new file to the reduction context
         ad.filename = gt.filename_updater(adinput=ad, suffix=rc["suffix"],
                                           strip=True)
         
         # Sanitize the headers of the file so that it looks like
         # a public calibration file rather than a science file
         ad = gt.convert_to_cal_header(adinput=ad, caltype="fringe")[0]
         
         # Adding a PROCFRNG time stamp to the PHU
         gt.mark_history(adinput=ad, keyword="PROCFRNG")
         
         # Refresh the AD types to reflect new processed status
         ad.refresh_types()
         
         adoutput_list.append(ad)
     
     # Upload to cal system
     rc.run("storeCalibration")
     
     # Report the list of output AstroData objects to the reduction
     # context
     rc.report_output(adoutput_list)
     
     yield rc