예제 #1
0
def sameFIR(firA, firB):
    result = checkNRL.checkMultiple( [
        ('Symmetry', firA.Symmetry, firB.Symmetry),
        ('len NumeratorCoefficient', len(firA.NumeratorCoefficient), len(firB.NumeratorCoefficient))
    ] )
    if not result[0]:
         return result
    checklist = []
    for i in range(len(firA.NumeratorCoefficient)):
         checklist.append(("%d NumeratorCoefficient"%(i,), float(firA.NumeratorCoefficient[i].ValueOf), float(firB.NumeratorCoefficient[i].ValueOf), 0.001))
    result = checkNRL.checkMultiple(checklist)
    return result
예제 #2
0
def sameCoefficients(coefA, coefB):
    numerA = getattr(coefA, 'Numerator', [])
    denomA = getattr(coefA, 'Denominator', [])
    numerB = getattr(coefB, 'Numerator', [])
    denomB = getattr(coefB, 'Denominator', [])
    result = checkNRL.checkMultiple( [
        ("CfTransferFunctionType", coefA.CfTransferFunctionType, coefB.CfTransferFunctionType),
        ("numerator len", len(numerA), len(numerB)),
        ("denominator len", len(denomA), len(denomB))
    ])
    if not result[0]:
         return result
    checklist = []
    for zi in range(len(numerA)):
         checklist.append(("%d numerator"%(zi,), float(coefA.Numerator[zi].ValueOf), float(coefB.Numerator[zi].ValueOf), 0.001))
    for pi in range(len(denomA)):
         checklist.append(("%d denominator"%(pi,), float(coefA.Denominator[pi].ValueOf), float(coefB.Denominator[pi].ValueOf), 0.001))
    result = checkNRL.checkMultiple(checklist)
    return result
예제 #3
0
def sameGain(stageA, stageB):
    booleanA = hasattr(stageA, 'StageGain')
    booleanB = hasattr(stageB, 'StageGain')
    if booleanA != booleanB:
        return (False, "Not same stage %s: %s %s"%('StageGain', booleanA, booleanB))
    if booleanA:
        result = checkNRL.checkMultiple( [
            ('Value', stageA.StageGain.Value, stageB.StageGain.Value, 0.001),
            ('Frequency', stageA.StageGain.Frequency, stageB.StageGain.Frequency, 0.001)
            ] )
        return result
    else:
        return True, "ok"
예제 #4
0
def sameDecimation(stageA, stageB):
    booleanA = hasattr(stageA, 'Decimation')
    booleanB = hasattr(stageB, 'Decimation')
    if booleanA != booleanB:
        return (False, "Not same stage %s: %s %s"%('Decimation', booleanA, booleanB))
    if booleanA:
        result = checkNRL.checkMultiple( [
            ('InputSampleRate', stageA.Decimation.InputSampleRate.ValueOf, stageB.Decimation.InputSampleRate.ValueOf, 0.001),
            ('Factor', stageA.Decimation.Factor, stageB.Decimation.Factor)
            ] )
        return result
    else:
        return True, "ok"
예제 #5
0
def samePolesZeros(pzA, pzB):
    zerosA = getattr(pzA, 'Zero', [])
    polesA = getattr(pzA, 'Pole', [])
    zerosB = getattr(pzB, 'Zero', [])
    polesB = getattr(pzB, 'Pole', [])
    result = checkNRL.checkMultiple( [
        ("PzTransferFunctionType", pzA.PzTransferFunctionType, pzB.PzTransferFunctionType),
        ("NormalizationFactor", pzA.NormalizationFactor, pzB.NormalizationFactor, 0.001),
        ("NormalizationFrequency", pzA.NormalizationFrequency, pzB.NormalizationFrequency, 0.001),
        ("zero len", len(zerosA), len(zerosB)),
        ("pole len", len(polesA), len(polesB))
    ])
    if not result[0]:
         return result
    checklist = []
    for zi in range(len(zerosA)):
         checklist.append(("%d zero real"%(zi,), float(pzA.Zero[zi].Real.ValueOf), float(pzB.Zero[zi].Real.ValueOf), 0.001))
         checklist.append(("%d zero imag"%(zi,), float(pzA.Zero[zi].Imaginary.ValueOf), float(pzB.Zero[zi].Imaginary.ValueOf), 0.001))
    for pi in range(len(polesA)):
         checklist.append(("%d pole real"%(pi,), float(pzA.Pole[pi].Real.ValueOf), float(pzB.Pole[pi].Real.ValueOf), 0.001))
         checklist.append(("%d pole imag"%(pi,), float(pzA.Pole[pi].Imaginary.ValueOf), float(pzB.Pole[pi].Imaginary.ValueOf), 0.001))
    result = checkNRL.checkMultiple(checklist)
    return result