def getRESP(self, station, channel, abbreviations): """ Returns RESP string. """ string = \ '#\t\t+ +----------------------------------------' +\ '---+ +\n' + \ '#\t\t+ | Response (Coefficients),' + \ '%6s ch %s | +\n' % (station, channel) + \ '#\t\t+ +----------------------------------------' +\ '---+ +\n' + \ '#\t\t\n' + \ 'B044F05 Response type: %s\n' \ % self.response_type + \ 'B044F06 Response in units lookup: %s\n'\ % Blockette34Lookup(abbreviations, self.signal_input_units) + \ 'B044F07 Response out units lookup: %s\n'\ % Blockette34Lookup(abbreviations, self.signal_output_units) + \ 'B044F08 Number of numerators: %s\n' \ % self.number_of_numerators + \ 'B044F11 Number of denominators: %s\n' \ % 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' return string
def getRESP(self, station, channel, abbreviations): """ Returns RESP string. """ string = \ '#\t\t+ +---------------------------------+' +\ ' +\n' + \ '#\t\t+ | Response List,%6s ch %s |' + \ ' +\n' % (station, channel) + \ '#\t\t+ +---------------------------------+' +\ ' +\n' + \ '#\t\t\n' + \ 'B055F03 Stage sequence number: %s\n' \ % self.stage_sequence_number + \ 'B055F04 Response in units lookup: %s\n' \ % Blockette34Lookup(abbreviations, self.stage_input_units) + \ 'B055F05 Response out units lookup: %s\n' \ % Blockette34Lookup(abbreviations, self.stage_output_units) + \ 'B055F06 Number of responses: %s\n' \ % self.number_of_responses_listed if self.number_of_responses_listed: string += \ '#\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 range(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
def getRESP(self, station, channel, abbreviations): """ Returns RESP string. """ # Field five needs some extra parsing. field_five_dict = { 'A': 'A [Laplace Transform (Rad/sec)]', 'B': 'B [Analog (Hz)]', 'C': 'C [Composite]', 'D': 'D [Digital (Z-transform)]' } string = \ '#\t\t+ ' + \ '+-----------------------------------------' + \ '---+ +\n' + \ '#\t\t+ | Response (Poles & Zeros),' + \ '%6s ch %s | +\n' % (station, channel) + \ '#\t\t+ ' + \ '+-----------------------------------------' + \ '---+ +\n' + \ '#\t\t\n' + \ 'B043F05 Response type: %s\n' \ % field_five_dict[self.response_type] + \ 'B043F06 Response in units lookup: %s\n' \ % Blockette34Lookup(abbreviations, self.stage_signal_input_units) + \ 'B043F07 Response out units lookup: %s\n' \ % Blockette34Lookup(abbreviations, self.stage_signal_output_units) + \ 'B043F08 A0 normalization factor: %G\n'\ % self.A0_normalization_factor + \ 'B043F09 Normalization frequency: %G\n'\ % self.normalization_frequency + \ 'B043F10 Number of zeroes: %s\n'\ % self.number_of_complex_zeros + \ 'B043F15 Number of poles: %s\n'\ % self.number_of_complex_poles + \ '#\t\tComplex zeroes:\n' + \ '#\t\t i real imag real_error imag_error\n' if self.number_of_complex_zeros > 0: if self.number_of_complex_zeros != 1: # Loop over all zeros. for _i in range(self.number_of_complex_zeros): string += 'B043F11-14 %4s %13s %13s %13s %13s\n' % ( _i, formatRESP(self.real_zero[_i], 6), formatRESP(self.imaginary_zero[_i], 6), formatRESP(self.real_zero_error[_i], 6), formatRESP(self.imaginary_zero_error[_i], 6)) else: 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
def getRESP(self, station, channel, abbreviations): """ Returns RESP string. """ # Field three needs some extra parsing. field_three_dict = { 'A': 'A [Laplace Transform (Rad/sec)]', 'B': 'B [Analog (Hz)]', 'C': 'C [Composite]', 'D': 'D [Digital (Z-transform)]', 'P': 'P [Polynomial]' } # Frequency too! frequency_dict = {'A': 'A [rad/sec]', 'B': 'B [Hz]'} # Polynomial Approximation too. polynomial_dict = {'M': 'M [MacLaurin]'} string = \ '#\t\t+ +-----------------------' + \ '----------------+ +\n' + \ '#\t\t+ | Polynomial response,' + \ '%6s ch %s | +\n' % (station, channel) + \ '#\t\t+ +-----------------------' + \ '----------------+ +\n' + \ '#\t\t\n' + \ 'B062F03 Transfer function type: %s\n' \ % field_three_dict[self.transfer_function_type] + \ 'B062F04 Stage sequence number: %s\n' \ % self.stage_sequence_number + \ 'B062F05 Response in units lookup: %s\n' \ % Blockette34Lookup(abbreviations, self.stage_signal_in_units) + \ 'B062F06 Response out units lookup: %s\n' \ % Blockette34Lookup(abbreviations, self.stage_signal_out_units) + \ 'B062F07 Polynomial Approximation Type: %s\n' \ % polynomial_dict[self.polynomial_approximation_type] + \ 'B062F08 Valid Frequency Units: %s\n' \ % frequency_dict[self.valid_frequency_units] + \ 'B062F09 Lower Valid Frequency Bound: %G\n' \ % self.lower_valid_frequency_bound + \ 'B062F10 Upper Valid Frequency Bound: %G\n' \ % self.upper_valid_frequency_bound + \ 'B062F11 Lower Bound of Approximation: %G\n' \ % self.lower_bound_of_approximation + \ 'B062F12 Upper Bound of Approximation: %G\n' \ % 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 range(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