Beispiel #1
0
    def setData(self, freqs=None, amp=None, phi=None, eAmp=0.03, ePhi=0.001):
        """
        Set data for chosen sip model.

        Parameters
        ----------
        freqs: iterable
            Array-like frequencies.
        amp: iterable
            Array-like amplitudes to work with.
        phi: iterable
            Array-like phase angles to work with.
        eAmp: float|iterable
            Relative error for amplitudes.
        ePhi: float|iterable
            Absolute error for phase angles.
        """
        self.fop.freqs = freqs
        if phi is not None:
            self.fw.dataVals = self._ensureData(toComplex(amp, phi))
            if isinstance(ePhi, float):
                ePhi = abs(ePhi / phi)
        else:
            self.fw.dataVals = self._ensureData(amp)

        if isinstance(eAmp, float):
            eAmp = np.ones(len(freqs)) * eAmp

        if phi is not None:
            err = np.asarray([*eAmp, *ePhi])
        else:
            err = eAmp

        self.fw.errorVals = self._ensureError(err, self.fw.dataVals)
Beispiel #2
0
 def drawData(self, ax, data, err=None, **kwargs):
     """"""
     if self.complex:
         Z = toComplex(data)
         showSpectrum(self.freqs, np.abs(Z), -np.angle(Z)*1000,
                      axs=ax, **kwargs)
     else:
         ax.semilogx(self.freqs, data)
         ax.legend()