bag.interface.ocean

This module implements bag’s interaction with an ocean simulator.

Module Contents

Classes

OceanInterface

This class handles interaction with Ocean simulators.

class bag.interface.ocean.OceanInterface(tmp_dir: str, sim_config: Dict[str, Any])[source]

Bases: bag.interface.simulator.SimProcessManager

This class handles interaction with Ocean simulators.

Parameters:
  • tmp_dir (str) – temporary file directory for SimAccess.

  • sim_config (Dict[str, Any]) – the simulation configuration dictionary.

format_parameter_value(param_config: Dict[str, Any], precision: int) str[source]

Format the given parameter value as a string.

To support both single value parameter and parameter sweeps, each parameter value is represented as a string instead of simple floats. This method will cast a parameter configuration (which can either be a single value or a sweep) to a simulator-specific string.

Parameters:
  • param_config (Dict[str, Any]) –

    a dictionary that describes this parameter value.

    4 formats are supported. This is best explained by example.

    single value: dict(type=’single’, value=1.0)

    sweep a given list of values: dict(type=’list’, values=[1.0, 2.0, 3.0])

    linear sweep with inclusive start, inclusive stop, and step size: dict(type=’linstep’, start=1.0, stop=3.0, step=1.0)

    logarithmic sweep with given number of points per decade: dict(type=’decade’, start=1.0, stop=10.0, num=10)

  • precision (int) – the parameter value precision.

Returns:

param_str – a string representation of param_config

Return type:

str

_get_ocean_info(save_dir, script_fname, log_fname)[source]

Private helper function that launches ocean process.

setup_sim_process(lib: str, cell: str, outputs: Dict[str, str], precision: int, sim_tag: Optional[str]) bag.interface.simulator.ProcInfo[source]
setup_load_process(lib: str, cell: str, hist_name: str, outputs: Dict[str, str], precision: int) bag.interface.simulator.ProcInfo[source]