MB=MB, gain=gain, scalable=True, savefile=True, path=path, timit=True) # (iii) WHITES #create (bias- & dark-subtracted) MASTER WHITE frame and corresponding error array (units = electrons) MW, err_MW = process_whites(flat_list, MB=MB, ronmask=ronmask, MD=MD, gain=gain, scalable=False, fancy=False, clip=5., savefile=True, saveall=False, diffimg=False, path=None, timit=False) ##################################################################################################################################################### # (3) ORDER TRACING ################################################################################################################################# # find orders roughly P, tempmask = find_stripes(MW, deg_polynomial=2, min_peak=0.05, gauss_filter_sigma=3., simu=False)
MDS = np.zeros(medbias.shape) # (iii) WHITES #create (bias- & dark-subtracted) MASTER WHITE frame and corresponding error array (units = electrons) choice_mw = 'r' if os.path.isfile(path + 'master_white.fits'): choice_mw = raw_input("MASTER WHITE image for " + date + " already exists! Do you want to skip this step or recreate it? ['s' / 'r']") if choice_mw.lower() == 's': print('Loading MASTER WHITE for ' + date + '...') MW = pyfits.getdata(path + 'master_white.fits', 0) err_MW = pyfits.getdata(path + 'master_white.fits', 1) else: # this is a first iteration without background removal - just so we can do the tracing; then we come back and do it properly later MW,err_MW = process_whites(flat_list, MB=medbias, ronmask=ronmask, MD=MDS, gain=gain, scalable=True, fancy=False, P_id=None, clip=5., savefile=False, saveall=False, diffimg=False, remove_bg=False, path=path, debug_level=1, timit=False) ##################################################################################################################################################### ### (3) INITIAL ORDER TRACING ####################################################################################################################### choice = 'r' if os.path.isfile(path + 'P_id.npy') and os.path.isfile(path + 'mask.npy'): choice = raw_input("INITIAL ORDER TRACING has already been done for " + date + " ! Do you want to skip this step or recreate it? ['s' / 'r']") if choice.lower() == 's': print('Loading initial order traces for ' + date + '...') P_id = np.load(path + 'P_id.npy').item() mask = np.load(path + 'mask.npy').item() else: # find rough order locations
nx, ny, savefile=True, path=path, timit=True) #we did not have darks, so I did this MD = np.zeros(MB.shape) #create (bias- & dark-subtracted) MASTER WHITE frame and corresponding error array (units = ADUs) MW, err_MW = process_whites(white_list, corrected_white_list, MB=MB, ronmask=ronmask, MD=MD, gain=gain, scalable=False, fancy=False, clip=5., savefile=True, saveall=True, diffimg=False, path=path, timit=False) # find orders P, tempmask = find_stripes(MW, deg_polynomial=2, min_peak=0.05, gauss_filter_sigma=3., simu=False) # assign physical diffraction order numbers (this is only a dummy function for now) to order-fit polynomials and bad-region masks P_id = make_P_id(P) mask = make_mask_dict(tempmask)