예제 #1
0
    def test_link_local_maxima_in_time_no_current_maxima(self):
        """Ensures correct output from _link_local_maxima_in_time.

        In this case there are no previous maxima.
        """

        these_current_to_prev_indices = (
            echo_top_tracking._link_local_maxima_in_time(
                current_local_max_dict=CURRENT_LOCAL_MAX_DICT_EMPTY,
                previous_local_max_dict=PREVIOUS_LOCAL_MAX_DICT,
                max_link_time_seconds=MAX_LINK_TIME_SECONDS,
                max_link_distance_m_s01=MAX_LINK_DISTANCE_M_S01))
        self.assertTrue(
            numpy.array_equal(these_current_to_prev_indices, numpy.array([])))
예제 #2
0
    def test_link_local_maxima_in_time_too_late(self):
        """Ensures correct output from _link_local_maxima_in_time.

        In this case, current minus previous time is too long for linkage.
        """

        these_current_to_prev_indices = (
            echo_top_tracking._link_local_maxima_in_time(
                current_local_max_dict=CURRENT_LOCAL_MAX_DICT_TOO_LATE,
                previous_local_max_dict=PREVIOUS_LOCAL_MAX_DICT,
                max_link_time_seconds=MAX_LINK_TIME_SECONDS,
                max_link_distance_m_s01=MAX_LINK_DISTANCE_M_S01))
        self.assertTrue(
            numpy.array_equal(these_current_to_prev_indices,
                              CURRENT_TO_PREV_INDICES_TOO_LATE))
예제 #3
0
    def test_link_local_maxima_in_time_no_previous_dict(self):
        """Ensures correct output from _link_local_maxima_in_time.

        In this case, `previous_local_max_dict` is None, meaning that there are
        no previous maxima with which to compare.
        """

        these_current_to_prev_indices = (
            echo_top_tracking._link_local_maxima_in_time(
                current_local_max_dict=CURRENT_LOCAL_MAX_DICT_BOTH_NEAR,
                previous_local_max_dict=None,
                max_link_time_seconds=MAX_LINK_TIME_SECONDS,
                max_link_distance_m_s01=MAX_LINK_DISTANCE_M_S01))
        self.assertTrue(
            numpy.array_equal(these_current_to_prev_indices,
                              CURRENT_TO_PREV_INDICES_NO_LINKS))
예제 #4
0
    def test_link_local_maxima_in_time_both_near(self):
        """Ensures correct output from _link_local_maxima_in_time.

        In this case, both current maxima are close enough to previous maxima to
        be linked.
        """

        these_current_to_prev_indices = (
            echo_top_tracking._link_local_maxima_in_time(
                current_local_max_dict=CURRENT_LOCAL_MAX_DICT_BOTH_NEAR,
                previous_local_max_dict=PREVIOUS_LOCAL_MAX_DICT,
                max_link_time_seconds=MAX_LINK_TIME_SECONDS,
                max_link_distance_m_s01=MAX_LINK_DISTANCE_M_S01))
        self.assertTrue(
            numpy.array_equal(these_current_to_prev_indices,
                              CURRENT_TO_PREV_INDICES_BOTH_NEAR))
예제 #5
0
    def test_link_local_maxima_in_time_overlap(self):
        """Ensures correct output from _link_local_maxima_in_time.

        In this case, both current maxima are close enough to be linked to the
        same previous max.  But this can't happen, so only one current max is
        linked.
        """

        these_current_to_prev_indices = (
            echo_top_tracking._link_local_maxima_in_time(
                current_local_max_dict=CURRENT_LOCAL_MAX_DICT_OVERLAP,
                previous_local_max_dict=PREVIOUS_LOCAL_MAX_DICT,
                max_link_time_seconds=MAX_LINK_TIME_SECONDS,
                max_link_distance_m_s01=MAX_LINK_DISTANCE_M_S01))
        self.assertTrue(
            numpy.array_equal(these_current_to_prev_indices,
                              CURRENT_TO_PREV_INDICES_OVERLAP))