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
2 changes: 1 addition & 1 deletion docs/source/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ This command reads the waveform definitions from the specified `YAML` file, eval
**Arguments:**

* ``YAML``: Path to the input waveform YAML configuration file.
* ``URI``: The URI specifying the IMAS data entry to write to.
* ``URI``: The URI specifying the IMAS data entry or `IMAS NetCDF <https://imas-python.readthedocs.io/en/stable/netcdf.html>`_ filename to write to.

**Options:**

Expand Down
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store","generated/waveform_editor.cli._excepthook.rst"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
Expand Down Expand Up @@ -297,7 +297,13 @@
def escape_underscores(string):
return string.replace("_", r"\_")

# Get around issue where param contains an invalid docstring
def patch_param_docstring(app, what, name, obj, options, lines):
for i, line in enumerate(lines):
if "**params" in line:
lines[i] = line.replace("**params", "``**params``")

def setup(app):
DEFAULT_FILTERS["escape_underscores"] = escape_underscores
app.add_css_file("waveform_editor.css")
app.connect("autodoc-process-docstring", patch_param_docstring)
Binary file modified docs/source/images/training/shape_editor_setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 24 additions & 8 deletions docs/source/training/training.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ if you want to do the exercises in the section :ref:`shape_editor_training`.
.. important::
For this training you will need access to a graphical environment to visualize
the simulation results. If you are on SDCC, it is recommended to follow this training
through the NoMachine client, and to use **chrome** as your default browser (there have been
issues when using firefox through NoMachine).
through the NoMachine client, and to use **chrome** as your default browser. If you use
Firefox, ensure you disable hardware acceleration in the browser settings.

Creating your first waveforms
-----------------------------
Expand Down Expand Up @@ -119,15 +119,15 @@ Exercise 1c: Creating a sine wave - part 2

In the previous execise, you might have noticed that there a multiple ways in which you can define the same
waveform. Recreate the waveform of previous exercise using only the following tendency parameters:
``type``, ``start``, ``duration``, ``period``, ``min``, and ``max``.
``type``, ``duration``, ``period``, ``min``, and ``max``.

.. md-tab-item:: Solution

The resulting waveform should be:

.. code-block:: yaml

- {type: sine, start: 10, duration: 5, period: 2, min: 0, max: 6}
- {type: sine, duration: 5, period: 2, min: 0, max: 6}


Exercise 1d: Creating a sine wave - part 3
Expand Down Expand Up @@ -591,6 +591,12 @@ Exercise 5c: Exporting from the CLI

This exports the same IDS as in previous exercise.

.. note:: You can also supply the path of a NetCDF file to export to an `IMAS NetCDF <https://imas-python.readthedocs.io/en/stable/netcdf.html>`_ file. For example:

.. code-block:: text

waveform-editor export-ids example.yaml output.nc --linspace 0,800,20

.. _shape_editor_training:

Plasma Shape Editor
Expand Down Expand Up @@ -628,7 +634,7 @@ this plasma shape.
2. Set any NICE environment variables required to run NICE. This depends on your specific system.
If you are on SDCC, you can leave this as is.

If you get errors stating that there
If you are running waveform editor locally (not on SDCC), you may get errors stating that there
were issues when loading shared libraries, you might need to set the ``LD_LIBRARY_PATH``.
You can set them using the following dictionary style format: ``{'LD_LIBRARY_PATH': '<paths>'}``,
replacing the ``<paths>`` (including angle brackets).
Expand Down Expand Up @@ -724,6 +730,8 @@ Exercise 6c: Configurating the Plasma Shape
Provide an outline from an equilibrium IDS, for example by using the URI below
if you are on SDCC. Visualize the boundary outline of the time steps at 200s and 251s,
do you see a difference? Run NICE inverse for both time steps, what happens in each case?
What happens if you change the P' and FF' profiles from the manual parameterisation
to the profiles from the corresponding equilibrium IDS?

.. code-block:: bash

Expand All @@ -739,13 +747,21 @@ Exercise 6c: Configurating the Plasma Shape
.. image:: ../images/training/shape_valid.png
:align: center

