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 conversion] clean up obsolete commented lines of eyetrackingrun.py and make sure code snippets in edf_to_bids.md match eyetrackingrun.py #458

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

Comments

@celprov
Copy link
Collaborator

celprov commented Mar 26, 2024

It seems originally the code wanted to support both eyes (that's the snippets that are referenced to in edf_to_bids.md), but the developers retracted (code implemented in eyetrackingrun.py). The changes were however not reflected in the notebook.

The code in eyetrackingrun.py moreover reflects changes in the BEP20, but those changes are not reflected in the code snippets in edf_to_bids.md.

Here are the concerned lines:

thresholds_msg = messages.trialid.str.startswith("THRESHOLDS")
if thresholds_msg.any():
# self.metadata["PupilThreshold"] = [None] * len(self.eye)
# self.metadata["CornealReflectionThreshold"] = [None] * len(self.eye)
thresholds_chunks = (
messages[thresholds_msg].trialid.iloc[-1].strip().split(" ")[1:]
)
# eye_index = self.eye.index(EYE_CODE_MAP[thresholds_chunks[0]])
self.metadata["PupilThreshold"] = int(thresholds_chunks[-2])
self.metadata["CornealReflectionThreshold"] = int(thresholds_chunks[-1])
messages = messages.loc[~thresholds_msg]

for eyenum, eyename in enumerate(self.eye):
# Clean-up implausible values for pupil area (pa)
self.recording.loc[
self.recording[f"pa_{eyename}"] < 1, f"pa_{eyename}"
] = np.nan
self.recording = self.recording.rename(
# columns={f"pa_{eyename}": f"eye{eyenum + 1}_pupil_size"},
columns={f"pa_{eyename}": f"pupil_size"},
)
# Interpolate BIDS column names
columns = list(
set(self.recording.columns)
- set(
(
"timestamp",
"screen_ppdeg_x_coordinate",
"screen_ppdeg_y_coordinate",
"pupil_size",
# "eye2_pupil_size",
)
)
)
bids_columns = []
for eyenum, eyename in enumerate(self.eye):
for name in columns:
# colprefix = f"eye{eyenum + 1}" if name.endswith(f"_{eyename}") else ""
colprefix = "" # Assume one eye only
_newname = name.split("_")[0]

# Process events: first generate empty columns
self.recording["fixation"] = 0
self.recording["saccade"] = 0
self.recording["blink"] = 0

# Replace suffix
refname = refname.replace(f"_{suffix}", "_recording-eyetrack_physio")

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