Skip to content
Anchal Gupta edited this page Jan 17, 2024 · 13 revisions

Synthetic Diagnostics from SOLPS data

News: Minimal working set released on all repositories

How to use:

Following assumes that you have installed Julia on your computer as recommended here. We have not registered our package with Julia registry yet, thus adding packages in the standard way of using Pkg; Pkg.add("SD4SOLPS" would not work yet. Here is how you can get started on using the repositories in this project right now:

Creating your test environment

You can create a test environment file on your local machine and move it around wherever you like or refer to them from where you are running scripts or jupyter notebook. But to get there, you will have to strictly follow the following steps:

Option 1: Maintaining easy access to source code as well

  1. Pull all the repositories from the latest master branches.
  • Some repositories have dev as the default branch, please checkout to master for stability.
  • You can pull the repositories anywhere on your computer, we will be using absolute path to these repositories in the next steps.
% git pull [email protected]:ProjectTorreyPines/SD4SOLPS.jl.git
% git checkout master
  1. Create a test environment directory
  • This is strictly not required but will keep it clean for you.
% mkdir SD4SOLPS_env
% cd SD4SOLPS_env
  1. Run Julia and do the following:
% julia --project=./
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.2 (2023-07-05)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ]
(SD4SOLPS_env) pkg> dev /local/path/to/ProjectTorreyPines/OMAS.jl
...
(SD4SOLPS_env) pkg> dev /local/path/to/ProjectTorreyPines/GGDUtils.jl
...
(SD4SOLPS_env) pkg> dev /local/path/to/ProjectTorreyPines/SOLPS2IMAS.jl
...
(SD4SOLPS_env) pkg> dev /local/path/to/ProjectTorreyPines/SynthDiag.jl
...
(SD4SOLPS_env) pkg> dev /local/path/to/ProjectTorreyPines/SD4SOLPS.jl
...
(SD4SOLPS_env) instantiate
(SD4SOLPS_env) # press backspace (delete on mac) to get out
julia> exit()
  • Use your local paths to the pulled repos above.
  • Note that you can use add instead of dev above but dev allows you to remain up to date on these repos in the future by simply pulling the latest releases.
  1. Now to run some script using your environment, you can run the scripts as:
% julia --project=/path/to/SD4SOLPS_env/as/created/above/ some_script.jl
  1. You can also make copies of the Project.toml and Manifest.toml generated in your SD4SOLPS_env directory and pass it around to any other directory in your local machine. In that case, it will become easier to call the scripts:
% cd working_dir
% cp /path/to/SD4SOLPS_env/as/created/above/*.toml ./
% julia --project some_script.jl
  1. Or you can run a jupyter notebook for inline visualization and testing your code.
    • For this to work, you'll have to install IJulia package in your main environment (usually called @vx.x):
% julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.2 (2023-07-05)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ]
(@v1.9) pkg> add IJulia
(@v1.9) pkg> instantiate
# press backspace (delete on mac) to get out
(@v1.9) pkg> julia> exit()
  • Either get inside SD4SOLPS_env directory created above or get inside a working directory that contains the environment toml files created above.
  • Then create any file with .ipynb extension and select the Julia kernel after starting the notebook or opening it in VScode), and at the top cell:
using Pkg;
Pkg.activate("./")
Pkg.instantiate()

Option 2: Installing from github

If you do not care to look often into the source code, you can skip the step of pulling the git repos yourself and let julia package manager do it for you. In this case, you will skip step 1 above, follow step 2, and on step 3, do this instead:

  1. Run Julia and do the following:
% julia --project=./
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.2 (2023-07-05)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ]
(SD4SOLPS_env) pkg> add "[email protected]:ProjectTorreyPines/OMAS.jl.git"#master
...
(SD4SOLPS_env) pkg> add "[email protected]:ProjectTorreyPines/SOLPS2IMAS.jl"#master
...
(SD4SOLPS_env) pkg> add "[email protected]:ProjectTorreyPines/GGDUtils.jl"#master
...
(SD4SOLPS_env) pkg> add "[email protected]:ProjectTorreyPines/SD4SOLPS.jl"#master
...
(SD4SOLPS_env) pkg> add "[email protected]:ProjectTorreyPines/SynthDiag.jl"#master
...
(SD4SOLPS_env) instantiate
(SD4SOLPS_env) # press backspace (delete on mac) to get out
julia> exit()

You can follow the rest of the steps as above. For updating any package in future, you'll have to run following:

cd SD4SOLPS_env # where Project.toml and Manifest.toml are stored
% julia --project=./
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.2 (2023-07-05)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> ]
(SD4SOLPS_env) pkg> update OMAS
...

Dependence hierarchy

Note: The packages have following dependence order right now, you'll have to ensure that this is not broken while installing and updating packages:

DependencyHeirarcy drawio

Clone this wiki locally