diff --git a/.gitignore b/.gitignore index 2667a32..c97c1e9 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ _version.py nuspacesim_run_*.fits nuspacesim_run_*.h5 nuspacesim_run_*.hdf5 +*.code-workspace diff --git a/README.md b/README.md index 895c510..65f4954 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,14 @@ Tau propagation is interpolated using included data tables from [nupyprop](https ![NuSpaceSim Usage](https://raw.githubusercontent.com/NuSpaceSim/nuSpaceSim/main/docs/_static/run.svg) +### *nuspacesim* TUI + +![NuSpaceSim tui](https://raw.githubusercontent.com/NuSpaceSim/nuSpaceSim/73-tui-option/docs/_static/nuSpaceSim_TUI_example.png) + +`nuspacesim tui` + +This opens a Text-based user interface (TUI) allowing to explore all CLI options available to *nuspacesim*. On the right hand side are the different *nuspacesim* commands while the left lets youchose and enter all configuration variables. After selecting all options (and leave othern as defaults) the resulting command is shown at the bottom. To execute *Crtl + r*. + ### Create an XML configuration script The command line simulator uses an XML file to store configuration parameters. To diff --git a/docs/_static/nuSpaceSim_TUI_example.png b/docs/_static/nuSpaceSim_TUI_example.png new file mode 100644 index 0000000..b68b067 Binary files /dev/null and b/docs/_static/nuSpaceSim_TUI_example.png differ diff --git a/docs/quickstart.rst b/docs/quickstart.rst index 20da08c..5ff0741 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -18,6 +18,13 @@ Alternatively install nuspacesim from our conda channel.:: conda create -n nuspacesim -c conda-forge -c nuspacesim nuspacesim conda activate nuspacesim +---------------------------------- +Open the nuspacesim TUI +---------------------------------- +:: + + python3 -m nuspacesim tui + ---------------------------------- Read the nuspacesim help docstring diff --git a/docs/tutorial/command_line.rst b/docs/tutorial/command_line.rst index 4a8c822..7b09bd4 100644 --- a/docs/tutorial/command_line.rst +++ b/docs/tutorial/command_line.rst @@ -7,6 +7,13 @@ Command Line Application nuspacesim is a command line client shipped with the nuspacesim package. It can be run in application or module mode. +:: + + nuspacesim tui + + +Opens a TUI to run nuspacesim + :: nuspacesim --help diff --git a/src/nuspacesim/apps/cli.py b/src/nuspacesim/apps/cli.py index 3c87076..f731830 100644 --- a/src/nuspacesim/apps/cli.py +++ b/src/nuspacesim/apps/cli.py @@ -51,10 +51,11 @@ import configparser import click +from trogon import tui from .. import NssConfig, SimulationParameters, simulation from ..compute import compute -from ..config import FileSpectrum, MonoSpectrum, PowerSpectrum +from ..config import MonoSpectrum, PowerSpectrum from ..results_table import ResultsTable from ..utils import plots from ..utils.plot_function_registry import registry @@ -63,6 +64,7 @@ __all__ = ["create_config", "run", "show_plot"] +@tui() @click.group() # @click.option("--debug/--no-debug", default=False) def cli(): @@ -248,7 +250,6 @@ def create_config(filename: str, numtrajs: float, monospectrum, powerspectrum) - spec = MonoSpectrum(monospectrum) if powerspectrum is not None: spec = PowerSpectrum(*powerspectrum) - # spec = FileSpectrum() simulation = SimulationParameters(N=int(numtrajs), spectrum=spec)