OutputConfig
- class cubie.outputhandling.OutputConfig(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], max_states: int, max_observables: int, saved_state_indices: List[int] | ndarray[Any, dtype[int64]] | None = NOTHING, saved_observable_indices: List[int] | ndarray[Any, dtype[int64]] | None = NOTHING, summarised_state_indices: List[int] | ndarray[Any, dtype[int64]] | None = NOTHING, summarised_observable_indices: List[int] | ndarray[Any, dtype[int64]] | None = NOTHING, output_types: List[str] = NOTHING, sample_summaries_every: float | None = None)[source]
Bases:
CUDAFactoryConfigValidated configuration for solver outputs and summaries.
- Parameters:
max_states – Maximum number of state variables.
max_observables – Maximum number of observable variables.
saved_state_indices – Indices of state variables to save. Defaults to an empty collection that resolves to all states.
saved_observable_indices – Indices of observable variables to save. Defaults to an empty collection that resolves to all observables.
summarised_state_indices – Indices of state variables to summarise. Defaults to saved_state_indices.
summarised_observable_indices – Indices of observable variables to summarise. Defaults to saved_observable_indices.
output_types – Requested output type names, including summary metric identifiers.
sample_summaries_every – Time interval between summary metric samples. Used by derivative metrics to scale finite differences. Defaults to 0.01 seconds.
precision (type[numpy.float16] | type[numpy.float32] | type[numpy.float64] | numpy.dtype[numpy.float16] | numpy.dtype[numpy.float32] | numpy.dtype[numpy.float64]) – Numerical precision for output calculations. Defaults to np.float32.
Notes
Private attributes store numpy arrays so that properties can manage circular dependencies between index validation and flag updates. The post-initialisation hook applies default indices, validates bounds, and ensures at least one output path is active.
- _check_for_no_outputs() None[source]
Ensure that at least one output type is requested.
- Returns:
Returns
None.- Return type:
None
- Raises:
ValueError – Raised when no output types are enabled.
- _check_saved_indices() None[source]
Convert saved indices to numpy arrays.
- Returns:
Returns
None.- Return type:
None
Notes
Converts index collections to numpy int arrays.
- _check_summarised_indices() None[source]
Convert summarised indices to numpy arrays.
- Returns:
Returns
None.- Return type:
None
Notes
Converts index collections to numpy int arrays.
- _validate_index_arrays() None[source]
Validate all index arrays for bounds and duplication.
- Returns:
Returns
None.- Return type:
None
Notes
Called post-initialisation so that
Nonevalues can be replaced by defaults before validation.
- property buffer_sizes_dict: dict[str, int]
Returns a dict of buffer sizes to update other objects’ settings
- property compile_flags: OutputCompileFlags
Get compile flags for this configuration.
- Returns:
Flags indicating which output features should be compiled.
- Return type:
OutputCompileFlags
- classmethod from_loop_settings(output_types: List[str], precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], saved_state_indices: Sequence[int] | ndarray[Any, dtype[int64]] | None = None, saved_observable_indices: Sequence[int] | ndarray[Any, dtype[int64]] | None = None, summarised_state_indices: Sequence[int] | ndarray[Any, dtype[int64]] | None = None, summarised_observable_indices: Sequence[int] | ndarray[Any, dtype[int64]] | None = None, max_states: int = 0, max_observables: int = 0, sample_summaries_every: float | None = 0.01) OutputConfig[source]
Create configuration from integrator-compatible specifications.
- Parameters:
output_types – Output types including
"state","observables","time", and summary metric names such as"max"or"rms".saved_state_indices – Indices of states to save in time-domain output.
saved_observable_indices – Indices of observables to save in time-domain output.
summarised_state_indices – Indices of states for summary calculations. Defaults to saved_state_indices.
summarised_observable_indices – Indices of observables for summary calculations. Defaults to saved_observable_indices.
max_states – Total number of state variables in the system.
max_observables – Total number of observable variables in the system.
sample_summaries_every – Time interval between summary metric samples. Used by derivative metrics to scale finite differences. Defaults to
0.01.precision – Numerical precision for output calculations. Defaults to
np.float32if not provided.
- Returns:
Configured output configuration object.
- Return type:
Notes
This class method provides a convenient interface for creating OutputConfig objects from the parameter format used by integrator classes. It handles None values appropriately by converting them to empty arrays.
- property n_saved_observables: int
Get number of observables that will be saved.
- Returns:
Number of observable variables to save in time-domain output.
- Return type:
- property n_saved_states: int
Get number of states that will be saved.
- Returns:
Number of state variables to save in time-domain output.
- Return type:
Notes
Returns the length of saved_state_indices when save_state is True, otherwise 0.
- property n_summarised_observables: int
Get number of observables that will be summarised.
- Returns:
Number of observable variables for summary calculations.
- Return type:
- property n_summarised_states: int
Get number of states that will be summarised.
- Returns:
Number of state variables for summary calculations.
- Return type:
Notes
Returns the length of summarised_state_indices when save_summaries is active, otherwise 0.
- property observable_summaries_buffer_height: int
Calculate total buffer height for observable summaries.
- Returns:
Total buffer height for all observable summary calculations.
- Return type:
- property observable_summaries_output_height: int
Calculate total output height for observable summaries.
- Returns:
Total output height for all observable summary results.
- Return type:
- property saved_observable_indices: ndarray[Any, dtype[int64]]
Observable indices to save, or an empty array when disabled.
- property saved_state_indices: ndarray[Any, dtype[int64]]
State indices to save, or an empty array when disabled.
- property state_summaries_buffer_height: int
Calculate total buffer height for state summaries.
- Returns:
Total buffer height for all state summary calculations.
- Return type:
- property state_summaries_output_height: int
Calculate total output height for state summaries.
- Returns:
Total output height for all state summary results.
- Return type:
- property summaries_buffer_height_per_var: int
Calculate buffer size per variable for summary calculations.
- Returns:
Buffer height required per variable for summary metrics.
- Return type:
- property summaries_output_height_per_var: int
Calculate output array height per variable for summaries.
- Returns:
Output height required per variable for summary results.
- Return type:
- property summarised_observable_indices: ndarray[Any, dtype[int64]]
Observable indices for summaries, or an empty array when disabled.
- property summarised_state_indices: ndarray[Any, dtype[int64]]
State indices for summaries, or an empty array when disabled.
- property summary_legend_per_variable: dict[int, str]
Map per-variable summary indices to metric names.
- property summary_parameters: dict[str, object]
Collect parameters required by the registered summary metrics.
- property summary_unit_modifications: dict[int, str]
Map per-variable summary indices to unit modifications.
- property total_summary_buffer_size: int
Calculate total size of all summary buffers.
- Returns:
Combined size of state and observable summary buffers.
- Return type:
- update_from_outputs_list(output_types: list[str]) None[source]
Update configuration from a list of output type names.
- Parameters:
output_types – Output type names to configure.
- Returns:
Returns
None.- Return type:
None
Notes
Parses the list to set boolean flags and collect summary metric selections. Unknown entries trigger warnings but do not raise exceptions.