Skip to content

Fix: cbt() and dlmos() now support batch trajectories#54

Open
ftavella wants to merge 1 commit into
Arcascope:mainfrom
ftavella:fix/issue-38
Open

Fix: cbt() and dlmos() now support batch trajectories#54
ftavella wants to merge 1 commit into
Arcascope:mainfrom
ftavella:fix/issue-38

Conversation

@ftavella
Copy link
Copy Markdown
Member

Summary

Fixes #38

cbt() and dlmos() previously failed with a ValueError when the trajectory had multiple initial conditions (batch size > 1), because find_peaks requires a 1-D array.

Changes

  • Add _cbt_single() private helper that runs peak detection on a single 1-D signal
  • Update cbt() for all 7 models (Forger99, Hannay19, Hannay19TP, Jewett99, Hilaire07, Breslow13, Skeldon23) to detect batch trajectories and return a list of arrays — one per batch
  • Single-trajectory calls return a plain np.ndarray as before (fully backward compatible)
  • dlmos() gains batch support automatically since it delegates to cbt()

Tests

Added batch tests to test_models.ipynb for Forger99.cbt() and Forger99.dlmos() verifying:

  • Return type is list for batch trajectories
  • Each per-batch result matches the cbt() of the corresponding individual trajectory

Add _cbt_single() helper that detects CBT minima from a 1-D signal.
Update cbt() for all models (Forger99, Hannay19, Hannay19TP, Jewett99,
Hilaire07, Breslow13, Skeldon23) to loop over batches when batch_size > 1,
returning a list of arrays. Single-trajectory calls return a plain array
as before (backward compatible).

dlmos() is unaffected since it delegates to cbt().

Also fix pkg_resources import in setup.py for setuptools >= 82.

Co-Authored-By: Claude Sonnet 4.6 <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.

CBTmin and DLMO calculation don't work after batch simulation

1 participant