diff --git a/docs/source/cli.rst b/docs/source/cli.rst index 6890d0c2..a7cb60ad 100644 --- a/docs/source/cli.rst +++ b/docs/source/cli.rst @@ -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 `_ filename to write to. **Options:** diff --git a/docs/source/conf.py b/docs/source/conf.py index 3808ad52..acef6729 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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" @@ -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) diff --git a/docs/source/images/training/shape_editor_setup.png b/docs/source/images/training/shape_editor_setup.png index 9f28a6c2..59dff187 100644 Binary files a/docs/source/images/training/shape_editor_setup.png and b/docs/source/images/training/shape_editor_setup.png differ diff --git a/docs/source/images/training/shape_valid_251s.png b/docs/source/images/training/shape_valid_251s.png new file mode 100644 index 00000000..559dc3eb Binary files /dev/null and b/docs/source/images/training/shape_valid_251s.png differ diff --git a/docs/source/training/training.rst b/docs/source/training/training.rst index b7df855a..fea3d394 100644 --- a/docs/source/training/training.rst +++ b/docs/source/training/training.rst @@ -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 ----------------------------- @@ -119,7 +119,7 @@ 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 @@ -127,7 +127,7 @@ Exercise 1c: Creating a sine wave - part 2 .. 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 @@ -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 `_ file. For example: + + .. code-block:: text + + waveform-editor export-ids example.yaml output.nc --linspace 0,800,20 + .. _shape_editor_training: Plasma Shape Editor @@ -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': ''}``, replacing the ```` (including angle brackets). @@ -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 @@ -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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/test_configuration.py b/tests/test_configuration.py index e505475b..8f691f8e 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -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 @@ -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 diff --git a/tests/test_yaml_parser.py b/tests/test_yaml_parser.py index 8d40b66e..e28940f6 100644 --- a/tests/test_yaml_parser.py +++ b/tests/test_yaml_parser.py @@ -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 @@ -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" ) diff --git a/waveform_editor/cli.py b/waveform_editor/cli.py index 7cd186f8..bba2c02a 100644 --- a/waveform_editor/cli.py +++ b/waveform_editor/cli.py @@ -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. diff --git a/waveform_editor/gui/io/file_exporter.py b/waveform_editor/gui/io/file_exporter.py index 3f03a400..3676524f 100644 --- a/waveform_editor/gui/io/file_exporter.py +++ b/waveform_editor/gui/io/file_exporter.py @@ -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", @@ -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:", diff --git a/waveform_editor/gui/selector/rename_modal.py b/waveform_editor/gui/selector/rename_modal.py index b17137b7..79ad6cbf 100644 --- a/waveform_editor/gui/selector/rename_modal.py +++ b/waveform_editor/gui/selector/rename_modal.py @@ -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 )