Skip to content

dtype-aware tendency values#175

Open
DaanVanVugt wants to merge 4 commits into
iterorganization:developfrom
DaanVanVugt:tendency-value-dtype
Open

dtype-aware tendency values#175
DaanVanVugt wants to merge 4 commits into
iterorganization:developfrom
DaanVanVugt:tendency-value-dtype

Conversation

@DaanVanVugt

Copy link
Copy Markdown
Contributor

No description provided.

@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.

Code looks good to me! Can you update the docs of the constant tendency?

Comment thread waveform_editor/tendencies/constant.py
@DaanVanVugt DaanVanVugt requested a review from SBlokhuizen June 25, 2026 17:01
- Rename is_string -> is_categorical so booleans are treated like strings
  (held as a zero-order-hold step rather than coerced to float and interpolated)
- Reject mixing categorical (string/boolean) and numeric values within a single
  waveform, since the gaps between them cannot be interpolated
- Document the constant tendency value types (float/int/categorical) in the docs
np.full preserved int dtype for integer constants, so get_value() (the
time=None path) returned an int64 array while the explicit-time path
upcast to float. Force float for numeric values; categorical values
(str/bool) keep their native dtype.
@DaanVanVugt DaanVanVugt force-pushed the tendency-value-dtype branch from 4ca49ac to fc48600 Compare July 10, 2026 10:23
tendency.resolver = resolver
tendency.default_path = self.name

@property

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.

Should we check whether the specific dtype is valid for the specific IDS node e.g. during exporting?

Comment on lines +22 to +28
@property
def is_categorical(self):
"""Whether this constant holds a non-numeric (categorical) value, e.g. a
string or boolean, that is held as a step rather than interpolated."""
value = self.value
return isinstance(value, bool) or not isinstance(value, (int, float))

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.

Screencast.From.2026-07-14.14-53-38.mp4

Reloading a string waveform YAML snippet does not work for the panel editor, could you have a look at that?

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.

3 participants