Skip to content

Updates to feature vector and QC analysis from exc_mMET branch - #592

Open
gouwens wants to merge 21 commits into
masterfrom
flex-feature-vector
Open

Updates to feature vector and QC analysis from exc_mMET branch#592
gouwens wants to merge 21 commits into
masterfrom
flex-feature-vector

Conversation

@gouwens

@gouwens gouwens commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

This PR is trying to bring in changes from the long-ago diverged exc_mMET branch of IPFX into the current master branch. Rather than merging directly from that branch, I have manually ported the key features into this new branch here and made some additional modifications.

The major changes involve:

  • Many updates to feature vector extraction (e.g., bug fixes, new features, and new runner script run_feature_vector_extraction_flex.py)
  • Updates to some QC feature calculations (including averaging multiple test pulses and using curve fitting to improve estimates of certain QC metrics)
  • Modifications to some script utility functions, in particular ones that move LIMS queries out of the per specimen analysis code so that they can either be done up front or replaced by alternative input files. This allows the code to be run more easily in other environments, such as in Code Ocean

I've also (using Claude Code) updated the test suite to reflect these changes.

gouwens and others added 21 commits June 11, 2025 15:22
… calculation; add transient removal functionality
Replace builtin max()/min() over the stimulus array with np.max/np.min.
The builtins iterated element-by-element in Python (~65x slower on a
full-length trace); np.max/np.min use the C path on ndarrays while still
accepting list inputs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
find_time_index used np.argmin(abs(t - t_0)), an O(n) scan allocating two
full-length arrays on every call. Since t is monotonic (already asserted),
np.searchsorted finds the closest sample in O(log n) with identical results
(30-500x faster per call depending on trace length).

calculate_dvdt redesigned the 4-pole Bessel filter via signal.bessel on
every call, though the coefficients depend only on order and normalized
cutoff, which are fixed across a cell's sweeps. Memoize the design.

Feature-vector output verified bit-for-bit identical on a real specimen;
time_series_utils / spike / subthreshold test outcomes unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The feature-vector, subthreshold, and QC code was refactored (stim-timing
API, curve-fit QC, strict find_time_index) but the tests were not updated.

- test_feature_vector: port to stim_timing_dict/list + duration, add
  sweep_number and clipped columns; update inst_freq initial-rate assertion
  to match the spike-time-only estimate
- test_subthresh_features: rebuild input_resistance data with a baseline
  period and settling step (deflection is now baseline-relative)
- test_qc_features: rewrite measure_seal / input-resistance tests around the
  averaged-pulse + curve-fit path (get_r_from_stable_pulse_response_fit)
- run_feature_vector_extraction / run_feature_collection: port the old
  runners to the new API (sweep_qc_record, per-sweep stim timing,
  identify_suprathreshold_spike_info two-value return)
- regenerate feature-vector and MIES pipeline expected outputs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gouwens
gouwens requested a review from t-b July 27, 2026 21:07
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