Add Matlab-parity methods and rewrite paper examples#49
Merged
iahncajigas merged 6 commits intomainfrom Mar 10, 2026
Merged
Conversation
Port missing SignalObj methods from Matlab nSTAT toolbox: - Time manipulation: shift, shiftMe, alignTime - Arithmetic: power, sqrt - Cross-covariance: xcov (mean-removed xcorr) - Spectral: periodogram, MTMspectrum (DPSS multi-taper), spectrogram Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port missing FitResSummary methods from Matlab nSTAT toolbox: - plotAllCoeffs: errorbar plot of GLM coefficients across neurons/fits - plot3dCoeffSummary: 3D bar plot of binned significant coefficients - plot2dCoeffSummary: stacked ridge-plot of coefficient distributions - plotKSSummary: subplot grid of KS goodness-of-fit plots per neuron Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Major additions ported from Matlab nSTAT toolbox: SSGLM (State-Space GLM) EM algorithm in decoding_algorithms.py: - PPSS_EStep/PPSS_MStep: E-step (Kalman smoothing) and M-step (Newton) - PPSS_EM/PPSS_EMFB: Full EM with forward-backward smoothing - estimateInfoMat: Fisher information for coefficient CIs - prepareEMResults: Package EM output as FitResult objects - _ComputeStimulusCIs_MC: Monte Carlo stimulus confidence intervals Unscented Kalman Filter (UKF) in decoding_algorithms.py: - ukf_sigmas: Sigma point generation via Cholesky decomposition - ukf_ut: Unscented transformation - ukf: Full UKF one-step update SpikeTrainCollection methods in trial.py: - ssglm(): Run SSGLM EM on spike train collection - ssglmFB(): Run SSGLM EM with forward-backward smoothing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace thin wrappers (calling main_for) with self-contained scripts matching the Matlab example structure: - example01: Full nSTAT class API usage (nspikeTrain, Trial, Analysis) for mEPSC Poisson modeling under constant and washout Mg2+ - example02: Whisker stimulus GLM with lag/history selection - example03: PSTH comparison and SSGLM dynamics (two-part) - example04: Place-cell receptive fields (Gaussian vs Zernike) - example05: PPAF and hybrid filter decoding (three-part) Each script has: detailed docstrings, workflow comments matching Matlab, CLI args (--repo-root, --export-figures, --export-dir, --output-json), and proper result merging for multi-section examples. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add overview paragraph describing toolbox capabilities, lab website links, license note (GPL v2), Figshare dataset DOI, PMID, and cross-reference to the Matlab repo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port findPeaks, findMaxima, findMinima, findGlobalPeak from Matlab SignalObj. Fixes two Matlab bugs: - findPeaks 'minima' branch now negates data before peak detection (Matlab original calls findpeaks on raw data, finding maxima instead) - findGlobalPeak minima branch uses correct variable name (Matlab has typo 'sOBj' instead of 'sObj') Co-Authored-By: Claude Opus 4.6 <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
core.py): Portshift,shiftMe,alignTime,power,sqrt,xcov,periodogram,MTMspectrum,spectrogramfrom Matlabfit.py): PortplotAllCoeffs,plot3dCoeffSummary,plot2dCoeffSummary,plotKSSummarydecoding_algorithms.py): FullPPSS_EMFBimplementation (~700 lines) with E-step (Kalman), M-step (Newton), Fisher information, and Monte Carlo CIsdecoding_algorithms.py): Portukf,ukf_ut,ukf_sigmastrial.py): Convenience methods for running SSGLM on spike train collectionsTest plan
pytest tests/ -v)test_paper_example_scripts.py)🤖 Generated with Claude Code