Skip to content

Fix correctness issues in readers, dF/F, deconvolution and FluFinder detection - #1

Open
ehennestad wants to merge 3 commits into
mainfrom
fix-batch-a-algorithm-correctness
Open

ehennestad wants to merge 3 commits into
mainfrom
fix-batch-a-algorithm-correctness

Conversation

@ehennestad

Copy link
Copy Markdown
Contributor

Summary

Batch A from the migration memo: small correctness fixes in the algorithm code that moved into this module, each with a test.

Fixes

  • MDF reader could not be loaded. MDF kept a private copy of resolveDataSizeAndDimensionArrangement, which nansen.stack.data.VirtualArray declares sealed, so meta.class.fromName failed and no .mdf recording could be opened. The copy is removed; the base method does the same thing.
  • SciScanRaw.fileCheck returned a 1x2 logical from contains with two keys; it now returns a scalar.
  • CaImAn deconvolve called gcp unconditionally to decide whether to print progress; without the Parallel Computing Toolbox that was an undefined-function error before any work started.
  • dffRoiMinusDffNpil now raises a clear error naming the Signal Processing Toolbox when sgolayfilt is missing, and points at the alternatives.
  • dffChenEtAl2013 takes both baseline percentiles along time, as dffClassic does, instead of relying on the default dimension.
  • deconvolveDff documents and enforces its contract, numSamples x numRois in and out with a vector as one ROI, instead of transposing whenever rows outnumbered columns, which silently deconvolved the wrong axis for recordings with more ROIs than samples. All callers already pass that shape.
  • FluFinder findUniqueRoisFromComponents builds the component image with accumarray. The histcounts version needed at least two bin edges and, because the last bin is closed, never counted the last unique pixel. The function returns early when there are no components and stops when the component image has no peak left, which previously spun forever after the continue branch had cleared every pixel.
  • extractF help named a nonexistent nansen.RoiArray type.
  • ThorLabsTiffs and Suite2pCorrected imported themselves to call a static method; they use the qualified name now.
  • ProcessorT in the EXTRACT integration is deleted together with the commented-out block that was its only reference. It has been unreferenced since 2022, has an empty getDefaultOptions, and reused Processor's options identifier. Easy to restore from history if it turns out to be wanted.

Tests

ReaderResolutionTest now loads every reader class (this would have caught MDF) and checks the SciScan predicate is scalar. DffTest checks the Chen dF/F of a single ROI matches the multi-ROI result. New FluFinderDetectionTest covers no components, one repeated component and two separated components with hand-built stats in the shape getBwComponentStats returns.

🤖 Generated with Claude Code

ehennestad and others added 2 commits September 13, 2026 06:46
…detection

- MDF: drop the private copy of resolveDataSizeAndDimensionArrangement,
  which the VirtualArray base class seals; the class could not be loaded
  at all, so MScan recordings could not be opened.
- SciScanRaw.fileCheck returns a scalar logical.
- CaImAn deconvolve: only call gcp when the Parallel Computing Toolbox is
  installed; it merely decides whether to print progress.
- dffRoiMinusDffNpil: clear error when sgolayfilt (Signal Processing
  Toolbox) is missing, instead of an undefined-function error.
- dffChenEtAl2013: take the baseline percentiles along time.
- deconvolveDff: the input contract is numSamples x numRois (a vector is
  one ROI); orientation is no longer guessed from which dimension is
  larger, and the function now has help text.
- FluFinder findUniqueRoisFromComponents: build the component image with
  accumarray (histcounts needed two bin edges and dropped the last unique
  pixel), return early when there are no components, and stop when the
  component image has no peak left instead of looping forever.
- extractF help names RoI arrays instead of a nonexistent type.
- ThorLabsTiffs and Suite2pCorrected call their own static method by
  qualified name instead of importing themselves.
- Remove the EXTRACT ProcessorT class, unreferenced since 2022 apart from
  a commented-out block, and that block.

Tests: every reader class must load, the SciScan predicate is scalar, the
Chen dF/F of one ROI matches the multi-ROI result, and FluFinder's
component picking handles no components, one repeated component and two
separated components.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The explicit permissions block lacked pull-requests: write, so the
publish-unit-test-result step was refused with 403 on the first PR.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

39 tests   38 ✅  4s ⏱️
 6 suites   1 💤
 1 files     0 ❌

Results for commit 57b1bcd.

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