arve.data package

Submodules

arve.data.add_data module

class arve.data.add_data.add_data[source]

Bases: object

add_data(time_val: ndarray | None = None, vrad_val: ndarray | None = None, vrad_err: ndarray | None = None, berv_val: ndarray | None = None, wave_val: ndarray | None = None, flux_val: ndarray | None = None, flux_err: ndarray | None = None, medium: Literal['vac', 'air'] = 'vac', format: Literal['s1d', 's2d'] = 's1d', files: list[str] | None = None, path: str | None = None, extension: Literal['fits', 'npz', 'csv'] | None = None, compression: str | None = None, instrument: Literal['espresso', 'harps', 'harps-n', 'kpf', 'neid', 'nirps', 'spirou'] | None = None, resolution: float | None = None, berv_corrected: bool = True, same_wave_grid: bool = False, interpolation: Literal['linear', 'nearest', 'nearest-up', 'zero', 'slinear', 'quadratic', 'cubic', 'previous', 'next'] = 'cubic') None[source]

Add data.

Parameters:
  • time_val (np.ndarray | None, optional) – time values, by default None

  • vrad_val (np.ndarray | None, optional) – radial velocity values, by default None

  • vrad_err (np.ndarray | None, optional) – radial velocity errors, by default None

  • berv_val (np.ndarray | None, optional) – barycentric-Earth radial velocity (BERV) values, by default None

  • wave_val (np.ndarray | None, optional) – wavelength values, by default None

  • flux_val (np.ndarray | None, optional) – flux values, by default None

  • flux_err (np.ndarray | None, optional) – flux errors, by default None

  • medium (Literal["vac", "air"], optional) – medium of recorded wavelengths, by default “vac”

  • format (Literal["s1d", "s2d"], optional) – spectral format, by default “s1d”

  • files (list[str] | None, optional) – list of files of spectra including their path, by default None

  • path (str | None, optional) – path to spectra, by default None

  • extension (Literal["fits", "npz", "csv"] | None, optional) – extension of files containing the spectra, by default None

  • compression (str | None, optional) – compression of files containing the spectra, by default None

  • instrument (Literal["espresso", "harps", "harps-n", "kpf", "neid", "nirps", "spirou"] | None, optional) – instrument name (if the spectra are in FITS files), by default None

  • resolution (float | None, optional) – instrumental resolution (if the spectra are in NPZ or CSV files), by default None

  • berv_corrected (bool, optional) – spectra already BERV-corrected, by default True

  • same_wave_grid (bool, optional) – spectra already on the same wavelength grid, by default False

  • interpolation (Literal["linear", "nearest", "nearest-up", "zero", "slinear", "quadratic", "cubic", "previous", "next"], optional) – kind of interpolation of spectra onto common wavelength grid, by default “cubic”

Returns:

None

Return type:

None

arve.data.compute_spec_reference module

class arve.data.compute_spec_reference.compute_spec_reference[source]

Bases: object

compute_spec_reference(N_spec: int | None = None, oversamp: int = 10, smooth: bool = False) None[source]

Compute reference spectrum.

Parameters:
  • N_spec (int | None, optional) – number of spectra used to build the reference (if None, all input spectra will be considered), by default None

  • oversamp (int, optional) – oversampling factor of the wavelength grid, by default 10

  • smooth (bool, optional) – smooth the individual spectra before building the reference, by default False

Returns:

None

Return type:

None

arve.data.compute_vrad_ccf module

class arve.data.compute_vrad_ccf.compute_vrad_ccf[source]

Bases: object

compute_vrad_ccf(weight_name: str | None = None, vrad_grid: list[float] | None = None, ccf_err_scale: bool = False, criteria: list[str] | None = None, exclude_tellurics: bool = True, exclude_regions: bool = True) None[source]

Compute radial velocities (RVs) from spectral data using the cross-correlation function (CCF) method.

Parameters:
  • weight_name (str | None, optional) – name of float column available in the mask to be used as weight (if None, all lines are weighted equally), by default None

  • vrad_grid (list[float] | None, optional) – velocity grid, in the format [start,stop,step] and in units of km/s, on which to evaluate the CCF (if None, the grid is set to [-20,20,v_med] where v_med is the median wavelength step converted to a velocity), by default None

  • ccf_err_scale (bool, optional) – scale the CCF errors if the velocity grid is under- or over-sampled, by default False

  • criteria (list[str] | None, optional) – criteria to apply (must be boolean columns available in the mask), by default None

  • exclude_tellurics (bool, optional) – exclude telluric bands, by default True

  • exclude_regions (bool, optional) – exclude wavelength intervals, by default True

Returns:

None

Return type:

None

arve.data.compute_vrad_lbl module

class arve.data.compute_vrad_lbl.compute_vrad_lbl[source]

Bases: object

