Example #1
0
 def getRESP(self, station, channel, abbreviations):
     """
     Returns RESP string.
     """
     string = (
         "#\t\t+                     +--------------------------------+"
         + "                      +\n"
         + "#\t\t+                     |   FIR response,"
         + "%6s ch %s   |                      +\n" % (station, channel)
         + "#\t\t+                     +--------------------------------+"
         + "                      +\n"
         + "#\t\t\n"
         + "B041F05     Symmetry type:                         %s\n" % self.symmetry_code
         + "B041F06     Response in units lookup:              %s - %s\n"
         % (
             LookupCode(abbreviations, 34, "unit_name", "unit_lookup_code", self.signal_in_units),
             LookupCode(abbreviations, 34, "unit_description", "unit_lookup_code", self.signal_in_units),
         )
         + "B041F07     Response out units lookup:             %s - %s\n"
         % (
             LookupCode(abbreviations, 34, "unit_name", "unit_lookup_code", self.signal_out_units),
             LookupCode(abbreviations, 34, "unit_description", "unit_lookup_code", self.signal_out_units),
         )
         + "B041F08     Number of numerators:                  %s\n" % self.number_of_factors
     )
     if self.number_of_factors > 1:
         string += "#\t\tNumerator coefficients:\n" + "#\t\t  i, coefficient\n"
         for _i in xrange(self.number_of_factors):
             string += "B041F09    %4s %13s\n" % (_i, formatRESP(self.FIR_coefficient[_i], 6))
     elif self.number_of_factors == 1:
         string += "#\t\tNumerator coefficients:\n" + "#\t\t  i, coefficient\n"
         string += "B041F09    %4s %13s\n" % (0, formatRESP(self.FIR_coefficient, 6))
     string += "#\t\t\n"
     return string