Running it with the time slice at 251s, NICE doesn't converge and it will throw
an error:
Running it with the time slice at 251s with the default parameterised P' and FF' profiles,
NICE doesn't converge and it will throw an error:

.. image:: ../images/training/shape_invalid.png
:align: center

However, if you use the P' and FF' profiles from the equilibrium IDS at 251s instead,
NICE will converge:

.. image:: ../images/training/shape_valid_251s.png
:align: center

2. If you provided a valid plasma shape NICE will converge and you will see the
resulting equilibrium, otherwise you will receive an error.
resulting equilibrium, otherwise you will receive an error. For example if the
given shape cannot be achieved with the given input.

Exercise 6d: Fixing Coil Currents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from waveform_editor.tendencies.linear import LinearTendency
from waveform_editor.tendencies.periodic.sine_wave import SineWaveTendency
from waveform_editor.tendencies.smooth import SmoothTendency
from waveform_editor.util import LATEST_DD_VERSION
from waveform_editor.waveform import Waveform
from waveform_editor.yaml_parser import YamlParser

Expand Down Expand Up @@ -340,7 +341,7 @@ def test_load_yaml_globals():
ec_launchers/beam(1)/phase/angle: 1e-3
"""
config.load_yaml(yaml_str)
assert config.globals.dd_version == "4.0.0"
assert config.globals.dd_version == LATEST_DD_VERSION
assert not config.globals.machine_description


Expand Down
3 changes: 2 additions & 1 deletion tests/test_yaml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from waveform_editor.tendencies.periodic.square_wave import SquareWaveTendency
from waveform_editor.tendencies.periodic.triangle_wave import TriangleWaveTendency
from waveform_editor.tendencies.smooth import SmoothTendency
from waveform_editor.util import LATEST_DD_VERSION
from waveform_editor.waveform import Waveform
from waveform_editor.yaml_parser import YamlParser

Expand Down Expand Up @@ -216,7 +217,7 @@ def test_load_yaml_globals_missing_dd_version(yaml_parser, config):
yaml_parser.load_yaml(yaml_str)
assert not config.groups
assert not config.waveform_map
assert config.globals.dd_version == "4.0.0"
assert config.globals.dd_version == LATEST_DD_VERSION
assert (
config.globals.machine_description["ec_launchers"] == "imas:hdf5?path=test_md"
)
Expand Down
2 changes: 1 addition & 1 deletion waveform_editor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def export_ids(yaml, uri, csv, linspace):
\b
Arguments:
yaml: Path to the waveform YAML file.
uri: URI of the output Data Entry.
uri: URI of the output Data Entry or file path of output NetCDF file.
\b
Options:
csv: CSV file containing a custom time array.
Expand Down
4 changes: 2 additions & 2 deletions waveform_editor/gui/io/file_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(self, manager):
def _export_type_placeholder(self):
"""Output path placeholder, based on the selected export type."""
return {
IDS_EXPORT: "e.g. imas:hdf5?path=testdb",
IDS_EXPORT: "e.g. imas:hdf5?path=testdb or test.nc",
PNG_EXPORT: "e.g. /path/to/export/pngs",
CSV_EXPORT: "e.g. /path/to/export/output.csv",
PCSSP_EXPORT: "e.g. /path/to/export/output.xml",
Expand All @@ -131,7 +131,7 @@ def _export_type_placeholder(self):
def _export_type_description(self):
"""Help description for the selected export type."""
return {
IDS_EXPORT: "Please enter the output IMAS URI below:",
IDS_EXPORT: "Please enter the output IMAS URI or NetCDF file name below:",
PNG_EXPORT: "Please enter an output folder below:",
CSV_EXPORT: "Please enter an output file below:",
PCSSP_EXPORT: "Please enter an output file below:",
Expand Down
1 change: 1 addition & 0 deletions waveform_editor/gui/selector/rename_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def __init__(self):

self.label = pn.pane.Markdown("**Enter a new name for the waveform:**")
self.input = pn.widgets.TextInput(placeholder="Enter new name")
self.input.param.watch(self._handle_accept, "enter_pressed")
self.accept_button = pn.widgets.Button(
name="Accept", button_type="primary", on_click=self._handle_accept
)
Expand Down
Loading