antaress.ANTARESS_corrections.ANTARESS_calib module#

calc_gcal(gen_dic, data_dic, inst, plot_dic, coord_dic, data_prop)[source]#

Main instrumental calibration routine.

Estimates instrumental calibration (see weights_bin_prof())

Calibration profiles are used in weight profiles and to scale back profiles approximatively to their raw photoelectron counts. If blaze files are not available, calibration profiles are estimated from the error and flux tables and we neglect detector noise. This tends to overestimate the true calibration in regions of low count levels.

We fit a model to the calibration profile (measured or estimated) for each exposure, so that it can be extrapolated over a larger common range for all visits, or used to complete the measured profile over undefined pixels.

Weights use the specific calibration profile defined for each exposure. Weights are used for temporal binning, and are relevant only if the weight of a given pixel change over time. The calibration is thus not defined for CCFs.

Scaling uses a single calibration profile, constant in time and common to all processed exposures of an instrument, so that the relative color balance between spectra is not modified when converting them back to counts. For the same reason the calibration must be applied uniformely (ie, in the same rest frame) to spectra in different exposures, and their master, so that it does not affect their combinations - even if the original calibration to flux units is applied in the detector rest frame. The scaling is applied in particular during CCF calculations, to avoid artifically increasing errors when combining spectral regions with different SNRs. Spectra must however be kept to their extracted flux units througout ANTARESS processing, as the stellar spectrum shifts over time in the instrument rest frame. The same region of the spectrum thus sees different instrumental responses over time and is measured with different flux levels. Shifted stellar spectra with the same profile would thus have a different color balance after being converted in raw count units, preventing in particular the correct calculation of binned spectra. We calculate the median of the extrapolated models or measured completed profiles, interpolate it as a function, and use it to define the common scaling calibration profile over the specific table of each exposure. Spectra are typically provided in the solar barycentric rest frame. Calibration profiles measured or estimated in this frame are thus shifted to the Earth barycentric frame (ie, the detector frame) before being averaged

Parameters:

TBD

Returns:

TBD

model_gain(iexp_glob_groups, iexp_gain_groups, plot_save, nord, gcal_val_all, inst, gcal_thresh, gcal_edges, gcal_nooutedge, fixed_args, nfree_gainfit, p_start, gcal_blaze_vis, cal_smooth_inst, scal_val, min_edge_ord, max_edge_ord, n_edge)[source]#

Main fit function for estimated instrumental calibration.

Parameters:

TBD

Returns:

TBD

model_gain_meas(iexp_glob_groups, plot_save, nord, inst, gcal_thresh, gcal_edges, gcal_nooutedge, fixed_args, nfree_gainfit, p_start, cal_data_paths, gcal_blaze_vis, cal_smooth_inst, scal_val, min_edge_ord, max_edge_ord, n_edge, proc_DI_data_paths, sing_gcal_DI_data_paths, gcal_binw, dim_exp, cal_weight, cond_plot_gcal)[source]#

Main fit function for blaze-derived instrumental calibration.

Parameters:

TBD

Returns:

TBD

model_gain_ord(data_gain, iord, gcal_val_ord, gcal_blaze_vis, gcal_thresh, scal_val, cal_smooth_inst, gcal_edges, fixed_args, p_start, nfree_gainfit, n_edge, min_edge_ord, max_edge_ord, inst, gcal_nooutedge, plot_save)[source]#

Sub fit function for instrumental calibration.

Parameters:

TBD

Returns:

TBD

para_model_gain(func_input, nthreads, n_elem, y_inputs, common_args)[source]#

Multithreading routine for model_gain().

Parameters:
  • func_input (function) – multi-threaded function

  • nthreads (int) – number of threads

  • n_elem (int) – number of elements to thread

  • y_inputs (list) – threadable function inputs

  • common_args (tuple) – common function inputs

Returns:

y_output (None or specific to func_input) – function outputs

para_model_gain_meas(func_input, nthreads, n_elem, y_inputs, common_args, dim_exp)[source]#

Multithreading routine for model_gain_meas().

Parameters:
  • func_input (function) – multi-threaded function

  • nthreads (int) – number of threads

  • n_elem (int) – number of elements to thread

  • y_inputs (list) – threadable function inputs

  • common_args (tuple) – common function inputs

Returns:

y_output (None or specific to func_input) – function outputs

cal_piecewise_func(param_in, wav_in, args=None)[source]#

Instrumental calibration model.

Defines joined polynomials to model calibration profiles.

Parameters:

TBD

Returns:

TBD