Artifact

Inheritance diagram of hermespy.core.pymonte.artifact.Artifact, hermespy.core.pymonte.artifact.MonteCarloSample, hermespy.core.pymonte.artifact.ArtifactTemplate
class Artifact[source]

Bases: ABC

Result of an investigated object evaluation.

Generated by Evaluator instances operating on investigated object states. In other words, Evaluator.evaluate is expected to return an instance derived of this base class.

Artifacts may, in general represent any sort of object. However, it is encouraged to provide a scalar floating-point representation for data visualization by implementing the to_scalar() method.

abstract to_scalar()[source]

Scalar representation of this artifact’s content.

Used to evaluate premature stopping criteria for the underlying evaluation.

Return type:

float | None

Returns:

Scalar floating-point representation. None if a conversion to scalar is impossible.

class MonteCarloSample(grid_section, sample_index, artifacts)[source]

Bases: object

Single sample of a Monte Carlo simulation.

Parameters:
  • grid_section (tuple[int, ...]) – Grid section from which the sample was generated.

  • sample_index (int) – Index of the sample. In other words this object represents the sample_index`th sample of the selected `grid_section.

  • artifacts (Sequence[Artifact]) – Artifacts of evaluation

property artifact_scalars: ndarray[source]

Collect scalar artifact representations.

Returns: Vector of scalar artifact representations.

property artifacts: Sequence[Artifact][source]

Artifacts resulting from the sample’s evaluations.

property grid_section: tuple[int, ...][source]

Grid section from which this sample was generated.

property num_artifacts: int[source]

Number of contained artifact objects.

property sample_index: int[source]

Index of the sample this object represents.

class ArtifactTemplate(artifact)[source]

Bases: Generic[FAT], Artifact

Scalar numerical result of an investigated object evaluation.

Implements the common case of an Artifact representing a scalar numerical value.

Parameters:

artifact (TypeVar(FAT, bound= SupportsFloat)) – Artifact value.

to_scalar()[source]

Scalar representation of this artifact’s content.

Used to evaluate premature stopping criteria for the underlying evaluation.

Return type:

float

Returns:

Scalar floating-point representation. None if a conversion to scalar is impossible.

property artifact: FAT[source]

Evaluation artifact.

Provides direct access to the represented artifact.

Returns: Copy of the artifact.

class AT[source]

Type of Monte Carlo evaluation artifact.

alias of TypeVar(‘AT’, bound=Artifact)

class FAT[source]

Type of floating point Monte Carlo evaluation artifact.

alias of TypeVar(‘FAT’, bound=SupportsFloat)