ronswanson.database module

class ronswanson.database.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: