-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: split_gaze_data by column values #859
Open
SiQube
wants to merge
32
commits into
main
Choose a base branch
from
split-gaze-files-into-trial-dataframes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
1c6c769
feat: split_gaze_data into trial
SiQube 976695b
docs: Add missing modules to documentation (#866)
dkrako 953ade3
hotfix: check whether public dataset has gaze files (#872)
SiQube b842bdb
docs: correctly add EyeTracker class to gaze module (#876)
dkrako cc1bae1
feat: add support for .ias files in stimulus.text.from_file() (#858)
SiQube 5417804
dataset: beijing sentence corpus (#857)
SiQube 92b49a7
dataset: add InteRead dataset (#862)
SiQube f0b69a9
fix: copy event resource files instead of moving them to events direc…
SiQube e6a9ced
hotfix: CopCo dataset precomputed eventsloading (#873)
SiQube 1b8c4bd
ci: ignore too-many-public-methods (#882)
dkrako 69ef837
ci: pre-commit autoupdate (#889)
pre-commit-ci[bot] cfbce95
ci: pre-commit autoupdate (#890)
pre-commit-ci[bot] 47e734d
build: add support for python 3.13 (#845)
SiQube 166b076
build: update nbsphinx requirement from <0.9.5,>=0.8.8 to >=0.8.8,<0.…
dependabot[bot] 495e5d9
ci: pre-commit autoupdate (#896)
pre-commit-ci[bot] b691e6d
build: update setuptools-git-versioning requirement from <2 to <3 (#895)
dependabot[bot] 88113c8
hotfix: download link fakenewsperception dataset (#897)
SiQube 21fd0d2
feat: Store metadata from ASC in experiment metadata (#884)
saeub 0856658
move split method to gaze dataframe
SiQube 4751e41
Merge branch 'main' into split-gaze-files-into-trial-dataframes
SiQube b47ad31
ci: pre-commit autoupdate (#899)
pre-commit-ci[bot] 5f5525a
ci: pre-commit autoupdate (#900)
pre-commit-ci[bot] c30bd9e
Add trial_columns argument in from_asc() (#898)
saeub 7a25297
ci: pre-commit autoupdate (#902)
pre-commit-ci[bot] 96141d5
docs: add CITATION.cff (#901)
SiQube 5bf55f1
ci: pre-commit autoupdate (#904)
pre-commit-ci[bot] e4b3e8f
ci: add dataset section to release drafter (#903)
dkrako eb8aee5
move split method to gaze dataframe
SiQube ecd6b5c
add tests for number of split files
SiQube 7229cd9
Merge branch 'main' into split-gaze-files-into-trial-dataframes
SiQube 52902af
Merge branch 'main' into split-gaze-files-into-trial-dataframes
SiQube 8994bb1
Merge branch 'main' into split-gaze-files-into-trial-dataframes
SiQube File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,6 +285,7 @@ def __init__( | |
|
||
# Remove this attribute once #893 is fixed | ||
self._metadata: dict[str, Any] | None = None | ||
self.auto_column_detect = auto_column_detect | ||
SiQube marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def apply( | ||
self, | ||
|
@@ -307,6 +308,33 @@ def apply( | |
else: | ||
raise ValueError(f"unsupported method '{function}'") | ||
|
||
def split(self, by: list[str] | str) -> list[GazeDataFrame]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's use |
||
"""Split the GazeDataFrame into multiple frames based on specified column(s). | ||
|
||
Parameters | ||
---------- | ||
by: list[str] | str | ||
Column name(s) to split the DataFrame by. If a single string is provided, | ||
it will be used as a single column name. If a list is provided, the DataFrame | ||
will be split by unique combinations of values in all specified columns. | ||
|
||
Returns | ||
------- | ||
list[GazeDataFrame] | ||
A list of new GazeDataFrame instances, each containing a partition of the | ||
original data with all metadata and configurations preserved. | ||
""" | ||
return [ | ||
GazeDataFrame( | ||
new_frame, | ||
experiment=self.experiment, | ||
trial_columns=self.trial_columns, | ||
time_column='time', | ||
distance_column='distance', | ||
) | ||
for new_frame in self.frame.partition_by(by=by) | ||
] | ||
|
||
def transform( | ||
self, | ||
transform_method: str | Callable[..., pl.Expr], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use
Sequence
here fromcollections
, this way it's more in line with the polars signature: https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.partition_by.html