Simulation Grid

class RegisteredDimension(_property, first_impact=None, last_impact=None, title=None)[source]

Bases: property

Register a class property getter as a PyMonte simulation dimension.

Registered properties may specify their simulation stage impacts and therefore significantly increase simulation runtime in cases where computationally demanding section re-calculations can be reduced.

Parameters:
  • first_impact (str | None) – Name of the first simulation stage within the simulation pipeline which is impacted by manipulating this property. If not specified, the initial stage is assumed.

  • last_impact (str | None) – Name of the last simulation stage within the simulation pipeline which is impacted by manipulating this property. If not specified, the final stage is assumed.

  • title (str | None) – Displayed title of the dimension. If not specified, the dimension’s name will be assumed.

deleter(fdel)[source]

Descriptor to obtain a copy of the property with a different deleter.

Return type:

RegisteredDimension

getter(fget)[source]

Descriptor to obtain a copy of the property with a different getter.

Return type:

RegisteredDimension

classmethod is_registered(object)[source]

Check if any object is a registered PyMonte simulation dimension.

Parameters:

object (object) – The object in question.

Return type:

bool

Returns:

A boolean indicator.

setter(fset)[source]

Descriptor to obtain a copy of the property with a different setter.

Return type:

RegisteredDimension

property first_impact: str | None[source]

First impact of the dimension within the simulation pipeline.

property last_impact: str | None[source]

Last impact of the dimension within the simulation pipeline.

property title: str | None[source]

Displayed title of the dimension.

class register(*args, **kwargs)[source]

Bases:

Shorthand to register a property as a MonteCarlo dimension.

Parameters:

_property – The property to be registered.

Return type:

Callable[[object], RegisteredDimension]

class SamplePoint(value, title=None)[source]

Bases: object

Sample point of a single grid dimension.

A single GridDimension holds a sequence of sample points accesible by the sample_points property. During simulation runtime, the simulation will dynamically reconfigure the scenario selecting a single sample point out of each GridDimension per generated simulation sample.

Parameters:
  • value (object) – Sample point value with which to configure the grid dimension.

  • title (str | None) – String representation of this sample point. If not specified, the simulation will attempt to infer an adequate representation.

property title: str[source]

String representation of this sample point

property value: object[source]

Sample point value with which to configure the grid dimension

class GridDimension(considered_objects, dimension, sample_points, title=None, plot_scale=None, tick_format=None)[source]

Bases: GridDimensionInfo

Single axis within the simulation grid.

A grid dimension represents a single simulation parameter that is to be varied during simulation runtime to observe its effects on the evaluated performance indicators. The values the represented parameter is configured to are SamplePoints.

Parameters:
  • considered_objects (object | tuple[object, ...]) – The considered objects of this grid section.

  • dimension (str) – Path to the attribute.

  • sample_points (Sequence[SamplePoint | object]) – Sections the grid is sampled at.

  • title (str | None) – Title of this dimension. If not specified, the attribute string is assumed.

  • plot_scale (str | None) – Scale of the axis within plots.

  • tick_format (ValueType | None) – Format of the tick labels. Linear by default.

Raises:

ValueError – If the selected dimension does not exist within the considered_object.

configure_point(point_index)[source]

Configure a specific sample point.

Parameters:

point_index (int) – Index of the sample point to configure.

Raises:

ValueError – For invalid indexes.

Return type:

None

property considered_objects: tuple[object, ...][source]

Considered objects of this grid section.

property dimension: str[source]

Dimension property name.

property first_impact: str | None[source]

Index of the first impacted simulation pipeline stage.

None, if the stage is unknown.

property last_impact: str | None[source]

Index of the last impacted simulation pipeline stage.

None, if the stage is unknown.

class GridDimensionInfo(sample_points, title, plot_scale, tick_format)[source]

Bases: object

Basic information about a grid dimension.

property num_sample_points: int[source]

Number of dimension sample points.

Returns: Number of sample points.

property plot_scale: str[source]

Scale of the scalar evaluation plot.

Refer to the Matplotlib documentation for a list of a accepted values.

property sample_points: list[SamplePoint][source]

Sample points of this grid dimension.

property tick_format: ValueType[source]

Axis tick format of the scalar evaluation plot.

property title: str[source]

Title of this grid dimension.

class ScalarDimension[source]

Bases: ABC

Base class for objects that can be configured by scalar values.

When a property of type ScalarDimension is defined as a simulation parameter GridDimension, the simulation will automatically configure the object with the scalar value of the sample point during simulation runtime.

The configuration operation is represented by the lshift operator <<.

abstract property title: str[source]

Title of the scalar dimension.

Displayed in plots and tables during simulation runtime.