From fea0e0d55842b5b8a901889ee82edec68a3636dc Mon Sep 17 00:00:00 2001 From: smoia Date: Thu, 27 Apr 2023 02:36:31 +0200 Subject: [PATCH] Run pre-commits --- phys2bids/io.py | 14 +++++++------- phys2bids/tests/conftest.py | 22 +++++----------------- phys2bids/tests/test_io.py | 18 +++++++++--------- 3 files changed, 21 insertions(+), 33 deletions(-) diff --git a/phys2bids/io.py b/phys2bids/io.py index ce4b9ef57..d4a5e3903 100644 --- a/phys2bids/io.py +++ b/phys2bids/io.py @@ -575,7 +575,7 @@ def load_smr(filename, chtrig=0): sonpy.lib.DataType.AdcMark: sonpy.lib.SonFile.ReadWaveMarks, sonpy.lib.DataType.RealMark: sonpy.lib.SonFile.ReadRealMarks, sonpy.lib.DataType.TextMark: sonpy.lib.SonFile.ReadTextMarks, - sonpy.lib.DataType.RealWave: sonpy.lib.SonFile.ReadFloats + sonpy.lib.DataType.RealWave: sonpy.lib.SonFile.ReadFloats, } smrfile = sonpy.lib.SonFile(filename, True) @@ -601,8 +601,8 @@ def load_smr(filename, chtrig=0): n_samples = int(np.floor((max_n_tick) / divide)) raw_signal = read_data[current_channel]( - smrfile, chan=i, nMax=n_samples, - tFrom=0, tUpto=max_n_tick) + smrfile, chan=i, nMax=n_samples, tFrom=0, tUpto=max_n_tick + ) signal = np.array(raw_signal) * gain + offset @@ -618,8 +618,8 @@ def load_smr(filename, chtrig=0): time = np.arange(n_timepoints) * freq[idx_max] # prepend to the existing list - freq = [freq[idx_max], ] + freq - timeseries = [time, ] + timeseries - units = ['s', ] + units - names = ['time', ] + names + freq = [freq[idx_max]] + freq + timeseries = [time] + timeseries + units = ["s"] + units + names = ["time"] + names return BlueprintInput(timeseries, freq, names, units, chtrig) diff --git a/phys2bids/tests/conftest.py b/phys2bids/tests/conftest.py index e715b454d..69160fde6 100644 --- a/phys2bids/tests/conftest.py +++ b/phys2bids/tests/conftest.py @@ -95,7 +95,6 @@ def multi_run_file(testpath): return fetch_file("gvy84", testpath, "Test2_samefreq_TWOscans.txt") - @pytest.fixture def matlab_file_labchart(testpath): return fetch_file("2j43t", testpath, "test_2minRest.mat") @@ -106,57 +105,46 @@ def matlab_file_acq(testpath): return fetch_file("mc96w", testpath, "Test_belt_pulse_multifreq.mat") - @pytest.fixture def ge_one_gep_file(testpath): return fetch_file("wb84d", testpath, "PPGData_epiRT_0000000000_00_00_000.gep") - @pytest.fixture def ge_two_gep_files_ppg(testpath): tmp = fetch_file("qawjv", testpath, "RESPData_epiRT_0000000000_00_00_000.gep") return fetch_file("wb84d", testpath, "PPGData_epiRT_0000000000_00_00_000.gep") - @pytest.fixture def ge_two_gep_files_resp(testpath): tmp = fetch_file("wb84d", testpath, "PPGData_epiRT_0000000000_00_00_000.gep") return fetch_file("qawjv", testpath, "RESPData_epiRT_0000000000_00_00_000.gep") - @pytest.fixture def ge_one_raw_file(testpath): return fetch_file("u9wsr", testpath, "PPGData_epiRT_0000000000_00_00_000") - @pytest.fixture def ge_two_raw_files(testpath): tmp = fetch_file("49xpw", testpath, "RESPData_epiRT_0000000000_00_00_000") return fetch_file("u9wsr", testpath, "PPGData_epiRT_0000000000_00_00_000") - @pytest.fixture def ge_badfiles(testpath): - tmp = fetch_file('tdmyn', testpath, - 'PPGData_epiRT_columnscsv_00_00_000') - tmp = fetch_file('b6skq', testpath, - 'PPGData_epiRT_columnstsv_00_00_000') - return fetch_file('8235b', testpath, - 'PPGData_epiRT_string0000_00_00_000') + tmp = fetch_file("tdmyn", testpath, "PPGData_epiRT_columnscsv_00_00_000") + tmp = fetch_file("b6skq", testpath, "PPGData_epiRT_columnstsv_00_00_000") + return fetch_file("8235b", testpath, "PPGData_epiRT_string0000_00_00_000") @pytest.fixture def spike2_smrx_file(testpath): - return fetch_file('7x5qw', testpath, - 'Test_ppg_pulse_spike2.smrx') + return fetch_file("7x5qw", testpath, "Test_ppg_pulse_spike2.smrx") @pytest.fixture def spike2_smr_file(testpath): - return fetch_file('zdpfr', testpath, - 'Test_ppg_pulse_spike2.smr') + return fetch_file("zdpfr", testpath, "Test_ppg_pulse_spike2.smr") diff --git a/phys2bids/tests/test_io.py b/phys2bids/tests/test_io.py index fa64cdb7d..ffed64546 100644 --- a/phys2bids/tests/test_io.py +++ b/phys2bids/tests/test_io.py @@ -219,7 +219,7 @@ def test_load_gep_two_files_resp(ge_two_gep_files_resp, testpath): @pytest.mark.skipif( sys.version_info < (3, 7) or sys.version_info > (3, 9), - reason="Requires python between 3.7 and 3.9" + reason="Requires python between 3.7 and 3.9", ) @pytest.mark.xfail(reason="We need to fix sonpy install") def test_load_smr(spike2_smr_file, spike2_smrx_file): @@ -227,25 +227,25 @@ def test_load_smr(spike2_smr_file, spike2_smrx_file): # 32-bit file phys_obj = io.load_smr(spike2_smr_file, chtrig) - assert phys_obj.ch_name[0] == 'time' + assert phys_obj.ch_name[0] == "time" assert phys_obj.freq[0] == 1000.0 - assert phys_obj.units[0] == 's' + assert phys_obj.units[0] == "s" # checks that the scanner strigger is in the right channel # the marker channels are stored as binary - assert phys_obj.ch_name[chtrig] == 'Scan Vol' + assert phys_obj.ch_name[chtrig] == "Scan Vol" assert phys_obj.freq[chtrig] == 200.0 - assert phys_obj.units[chtrig] == '' + assert phys_obj.units[chtrig] == "" assert len(phys_obj.timeseries[chtrig]) == 60 # 64-bit file should have the same phys_obj = io.load_smr(spike2_smrx_file, chtrig) - assert phys_obj.ch_name[0] == 'time' + assert phys_obj.ch_name[0] == "time" assert phys_obj.freq[0] == 1000.0 - assert phys_obj.units[0] == 's' + assert phys_obj.units[0] == "s" # checks that the scanner trigger is in the right channel # the marker channels are stored as binary - assert phys_obj.ch_name[chtrig] == 'Scan Vol' + assert phys_obj.ch_name[chtrig] == "Scan Vol" assert phys_obj.freq[chtrig] == 200.0 - assert phys_obj.units[chtrig] == '' + assert phys_obj.units[chtrig] == "" assert len(phys_obj.timeseries[chtrig]) == 60