Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #102 #113

Merged
merged 19 commits into from
Jan 22, 2025
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#96: fix start and stop time to be numbers instead of arrays
  • Loading branch information
julia-pfarr committed Sep 4, 2024
commit 95a7875bcc2651984e855ab2886660592dd0a22d
22 changes: 12 additions & 10 deletions eye2bids/edf2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,11 @@ def _extract_ScreenResolution(df: pd.DataFrame) -> list[int]:


def _extract_StartTime(events: list[str]) -> int:
StartTime = pd.DataFrame([st.split() for st in events if st.startswith("START")])[
1
].astype(int)
StartTime = (
np.array(pd.DataFrame([st.split() for st in events if st.startswith("START")])[1])
.astype(int)
.tolist()
)
if len(StartTime) > 1:
e2b_log.info(
"""Your input file contains multiple start times.\n
Expand All @@ -288,14 +290,15 @@ def _extract_StartTime(events: list[str]) -> int:
Please consider changing your code accordingly
for future eyetracking experiments.\n"""
)
return StartTime[0]
return StartTime
return StartTime[0]


def _extract_StopTime(events: list[str]) -> int:
StopTime = pd.DataFrame([so.split() for so in events if so.startswith("END")])[
1
].astype(int)
StopTime = (
np.array(pd.DataFrame([st.split() for st in events if st.startswith("START")])[1])
.astype(int)
.tolist()
)
if len(StopTime) > 1:
e2b_log.info(
"""Your input file contains multiple stop times.\n
Expand All @@ -304,8 +307,7 @@ def _extract_StopTime(events: list[str]) -> int:
Please consider changing your code accordingly
for future eyetracking experiments.\n"""
)
return StopTime[-1]
return StopTime
return StopTime[-1]


def _load_asc_file(events_asc_file: str | Path) -> list[str]:
Expand Down
Loading