piel.units.power
================

.. py:module:: piel.units.power


Functions
---------

.. autoapisummary::

   piel.units.power.dBm2watt
   piel.units.power.watt2dBm
   piel.units.power.watt2vrms
   piel.units.power.dBm2vrms
   piel.units.power.vrms2vpp
   piel.units.power.vrms2watt
   piel.units.power.vrms2dBm
   piel.units.power.dBm2vpp
   piel.units.power.vpp2vrms
   piel.units.power.vpp2dBm


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

.. py:function:: dBm2watt(dBm: piel.types.NumericalTypes) -> piel.types.NumericalTypes

       Converts power from dBm (decibel-milliwatts) to Watts.

       The conversion is performed using the following equation:

       .. math::

           P_{     ext{Watt}} = 10^{\left(
   rac{P_{ ext{dBm}}}{10}
   ight)}  imes 10^{-3}

       Args:
       - dBm (NumericalTypes): Power level in dBm (can be int, float, or numpy array).

       Returns:
       - NumericalTypes: Power level in Watts, in the same type as the input.



.. py:function:: watt2dBm(watt: piel.types.NumericalTypes) -> piel.types.NumericalTypes

       Converts power from Watts to dBm (decibel-milliwatts).

       The conversion is performed using the following equation:

       .. math::
           P_{     ext{dBm}} = 10  imes \log_{10}\left(
   rac{P_{    ext{Watt}}}{10^{-3}}
   ight)

       Args:
       - watt (NumericalTypes): Power level in Watts (can be int, float, or numpy array).

       Returns:
       - NumericalTypes: Power level in dBm, in the same type as the input.



.. py:function:: watt2vrms(watt: piel.types.NumericalTypes, impedance: piel.types.NumericalTypes = 50.0) -> piel.types.NumericalTypes

   Converts power in Watts to Vrms (root mean square voltage) for a given impedance.

   The conversion is performed using the following equation:

   .. math::

       V_{     ext{rms}} = \sqrt{P_{   ext{Watt}}      imes Z}

   Args:
   - watt (NumericalTypes): Power level in Watts.
   - impedance (float): The network impedance in ohms. Defaults to 50.0 Ohms.

   Returns:
   - NumericalTypes: Vrms in the same type as the input.


.. py:function:: dBm2vrms(dBm: piel.types.NumericalTypes, impedance: piel.types.NumericalTypes = 50.0) -> piel.types.NumericalTypes

       Converts power from dBm to Vrms (root mean square voltage) in a specified impedance network.

       The conversion is performed using the following steps:

       1. Convert dBm to Watts:
          .. math::

              P_{  ext{Watt}} = 10^{\left(
   rac{P_{ ext{dBm}}}{10}
   ight)}  imes 10^{-3}

       2. Convert Watts to Vrms:
          .. math::

              V_{  ext{rms}} = \sqrt{P_{   ext{Watt}}      imes Z}

       Args:
       - dBm (NumericalTypes): Power level in dBm (can be int, float, or numpy array).
       - impedance (float): The network impedance in ohms. Default is 50 ohms.

       Returns:
       - NumericalTypes: Vrms value, in the same type as the input.



.. py:function:: vrms2vpp(vrms: piel.types.NumericalTypes) -> piel.types.NumericalTypes

   Converts Vrms (root mean square voltage) to Vpp (peak-to-peak voltage).

   The conversion is performed using the following equation:

   .. math::

       V_{     ext{pp}} = V_{  ext{rms}}       imes \sqrt{2}   imes 2

   Args:
   - vrms (NumericalTypes): Vrms value.

   Returns:
   - NumericalTypes: Vpp in the same type as the input.


