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

ENH: Add high-level predictor fetching utilities #112

Merged
merged 24 commits into from Dec 20, 2022
Merged

Conversation

adelavega
Copy link
Collaborator

@adelavega adelavega commented Dec 9, 2022

Adds a fetch_utils module, with the function fetch_predictors & fetch_images

This helper simplifies using api.predictor_events to fetch predictors.

After fetching predictors using predictor_events, it does the following:

  • Grab duration, and TR from API for each unique run (from /api/tasks), and compute the probably n_vols for each. Note: ideally this would be grabbed directly from the volumes, rather than computed, but I didn't record this in the API. I could do this in the future, but need to add this to the API.
  • Creates a BIDSVariableCollection (pybids) from these Predictors, to facilitate resampling to TR (without reimplementing this logic).
  • Can return BIDSVariableCollection if the user wants to apply Transformations (e.g. scale), or can return a df (resampled or not).

The main problem I see here is the pybids dependency, but I think this will help users grab TR resampled timeseries.

fetch_images simplifies the process of fetching images from Neuroscout using datalad by:

  • Given the name of a dataset and a path:
  • Installing preproc dataset
  • Fetching files given a set of entities
  • Uses pyBIDS to associate paths w/ entities (to match to events easily)

@adelavega
Copy link
Collaborator Author

@jsmentch would you find this useful?

@jsmentch
Copy link
Contributor

jsmentch commented Dec 9, 2022

Yes definitely - I was previously doing resampling to TR manually so the resampling alone would be convenient in the future

@adelavega
Copy link
Collaborator Author

Cool. Also check out this PR: rbroc/neuroscout-encoding-models#2

This is the workflow roberta was working on w/ himalaya. I don't think I'll implement a full workflow for Neuroscout yet, but with this helper function it should be easy for people to use the data as they wish.

@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2022

Codecov Report

Merging #112 (2d08071) into master (56bd1a5) will decrease coverage by 11.13%.
The diff coverage is 0.91%.

@@             Coverage Diff             @@
##           master     #112       +/-   ##
===========================================
- Coverage   87.10%   75.97%   -11.14%     
===========================================
  Files          17       18        +1     
  Lines         737      845      +108     
===========================================
  Hits          642      642               
- Misses         95      203      +108     
Impacted Files Coverage Δ
pyns/endpoints/base.py 69.90% <ø> (ø)
pyns/fetch_utils.py 0.00% <0.00%> (ø)
pyns/__init__.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@adelavega adelavega merged commit a84996f into master Dec 20, 2022
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.

None yet

3 participants