Skip to content

Load values from external IDSes#170

Open
DaanVanVugt wants to merge 4 commits into
iterorganization:developfrom
DaanVanVugt:feature/reference-tendency
Open

Load values from external IDSes#170
DaanVanVugt wants to merge 4 commits into
iterorganization:developfrom
DaanVanVugt:feature/reference-tendency

Conversation

@DaanVanVugt

Copy link
Copy Markdown
Contributor

After #168
Also allows loading 2D values, but then cannot be combined with other tendencies in the same variable.
Also allows wildcards in the IDS path.

Comment thread waveform_editor/tendencies/reference.py Outdated
Comment thread waveform_editor/waveform.py Outdated
Comment thread waveform_editor/configuration.py Outdated
Comment thread tests/test_exporter.py Outdated
Comment thread tests/test_exporter.py
Comment thread tests/test_exporter.py
Comment thread tests/test_exporter.py
Comment thread waveform_editor/yaml/yaml_parser.py Outdated
Comment thread waveform_editor/tendencies/reference.py Outdated
Comment thread waveform_editor/tendencies/reference.py Outdated
Comment thread tests/test_exporter.py
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.
Adds a single `globals.imports` map (name -> IMAS URI, or {port: <name>}
for an IDS received on a MUSCLE3 port at run time) consumed by
`{ref: <name>}` import entries in waveforms. This replaces the
machine_description, top-level references, and base_idss overlay with one
mechanism.

- ImportTendency: a 0D import segment, combinable with analytic segments
  (each fills its [start, end] window); resolved by the exporter.
- ImportWaveform / StaticWaveform: a non-0D or wildcard import owns the
  whole waveform; StaticWaveform carries a single string constant.
- A whole-IDS import (<ids>/*) is overlaid first as a base, then leaf
  waveforms override it, reproducing the machine-description behaviour.
- Imports are resampled onto the export time base with a selectable
  interpolation mode (closest/linear/previous), via an in-memory entry so
  any backend can be sliced.
- Index wildcards (source(*), incl. multiple for higher dimensions) and
  trailing-subtree wildcards; a (*) over an array of structure whose size
  varies in time raises rather than silently mis-populating.
- The `ref` key infers the `import` tendency type (`reference` kept as an
  alias); imports editing UI (free-text-key DictEditor) in Edit Global
  Properties.
- Docs + a literalinclude reference example; tests migrated and extended.
@DaanVanVugt DaanVanVugt force-pushed the feature/reference-tendency branch from b3719a6 to e11680d Compare June 25, 2026 06:29
Move scalar import resolution out of the exporter into the waveform.
ImportTendency.get_value now produces values itself -- raw source
samples while editing/plotting, resampled onto the export time base at
export -- via a new ImportResolver that is the single owner of all IMAS
source reading (open, resample, extract, wildcard expansion). Composites
of analytic and import segments now work through the normal tendency
evaluator, and the editor plots real imported curves. The exporter is
reduced to orchestration, and the IDS node-filling shared by the
exporter and resolver is factored into ids_fill.

Generalise imports to overlay whole entries: a bare `*` overlays every
IDS a source provides, and any overlay key may list several sources.
Conflicts resolve by specificity (`*` < `<ids>/*` < subtree `.../*` <
explicit leaf), falling back to listing order for equal specificity, so
ordering no longer changes broad-vs-specific results.

Also adds the imports editing tooltip in the globals tab and shortens
the import documentation.
Remove the whole-entry (`*`) import. It existed only to save listing a
few `<ids>/*` overlays, but required runtime IDS discovery
(source_ids_names probing every DD IDS, with a broad except); the
well-tested `<ids>/*` whole-IDS overlay and multi-source overlays cover
the real need without it.

Replace the incidental, order-dependent array sizing with an explicit
sizing pass (size_arrays): walk all waveform paths together, compute
each array of structure's required size as the max over every path (an
explicit index + 1, a bounded slice's stop, or the time length for a
dynamic array), and resize each array once before any value is filled.
A `:` slice therefore expands against the final size regardless of
declaration order, replacing the previous two-pass-plus-reverse heuristic
that assumed waveforms were listed in increasing-index order.
@DaanVanVugt DaanVanVugt requested a review from mikesndrs June 29, 2026 07:19
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