sequince.steps.context#

Attributes#

Classes#

StepContext

Runtime context passed to each SMC step.

Module Contents#

sequince.steps.context.LOG_PROPOSAL_OVERRIDE_KEY = 'log_proposal_override'#
sequince.steps.context.EVALUATION_COUNTS_KEY = 'evaluation_counts'#
sequince.steps.context.SMC_TRANSFORMATION_KEY = 'smc_transformation'#
sequince.steps.context.RESULT_HDF5_OMITTED_METADATA_KEYS#
class sequince.steps.context.StepContext[source]#

Runtime context passed to each SMC step.

t: int#
next_observation_index: int = 0#
observation: Any = None#
shared: collections.abc.Mapping[str, Any]#

Dictionary for shared user-defined context across steps.

Should not be modified by steps directly; use metadata for step-to-step communication instead.

metadata: collections.abc.Mapping[str, Any]#

Dictionary for step metadata that can be used for communication between steps and callbacks.

evaluation_counts: sequince.target.EvaluationCounts#
stop_requested: bool = False#
stop_immediately: bool = False#
property iteration: int#

Alias for t.

Return type:

int

with_metadata(**updates)[source]#

Return a context with copy-on-write metadata updates.

Parameters:

updates (Any)

Return type:

StepContext

without_metadata(*keys)[source]#

Return a context without the named metadata entries.

Parameters:

keys (str)

Return type:

StepContext

add_evaluation_counts(counts)[source]#

Return a context with newly incurred work added to its counters.

Parameters:

counts (sequince.target.EvaluationCounts)

Return type:

StepContext

request_stop()[source]#

Signal that the SMC runner should halt after this iteration.

Return type:

StepContext

request_stop_immediately()[source]#

Signal that the SMC runner should halt immediately.

Return type:

StepContext

clear_stop_request()[source]#

Clear any pending stop request.

Return type:

StepContext