def test_notch_filter(): rec, sort = se.example_datasets.toy_example(dump_folder='test', dumpable=True, duration=2, num_channels=4, seed=0) rec_n = notch_filter(rec, 3000, q=10) assert check_signal_power_signal1_below_signal2(rec_n.get_traces(), rec.get_traces(), freq_range=[2900, 3100], fs=rec.get_sampling_frequency()) assert check_signal_power_signal1_below_signal2(rec_n.get_traces(end_frame=30000), rec.get_traces(end_frame=30000), freq_range=[2900, 3100], fs=rec.get_sampling_frequency()) check_dumping(rec_n) shutil.rmtree('test')
def test_highpass_filter(): rec, sort = se.example_datasets.toy_example(dump_folder='test', dumpable=True, duration=2, num_channels=4, seed=0) rec_fft = highpass_filter(rec, freq_min=5000, filter_type='fft') assert check_signal_power_signal1_below_signal2(rec_fft.get_traces(), rec.get_traces(), freq_range=[1000, 5000], fs=rec.get_sampling_frequency()) assert check_signal_power_signal1_below_signal2(rec_fft.get_traces(end_frame=30000), rec.get_traces(end_frame=30000), freq_range=[1000, 5000], fs=rec.get_sampling_frequency()) check_dumping(rec_fft) shutil.rmtree('test')
def test_highpass_filter(): rec, sort = se.example_datasets.toy_example(dump_folder='test', dumpable=True, duration=2, num_channels=4, seed=0) rec_fft = highpass_filter(rec, freq_min=5000, filter_type='fft') assert check_signal_power_signal1_below_signal2( rec_fft.get_traces(), rec.get_traces(), freq_range=[1000, 5000], fs=rec.get_sampling_frequency()) rec_sci = bandpass_filter(rec, freq_min=3000, freq_max=6000, filter_type='butter', order=3) assert check_signal_power_signal1_below_signal2( rec_sci.get_traces(), rec.get_traces(), freq_range=[1000, 3000], fs=rec.get_sampling_frequency()) traces = rec.get_traces().astype('uint16') rec_u = se.NumpyRecordingExtractor( traces, sampling_frequency=rec.get_sampling_frequency()) rec_fu = bandpass_filter(rec_u, freq_min=5000, freq_max=10000, filter_type='fft') assert check_signal_power_signal1_below_signal2( rec_fu.get_traces(), rec_u.get_traces(), freq_range=[1000, 5000], fs=rec.get_sampling_frequency()) assert check_signal_power_signal1_below_signal2( rec_fu.get_traces(), rec_u.get_traces(), freq_range=[10000, 15000], fs=rec.get_sampling_frequency()) assert not str(rec_fu.get_dtype()).startswith('u') check_dumping(rec_fft) shutil.rmtree('test')
def test_notch_filter(): rec, sort = se.example_datasets.toy_example(duration=10, num_channels=4) rec_n = notch_filter(rec, 3000, q=10) assert check_signal_power_signal1_below_signal2( rec_n.get_traces(), rec.get_traces(), freq_range=[2900, 3100], fs=rec.get_sampling_frequency())
def test_notch_filter(): rec, sort = se.example_datasets.create_dumpable_extractors(duration=10, num_channels=4, folder='test') rec_n = notch_filter(rec, 3000, q=10) assert check_signal_power_signal1_below_signal2( rec_n.get_traces(), rec.get_traces(), freq_range=[2900, 3100], fs=rec.get_sampling_frequency()) check_dumping(rec_n) shutil.rmtree('test')
def test_bandpass_filter(): rec, sort = se.example_datasets.toy_example(duration=10, num_channels=4) rec_fft = bandpass_filter(rec, freq_min=5000, freq_max=10000, type='fft') assert check_signal_power_signal1_below_signal2( rec_fft.get_traces(), rec.get_traces(), freq_range=[1000, 5000], fs=rec.get_sampling_frequency()) assert check_signal_power_signal1_below_signal2( rec_fft.get_traces(), rec.get_traces(), freq_range=[10000, 15000], fs=rec.get_sampling_frequency()) rec_sci = bandpass_filter(rec, freq_min=3000, freq_max=6000, type='butter', order=3) assert check_signal_power_signal1_below_signal2( rec_sci.get_traces(), rec.get_traces(), freq_range=[1000, 3000], fs=rec.get_sampling_frequency()) assert check_signal_power_signal1_below_signal2( rec_sci.get_traces(), rec.get_traces(), freq_range=[6000, 10000], fs=rec.get_sampling_frequency()) rec_cache = bandpass_filter(rec, freq_min=3000, freq_max=6000, type='butter', order=3, cache_to_file=True) assert check_signal_power_signal1_below_signal2( rec_cache.get_traces(), rec.get_traces(), freq_range=[1000, 3000], fs=rec.get_sampling_frequency()) assert check_signal_power_signal1_below_signal2( rec_cache.get_traces(), rec.get_traces(), freq_range=[6000, 10000], fs=rec.get_sampling_frequency())