antaress.ANTARESS_conversions.ANTARESS_binning module#
- process_bin_prof(mode, data_type_gen, gen_dic, inst, vis_in, data_dic, coord_dic, data_prop, system_param, theo_dic, plot_dic, ar_dic={}, masterDIweigh=False)[source]#
Binning routine
Bins series of input spectral profile into a new series along the chosen temporal/spatial dimension.
for a given visit or between several visits
binned profiles are calculated as weighted means with weights specific to the type of profiles
binned profiles are used for analysis purposes
master profiles used to extract differential profiles from each exposure are calculated in extract_diff_profiles()
- Parameters:
TBD
- Returns:
TBD
- init_bin_prof(data_type, ref_pl, idx_in_bin, dim_bin, coord_dic, inst, vis_to_bin, data_dic, gen_dic, bin_prop)[source]#
Binning routine: initialization
Initializes process_bin_prof().
- Parameters:
TBD
- Returns:
TBD
- weights_bin_prof_calc(data_type_gen, data_type, gen_dic, data_dic, inst, check_var=True)[source]#
Binning routine: calculations
Identifies which components needs to be calculated
- Parameters:
TBD
- Returns:
TBD
- weights_bin_prof(iord_orig_list, scaled_data_paths, inst, vis, gen_corr_Fbal, gen_corr_FbalOrd, save_data_dir, nord, iexp_glob, data_type, data_format, dim_exp, tell_exp, gcal_exp, cen_bins, dt, flux_ref_exp, cov_ref_exp, calc_cond, flux_est_loc_exp=None, cov_est_loc_exp=None, SpSstar_spec=None, glob_flux_sc=None, sdet_exp2=None, EFsc2_all_in=None, EFdiff2_in=None, EFintr2_in=None, EFem2_in=None, EAbs2_in=None)[source]#
Binning routine: weights
Defines weights to be used when binning profiles. Weights should only be defined using the inverse squared error if the weighted values are comparable, so that all profiles should have been scaled to comparable flux levels prior to binning. Profiles must be defined on the same spectral table to be binned together.
- Parameters:
TBD
- Returns:
TBD
- calc_bin_prof(idx_to_bin, nord, dim_exp, nspec, data_to_bin_in, inst, n_in_bin, cen_bins_exp, edge_bins_exp, dx_ov_in=None)[source]#
Spectral profile binning
Main routine to bin input spectral profiles, defined over a common spectral table, into a single spectral profile
propagates covariance matrixes
uses spectral weight profiles
assumes profiles are independent along the binning dimension
- Parameters:
TBD
- Returns:
TBD
- pre_calc_bin_prof(n_in_bin, dim_sec, idx_to_bin, resamp_mode, dx_ov_in, data_to_bin, edge_bins_resamp, nocov=False, tab_delete=None)[source]#
Spectral binning: pre-processing
Cleans and normalizes profiles and their weights before binning.
- Parameters:
TBD
- Returns:
TBD
- resample_func(x_bd_low_in, x_bd_high_in, x_low_in_all, x_high_in_all, flux_in_all, err_in_all, remove_empty=True, dim_bin=0, cond_def_in_all=None, multi=False, adj_xtab=True)[source]#
General profiles binning
Bins input profiles into a new series of profiles, along the chosen dimension
Propagates variance only
Natural weighing by the size of the original bins along the binning dimension
Original and final bins can be discontinuous and of different sizes. Original bins can overlap and be given as a single input table. Input tables must have the same stucture and dimensions, except along the binned dimension .
This resampling assumes that the flux density is constant over each pixel, ie that the same number of photons is received by every portion of the pixel. In practice this is not the case, as the flux may vary sharply from one pixel to the next, and thus the flux density varies over a pixel (as we would measure at a higher spectral resolution). The advantage of the present resampling is that it conserves the flux, which is not necessarily the case for interpolation.
nan values can be left in the input tables, so that new pixels that overlap with them will be set conservatively to nan. They can also be removed before input to speed up calculation, in which case the new pixel will be defined based on defined, overlapping pixels.
If a new pixel is only partially covered by input pixels, its boundaries can be re-adjusted to the maximum overlapping range.
The x tables must not contain nan so that they can be sorted. The x tables must correspond to the dimension set by dim_bin.
Multiprocessing takes longer than the standard loop, even for tens of exposures and the full ESPRESSO spectra.
- Parameters:
TBD
- Returns:
TBD
- sub_calc_bins(low_bin, high_bin, raw_loc_dic, nfilled_bins, calc_Fr=False, calc_gcal=False, adjust_bins=True)[source]#
Simplified binning routine
Used instead of the resampling function when only the flux is binned and/or the bins are large enough that we can neglect the covariance between them. This is also why we can bin the master and exposure over defined pixels (ie, ignoring some of the pixels that might be undefined within a bin). Otherwise the covariance matrix would need to be resampled over all consecutive pixels, included undefined ones, and the binned pixels would be set to undefined by the resampling function.
- Parameters:
TBD
- Returns:
TBD