Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1372 +/- ##
========================================
Coverage 94.85% 94.86%
========================================
Files 71 71
Lines 7387 7399 +12
========================================
+ Hits 7007 7019 +12
Misses 380 380 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
@dalonsoa This looks good and bang on spec.
So instead, I'm going to move the target as I have a few questions about my own proposed API and the user experience 😄
-
Does it make sense to have defaults? I think the default of the disturbance happening every step is a surprising and unlikely use case. I don't think some other default is any more sensible. In retrospect, I think it is clearer to have no defaults - users must specify the disturbance timing?
-
I think I've overcomplicated the constructor args.
- The primary mode could be
run_at: int | list[int] | None, which implicitly supportsrun_once. - If
run_atisNonethen users can instead use the convenience shortcutrun_every: tuple[int, int]. The tuple provides a configurable start point and step(2,5) -> [2, 7, ...]. We could allow a single int for only specifying the step and default to run first on step zero (5 -> [0, 5, ...]), but again that is a surprising default, so better to make it explicit?
- The primary mode could be
I think those configuration options are easier to document and explain and give a simpler API without surprising behaviour.
|
I agree. It would be best to enforce the user to provide the timing explicitly. That would be enforced when creating the input layer (see #1369). About the input arguments, I agree with your plan. The first option ( run_every = (`start`) # Runs to the end, with step 1
run_every = (`start`, `step`) # Runs to the end with step `step`
run_every = (`start`, `step`, `stop`) # Runs to `stop` with step `step` |
|
@dalonsoa Your suggested |
Description
First step towards the disturbance framework: the disturbance timing. Based on some inputs, a list of time indices when the disturbance model will run is created. This is then used at runtime to decide if the disturbance should run, given the current time index.
Fixes #1366
Type of change
Key checklist
pre-commitchecks:$ pre-commit run -a$ poetry run pytestFurther checks