def test_segment_type_and_slice_2(self): # Gear on Ground is used instead of Eng (1) Nr speed_array = load_compressed( os.path.join(test_data_path, 'segment_type_and_slice_2_speed.npz')) heading_array = load_compressed( os.path.join(test_data_path, 'segment_type_and_slice_2_heading.npz')) eng_arrays = load_compressed( os.path.join(test_data_path, 'segment_type_and_slice_2_eng_arrays.npz')) aircraft_info = {'Aircraft Type': 'helicopter'} thresholds = { 'hash_min_samples': 64, 'speed_threshold': 90, 'min_split_duration': 100, 'min_duration': 180 } def get(key): array = load_compressed( os.path.join(test_data_path, 'segment_type_and_slice_2_gog.npz')) return Parameter('Gear on Ground', array=array) hdf = mock.MagicMock() hdf.get.side_effect = get hdf.superframe_present = False segment_type, segment, array_start_secs = _segment_type_and_slice( speed_array, 1, heading_array, 1, 0, 5736, eng_arrays, aircraft_info, thresholds, hdf) self.assertEqual(segment_type, 'START_AND_STOP') self.assertEqual(segment, slice(0, 5736)) self.assertEqual(array_start_secs, 0)
def test_segment_type_and_slice_1(self): # Unmasked fast Airspeed at the beginning of the data which is difficult # to validate should be ignored in segment type identification. speed_array = load_compressed( os.path.join(test_data_path, 'segment_type_and_slice_1_speed.npz')) heading_array = load_compressed( os.path.join(test_data_path, 'segment_type_and_slice_1_heading.npz')) eng_arrays = load_compressed( os.path.join(test_data_path, 'segment_type_and_slice_1_eng_arrays.npz')) aircraft_info = {'Aircraft Type': 'aeroplane'} thresholds = { 'hash_min_samples': 64, 'speed_threshold': 80, 'min_split_duration': 100, 'min_duration': 180 } hdf = mock.Mock() hdf.superframe_present = False segment_type, segment, array_start_secs = _segment_type_and_slice( speed_array, 1, heading_array, 1, 0, 11824, eng_arrays, aircraft_info, thresholds, hdf) self.assertEqual(segment_type, 'START_AND_STOP') self.assertEqual(segment, slice(0, 11824)) self.assertEqual(array_start_secs, 0)
def test_segment_type_and_slice_3(self): # Gear on Ground is used instead of Eng (1) Nr speed_array = load_array('segment_type_and_slice_3_speed.npz') heading_array = load_array('segment_type_and_slice_3_heading.npz') eng_arrays = load_array('segment_type_and_slice_3_eng_arrays.npz') aircraft_info = {'Aircraft Type': 'helicopter'} thresholds = { 'hash_min_samples': 64, 'speed_threshold': 90, 'min_split_duration': 100, 'min_duration': 180 } def get(key): if key == 'Collective': return Parameter( key, array=load_array( 'segment_type_and_slice_3_collective.npz'), frequency=8.) hdf = mock.MagicMock() hdf.get.side_effect = get hdf.superframe_present = False segment_type, segment, array_start_secs = _segment_type_and_slice( speed_array, 1, heading_array, 2, 0, 5560, eng_arrays, aircraft_info, thresholds, hdf) self.assertEqual(segment_type, 'START_AND_STOP') self.assertEqual(segment, slice(0, 5560)) self.assertEqual(array_start_secs, 0)
def test_segment_type_and_slice_1(self): # Unmasked fast Airspeed at the beginning of the data which is difficult # to validate should be ignored in segment type identification. speed_array = load_compressed(os.path.join(test_data_path, 'segment_type_and_slice_1_speed.npz')) heading_array = load_compressed(os.path.join(test_data_path, 'segment_type_and_slice_1_heading.npz')) eng_arrays = load_compressed(os.path.join(test_data_path, 'segment_type_and_slice_1_eng_arrays.npz')) aircraft_info = {'Aircraft Type': 'aeroplane'} thresholds = {'hash_min_samples': 64, 'speed_threshold': 80, 'min_split_duration': 100, 'min_duration': 180} hdf = mock.Mock() hdf.superframe_present = False segment_type, segment, array_start_secs = _segment_type_and_slice( speed_array, 1, heading_array, 1, 0, 11824, eng_arrays, aircraft_info, thresholds, hdf) self.assertEqual(segment_type, 'START_AND_STOP') self.assertEqual(segment, slice(0, 11824)) self.assertEqual(array_start_secs, 0)
def test_segment_type_and_slice_3(self): # Gear on Ground is used instead of Eng (1) Nr speed_array = load_array('segment_type_and_slice_3_speed.npz') heading_array = load_array('segment_type_and_slice_3_heading.npz') eng_arrays = load_array('segment_type_and_slice_3_eng_arrays.npz') aircraft_info = {'Aircraft Type': 'helicopter'} thresholds = {'hash_min_samples': 64, 'speed_threshold': 90, 'min_split_duration': 100, 'min_duration': 180} def get(key): if key == 'Collective': return Parameter(key, array=load_array('segment_type_and_slice_3_collective.npz'), frequency=8.) hdf = mock.MagicMock() hdf.get.side_effect = get hdf.superframe_present = False segment_type, segment, array_start_secs = _segment_type_and_slice( speed_array, 1, heading_array, 2, 0, 5560, eng_arrays, aircraft_info, thresholds, hdf) self.assertEqual(segment_type, 'START_AND_STOP') self.assertEqual(segment, slice(0, 5560)) self.assertEqual(array_start_secs, 0)