Skip to content

Commit ee3af48

Browse files
authored
Merge pull request #181 from iterorganization/revert-reference
Revert "Load values from external IDSes" PR#170
2 parents 13c13ef + 0cb665e commit ee3af48

26 files changed

Lines changed: 279 additions & 1787 deletions

docs/source/examples/imports.yaml

Lines changed: 0 additions & 49 deletions
This file was deleted.

docs/source/tendencies.rst

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ This document describes the different types of tendencies available in the Wavef
88

99
Each tendency defines the behavior of the signal over a specific time interval. You can chain multiple tendencies together to create complex waveforms.
1010

11-
If ``type`` is omitted it is inferred from the entry's keys: ``ref`` → :ref:`import <import-tendency>`, ``to`` → linear, ``time`` → :ref:`piecewise <piecewise-linear-tendency>`, ``value`` → constant; anything else defaults to ``linear`` (so a ``from``-only, ``rate``-only, or bare segment is still a linear ramp). Tendencies with no distinguishing key -- the periodic shapes, ``smooth``, and a value-less ``constant`` -- must name their ``type`` explicitly.
12-
1311
Common Time Parameters
1412
======================
1513

@@ -190,48 +188,6 @@ Parameters
190188
.. warning::
191189
This tendency does **not** accept the common ``start``, ``duration``, or ``end`` parameters. These are derived directly from the required ``time`` list.
192190

