antaress.ANTARESS_corrections.ANTARESS_interferences module#
- MAIN_corr_wig(inst, gen_dic, data_dic, coord_dic, data_prop, plot_dic, system_param)[source]#
Main wiggle correction routine.
Determines and applies correction for ESPRESSO wiggles
Wiggles are processed in wave_number space. We use \(\nu_\mathrm{ana} = c[km s^{-1}]/w[A]\) because it is on the order of 10, with \(\nu[s^{-1}] = 10^{13} \nu_\mathrm{ana}\). For example a wavelength of 4000 A corresponds to \(\nu_\mathrm{ana} = 75 [10^{13} s^{-1}]\) and \(\nu = 7.5 \times 10^{14} [s^{-1}]\) = 750 [Thz].
Periodogram frequencies \(F_{\nu,\mathrm{ana}}\) correspond to wiggle periods
\[\begin{split}P_{\nu}[s^{-1}] &= 10^{13} P_{\nu,\mathrm{ana}} \\ &= 10^{13} / F_{\nu,\mathrm{ana}}\end{split}\]or \(F_{\nu}[s] = 10^{-13} F_{\nu,\mathrm{ana}}\). The corresponding period in wavelength space is
\[\begin{split}P_{w}[A] &= c[A s^{-1}] P_{\nu}[s^{-1}]/\nu[s^{-1}]^2 \\ &= c[A s^{-1}]/(F_{\nu}[s] \nu[s^{-1}]^2) \\ &= 10^{13} c[km s^{-1}]/(10^{-13} F_{\nu,\mathrm{ana}} (10^{13} \nu_\mathrm{ana})^2) \\ &= c[km s^{-1}]/(F_{\nu,\mathrm{ana}} \nu_\mathrm{ana}^2) \\ &= w[A]^2/(F_{\nu,\mathrm{ana}} c[km s^{-1}])\end{split}\]at this stage spectra can be written as (see rescale_profiles())
\[F_\mathrm{corr}(w,t,v) = F_{\star}(w,v) C_\mathrm{ref}(w,v) L(t) W(w,t,v)\]where W(w,t) represents the wiggles and we can ignore \(C_\mathrm{ref}(w,v)\) and L(t) as they will be removed when normalizing \(F_\mathrm{corr}(w,t,v)\) by the visit master
The approach is the same as with the flux balance module: spectra are first scaled back to count units and binned to smooth out noise, with a bin size short enough that it does not dilute the wiggles. When spectra are shifted into the star rest frame their calibration profile is shifted as well, so that a given exposure and its master are scaled using the same profile. In this way the contribution from the stellar spectrum and calibration profile is removed when calculating the ratio between the binned exposure and master count spectra, and all low-resolution transmission spectra are comparable, even if they involved calibration profiles shifted to different positions.
- Parameters:
TBD
- Returns:
None
- def_wig_tab(min_nu, max_nu, dnu)[source]#
Wiggle table definition
Defines wiggle table in \(\nu\) space
- Parameters:
min_nu (float) – Start value of the table in \(\nu\).
max_nu (float) – End value of the table in \(\nu\).
dnu (float) – Resolution of the table in \(\nu\).
- Returns:
n_nu (float) – Number of table values.
nu_tab (1D array) – \(\nu\) table.
- wig_mod_cst(params, x_in, args=None)[source]#
Flat wiggle model
Defines wiggle model with constant value.
- Parameters:
TBD
- Returns:
TBD
- wig_def_sampbands(comp_id, nu, shift_off, args, p_start_gen)[source]#
Wiggle sampling bands
Defines sampling bands of the wiggles.
sampling size is based on the period component
the shift to oversample is applied to the starting wavelength, so that the sampling width remains correctly adjusted with wavelength
- Parameters:
TBD
- Returns:
TBD
- wig_perio_gen(calc_range, src_range, nu_in, flux_in, err_in, args, plot=False)[source]#
Wiggle periodogram
Calculates wiggle periodogram over a current spectral band.
- Parameters:
TBD
- Returns:
TBD
- plot_bin_spec(ax, low_bins, high_bins, val_bins, min_plot, max_plot, dbin_plot, color='goldenrod')[source]#
Wiggle plot : binned spectrum
Plot the binned transmission spectrum of an exposure. We use resample_func() rather than bind.resampling because input tables are not necessarily continuous, and because the calculations here are less generic than those in process_bin_prof()
- Parameters:
TBD
- Returns:
TBD
- plot_screening(ibin2exp_fit, ibin2ord_fit, min_plot, max_plot, gen_dic, Fr_bin_fit, rms, plot_path, fixed_args)[source]#
Wiggle plot : screening
Plot the transmission spectrum of an exposure with the associated periodogram.
- Parameters:
TBD
- Returns:
TBD
- plot_sampling_perio(fixed_args, ax, best_freq, src_range, calc_perio, ls, ls_freq, ls_pow, freq_guess, max_pow, fap_max, probas, log=False, fontsize=10, plot_xlab=True, plot_ylab=True)[source]#
Wiggle plot : periodogram
Plot the sampled wiggle periodogram.
- Parameters:
TBD
- Returns:
TBD
- plot_global_perio(fixed_args, comm_freq_comp, comm_power_comp, nexp, path_gen, color_comps)[source]#
Wiggle plot : global periodogram
Plots wiggle periodogram calculated over all exposures.
- Parameters:
TBD
- Returns:
TBD
- plot_sampling_spec(ax, x_range_plot_in, nu_fit, var_plot, nu_plot, mod_HR, mean_wav, mean_nu, fixed_args, fontsize=10, plot_xlab=True, plot_ylab=True)[source]#
Wiggle plot : spectra
Plot transmission spectra in sampled bands.
- Parameters:
TBD
- Returns:
TBD
- wig_perio_sampling(comp_id_proc, plot_samp, samp_fit_dic, shift_off, ishift_comp, ishift, comp_id, nu_in, flux_in, var_in, count, args, p_start_gen, nu_amp, src_perio_comp, comp_freqfixed, pref_names, suf_names, fix_freq2perio, fit_results, path_sampling_plot, freq_params_samp, fixed_args)[source]#
Wiggle sampling
Main routine to sample wiggle properties chromatically
- Parameters:
TBD
- Returns:
TBD
- plot_wig_glob(low_nu_fit, high_nu_fit, nu_fit, flux_fit, err_fit, nu_mod, mod_plot_glob, low_nu_res, high_nu_res, nu_res, flux_res, err_res, fixed_args, min_max_plot, pref_plot, path_sampling_plot, bin_spec=False, filter_mode=False)[source]#
Wiggle plot: full spectrum
Plots full wiggle transmission spectrum (measured and model) before and after correction, with associated periodogram.
- Parameters:
TBD
- Returns:
TBD
- plot_rms_wig(cen_ph_plot, rms_precorr, rms_postcorr, median_err, save_path)[source]#
Wiggle plot: RMS
Plots global RMS of wiggle transmission spectra
- Parameters:
TBD
- Returns:
TBD
- FIT_wig_submod_coord_discont(param_in, x_in, args=None)[source]#
Wiggle fit function: generic model for hyper-parameters
Calls corresponding model function for optimization
- Parameters:
TBD
- Returns:
TBD
- wig_submod_coord_discont(nexp, params, args)[source]#
Wiggle model function: generic model for hyper-parameters
Defines the following model for wiggle hyper-parameters
\(f(t) = U + \alpha_\mathrm{x} \sin(az(t)) + \alpha_\mathrm{y} \cos(az(t)) + \alpha_\mathrm{z} \sin(alt(t))\)
where U, \(\alpha_\mathrm{x}\), \(\alpha_\mathrm{y}\), \(\alpha_\mathrm{z}\) are different before/after the meridian but linked through continuity of values at the meridian (\(az = \pi\))
\[\begin{split}U - \alpha_\mathrm{y}^\mathrm{east} + \alpha_\mathrm{z}^\mathrm{east} \sin(alt^\mathrm{mer}) &= U + dU - \alpha_\mathrm{y}^\mathrm{west} + \alpha_\mathrm{z}^\mathrm{west} \sin(alt^\mathrm{mer}) \\ \alpha_\mathrm{y}^\mathrm{west} &= dU + \alpha_\mathrm{y}^\mathrm{east} + \sin(alt^\mathrm{mer}) (\alpha_\mathrm{z}^\mathrm{west} - \alpha_\mathrm{z}^\mathrm{east})\end{split}\]and through continuity of derivative at the meridian (\(az = \pi\), \(dalt/dt = 0\))
\[\begin{split}f'(t) &= az'(t) (\alpha_\mathrm{x} \cos(az(t)) - \alpha_\mathrm{y} \sin(az(t))) + \alpha_\mathrm{z} alt'(t) \cos(alt(t)) \\ -\alpha_\mathrm{x}^\mathrm{east} az'(mer) &= -\alpha_\mathrm{x}^\mathrm{west} az'(mer) \\ \alpha_\mathrm{x}^\mathrm{west} &= \alpha_\mathrm{x}^\mathrm{east}\end{split}\]If the guide star changes during the night, it changes the wiggle properties and breaks continuity. Exposure pre-shift (if the change occured before meridian crossing) or post-shift (if the change occured after meridian crossing) are then modelled differently.
- Parameters:
TBD
- Returns:
TBD
- FIT_wig_amp_nu_poly(param_in, nu_in, args=None)[source]#
Wiggle fit function: chromatic amplitude
Calls corresponding model function for optimization
- Parameters:
TBD
- Returns:
TBD
- wig_amp_nu_poly(comp_id, nu_in, params, args)[source]#
Wiggle model function: chromatic amplitude
Defines the model for wiggle chromatic amplitude
- Parameters:
TBD
- Returns:
TBD
- FIT_wig_freq_nu(param_in, nu_in, args=None)[source]#
Wiggle fit function: chromatic frequency
Calls corresponding model function for optimization
- Parameters:
TBD
- Returns:
TBD
- wig_freq_nu(comp_id, nu_in, params, args)[source]#
Wiggle model function: chromatic frequency
Defines the model for wiggle chromatic frequency
- Parameters:
TBD
- Returns:
TBD
- wig_intfreq_nu(comp_id, nu_in, params, args)[source]#
Wiggle sub-function: integrated frequency
Defines the integral of the wiggle frequency. A sinusoid frequency is the rate-of-change (= derivative) of the sinusoid phase. A given frequency profile f(t) needs to be integrated to compute the desired sinusoid phase (up to a constant additive term), from which one can then compute the desired waveform.
Assuming the frequency profile varies as a polynomial of \(\nu\)
\[\begin{split}W(\nu) &= \sin( \int_{0}^{\nu} 2 \pi f(\nu) d\nu - \Phi_\mathrm{0} ) \\ &= \sin( 2 \pi \int_{0}^{\nu} \sum_{i=0}^{d}( a[i] (\nu-\nu_\mathrm{ref})^i) d\nu - \Phi_\mathrm{0} ) \\ &= \sin( 2 \pi \sum_{i=0}^{d}( \int_{0}^{\nu} a[i] (\nu-\nu_\mathrm{ref})^i d\nu ) - \Phi_\mathrm{0} ) \\ &= \sin( 2 \pi \sum_{i=0}^{d}( a[i] \frac{(\nu-\nu_\mathrm{ref})^{i+1}}{i+1} ) - \Phi ) \\ &= \sin( 2 \pi \sum_{i=1}^{d+1}( a[i-1] \frac{(\nu-\nu_\mathrm{ref})^i}{i} ) - \Phi ) \\ &= \sin( 2 \pi \sum_{i=0}^{d+1}( d[i] (\nu-\nu_\mathrm{ref})^i ) - \Phi ) \\ &= \sin( 2 \pi f_\mathrm{Int}(\nu) - \Phi )\end{split}\]with d[0] = 0 et d[i>0] = a[i-1]/i in \(A^{-1}\).
We set \(W(\nu_\mathrm{ref}) = \sin( -\Phi )\) so that \(\Phi\) can be estimated in a given spectrum by taking the model fit at \(\nu = \nu_\mathrm{ref}\).
Locally we can assume a constant frequency \(f_\mathrm{0}\) so that \(a_\mathrm{0}\) can be directly measured through
\[W(\nu) = \sin( 2 \pi a_\mathrm{0} (\nu-\nu_\mathrm{ref}) - \Phi ) = \sin( 2 \pi f_\mathrm{0} w - \Phi_\mathrm{0} )\]
- FIT_calc_wig_mod_nu(param_in, nu_in, args=None)[source]#
Wiggle fit function: global chromatic model
Calls corresponding model function for optimization
- Parameters:
TBD
- Returns:
TBD
- calc_wig_mod_nu(nu_in, params, args)[source]#
Wiggle model function: global chromatic model
Defines the chromatic model for the wiggles in a given exposure as
\[W(\nu) = 1 + A(\nu) \sin( 2 \pi f_\mathrm{Int}(\nu) - \Phi )\]- Parameters:
TBD
- Returns:
TBD
- FIT_calc_wig_mod_nu_t(param_in, nu_all, args=None)[source]#
Wiggle fit function: global chromato-temporal model
Calls corresponding model function for optimization
- Parameters:
TBD
- Returns:
TBD
- calc_wig_mod_nu_t(nu_in, params, args)[source]#
Wiggle model function: global chromato-temporal model
The model for a given visit is defined as
\[W(\nu,c(t),it) = 1 + A(\nu,c(t),it) \sin( 2 \pi f_\mathrm{Int}(\nu,c(t)) - \Phi(c(t)) )\]With c(t) the pointing coordinates of the telescope at time t.
The model for the corresponding transmission spectrum is defined as
\[W_\mathrm{norm}(\nu,c(t),it) = \frac{W(\nu,c(t),it)}{< t , W(\nu,c(t),it-1) >}\]- Parameters:
TBD
- Returns:
TBD
- calc_chrom_coord(params, args)[source]#
Wiggle model function: properties
Calculates coordinate variations of chromatic parameters (amplitude and frequency) and offset
- Parameters:
TBD
- Returns:
TBD
- corr_fring(inst, gen_dic, data_inst, plot_dic, data_dic)[source]#
Main fringing correction routine.
Determines and applies correction for near-infrared spectrograph fringes.
- Parameters:
TBD
- Returns:
TBD
- FIT_fring_mod(param, x, args=None)[source]#
Fringing fit function
Calls corresponding model function for optimization
- Parameters:
TBD
- Returns:
TBD
- fring_mod(param, x, args=None)[source]#
Fringing model function
Defined as the product of
nominal flux : should be close to 1 as we model the ratio between two overlapping orders
4th order polynomial function, function of wavelength: model low-frequency variations, such as the blaze if not removed
amplifying sinusoidal perturbation, function of wavenumber : periodic in wavenumber, amplitude is a gaussian increasing with wavenumber
- Parameters:
TBD
- Returns:
TBD