diff --git a/Notes_Upgrades/Communications/SeminaireStras20/2019_LM_SeminaireStras.tex b/Notes_Upgrades/Communications/SeminaireStras20/2019_LM_SeminaireStras.tex index f667c03f5..0471be66e 100644 --- a/Notes_Upgrades/Communications/SeminaireStras20/2019_LM_SeminaireStras.tex +++ b/Notes_Upgrades/Communications/SeminaireStras20/2019_LM_SeminaireStras.tex @@ -987,7 +987,7 @@ \section{What's next} \textbf{Meshing and Inversions}: \begin{itemize} \item Meshing and Basis functions (local and global) with visualization - + \item Geometry matrix (fast) computation \end{itemize} @@ -1070,7 +1070,7 @@ \section{What's next} \textbf{Meshing and Inversions}: \begin{itemize} \item Meshing and Basis functions (local and global) with visualization - + \item Geometry matrix (fast) computation and introspection plots \item \textcolor{myblue}{Multiple Inversion-Regularization (linear and non-linear) and visualization \item pre- and post-inversion tools} @@ -1111,7 +1111,7 @@ \section{What's next} \textbf{Meshing and Inversions}: \begin{itemize} \item Meshing and Basis functions (local and global) with visualization - + \item Geometry matrix (fast) computation and introspection plots \item Multiple Inversion-Regularization (linear and non-linear) and visualization \item post-inversion analysis tools diff --git a/doc/source/index.rst b/doc/source/index.rst index bbcc751dc..6c3086703 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -65,6 +65,7 @@ Contents A guide to contributing to tofu A list of all different device configurations available (ITER, WEST, JET, ...) Tutorials and examples + Using tofu from a bash terminal * How to create / handle a diagnostic geometry - Visit the basic_ tutorial for getting started: create, plot and save diff --git a/doc/source/tofu.data.rst b/doc/source/tofu.data.rst index 952cfb5df..1aeeec85e 100644 --- a/doc/source/tofu.data.rst +++ b/doc/source/tofu.data.rst @@ -41,14 +41,6 @@ tofu.data.\_def module :undoc-members: :show-inheritance: -tofu.data.\_physics module --------------------------- - -.. automodule:: tofu.data._physics - :members: - :undoc-members: - :show-inheritance: - tofu.data.\_plot module ----------------------- diff --git a/doc/source/tofu.geom.rst b/doc/source/tofu.geom.rst index 713d9d717..8a72dec6f 100644 --- a/doc/source/tofu.geom.rst +++ b/doc/source/tofu.geom.rst @@ -9,6 +9,14 @@ tofu.geom package Submodules ---------- +tofu.geom.\_GG.cpython\-36m\-darwin module +------------------------------------------ + +.. automodule:: tofu.geom._GG.cpython-36m-darwin + :members: + :undoc-members: + :show-inheritance: + tofu.geom.\_GG module --------------------- @@ -17,6 +25,14 @@ tofu.geom.\_GG module :undoc-members: :show-inheritance: +tofu.geom.\_basic\_geom\_tools.cpython\-36m\-darwin module +---------------------------------------------------------- + +.. automodule:: tofu.geom._basic_geom_tools.cpython-36m-darwin + :members: + :undoc-members: + :show-inheritance: + tofu.geom.\_basic\_geom\_tools module ------------------------------------- @@ -65,6 +81,14 @@ tofu.geom.\_def module :undoc-members: :show-inheritance: +tofu.geom.\_distance\_tools.cpython\-36m\-darwin module +------------------------------------------------------- + +.. automodule:: tofu.geom._distance_tools.cpython-36m-darwin + :members: + :undoc-members: + :show-inheritance: + tofu.geom.\_distance\_tools module ---------------------------------- @@ -89,6 +113,14 @@ tofu.geom.\_plot\_optics module :undoc-members: :show-inheritance: +tofu.geom.\_raytracing\_tools.cpython\-36m\-darwin module +--------------------------------------------------------- + +.. automodule:: tofu.geom._raytracing_tools.cpython-36m-darwin + :members: + :undoc-members: + :show-inheritance: + tofu.geom.\_raytracing\_tools module ------------------------------------ @@ -97,6 +129,14 @@ tofu.geom.\_raytracing\_tools module :undoc-members: :show-inheritance: +tofu.geom.\_sampling\_tools.cpython\-36m\-darwin module +------------------------------------------------------- + +.. automodule:: tofu.geom._sampling_tools.cpython-36m-darwin + :members: + :undoc-members: + :show-inheritance: + tofu.geom.\_sampling\_tools module ---------------------------------- @@ -105,6 +145,14 @@ tofu.geom.\_sampling\_tools module :undoc-members: :show-inheritance: +tofu.geom.\_vignetting\_tools.cpython\-36m\-darwin module +--------------------------------------------------------- + +.. automodule:: tofu.geom._vignetting_tools.cpython-36m-darwin + :members: + :undoc-members: + :show-inheritance: + tofu.geom.\_vignetting\_tools module ------------------------------------ diff --git a/doc/source/tofu.rst b/doc/source/tofu.rst index cf238008d..40e4fdbe0 100644 --- a/doc/source/tofu.rst +++ b/doc/source/tofu.rst @@ -15,10 +15,20 @@ Subpackages tofu.dumpro tofu.dust tofu.geom + tofu.scripts + tofu.tests Submodules ---------- +tofu.\_physics module +--------------------- + +.. automodule:: tofu._physics + :members: + :undoc-members: + :show-inheritance: + tofu.\_plot module ------------------ diff --git a/doc/source/tofu.scripts.rst b/doc/source/tofu.scripts.rst new file mode 100644 index 000000000..ce5c6da07 --- /dev/null +++ b/doc/source/tofu.scripts.rst @@ -0,0 +1,35 @@ +tofu.scripts package +==================== + +.. automodule:: tofu.scripts + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +tofu.scripts.tofucalc module +---------------------------- + +.. automodule:: tofu.scripts.tofucalc + :members: + :undoc-members: + :show-inheritance: + +tofu.scripts.tofucustom module +------------------------------ + +.. automodule:: tofu.scripts.tofucustom + :members: + :undoc-members: + :show-inheritance: + +tofu.scripts.tofuplot module +---------------------------- + +.. automodule:: tofu.scripts.tofuplot + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/tofu.tests.rst b/doc/source/tofu.tests.rst new file mode 100644 index 000000000..07f57ad83 --- /dev/null +++ b/doc/source/tofu.tests.rst @@ -0,0 +1,17 @@ +tofu.tests package +================== + +.. automodule:: tofu.tests + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + + tofu.tests.tests00_root + tofu.tests.tests01_geom + tofu.tests.tests02_data + tofu.tests.tests09_tutorials diff --git a/doc/source/tofu.tests.tests00_root.rst b/doc/source/tofu.tests.tests00_root.rst new file mode 100644 index 000000000..92f06c1f1 --- /dev/null +++ b/doc/source/tofu.tests.tests00_root.rst @@ -0,0 +1,19 @@ +tofu.tests.tests00\_root package +================================ + +.. automodule:: tofu.tests.tests00_root + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +tofu.tests.tests00\_root.tests03\_plot module +--------------------------------------------- + +.. automodule:: tofu.tests.tests00_root.tests03_plot + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/tofu.tests.tests01_geom.rst b/doc/source/tofu.tests.tests01_geom.rst new file mode 100644 index 000000000..348a2d23e --- /dev/null +++ b/doc/source/tofu.tests.tests01_geom.rst @@ -0,0 +1,50 @@ +tofu.tests.tests01\_geom package +================================ + +.. automodule:: tofu.tests.tests01_geom + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + + tofu.tests.tests01_geom.tests03_core_data + +Submodules +---------- + +tofu.tests.tests01\_geom.test\_get\_sample module +------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.test_get_sample + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests01\_GG module +------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests01_GG + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests02\_compute module +------------------------------------------------ + +.. automodule:: tofu.tests.tests01_geom.tests02_compute + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core module +--------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/tofu.tests.tests01_geom.tests03_core_data.rst b/doc/source/tofu.tests.tests01_geom.tests03_core_data.rst new file mode 100644 index 000000000..d233b3786 --- /dev/null +++ b/doc/source/tofu.tests.tests01_geom.tests03_core_data.rst @@ -0,0 +1,139 @@ +tofu.tests.tests01\_geom.tests03\_core\_data package +==================================================== + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_CoilPF\_Notes module +----------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_CoilPF_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_Baffle\_Notes module +---------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_Baffle_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_BumperInner\_Notes module +--------------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_BumperInner_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_BumperOuter\_Notes module +--------------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_BumperOuter_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_DivLowGC\_Notes module +------------------------------------------------------------------------------ + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_DivLowGC_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_DivLowITER\_Notes module +-------------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_DivLowITER_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_DivUp\_Notes module +--------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_DivUp_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_IC1\_Notes module +------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_IC1_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_IC2\_Notes module +------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_IC2_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_IC3\_Notes module +------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_IC3_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_LH1\_Notes module +------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_LH1_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_LH2\_Notes module +------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_LH2_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PFC\_Ripple\_Notes module +---------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PFC_Ripple_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_PlasmaDomain\_Standard\_Notes module +--------------------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_PlasmaDomain_Standard_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_Ves\_VesIn\_Notes module +--------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_Ves_VesIn_Notes + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests01\_geom.tests03\_core\_data.WEST\_Ves\_VesOut\_Notes module +---------------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests01_geom.tests03_core_data.WEST_Ves_VesOut_Notes + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/tofu.tests.tests02_data.rst b/doc/source/tofu.tests.tests02_data.rst new file mode 100644 index 000000000..3d0617c9d --- /dev/null +++ b/doc/source/tofu.tests.tests02_data.rst @@ -0,0 +1,19 @@ +tofu.tests.tests02\_data package +================================ + +.. automodule:: tofu.tests.tests02_data + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +tofu.tests.tests02\_data.tests03\_core module +--------------------------------------------- + +.. automodule:: tofu.tests.tests02_data.tests03_core + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/tofu.tests.tests09_tutorials.rst b/doc/source/tofu.tests.tests09_tutorials.rst new file mode 100644 index 000000000..ec8d47a07 --- /dev/null +++ b/doc/source/tofu.tests.tests09_tutorials.rst @@ -0,0 +1,43 @@ +tofu.tests.tests09\_tutorials package +===================================== + +.. automodule:: tofu.tests.tests09_tutorials + :members: + :undoc-members: + :show-inheritance: + +Submodules +---------- + +tofu.tests.tests09\_tutorials.tests01\_runall module +---------------------------------------------------- + +.. automodule:: tofu.tests.tests09_tutorials.tests01_runall + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests09\_tutorials.tuto\_plot\_basic module +------------------------------------------------------ + +.. automodule:: tofu.tests.tests09_tutorials.tuto_plot_basic + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests09\_tutorials.tuto\_plot\_create\_geometry module +----------------------------------------------------------------- + +.. automodule:: tofu.tests.tests09_tutorials.tuto_plot_create_geometry + :members: + :undoc-members: + :show-inheritance: + +tofu.tests.tests09\_tutorials.tuto\_plot\_custom\_emissivity module +------------------------------------------------------------------- + +.. automodule:: tofu.tests.tests09_tutorials.tuto_plot_custom_emissivity + :members: + :undoc-members: + :show-inheritance: + diff --git a/doc/source/tofu_from_bash.rst b/doc/source/tofu_from_bash.rst new file mode 100644 index 000000000..6e620455e --- /dev/null +++ b/doc/source/tofu_from_bash.rst @@ -0,0 +1,181 @@ +.. _command_line: + +Bash access to tofu +=================== + +tofu is a python library, and it through a python console that you'll get the most of it. +However, it also provides a few bash commands to be used straight form the terminal. +These commands provide a quick and simple access to a few very common features of tofu. +So far they include: + +- :ref:`tofuplot`: for interactive plotting of data from IMAS +- :ref:`tofucalc`: for computing and interactive plotting of synthetic data from IMAS +- :ref:`tofu-custom`: for setting-up your own tofu preferences + + +.. _tofuplot: + +tofuplot +-------- + +tofuplot is available only if IMAS is also installed on your environment. +In that case, the sub-package imas2tofu will be operational. +This sub-package provides an interface between tofu and IMAS, and allows, +among other things, to use tofu to plot experimental data stored in IMAS in +interactive figures. + +This feature is typically used as follows: + +:: + + $ tofuplot -s 54178 -i ece + +The line above calls tofuplot with the following arguments: + +- -s / --shot : the shot number of the imas data entry (here 54178) +- -i / --ids : the name of the ids we want to get data from (here ece) + +The ids names that can be used are diagnostic ids, they include: + +- soft_x_rays +- bolometer +- interferometer +- polarimeter +- reflectometer_profile +- barometry +- spectrometer_visible +- bremsstrahlung_visible + +Note that you can combine the plots from several ids in the same figure by +simply adding more ids (they will have common time axis): + +:: + + $ tofuplot -s 54178 -i ece soft_x_rays interferometer + + +In all cases, what tofuplot does is simply: + +- read the tokamak geometry from ids wall +- read the diagnostic geometry from the provided ids +- compute the Lines of Sight (LOS) +- read the diagnostic experimental data from the provided ids +- display the data (time traces per LOS) and the geometry (tokamak + LOS) in +an interactive figure + +There are many other parameters that can be specified, like in particular: + +- -tok / --tokamak: the name of the tokamak of the imas data entry +- -u / --user : the user of the imas data entry +- -t0 / --t0 : the name of the time event used as origin (can be a float) + +When a parameter is not specified, a default value is used. + +For help on the other parameters, type: + +:: + + $ tofuplot --help + +Here is an example of the interactive figure + + + +.. _tofucalc: + +tofucalc +-------- + +tofuplot simply reads and plot data. + +By comparison, tofucalc also reads the diagnostics geometry, +but more importantly, it reads plasma profiles (1d radial profiles or 2d maps) +of the quantity of interest for the chosen diagnostic +(i.e.: electron density for interferometer, total radiated power for +bolometer...) and calculates the synthetic data of the +diagnostic (it performs the Line Of Sight integrationi of the quantity). +Finally, it displays the result in the same interactive figure as tofuplot. + +Once you have understood the parameters of tofuplot, tofucalc is intuitive +as it requires the same input: + +:: + + $ tofucalc -s 54178 -i interferometer + +Note however, that tofucalc is available for a limited number of diagnostics. +Indeed, it requires pre-tabulating the quantity of interest for each ids and +implementing proper 2D interpolation methods for each type of profile. +So far, it is available for: + +- interefreometer +- polarimeter +- bolometer +- bremsstrhalung_visible + +Other diagnostics / ids will be added to this list as tofu is developped and +tested on WEST. + +Also note that there is a default profile tabulated for each diagostics. +For example interferometer used the 1d electron density profile stored in ids +core_profiles. +But one could of course object that electron density can be stored as a 2D map +in another ids, produced, for example by a plasma edge code. +Computing synthetic data from an alternative source than the tabulated default +o ne is possible, but through the python console only as it requires a more +advanced use of the features offered by tofu. + +For some specific users, an alternative way of providing the profiles has been +implemented: it is possible to pass the ids not by its identification +parameters (shot, user, tokamak, ids name...), but via an input file saved with +matlab (.mat). +The input file shall contain an exact representation of the ids. +Likewise, the result can be saved into a .mat output file. +This feature is only available for ids bremsstrahlung_visible so far and it +only the 1d radiation profile that is passed throught the input file. +The equilibrium (for interpolation) and diagnostic geometry are still read from +regular IMAS ids. + +:: + + $ tofucalc -s 54178 -i interferometer + + + + +.. _tofu-custom: + +tofu-custom +----------- + +tofu used a lot of default parameters, such that providing no parameter at all +is ok when using most method / functions. +However, you may want to customize some of these default parameters to better +suit your usage or liking. + +If tofu is installed on a shared cluster, you can't access tofu's default +parametersas modifying them would also affect everybody else's usage. + +In order to allow for user-specific customization, run: + +:: + + $ tofu-custom + + +This will create a .tofu/ directory in your home (~/), in which tofu will copy +default parameters and data that you are free to edit. +This local copy is thus user-specific and will always have precedence when +importing tofu. + +Not all parameters can be customized, and this effort is on-going, but to, +as of tofu 1.4.3, you can edit: + +- the imas shortcuts in _imas2tofu-def.py +- the default parameters of tofuplot and tofcalc in _scripts_def.py + +Other parameters will be available for customization in future versions. + +This hidden directory also holds a openadas2tofu/ sub-directory where all data +downloaded by tofu from `openadas `__ +(a free online atomic database) is stored.