Open
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.
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>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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