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

[EDF to BIDS revision] Unclear explanation about how to extract Startime and Stoptime metadata #456

Open
3 tasks
celprov opened this issue Mar 26, 2024 · 0 comments

Comments

@celprov
Copy link
Collaborator

celprov commented Mar 26, 2024

We then search for messages signaling the start and stop run events.
These events are stored in the JSON sidecar file annotating our `_eyetrack.tsv.gz` file.
In our *Psychopy* experiment files, we configure messages be sent to the ET at these events.
The message changes a little with the RSfMRI experiment, but are usually like `hello <taskname>` and `bye <taskname>`, which are stored in the variables `message_first_trigger` and `message_last_trigger` variables, respectively.
In the last line, we clean up these used-up lines from the dataframe.
``` Python
# Find Start time
start_rows = messages.trialid.str.contains(
message_first_trigger, case=False, regex=True
)
stop_rows = messages.trialid.str.contains(
message_last_trigger, case=False, regex=True
)
# Extract calibration headers
_cal_hdr = messages.trialid.str.startswith("!CAL")
calibration = messages[_cal_hdr]
messages = messages.drop(messages.index[_cal_hdr])
# Pick the LAST of the start messages
metadata["StartTime"] = (
int(messages[start_rows].trialid_time.values[-1])
if start_rows.any()
else None
)
# Pick the FIRST of the stop messages
metadata["StopTime"] = (
int(messages[stop_rows].trialid_time.values[0])
if stop_rows.any()
else None
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant