ronswanson package

Subpackages

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:

run() None[source]

run this simulation :returns:

class ronswanson.ParameterGrid(parameter_list: List[ronswanson.grids.Parameter], energy_grid: List[ronswanson.grids.EnergyGrid])[source]

Bases: object

parameter_list: List[Parameter]
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]
to_dict() Dict[str, Dict[str, Any]][source]
write(file_name: str) None[source]
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]]
at(i: int) ValueContainer[source]

return the parameters and values at an index

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:
Returns:

plot_runtime(colorscale: str = 'plasma')[source]

show a parallel plot of the run time

Parameters:

colorscale

Returns:

plot_meta_data(meta_number: int = 0, colorscale: str = 'plasma', as_log: bool = False)[source]

parallel plot of the meta data

Parameters:
  • meta_number (int) –

  • colorscale (str) –

  • as_log (bool) –

Returns:

ronswanson.update_logging_level(level)[source]
ronswanson.show_configuration() Tree[source]