Skip to content

Fix: default to zero input when none provided in integrate#52

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

Fix: default to zero input when none provided in integrate#52
ftavella wants to merge 1 commit into
Arcascope:mainfrom
ftavella:fix/issue-18

Conversation

@ftavella
Copy link
Copy Markdown
Member

Summary

Fixes #18

When input is not specified in integrate (or __call__), the model now defaults to an array of zeros rather than raising a ValueError. This makes input truly optional, consistent with how initial_condition already works.

Changes

  • integrate: replace raise ValueError when input is None with a default of np.zeros(len(time)) for single-input models and np.zeros((len(time), num_inputs)) for multi-input models
  • Also fixes pkg_resources import in setup.py for setuptools >= 82 compatibility

Tests

Updated test_models.ipynb:

  • Removed the test that expected a ValueError when no input is provided
  • Added test verifying that calling a single-input model (Forger99) without input produces the same trajectory as passing np.zeros
  • Added test verifying that a multi-input model runs without error when input is omitted

)

When `input` is not specified, `integrate` now defaults to an array of
zeros instead of raising a ValueError. Single-input models get a 1D
zeros array; multi-input models get a 2D zeros array shaped
(len(time), num_inputs). This matches the existing behavior for
`initial_condition`.

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.

Non-required argument input causes error if not specified when integrating a model

1 participant