pyROX.cross_sections#
Classes#
Base class for handling cross-sections. |
Functions#
|
Load the data object based on the given configuration. |
Module Contents#
- pyROX.cross_sections.load_data_object(config, **kwargs)#
Load the data object based on the given configuration.
- Parameters:
config (object) – Configuration object containing database information.
**kwargs – Additional arguments to pass to the data object.
- Returns:
An instance of the appropriate data object based on the database type.
- Return type:
object
- Raises:
NotImplementedError – If the specified database is not implemented.
- class pyROX.cross_sections.CrossSections(config, download=False)#
Base class for handling cross-sections.
- static _mask_arrays(arrays, mask, **kwargs)#
Apply a mask to the given arrays.
- Parameters:
arrays (list) – List of arrays to mask.
mask (array-like) – Boolean mask to apply.
**kwargs – Additional arguments for numpy.compress.
- Returns:
List of masked arrays.
- Return type:
list
- database#
- abstractmethod download_data(*args, **kwargs)#
Download data required for cross-section calculations.
- Raises:
NotImplementedError – This method should be implemented in a subclass.
- abstractmethod calculate_temporary_outputs(*args, **kwargs)#
Calculate temporary outputs for cross-sections.
- Raises:
NotImplementedError – This method should be implemented in a subclass.
- abstractmethod plot_combined_outputs(*args, **kwargs)#
Plot merged outputs for cross-sections.
- Raises:
NotImplementedError – This method should be implemented in a subclass.
- save_combined_outputs(keys_to_merge, progress_bar=False, overwrite=False, **kwargs)#
Combine temporary files and save the final output.
- Parameters:
keys_to_merge (list) – List of keys to combine.
progress_bar (bool, optional) – Whether to show a progress bar. Defaults to False.
overwrite (bool, optional) – Whether to overwrite the final output file if it exists. Defaults to False.
**kwargs – Additional arguments for merging.
- combine_temporary_outputs(keys_to_merge, progress_bar=False, **kwargs)#
Combine temporary output-files into a single dataset.
- Parameters:
keys_to_merge (list) – List of keys to read from the temporary files.
progress_bar (bool, optional) – Whether to show a progress bar. Defaults to False.
**kwargs – Additional arguments for merging.
- Raises:
FileNotFoundError – If no temporary cross-section files are found.
ValueError – If the temperature grid is not found in a temporary file.
- _combine_PT_grids(tmp_files, sum_outputs)#
Combine the PT-grids of the temporary files.
- Parameters:
tmp_files (list) – List of temporary files to combine.
sum_outputs (bool) – Whether to sum the outputs.
- Returns:
A tuple containing the main wavelength grid, pressure grid, temperature grid, and a list of booleans indicating if the wavelength axis was flipped.
- Return type:
tuple
- Raises:
ValueError – If the PT grid is not rectangular or grids are incompatible.
- _check_if_sum_outputs()#
Check if the cross-sections should be summed.
- Returns:
True if the outputs should be summed, False otherwise.
- Return type:
bool
- _check_existing_output_files(input_files=[''], overwrite_all=False, final_output_file=None)#
Check if the output files already exist.
- Parameters:
input_files (list) – List of input file paths.
overwrite_all (bool) – Whether to overwrite all existing files.
final_output_file (str) – Expected output file name.
- Returns:
List of output file paths.
- Return type:
list
- _read_configuration_parameters(config)#
Read parameters from the configuration object.
- Parameters:
config (object) – Configuration object containing parameters.
- Raises:
ValueError – If no input-data files are specified in the configuration.
- _setup_nu_grid()#
Configure the wavenumber grid based on the configuration parameters.
- _setup_coarse_nu_grid(adaptive_delta_nu)#
Configure a coarse wavenumber grid for adaptive calculations.
- Parameters:
adaptive_delta_nu (float) – Desired resolution for the coarse grid.
- Returns:
Coarse wavenumber grid.
- Return type:
numpy.ndarray