예제 #1
0
    def compute_pinger_direction2(self, ang_ret=False):
        # Grab a sample of pinger data
        self.adc.get_data()

        # (detour) log data if applicable
        self.logger.process(self.adc, self.filt)

        # Estimate pinger location: Get a value that represents the
        # time delay of arrival for each individual hydrophone
        tdoa_times = get_heading.compute_relative_delay_times(self.adc,
                                                              TARGET_FREQ,
                                                              self.array,
                                                              env.c)

        # Get direction
        toa_dists = tdoa_times * env.c
        info_string = self.array.get_direction(toa_dists)

        # Report angles if applicable
        if ang_ret:
            angles = [(-math.atan2(b, a) * 180 / math.pi + 90) for (a, b) in self.array.ab]

            n = self.array.n_elements
            if n == 2:
                return {'ab': angles[0]}

            elif n == 3:
                return {'ra': angles[0],
                        'rb': angles[1],
                        'ab': angles[2]
                        }
            else:
                raise IOError('%d hydrophone elements was not expected' % n)
예제 #2
0
def compute_heading(hydrophone_pair, adc, pattern):
    # capture theta for sub array
    tdoa_times = get_heading.compute_relative_delay_times(adc, 22e3, hydrophone_pair, c=C_SOUND,pattern=[(0,1)],elem2adc=pattern)
    doas = tdoa_times * C_SOUND
    hydrophone_pair.get_direction(doas)

    unpack = 0
    (a,b) = hydrophone_pair.ab[unpack]
    theta_center = ab2heading(a,b)

    return theta_center
예제 #3
0
    def compute_pinger_direction3(self, ang_ret=False):
        # Helpful index definitions
        idx_pair_ab = 0
        idx_pair_cd = 5
        idx_tri_ra = 0
        idx_tri_rb = 1
        idx_tri_ab = 2
        
        # Grab a sample of pinger data
        y = self.get_data()

        if y:
            # (detour) log data if applicable
            self.logger.process(self.adc, self.filt)

            # Estimate pinger location: Get a value that represents the
            # time delay of arrival for each individual hydrophone
            tdoa_times = get_heading.compute_relative_delay_times(self.adc,
                                                                  self.pinger_freq,
                                                                  self.array,
                                                                  env.c)

            # Get direction
            toa_dists = tdoa_times * env.c
            info_string = self.array.get_direction(toa_dists)

            # Report angles if applicable
            if ang_ret:
                angles = [(-math.atan2(b, a) * 180 / math.pi + 90) for (a, b) in self.array.ab]

                n = self.array.n_elements
                if n == 2:
                    return {'ab': angles[idx_pair_ab], 'cd': None}

                elif n == 3:
                    return {'ra': angles[0],
                            'rb': angles[1],
                            'ab': angles[2]
                            }
                            
                elif n == 4:
                    return {'ab': angles[idx_pair_ab], 'cd': angles[idx_pair_cd]}
                else:
                    raise IOError('%d hydrophone elements was not expected' % n)
        else:
            # Did not get an acceptable sample. Return None.
            return None