コード例 #1
0
    def __init__(self,newobs,ownIraf=0):
        self.modName    = string.split(string.split(str(self))[0],'.')[0][1:] # this is the module name
        self.newobs     = newobs                                              # new observation's name
        self.base       = path.Env()
        self.configdir  = self.base.getenv('CONFIGS')
        self.pardir     = self.base.getenv('PARS')
        self.ingestdir  = os.path.join(self.base.getenv('INGEST'), newobs)   # where it is in the INGEST dir
        self.newobspath = os.path.join(self.base.getenv('DATASETS'), newobs) # new observation's path under $PIPELINE/DATASETS
        self.newpar     = os.path.join(self.newobspath, 'par')               # parfile dir
        self.newfits    = os.path.join(self.newobspath, 'Images')            # the dir where all data is sent
        self.newcats    = os.path.join(self.newobspath, 'Catalogs')
        self.newalign   = os.path.join(self.newobspath, 'align')
        self.messagedir = os.path.join(self.newobspath, 'Messages')
        self.root       = self.newobspath
        self.ownIraf    = ownIraf
        self.errorList  = []
        self.inputList  = []
        self.outputList = {}                                                  # outputList is now a dictionary to accomodate 
                                                                              # predecessor images.

        # this instance variable is initialised here
        # and again in the buildObs method or not depending on the
        # value of the method call counter.  self.fitslist must be
        # reset if buildObs() is called multiple times though if that
        # is being done, the caller is doing something extraordinary.
        self.fitslist   = []

        # this counter will track the number of calls of the buildObs method.
        self.buildObsCallCounter = 0
コード例 #2
0
ファイル: buildAplusDir.py プロジェクト: XingxingHuang/APLUS
    def __init__(self, newobs, ownIraf=0):
        self.modName = string.split(string.split(str(self))[0],
                                    '.')[0][1:]  # this is the module name
        self.newobs = newobs  # new observation's name
        self.base = path.Env()
        self.configdir = self.base.getenv('CONFIGS')
        self.pardir = self.base.getenv('PARS')
        self.ingestdir = os.path.join(self.base.getenv('INGEST'),
                                      newobs)  # where it is in the INGEST dir
        self.newobspath = os.path.join(
            self.base.getenv('DATASETS'), newobs,
            'final')  # new observation's path under $PIPELINE/DATASETS
        self.newpardir = os.path.join(self.newobspath, 'par')  # parfile dir
        self.fitsdir = os.path.join(self.newobspath,
                                    'Images')  # the dir where all data is sent
        self.catdir = os.path.join(self.newobspath, 'Catalogs')
        self.newpar = os.path.join(self.newobspath, 'par')  # parfile dir
        self.newfits = os.path.join(self.newobspath,
                                    'Images')  # the dir where all data is sent
        self.newcats = os.path.join(
            self.newobspath, 'Catalogs'
        )  # WARNING: notice the above three elements! __________by xingxing
        self.newalign = os.path.join(self.newobspath, 'align')
        self.prodir = os.path.join(self.newobspath, 'Output')  #WZ
        self.reddir = os.path.join(self.newobspath, 'Red')  #WZ
        self.aligndir = os.path.join(self.newobspath, 'align')
        self.messagedir = os.path.join(self.newobspath, 'Messages')
        self.root = self.newobspath
        self.ownIraf = ownIraf
        self.errorList = []
        self.inputList = []
        self.outputList = {}  # outputList is now a dictionary to accomodate
        # predecessor images.
        # add by xingxing.  files like these:
        ##obs.sciImageList=['a209_f110w_drz.fits','a209_f390w_drz.fits','a209_f814w_drz.fits']
        ##obs.contextImageList=['a209_f110w_drz_context.fits','a209_f390w_drz_context.fits','a209_f814w_drz_context.fits']
        ##obs.weightImageList=['a209_f110w_drz_weight.fits','a209_f390w_drz_weight.fits','a209_f814w_drz_weight.fits']
        ##obs.flagImageList=['a209_f110w_FLAG.fits','a209_f390w_FLAG.fits','a209_f814w_FLAG.fits']
        ##obs.rmsImageList=['a209_f110w_RMS.fits','a209_f390w_RMS.fits','a209_f814w_RMS.fits']
        self.datasetsdir = self.base.getenv('DATASETS')  #path
        self.sciImageList = []
        self.contextImageList = []
        self.weightImageList = []
        self.flagImageList = []
        self.rmsImageList = []

        # this instance variable is initialised here
        # and again in the buildObs method or not depending on the
        # value of the method call counter.  self.fitslist must be
        # reset if buildObs() is called multiple times though if that
        # is being done, the caller is doing something extraordinary.
        self.fitslist = []

        # this counter will track the number of calls of the buildObs method.
        self.buildObsCallCounter = 0
コード例 #3
0
    def run(self):
        if self.inputdir == None:
            self.inputdir = os.path.join(path.Env().getenv('DATASETS'),
                                         self.obsName, 'final', 'Images')
        if self.colordir == None:
            self.colordir = os.path.join(path.Env().getenv('DATASETS'),
                                         self.obsName, 'final', 'CoImages')
        if not os.path.isdir(self.colordir):
            os.mkdir(self.colordir)
        print "Color images will be stored in " + self.colordir

        for keys in self.filterlist:
            drzfile = self.obsName + "_" + keys + "_drz.fits"
            if not os.path.isfile(os.path.join(self.inputdir, drzfile)):
                print drzfile + " not found !!"
                self.filter.remove(keys)
                if keys in self.acsfilter:
                    self.acsfilter.remove(keys)
                elif keys in self.irfilter:
                    self.irfilter.remove(keys)
                elif keys in self.uvisfilter:
                    self.uvisfilter.remove(keys)
                else:
                    print keys + ' is not found in ACS IR UVIS.'
                    sys.exit()
        print "filters used:"
        print "UVIS: ", self.uvisfilter
        print "ACS:  ", self.acsfilter
        print "IR:   ", self.irfilter

        #pdb.set_trace()
        #source.in
        if self.acsfilter and self.irfilter and self.uvisfilter:
            fname = os.path.join(self.colordir, 'source.in')
            print "\n>>>>>>>>>make ", fname, '...'
            if os.path.isfile(fname):
                back = fname + '_old'
                os.rename(fname, back)
            f = open(fname, 'w')
            print >> f, 'B'
            for keys in self.uvisfilter:
                print >> f, self.obsName + '_' + keys + '_drz.fits'
            print >> f, '\n'
            print >> f, 'G'
            for keys in self.acsfilter:
                print >> f, self.obsName + '_' + keys + '_drz.fits'
            print >> f, '\n'
            print >> f, 'R'
            for keys in self.irfilter:
                print >> f, self.obsName + '_' + keys + '_drz.fits'
            print >> f, '\n'

            print >> f, 'indir    ', self.inputdir
            print >> f, 'outname  ', self.obsName + '_source'
            print >> f, 'samplesize  1000'
            print >> f, 'showstamps 0'
            print >> f, 'satpercent  0.001'
            print >> f, 'noiselum    0.12'
            print >> f, 'colorsatfac  1'
            print >> f, 'deletetests  0'
            print >> f, 'sampledx   330'
            f.close()
            try:
                Trilogy(infile=fname, outdir=self.colordir,
                        **params_cl()).run()
            except Exception, err:
                print "*******ERROR: fail for " + fname