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])
def testSmoothBoundaryWalkOneZigZag(self): tp_with_speeds = ls.add_speed(cmsd.convert_track_point_array_to_df( json.load(open("emission/tests/data/smoothing_data/walk_one_zigzag.json")))) boundary_smoother = cjs.SmoothBoundary(maxSpeed = 150 * 1000) 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), 0) self.assertEqual(removed_indices, [])
def testSmoothMaxBoundaryWalkOneZigZag(self): tp_with_speeds = ls.add_speed(cmsd.convert_track_point_array_to_df( json.load(open("emission/tests/data/smoothing_data/walk_one_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), 1) self.assertEqual(removed_indices, [5])
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])
def testSmoothBoundaryWalkOneZigZag(self): tp_with_speeds = ls.add_speed( cmsd.convert_track_point_array_to_df( json.load( open( "emission/tests/data/smoothing_data/walk_one_zigzag.json" )))) boundary_smoother = cjs.SmoothBoundary(maxSpeed=150 * 1000) 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), 0) self.assertEqual(removed_indices, [])
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])