Conversation
| directory = Path(directory) / session / constants.RAW_DATA_FOLDER | ||
| directory.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| new_data = data.clone() |
There was a problem hiding this comment.
the clone shouldn't be necessary
preprocessing/io/save.py
Outdated
| directory.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| new_data = data.clone() | ||
| trials = data.split(by="trial", as_dict=True) |
There was a problem hiding this comment.
maybe it would be nice to store the keys that the data is split on into the new Gaze.metadata field.
I created an issue for this: pymovements/pymovements#1502
There was a problem hiding this comment.
implemented in pymovements/pymovements#1504
There was a problem hiding this comment.
as pymovements/pymovements#1504 is merged I updated this PR accordingly in 7330f72
| trial.unnest() | ||
| trial.frame = trial.frame["time", "pixel_x", "pixel_y", "pupil", "page"] | ||
|
|
||
| trial.save_samples(directory / filename) |
There was a problem hiding this comment.
the save samples method could include two additional arguments:
unnest: bool | None = None: if True, always unnest, if None only unnest for csv files.columns: list[str] | None: if list of strings, only save these columns
preprocessing/io/save.py
Outdated
| name = f"{session}_{trial}_{stimulus}_raw_data.csv" | ||
| df = df["time", "pixel_x", "pixel_y", "pupil", "page"] | ||
| df.write_csv(directory / name) | ||
| trial.unnest() |
There was a problem hiding this comment.
| trial.unnest() | |
| trial.unnest('pixel') |
There was a problem hiding this comment.
this way no warning should be raised
|
When I run the code locally: It gets raised when unnesting the gaze per default in the save methods. So, we'd need the unnest parameter here to make it work. and set it to False as it is already unnested. I could not find an issue in pm for this, is there one already? |
|
Thanks for the feedback! pymovements/pymovements#1522 should fix that issue. |
No description provided.