ronswanson package
Subpackages
- ronswanson.utils package
- Submodules
- ronswanson.utils.cartesian_product module
- ronswanson.utils.check_complete module
- ronswanson.utils.color module
- ronswanson.utils.colormap_generator module
- ronswanson.utils.configuration module
- ronswanson.utils.file_open module
- ronswanson.utils.hdf5_utils module
- ronswanson.utils.logging module
- ronswanson.utils.package_data module
- ronswanson.utils.quailty_checks module
- Module contents
- Submodules
Submodules
Module contents
Top-level package for ronswanson.
- class ronswanson.Simulation(simulation_id: int, parameter_set: Dict[str, float], energy_grid: List[EnergyGrid], out_file: str, num_outputs: int = 1, num_meta_parameters: Optional[int] = None)[source]
Bases:
object
- __init__(simulation_id: int, parameter_set: Dict[str, float], energy_grid: List[EnergyGrid], out_file: str, num_outputs: int = 1, num_meta_parameters: Optional[int] = None) None [source]
Generic simulation class
- Parameters:
simulation_id (int) –
parameter_set (Dict[str, float]) –
energy_grid (np.ndarray) –
out_file (str) –
- Returns:
- class ronswanson.ParameterGrid(parameter_list: List[ronswanson.grids.Parameter], energy_grid: List[ronswanson.grids.EnergyGrid])[source]
Bases:
object
- energy_grid: List[EnergyGrid]
- full_grid: Optional[ndarray]
- property n_points: int
- property n_parameters: int
- classmethod from_dict(d: Dict[str, Dict[str, Any]]) ParameterGrid [source]
- classmethod from_yaml(file_name: str) ParameterGrid [source]
- property parameter_names: List[str]
- at_index(i: int, as_array: bool = False) Union[Dict[str, float], ndarray] [source]
return the ith set of parameters
- Parameters:
i (int) –
- Returns:
- __init__(parameter_list: List[Parameter], energy_grid: List[EnergyGrid]) None
- class ronswanson.SimulationBuilder(parameter_grid: ParameterGrid, out_file: str, import_line: str, simulation_config: SimulationConfig, gather_config: Optional[GatherConfig] = None, num_meta_parameters: Optional[int] = None, clean: bool = True, finish_missing: bool = False)[source]
Bases:
object
The simulation builder class constructs the scripts needed for building the table model database
- __init__(parameter_grid: ParameterGrid, out_file: str, import_line: str, simulation_config: SimulationConfig, gather_config: Optional[GatherConfig] = None, num_meta_parameters: Optional[int] = None, clean: bool = True, finish_missing: bool = False)[source]
TODO describe function
- Parameters:
parameter_grid (ParameterGrid) –
out_file (str) –
import_line (str) –
simulation_config (SimulationConfig) –
gather_config (Optional[GatherConfig]) –
num_meta_parameters (Optional[int]) –
clean (bool) –
- Returns:
- classmethod from_yaml(file_name: str) SimulationBuilder [source]
Create a simulation setup from a yaml file.
- class ronswanson.Database(grid_points: ndarray, parameter_names: List[str], energy_grid: ndarray, run_time: ndarray, values: ndarray, meta_data: Optional[Dict[str, ndarray]] = None)[source]
Bases:
object
- __init__(grid_points: ndarray, parameter_names: List[str], energy_grid: ndarray, run_time: ndarray, values: ndarray, meta_data: Optional[Dict[str, ndarray]] = None) None [source]
Databse of parameters and simulated values
- Parameters:
grid_points (Dict[str, np.ndarray]) –
parameter_names (List[str]) –
energy_grid (np.ndarray) –
values (Dict[str, np.ndarray]) –
- Returns:
- property n_entries: int
the number of entries in the database
- Returns:
- property n_parameters: int
the number of parameters in the database
- Returns:
- property grid_points: ndarray
- property values: ndarray
- property parameter_ranges: Dict[str, ndarray]
- property parameter_names: List[str]
the names of the parameters
- property run_time: ndarray
an array of runtimes for all points in the grid
- Returns:
- property energy_grid: ndarray
The corresponding energy grid of the simulation
- Returns:
- property meta_data: Optional[Dict[str, ndarray]]
- classmethod from_file(file_name: str, output: int = 0) Database [source]
open a database from a file. The output argument specifies which value to collect. For example, a simulation may save photon and electron distributions from a solution.
- replace_nan_inf_with(value: float = 0.0) None [source]
Replace NaN and inf values with a float
- Parameters:
value (float) –
- Returns:
- to_3ml(name: str, desc: str, overwrite: bool = False, **kwargs) TemplateModel [source]
construct a table model from the database. parameter sub-selections are passed as kwargs of dictionaries:
selections = dict(param1=dict(vmin=1, vmax=2))
- Parameters:
name (str) –
desc (str) –
overwrite (bool) –
- Returns:
- check_for_missing_parameters(parameter_grid: ParameterGrid, create_new_grid: bool = False) None [source]
Search a parameter grid for missing values
- Parameters:
parameter_grid (ParameterGrid) –
create_new_grid (bool) –
- Returns: