ACID_code_v2.Data

class ACID_code_v2.Data(wavelengths: Dict[str, ~numpy.ndarray]=<factory>, flux: Dict[str, ~numpy.ndarray]=<factory>, errors: Dict[str, ~numpy.ndarray]=<factory>, sn: Dict[str, ~numpy.ndarray]=<factory>, alpha: ndarray | None = None, c_factor: tuple | None = None, residual_masks: ndarray | None = None, nanmask: ndarray | None = None, velocities: ndarray | None = None, initial_profile: ndarray | None = None, initial_profile_errors: ndarray | None = None, poly_inputs: ndarray | None = None, initial_model_inputs: ndarray | None = None, model_inputs: ndarray | None = None, initial_state: ndarray | None = None, nwalkers: int | None = None, ndim: int | None = None, profiles: ndarray | None = None, nsteps: int | None = 0, max_steps: int | None = None, initialisation_time: float | None = None, mcmc_time: float | None = None, get_profiles_time: float | None = None, full_run_time: float | None = None, plotting_variables: Dict[str, ~typing.Any]=<factory>, _config: Config = <factory>, _linelist: Dict[str, ~numpy.ndarray] | None=None)[source]

Stores necessary data for the Acid class which can be conveniently updated and saved. Allows ACID to handle data that has already been computed to avoid recalculation. This class is designed to be lightweight in memory and hence does not store the sampler as an object. Note that a Data class should only hold the data for ONE order or observation, but it can hold the data for multiple frames of the same order.

wavelengths: Dict[str, ndarray]
flux: Dict[str, ndarray]
errors: Dict[str, ndarray]
sn: Dict[str, ndarray]
alpha: ndarray | None
c_factor: tuple | None
residual_masks: ndarray | None
nanmask: ndarray | None
velocities: ndarray | None
initial_profile: ndarray | None
initial_profile_errors: ndarray | None
poly_inputs: ndarray | None
initial_model_inputs: ndarray | None
model_inputs: ndarray | None
initial_state: ndarray | None
nwalkers: int | None
ndim: int | None
profiles: ndarray | None
nsteps: int | None
max_steps: int | None
initialisation_time: float | None
mcmc_time: float | None
get_profiles_time: float | None
full_run_time: float | None
plotting_variables: Dict[str, Any]
plot_continuum_fit(plot_type: str = 'initial', return_fig: bool = False, save_fig: str | None = None) None[source]
plot_residual_masking(save_fig: str | None = None) None[source]
set_inputs(input_wavelengths: ndarray | None = None, input_flux: ndarray | None = None, input_errors: ndarray | None = None, input_sn: ndarray | None = None, skips: int = 1) None[source]

Sets the input data for the ACID class. This is used to initialize the data object with the raw spectra, and to validate the arguments (previously done within the ACID function). :param input_wavelengths: Wavelength array for the input spectra, by default None :type input_wavelengths: np.ndarray, optional :param input_flux: Flux array for the input spectra, by default None :type input_flux: np.ndarray, optional :param input_errors: Error array for the input spectra, by default None :type input_errors: np.ndarray, optional :param input_sn: Signal-to-noise array for the input spectra, by default None :type input_sn: np.ndarray, optional :param skips: Number of pixels to skip when processing the spectra, by default 1 (no skipping) :type skips: int, optional

save(filename: str = 'data.pkl') None[source]

Saves the data object to a file using pickling. This will store just the dictionary of the class, not the actual class itself. The load function then will initialise a new Data class using the dictionary.

Parameters:

filename (str) – The name of the file to save the data object to. This should be a .pkl file.

classmethod load(filename: str)[source]
to_dict() dict[str, Any][source]

Converts the data object to a dictionary payload for saving. This is used internally in the save method, but can also be used for debugging or other purposes.

from_dict(payload: dict[str, Any]) None[source]

Updates the data object from a dictionary payload. This is used internally in the load method, but can also be used for debugging or other purposes.

property config: Config

Returns the internally stored config object, which contains the configuration of the ACID run.

property linelist: Dict[str, ndarray]

Returns the internally stored linelist. It has keys “wavelengths” and “depths” or index 0 and 1.

set_linelist(linelist=None, linelist_wl=None, linelist_depths=None) None[source]
plot_linelist(min_depth: ACID_code_v2.utils.Scalar = 0.2, bounds: tuple | list | None = None, return_fig: bool = False) None | tuple[source]

Plots the linelist points with their corresponding depths as delta-function lines.

Parameters:
  • min_depth (Scalar) – The minimum depth for plotting the linelist points.

  • bounds (tuple or list, optional) – The wavelength bounds for clipping the linelist. If None, no clipping is applied.

  • return_fig (bool, optional) – If True, returns the figure and axis objects instead of displaying the plot.