def analyze_darks(): """Analyze the dark_calib results """ util.mkdir('calib') os.chdir('calib') first_dark = 16 calib.analyzeDarkCalib(first_dark) os.chdir('../')
def __init__(self, epoch, rootDir='/g/lu/data/orion/', filt='kp', epochDirSuffix=None, imgSuffix=None, stfDir=None, useDistorted=False, cleanList='c.lis'): # Setup default parameters self.type = 'ao' self.corrMain = 0.8 self.corrSub = 0.6 self.corrClean = 0.7 self.starlist = rootDir + 'source_list/psf_central.dat' self.labellist = rootDir+ 'source_list/label.dat' self.orbitlist = rootDir+ 'source_list/orbits.dat' self.calFile = rootDir + 'source_list/photo_calib.dat' self.calStars = ['16C', '16NW', '16CC'] self.calFlags = '-f 1 -R ' self.mapFilter2Cal = {'kp': 1, 'lp': 3, 'h': 4, 'ms': 5} if 'kp' in filt: self.calColumn = 1 else: # case for Maser mosaic, deep mosaic self.calColumn = self.mapFilter2Cal[filt] self.calCooStar = '16C' self.cooStar = 'irs16C' self.deblend = None self.alignFlags = '-R 3 -v -p -a 0' self.numSubMaps = 3 self.minSubMaps = 3 # Setup input parameters self.epoch = epoch self.rootDir = rootDir if not self.rootDir.endswith('/'): self.rootDir += '/' self.filt = filt if epochDirSuffix != None: self.suffix = '_' + epochDirSuffix else: self.suffix = '' if imgSuffix != None: self.imgSuffix = '_' + imgSuffix else: self.imgSuffix = '' # Setup Directories self.dirEpoch = self.rootDir + self.epoch + self.suffix + '/' self.dirClean = self.dirEpoch + 'clean/' + self.filt + '/' if useDistorted: self.dirClean += 'distort/' if stfDir != None: self.dirCleanStf = self.dirClean + 'starfinder/' + stfDir + '/' else: self.dirCleanStf = self.dirClean + 'starfinder/' self.dirCleanAln = self.dirCleanStf + 'align/' self.dirCombo = self.dirEpoch + 'combo/' if stfDir != None: self.dirComboStf = self.dirCombo + 'starfinder/' + stfDir + '/' else: self.dirComboStf = self.dirCombo + 'starfinder/' self.dirComboAln = self.dirComboStf + 'align/' # make the directories if we need to if cleanList != None: util.mkdir(self.dirCleanStf) util.mkdir(self.dirCleanAln) util.mkdir(self.dirComboStf) util.mkdir(self.dirComboAln) # Get the list of clean files to work on self.cleanList = cleanList self.cleanFiles = [] if cleanList != None: _list = asciidata.open(self.dirClean + self.cleanList, 'r') for ii in range(_list.nrows): fields = _list[0][ii].split('/') filename = fields[-1].replace('.fits', '') self.cleanFiles.append(filename) # Keep track of the current directory we started in self.dirStart = os.getcwd() # Set the default magnitude cut for plotPosError self.plotPosMagCut = 15.0
def go(): """Do the full data reduction. @author Jessica Lu @author Sylvana Yelda """ #################### # # Calibration files: # everything created under calib/ # #################### # Darks - created in subdir darks/ # Files n0001 - n0009 # - darks needed to make bad pixel mask # - store the resulting dark in the file name that indicates the # integration time (2.8s) and the coadds (10ca). darkFiles = range(1, 9+1) calib.makedark(darkFiles, 'dark_2.8s_10ca.fits') # Flats - created in subdir flats/ # Files n0037,n0039,n0041,n0043,n0045: lamps off for flats at K # Files n0038,n0040,n0042,n0044,n0046: lamps on for flats at K offFiles = [37, 39, 41, 43, 45] onFiles = [38, 40, 42, 44, 46] calib.makeflat(onFiles, offFiles, 'flat_kp.fits') # Masks calib.makemask('darks/dark_2.8s_10ca.fits', 'flats/flat_kp.fits', 'supermask.fits') #################### # # Galactic Center # #################### ########## # K-band reduction ########## util.mkdir('kp') os.chdir('kp') # Nite 1: # SCI frames (don't forget to add 1 at end): 108-237 # reference star position in first image: [407.77, 673.87] # use a different Strehl star at position: [521.79, 398.92] # Sky frames (don't forget to add 1 at end): 252-261 # # -- If you have more than one position angle, make sure to # clean them seperatly. # -- Strehl and Ref src should be the pixel coordinates of a bright # (but non saturated) source in the first exposure of sci_files. sci_files1 = range(108, 237+1) refSrc1 = [407.77, 673.87] strSrc1 = [521.79, 398.92] sky_files1 = range(252, 261+1) # sky.makesky(sky_files1, 'nite1', 'kp') data.clean(sci_files1, 'nite1', 'kp', refSrc1, strSrc1) # Nite 2: # SCI frames (don't forget to add 1 at end): 1108-1237 # reference star position in first image: [407.77, 673.87] # use a different Strehl star at position: [521.79, 398.92] # Sky frames (don't forget to add 1 at end): 1252-1261 and 1400-1405 sci_files2 = range(1108, 1237+1) refSrc2 = [407.77, 673.87] strSrc2 = [521.79, 398.92] sky_files2 = range(1252, 1261+1) + range(1400, 1405+1) # sky.makesky(sky_files2, 'nite2', 'kp') data.clean(sci_files2, 'nite2', 'kp', refSrc2, strSrc2) # Combine: # Combine all of them together (from both nights). # Do frame selection (trim=1). # Weight by Strehl (weight='strehl'). # Make 3 submaps. sci_files = sci_files1 + sci_files2 data.calcStrehl(sci_files, 'kp') data.combine(sci_files, 'kp', '06junlgs', trim=1, weight='strehl', submaps=3) os.chdir('../') ############ # Lp ############ util.mkdir('lp') os.chdir('lp') # Nite 1 sky_files = range(38, 53+1) sci_files = range(87, 94+1) + range(115,122+1) refSrc = [695., 543.] strSrc = [680., 839.] sky.makesky_lp(sky_files, 'nite1', 'lp') data.clean(sci_files, 'nite1', 'lp', refSrc, strSrc) data.calcStrehl(sci_files, 'lp') data.combine(sci_files, 'lp', '06junlgs', trim=0, weight=None, submaps=3) os.chdir('../')