def create_reference_file(input_dir, input_flist): ''' This function will point Justin's refstis scripts to a folder containing darks or biases and have it create a superdark or super bias. The script will automatically try to create darks and biases for with all files in a directory. Biases and darks should be kept in separate folders. This script automatically divided observations into individual weeks ''' date = [] for ifile in input_flist: date.append( pyfits.getval(os.path.join(input_dir, ifile), 'texpstrt', 0)) date.append(pyfits.getval(os.path.join(input_dir, ifile), 'texpend', 0)) filetype = pyfits.getval(os.path.join(input_dir, ifile), 'targname', 0) date = np.array(date) month_begin = np.min(date) month_end = np.max(date) if filetype == 'DARK': REFSTIS_wrapper.separate_obs(input_dir, month_begin, month_end, input_filetype='flc', move_files=False) else: REFSTIS_wrapper.separate_obs(input_dir, month_begin, month_end, move_files=False) make_reffiles(input_dir, filetype) #Copy reference file from each week folder to the reffiles folder os.path.walk(input_dir, copy_reference_files_to_reffiles, '')
def make_reffiles(root_folder, filetype): """ Make all refrence files for a given folder This functions is very specific to the REFSTIS pipeline, and requires files and folders to have certain naming conventions. """ print '#-----------------------------#' print '# Making all ref files for #' print root_folder print '#-----------------------------#' if not os.path.exists(root_folder): raise IOError('Root folder: %s does not exist' % (root_folder)) gain_folders, week_folders = REFSTIS_wrapper.pull_out_subfolders( root_folder) if filetype.upper() == 'BIAS': REFSTIS_wrapper.refbias(week_folders) #Basebias is not currently supported #REFSTIS_wrapper.basebias(root_folder, gain_folders) elif filetype.upper() == 'DARK': REFSTIS_wrapper.basedark(root_folder, input_filetype='flc', set_biasfile=False) REFSTIS_wrapper.weekdark(week_folders, input_filetype='flc', set_biasfile=False) else: sys.exit('ERROR: File type not recognized')
def create_reference_file(input_dir, input_flist): ''' This function will point Justin's refstis scripts to a folder containing darks or biases and have it create a superdark or super bias. The script will automatically try to create darks and biases for with all files in a directory. Biases and darks should be kept in separate folders. This script automatically divided observations into individual weeks ''' date = [] for ifile in input_flist: date.append(pyfits.getval(os.path.join(input_dir, ifile), 'texpstrt', 0)) date.append(pyfits.getval(os.path.join(input_dir, ifile),'texpend', 0)) filetype = pyfits.getval(os.path.join(input_dir, ifile), 'targname', 0) date = np.array(date) month_begin = np.min(date) month_end = np.max(date) if filetype == 'DARK': REFSTIS_wrapper.separate_obs(input_dir, month_begin, month_end, input_filetype = 'flc', move_files = False) else: REFSTIS_wrapper.separate_obs(input_dir, month_begin, month_end, move_files = False) make_reffiles(input_dir, filetype) #Copy reference file from each week folder to the reffiles folder os.path.walk(input_dir, copy_reference_files_to_reffiles, '')
def make_reffiles(root_folder, filetype): """ Make all refrence files for a given folder This functions is very specific to the REFSTIS pipeline, and requires files and folders to have certain naming conventions. """ print '#-----------------------------#' print '# Making all ref files for #' print root_folder print '#-----------------------------#' if not os.path.exists( root_folder ): raise IOError( 'Root folder: %s does not exist' %(root_folder)) gain_folders, week_folders = REFSTIS_wrapper.pull_out_subfolders( root_folder ) if filetype.upper() == 'BIAS': REFSTIS_wrapper.refbias(week_folders) #Basebias is not currently supported #REFSTIS_wrapper.basebias(root_folder, gain_folders) elif filetype.upper() == 'DARK': REFSTIS_wrapper.basedark(root_folder, input_filetype = 'flc', set_biasfile = False) REFSTIS_wrapper.weekdark(week_folders, input_filetype = 'flc', set_biasfile = False) else: sys.exit('ERROR: File type not recognized')