The script creates 'synthetic master darks' from coefficients describing the flux in each pixel from the relationship F = z1 + z0 * log10(Texp). The coefficient matrices z1 and z0 as well as the exposure times and ND filter settings of the underlying data are read in from a numpy pickle file.
Synthetic master darks can be created automatically for all exposure times (and non-standard ND filter settings) of science frames found in a (range of) file folder(s). Alternativly, exposure times and/or ND filter settings can be specified manually with the input of a specific science file.
Numpy pickle file with coefficients.
2D data frame(s) with interpolated darks saved in the same directory as the coefficient file.
YYYYMMDD_masterdark_mean_TTTT.fits or
YYYYMMDD_masterdark_ndxxx_mean_TTTT.fits
where the date (YYYYMMDD) is from the part of the folder name with the coefficient file, and the exposure time (TTTT) are from the science frame or from the user input. If a specific ND filter wheel setting was specified (or a mismatch between the relationship between exposure time and ND filter in the input dataset was found), the xxx is the angle of the ND filterwheel.
From the base directory (maroonx_reduce) call: PYTHONPATH=${PWD} python reduce/recipes/make_master_darks_from_coeffs.py
with the following parameters:
-dd DATA_DIRECTORY, --data_directory DATA_DIRECTORY Directory for raw science files for which darks are to be created, e.g., '/data10/MaroonX_spectra/'.
-d DATE, --date DATE UTC date of observations, e.g. '202312??'.
-t EXPTIME, --exptime EXPTIME Exposure time in sec, e.g. '300', if a specific exposure time is required.
-nd ND_SETTING, --nd_setting ND_SETTING ND Filter wheel setting in deg, if a specific ND filter wheel setting is required.
-cb FILE, --coeff_file_blue FILE Name of coefficient file (.npz) for blue arm.
-cr FILE, --coeff_file_red FILE Name of coefficient file (.npz) for red arm.
--overwrite Overwrite existing dark files in output directory. Default: False
--arm 'r' / 'b' If darks for only blue ('b') or red ('r') arm are desired. Skip to get both.
-od OUTPUT_DIRECTORY, --output_directory OUTPUT_DIRECTORY Directory for output files. The coefficient files should be in this directory.
Example: '/data10/MaroonX_spectra_reduced/Maroonx_masterframes/202311xx/darks/'.
Should follow end in '/YYYYMMDD/darks/ '
-l FILELIST --filelist FILELIST File with list of input files (incl. full path). Supersedes file collection by date and exposure time.
Example 1: PYTHONPATH=${PWD} python reduce/recipes/make_master_darks_from_coeffs.py -dd '/data10/MaroonX_spectra/' -od '/data10/MaroonX_spectra_reduced/Maroonx_masterframes/202311xx/darks/' -cr 'masterdarks_coeffs_202311xx_red.npz' -cb 'masterdarks_coeffs_202311xx_blue.npz' -d '202312??'
Example call collects all blue and red science frames from /data10/MaroonX_spectra/202312?? and produces synthetic darks for all unique exposure times and ND filter settings found among the science frames. Based on the specified coefficient files. Results are saved in /data10/MaroonX_spectra_reduced/Maroonx_masterframes/202311xx/darks/
Example 2: PYTHONPATH=${PWD} python reduce/recipes/make_master_darks_from_coeffs.py -od '/data10/MaroonX_spectra_reduced/Maroonx_masterframes/202311xx/darks/' -cr 'masterdarks_coeffs_202311xx_red.npz' -cb 'masterdarks_coeffs_202311xx_blue.npz' -t 45
Example call produces synthetic darks for blue and red arm for a exposure time of 45sec and default ND filter setting for this exposure time. Results are saved in /data10/MaroonX_spectra_reduced/Maroonx_masterframes/202311xx/darks/
Blue and red frames are processed separately. A list of exposure times and ND filter settings is contructed from either
(a) All science frames found in the specified data directory and date range.
(b) From a list of input files (of arbitrary type).
(c) Specified exposure time and/or ND filter setting. If only one is given, the other is calculated from a linear log10(Texp) - ND filterwheel angle setting. If both are given and don't match the flux is scaled up by the difference in exposure time between actual (as given) and nominal (from default ND filter setting).
The coefficient files contain arrays 'z0' and 'z1' to construct the counts in the output dark file for a given exposure time: F = z1 + z0 * log10(Texp)