Example #1
0
 def testSmoothBoundaryOneZigZag(self):
     tp = cmsd.convert_track_point_array_to_df(
         json.load(
             open(
                 "emission/tests/data/smoothing_data/caltrain_one_zigzag.json"
             )))
     boundary_smoother = cjs.SmoothBoundary(maxSpeed=150 * 1000)
     boundary_smoother.filter(ls.add_speed(tp))
     removed_indices = np.nonzero(
         np.logical_not(boundary_smoother.inlier_mask_))[0].tolist()
     logging.info("removed indices = %s" % removed_indices)
     self.assertEqual(len(removed_indices), 1)
     self.assertEqual(removed_indices, [68])
Example #2
0
    def testSmoothMaxBoundaryMultiZigZag(self):
        tp_with_speeds = ls.add_speed(
            cmsd.convert_track_point_array_to_df(
                json.load(
                    open(
                        "emission/tests/data/smoothing_data/caltrain_multi_zigzag.json"
                    ))))

        cqo = cso.SimpleQuartileOutlier(quantile=0.95, ignore_zeros=True)
        boundary_smoother = cjs.SmoothBoundary(
            maxSpeed=cqo.get_threshold(tp_with_speeds))
        boundary_smoother.filter(tp_with_speeds)
        removed_indices = np.nonzero(
            np.logical_not(boundary_smoother.inlier_mask_))[0].tolist()
        logging.info("removed indices = %s" % removed_indices)
        self.assertEqual(len(removed_indices), 2)
        self.assertEqual(removed_indices, [46, 58])