Example #1
0
    def display(self, ad, fid=None):
        '''
        
        
        @param ad: The astrodata to display.
        @type ad: AstroData
        '''
        
        # do stack id and astrodata what nots.
#        print 'GDS 66:'
        if type(ad) is not astrodata.AstroData:
            ad = AstroData( ad )
        desc = Descriptors.get_calculator( ad )
        
        displayfunc = desc.fetch_value( 'display', ad )
        
        if displayfunc is None:
            # This occurs when there is specific display function for the given tool.
            # (i.e. it is using the default display descriptor).
            displayfunc = self.ds9.displayFile
        
        if fid is None:
            fid = self.getDisplayID( ad )
        
        self.ds9.frame( fid )
        framenumber = self.ds9[fid]
        
        if self.ds9.pyds9_sup:
            self.ds9.set( 'regions delete all' )
        
        displayfunc( ad.filename, frame=framenumber, fl_imexam=False,
                     Stdout = coi.get_iraf_stdout(), Stderr = coi.get_iraf_stderr())
 def __init__( self, ad, ell_mean, ell_sigma, fwhm_mean, fwhm_sigma ):
     from astrodata import Descriptors
     
     super( ImageQualityRequest, self ).__init__()
     #
     self.ad = ad
     self.filename = ad.filename
     self.ellMean = ell_mean
     self.ellSigma = ell_sigma
     self.fwhmMean = fwhm_mean
     self.fwhmSigma = fwhm_sigma
     desc = Descriptors.get_calculator( ad )
     self.pixelScale = ad.pixel_scale().as_pytype()
     self.seeing = self.fwhmMean * self.pixelScale
    def search( self, cal_rq ):
        '''
        Searches the various fits files collecting valid calibrations and eventually returning a
        sorted list of based on the priorities.
        
        @param cal_rq: The Calibration Request. For this localized version, it contains only the most
        critical information, but on the PRS, this would be a message.
        @type cal_rq: CalibrationRequest instance.
        
        @return: A sorted list of calibration pathnames.
        @rtype: list
        '''
        from astrodata import Descriptors
        inputfile = cal_rq.filename
        urilist = []     
        
        # print "LCS73:", self.calList
        
        for calfile in self.calList:
                
            # print "CS90: Checking if '" + calfile + "' is viable."
            ad = AstroData( calfile )
            desc = Descriptors.get_calculator( ad )
            
            if not self.search_identifiers( cal_rq.identifiers, desc, ad ):
                # print "FAILED IDENTIFIERS"
                continue
            if not self.search_criteria( cal_rq.criteria, desc, ad ):
                # print "FAILED CRITERIA"
                continue

            # print "CS98: This '" + calfile + "' succeeded!"
            urilist.append( (calfile, desc, ad) )
            
        urilist = self.sort_priority( urilist, cal_rq.priorities )
        
        #print "CS96 urilist --\n", urilist
        if urilist == []:
            # Nothing found, return None
            return None
              
        return urilist
 def _lazyloadCalculator(self, **args):
     '''Function to put at top of all descriptor members
     to ensure the descriptor is loaded.  This way we avoid
     loading it if it is not needed.'''
     if self.descriptor_calculator is None:
         self.descriptor_calculator = Descriptors.get_calculator(self, **args)