.. py:function:: vrms2watt(vrms: piel.types.NumericalTypes, impedance: piel.types.NumericalTypes = 50.0) -> piel.types.NumericalTypes

       Converts Vrms (root mean square voltage) to power in Watts for a given impedance.

       The conversion is performed using the following equation:

       .. math::
           P_{     ext{Watt}} =
   rac{V_{   ext{rms}}^2}{Z}

       Args:
       - vrms (NumericalTypes): Vrms value.
       - impedance (float): The network impedance in ohms.

       Returns:
       - NumericalTypes: Power level in Watts, in the same type as the input.



.. py:function:: vrms2dBm(vrms: piel.types.NumericalTypes, impedance: piel.types.NumericalTypes = 50.0) -> piel.types.NumericalTypes

       Converts Vrms (root mean square voltage) to dBm in a specified impedance network.

       The conversion is performed using the following steps:

       1. Convert Vrms to Watts:
          .. math::
              P_{  ext{Watt}} =
   rac{V_{   ext{rms}}^2}{Z}

       2. Convert Watts to dBm:
          .. math::
              P_{  ext{dBm}} = 10  imes \log_{10}\left(
   rac{P_{    ext{Watt}}}{10^{-3}}
   ight)

       Args:
       - vrms (NumericalTypes): Vrms value.
       - impedance (float): The network impedance in ohms. Default is 50 ohms.

       Returns:
       - NumericalTypes: Power level in dBm, in the same type as the input.



.. py:function:: dBm2vpp(dBm: piel.types.NumericalTypes, impedance: piel.types.NumericalTypes = 50.0) -> piel.types.NumericalTypes

       Converts power from dBm to Vpp (peak-to-peak voltage) in a specified impedance network.

       The conversion is performed using the following steps:

       1. Convert dBm to Watts:
          .. math::

              P_{  ext{Watt}} = 10^{\left(
   rac{P_{ ext{dBm}}}{10}
   ight)}  imes 10^{-3}

       2. Convert Watts to Vrms:
          .. math::

              V_{  ext{rms}} = \sqrt{P_{   ext{Watt}}      imes Z}

       3. Convert Vrms to Vpp:
          .. math::

              V_{  ext{pp}} = V_{  ext{rms}}       imes \sqrt{2}   imes 2

       Args:
       - dBm (NumericalTypes): Power level in dBm (can be int, float, or numpy array).
       - impedance (float): The network impedance in ohms. Default is 50 ohms.

       Returns:
       - NumericalTypes: Vpp value, in the same type as the input.



.. py:function:: vpp2vrms(vpp: piel.types.NumericalTypes) -> piel.types.NumericalTypes

       Converts Vpp (peak-to-peak voltage) to Vrms (root mean square voltage).

       The conversion is performed using the following equation:

       .. math::
           V_{     ext{rms}} =
   rac{V_{    ext{pp}}}{\sqrt{2}      imes 2}

       Args:
       - vpp (NumericalTypes): Vpp value.

       Returns:
       - NumericalTypes: Vrms value, in the same type as the input.



.. py:function:: vpp2dBm(vpp: piel.types.NumericalTypes, impedance: piel.types.NumericalTypes = 50.0) -> piel.types.NumericalTypes

       Converts Vpp (peak-to-peak voltage) to dBm in a specified impedance network.

       The conversion is performed using the following steps:

       1. Convert Vpp to Vrms:
          .. math::
              V_{  ext{rms}} =
   rac{V_{    ext{pp}}}{\sqrt{2}      imes 2}

       2. Convert Vrms to Watts:
          .. math::
              P_{  ext{Watt}} =
   rac{V_{   ext{rms}}^2}{Z}

       3. Convert Watts to dBm:
          .. math::
              P_{  ext{dBm}} = 10  imes \log_{10}\left(
   rac{P_{    ext{Watt}}}{10^{-3}}
   ight)

       Args:
       - vpp (NumericalTypes): Vpp value.
       - impedance (float): The network impedance in ohms. Default is 50 ohms.

       Returns:
       - NumericalTypes: Power level in dBm, in the same type as the input.



