# Path: pyphysim/comm/waterfilling.py
# def doWF(vtChannels: np.ndarray,
#          dPt: float,
#          noiseVar: float = 1.0,
#          Es: float = 1.0) -> Tuple[np.ndarray, float]:


import numpy as np
    import os
from pyphysim.comm import waterfilling
def drawWF(vtChannels, waterLevel, noiseVar=1.0, channelLength=0.8):
    """Creates a file with the latex code to draw (using Tikz) the
    waterfilling representation.

    Parameters
    ----------
    vtChannels : np.ndarray
        Channel gains of the parallel AWGN channels. This is a 1D numpy array.
    waterLevel : float
        Water level.
    noiseVar : float
        Noise variance.
    channelLength : float
        Length (in cm) of the representation of each channel in the X axis.
    """
    texCode = genLatexCode(vtChannels, waterLevel, noiseVar, channelLength)
    fId = open("texCode.tex", 'w')
    fId.write(texCode)
    fId.close()


# This method is only for testing purposes and is does not need to be
# exposed to the outside of this module.
def _test_drawwf():

    print("Inicio")

    vtChannels = np.array([9.32904521e-13, 2.63321084e-13, 5.06505202e-14])
    noiseVar = 2.5119e-14
    Pt = 0.2512

# Path: pyphysim/comm/waterfilling.py
# def doWF(vtChannels: np.ndarray,
#          dPt: float,
#          noiseVar: float = 1.0,
#          Es: float = 1.0) -> Tuple[np.ndarray, float]:


# Path: apps/waterfilling_tikz_draw.py
import numpy as np
    import os
from pyphysim.comm import waterfilling

def drawWF(vtChannels, waterLevel, noiseVar=1.0, channelLength=0.8):
    """Creates a file with the latex code to draw (using Tikz) the
    waterfilling representation.

    Parameters
    ----------
    vtChannels : np.ndarray
        Channel gains of the parallel AWGN channels. This is a 1D numpy array.
    waterLevel : float
        Water level.
    noiseVar : float
        Noise variance.
    channelLength : float
        Length (in cm) of the representation of each channel in the X axis.
    """
    texCode = genLatexCode(vtChannels, waterLevel, noiseVar, channelLength)
    fId = open("texCode.tex", 'w')
    fId.write(texCode)
    fId.close()


# This method is only for testing purposes and is does not need to be
# exposed to the outside of this module.
def _test_drawwf():

    print("Inicio")

    vtChannels = np.array([9.32904521e-13, 2.63321084e-13, 5.06505202e-14])
    noiseVar = 2.5119e-14
    Pt = 0.2512

    (vtOptP, mu) = waterfilling.doWF(vtChannels, Pt, noiseVar)