def test_fl_mda_valid_time_manager_get_fl_mda_valid_times_failed_due_to_None_param(self): gaps_margin = 0.0001 sampling_rate = 1.0 mock_metadata = {'times_period_multiplier': 1.5} fl_mda_valid_time_manager = FlMdaValidTimeManager(sampling_rate, mock_metadata) fl_mda_valid_time_manager.get_fl_mda_valid_times( nwb_content=None, gaps_margin=gaps_margin )
def test_fl_mda_valid_time_manager_get_fl_mda_valid_times_failed_due_to_lack_of_timestamps(self): gaps_margin = 0.0001 sampling_rate = 1.0 mock_nwb = MagicMock(spec=NWBFile) mock_nwb.acquisition['e-series'].timestamps = None mock_metadata = {'times_period_multiplier': 1.5} fl_mda_valid_time_manager = FlMdaValidTimeManager(sampling_rate, mock_metadata) fl_mda_valid_time_manager.get_fl_mda_valid_times( nwb_content=mock_nwb, gaps_margin=gaps_margin )
def test_fl_mda_valid_time_manager_get_fl_mda_valid_times_with_gap_at_end(self): sampling_rate = 1.0 gaps_margin = 0.0001 mock_array = np.ndarray(dtype='float', shape=[10, ]) array = [1, 2, 3, 4, 5, 6, 7, 8, 10, 12] for i, number in enumerate(array): mock_array[i] = number mock_nwb = MagicMock(spec=NWBFile) mock_nwb.acquisition['e-series'].timestamps = mock_array mock_metadata = {'times_period_multiplier': 1.5} fl_mda_valid_time_manager = FlMdaValidTimeManager(sampling_rate, mock_metadata) fl_mda_valid_times = fl_mda_valid_time_manager.get_fl_mda_valid_times( nwb_content=mock_nwb, gaps_margin=gaps_margin ) self.assertEqual(len(fl_mda_valid_times), 1) self.assertEqual(round(fl_mda_valid_times[0].start_time, 4), 1.0001) self.assertEqual(round(fl_mda_valid_times[0].stop_time, 4), 7.9999)
class MdaValidTimeOriginator: def __init__(self, header, metadata): self.fl_mda_valid_time_manager = FlMdaValidTimeManager( sampling_rate=float( header.configuration.hardware_configuration.sampling_rate), metadata=metadata) self.mda_valid_time_injector = MdaValidTimeInjector() def make(self, nwb_content): logger.info('MDA valid times: Building') mda_valid_times = self.fl_mda_valid_time_manager.get_fl_mda_valid_times( nwb_content) logger.info('MDA valid times: Injecting') self.mda_valid_time_injector.inject_all(mda_valid_times, nwb_content)
def __init__(self, header, metadata): self.fl_mda_valid_time_manager = FlMdaValidTimeManager( sampling_rate=float( header.configuration.hardware_configuration.sampling_rate), metadata=metadata) self.mda_valid_time_injector = MdaValidTimeInjector()
def test_fl_mda_valid_time_manager_not_initialized_due_to_None_param(self): with self.assertRaises(TypeError): FlMdaValidTimeManager(None)