Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions docs/source/examples/imports.yaml

This file was deleted.

44 changes: 0 additions & 44 deletions docs/source/tendencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ This document describes the different types of tendencies available in the Wavef

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

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.

Common Time Parameters
======================

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

.. _import-tendency:

Import
======

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.

*Type:* ``import`` (inferred when ``ref`` is present)

Parameters
----------
* ``ref``: Entry in ``globals.imports`` to read from.
* ``path``: DD path to read. Defaults to the waveform's own path.
* ``time_offset``: Offset added to the export time when sampling. Defaults to ``0``.
* ``interp``: Resampling mode: ``closest`` (default), ``linear`` or ``previous``.

.. code-block:: yaml

core_sources/source(1)/profiles_1d/electrons/energy:
- {ref: scenario, interp: linear}

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:

.. code-block:: yaml

core_sources/source(*)/profiles_1d/ion(*)/z_ion:
- {ref: scenario}

ec_launchers/*: # whole-IDS overlay; sources stack
- {ref: machine}
- {ref: scenario}

**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).

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:

.. code-block:: yaml

equilibrium/time_slice/global_quantities/ip:
- {type: constant, value: -1.0, duration: 1} # analytic on [0, 1] s
- {ref: scenario, duration: 1} # imported on [1, 2] s

Periodic Tendencies
===================

Expand Down
38 changes: 10 additions & 28 deletions docs/source/yaml_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,21 @@ These parameters can be changed under the "Edit Global Properties" tab in the GU
globals:
dd_version: 3.42.0

* **imports:** Named external data entries that waveforms read from (see
:ref:`Import <import-tendency>`), keyed by names you choose and refer to with
``{ref: <name>}``. Each value is an IMAS URI, or ``{port: <name>}`` for an IDS
received on a MUSCLE3 port at run time (used by the actor).
* **machine_description:** Provides URIs for IMAS machine description entries.
The machine descriptions are relevant when you :ref:`export a waveform configuration to an IDS<export-ids>`.
When exporting, any existing data from the given machine description will be copied
to the new IDS, before the waveforms from the configuration are added.
To specify machine descriptions for a target IDS, use a dictionary where keys are
the IDS names and values are their corresponding machine description URIs.

.. code-block:: yaml

globals:
dd_version: 3.42.0
imports:
machine: imas:hdf5?path=machine_description1
scenario: imas:hdf5?path=scenario_run
live_eq: {port: equilibrium_in}

Overlay a machine-description IDS with an ``<ids>/*`` wildcard import, then override
individual nodes.

.. code-block:: yaml

ec_launchers:
ec_launchers/*:
- {ref: machine} # overlay base
ec_launchers/beam(1)/phase/angle: -1.65898 # then override leaves
machine_description:
ec_launchers: imas:hdf5?path=machine_description1
nbi: imas:hdf5?path=machine_description2
# Add other IDSs as needed

Grouping Waveforms
------------------
Expand Down Expand Up @@ -114,8 +106,6 @@ a list of waveforms, or a single number (float or integer).
# Implicit linear ramp back to 0 over 25 seconds
- { duration: 25, to: 0 }

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

Refer to the :ref:`Available Tendencies <available-tendencies>` documentation for details on the different tendency types and their parameters.

2. **Constant Value:** A simple number (integer or float) defines a constant waveform over time.
Expand Down Expand Up @@ -164,12 +154,4 @@ Slicing can be applied at multiple nested levels. For example, the following fil

interferometer/channel(2:3)/wavelength(1:4)/phase_corrected/data: 15.0

Complete Example
----------------

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.

.. literalinclude:: examples/imports.yaml
:language: yaml


2 changes: 1 addition & 1 deletion tests/muscle3_integration/overlay.ymmsl.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ model:
waveform_actor:
implementation: waveform_actor
ports:
# An IDS-named input port exposes the received IDS as a port-import:
# An IDS-named input port selects overlay mode:
f_init: equilibrium_in
# Name of the output port is "<ids_name>_out":
o_f:
Expand Down
9 changes: 2 additions & 7 deletions tests/muscle3_integration/overlay_waveforms.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# Waveform configuration for the overlay example: the equilibrium received on the
# 'equilibrium_in' port is imported whole (overlay base), then a single plasma-current
# ramp is written onto every time slice while its other data (the boundary) is kept.
# Waveform configuration for the overlay example: a single plasma-current ramp that the
# actor writes onto every time slice of the equilibrium it receives.
globals:
dd_version: 4.0.0
imports:
eq_in: {port: equilibrium_in}

Plasma current:
equilibrium/*:
- {ref: eq_in}
equilibrium/time_slice/global_quantities/ip:
- {type: linear, to: -15e6, duration: 100}
12 changes: 6 additions & 6 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def test_dump_comments():
yaml_str = dedent("""
globals:
dd_version: 3.42.0
imports:
machine_description:
ec_launchers: imas:hdf5?path=test_md
ec_launchers:
beams:
Expand All @@ -280,12 +280,12 @@ def test_dump_globals():
config = WaveformConfiguration()
config.load_yaml(yaml_str)
config.globals.dd_version = "3.41.0"
config.globals.imports = {"ec_launchers": "imas:mdsplus?path=test"}
config.globals.machine_description = {"ec_launchers": "imas:mdsplus?path=test"}
dumped_yaml = config.dump()
expected_dump = dedent("""
globals:
dd_version: 3.41.0
imports:
machine_description:
ec_launchers: imas:mdsplus?path=test
ec_launchers:
ec_launchers/beam(1)/phase/angle:
Expand Down Expand Up @@ -326,23 +326,23 @@ def test_load_yaml_globals():
yaml_str = """
globals:
dd_version: 3.42.0
imports:
machine_description:
ec_launchers: imas:hdf5?path=testdb
ec_launchers:
ec_launchers/beam(1)/phase/angle: 1e-3
"""
config = WaveformConfiguration()
config.load_yaml(yaml_str)
assert config.globals.dd_version == "3.42.0"
assert config.globals.imports["ec_launchers"] == "imas:hdf5?path=testdb"
assert config.globals.machine_description["ec_launchers"] == "imas:hdf5?path=testdb"

yaml_str = """
ec_launchers:
ec_launchers/beam(1)/phase/angle: 1e-3
"""
config.load_yaml(yaml_str)
assert config.globals.dd_version == LATEST_DD_VERSION
assert not config.globals.imports
assert not config.globals.machine_description


def test_bounds(config):
Expand Down
Loading
Loading