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, model_inputs: ndarray | None = None, initial_state: ndarray | None = None, nwalkers: int | None = None, ndim: int | None = None, all_frames: 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, _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.
- 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
- model_inputs: ndarray | None
- initial_state: ndarray | None
- nwalkers: int | None
- ndim: int | None
- all_frames: 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
- 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
- initiate_all_frames(all_frames: ndarray) None[source]
Initiates the all_frames variable, used in the ACID method, to eventually store the results of the MCMC sampling. This is used to update the all_frames variable after each sampling step, allowing for resuming and avoiding recalculation of profiles if the user wishes to continue sampling.
- Parameters:
all_frames (np.ndarray) – The array of all frames to be stored in the data class. This should be of shape (n_steps, n_profiles, 2) where the last dimension contains the profile and its error.
- 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.
- 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.