symop.devices.models.filters.spectral_filter¶
Spectral filter device.
This module defines SpectralFilter, a path-based device that updates
mode envelopes according to a spectral transfer function and records the
corresponding attenuation parameters for backend execution.
The planning stage performs two tasks for every mode on the selected input path:
It applies the transfer function to the mode envelope, producing a new output envelope.
It computes an effective transmissivity \(\eta \in [0, 1]\) for that envelope transformation.
The physical attenuation itself is not applied in the planning stage. Instead,
the planner stores per-mode transmissivities in action.params["eta_by_mode"]
for the backend kernel and emits label edits that update the output mode
descriptors.
Notes
This device requires envelopes that implement the
TimeFrequencyEnvelope protocol,
because spectral filtering needs frequency-domain access.
The backend kernel is expected to realize the attenuation channel, for example through a pure-loss dilation followed by tracing out the environment mode.
Classes
|
Spectral filter device. |
- class SpectralFilter(transfer: TransferFunction) None¶
Bases:
DeviceBaseSpectral filter device.
A spectral filter acts on all modes on a selected input path by applying a transfer function to each mode envelope. The updated mode labels are routed to the output path, while the corresponding attenuation strengths are recorded for the backend kernel.
- Parameters:
transfer (
TransferFunction) – Spectral transfer function applied to each compatible mode envelope.
Notes
Planning performs descriptor updates only. The actual physical attenuation is delegated to the runtime kernel through
action.params["eta_by_mode"].- _abc_impl = <_abc._abc_data object>¶
- apply(state: State, *, ports: Mapping[str, Path], selection: object | None = None, runtime: DeviceRuntime | None, ctx: ApplyContext | None = None, out_kind: Literal['ket', 'density'] | None = None) State¶
Apply the device to a state through a runtime.
- Parameters:
state (
State) – Input state to which the device is applied.ports (
Mapping[str,Path]) – Mapping from logical port names to path labels.selection (
object|None) – Optional device-specific selection or configuration object.runtime (
DeviceRuntime|None) – Runtime used to execute the device application. IfNone, the default runtime is used.ctx (
ApplyContext|None) – Optional apply context shared across planning and execution.out_kind (
Optional[Literal['ket','density']]) – Optional requested output state kind.
- Returns:
Output state returned by the runtime.
- Return type:
StateProtocol
Notes
This method first selects a runtime and then delegates execution to
runtime.apply(...).
- property kind: DeviceKind¶
Return the device kind identifier.
- Returns:
The spectral-filter device kind.
- Return type:
- plan(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) DeviceAction¶
Plan spectral filtering on all modes of the input path.
For every mode on
ports["in"], this method:checks that the mode envelope supports time/frequency access,
applies the transfer function to obtain a filtered envelope,
records the corresponding transmissivity,
emits a label edit redirecting the mode to
ports["out"]with the updated envelope.
- Parameters:
state (
State) – Input state whose mode labels are inspected.ports (
Mapping[str,Path]) – Mapping from device-port names to physical or logical paths. Must contain the keys"in"and"out".selection (
object|None) – Optional selection object forwarded by the runtime. It is not used by this device.ctx (
ApplyContext|None) – Optional apply context forwarded by the runtime. It is not used by this device.
- Returns:
Planned action containing:
params["eta_by_mode"]: transmissivity per affected modeedits: label updates for all transformed modes
- Return type:
- Raises:
Notes
The attenuation channel itself is not applied here. This method only prepares the semantic and kernel parameters required for execution.
- transfer: TransferFunction¶