compute_vrad_lbl(scale: bool = True, bins: list[list[float]] | None = None, N_iter: int = 1, vrad_err_lim: float = 0.001, criteria: list[str] | None = None, exclude_tellurics: bool = True, exclude_regions: bool = True) None[source]

Compute radial velocities (RVs) from spectral data using the line-by-line (LBL) method.

Parameters:
  • scale (bool, optional) – scale reference spectrum when fitting, by default True

  • bins (list[list[float]] | None, optional) – formation temperature bins with which to segment each line (if None, only 1 bin with the entire line-forming temperature range is considered), by default None

  • N_iter (int, optional) – number of iterations per line segment (the inital RV guess is updated from the previous iteration), by default 1

  • vrad_err_lim (float, optional) – RV error lower limit (used to prevent diverging RVs due to null errors returned by the numerical solver for some lines), by default 1e-3

  • criteria (list[str] | None, optional) – criteria to apply (must be boolean columns available in the mask), by default None

  • exclude_tellurics (bool, optional) – exclude telluric bands, by default True

  • exclude_regions (bool, optional) – exclude wavelength intervals, by default True

Returns:

None

Return type:

None

arve.data.get_aux_data module

class arve.data.get_aux_data.get_aux_data[source]

Bases: object

get_aux_data(mask_path: str | None = None, mask_medium: Literal['vac', 'air'] = 'vac', tell_wave: ndarray | None = None, tell_flux: ndarray | None = None, tell_lim: float = 0.99, exclude_regions: list[list[float]] | None = None) None[source]

Get auxiliary data.

Parameters:
  • mask_path (str | None, optional) – path to self-provided line mask (must be a CSV file where the relevant columns are named the same as in the package-provided masks), by default None

  • mask_medium (Literal["vac", "air"], optional) – medium of mask wavelengths, by default “vac”

  • tell_wave (np.ndarray | None, optional) – wavelength values of normalized telluric spectrum (to replace the general model), by default None

  • tell_flux (np.ndarray | None, optional) – flux values of normalized telluric spectrum (to replace the general model), by default None

  • tell_lim (float, optional) – normalized flux limit on telluric features (to add a criterion column for stellar lines unaffected by tellurics), by default 0.99

  • exclude_regions (list[list[float]] | None, optional) – wavelength intervals to be excluded (to add a criterion column for stellar lines outside the excluded regions), by default None

Returns:

None

Return type:

None

arve.data.plot_spec_data module

class arve.data.plot_spec_data.plot_spec_data[source]

Bases: object

plot_spec_data(figsize: tuple = (20, 10), xlim: list[float] | None = None, ylim: list[float] | None = None, orders: list[int] | None = None, include_obs_data: bool = True, include_aux_data: bool = True, plot_spec: bool = True, plot_tell: bool = True, plot_band: bool = True, plot_excl: bool = True, plot_mask: bool = True, add_legend: bool = True, annotate: bool = False) Figure[source]

Plot spectral data.

Parameters:
  • figsize (tuple, optional) – figure size, by default (20,10)

  • xlim (list[float] | None, optional) – x limits, by default None

  • ylim (list[float] | None, optional) – y limits, by default None

  • orders (list[int] | None, optional) – indices of orders to plot, by default None

  • include_obs_data (bool, optional) – include observed data, by default True

  • include_aux_data (bool, optional) – include auxiliary data, by default True

  • plot_spec (bool, optional) – plot stellar spectrum, by default True

  • plot_tell (bool, optional) – plot telluric spectrum, by default True

  • plot_band (bool, optional) – plot telluric bands, by default True

  • plot_excl (bool, optional) – plot excluded wavelength regions, by default True

  • plot_mask (bool, optional) – plot stellar line mask, by default True

  • add_legend (bool, optional) – add legend about line colors, by default True

  • annotate (bool, optional) – annonate spectral lines with atomic information, by default False

Returns:

figure with the spectral data

Return type:

plt.Figure

arve.data.plot_vrad module

class arve.data.plot_vrad.plot_vrad[source]

Bases: object

plot_vrad(figsize: tuple = (20, 10)) Figure[source]

Plot RV time series.

Parameters:

figsize (tuple, optional) – figure size, by default (20,10)

Returns:

figure with the RV time series

Return type:

plt.Figure

arve.data.read_spec module

class arve.data.read_spec.read_spec[source]

Bases: object

read_spec(i: int) tuple[ndarray][source]

Read spectrum.

Parameters:

i (int) – spectrum index

Returns:

wavelength values, flux values and flux errors of i:th spectrum

Return type:

tuple[np.ndarray]

Module contents

class arve.data.Data(arve)[source]

Bases: add_data, compute_spec_reference, compute_vrad_ccf, compute_vrad_lbl, get_aux_data, plot_spec_data, plot_vrad, read_spec

ARVE Data subclass.