Skip to content

Commit

Permalink
change how/if TaskName is extracted (#88)
Browse files Browse the repository at this point in the history
* change how/if TaskName is extracted

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix taskname function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix taskname function

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix test_cli.py

* get rid of func TaskName and include it instead in metadata.yml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
julia-pfarr and pre-commit-ci[bot] authored Jul 25, 2024
1 parent a93425d commit 25cbfaa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions eye2bids/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def update_from_metadata(self, metadata: None | dict[str, Any] = None) -> None:
"ScreenRefreshRate": metadata.get("ScreenRefreshRate"),
"ScreenSize": metadata.get("ScreenSize"),
}
self["TaskName"] = metadata.get("TaskName")

def output_filename(self, recording: str | None = None) -> str:
"""Generate output filename."""
Expand Down
1 change: 1 addition & 0 deletions eye2bids/config/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ GazeMappingSettings:
RawDataFilters:
InstitutionName: str
InstitutionAddress: str
TaskName: str
9 changes: 0 additions & 9 deletions eye2bids/edf2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,6 @@ def _extract_ScreenResolution(df: pd.DataFrame) -> list[int]:
return [eval(i) for i in list_res]


def _extract_TaskName(events: list[str]) -> str:
return (
" ".join([ts for ts in events if ts.startswith("** RECORDED BY")])
.replace("** RECORDED BY ", "")
.replace("\n", "")
)


def _extract_StartTime(events: list[str]) -> int:
StartTime = (
np.array(pd.DataFrame([st.split() for st in events if st.startswith("START")])[1])
Expand Down Expand Up @@ -548,7 +540,6 @@ def edf2bids(
events_json.input_file = input_file
events_json.two_eyes = _2eyesmode(df_ms_reduced)

events_json["TaskName"] = _extract_TaskName(events)
events_json["StimulusPresentation"]["ScreenResolution"] = _extract_ScreenResolution(
df_ms_reduced
)
Expand Down

0 comments on commit 25cbfaa

Please sign in to comment.