symop.devices.models.filters.polarizing_filter¶
Polarizing filter device.
This module defines PolarizingFilter, a path-based device that
projects mode polarizations onto a selected transmitted polarization and
records the corresponding attenuation parameters for backend execution.
For each mode on the selected input path, the planning stage computes an
effective transmissivity from the overlap between the input polarization
label and the configured transmitted polarization. The physical attenuation
is not applied during planning. Instead, the planner stores per-mode
transmissivities in action.params["eta_by_mode"] for the backend kernel
and emits label edits that update output mode descriptors.
Notes
For an ideal polarizing filter with transmitted polarization \(|\psi\rangle\) and input polarization \(|\phi\rangle\), the effective transmissivity is
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
|
Ideal polarizing filter device. |
- class PolarizingFilter(passed_polarization: Polarization) None¶
Bases:
DeviceBaseIdeal polarizing filter device.
A polarizing filter acts on all modes on a selected input path by projecting their polarization content onto a configured transmitted polarization. The updated mode labels are routed to the output path, while the corresponding attenuation strengths are recorded for the backend kernel.
- Parameters:
passed_polarization (
Polarization) – Polarization transmitted by the filter.
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 = 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 polarizing-filter device kind.
- Return type:
- passed_polarization: Polarization¶
- plan(*, state: State, ports: Mapping[str, Path], selection: object | None = None, ctx: ApplyContext | None = None) DeviceAction¶
Plan ideal polarization filtering on all modes of the input path.
For every mode on
ports["in"], this method:computes the overlap with the transmitted polarization,
converts that overlap into an effective transmissivity,
emits a label edit redirecting the mode to
ports["out"]with the transmitted polarization label.
- 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:
TypeError – If the state does not support label editing and path-based mode lookup.
Notes
The attenuation channel itself is not applied here. This method only prepares the semantic and kernel parameters required for execution.