piel.analysis.electro_optic.modulation
======================================

.. py:module:: piel.analysis.electro_optic.modulation


Functions
---------

.. autoapisummary::

   piel.analysis.electro_optic.modulation.effective_index_product
   piel.analysis.electro_optic.modulation.relative_phase
   piel.analysis.electro_optic.modulation.phase_difference
   piel.analysis.electro_optic.modulation.balanced_mzi_phase_difference
   piel.analysis.electro_optic.modulation.free_spectral_range
   piel.analysis.electro_optic.modulation.insertion_loss
   piel.analysis.electro_optic.modulation.extinction_ratio
   piel.analysis.electro_optic.modulation.modulated_extinction_ratio


Module Contents
---------------

.. py:function:: effective_index_product(n_eff, L_nm, L_active, L_thermal)

   Calculate the effective index product for a segment.

   Parameters:
   n_eff (float): Effective index of the material.
   L_nm (float): Non-modulated length of the segment (m).
   L_active (float): Active length of the segment (m).
   L_thermal (float): Thermal length of the segment (m).

   Returns:
   float: Effective index product.

   Formula:
   .. math::
       n_{eff, i} L_i = n_{eff, i} L_{nm, i} + n_{eff, i}(V) L_{active, i} + n_{eff, i}(T) L_{thermal, i}


.. py:function:: relative_phase(phi2, phi1)

   Calculate the relative phase difference.

   Parameters:
   phi2 (float): Phase at point 2 (radians).
   phi1 (float): Phase at point 1 (radians).

   Returns:
   float: Relative phase difference.

   Formula:
   .. math::
       \Delta \phi = \phi_2 - \phi_1


.. py:function:: phase_difference(n_eff2, L2, n_eff1, L1, wavelength)

       Calculate the phase difference between two segments.

       Parameters:
       n_eff2 (float): Effective index of segment 2.
       L2 (float): Length of segment 2 (m).
       n_eff1 (float): Effective index of segment 1.
       L1 (float): Length of segment 1 (m).
       wavelength (float): Wavelength of light (m).

       Returns:
       float: Phase difference (radians).

       Formula:
       .. math::
           \Delta \phi =
   rac{2 \pi (n_{eff, 2}L_2 - n_{eff, 1}L_1)}{\lambda_0}



.. py:function:: balanced_mzi_phase_difference(delta_n_eff, L, wavelength)

       Calculate the phase difference in a balanced Mach-Zehnder Interferometer (MZI).

       Parameters:
       delta_n_eff (float): Difference in effective indices between the arms.
       L (float): Arm length (m).
       wavelength (float): Wavelength of light (m).

       Returns:
       float: Phase difference (radians).

       Formula:
       .. math::
           \Delta \phi = eta L =
   rac{2 \pi \Delta n_{eff} L }{\lambda_0}



.. py:function:: free_spectral_range(wavelength, n_g, delta_L)

       Calculate the free spectral range (FSR).

       Parameters:
       wavelength (float): Wavelength of light (m).
       n_g (float): Group index.
       delta_L (float): Path length difference (m).

       Returns:
       float: Free spectral range (m).

       Formula:
       .. math::
           FSR =
   rac{\lambda^2}{n_{g} \Delta L}



.. py:function:: insertion_loss(P_in_dBm, P_max_dBm)

   Calculate the insertion loss of a device in decibels (dB).

   Parameters:
   P_in_dBm (float): Input power (dBm).
   P_max_dBm (float): Maximum transmitted power (dBm).

   Returns:
   float: Insertion loss (dB).

   Formula:
   .. math::
       IL = P_{in, dBm} - P_{max, dBm}


.. py:function:: extinction_ratio(P_max, P_min)

       Calculate the extinction ratio in decibels (dB).

       Parameters:
       P_max (float): Maximum power (W).
       P_min (float): Minimum power (W).

       Returns:
       float: Extinction ratio (dB).

       Formula:
       .. math::
           ER = 10 \cdot \log_{10} \left(
   rac{P_{max}}{P_{min}}
   ight)



.. py:function:: modulated_extinction_ratio(P_H, P_L)

       Calculate the modulated extinction ratio in decibels (dB).

       Parameters:
       P_H (float): High power level (W).
       P_L (float): Low power level (W).

       Returns:
       float: Modulated extinction ratio (dB).

       Formula:
       .. math::
           ER_{mod} = 10 \cdot \log_{10} \left(
   rac{P_{H}}{P_{L}}
   ight)



