Beispiel #1
0
def make_stationxml_response(presponse, input_unit, output_unit):
    norm_factor = 1.0 / float(
        abs(presponse.evaluate(num.array([1.0]))[0] / presponse.constant))

    pzs = fs.PolesZeros(pz_transfer_function_type='LAPLACE (RADIANS/SECOND)',
                        normalization_factor=norm_factor,
                        normalization_frequency=fs.Frequency(1.0),
                        zero_list=[
                            fs.PoleZero(real=fs.FloatNoUnit(z.real),
                                        imaginary=fs.FloatNoUnit(z.imag))
                            for z in presponse.zeros
                        ],
                        pole_list=[
                            fs.PoleZero(real=fs.FloatNoUnit(z.real),
                                        imaginary=fs.FloatNoUnit(z.imag))
                            for z in presponse.poles
                        ])

    pzs.validate()

    stage = fs.ResponseStage(number=1,
                             poles_zeros_list=[pzs],
                             stage_gain=fs.Gain(presponse.constant /
                                                norm_factor))

    resp = fs.Response(instrument_sensitivity=fs.Sensitivity(
        value=stage.stage_gain.value,
        input_units=fs.Units(input_unit),
        output_units=fs.Units(output_unit)),
                       stage_list=[stage])

    return resp
Beispiel #2
0
def pblock_053(content):
    stage_number = int(get1(content, '04'))

    pzs = fs.PolesZeros(
        pz_transfer_function_type=ptftype(get1(content, '03')),
        input_units=fs.Units(name=punit(get1(content, '05'))),
        output_units=fs.Units(name=punit(get1(content, '06'))),
        normalization_factor=float(get1(content, '07')),
        normalization_frequency=fs.Frequency(value=float(get1(content, '08'))),
        zero_list=map(ppolezero, getn(content, '10-13')),
        pole_list=map(ppolezero, getn(content, '15-18')))

    for i, x in enumerate(pzs.zero_list):
        x.number = i

    for i, x in enumerate(pzs.pole_list):
        x.number = i

    return stage_number, pzs