cubie.integrators.algorithms.IntegratorLoopSettings

Integrator configuration management with validation and adapter patterns.

This module provides the IntegratorLoopSettings class for managing compile-critical settings for integrator loops, including timing parameters, buffer sizes, and function references. It uses validation and adapter patterns to ensure configuration consistency.

Classes

IntegratorLoopSettings(loop_step_config, ...)

Compile-critical settings for the integrator loop.

class cubie.integrators.algorithms.IntegratorLoopSettings.IntegratorLoopSettings(loop_step_config: ~cubie.integrators.algorithms.LoopStepConfig.LoopStepConfig, buffer_sizes: ~cubie.outputhandling.output_sizes.LoopBufferSizes, precision: type = <class 'numpy.float32'>, compile_flags: ~cubie.outputhandling.output_config.OutputCompileFlags = OutputCompileFlags(save_state=False, save_observables=False, summarise=False, summarise_observables=False, summarise_state=False), dxdt_function: ~typing.Callable | None = None, save_state_func: ~typing.Callable | None = None, update_summaries_func: ~typing.Callable | None = None, save_summaries_func: ~typing.Callable | None = None)[source]

Bases: object

Compile-critical settings for the integrator loop.

This class manages configuration settings that are critical for compiling integrator loops, including timing parameters, buffer sizes, precision, and function references. The integrator loop is not the source of truth for these settings, so minimal setters are provided. Instead, there are update_from methods which extract relevant settings from other objects.

Parameters:
  • loop_step_config (LoopStepConfig) – Configuration object for loop step timing parameters.

  • buffer_sizes (LoopBufferSizes) – Configuration object specifying buffer sizes for integration.

  • precision (type, default=float32) – Numerical precision type (float32, float64, or float16).

  • compile_flags (OutputCompileFlags, default=OutputCompileFlags()) – Compilation flags for output handling.

  • dxdt_function (callable, optional) – Function that computes time derivatives of the state.

  • save_state_func (callable, optional) – Function for saving state values during integration.

  • update_summaries_func (callable, optional) – Function for updating summary statistics.

  • save_summaries_func (callable, optional) – Function for saving summary statistics.

Notes

This class serves as a data container for compile-time settings and provides convenient property access to nested configuration values. It validates input parameters to ensure consistency.

See also

LoopStepConfig

Step timing configuration

LoopBufferSizes

Buffer size configuration

OutputCompileFlags

Output compilation flags

property atol: float

Get the absolute tolerance for integration.

Returns:

Absolute tolerance from the loop step configuration.

Return type:

float

buffer_sizes: LoopBufferSizes
compile_flags: OutputCompileFlags
property dt_max: float

Get the maximum time step size.

Returns:

Maximum time step size from the loop step configuration.

Return type:

float

property dt_min: float

Get the minimum time step size.

Returns:

Minimum time step size from the loop step configuration.

Return type:

float

property dt_save: float

Get the time interval between saved outputs.

Returns:

Time interval between saved outputs from the loop step configuration.

Return type:

float

property dt_summarise: float

Get the time interval between summary calculations.

Returns:

Time interval between summary calculations from the loop step configuration.

Return type:

float

dxdt_function: Callable | None
property fixed_step_size: float

Get the step size used in the loop.

Returns:

The fixed step size for integration.

Return type:

float

property fixed_steps

Get the fixed steps configuration.

Returns:

Tuple of (save_every_samples, summarise_every_samples, step_size).

Return type:

tuple

classmethod from_integrator_run(run_object)[source]

Create an IntegratorLoopSettings instance from a SingleIntegratorRun object.

Parameters:

run_object (SingleIntegratorRun) – The SingleIntegratorRun object containing configuration parameters.

Returns:

New instance configured with parameters from the run object.

Return type:

IntegratorLoopSettings

loop_step_config: LoopStepConfig
precision: type
property rtol: float

Get the relative tolerance for integration.

Returns:

Relative tolerance from the loop step configuration.

Return type:

float

save_state_func: Callable | None
save_summaries_func: Callable | None
update_summaries_func: Callable | None