Repository navigation
Cap auto-selected EMGFromLFP channels when there are many spike groups - #33
Merged
Merged
Conversation
getEMGFromLFP picks one channel per spike group and correlates every channel pair, so the work grows with the square of the number of spike groups. A layout with 42 spike groups gives 42 channels and 861 pairs, compared with 6-28 pairs for 4-8 groups. - New 'maxAutoChannels' option (default 16). With more usable spike groups than that, use that many groups spread evenly over the spike-group list. Recordings with <= 16 usable groups take the unchanged selection path and consume the RNG identically, so they get the same channels. specialChannels are still added on top; inf disables the cap. - Replace the per-bin corr() loop with blocked, vectorised Pearson correlations (same formula, NaN for flat windows). Values match the former loop to rounding error (<1e-12 in the regression tests). - Record the selection in EMGFromLFP.detectorinfo. - Call loadBinary with its actual case so the function runs on Linux. - Tests compare layouts with few spike groups against a frozen copy of the former implementation and check the cap on a 42-group layout.
ubuntu-latest now resolves to Ubuntu 26.04, where setup-matlab@v1 installs the latest MATLAB release with an installer that is no longer supported, and activation fails before any test runs. - Pin the runner to ubuntu-24.04. - Use setup-matlab@v2 with a pinned release (R2025b) and the toolboxes the tests need (Signal Processing, DSP System, Statistics and Machine Learning); v2 installs only MATLAB unless products are listed. - Update actions/checkout to v4.
With setup-matlab@v2, calling matlab -batch from a shell step finds no
license ("Unable to find a license for MATLAB"). Public repositories are
licensed only through the matlab-actions run steps, so compile the MEX
files and run the tests with matlab-actions/run-command@v2.
LFPfromDat calls gpuDeviceCount (useGPU defaults to true) and its progress reporter uses parallel.pool.DataQueue, both from Parallel Computing Toolbox, so test_LFPfromDat errors without it.
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.
getEMGFromLFP picks one channel per spike group and correlates every channel pair, so the work grows with the square of the number of spike groups. A layout with 42 spike groups gives 42 channels and 861 pairs, compared with 6-28 pairs for 4-8 groups.
CI: ubuntu-latest moved to Ubuntu 26.04, where setup-matlab@v1 no longer installs or activates MATLAB. The runner is pinned to ubuntu-24.04, setup-matlab is now v2 with release R2025b and the toolboxes the tests need, and MATLAB runs through matlab-actions/run-command@v2 so the CI licence applies.
Checks on a 42-spike-group, 257-channel, 8.2 h recording: