lightweight_distribution

Lightweight distribution snapshot for transformation pipelines.

The snapshot keeps only metadata required by transformations and strategies, while avoiding strong references to full parent distribution objects.

class pysatl_core.transformations.lightweight_distribution.LightweightDistribution(*, distribution_type, analytical_computations, support=None, sampling_strategy=None, computation_strategy=None, bases=None, loop_analytical_flags=None)[source]

Bases: Distribution

Lightweight Distribution implementation for transformation internals.

Parameters:
  • distribution_type (DistributionType) – Type descriptor of the distribution.

  • analytical_computations (Mapping[) –

    GenericCharacteristicName, (

    AnalyticalComputation[Any, Any] | Mapping[LabelName, AnalyticalComputation[Any, Any]]

    ),

  • ] – Labeled characteristic methods exposed by the snapshot.

  • support (Support | None, optional) – Support metadata copied from the source distribution.

  • sampling_strategy (SamplingStrategy | None, optional) – Sampling strategy attached to the snapshot.

  • computation_strategy (ComputationStrategy | None, optional) – Computation strategy attached to the snapshot.

  • bases (Mapping[ParentRole, LightweightDistribution] | None, optional) – Lightweight base snapshots for chained transformations.

  • loop_analytical_flags (Mapping[) – GenericCharacteristicName, Mapping[LabelName, bool],

  • None (] |) – Optional analytical flags for loop variants.

  • optional – Optional analytical flags for loop variants.

__init__(*, distribution_type, analytical_computations, support=None, sampling_strategy=None, computation_strategy=None, bases=None, loop_analytical_flags=None)[source]

Initialize common distribution state.

Parameters:
  • distribution_type (DistributionType) – Type information about the distribution (kind, dimension, etc.).

  • analytical_computations (Mapping) –

    Distribution-provided characteristic methods. For non-transformed distributions these methods are fully analytical.

    Note

    Each characteristic callable should accept and return NumPy arrays (array semantics). Scalar-only callables are wrapped automatically via numpy.vectorize, but at a significant per-element overhead cost.

  • support (Support or None, default None) – Support of the distribution.

  • sampling_strategy (SamplingStrategy or None, default None) – Sampling strategy instance. If omitted, univariate default is used.

  • computation_strategy (ComputationStrategy or None, default None) – Computation strategy instance. If omitted, default strategy is used.

  • bases (Mapping[ParentRole, LightweightDistribution] | None)

  • loop_analytical_flags (Mapping[GenericCharacteristicName, Mapping[LabelName, bool]] | None)

Return type:

None

classmethod from_distribution(distribution)[source]

Build a lightweight snapshot from an arbitrary distribution.

The method copies only strategy-relevant fields and recursively snapshots known bases when the source distribution exposes them.

Parameters:

distribution (Distribution) – Source distribution.

Returns:

Lightweight snapshot compatible with Distribution.

Return type:

LightweightDistribution

property bases: Mapping[ParentRole, pysatl_core.distributions.distribution.Distribution]

Get lightweight base snapshots grouped by role.

loop_is_analytical(characteristic_name, label_name)[source]

Return preserved loop analytical flag for the snapshot.

Return type:

bool

Parameters:
  • characteristic_name (GenericCharacteristicName)

  • label_name (LabelName)