def test_AmplitudeBase_convertSNR():
    '''
  Generic tests for AmplitudeBase conversion to volts
  '''
    noiseParams = NoiseParameters(1e6, 1.)
    assert 10. * numpy.log10(4.) == AmplitudeBase.convertUnits2SNR(
        4., AmplitudeBase.UNITS_AMPLITUDE, noiseParams)
    assert 10. * numpy.log10(1.) == AmplitudeBase.convertUnits2SNR(
        4., AmplitudeBase.UNITS_POWER, noiseParams)
    assert 20. == AmplitudeBase.convertUnits2SNR(100, AmplitudeBase.UNITS_SNR,
                                                 noiseParams)
    assert 15. == AmplitudeBase.convertUnits2SNR(15.,
                                                 AmplitudeBase.UNITS_SNR_DB,
                                                 noiseParams)
def test_AmplitudeBase_convertSNR():
  '''
  Generic tests for AmplitudeBase conversion to volts
  '''
  noiseParams = NoiseParameters(1e6, 1.)
  assert 10. * numpy.log10(4.) == AmplitudeBase.convertUnits2SNR(4.,
                                                                 AmplitudeBase.UNITS_AMPLITUDE,
                                                                 noiseParams)
  assert 10. * numpy.log10(1.) == AmplitudeBase.convertUnits2SNR(4.,
                                                                 AmplitudeBase.UNITS_POWER,
                                                                 noiseParams)
  assert 20. == AmplitudeBase.convertUnits2SNR(100,
                                               AmplitudeBase.UNITS_SNR,
                                               noiseParams)
  assert 15. == AmplitudeBase.convertUnits2SNR(15.,
                                               AmplitudeBase.UNITS_SNR_DB,
                                               noiseParams)
Beispiel #3
0
  def computeSNR(self, noiseParams):
    '''
    Computes signal to noise ratio in dB.

    noiseParams : NoiseParameters
      Noise parameter container

    Returns
    -------
    float
      SNR in dB
    '''
    value = self.initial
    return AmplitudeBase.convertUnits2SNR(value, self.units, noiseParams)
Beispiel #4
0
    def computeSNR(self, noiseParams):
        '''
    Computes signal to noise ratio in dB.

    noiseParams : NoiseParameters
      Noise parameter container

    Returns
    -------
    float
      SNR in dB
    '''
        poly = self.poly
        if poly is not None:
            value = poly(0.)
        else:
            value = 1.

        return AmplitudeBase.convertUnits2SNR(value, self.units, noiseParams)
Beispiel #5
0
  def computeSNR(self, noiseParams):
    '''
    Computes signal to noise ratio in dB.

    noiseParams : NoiseParameters
      Noise parameter container

    Returns
    -------
    float
      SNR in dB
    '''
    poly = self.poly
    if poly is not None:
      value = poly(0.)
    else:
      value = 1.

    return AmplitudeBase.convertUnits2SNR(value, self.units, noiseParams)