Skip to content

Commit

Permalink
change dtypes of physioevents df columns and modify test
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-pfarr committed Jun 19, 2024
1 parent 0277a79 commit 6a3e661
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 3 additions & 0 deletions eye2bids/edf2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ def _physioevents_eye1 (physioevents_reordered: pd.DataFrame) -> pd.DataFrame:
physioevents_eye1['blink'] = physioevents_eye1['blink'].astype('Int64')
physioevents_eye1 = physioevents_eye1[physioevents_eye1.trial_type != 'EBLINKL']

physioevents_eye1['timestamp']= physioevents_eye1['timestamp'].astype('Int64')
physioevents_eye1['duration']= physioevents_eye1['duration'].astype('Int64')

physioevents_eye1 = physioevents_eye1[['timestamp', 'duration', 'trial_type','blink', 'message']]
return physioevents_eye1

Expand Down
12 changes: 4 additions & 8 deletions tests/test_edf2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,9 @@ def test_number_columns_physioevents_tsv(eyelink_test_data_dir):
@pytest.mark.parametrize(
"folder, expected",
[
("emg", [2116084, np.nan, np.nan, np.nan, "!MODE RECORD CR 1000 2 1 R"]),
("lt", [3852521, np.nan, np.nan, np.nan, "EYE_USED 0 LEFT"]),
("pitracker", [248610, np.nan, np.nan, np.nan, "!MODE RECORD CR 1000 2 1 R"]),
("rest", [9199380, np.nan, np.nan, np.nan, "RECORD_START"]),
("satf", [3098683, 20, "saccade", 1, np.nan]),
("vergence", [819655, np.nan, np.nan, np.nan, "!MODE RECORD CR 1000 2 1 LR"]),
("2eyes",[767985, 169, "fixation", 0, np.nan])
("rest", ['fixation', 'saccade', 'fixation', 'saccade', 'fixation', 'saccade', 'fixation']),
("2eyes", ['fixation', 'saccade', 'fixation', 'saccade', 'fixation', 'saccade', 'fixation']),
("pitracker", ['saccade', 'fixation', 'saccade', 'fixation', 'saccade', 'fixation', 'saccade']),
],
)
def test_physioevents_value(folder, expected, eyelink_test_data_dir):
Expand All @@ -649,4 +645,4 @@ def test_physioevents_value(folder, expected, eyelink_test_data_dir):
events_after_start = _df_events_after_start(events)
physioevents_reordered = _df_physioevents(events_after_start)
physioevents_eye1 = _physioevents_eye1(physioevents_reordered)
assert physioevents_eye1.iloc[0].tolist() == expected
assert physioevents_eye1.iloc[3:10, 2].tolist() == expected

0 comments on commit 6a3e661

Please sign in to comment.