necst.procedures.observations.spectral_recording_sequence¶
Observation-flow helper for spectral-recording setup sidecars and gate control.
- class SpectralRecordingObservationSetup(setup_id: 'str', setup_hash: 'str', snapshot_toml: 'str', sidecars: 'Tuple[Tuple[str, str], ...]' = <factory>, setup_override_policy: 'str' = 'strict', sg_preflight_policy: 'str' = 'none', sg_preflight_scope: 'str' = 'active_lo_chains', sg_preflight_plan: 'Tuple[Tuple[str, Mapping[str, Any]], ...]' = <factory>, sg_preflight_timeout_sec: 'float' = 10.0, sg_preflight_allow_command_echo: 'bool' = False)[source]¶
Bases:
object- Parameters:
setup_id (str) –
setup_hash (str) –
snapshot_toml (str) –
sidecars (Tuple[Tuple[str, str], ...]) –
setup_override_policy (str) –
sg_preflight_policy (str) –
sg_preflight_scope (str) –
sg_preflight_plan (Tuple[Tuple[str, Mapping[str, Any]], ...]) –
sg_preflight_timeout_sec (float) –
sg_preflight_allow_command_echo (bool) –
- setup_id: str¶
- setup_hash: str¶
- snapshot_toml: str¶
- sidecars: Tuple[Tuple[str, str], ...]¶
- setup_override_policy: str = 'strict'¶
- sg_preflight_policy: str = 'none'¶
- sg_preflight_scope: str = 'active_lo_chains'¶
- sg_preflight_plan: Tuple[Tuple[str, Mapping[str, Any]], ...]¶
- sg_preflight_timeout_sec: float = 10.0¶
- sg_preflight_allow_command_echo: bool = False¶
- property strict: bool¶
- property sg_preflight_enabled: bool¶
- build_spectral_recording_observation_setup(*, params, obs_file, default_setup_id, obsspec=None)[source]¶
Build a spectral-recording setup from .obs parameters.
If no spectral-recording parameter is present, return None and preserve the legacy observation flow.
- Parameters:
params (Mapping[str, Any]) –
obs_file (Any) –
default_setup_id (str) –
obsspec (Any) –
- Return type:
Optional[SpectralRecordingObservationSetup]
- reject_legacy_recording_kwargs_for_setup(kwargs, setup)[source]¶
Reject active legacy per-observation spectral controls in setup mode.
In setup mode, stream-local saved channel windows and TP policy are already encoded in the resolved snapshot. Accepting legacy
ch/tp_mode/tp_rangecontrols would be ambiguous and can appear to succeed while being ignored by SpectralData.Command-line wrappers often pass inactive defaults such as
ch=Noneeven when the user did not request legacy binning. Those inert defaults must not disable spectral-recording setup mode. This function therefore rejects only values that would actually trigger the legacy controls inObservation.execute().- Parameters:
kwargs (Mapping[str, Any]) –
setup (Optional[SpectralRecordingObservationSetup]) –
- Return type:
None
- run_sg_preflight_with_commander(com, setup)[source]¶
Run optional observation-time SG preflight before recorder startup.
When sg_preflight_policy is omitted or none, this function does nothing and preserves the pre-u14_v12 behaviour exactly. The caller can log the returned per-SG results; strict failures raise before the spectral recorder setup is applied.
- Parameters:
com (Any) –
setup (SpectralRecordingObservationSetup) –
- Return type:
Dict[str, Dict[str, Any]]
- apply_setup_with_commander(com, setup)[source]¶
- Parameters:
com (Any) –
setup (SpectralRecordingObservationSetup) –
- Return type:
Any
- save_sidecars_with_commander(com, setup)[source]¶
- Parameters:
com (Any) –
setup (SpectralRecordingObservationSetup) –
- Return type:
None
- set_gate_with_commander(com, setup, *, allow_save)[source]¶
- Parameters:
com (Any) –
setup (SpectralRecordingObservationSetup) –
allow_save (bool) –
- Return type:
Any
- clear_setup_with_commander(com, setup, *, strict=True)[source]¶
- Parameters:
com (Any) –
setup (SpectralRecordingObservationSetup) –
strict (bool) –
- Return type:
Any