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

Higher-level API #17

Merged
merged 22 commits into from
Aug 9, 2023
Merged

Higher-level API #17

merged 22 commits into from
Aug 9, 2023

Conversation

clane9
Copy link
Collaborator

@clane9 clane9 commented Aug 7, 2023

Add a higher level BIDSTable interface inspired by the proposed PyBIDS API redesign.

Add `BIDSTable` subclass of `DataFrame` with convenience methods for
accessing subtables and flattened metadata.
Add `BIDSTable.filter()` which filters rows according to a condition
applied to a single column. The supported conditions follow
`pandas.Series.filter()`.
Also change `file` column group to `finfo` to try to limit possible confusion.
Bug fixes:

- Set the index of `flat_metadata` to the parent table's index.
- Treat NA in the row mask as False in `filter()`.
PyBIDS supports querying a layout with multiple filters specified as
keyword arguments. This is a nice interface, and is also useful for
programmatic filtering. Here we add a `filter_multi()` method to do
something similar.
@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Patch coverage: 95.32% and project coverage change: +1.13% 🎉

Comparison is base (0659536) 91.89% compared to head (84d471a) 93.03%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #17      +/-   ##
==========================================
+ Coverage   91.89%   93.03%   +1.13%     
==========================================
  Files          10       10              
  Lines         432      560     +128     
==========================================
+ Hits          397      521     +124     
- Misses         35       39       +4     
Files Changed Coverage Δ
bids2table/__main__.py 94.73% <ø> (ø)
bids2table/extractors/image.py 81.39% <75.00%> (-1.54%) ⬇️
bids2table/_b2t.py 89.74% <82.35%> (ø)
bids2table/table.py 95.91% <95.91%> (ø)
bids2table/__init__.py 100.00% <100.00%> (ø)
bids2table/entities.py 96.27% <100.00%> (ø)
bids2table/extractors/bids.py 89.65% <100.00%> (ø)
bids2table/extractors/inheritance.py 91.17% <100.00%> (ø)
bids2table/extractors/metadata.py 91.17% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Add a `func` arg option to `filter` for arbitrary lambda function
filtering.

Also move `join_bids_path()` into the `table` module.
Having the argument be `output` in `bids2table` was confusing when you
only want to load a table.
@clane9 clane9 marked this pull request as ready for review August 9, 2023 10:26
@clane9 clane9 merged commit 918fcf4 into main Aug 9, 2023
3 checks passed
@clane9 clane9 deleted the feat/layout-api branch August 9, 2023 10:30
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

Successfully merging this pull request may close these issues.

1 participant