blueetl.campaign.config

Simulation Campaign configuration.

Classes

SimulationCampaign(data, name, attrs[, ...])

Simulation campaign configuration.

SimulationRow(index, path, conditions)

Simulation row in the simulation campaign.

class blueetl.campaign.config.SimulationCampaign(data: DataFrame, name: str, attrs: dict, config_dir: Path | None = None)

Bases: object

Simulation campaign configuration.

Init the configuration.

Parameters:
  • data – DataFrame of simulation paths, having as columns: simulation_path, and the parameters used for each simulation (for example: seed, ca…).

  • name – name of the Simulation Campaign.

  • attrs – dict of custom attributes.

  • config_dir – if specified, it’s used to resolve relative paths in attrs.

property attrs: dict

Return the attributes dict associated with the simulations campaign.

property condition_names: list[str]

Return the names of the parameters used to run the simulations.

property conditions: DataFrame

Return the DataFrame of the parameters used to run the simulations.

dump(path: str | PathLike) None

Save the configuration to file.

classmethod from_dict(d: dict, config_dir: Path | None = None) SimulationCampaign

Load the configuration from dict.

classmethod from_xarray(da: xarray.DataArray, config_dir: Path | None = None) SimulationCampaign

Load the configuration from xarray.DataArray.

classmethod from_xarray_dict(d: dict, config_dir: Path | None = None) SimulationCampaign

Load the configuration from a dict representing xarray.DataArray.

get(*args, **kwargs) DataFrame

Return a DataFrame with the selected simulations.

See etl.q for the filter syntax.

ids(*args, **kwargs) ndarray

Return a numpy array with the ids of the selected simulations.

See etl.q for the filter syntax.

is_coupled()

Return True if the coords are coupled, False otherwise.

is_sonata()

Return True if the simulations are in SONATA format, False otherwise.

classmethod load(path: str | PathLike) SimulationCampaign

Load the configuration from file.

Different file formats are supported:

  • xarray (json or yaml): configuration produced by bbp-workflow.

  • blueetl (json or yaml): configuration produced by this same class.

Parameters:

path – path to the configuration file.

Returns:

new instance.

Return type:

SimulationCampaign

property name: str

Return the name of the simulations campaign.

to_dict() dict

Convert the configuration to dict.

to_xarray() xarray.DataArray

Convert the configuration to xarray.DataArray.

to_xarray_dict() dict

Return the configuration as a dict representing xarray.DataArray.

class blueetl.campaign.config.SimulationRow(index: int, path: str, conditions: dict[str, Any])

Bases: object

Simulation row in the simulation campaign.

property empty: bool

Return True if the simulation has been excluded when running the campaign.