abscal.wfc3.reduce_grism_wavelength¶
This module takes a table of exposures, finds all exposures tagged as planetary nebula exposures, and:
- For each grism
- For each spectral order
- For each file
Determines which emission lines fall in that order of that file
Attempts to automatically fit the line location
Allows the user to override the result of the automatic fit
Records the resulting fit location and status (good/bad/custom/etc.)
The module then saves a table of the results.
In addition, the module can take the result table above and use it to derive an overall wavelength fit for each grism/order value of the inputs, and produce yet another output table given the results of that fit.
Use¶
This module can be run from the command line (although one of the abscal.commands or abscal.idl_commands scripts would be preferred for that), but is mostly intended to be imported, either by binary scripts or for use from within python:
from abscal.wfc3.reduce_grism_wavelength import wlmeas, wlmake
interim_table = wlmeas(input_table, command_line_arg_namespace, override_dict)
final_table = wlmake(input_table, interim_table, command_line_arg_namespace, override_dict)
The override dict allows for many of the default input parameters to be overriden (as defaults – individual per-exposure overrides defined in the data files will still take priority). There are currently no default parameters that can be overriden in this module.
Module Contents¶
Functions¶
|
Find a line from the IMA zero-read. |
|
Measure planetary nebula emission line locations. |
|
Derives a grism wavelength fit. |
|
Derives wavelength offsets for white dwarf exposures. |
|
Additional command-line arguments. |
|
Parse command-line arguments. |
|
Run the wavelength fitting function(s). |
- abscal.wfc3.reduce_grism_wavelength.wlimaz(root, y_arr, wave_arr, directory, verbose)¶
Find a line from the IMA zero-read.
If the very bright 10380A line falls in the first order, you can end up trying to centre a saturated line. In this case, use the _ima.fits file, which holds all of the individual reads, and measure the line centre from the zero-read ima file in the first order.
- Parameters:
root (str) – The file name to be checked
y_arr (np.ndarray) – The y-values (flux values) from the flt file
wave_arr (np.ndarray) – The approximate wavelength values from the flt file
directory (str) – The directory where the flt file is located (and where the ima file should be located)
- Returns:
star_x (float) – The x centre of the line
star_y (float) – The y centre of the line
- abscal.wfc3.reduce_grism_wavelength.wlmeas(input_table, **kwargs)¶
Measure planetary nebula emission line locations.
There are six planetary nebula emission lines that fall neatly into the WFC3 grism spectral orders, and this function uses the approximate wavelength solution to find the rough location of these lines, and then uses flux-weighting to determine the line centre. The user is able to override a given fit if the script is run with the show_plots flag.
- Parameters:
input_table (abscal.common.exposure_data_table.AbscalDataTable) – Table of exposures with emission lines to fit.
kwargs (dict) – Dictionary of overrides to the default reduction parameters, and command-line option selections.
- Returns:
output_table – Table of emission line locations
- Return type:
astropy.table.Table
- abscal.wfc3.reduce_grism_wavelength.wlmake(input_table, wl_table, **kwargs)¶
Derives a grism wavelength fit.
Once planetary nebula emission lines have been located and fit, it is possible to use them as input in creating a full wavelength fit for the grism detector. ABSCAL fits the wavelength set with a linear slope and intercept, where both the slope and the intercept have constant terms, linear terms in X, and linear terms in y.
Once the fit has been calculated, the script prints out fit errors based on the input exposures, and creates an output table with all of the fit terms. A separate fit is derived for each order of each grism.
- Parameters:
input_table (abscal.common.exposure_data_table.AbscalDataTable) – Table of exposures to be fit.
wl_table (astropy.table.Table) – Output of wlmeas.
kwargs (dict) – Dictionary of overrides to the default reduction parameters, and command-line option selections.
- Returns:
output_table – Table of wavelength fit values
- Return type:
astropy.table.Table
- abscal.wfc3.reduce_grism_wavelength.wl_offset(input_table, **kwargs)¶
Derives wavelength offsets for white dwarf exposures.
Cross-correlates flux and net from white dwarf exposures against one another to derive offsets
- Parameters:
input_table (abscal.common.exposure_data_table.AbscalDataTable) – Table of exposures to have offsets generated.
kwargs (dict) – Dictionary of overrides to the default reduction parameters, and command-line option selections.
- Returns:
output_table – Updated table
- Return type:
astropy.table.Table
- abscal.wfc3.reduce_grism_wavelength.additional_args(**kwargs)¶
Additional command-line arguments.
Provides additional command-line arguments that are unique to the wavelength fitting process.
- Returns:
additional_args – Dictionary of tuples in the form (fixed,keyword) that can be passed to an argument parser to create a new command-line option
- Return type:
dict
- abscal.wfc3.reduce_grism_wavelength.parse_args(**kwargs)¶
Parse command-line arguments.
Gets the custom arguments from wavelength fitting, and passes them to the common command-line option function.
- Returns:
res – parsed argument namespace
- Return type:
namespace
- abscal.wfc3.reduce_grism_wavelength.main(do_measure=True, do_make=True, **kwargs)¶
Run the wavelength fitting function(s).
Runs the wavelength fitting function(s) if called from the command line, with command-line arguments added in. Can run wlmeas, wlmake, or both.
- Parameters:
do_measure (bool, default True) – Run wlmeas function
do_make (bool, default, True) – Run wlmake function
kwargs (dict) – Dictionary of parameters to override when running.