piel.models.logic.electro_optic.signal_mapping#
TODO implement this function. In this function we implement different methods of mapping electronic signals to phase.
One particular implementation of phase mapping would be:
Bit |
Phase |
|---|---|
b0 |
\(\phi_0 \to 0\) |
b1 |
\(\phi_1 \to \pi\) |
We can define the two corresponding angles that this would be.
A more complex implementation of phase mapping can be similar to a DAC mapping: a bitstring within a converter bit-size can map directly to a particular phase space within a particular mapping.
Functions#
|
Returns an array of bits from a given amount of bits. |
|
This function converts a phase array or tuple iterable, into the corresponding mapping of their bitstring required within a particular bit-phase mapping. A |
|
Extracts the phase corresponding to the specified transition type. |
|
This is a mapping function between a provided target phase that might be more analogous, with the closest |
Formats the electro-optic state into a standard FockStatePhaseTransitionType format. This is useful for the |
|
|
The goal of this function is to extract the corresponding phase required to implement a state transition. |
|
The goal of this function is to extract the corresponding phase required to implement a state transition. |
|
Returns a linear direct mapping of bits to phase. |
Returns a list of phases from a given data series and phase map. |
Module Contents#
- bits_array_from_bits_amount(bits_amount: int, bit_format: Literal['int', 'str'] = 'int') numpy.ndarray[source]#
Returns an array of bits from a given amount of bits.
- Parameters:
bits_amount (int) – Amount of bits to generate.
bit_format (str) – Format of the bits to generate.
- Returns:
Array of bits.
- Return type:
bit_array(np.ndarray)
- convert_phase_array_to_bit_array(phase_array: Iterable, phase_bit_dataframe: pandas.DataFrame, phase_series_name: str = 'phase', bit_series_name: str = 'bit', rounding_function: Callable | None = None) tuple[source]#
This function converts a phase array or tuple iterable, into the corresponding mapping of their bitstring required within a particular bit-phase mapping. A
phase_arrayiterable is provided, and each phase is mapped to a particular bitstring based on thephase_bit_dataframe. A tuple is composed of strings that represent the bitstrings of the phases provided.- Parameters:
phase_array (Iterable) – Iterable of phases to map to bitstrings.
phase_bit_dataframe (pd.DataFrame) – Dataframe containing the phase-bit mapping.
phase_series_name (str) – Name of the phase series in the dataframe.
bit_series_name (str) – Name of the bit series in the dataframe.
rounding_function (Callable) – Rounding function to apply to the target phase.
- Returns:
Tuple of bitstrings corresponding to the phases.
- Return type:
bit_array(tuple)
- extract_phase(phase_transition_list: list[piel.models.logic.electro_optic.types.FockStatePhaseTransitionType], transition_type='cross')[source]#
Extracts the phase corresponding to the specified transition type.
- Parameters:
phase_transition_list (list of dict) – Data structure containing phase transition information.
transition_type (str) – Type of transition to extract phase for (‘cross’ or ‘bar’).
- Returns:
Phase corresponding to the specified transition type.
- Return type:
float
- find_nearest_bit_for_phase(target_phase: float, phase_bit_dataframe: pandas.DataFrame, phase_series_name: str = 'phase', bit_series_name: str = 'bit', rounding_function: Callable | None = None) tuple[source]#
This is a mapping function between a provided target phase that might be more analogous, with the closest bit-value in a bit-phase ideal relationship. The error between the target phase and the applied phase is limited to the discretisation error of the phase mapping.
- Parameters:
target_phase (float) – Target phase to map to.
phase_bit_dataframe (pd.DataFrame) – Dataframe containing the phase-bit mapping.
phase_series_name (str) – Name of the phase series in the dataframe.
bit_series_name (str) – Name of the bit series in the dataframe.
rounding_function (Callable) – Rounding function to apply to the target phase.
- Returns:
Bitstring corresponding to the nearest phase.
- Return type:
bitstring(str)
- format_electro_optic_fock_transition(switch_state_array: piel.integration.type_conversion.array_types, input_fock_state_array: piel.integration.type_conversion.array_types, raw_output_state: piel.integration.type_conversion.array_types) piel.models.logic.electro_optic.types.FockStatePhaseTransitionType[source]#
Formats the electro-optic state into a standard FockStatePhaseTransitionType format. This is useful for the electro-optic model to ensure that the output state is in the correct format. The output state is a dictionary that contains the phase, input fock state, and output fock state. The idea is that this will allow us to standardise and compare the output states of the electro-optic model across multiple formats.
- Parameters:
switch_state_array (array_types) – Array of switch states.
input_fock_state_array (array_types) – Array of valid input fock states.
raw_output_state (array_types) – Array of raw output state.
- Returns:
Electro-optic state.
- Return type:
electro_optic_state(FockStatePhaseTransitionType)
- get_state_phase_transitions(switch_function: Callable, switch_states: list[piel.types.NumericalTypes] | None = None, input_fock_states: list[piel.types.ArrayTypes] | None = None, mode_amount: int | None = None, **kwargs) list[piel.types.ArrayTypes][source]#
The goal of this function is to extract the corresponding phase required to implement a state transition.
Let’s consider a simple MZI 2x2 logic with two transmission states. We want to verify that the electronic function switch, effectively switches the optical output between the cross and bar states of the optical transmission function.
For the corresponding switch model:
Let’s assume a switch model unitary. For a given 2x2 input optical switch “X”. In bar state, in dual rail, transforms an optical input: ``` .. raw:
[[1] ----> [[1] [0]] [0]]
In cross state, in dual rail, transforms an optical input:
However, sometimes it is easier to describe a photonic logic transformation based on these states, rather than inherently the numerical phase that is applied. This may be the case, for example, in asymmetric Mach-Zehnder modulators models, etc.
As such, this function will help us extract the corresponding phase for a particular switch transition.
- get_state_to_phase_map(switch_function: Callable, switch_states: list[piel.types.NumericalTypes] | None = None, input_fock_states: list[piel.types.ArrayTypes] | None = None, target_transition_list: list[dict] | None = None, mode_amount: int | None = None, **kwargs) tuple[piel.types.ArrayTypes][source]#
The goal of this function is to extract the corresponding phase required to implement a state transition.
Let’s consider a simple MZI 2x2 logic with two transmission states. We want to verify that the electronic function switch, effectively switches the optical output between the cross and bar states of the optical transmission function.
For the corresponding switch model:
Let’s assume a switch model unitary. For a given 2x2 input optical switch “X”. In bar state, in dual rail, transforms an optical input: ``` .. raw:
[[1] ----> [[1] [0]] [0]]
In cross state, in dual rail, transforms an optical input:
However, sometimes it is easier to describe a photonic logic transformation based on these states, rather than inherently the numerical phase that is applied. This may be the case, for example, in asymmetric Mach-Zehnder modulators models, etc.
As such, this function will help us extract the corresponding phase for a particular switch transition.
- linear_bit_phase_map(bits_amount: int, final_phase_rad: float, initial_phase_rad: float = 0, return_dataframe: bool = True, quantization_error: float = 1e-06, bit_format: Literal['int', 'str'] = 'int') dict | pandas.DataFrame[source]#
Returns a linear direct mapping of bits to phase.
- Parameters:
bits_amount (int) – Amount of bits to generate.
final_phase_rad (float) – Final phase to map to.
initial_phase_rad (float) – Initial phase to map to.
- Returns:
Mapping of bits to phase.
- Return type:
bit_phase_mapping(dict)
- return_phase_array_from_data_series(data_series: pandas.Series, phase_map: pandas.DataFrame | pandas.Series) list[source]#
Returns a list of phases from a given data series and phase map. # TODO optimise lookup table speed
- Parameters:
data_series (pd.Series) – Data series to map.
phase_map (pd.DataFrame | pd.Series) – Phase map to use.
- Returns:
List of phases.
- Return type:
phase_array(list)