Utilities

class stix.sampling.utils.Direction(*values)

Bases: Enum

Integration direction for the ODE/SDE solver.

FORWARD = 'forward'
REVERSE = 'reverse'
stix.sampling.utils.check_scale_is_non_negative(scale_fn)

Check that scale_fn is non-negative on the interior of [0, 1].

Evaluated on a 1000-point grid excluding the endpoints, so a True result is necessary but not sufficient. True also comes back when the values are not concrete, which is the case for a callable closing over a traced value; ctmc_euler_step() clamps those at run time.

Parameters:

scale_fn (Callable[[Time], Scalar])

Return type:

bool

stix.sampling.utils.validate_generator_types(modality_registry, *, supported, stochasticity_scale=None)

Validate each modality’s generator_type against a solver before tracing.

Parameters:
  • modality_registry – Registry of modalities to validate.

  • supported (Mapping[type[Generator], object]) – Mapping of generator types the solver can step.

  • stochasticity_scale – Optional per-modality stochasticity scale tree.

Raises:
  • TypeError – If a modality declares a generator_type the solver cannot step (i.e. absent from supported).

  • ValueError – If stochasticity_scale is set for a modality whose generator carries no score (Velocity), or if one of its callables is negative on [0, 1].

Return type:

None