Skip to content

Infer tendency type from keys when type is omitted#174

Open
DaanVanVugt wants to merge 2 commits into
iterorganization:developfrom
DaanVanVugt:feature/infer-tendency-type
Open

Infer tendency type from keys when type is omitted#174
DaanVanVugt wants to merge 2 commits into
iterorganization:developfrom
DaanVanVugt:feature/infer-tendency-type

Conversation

@DaanVanVugt

Copy link
Copy Markdown
Contributor

When a tendency entry has no explicit type, infer it from its keys
instead of always defaulting to linear: to -> linear, time ->
piecewise, value -> constant. Anything else falls back to linear, so a linear tendency does not require to (a from-only/rate-only/bare segment is still linear and takes its endpoints from its neighbours).

A segment whose distinguishing key is absent must name its type explicitly: the periodic shapes, smooth, and a value-less constant (a bare {duration} is read as a linear ramp).

Documents the behaviour (yaml_format + tendencies) and tests the inference, the linear-without-to forms, the value-less ambiguity, and that an explicit type takes precedence.

When a tendency entry has no explicit `type`, infer it from its keys
instead of always defaulting to linear: `to` -> linear, `time` ->
piecewise, `value` -> constant. Anything else falls back to linear, so
a linear tendency does not require `to` (a from-only/rate-only/bare
segment is still linear and takes its endpoints from its neighbours).

A segment whose distinguishing key is absent must name its type
explicitly: the periodic shapes, smooth, and a value-less constant (a
bare {duration} is read as a linear ramp).

Documents the behaviour (yaml_format + tendencies) and tests the
inference, the linear-without-`to` forms, the value-less ambiguity, and
that an explicit type takes precedence.

@SBlokhuizen SBlokhuizen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I just have 2 minor comments about the documentation.

Comment thread docs/source/tendencies.rst Outdated
Comment thread docs/source/yaml_format.rst Outdated
@DaanVanVugt

Copy link
Copy Markdown
Contributor Author

later prs introduce new tendencies, we should remember to include new auto-identification for these

Point the type-inference refs at the per-tendency sections (added
labels for constant/linear/smooth/periodic) instead of the page-top
anchor, and drop the duplicated inference description in yaml_format
in favour of the Available Tendencies page.
@DaanVanVugt DaanVanVugt requested a review from SBlokhuizen June 25, 2026 12:48
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.

2 participants