Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
% self.number_of_denominators + \
'#\t\tNumerator coefficients:\n' + \
'#\t\t i, coefficient, error\n'
if self.number_of_numerators:
string += \
'#\t\tNumerator coefficients:\n' + \
'#\t\t i, coefficient, error\n'
if self.number_of_numerators > 1:
# Loop over all zeros.
for _i in range(self.number_of_numerators):
string += 'B044F09-10 %3s %13s %13s\n' % (_i,
formatRESP(self.numerator_coefficient[_i], 6),
formatRESP(self.numerator_error[_i], 6))
else:
string += 'B044F09-10 %3s %13s %13s\n' % (0,
formatRESP(self.numerator_coefficient, 6),
formatRESP(self.numerator_error, 6))
if self.number_of_denominators:
string += \
'#\t\tDenominator coefficients:\n' + \
'#\t\t i, coefficient, error\n'
if self.number_of_denominators > 1:
# Loop over all zeros.
for _i in range(self.number_of_numerators):
string += 'B044F12-13 %3s %13s %13s\n' % (_i,
formatRESP(self.denominator_coefficient[_i], 6),
formatRESP(self.denominator_error[_i], 6))
else:
string += 'B044F12-13 %3s %13s %13s\n' % (0,
formatRESP(self.denominator_coefficient, 6),
formatRESP(self.denominator_error, 6))
string += '#\t\t\n'
out += 'imag_error\n'
if self.number_of_complex_poles > 0:
if self.number_of_complex_poles != 1:
# Loop over all poles.
for _i in range(self.number_of_complex_poles):
out += 'B053F15-18 %4s %13s %13s %13s %13s\n' % (_i,
formatRESP(self.real_pole[_i], 6),
formatRESP(self.imaginary_pole[_i], 6),
formatRESP(self.real_pole_error[_i], 6),
formatRESP(self.imaginary_pole_error[_i], 6))
else:
out += 'B053F15-18 %4s %13s %13s %13s %13s\n' % (0,
formatRESP(self.real_pole, 6),
formatRESP(self.imaginary_pole, 6),
formatRESP(self.real_pole_error, 6),
formatRESP(self.imaginary_pole_error, 6))
out += '#\t\t\n'
return out
'#\t\tResponses:\n' + \
'#\t\t frequency\t amplitude\t amp error\t ' + \
'phase\t phase error\n'
if self.number_of_responses_listed > 1:
for _i in xrange(self.number_of_responses_listed):
string += 'B055F07-11 %s\t%s\t%s\t%s\t%s\n' % \
(formatRESP(self.frequency[_i], 6),
formatRESP(self.amplitude[_i], 6),
formatRESP(self.amplitude_error[_i], 6),
formatRESP(self.phase_angle[_i], 6),
formatRESP(self.phase_error[_i], 6))
else:
string += 'B055F07-11 %s\t%s\t%s\t%s\t%s\n' % \
(formatRESP(self.frequency, 6),
formatRESP(self.amplitude, 6),
formatRESP(self.amplitude_error, 6),
formatRESP(self.phase_angle, 6),
formatRESP(self.phase_error, 6))
string += '#\t\t\n'
return string
% self.upper_bound_of_approximation + \
'B062F13 Maximum Absolute Error: %G\n' \
% self.maximum_absolute_error + \
'B062F14 Number of coefficients: %d\n' \
% self.number_of_polynomial_coefficients
if self.number_of_polynomial_coefficients:
string += '#\t\tPolynomial coefficients:\n' + \
'#\t\t i, coefficient, error\n'
if self.number_of_polynomial_coefficients > 1:
for _i in xrange(self.number_of_polynomial_coefficients):
string += 'B062F15-16 %2s %13s %13s\n' \
% (_i, formatRESP(self.polynomial_coefficient[_i], 6),
formatRESP(self.polynomial_coefficient_error[_i], 6))
else:
string += 'B062F15-16 %2s %13s %13s\n' \
% (0, formatRESP(self.polynomial_coefficient, 6),
formatRESP(self.polynomial_coefficient_error, 6))
string += '#\t\t\n'
return string
LookupCode(abbreviations, 34, 'unit_name',
'unit_lookup_code', self.signal_out_units),
LookupCode(abbreviations, 34, 'unit_description',
'unit_lookup_code', self.signal_out_units),
self.number_of_coefficients)
if self.number_of_coefficients > 1:
out += '#\t\tNumerator coefficients:\n'
out += '#\t\t i, coefficient\n'
for _i in range(self.number_of_coefficients):
out += 'B061F09 %4s %13s\n' % \
(_i, formatRESP(self.FIR_coefficient[_i], 6))
elif self.number_of_coefficients == 1:
out += '#\t\tNumerator coefficients:\n'
out += '#\t\t i, coefficient\n'
out += 'B061F09 %4s %13s\n' % \
(0, formatRESP(self.FIR_coefficient, 6))
out += '#\t\t\n'
return out.encode()
string += 'B043F11-14 %4s %13s %13s %13s %13s\n' % (0,
formatRESP(self.real_zero, 6),
formatRESP(self.imaginary_zero, 6),
formatRESP(self.real_zero_error, 6),
formatRESP(self.imaginary_zero_error, 6))
string += '#\t\tComplex poles:\n' + \
'#\t\t i real imag real_error imag_error\n'
if self.number_of_complex_poles > 0:
if self.number_of_complex_poles != 1:
# Loop over all poles.
for _i in range(self.number_of_complex_poles):
string += 'B043F16-19 %4s %13s %13s %13s %13s\n' % (_i,
formatRESP(self.real_pole[_i], 6),
formatRESP(self.imaginary_pole[_i], 6),
formatRESP(self.real_pole_error[_i], 6),
formatRESP(self.imaginary_pole_error[_i], 6))
else:
string += 'B043F16-19 %4s %13s %13s %13s %13s\n' % (0,
formatRESP(self.real_pole, 6),
formatRESP(self.imaginary_pole, 6),
formatRESP(self.real_pole_error, 6),
formatRESP(self.imaginary_pole_error, 6))
string += '#\t\t\n'
return string
string += \
'#\t\tCalibrations:\n' + \
'#\t\t i, sensitivity, frequency, time of calibration\n'
for _i in xrange(self.number_of_history_values):
string += \
'B058F07-08 %2s %13s %13s %s\n' \
% (formatRESP(self.sensitivity_for_calibration[_i], 6),
formatRESP(self.frequency_of_calibration_sensitivity[_i], 6),
self.time_of_above_calibration[_i].formatSEED())
elif self.number_of_history_values == 1:
string += \
'#\t\tCalibrations:\n' + \
'#\t\t i, sensitivity, frequency, time of calibration\n' + \
'B058F07-08 0 %13s %13s %s\n' \
% (formatRESP(self.sensitivity_for_calibration, 6),
formatRESP(self.frequency_of_calibration_sensitivity, 6),
self.time_of_above_calibration.formatSEED())
string += '#\t\t\n'
return string
% self.upper_bound_of_approximation + \
'B062F13 Maximum Absolute Error: %G\n' \
% self.maximum_absolute_error + \
'B062F14 Number of coefficients: %d\n' \
% self.number_of_polynomial_coefficients
if self.number_of_polynomial_coefficients:
string += '#\t\tPolynomial coefficients:\n' + \
'#\t\t i, coefficient, error\n'
if self.number_of_polynomial_coefficients > 1:
for _i in xrange(self.number_of_polynomial_coefficients):
string += 'B062F15-16 %2s %13s %13s\n' \
% (_i, formatRESP(self.polynomial_coefficient[_i], 6),
formatRESP(self.polynomial_coefficient_error[_i], 6))
else:
string += 'B062F15-16 %2s %13s %13s\n' \
% (0, formatRESP(self.polynomial_coefficient, 6),
formatRESP(self.polynomial_coefficient_error, 6))
string += '#\t\t\n'
return string
def getRESP(self, station, channel, abbreviations):
"""
Returns RESP string.
"""
string = \
'#\t\t+ +------------------------------+' + \
' +\n' + \
'#\t\t+ | Decimation,' + \
'%6s ch %s | +\n' % (station, channel) + \
'#\t\t+ +------------------------------+' + \
' +\n' + \
'#\t\t\n' + \
'B047F05 Response input sample rate: %s\n' \
% formatRESP(self.input_sample_rate, 6) + \
'B047F06 Response decimation factor: %s\n' \
% self.decimation_factor + \
'B047F07 Response decimation offset: %s\n' \
% self.decimation_offset + \
'B047F08 Response delay: %s\n' \
% formatRESP(self.estimated_delay, 6) + \
'B047F09 Response correction: %s\n' \
% formatRESP(self.correction_applied, 6) + \
'#\t\t\n'
return string
string += \
'#\t\tCalibrations:\n' + \
'#\t\t i, sensitivity, frequency, time of calibration\n'
for _i in xrange(self.number_of_history_values):
string += \
'B058F07-08 %2s %13s %13s %s\n' \
% (formatRESP(self.sensitivity_for_calibration[_i], 6),
formatRESP(self.frequency_of_calibration_sensitivity[_i], 6),
self.time_of_above_calibration[_i].formatSEED())
elif self.number_of_history_values == 1:
string += \
'#\t\tCalibrations:\n' + \
'#\t\t i, sensitivity, frequency, time of calibration\n' + \
'B058F07-08 0 %13s %13s %s\n' \
% (formatRESP(self.sensitivity_for_calibration, 6),
formatRESP(self.frequency_of_calibration_sensitivity, 6),
self.time_of_above_calibration.formatSEED())
string += '#\t\t\n'
return string