Example #2
0
 def getRESP(self, station, channel, abbreviations):
     """
     Returns RESP string.
     """
     out = RESP % (station, channel,
                   self.stage_sequence_number,
                   self.symmetry_code,
                   LookupCode(abbreviations, 34, 'unit_name',
                              'unit_lookup_code', self.signal_in_units),
                   LookupCode(abbreviations, 34, 'unit_description',
                              'unit_lookup_code', self.signal_in_units),
                   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 xrange(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
Example #3
0
 def getRESP(self, station, channel, abbreviations):
     """
     Returns RESP string.
     """
     out = RESP % (station, channel, self.stage_sequence_number,
                   formatRESP(self.input_sample_rate, 6),
                   self.decimation_factor, self.decimation_offset,
                   formatRESP(self.estimated_delay,
                              6), formatRESP(self.correction_applied, 6))
     return out
Example #4
0
 def getRESP(self, station, channel, abbreviations):
     """
     Returns RESP string.
     """
     out = RESP % (station, channel,
                   self.stage_sequence_number,
                   formatRESP(self.input_sample_rate, 6),
                   self.decimation_factor,
                   self.decimation_offset,
                   formatRESP(self.estimated_delay, 6),
                   formatRESP(self.correction_applied, 6))
     return out.encode()
Example #5
0
 def getRESP(self, station, channel, abbreviations):
     """
     Returns RESP string.
     """
     # This blockette can result in two different RESPs.
     blkt_type = self.stage_sequence_number
     if blkt_type != 0:
         string = \
         '#\t\t+                  +-------------------------------' + \
         '--------+                  +\n' + \
         '#\t\t+                  |       Channel Gain,' + \
         '%6s ch %s      |                  +\n' % (station, channel) + \
         '#\t\t+                  +-------------------------------' + \
         '--------+                  +\n'
     else:
         string = \
         '#\t\t+                  +--------------------------------' + \
         '-------+                  +\n' + \
         '#\t\t+                  |   Channel Sensitivity,' + \
         '%6s ch %s   |                  +\n' % (station, channel) + \
         '#\t\t+                  +--------------------------------' + \
         '-------+                  +\n'
     string += '#\t\t\n' + \
     'B058F03     Stage sequence number:                 %s\n' \
                 % blkt_type
     if blkt_type != 0:
         string += \
         'B058F04     Gain:                                  %s\n' \
                     % formatRESP(self.sensitivity_gain, 6) + \
         'B058F05     Frequency of gain:                     %s HZ\n' \
                     % formatRESP(self.frequency, 6)
     else:
         string += \
         'B058F04     Sensitivity:                           %s\n' \
                     % formatRESP(self.sensitivity_gain, 6) + \
         'B058F05     Frequency of sensitivity:              %s HZ\n' \
                     % formatRESP(self.frequency, 6)
     string += \
     'B058F06     Number of calibrations:                %s\n' \
                 % self.number_of_history_values
     if self.number_of_history_values > 1:
         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
Example #6
0
 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
Example #7
0
 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
Example #8
0
 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
Example #9
0
    def getRESP(self, station, channel, abbreviations):
        """
        Returns RESP string.
        """
        string = \
            '#\t\t+                     +--------------------------------+' + \
            '                      +\n' + \
            '#\t\t+                     |   FIR response,' + \
            '%6s ch %s   |                      +\n' % (station, channel) + \
            '#\t\t+                     +--------------------------------+' + \
            '                      +\n' + \
            '#\t\t\n' + \
            'B041F05     Symmetry type:                         %s\n' \
            % self.symmetry_code + \
            'B041F06     Response in units lookup:              %s - %s\n'\
            % (LookupCode(abbreviations, 34, 'unit_name',
                          'unit_lookup_code', self.signal_in_units),
               LookupCode(abbreviations, 34, 'unit_description',
                          'unit_lookup_code', self.signal_in_units)) + \
            'B041F07     Response out units lookup:             %s - %s\n'\
            % (LookupCode(abbreviations, 34, 'unit_name', 'unit_lookup_code',
                          self.signal_out_units),
               LookupCode(abbreviations, 34, 'unit_description',
                          'unit_lookup_code', self.signal_out_units)) + \
            'B041F08     Number of numerators:                  %s\n' \
            % self.number_of_factors

        if self.number_of_factors > 1:
            string += '#\t\tNumerator coefficients:\n' + \
                      '#\t\t  i, coefficient\n'
            for _i in xrange(self.number_of_factors):
                string += 'B041F09    %4s %13s\n' \
                    % (_i, formatRESP(self.FIR_coefficient[_i], 6))
        elif self.number_of_factors == 1:
            string += '#\t\tNumerator coefficients:\n' + \
                '#\t\t  i, coefficient\n'
            string += 'B041F09    %4s %13s\n' \
                % (0, formatRESP(self.FIR_coefficient, 6))
        string += '#\t\t\n'
        return string
Example #10
0
    def getRESP(self, station, channel, abbreviations):
        """
        Returns RESP string.
        """
        string = \
            '#\t\t+                     +--------------------------------+' + \
            '                      +\n' + \
            '#\t\t+                     |   FIR response,' + \
            '%6s ch %s   |                      +\n' % (station, channel) + \
            '#\t\t+                     +--------------------------------+' + \
            '                      +\n' + \
            '#\t\t\n' + \
            'B041F05     Symmetry type:                         %s\n' \
            % self.symmetry_code + \
            'B041F06     Response in units lookup:              %s - %s\n'\
            % (LookupCode(abbreviations, 34, 'unit_name',
                          'unit_lookup_code', self.signal_in_units),
               LookupCode(abbreviations, 34, 'unit_description',
                          'unit_lookup_code', self.signal_in_units)) + \
            'B041F07     Response out units lookup:             %s - %s\n'\
            % (LookupCode(abbreviations, 34, 'unit_name', 'unit_lookup_code',
                          self.signal_out_units),
               LookupCode(abbreviations, 34, 'unit_description',
                          'unit_lookup_code', self.signal_out_units)) + \
            'B041F08     Number of numerators:                  %s\n' \
            % self.number_of_factors

        if self.number_of_factors > 1:
            string += '#\t\tNumerator coefficients:\n' + \
                      '#\t\t  i, coefficient\n'
            for _i in range(self.number_of_factors):
                string += 'B041F09    %4s %13s\n' \
                    % (_i, formatRESP(self.FIR_coefficient[_i], 6))
        elif self.number_of_factors == 1:
            string += '#\t\tNumerator coefficients:\n' + \
                '#\t\t  i, coefficient\n'
            string += 'B041F09    %4s %13s\n' \
                % (0, formatRESP(self.FIR_coefficient, 6))
        string += '#\t\t\n'
        return string
Example #11
0
 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
Example #12
0
 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
Example #13
0
 def getRESP(self, station, channel, abbreviations):
     """
     Returns RESP string.
     """
     string = \
         '#\t\t+                  ' + \
         '+---------------------------------------+' + \
         '                  +\n' + \
         '#\t\t+                  |   Channel Sensitivity,' + \
         '%6s ch %s   |                  +\n' % (station, channel) + \
         '#\t\t+                  ' + \
         '+---------------------------------------+' + \
         '                  +\n' + \
         '#\t\t\n' + \
         'B048F05     Sensitivity:                           %s\n' \
         % formatRESP(self.sensitivity_gain, 6) + \
         'B048F06     Frequency of sensitivity:              %s\n' \
         % formatRESP(self.frequency, 6) + \
         'B048F07     Number of calibrations:                %s\n' \
         % self.number_of_history_values
     if self.number_of_history_values > 1:
         string += \
             '#\t\tCalibrations:\n' + \
             '#\t\t i, sensitivity, frequency, time of calibration\n'
         for _i in range(self.number_of_history_values):
             string += \
                 'B048F08-09   %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' + \
             'B048F08-09    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
Example #14
0
 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
Example #15
0
 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
Example #16
0
 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
Example #17
0
 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
Example #18
0
 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)]'}
     out = RESP % (station, channel,
                   field_three_dict[self.transfer_function_types],
                   self.stage_sequence_number,
                   LookupCode(abbreviations, 34, 'unit_name',
                              'unit_lookup_code',
                              self.stage_signal_input_units),
                   LookupCode(abbreviations, 34, 'unit_description',
                              'unit_lookup_code',
                              self.stage_signal_input_units),
                   LookupCode(abbreviations, 34, 'unit_name',
                              'unit_lookup_code',
                              self.stage_signal_output_units),
                   LookupCode(abbreviations, 34, 'unit_description',
                              'unit_lookup_code',
                              self.stage_signal_output_units),
                   self.A0_normalization_factor,
                   self.normalization_frequency,
                   self.number_of_complex_zeros,
                   self.number_of_complex_poles)
     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):
                 out += 'B053F10-13 %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:
             out += 'B053F10-13 %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))
     out += '#\t\tComplex poles:\n'
     out += '#\t\t  i  real          imag          real_error    '
     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
Example #19
0
 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)]'
     }
     out = RESP % (
         station, channel, field_three_dict[self.transfer_function_types],
         self.stage_sequence_number,
         LookupCode(abbreviations, 34, 'unit_name', 'unit_lookup_code',
                    self.stage_signal_input_units),
         LookupCode(abbreviations, 34, 'unit_description',
                    'unit_lookup_code', self.stage_signal_input_units),
         LookupCode(abbreviations, 34, 'unit_name', 'unit_lookup_code',
                    self.stage_signal_output_units),
         LookupCode(abbreviations, 34, 'unit_description',
                    'unit_lookup_code', self.stage_signal_output_units),
         self.A0_normalization_factor, self.normalization_frequency,
         self.number_of_complex_zeros, self.number_of_complex_poles)
     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):
                 out += 'B053F10-13 %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:
             out += 'B053F10-13 %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))
     out += '#\t\tComplex poles:\n'
     out += '#\t\t  i  real          imag          real_error    '
     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.encode()