Example #1
0
 def __init__(self, f=None, resp=None):
     """Constructor
     @param f (optional) instance of class FrequencyList
     @param resp (optional) list of complex frequency content or response
     """
     self.m_f = FrequencyList(f)
     if not resp is None:
         list.__init__(self, resp)
 def LimitEndFrequency(self, endFrequency):
     """limits the end frequency
     @param endFrequency float end frequency to limit to
     @return self
     @remark if the end frequency is higher than the current end frequency,
     the content is left unchanged.
     @warning the end frequency might be slightly higher and this is not
     a strict limit.  The goal is for the frequencies to potentially bracket
     the desired end frequency.
     """
     frequencies = self.Frequencies()
     deltaf = frequencies[-1] / (len(self) - 1)
     numPts = int(math.ceil(endFrequency / deltaf))
     if numPts >= len(self):
         return self
     fl = FrequencyList(frequencies[0:numPts + 1])
     fl.CheckEvenlySpaced()
     FrequencyDomain.__init__(self, fl, self[0:numPts + 1])
     return self
Example #3
0
 def Resample(self, fl):
     """Resamples the s-parameters onto a new frequency scale
     @param fl list of frequencies to resample to.
     @return instance of class SParameters containing resampled s-parameters
     """
     if self.m_d is None:
         self.m_f = fl
         copy.deepcopy(self)
     fl = FrequencyList(fl)
     f = FrequencyList(self.f())
     f.CheckEvenlySpaced()
     SR = [empty((self.m_P, self.m_P)).tolist() for n in range(fl.N + 1)]
     for o in range(self.m_P):
         for i in range(self.m_P):
             res = FrequencyResponse(f, self.Response(o + 1,
                                                      i + 1)).Resample(fl)
             for n in range(len(fl)):
                 SR[n][o][i] = res[n]
     return SParameters(fl, SR, self.m_Z0)
Example #4
0
 def __init__(self, f, data, Z0=50.0):
     """Constructor
     @param f list of frequencies
     @param data list of list of list matrices were each element is a list of list s-parameter matrix.
     @param Z0 (optional) real or complex reference impedance
     """
     self.m_sToken = 'S'
     self.m_d = data
     self.m_Z0 = Z0
     self.m_f = FrequencyList(f)
     if not data is None:
         if len(data) > 0: self.m_P = len(data[0])
     else:
         mat = self[0]
         if not mat is None: self.m_P = len(mat[0])
    def __init__(self, f, d):
        """Constructor
        @param f instance of class FrequencyList
        @param d list of list of list matrices
        @remark
        The list of list of list matrices in d are such that each element in the list
        represents a list of list matrix for a given frequency.  The list of list matrix
        for a frequency is the frequency response that converts inputs (columns) to outputs
        (rows).  If d is an N+1 element list of RxC matrices, then for n in 0..N, d[n][r][c]
        represents the frequency response for a filter used to convert input C into output
        r.

        Generally, you don't deal with the structure of d as it is produced completely by the
        two classes SimulatorNumericParser and VirtualProbeNumericParser, and an element of d
        for a frequency is produced by the two classes SimulatorNumeric and VirtualProbeNumeric.
        """
        self.f = FrequencyList(f)
        list.__init__(self, d)
        self.Inputs = len(d[0][0])
        self.Outputs = len(d[0])