-
Notifications
You must be signed in to change notification settings - Fork 3
Update pySPFM notebook for v2.0 API #56
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
base: main
Are you sure you want to change the base?
Conversation
Migrate notebook from legacy pySPFM.pySPFM() function to new scikit-learn style SparseDeconvolution class API: - Use SparseDeconvolution with fit/transform pattern - Add NiftiMasker for data loading and inverse transformation - Concatenate multi-echo data along time axis as required by new API - Add documentation of model attributes (coef_, lambda_, hrf_matrix_) - Save fitted signal and residuals as additional outputs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
bc25d11 to
4c49e90
Compare
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.
Pull request overview
This PR migrates the pySPFM notebook from the legacy v1.0 pySPFM.pySPFM() function-based API to the new v2.0 scikit-learn style SparseDeconvolution class API. The update introduces proper fit/transform patterns, adds NiftiMasker for data handling, and documents new model attributes and methods.
- Replaces single-function API with scikit-learn style fit/transform pattern
- Implements multi-echo data concatenation along the time axis using NiftiMasker
- Adds documentation and code for saving fitted signals, residuals, and model attributes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove unused nibabel import - Fit NiftiMasker once before loop, use transform() inside - Clarify comments about multi-echo data stacking - Add shape information to coef_ documentation - Clarify method parameter requirements in documentation - Save fitted_signal and residuals as numpy arrays instead of NIfTI (their shape doesn't match single-echo masker expectations) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add n_jobs=-1 to use all available CPU cores, significantly speeding up the voxel-wise deconvolution. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
05_3dMEPFM.mdnotebook from legacypySPFM.pySPFM()function to new scikit-learn styleSparseDeconvolutionclass APINiftiMaskerfor proper data loading and inverse transformationRelated
Companion to #54 (pySPFM version bump from 1.0.0 to 2.0.1)
Changes
from pySPFM import pySPFMwithfrom pySPFM import SparseDeconvolutioncoef_,lambda_,hrf_matrix_)Test plan
🤖 Generated with Claude Code