astrocook.recipes.flux module#
- class astrocook.recipes.flux.RecipeFluxV2(session_v2: SessionV2)[source]#
Bases:
objectRecipes for manipulating spectral flux and grid sampling.
These methods are accessed via the
session.fluxattribute and delegate logic toSpectrumV2.- calculate_running_std(input_col: str = 'y', output_col: str = 'running_std', window_pix: str = '21') SessionV2[source]#
Calculate running standard deviation.
Calculates a running Root-Mean-Square (RMS) on a specific column to estimate local error or variability. Delegates to
astrocook.core.spectrum.SpectrumV2.calculate_running_std().- Parameters:
input_col (str, optional) – The column to use for StdDev calculation (e.g.,
'y'). Defaults to'y'.output_col (str, optional) – Name of the new column to create (e.g.,
'running_std'). Defaults to'running_std'.window_pix (str, optional) – Total window size in pixels (should be odd). Defaults to
'21'.
- Returns:
A new
SessionV2with the calculated column added, or 0 on failure.- Return type:
SessionV2 or int
- smooth(sigma_kms: str = '100.0') SessionV2[source]#
Smooth spectrum.
Applies a Gaussian filter to the spectrum flux (y-axis), error (dy-axis), and auxiliary columns. Delegates to
astrocook.core.spectrum.SpectrumV2.smooth().
- rebin(xstart: str = 'None', xend: str = 'None', dx: str = '10.0', xunit: str = 'km/s', kappa: str = '5.0', filling: str = 'nan', norm: str = 'False') SessionV2[source]#
Rebin spectrum.
Applies a new binning to a spectrum with a constant bin size. Delegates to
astrocook.core.spectrum.SpectrumV2.rebin().- Parameters:
xstart (str, optional) – Start wavelength/velocity.
'None'for auto (data minimum). Defaults to'None'.xend (str, optional) – End wavelength/velocity.
'None'for auto (data maximum). Defaults to'None'.dx (str, optional) – Step size in x. Defaults to
'10.0'.xunit (str, optional) – Unit of wavelength or velocity for the step size (e.g.,
'km/s','nm'). Defaults to'km/s'.kappa (str, optional) – Sigma clipping threshold for binning.
'None'for off. Defaults to'5.0'.filling (str, optional) – Value to fill regions without data. Defaults to
'nan'.norm (str, optional) – (Legacy flag, currently unused). Defaults to
'False'.
- Returns:
A new
SessionV2with the rebinned spectrum, or 0 on failure.- Return type:
SessionV2 or int
- equalize(reference_session: str = 'None', order: str = '0') SessionV2[source]#
Equalize flux to a reference session.
Scales the flux of the current session to match the flux level of a reference session using a polynomial scaling model.
- Parameters:
reference_session (str, optional) – The name of the reference session. Defaults to
'None'.order (str, optional) – The polynomial order for the scaling model (
'0'= scalar,'-1'= spline). Defaults to'0'.
- Returns:
A new session with the scaled flux. Returns
0(int) on failure.- Return type:
- resample(target_session: str = 'None') SessionV2[source]#
Resample on another grid.
Resamples this spectrum onto the exact wavelength grid of another open session. This is often a prerequisite for multi-session arithmetic. Delegates to
astrocook.core.spectrum.SpectrumV2.resample_on_grid().
- calibrate_from_magnitudes(magnitudes: str = 'SDSS_r=17.0') SessionV2[source]#
Flux calibrate (multi-band).
Warps the spectrum SED to match multiple photometric points. Delegates to
astrocook.core.spectrum.SpectrumV2.calibrate().