193-
.. _import-tendency:
194-
195-
Import
196-
======
197-
198-
Takes its values from an external entry in :ref:`globals.imports <global_properties>` instead of an analytic shape, resampled onto the export time base. By default it reads the waveform's own DD path.
199-
200-
*Type:* ``import`` (inferred when ``ref`` is present)
201-
202-
Parameters
203-
----------
204-
* ``ref``: Entry in ``globals.imports`` to read from.
205-
* ``path``: DD path to read. Defaults to the waveform's own path.
206-
* ``time_offset``: Offset added to the export time when sampling. Defaults to ``0``.
207-
* ``interp``: Resampling mode: ``closest`` (default), ``linear`` or ``previous``.
208-
209-
.. code-block:: yaml
210-
211-
core_sources/source(1)/profiles_1d/electrons/energy:
212-
- {ref: scenario, interp: linear}
213-
214-
Wildcards expand against the source: a trailing ``*`` imports a whole subtree (``<ids>/*`` copies a whole IDS), and a ``(*)`` index wildcard iterates every element of an array of structure -- several may be combined, e.g. every ion of every source. An overlay may list several sources, applied in order:
215-
216-
.. code-block:: yaml
217-
218-
core_sources/source(*)/profiles_1d/ion(*)/z_ion:
219-
- {ref: scenario}
220-
221-
ec_launchers/*: # whole-IDS overlay; sources stack
222-
- {ref: machine}
223-
- {ref: scenario}
224-
225-
**Precedence.** Where imports or explicit waveforms write the same node, the most specific wins regardless of order: ``<ids>/*`` < subtree ``.../*`` < explicit leaf. Equal specificity falls back to listing order (last wins).
226-
227-
Non-0D imports (a profile, a wildcard subtree) own the whole waveform. Only **0D (scalar)** imports combine with analytic segments, each filling its ``[start, end]`` window:
228-
229-
.. code-block:: yaml
230-
231-
equilibrium/time_slice/global_quantities/ip:
232-
- {type: constant, value: -1.0, duration: 1} # analytic on [0, 1] s
233-
- {ref: scenario, duration: 1} # imported on [1, 2] s
234-
235191
Periodic Tendencies
236192
===================
237193

docs/source/yaml_format.rst

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,21 @@ These parameters can be changed under the "Edit Global Properties" tab in the GU
5050
globals:
5151
dd_version: 3.42.0
5252
53-
* **imports:** Named external data entries that waveforms read from (see
54-
:ref:`Import <import-tendency>`), keyed by names you choose and refer to with
55-
``{ref: <name>}``. Each value is an IMAS URI, or ``{port: <name>}`` for an IDS
56-
received on a MUSCLE3 port at run time (used by the actor).
53+
* **machine_description:** Provides URIs for IMAS machine description entries.
54+
The machine descriptions are relevant when you :ref:`export a waveform configuration to an IDS<export-ids>`.
55+
When exporting, any existing data from the given machine description will be copied
56+
to the new IDS, before the waveforms from the configuration are added.
57+
To specify machine descriptions for a target IDS, use a dictionary where keys are
58+
the IDS names and values are their corresponding machine description URIs.
5759

5860
.. code-block:: yaml
5961
6062
globals:
6163
dd_version: 3.42.0
62-
imports:
63-
machine: imas:hdf5?path=machine_description1
64-
scenario: imas:hdf5?path=scenario_run
65-
live_eq: {port: equilibrium_in}
66-
67-
Overlay a machine-description IDS with an ``<ids>/*`` wildcard import, then override
68-
individual nodes.
69-
70-
.. code-block:: yaml
71-
72-
ec_launchers:
73-
ec_launchers/*:
74-
- {ref: machine} # overlay base
75-
ec_launchers/beam(1)/phase/angle: -1.65898 # then override leaves
64+
machine_description:
65+
ec_launchers: imas:hdf5?path=machine_description1
66+
nbi: imas:hdf5?path=machine_description2
67+
# Add other IDSs as needed
7668
7769
Grouping Waveforms
7870
------------------
@@ -114,8 +106,6 @@ a list of waveforms, or a single number (float or integer).
114106
# Implicit linear ramp back to 0 over 25 seconds
115107
- { duration: 25, to: 0 }
116108
117-
If ``type`` is omitted it is inferred from the entry's keys: ``ref`` → ``import``, ``to`` → ``linear``, ``time`` → ``piecewise``, ``value`` → ``constant``; anything else defaults to ``linear``. Tendencies with no distinguishing key (the periodic shapes, ``smooth``, a value-less ``constant``) must name their ``type``.
118-
119109
Refer to the :ref:`Available Tendencies <available-tendencies>` documentation for details on the different tendency types and their parameters.
120110

121111
2. **Constant Value:** A simple number (integer or float) defines a constant waveform over time.
@@ -164,12 +154,4 @@ Slicing can be applied at multiple nested levels. For example, the following fil
164154
165155
interferometer/channel(2:3)/wavelength(1:4)/phase_corrected/data: 15.0
166156
167-
Complete Example
168-
----------------
169-
170-
The following configuration exercises the full :ref:`imports <import-tendency>` mechanism: a machine-description overlay (``<ids>/*``), a scalar import with interpolation, a static value, trailing-subtree and index wildcards (``source(*)``, ``ion(*)``), a 0D composite, and a runtime port-import.
171-
172-
.. literalinclude:: examples/imports.yaml
173-
:language: yaml
174-
175157

tests/muscle3_integration/overlay.ymmsl.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ model:
1414
waveform_actor:
1515
implementation: waveform_actor
1616
ports:
17-
# An IDS-named input port exposes the received IDS as a port-import:
17+
# An IDS-named input port selects overlay mode:
1818
f_init: equilibrium_in
1919
# Name of the output port is "<ids_name>_out":
2020
o_f:
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
# Waveform configuration for the overlay example: the equilibrium received on the
2-
# 'equilibrium_in' port is imported whole (overlay base), then a single plasma-current
3-
# ramp is written onto every time slice while its other data (the boundary) is kept.
1+
# Waveform configuration for the overlay example: a single plasma-current ramp that the
2+
# actor writes onto every time slice of the equilibrium it receives.
43
globals:
54
dd_version: 4.0.0
6-
imports:
7-
eq_in: {port: equilibrium_in}
85

96
Plasma current:
10-
equilibrium/*:
11-
- {ref: eq_in}
127
equilibrium/time_slice/global_quantities/ip:
138
- {type: linear, to: -15e6, duration: 100}

tests/test_configuration.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def test_dump_comments():
256256
yaml_str = dedent("""
257257
globals:
258258
dd_version: 3.42.0
259-
imports:
259+
machine_description:
260260
ec_launchers: imas:hdf5?path=test_md
261261
ec_launchers:
262262
beams:
@@ -280,12 +280,12 @@ def test_dump_globals():
280280
config = WaveformConfiguration()
281281
config.load_yaml(yaml_str)
282282
config.globals.dd_version = "3.41.0"
283-
config.globals.imports = {"ec_launchers": "imas:mdsplus?path=test"}
283+
config.globals.machine_description = {"ec_launchers": "imas:mdsplus?path=test"}
284284
dumped_yaml = config.dump()
285285
expected_dump = dedent("""
286286
globals:
287287
dd_version: 3.41.0
288-
imports:
288+
machine_description:
289289
ec_launchers: imas:mdsplus?path=test
290290
ec_launchers:
291291
ec_launchers/beam(1)/phase/angle:
@@ -326,23 +326,23 @@ def test_load_yaml_globals():
326326
yaml_str = """
327327
globals:
328328
dd_version: 3.42.0
329-
imports:
329+
machine_description:
330330
ec_launchers: imas:hdf5?path=testdb
331331
ec_launchers:
332332
ec_launchers/beam(1)/phase/angle: 1e-3
333333
"""
334334
config = WaveformConfiguration()
335335
config.load_yaml(yaml_str)
336336
assert config.globals.dd_version == "3.42.0"
337-
assert config.globals.imports["ec_launchers"] == "imas:hdf5?path=testdb"
337+
assert config.globals.machine_description["ec_launchers"] == "imas:hdf5?path=testdb"
338338

339339
yaml_str = """
340340
ec_launchers:
341341
ec_launchers/beam(1)/phase/angle: 1e-3
342342
"""
343343
config.load_yaml(yaml_str)
344344
assert config.globals.dd_version == LATEST_DD_VERSION
345-
assert not config.globals.imports
345+
assert not config.globals.machine_description
346346

347347

348348
def test_bounds(config):

0 commit comments

Comments
 (0)