-
Notifications
You must be signed in to change notification settings - Fork 4
How findr Works
danielchen1 edited this page Dec 8, 2015
·
38 revisions
The sample.cfg file defines all the variables used in run_findr.py and findr_lib (variables are in italics): Jared Males's bitbucket url: https://bitbucket.org/jaredmales/acic/src
- max_processes: max number of workers that can be ran simultaneously (defined as 2)
- fileshifts: used for centering the images; defined as file_shifts.txt provided by Jared
- darkmaster_path: path to darkmaster.cpp located in Jared Males's bitbucket
- darksub_path: path to darksub.cpp located in Jared's bitbucket
- fitscent_path: path to fitscent.cpp located in Jared's bitbucket
- outputfname: the name of the .json and .tsv files created by run_findr.py (defined as metadata)
- masterdark_filename: defined as masterdark.fits (the average of all the dark images in darks.list) generated from running darkmaster.cpp from Jared's bitbucket
- darknorms_filename: defined as norm.dat (file containing median pixel intensity across the dark images) generated from running darkmaster.cpp
- darklist_filename: defined as darks.list (list of all the dark images passed into darkmaster.cpp) generated from running darkmaster.cpp
- smooth_window: the number of images to normalize in each iteration (defined as 20)
- science_norms: defined as all_sci_median_norms.dat (contains the normalization of the science images)
Necessary library and python script imports:
- sys
- json
- os
- multiprocessing
- ConfigParser
- astropy.io.fits
- findr_lib
- If the files does not exists.
- Gets the path and cfg file name from passed args
- Reads config_vals into findr_lib from file name
- If no .json and .tsv file
- Gets files in dir if they are .fits
- Gets fieldnames from first fits file
- Setups multiprocessing pool
- Asynchronously gathers metadata
- Generates tsv of metadata
- Makes dictionary from list of all metadata
- Creates json from list of metadata if config is set to allow
- If .json and .tsv files exists
- Reads in data from .json files
- Sorts metadata into dictionary of lists based on VIMTYPE
- Removes science files from metadata dictionary if AOLOOPST is OPEN
- Runs darkmaster
- Runs subtractAndCenter
- TODO Klip-reduce
- Returns a dictionary of lists of good filenames sorted by type
Necessary library imports:
- os: path, system
- csv
- json
- numpy
- datetime
- time
- astropy.io,fits
- Gets all the metadata from the fits file hdulist
- Removes comment field
- Creates a file called metadata.tsv for the output
- Sets up the writer, header fields, and delimiter
- Writes the header to the file
- Builds json file of metadata not sorted by VIMTYPE
- Sorts total_dic into dictionary by VIMTYPE
- Searches dictionary built by my other script
- Stores names of good files
- Returns those names
- Writes out a config file from a list
- Writes out a config file from a dictionary
- Writes dark images to config file
- Fills out required parameters
- Fills out bottom/top normalization coordinates if present
- Fills out height/width of centered normalization region (overrides normalization coordinates) if present
- Adds median options, if present
- Builds & calls darkmaster command
- Prepends text to filename
- Spawns a darksub command
- Spawns a fitscent command
- Calculates the centered moving average of the norm values for the image data set's top and bottom amplifiers
- Initial smoothing
- If the size is even, then smooth the smoother values
- Adjusts the science smoothed norm values based on the norm values
- Converts all timestamps to seconds since epoch
- Dark_time is now in seconds since epoch
- Sci_time is now in seconds since epoch
- Calculate deltas
- Shifts smoother norms
- Special case for the last dark and the last few sciences
- Builds list of science images to process
- Loads shift values from file to memory
- Builds norms and stores in memory
- Defines necessary variables
- Builds up commands for each science images
- Gets norm values
- Gets shift values
- Skips remaining task
- Builds subtraction task
- Builds centering task
- Executes subtraction tasks (parallel)
- Executes subtraction tasks (serial)
- Executes centering tasks (parallel)
- Executes centering tasks (serial)
- Returns list of final filenames