Skip to content

Conversation

@eurunuela
Copy link
Collaborator

@eurunuela eurunuela commented Dec 20, 2025

Summary

  • Migrate 05_3dMEPFM.md notebook from legacy pySPFM.pySPFM() function to new scikit-learn style SparseDeconvolution class API
  • Add NiftiMasker for proper data loading and inverse transformation
  • Document new model attributes and methods available in v2.0

Related

Companion to #54 (pySPFM version bump from 1.0.0 to 2.0.1)

Changes

  • Replace from pySPFM import pySPFM with from pySPFM import SparseDeconvolution
  • Use fit/transform pattern instead of single function call
  • Concatenate multi-echo data along time axis as required by new API
  • Add code to save fitted signal and residuals as additional outputs
  • Add documentation of model attributes (coef_, lambda_, hrf_matrix_)

Test plan

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings December 20, 2025 17:27
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>
Copy link

Copilot AI left a 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.

eurunuela and others added 2 commits December 20, 2025 11:00
- 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>
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