Ejemplo n.º 1
0
 def testSmoothPosdapOneZigZag(self):
     tp = cmsd.convert_track_point_array_to_df(
         json.load(
             open(
                 "emission/tests/data/smoothing_data/caltrain_one_zigzag.json"
             )))
     posdap_smoother = cjs.SmoothPosdap(maxSpeed=150 * 1000)
     posdap_smoother.filter(ls.add_speed(tp))
     removed_indices = np.nonzero(
         np.logical_not(posdap_smoother.inlier_mask_))[0].tolist()
     logging.info("removed indices = %s" % removed_indices)
     self.assertEqual(len(removed_indices), 1)
     self.assertEqual(removed_indices, [68])
Ejemplo n.º 2
0
    def testSmoothMaxPosdapMultiZigZag(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)
        posdap_smoother = cjs.SmoothPosdap(
            maxSpeed=cqo.get_threshold(tp_with_speeds))
        posdap_smoother.filter(tp_with_speeds)
        removed_indices = np.nonzero(
            np.logical_not(posdap_smoother.inlier_mask_))[0].tolist()
        logging.info("removed indices = %s" % removed_indices)
        self.assertEqual(len(removed_indices), 1)
        self.assertEqual(removed_indices, [46])