Quanlse/QWaveform.py
def plotIon(self, names: Union[str, List[str]] = None, xUnit: str = r'$\mu$s', yUnit: str = 'Amp (a.u.)',
                color: Union[str, List[str]] = None, dark: bool = False) -> None:
        """
        Print the waveforms of the control terms listed in ``names``.

        :param names: the name or name list of the control term
        :param xUnit: the unit of the x axis
        :param yUnit: the unit of the y axis
        :param color: None or list of colors
        :param dark: the plot can be switched to dark mode if required by user
        :return: None

        In Quanlse, users can specify colors from:

        ``mint``, ``blue``, ``red``, ``green``, ``yellow``, ``black``, ``pink``, ``cyan``, ``purple``,
        ``darkred``, ``orange``, ``brown``, ``pink`` and ``teal``.

        The colors will repeat if there are more pulses than colors.
        """

        self.computeMaxTime()

        # Get the max time
        maxNs = self.endTime

        # print plot
        if names is None:
            names = list(self.waves.keys())
        elif isinstance(names, str):
            names = [names]
        elif isinstance(names, list):
            pass
        else:
            raise Error.ArgumentError("Variable names should be a list or a str.")

        if len(names) < 1:
            raise Error.ArgumentError("No terms exist, hence no available waves can be plot.")

        # Keep track of figure numbers
        fig = 0

        # Create two empty lists
        x = []
        y = []
        yLabel = []
        colors = []
        colorIndex = 0
        self.buildWaveCache()

        for name in names:
            aList = array(self._waveCache[name])
            tList = linspace(0, maxNs, len(aList))
            y.append(list(aList))
            x.append(list(tList))
            yLabel.append(yUnit)

            # Whether repetitive colors or all blue
            if color is None:
                colors.append('blue')
            else:
                colors.append(color[colorIndex])
                colorIndex += 1
                if colorIndex == len(color):
                    colorIndex = 0
            fig += 1
        plotPulse(x, y, xLabel=f'Time ({xUnit})', yLabel=yLabel, title=names, color=colors, dark=dark)
        plt.show()
        self.clearCache()

        Print the waveforms of the control terms listed in ``names``.

        :param names: the name or name list of the control term
        :param xUnit: the unit of the x axis
        :param yUnit: the unit of the y axis
        :param color: None or list of colors
        :param dark: the plot can be switched to dark mode if required by user
        :return: None

        In Quanlse, users can specify colors from:

        ``mint``, ``blue``, ``red``, ``green``, ``yellow``, ``black``, ``pink``, ``cyan``, ``purple``,
        ``darkred``, ``orange``, ``brown``, ``pink`` and ``teal``.

        The colors will repeat if there are more pulses than colors.
        
Print the waveforms of the control terms listed in ``names``.
Print the waveforms of the control terms listed in ` ` names ` ` .
def plotIon(self, names: Union[str, List[str]] = None, xUnit: str = r'$\mu$s', yUnit: str = 'Amp (a.u.)',
                color: Union[str, List[str]] = None, dark: bool = False) -> None:
        self.computeMaxTime()
        maxNs = self.endTime
        if names is None:
            names = list(self.waves.keys())
        elif isinstance(names, str):
            names = [names]
        elif isinstance(names, list):
            pass
        else:
            raise Error.ArgumentError("Variable names should be a list or a str.")
        if len(names) < 1:
            raise Error.ArgumentError("No terms exist, hence no available waves can be plot.")
        fig = 0
        x = []
        y = []
        yLabel = []
        colors = []
        colorIndex = 0
        self.buildWaveCache()
        for name in names:
            aList = array(self._waveCache[name])
            tList = linspace(0, maxNs, len(aList))
            y.append(list(aList))
            x.append(list(tList))
            yLabel.append(yUnit)
            if color is None:
                colors.append('blue')
            else:
                colors.append(color[colorIndex])
                colorIndex += 1
                if colorIndex == len(color):
                    colorIndex = 0
            fig += 1
        plotPulse(x, y, xLabel=f'Time ({xUnit})', yLabel=yLabel, title=names, color=colors, dark=dark)
        plt.show()
        self.clearCache()
def plotIon ( self , names : Union [ str , List [ str ] ] = None , xUnit : str = r'$\mu$s' , yUnit : str = 'Amp (a.u.)' , color : Union [ str , List [ str ] ] = None , dark : bool = False ) -> None : self . computeMaxTime ( ) maxNs = self . endTime if names is None : names = list ( self . waves . keys ( ) ) elif isinstance ( names , str ) : names = [ names ] elif isinstance ( names , list ) : pass else : raise Error . ArgumentError ( "Variable names should be a list or a str." ) if len ( names ) < 1 : raise Error . ArgumentError ( "No terms exist, hence no available waves can be plot." ) fig = 0 x = [ ] y = [ ] yLabel = [ ] colors = [ ] colorIndex = 0 self . buildWaveCache ( ) for name in names : aList = array ( self . _waveCache [ name ] ) tList = linspace ( 0 , maxNs , len ( aList ) ) y . append ( list ( aList ) ) x . append ( list ( tList ) ) yLabel . append ( yUnit ) if color is None : colors . append ( 'blue' ) else : colors . append ( color [ colorIndex ] ) colorIndex += 1 if colorIndex == len ( color ) : colorIndex = 0 fig += 1 plotPulse ( x , y , xLabel = f'Time ({xUnit})' , yLabel = yLabel , title = names , color = colors , dark = dark ) plt . show ( ) self . clearCache ( )
Print the waveforms of the control terms listed in ``names``.
Print the waveforms of the control terms listed in ` ` names ` ` .
"""
        Print the waveforms of the control terms listed in ``names``.

        :param names: the name or name list of the control term
        :param xUnit: the unit of the x axis
        :param yUnit: the unit of the y axis
        :param color: None or list of colors
        :param dark: the plot can be switched to dark mode if required by user
        :return: None

        In Quanlse, users can specify colors from:

        ``mint``, ``blue``, ``red``, ``green``, ``yellow``, ``black``, ``pink``, ``cyan``, ``purple``,
        ``darkred``, ``orange``, ``brown``, ``pink`` and ``teal``.

        The colors will repeat if there are more pulses than colors.
        """ # Get the max time # print plot # Keep track of figure numbers # Create two empty lists # Whether repetitive colors or all blue
None
In Quanlse, users can specify colors from.



The colors will repeat if there are more pulses than colors.
None In Quanlse users can specify colors from . The colors will repeat if there are more pulses than colors .
self
names
Union[str, List[str]]
the name or name list of the control term
the name or name list of the control term
xUnit
str
the unit of the x axis
the unit of the x axis
yUnit
str
the unit of the y axis
the unit of the y axis
color
Union[str, List[str]]
None or list of colors
None or list of colors
dark
bool
the plot can be switched to dark mode if required by user
the plot can be switched to dark mode if required by user