Skip to content

Commit b3632f3

Browse files
authored
Merge pull request #135 from iterorganization/bugfix/mireille-feedback
Implement feedback Mireille
2 parents f5d02e2 + 8c9aaaf commit b3632f3

File tree

10 files changed

+40
-15
lines changed

10 files changed

+40
-15
lines changed

docs/source/cli.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ This command reads the waveform definitions from the specified `YAML` file, eval
7777
**Arguments:**
7878

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

8282
**Options:**
8383

docs/source/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
# List of patterns, relative to source directory, that match files and
106106
# directories to ignore when looking for source files.
107107
# This pattern also affects html_static_path and html_extra_path .
108-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
108+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store","generated/waveform_editor.cli._excepthook.rst"]
109109

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

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

301306
def setup(app):
302307
DEFAULT_FILTERS["escape_underscores"] = escape_underscores
303308
app.add_css_file("waveform_editor.css")
309+
app.connect("autodoc-process-docstring", patch_param_docstring)
95.5 KB
Loading
1.14 MB
Loading

docs/source/training/training.rst

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ if you want to do the exercises in the section :ref:`shape_editor_training`.
1818
.. important::
1919
For this training you will need access to a graphical environment to visualize
2020
the simulation results. If you are on SDCC, it is recommended to follow this training
21-
through the NoMachine client, and to use **chrome** as your default browser (there have been
22-
issues when using firefox through NoMachine).
21+
through the NoMachine client, and to use **chrome** as your default browser. If you use
22+
Firefox, ensure you disable hardware acceleration in the browser settings.
2323

2424
Creating your first waveforms
2525
-----------------------------
@@ -119,15 +119,15 @@ Exercise 1c: Creating a sine wave - part 2
119119

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

124124
.. md-tab-item:: Solution
125125

126126
The resulting waveform should be:
127127

128128
.. code-block:: yaml
129129
130-
- {type: sine, start: 10, duration: 5, period: 2, min: 0, max: 6}
130+
- {type: sine, duration: 5, period: 2, min: 0, max: 6}
131131
132132
133133
Exercise 1d: Creating a sine wave - part 3
@@ -591,6 +591,12 @@ Exercise 5c: Exporting from the CLI
591591
592592
This exports the same IDS as in previous exercise.
593593

594+
.. 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:
595+
596+
.. code-block:: text
597+
598+
waveform-editor export-ids example.yaml output.nc --linspace 0,800,20
599+
594600
.. _shape_editor_training:
595601

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

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

728736
.. code-block:: bash
729737
@@ -739,13 +747,21 @@ Exercise 6c: Configurating the Plasma Shape
739747
.. image:: ../images/training/shape_valid.png
740748
:align: center
741749

742-
Running it with the time slice at 251s, NICE doesn't converge and it will throw
743-
an error:
750+
Running it with the time slice at 251s with the default parameterised P' and FF' profiles,
751+
NICE doesn't converge and it will throw an error:
744752

745753
.. image:: ../images/training/shape_invalid.png
746754
:align: center
755+
756+
However, if you use the P' and FF' profiles from the equilibrium IDS at 251s instead,
757+
NICE will converge:
758+
759+
.. image:: ../images/training/shape_valid_251s.png
760+
:align: center
761+
747762
2. If you provided a valid plasma shape NICE will converge and you will see the
748-
resulting equilibrium, otherwise you will receive an error.
763+
resulting equilibrium, otherwise you will receive an error. For example if the
764+
given shape cannot be achieved with the given input.
749765

750766
Exercise 6d: Fixing Coil Currents
751767
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/test_configuration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from waveform_editor.tendencies.linear import LinearTendency
88
from waveform_editor.tendencies.periodic.sine_wave import SineWaveTendency
99
from waveform_editor.tendencies.smooth import SmoothTendency
10+
from waveform_editor.util import LATEST_DD_VERSION
1011
from waveform_editor.waveform import Waveform
1112
from waveform_editor.yaml_parser import YamlParser
1213

@@ -340,7 +341,7 @@ def test_load_yaml_globals():
340341
ec_launchers/beam(1)/phase/angle: 1e-3
341342
"""
342343
config.load_yaml(yaml_str)
343-
assert config.globals.dd_version == "4.0.0"
344+
assert config.globals.dd_version == LATEST_DD_VERSION
344345
assert not config.globals.machine_description
345346

346347

tests/test_yaml_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from waveform_editor.tendencies.periodic.square_wave import SquareWaveTendency
1111
from waveform_editor.tendencies.periodic.triangle_wave import TriangleWaveTendency
1212
from waveform_editor.tendencies.smooth import SmoothTendency
13+
from waveform_editor.util import LATEST_DD_VERSION
1314
from waveform_editor.waveform import Waveform
1415
from waveform_editor.yaml_parser import YamlParser
1516

@@ -216,7 +217,7 @@ def test_load_yaml_globals_missing_dd_version(yaml_parser, config):
216217
yaml_parser.load_yaml(yaml_str)
217218
assert not config.groups
218219
assert not config.waveform_map
219-
assert config.globals.dd_version == "4.0.0"
220+
assert config.globals.dd_version == LATEST_DD_VERSION
220221
assert (
221222
config.globals.machine_description["ec_launchers"] == "imas:hdf5?path=test_md"
222223
)

waveform_editor/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def export_ids(yaml, uri, csv, linspace):
107107
\b
108108
Arguments:
109109
yaml: Path to the waveform YAML file.
110-
uri: URI of the output Data Entry.
110+
uri: URI of the output Data Entry or file path of output NetCDF file.
111111
\b
112112
Options:
113113
csv: CSV file containing a custom time array.

waveform_editor/gui/io/file_exporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def __init__(self, manager):
121121
def _export_type_placeholder(self):
122122
"""Output path placeholder, based on the selected export type."""
123123
return {
124-
IDS_EXPORT: "e.g. imas:hdf5?path=testdb",
124+
IDS_EXPORT: "e.g. imas:hdf5?path=testdb or test.nc",
125125
PNG_EXPORT: "e.g. /path/to/export/pngs",
126126
CSV_EXPORT: "e.g. /path/to/export/output.csv",
127127
PCSSP_EXPORT: "e.g. /path/to/export/output.xml",
@@ -131,7 +131,7 @@ def _export_type_placeholder(self):
131131
def _export_type_description(self):
132132
"""Help description for the selected export type."""
133133
return {
134-
IDS_EXPORT: "Please enter the output IMAS URI below:",
134+
IDS_EXPORT: "Please enter the output IMAS URI or NetCDF file name below:",
135135
PNG_EXPORT: "Please enter an output folder below:",
136136
CSV_EXPORT: "Please enter an output file below:",
137137
PCSSP_EXPORT: "Please enter an output file below:",

waveform_editor/gui/selector/rename_modal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def __init__(self):
1111

1212
self.label = pn.pane.Markdown("**Enter a new name for the waveform:**")
1313
self.input = pn.widgets.TextInput(placeholder="Enter new name")
14+
self.input.param.watch(self._handle_accept, "enter_pressed")
1415
self.accept_button = pn.widgets.Button(
1516
name="Accept", button_type="primary", on_click=self._handle_accept
1617
)

0 commit comments

Comments
 (0)