diff --git a/.gitignore b/.gitignore index a94e3bed3..32cc648f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,72 +1,4 @@ -# No .pyc files -*.pyc - -# No .so, .c or .nfs files -*.o -*.so -*.c -*.cpp -*.nfs* - -# annotated files -tofu/geom/*.html - -# No images -#*.png - -# Mac stuff +# apple stuff *.AppleDouble .DS_Store ._.DS_Store - -# No files finishing with a tilde -*~ - -# No jobs -job_* - -# No Nextupdate -NextUpdate* - -# No swap files -*.swp - -# No plugins -tofu/plugins/ -tofu/geom/build/ -./conda-bld -conda-bld/ -dist/ -tofu.egg-info/ -build/ - -# Tex files -*.aux -*.log - -# coverage output -.coverage - -# Include travis -!.travis.yml - -# no precommit configurations -.pre-commit-config.yaml - -# installation dir -usr/ - -# no PyCharm config files -.idea/ - -# do not commit sphinx built files -doc/build/html/ - -# do not commit built compiled files on windows -*.pyd - -# do not commit sphinx-gallery files -doc/source/auto_examples/ - -# do not commit nose tests files -*.noseids diff --git a/.travis.yml b/.travis.yml index 460d5e775..a4006d864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,20 @@ language: python python: +- '2.7' - '3.6' -- '3.7-dev' - git: - depth: 200 + depth: 100 sudo: required dist: trusty before_install: - - sudo apt-get update - - ldd --version - - gcc --version - - export START=$(pwd) +- sudo apt-get update +- ldd --version +- gcc --version +- export START=$(pwd) install: -- if [[ "$TRAVIS_PYTHON_VERSION" == "3.7-dev" ]]; then export VADD="py37"; else export VADD="py36"; fi -- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh - -O miniconda.sh +- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh + -O miniconda.sh; export VADD="py27"; export PCK="polygon2"; else wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh + -O miniconda.sh; export VADD="py36"; export PCK="polygon3"; fi - bash miniconda.sh -b -p $HOME/miniconda - export PATH="$HOME/miniconda/bin:$PATH" - hash -r @@ -27,10 +26,7 @@ install: - conda config --append channels conda-forge - conda config --append channels tofuproject - conda info -a -- if [[ "$TRAVIS_PYTHON_VERSION" == "3.7-dev" ]]; then export THIS_PY_VERSION="3.7"; - else THIS_PY_VERSION=$TRAVIS_PYTHON_VERSION; - fi -- conda install -q python=$THIS_PY_VERSION conda-build anaconda-client nose +- conda install -q python=$TRAVIS_PYTHON_VERSION conda-build anaconda-client nose nose-timer coverage codecov - export REV=$(python -c "import _updateversion as up; out=up.updateversion(); print(out)") - export VERSION=$(echo $REV | tr - .) diff --git a/Debug_JINTRACMesh.pdf b/Debug_JINTRACMesh.pdf deleted file mode 100644 index e69de29bb..000000000 diff --git a/Notebooks/Cython_speedup_notes.ipynb b/Notebooks/Cython_speedup_notes.ipynb deleted file mode 100644 index bead1fb51..000000000 --- a/Notebooks/Cython_speedup_notes.ipynb +++ /dev/null @@ -1,658 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Cython Speed-up notes\n", - "\n", - "While I started coding on *Cython* I found a number of tips and tricks of what to (not) do. This is a collection of those things...\n", - "\n", - "## Basic tutorials and tips\n", - "\n", - "For the basis, this is a list of documentation that I found useful:\n", - "* https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html\n", - "* https://cython.readthedocs.io/en/latest/src/tutorial/\n", - " \n", - "Some basics tips that will speed up your code significantly:\n", - "* **Type** your variables : *all* variables, functions inputs, local variables, global variables, etc.\n", - "* Minimize functions called from other python libraries (avoid overheads)\n", - "* Try defining all local function as `inline`\n", - "* Learn the difference between cdef, def, and pcdef\n", - "* If not necessary, release the GIL and make it explicit (ie. use `nogil`)\n", - "* Use function decorators (e.g. ` @cython.boundscheck(False) `)\n", - "\n", - "## Some examples\n", - "\n", - "### Typing variables\n", - "\n", - "An easy way to see if you are typing (correctly) all variables, is to see the annotated version of your source code. Let us compare the following three functions." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "%load_ext Cython" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [], - "source": [ - "%%cython\n", - "#--annotate\n", - "import time\n", - "import sys\n", - "\n", - "cimport cython\n", - "cimport numpy as np\n", - "import numpy as np\n", - "\n", - "\n", - "def untyped_func(tab, tab_len, scalar):\n", - " res = 0.\n", - " for i in range(tab_len):\n", - " res += tab[i] * scalar\n", - " return res\n", - "\n", - "def somewhat_typed_func(np.ndarray[double, ndim=1, mode=\"c\"] tab not None, int tab_len, double scalar):\n", - " cdef double res = 0.\n", - " cdef int i\n", - " for i in range(tab_len):\n", - " res += tab[i] * scalar\n", - " return res\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "cdef double typed_func(double[::1] tab, int tab_len, double scalar) nogil:\n", - " cdef double res = 0.\n", - " cdef int i\n", - " for i in range(tab_len):\n", - " res += tab[i] * scalar\n", - " return res" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "We can already see that the third function `typed_func`, has much less yellow, which generally means less C code behind it, thus faster code. Let's benchmark them." - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "For L = 1000\n", - "0.360000 μs, using the untyped_func\n", - "0.123000 μs, using the somewhat_typed_func\n", - "0.113000 μs, using the typed_func\n", - "0.029000 μs, using the inline_typed_func\n", - "For L = 10000\n", - "5.174000 μs, using the untyped_func\n", - "0.024000 μs, using the somewhat_typed_func\n", - "0.012000 μs, using the typed_func\n", - "0.015000 μs, using the inline_typed_func\n", - "For L = 100000\n", - "43.197000 μs, using the untyped_func\n", - "0.151000 μs, using the somewhat_typed_func\n", - "0.025000 μs, using the typed_func\n", - "0.024000 μs, using the inline_typed_func\n" - ] - } - ], - "source": [ - "%%cython\n", - "import time\n", - "import sys\n", - "\n", - "cimport cython\n", - "cimport numpy as np\n", - "import numpy as np\n", - "\n", - "\n", - "def untyped_func(tab, tab_len, scalar):\n", - " res = 0.\n", - " for i in range(tab_len):\n", - " res += tab[i] * scalar\n", - " return res\n", - "\n", - "def somewhat_typed_func(np.ndarray[double, ndim=1, mode=\"c\"] tab not None, int tab_len, double scalar):\n", - " cdef double res = 0.\n", - " cdef int i\n", - " for i in range(tab_len):\n", - " res += tab[i] * scalar\n", - " return res\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "cdef double typed_func(double[::1] tab, int tab_len, double scalar) nogil:\n", - " cdef double res = 0.\n", - " cdef int i\n", - " for i in range(tab_len):\n", - " res += tab[i] * scalar\n", - " return res\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "cdef inline double inline_typed_func(double[::1] tab, int tab_len, double scalar) nogil:\n", - " cdef double res = 0.\n", - " cdef int i\n", - " for i in range(tab_len):\n", - " res += tab[i] * scalar\n", - " return res\n", - "\n", - "cdef int L, i, loops = 1000\n", - "cdef double start, end, res\n", - "for L in [1000, 10000, 100000]:\n", - " np_array = np.ones(L)\n", - " print(\"For L = \", L)\n", - " start = time.clock()\n", - " res = untyped_func(np_array, L, 2.)\n", - " end = time.clock()\n", - " print(format((end-start) / loops * 1e6, \"2f\"), end=\" \")\n", - " sys.stdout.flush()\n", - " print(\"μs, using the untyped_func\")\n", - " # ..................................................\n", - " start = time.clock()\n", - " res = somewhat_typed_func(np_array, L, 2.)\n", - " end = time.clock()\n", - " print(format((end-start) / loops * 1e6, \"2f\"), end=\" \")\n", - " sys.stdout.flush()\n", - " print(\"μs, using the somewhat_typed_func\")\n", - " # ..................................................\n", - " start = time.clock()\n", - " res = typed_func(np_array, L, 2.)\n", - " end = time.clock()\n", - " print(format((end-start) / loops * 1e6, \"2f\"), end=\" \")\n", - " sys.stdout.flush()\n", - " print(\"μs, using the typed_func\")\n", - " # ..................................................\n", - " start = time.clock()\n", - " res = inline_typed_func(np_array, L, 2.)\n", - " end = time.clock()\n", - " print(format((end-start) / loops * 1e6, \"2f\"), end=\" \")\n", - " sys.stdout.flush()\n", - " print(\"μs, using the inline_typed_func\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Working with numpy arrays in I/O\n", - "\n", - "The first challenge I was confronted to, was handling Numpy arrays. The cython part of our code takes as inputs numpy arrays, and should give as output numpy arrays as well. However, reading and writing from numpy arrays can be slow in cython. Some tutorials mentioned using memory views, other mention that C array give a clear improvement, and overall several different solutions are mentioned. A StackOverflow answer makes a good benchmark between these solutions for a code that only need to create arrays (not taking any inputs) and giving back a numpy array:\n", - "https://stackoverflow.com/questions/18462785/what-is-the-recommended-way-of-allocating-memory-for-a-typed-memory-view\n", - "\n", - "However, here we need to focus on the copying and accessing the data from the numpy array." - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "-------- TESTS -------\n", - "Running numpy buffers\n", - "0.020667 0.009333 0.098333 0.882333 6.571667 58.261333 670.627333 μs\n", - "Running cpython.array buffer\n", - "0.327333 0.090000 0.323333 0.742333 7.339333 70.054000 1853.809000 μs\n", - "Running cpython.array memoryview\n", - "0.890333 0.785000 1.215667 1.305667 6.270667 44.810333 538.815667 μs\n", - "Running cpython.array raw C type with trick\n", - "0.044000 0.048667 0.380000 1.419333 10.037000 100.486667 2541.475333 μs\n", - "Running C pointers\n", - "0.006000 0.006333 0.023667 0.159000 2.129667 25.866667 363.967667 μs\n", - "Running malloc memoryview\n", - "0.588667 0.630333 0.663667 1.224333 2.392333 23.987667 379.138667 μs\n", - "Running argument memoryview\n", - "0.011667 0.016333 0.112000 0.722667 5.305000 45.683333 525.975333 μs\n" - ] - } - ], - "source": [ - "%%cython\n", - "import time\n", - "import sys\n", - "\n", - "from cpython.array cimport array, clone\n", - "from cython.view cimport array as cvarray\n", - "from libc.stdlib cimport malloc, free\n", - "import numpy as np\n", - "cimport numpy as np\n", - "\n", - "cdef int loops\n", - "\n", - "def timefunc(name):\n", - " def timedecorator(f):\n", - " cdef int L, i\n", - "\n", - " print(\"Running\", name)\n", - " for L in [1, 10, 100, 1000, 10000, 100000, 1000000]:\n", - " np_array = np.ones(L)\n", - " start = time.clock()\n", - " res_array = f(L, np_array)\n", - " end = time.clock()\n", - " print(format((end-start) / loops * 1e6, \"2f\"), end=\" \")\n", - " sys.stdout.flush()\n", - "\n", - " print(\"μs\")\n", - " return timedecorator\n", - "\n", - "print()\n", - "print(\"-------- TESTS -------\")\n", - "loops = 3000\n", - "\n", - "\n", - "@timefunc(\"numpy buffers\")\n", - "def _(int L, np.ndarray[double, ndim=1, mode=\"c\"] np_array not None):\n", - " cdef int i, j\n", - " cdef double d\n", - " for i in range(loops):\n", - " for j in range(L):\n", - " d = np_array[j]\n", - " np_array[j] = d*0.\n", - " # Prevents dead code elimination\n", - " str(np_array[0])\n", - " return np_array\n", - " \n", - "@timefunc(\"cpython.array buffer\")\n", - "def _(int L, np.ndarray[double, ndim=1, mode=\"c\"] np_array not None):\n", - " cdef int i, j\n", - " cdef double d\n", - " cdef array[double] arr, template = array('d')\n", - "\n", - " for i in range(loops):\n", - " arr = clone(template, L, False)\n", - " for j in range(L):\n", - " # initialization\n", - " arr[j] = np_array[j]\n", - " # access\n", - " d = arr[j]\n", - " arr[j] = d*2.\n", - " # Prevents dead code elimination\n", - " return np.asarray(arr)\n", - "\n", - "\n", - "@timefunc(\"cpython.array memoryview\")\n", - "def _(int L, np.ndarray[double, ndim=1, mode=\"c\"] np_array not None):\n", - " cdef int i, j\n", - " cdef double d\n", - " cdef double[::1] arr\n", - "\n", - " for i in range(loops):\n", - " arr = np_array\n", - " for j in range(L):\n", - " # usage\n", - " d = arr[j]\n", - " arr[j] = d*0.\n", - " # Prevents dead code elimination\n", - " return np_array\n", - " \n", - "\n", - "@timefunc(\"cpython.array raw C type with trick\")\n", - "def _(int L, np.ndarray[double, ndim=1, mode=\"c\"] np_array not None):\n", - " cdef int i\n", - " cdef array arr, template = array('d')\n", - "\n", - " for i in range(loops):\n", - " arr = clone(template, L, False)\n", - " for j in range(L):\n", - " # initialization\n", - " arr.data.as_doubles[j] = np_array[j]\n", - " # usage\n", - " d = arr.data.as_doubles[j]\n", - " arr.data.as_doubles[j] = d*2.\n", - " # Prevents dead code elimination\n", - " return np.asarray(arr)\n", - "\n", - "\n", - "@timefunc(\"C pointers\")\n", - "def _(int L, np.ndarray[double, ndim=1, mode=\"c\"] np_array not None):\n", - " cdef int i\n", - " cdef double* arrptr\n", - "\n", - " for i in range(loops):\n", - " arrptr = np_array.data\n", - " for j in range(L):\n", - " d = arrptr[j]\n", - " arrptr[j] = d*0.\n", - "\n", - " return np_array\n", - "\n", - "@timefunc(\"malloc memoryview\")\n", - "def _(int L, np.ndarray[double, ndim=1, mode=\"c\"] np_array not None):\n", - " cdef int i\n", - " cdef double* arrptr\n", - " cdef double[::1] arr\n", - "\n", - " for i in range(loops):\n", - " arrptr = np_array.data\n", - " arr = arrptr\n", - " for j in range(L):\n", - " d = arrptr[j]\n", - " arrptr[j] = d*0.\n", - "\n", - " return np_array\n", - "\n", - "@timefunc(\"argument memoryview\")\n", - "def _(int L, double[::1] np_array not None):\n", - " cdef int i, j\n", - " cdef double d\n", - "\n", - " for i in range(loops):\n", - " for j in range(L):\n", - " # usage\n", - " d = np_array[j]\n", - " np_array[j] = d*0.\n", - " # Prevents dead code elimination\n", - " return np_array" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "**In conclusion:**\n", - " For all cases, you will gain a 2x factor speed up by using a C pointer. Since the memory is already allocated for the numpy array, it is not necessary to use `malloc`. We will adopt the following declaration:\n", - "~~~~\n", - "cdef double* arrptr\n", - "arrptr = np_array.data\n", - "~~~~\n", - "\n", - "Note that for all functions we declared the numpy array in the function header.\n", - "\n", - "\n", - "## Parallelization and arrays\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "After optimizing the code, the obvious step to speed-up the code is to parallelize. From the documentation it seems that this should be quite easy, but I discovered a few things to keep in mind. Let's start with a simple loop example" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [], - "source": [ - "import Cython.Compiler.Options as CO\n", - "CO.extra_compile_args = [\"-O3\", \"-ffast-math\", \"-march=native\", \"-fopenmp\" ]\n", - "CO.extra_link_args = ['-fopenmp']" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [], - "source": [ - "%%cython --compile=-fopenmp --link-args=-fopenmp\n", - "\n", - "cimport cython\n", - "\n", - "from cython.parallel cimport parallel, prange\n", - "from cython.parallel cimport threadid\n", - "from libc.stdio cimport stdout, fprintf\n", - "import time\n", - "import sys\n", - "\n", - "from cpython.array cimport array, clone\n", - "from cython.view cimport array as cvarray\n", - "from libc.stdlib cimport malloc, free\n", - "\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "cdef inline void seq_func(int L, double* arrptr):\n", - " cdef int j\n", - "\n", - " for j in range(L):\n", - " arrptr[j] = 2.0*arrptr[j]\n", - " return\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "cdef inline void bad_par_func(int L, double* arrptr):\n", - " cdef Py_ssize_t j\n", - " cdef double d\n", - "\n", - " with nogil, parallel():\n", - " arrptr[0] = 0\n", - " for j in prange(1, L-1):\n", - " # or any other operation that doesn't allow to the code parallelized\n", - " arrptr[j+1] = 2.0*arrptr[j]-arrptr[j-1]\n", - " arrptr[L-1] = 0\n", - " return\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "cdef inline void good_par_func(int L, double* arrptr) nogil:\n", - " cdef Py_ssize_t j\n", - "\n", - " for j in prange(L, nogil=True):\n", - " arrptr[j] = 2.0*arrptr[j]\n", - " return\n", - "\n", - "\n", - "cdef int L, i, loops = 1000, ilps\n", - "cdef double start, end, res\n", - "cdef double t0=0.0, t1=0.0, t2=0.0\n", - "cdef double* tab\n", - "for L in [1000, 10000, 100000]:\n", - " tab = malloc(sizeof(double) * L)\n", - " print(\"For L = \", L)\n", - " for ilps in range(loops):\n", - " # ..................................................\n", - " start = time.clock()\n", - " seq_func(L, tab)\n", - " end = time.clock()\n", - " t0 += (end - start) / loops\n", - " # ..................................................\n", - " start = time.clock()\n", - " bad_par_func(L, tab)\n", - " end = time.clock()\n", - " t1 += (end - start) / loops\n", - " # ..................................................\n", - " start = time.clock()\n", - " good_par_func(L, tab)\n", - " end = time.clock()\n", - " t2 += (end - start) / loops\n", - "\n", - " print(format(t0 * 1e6, \"2f\"), \"μs, using the sequential loop\")\n", - " print(format(t1 * 1e6, \"2f\"), \"μs, using the parallel 1 loop\")\n", - " print(format(t2 * 1e6, \"2f\"), \"μs, using the parallel 2 loop\")\n", - " \n", - " free(tab)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Other errors to avoid is to add variables incrementation on the parallel part, e.g. `i += 1`" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": { - "scrolled": true - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "-------- TESTS -------\n", - "Running Static allocation for n=2\n", - "24.429000 1510.157000 μs\n", - "Running Dynamic allocation for n=2\n", - "25.680000 257.589000 μs\n", - "Running Static allocation for n=4\n", - "29.224000 1419.650000 μs\n", - "Running Dynamic allocation for n=4\n", - "49.522000 162.180000 μs\n" - ] - } - ], - "source": [ - "%%cython --compile-args=-openmp --link-args=-openmp -a\n", - "\n", - "cimport cython\n", - "\n", - "from cython.parallel import parallel, prange\n", - "from libc.stdlib cimport abort, malloc, free\n", - "import time, sys\n", - "import numpy as np\n", - "cimport numpy as np\n", - "\n", - "\n", - "cdef int loops\n", - "\n", - "def timefunc(name):\n", - " def timedecorator(f):\n", - " cdef int L, i\n", - " cdef np.ndarray np_array\n", - " cdef np.ndarray[double] global_buf\n", - "\n", - " print(\"Running\", name)\n", - " for L in [10000, 1000000]:\n", - " np_array = np.ones(L)\n", - " global_buf = np_array\n", - " start = time.clock()\n", - " f(global_buf, L, (L/2))\n", - " end = time.clock()\n", - " print(format((end-start) / loops * 1e6, \"2f\"), end=\" \")\n", - " sys.stdout.flush()\n", - "\n", - " print(\"μs\")\n", - " return timedecorator\n", - "\n", - "print()\n", - "print(\"-------- TESTS -------\")\n", - "loops = 1000\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "@timefunc(\"Static allocation for n=2\")\n", - "def _(double[::1] global_buf not None, int n, int n2):\n", - " cdef double[2] local_buf\n", - " cdef int idx, i\n", - "\n", - " with nogil, parallel():\n", - " for i in range(loops):\n", - " for idx in prange(n2, schedule='guided'):\n", - " local_buf[0] = global_buf[idx*2]\n", - " local_buf[1] = global_buf[idx*2+1]\n", - " func(local_buf)\n", - " return\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "@timefunc(\"Dynamic allocation for n=2\")\n", - "def _(double[::1] global_buf not None, int n, int n2):\n", - " cdef double* local_buf\n", - " cdef int idx, i\n", - "\n", - " with nogil, parallel():\n", - " for i in range(loops):\n", - " local_buf = malloc(sizeof(double) * 2)\n", - " for idx in prange(n2, schedule='guided'):\n", - " local_buf[0] = global_buf[idx*2]\n", - " local_buf[1] = global_buf[idx*2+1]\n", - " func(local_buf)\n", - " free(local_buf)\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "@timefunc(\"Static allocation for n=4\")\n", - "def _(double[::1] global_buf not None, int n, int n2):\n", - " cdef double[4] local_buf\n", - " cdef int idx, i, n4 = (n2/2)\n", - "\n", - " with nogil, parallel():\n", - " for i in range(loops):\n", - " for idx in prange(n4, schedule='guided'):\n", - " local_buf[0] = global_buf[idx*4]\n", - " local_buf[1] = global_buf[idx*4+1]\n", - " local_buf[2] = global_buf[idx*4+2]\n", - " local_buf[3] = global_buf[idx*4+3]\n", - " func(local_buf)\n", - " return\n", - "\n", - "@cython.boundscheck(False) # Deactivate bounds checking\n", - "@cython.wraparound(False) # Deactivate negative indexing.\n", - "@timefunc(\"Dynamic allocation for n=4\")\n", - "def _(double[::1] global_buf not None, int n, int n2):\n", - " cdef double* local_buf\n", - " cdef int idx, i, n4 = (n2/2)\n", - "\n", - " with nogil, parallel():\n", - " for i in range(loops):\n", - " local_buf = malloc(sizeof(double) * 4)\n", - " for idx in prange(n4, schedule='guided'):\n", - " local_buf[0] = global_buf[idx*4]\n", - " local_buf[1] = global_buf[idx*4+1]\n", - " local_buf[2] = global_buf[idx*4+2]\n", - " local_buf[3] = global_buf[idx*4+3]\n", - " func(local_buf)\n", - " free(local_buf)\n", - " \n", - "# ==============================================================================\n", - "# test function\n", - "cdef void func(double* local_buf) nogil:\n", - " cdef int i=0\n", - " return" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "It might seem counter-intuitive but using a dynamic `malloc` (and `free`-ing accordingly) instead of declaring an array statically, will improve the performance of your code." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.2" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.bib b/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.bib deleted file mode 100644 index b98edc6a2..000000000 --- a/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.bib +++ /dev/null @@ -1,10 +0,0 @@ -@article{didier2016, - title={Non-monotonic growth rates of sawtooth precursors evidenced with a new method on ASDEX Upgrade}, - author={Vezinet, D and Igochine, V and Weiland, M and Yu, Q and Gude, A and Meshcheriakov, D and Sertoli, M and EUROfusion MST1 Team and others}, - journal={Nuclear Fusion}, - volume={56}, - number={8}, - pages={086001}, - year={2016}, - publisher={IOP Publishing} -} \ No newline at end of file diff --git a/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.pdf b/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.pdf deleted file mode 100644 index 443e84fe1..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.tex b/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.tex deleted file mode 100644 index e58e1518b..000000000 --- a/Notes_Upgrades/Communications/Euroscipy2019/2019_LM_Euroscipy.tex +++ /dev/null @@ -1,1026 +0,0 @@ -\documentclass[10pt]{beamer} - -\usepackage{appendixnumberbeamer} -% -%\usepackage{lmodern} -%\usepackage{wrapfig} -\usepackage{tikz} -%\usetikzlibrary{positioning} -\usetikzlibrary{arrows,shapes} -\usepackage{amsmath,esint,esvect} % arrow for vector, maths and more -%\usepackage{datetime} -\usepackage{gensymb}%for degree symbol -%\usepackage{beamerthemesplit} -%\usepackage{graphicx} %trimed images -%\usepackage{pifont} %for dings -% -%\usepackage{import} -%\usepackage{cases} -\usepackage{booktabs} %beautiful tables -\usepackage{pgfplots} -\usepgfplotslibrary{dateplot} -% -\usepackage{siunitx} % SI notations -\sisetup{table-number-alignment=center, exponent-product=\cdot} - - - - -% Bibliography includes -\usepackage[backend=bibtex, citestyle=verbose-trad2,bibstyle=authortitle-icomp,sortcites=true,block=space,firstinits=true]{biblatex} -\addbibresource{2019_LM_Euroscipy.bib} -\usepackage{hyperref} - -\usetheme[progressbar=frametitle]{metropolis} - - - - \setbeamertemplate{itemize subitem}{\color{orange}$\blacktriangleright$} - -% --------------Math mode------------------ -\renewcommand\mathfamilydefault{\rmdefault} -% ----------------------------------------- - -% ------ Images path ------------------ -\newcommand{\figurespath}{./figures} - -%% ---------- Editing the footer ------------ -%\makeatother -%\setbeamertemplate{footline} -%{ -% \leavevmode% -% \hbox{% -% \begin{beamercolorbox}[wd=.6\paperwidth,ht=2.25ex,dp=1ex,center]{institute in head/foot}% -% \usebeamerfont{institute in head/foot}\insertshortinstitute -% \end{beamercolorbox}% -% \begin{beamercolorbox}[wd=.4\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}% -% \usebeamerfont{date in head/foot}\insertshortdate\hspace*{2em} -% \insertframenumber{} \hspace*{2ex} -% \end{beamercolorbox}}% -% \vskip0pt% -%} -%\makeatletter -%\setbeamertemplate{navigation symbols}{} -%% ----------------------------------------- - -% ------ Date definition ------------------ -% \newdate{date}{04}{09}{2019} -% ----------------------------------------- - -% ----------New color---------------------- -\definecolor{myblue}{RGB}{51,51,179} -\definecolor{beaubleu2}{cmyk}{1,0,0,0.71} -\definecolor{SchoolColor}{rgb}{0.6471, 0.1098, 0.1882} % Crimson -\definecolor{beaurouge}{HTML}{405684} -\definecolor{beaubleu}{HTML}{CC382C} -\definecolor{myyellow}{rgb}{0.99, 0.82, 0.35} -% ----------------------------------------- - -%% ---------Redifining foot cites----------- -\newrobustcmd*{\footlessfullcite}{\AtNextCite{\renewbibmacro{title}{}\renewbibmacro{in:}{}}\footfullcite} - -%\renewbibmacro{in:}{\hspace{-5pt}} -\AtEveryCitekey{\clearfield{pages}\clearfield{volume}\clearfield{url} -\clearfield{doi}\clearfield{issn}} -%% ----------------------------------------- - -% ---------First page variables------------ -\title{ToFu} -\subtitle{An open-source python/cython library for synthetic tomography diagnostics on tokamaks} -\author[Laura S. Mendoza] % (optional, for multiple authors) -{\textbf{Laura~S.~Mendoza}\inst{1}, \and Didier~Vezinet\inst{2}} -\institute[] % (optional) -{ - \inst{1}% - INRIA Grand-Est, - TONUS Team, Strasbourg, France\\ - - \inst{2}% - CEA, - Cadarache, France -} -\date[\displaydate{date}] % (optional) -{\alert{Euroscipy 2019, Bilbao, Espa\~na}} -\subject{} - - -% ----------------------------------------- - -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{document} - -\newcommand{\gradx}{\nablax} -\newcommand{\vpar}{v_\parallel} -\newcommand{\xvec}{\mathbf{x}} -\newcommand{\nablax}{\nabla_{\!\xvec}} - - -% ================================= -%\usebackgroundtemplate{\includegraphics[height=\paperheight,width=\paperwidth]{figures/background.png}}% -\begin{frame} - \titlepage -\end{frame} -% ================================= - -% ================================= -\begin{frame}{Table of contents} - \setbeamertemplate{section in toc}[sections numbered] - \tableofcontents[hideallsubsections] -\end{frame} -% ================================= - -\section{Context} - -% ================================= -\begin{frame} -\frametitle{Context: energy needs vs resources and climate change} - - \begin{center} - \includegraphics[height=1.8cm]{figures/oil-power.jpg}% - \includegraphics[height=1.8cm]{figures/solar-power.jpg}% - \includegraphics[height=1.8cm]{figures/nuclear-power.jpg}% - \includegraphics[height=1.8cm]{figures/wind-power.jpg} - \end{center} - -Worldwide growing energy needs (population, standards of living...)\\ -$\quad \Rightarrow$ high pressure on environment (degrading, changing, exhausting...)\\ - -$\quad \Rightarrow$ need to decrease consumption + alternative production means\\ - -$\quad \Rightarrow$ a relatively clean, safe, mass-production means with large resources would be welcome in the mix\\ - -%\begin{itemize}%[leftmargin=1em] -%\setbeamertemplate{itemize item}{$\Rightarrow$} -% \item \alert{Fusion}: cleaner, more reliable, more powerful energy source? -%\end{itemize} - -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Context: Controlled fusion and magnetic confinement} - -\begin{columns} - \begin{column}{0.65\textwidth} - \begin{center} - \textbf{D-T Fusion reaction\;\;\;}\vspace{0.3cm} - %\includegraphics[width=3.5cm]{figures/DT_reaction3.png} - \resizebox{0.5\textwidth}{!}{\input{figures/reaction.tex}} - \end{center} - \vspace{-0.5cm} - \begin{itemize}%[leftmargin=1em] - \item Gas $>$ 100 Million\degree K composed of positive ions and negative electrons: plasma - \item Confinement using electromagnetic fields - \item break-even not obtained yet - \end{itemize} - - \end{column} - - \begin{column}{0.35\textwidth} - \includegraphics[width=1.\textwidth]{figures/ITER.pdf} - \end{column} - -\end{columns} - -%\begin{itemize}%[leftmargin=1em] -\begin{center} -In a nutshell: toroidal vacuum vessel, filled with H plasma -\end{center}%\end{itemize} -\vspace{-0.2cm} -%%\begin{itemize}%[leftmargin=1em] -%%\setbeamertemplate{itemize item}{$\Rightarrow$} -%% \item \alert{Fusion codes:} complexity due to the number of parameters, geometry, model, etc. -%%\end{itemize} -\end{frame} -% ================================= - - -\section{Tomography diagnostics} - - -% ================================= -\begin{frame} -\frametitle{Tokamak diagnostics to measure plasma quantities} - - \metroset{block=fill} -\begin{alertblock}{Diagnostics} -Set of instruments to measure plasma quantities, for understanding, control, optimization. -\end{alertblock} - -e.g: magnetic field, neutrons, \textbf{emitted light}, temperature, density...\\[1cm] - - -$\quad \Rightarrow$ cameras (1D or 2D) for measuring light in various wavelengths - - -% -%\begin{itemize} -%\item \textbf{Magnetic} diagnostics: currents, plasma stored energy, plasma shape and position; -% -%\item \textbf{Neutron} diagnostics (ie. cameras, spectrometers, etc.): fusion power; -% -%\item Optical systems (\textbf{interferometers}): temperature and density profiles; -% -%\item Bolometric systems (\textbf{tomography}): spatial distribution of radiated power; -% -%\item \textbf{Spectroscopic}: X-ray wavelength range, impurity species and density, input particle flux, ion temperature, helium density, fueling ratio, plasma rotation, and current density. - -%\item Microwave diagnostics probe the main plasma and the plasma in the divertor region in order to measure plasma position. - -%\end{itemize} - -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{A tokamak as a poloidal + horizontal projections} - -\begin{columns} - - \begin{column}{0.25\textwidth} - \includegraphics[width=1.\textwidth]{figures/ITER.pdf} - \end{column} - - \begin{column}{0.75\textwidth} - \begin{center} - \textbf{tofu.geom.Config class} - \end{center} - \includegraphics[width=1.\textwidth]{figures/Config01.pdf} - \end{column} - -\end{columns} - - -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{Tomography diagnostics - numerical context} - \vspace{-0.75cm} - - $$M_i(t) = \iiint\limits_{V_i} \vv{\varepsilon(x,t)}\cdot\vv{n} \,\Omega_i \;{d}V$$ - \vspace{-0.75cm} -\begin{columns} - \begin{column}{0.325\textwidth} - - %\def\svgwidth{\linewidth} - %\import{figures/}{detectors.pdf_tex} - \includegraphics[width=\linewidth,trim={0 0 1cm 0}]{figures/Tomography.pdf} - - \end{column} - - \begin{column}{0.675\textwidth} - \begin{center} - - %DIRECT PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Direct problem} (synthetic diagnostic):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Simulated emissivity $\longrightarrow$ integrated measurements\\ - - %INVERSE PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Inverse problem} (tomography):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Integrated measurements $\longrightarrow$ Reconstructed emissivity \\ - - \end{center} - - \end{column} -% -\end{columns} - - -\end{frame} -% ================================= - - - - -% ================================= -\begin{frame} -\frametitle{Tomography diagnostics - numerical context} - - $$M_i(t) = \iiint\limits_{V_i} \vv{\varepsilon(x,t)}\cdot\vv{n} \,\Omega_i \;{d}V$$ - \vspace{-1cm} -\begin{columns} - \begin{column}{0.325\textwidth} - - %\def\svgwidth{\linewidth} - %\import{figures/}{detectors.pdf_tex} - \includegraphics[width=\linewidth,trim={0 0 1cm 0}]{figures/Tomography.pdf} - - \end{column} - - \begin{column}{0.675\textwidth} - \begin{center} - - %DIRECT PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Direct problem} (synthetic diagnostic):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Simulated emissivity $\longrightarrow$ measurements\\ - \alert{Spatial integration} - \vspace{-0.5cm} - - %INVERSE PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Inverse problem} (tomography):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Integrated measurements $\longrightarrow$ Reconstructed emissivity \\ - \alert{Mesh and basis functions construction, spatial integration, data filtering, inversion routines, etc.} - - \end{center} - - \end{column} -% -\end{columns} - -\pause -\vspace{-0.5cm} -\begin{block}{} -\begin{center} -Tomography is \textbf{ill-posed}, very sensitive to errors, noise and bias\\ -$\longrightarrow$ \alert{Reputation for low reproducibility / reliability } -\end{center} - \end{block} -\end{frame} -% ================================= - - - -\section{The ToFu package} - - -% ================================= -\begin{frame} -\frametitle{Motivation: ``current" state} - - In the fusion community, codes for tomography diagnostic are often: - \begin{itemize} - \item developed by physicists (with little programming experience) - \item in Matlab (or IDL) - \item written from scratch, re-done by new students - \item not distributed (few users), rarely documented - \end{itemize} - -... which means -\begin{itemize} - \item waste of resources: time, man-power - \item low traceability, reproducibility - \item low standardization, unclear assumptions / methods - \end{itemize} - -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{A code for Tomography for Fusion} -\textbf{Develop a common tool:} -\begin{columns} -\begin{column}{0.65\textwidth} - \begin{itemize} - \item Generic (geometry independent) - \item Portable (Python) - \item Optimized / parallelized - \item Documented online - \item Continuous integration - \end{itemize} -\end{column} -\begin{column}{0.35\textwidth} -\vspace{-1cm} -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/ci.pdf} -\end{center} -\end{column} -\end{columns} -\vspace{-0.9cm} - -\begin{block}{} - \begin{center} - \alert{\textbf{ToFu}\footnote{repository: \url{https://github.com/ToFuProject/tofu}}\footnote{documentation: \url{https://tofuproject.github.io/tofu/index.html} }\footcite{didier2016}} = \alert{\textbf{To}mography for \textbf{Fu}sion} - \end{center} -\vspace{-5mm} -\end{block} - -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{More about Tofu} - -\begin{columns} -\begin{column}{0.65\textwidth} -\begin{itemize} - \item Created in 2014 - \item Open Source:\textbf{ MIT license} - \item Python 2.7 and \textbf{Python} 3 + \textbf{Cython} - \item Continuous integration: \textbf{Travis} CI - \item \textbf{conda}, \textbf{pip} - \item Two (main) developers: - \begin{itemize} - \item Didier Vezinet (creator, Physics) - \item Laura S. Mendoza (since 06.2018, Applied Maths) - \end{itemize} - \item Contributors: - \begin{itemize} - \item Jorge Morales - \item Florian Le Bourdais - \item Arpan Khandelwal - \end{itemize} -\end{itemize} -\end{column} -\begin{column}{0.35\textwidth} -\begin{center} - \includegraphics[width=\textwidth]{figures/qr-code.png} -\end{center} -\end{column} -\end{columns} -\begin{center} - \includegraphics[width=\textwidth]{figures/badges.png} -\end{center} - -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{Tofu's structure} - -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/tofu.pdf} -\end{center} - -\end{frame} -% ================================= - - -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: modeling of simplified geometry} -% \begin{center} -% \includegraphics[width=\textwidth,trim={0 0 4cm 0}]{figures/geom_B3.png} -% \end{center} -%\end{frame} -%% ================================= -% -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: 3D modeling of a 1D camera} -% \begin{center} -% \includegraphics[width=\textwidth]{figures/cam1d.png} -% \end{center} -%\end{frame} -%% ================================= -% -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: 3D modeling of a 2D camera} -% \begin{center} -% \includegraphics[width=\textwidth]{figures/cam2d.png} -% \end{center} -%\end{frame} -%% ================================= - - -% ================================= -\begin{frame} -\frametitle{tofu.geom: modeling of simplified geometry} -\begin{columns} -% \begin{column}{0.33\textwidth} -% \begin{center} -% \textbf{Geometry configuration} -% \includegraphics[width=\textwidth,trim={0 0 6cm 0}]{figures/geom_B3.png} -% \end{center} -% \pause -% \end{column} - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{1D Camera\\(tofu.geom.CamLOS1D)} - \includegraphics[width=\textwidth]{figures/cam1d_bis.pdf} - \end{center} - \end{column} - \pause - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{2D Camera\\(tofu.geom.CamLOS2D)} - \includegraphics[width=\textwidth]{figures/cam2d_bis.pdf} - \end{center} - \end{column} - \end{columns} -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{tofu.geom: handle basic reflexions} -\begin{columns} -% \begin{column}{0.33\textwidth} -% \begin{center} -% \textbf{Geometry configuration} -% \includegraphics[width=\textwidth,trim={0 0 6cm 0}]{figures/geom_B3.png} -% \end{center} -% \pause -% \end{column} - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{1D Camera with reflexions\\(tofu.geom.CamLOS1D)} - \includegraphics[width=\textwidth]{figures/cam1d_bis_ref.pdf} - \end{center} - \end{column} - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{2D Camera with reflexions\\(tofu.geom.CamLOS2D)} - \includegraphics[width=\textwidth]{figures/cam2d_bis_ref.pdf} - \end{center} - \end{column} - \end{columns} -\end{frame} -% ================================= - -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: computing synthetic signals} -% -%\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{What ToFu can do} -\begin{itemize} - \item Model simplified 3D geometry - \item 3D modeling of a 1D and 2D LOS camera - \item Handle basic reflections - \item Computing synthetic signals - \item native support for IMAS interfacing - \item data easy interactive visualization and basic treatment - \pause - \item ...and soon (being re-written / developed): - \begin{itemize} - \item Finite beam width (VOS, in 1.4.2, late 2019) - \item meshing and basis functions (mid 2020) - \item tomographic inversion (late 2020 - 2021) - \item dust particle trajectory tracking (new, Arpan) - \item faster Matplotlib + PyQtGraph visualization - \item magnetic field line tracing (new) - \item statistical data analysis (pandas) integrated - \end{itemize} -\end{itemize} -\end{frame} -% ================================= -\section{Demo} - -% ================================= -{\setbeamercolor{palette primary}{fg=black, bg=yellow} -\begin{frame}[standout] - Demo -\end{frame} -} -% ================================= - -\section{Code Optimization} - - -% ================================= -\begin{frame} -\frametitle{Geometry reconstruction: ray-tracing techniques} - - To reconstruct emissivity we need to take account: - \begin{itemize} - \item Up to hundreds of structural elements in vessel - \item Scale of the vessel: - $10^4$ bigger than smaller structural detail - \setbeamertemplate{itemize item}{$\Rightarrow$} - - \item Geometry defined with minimal data polygon $(R,Z)$\\ extruded along $\varphi$ - \item Symmetry of vessel along $\varphi$ - - \end{itemize} - - \vspace{0.5cm} - \begin{center} - \includegraphics[height=2.3cm]{figures/confB3_wp_view2.png}% - ~ - \includegraphics[height=2.3cm]{figures/confB3_wp_view1.png}% - ~ - \includegraphics[height=2.3cm]{figures/confB3_wp_view3.png}% - \end{center} - -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Optimization of ray-tracing algorithm} - -\begin{columns} -\begin{column}{0.65\textwidth} - \begin{itemize} - \item Description of geometry: - \begin{itemize} - \item Vessel and structures: set of 2D polygon $\mathcal{P}_j = \cup_{i=1}^n \overline{{\rm A}_i{\rm B}_i}$ - \item Extruded along $[\varphi_{min}, \varphi_{max}]$ - \item Detectors defined as set of rays (of origin $D$ and direction $u$) - \item[{$\Rightarrow$}] Light memory-wise - \end{itemize} - \item[{$\Rightarrow$}] Equivalent to: set of truncated cones (frustums) of generatrix $A_iB_i$ - - \end{itemize} -\end{column} -\begin{column}{0.35\textwidth} -\begin{center} - \includegraphics[width=\linewidth]{figures/tore_cones1.pdf} -\end{center} -\end{column} -\end{columns} - -\vspace{0.3cm} -\begin{alertblock}{Ray-tracing algorithm on fusion device $\longrightarrow$ Computation of cone-Ray intersection} -\end{alertblock} - -$$ -\hspace{-3cm} -\exists (q,k) \in [0;1]\times [0;\infty[, \; -\left\{\begin{array}{ll} -R-R_A = q(R_B-R_A)\\ -Z-Z_A = q(Z_B-Z_A)\\ -DM = k u -\end{array}\right. -$$ - -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{Optimization of ray-tracing algorithm} - - -Cone-Ray intersection algorithm: - \begin{itemize} - \item Main steps: - \begin{itemize} - \item Test intersection \textbf{bounding-box} - \item \textbf{special cases} (ray direction, segment, etc.) - \item General case: solution of a\textbf{ quadratic equation} - \end{itemize} - \item Pre-computation of variables - \item Core functions in \textbf{Cython} - \item Parallelization (\textbf{prange} loops) - \end{itemize} -\pause -\begin{table}[h] % just use this specifier if really needed. - \centering - \label{tab:LOS_init_sirrah} - \sisetup{round-mode=places} - \begin{tabular}{@{}l*{4}{S[table-format=1.2e-1,scientific-notation=true]}@{}} - \toprule - \textbf{Nb LOS} & {$10^3$} & {$10^4$} & {$10^5$} & {$10^6$}\\ - \midrule - original & 32.569 & 310.23 & 3202.38 & 31723.827 $(~8$h$48)$\\ - optimized & 0.0258 & 0.2720 & 2.73581 & 26.589564 $(<30$s$)$\\ - 32 threads & 0.0136 & 0.0466 & 0.3640 & 2.9188 \\ - \bottomrule - \end{tabular} -\end{table} - - -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{Tofu's structure} - -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/tofu.pdf} -\end{center} - -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Optimization of spatial integration routines} - -Integration of \textbf{user-defined function} along a LOS: - \begin{itemize} - \item Integration of a python function \textbf{func} defined by user by: - \begin{itemize} - \item \textbf{numpy}.sum (quad: \textbf{midpoint}) - \item Cython based sum (quad: \textbf{midpoint}) - \item \textbf{Scipy}.integrate.simps - \item \textbf{Scipy}.integrate.romb - \end{itemize} - \item Optional optimizations: - \begin{itemize} - \item calls to \textbf{func}: avoid Cython-Python conversion, user-defined - \item memory: fine resolutions, high number of LOS - \item hybrid: compromise - \end{itemize} - \end{itemize} - -\end{frame} -% ================================= - - -%% ================================= -%\begin{frame} -%\frametitle{Optimization of spatial integration routines} -% \begin{figure} -% \begin{tikzpicture} -% \begin{axis}[ -% mbarplot, -% xlabel={Number of Lines of Sight}, -% ylabel={Execution time}, -% width=0.9\textwidth, -% height=6cm, -% xticklabels={$0$,,$10$,,$10^2$, ,$10^3$,,$10^4$}] -% ] -% -% \addplot plot coordinates {(1, 0.46) (2, 2.24) (3, 18.1) }; -% \addplot plot coordinates {(1, 18) (2, 24) (3, 23.5) (4, 13.2)}; -% \addplot plot coordinates {(1, 0.2) (2, 0.53) (3, 4.32) (4, 40)}; -% \addplot plot coordinates {(1, 0.08) (2, 0.44) (3, 4.4) (4, 40)}; -% -% \legend{ref, mem, calls, hybd} -% -% \end{axis} -% \end{tikzpicture} -% \end{figure} -% \vspace{-0.2cm} -% \begin{itemize} -% \item Space resolution: $10^{-3}$ -% \item Number of time steps: $10^3$ -% \item Integration method: \textbf{sum} (Cython or numpy) on midpoint -% \end{itemize} -% \end{frame} -% -% -%% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Optimization of spatial integration routines} - -\begin{table}[h] % just use this specifier if really needed. - \centering - \label{tab:LOS_init_sirrah} - \sisetup{round-mode=places} - \begin{tabular}{@{}lllll@{}} - \toprule - \textbf{LOS} & {$10$} & {$10^2$} & {$10^3$} & {$10^4$} \\% & {$10^5$}\\ - \midrule - original & 0.46 & 2.24 & 18.1 & x \\%& x \\ - memory & 0.9 & 8.9 & 96 & 945 (6Gb)\\ - calls & 0.207 & 0.53 & 4.32 & x \\ - hybrid & 0.08 & 0.44 & 4.2 & 40.3 (32Gb) \\%& 612 (32Gb)\\ - \bottomrule - \end{tabular} -\end{table} - - \vspace{-0.2cm} - \begin{itemize} - \item Space resolution: $10^{-3}$ - \item Number of time steps: $10^3$ - \item Integration method: \textbf{sum} (Cython or numpy) on midpoint - \end{itemize} - \end{frame} -% ================================= - - -\section{What's next} - - -% ================================= -\begin{frame} -\frametitle{Tofu's structure} - -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/tofu.pdf} -\end{center} - -\end{frame} -% ================================= - -% -%% ================================= -%\begin{frame} -%\frametitle{Optimization of ray-tracing algorithm} -% -% -%$$ -%\hspace{-3cm} -%\exists (q,k) \in [0;1]\times [0;\infty[, \; -%\left\{\begin{array}{ll} -%R-R_A = q(R_B-R_A)\\ -%Z-Z_A = q(Z_B-Z_A)\\ -%DM = k u -%\end{array}\right. -%$$ -%\vspace{-0.5cm} -%\begin{columns} -%\begin{column}{0.65\textwidth} -% \begin{itemize} -% \item Vessel and structures defined as polygons -% \item Algorithm based on \textbf{cone-ray intersection} -% \item Core functions written in \textbf{cython} -% \item Parallelization using \textbf{OpenMP} -% \end{itemize} -%\end{column} -%\begin{column}{0.35\textwidth} -%\vspace{-1cm} -%\begin{center} -% \includegraphics[width=\linewidth]{figures/tore_cones1.pdf} -%\end{center} -%\end{column} -%\end{columns} -% -%\begin{table}[h] % just use this specifier if really needed. -% \centering -% \label{tab:LOS_init_sirrah} -% % Visionner le code LaTeX du paragraphe 0 -% \sisetup{round-mode=places} -% \begin{tabular}{@{}l*{4}{S[table-format=1.2e-1,scientific-notation=true]}@{}} -% \toprule -% \textbf{Nb LOS} & {$10^3$} & {$10^4$} & {$10^5$} & {$10^6$}\\ -% \midrule -% original & 32.569 & 310.23 & 3202.38 & 31723.827 $(~8$h$48)$\\ -% optimized & 0.0258 & 0.2720 & 2.73581 & 26.589564 $(<30$s$)$\\ -% 32 threads & 0.0136 & 0.0466 & 0.3640 & 2.9188 \\ -% \bottomrule -% \end{tabular} -%\end{table} -% -% -%\end{frame} -%% ================================= - - - - - - -% ================================= -\begin{frame} -\frametitle{Tofu's main algorithms} - - -\begin{columns} -\begin{column}{0.6\textwidth} -\textbf{Geometry}: - \begin{itemize} - \item Finite beam width (LOS $\Rightarrow$ VOS) - \item More advanced reflections - \item Thermal heat load computation - \end{itemize} -\end{column} -\begin{column}{0.4\textwidth} - -\begin{center} - \hspace{-0.5cm}\includegraphics[width=\linewidth]{figures/cones.png} -\end{center} -\end{column} -\end{columns} - -\vspace{0.2cm} -\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 -\end{itemize} - -\vspace{0.2cm} -\textbf{On the side}: -\begin{itemize} - \item Statistical data analysis (tofu / pandas interface) - \item Basic magnetic field line and particle trajectory tracing - \item continued IMAS support -\end{itemize} - -%\begin{center} -% \includegraphics[width=0.6\linewidth]{figures/meshes.png} -%\end{center} -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{On geometry discretization: meshing} - - -\begin{columns} -\begin{column}{0.6\textwidth} -Several options for poloidal cut meshing: - -\begin{itemize} - \item Cartesian mesh - \item Polar mesh - \item Adaptive polar mesh - \item Hexagonal mesh - \item Triangular mesh -\end{itemize} - -\end{column} -\begin{column}{0.4\textwidth} - -For basis functions: - -\begin{itemize} - \item B-splines - \item NURBS - \item Box-splines -\end{itemize} -\end{column} -\end{columns} - - - -\begin{center} - \includegraphics[width=0.85\linewidth]{figures/meshes.png} -\end{center} -\vspace{-0.5cm} -\end{frame} -% ================================= - - - - -% ================================= -\begin{frame} -\centering -\Huge{Thank you for your attention!} -%\includegraphics[width=\linewidth]{figures/cones.png} -\end{frame} -% ================================= - - -% ================================= -\subsection*{Splines interpolation} -\begin{frame} - \frametitle{B(asis)-Splines basis*} - - B-Splines of degree $d$ are defined by the \textbf{recursion} formula: - - \begin{equation} - B_j^{d+1}(x)= \dfrac{x - x_j}{x_{j+d}-x_j} B_j^d(x)+ \dfrac{x_{j+1} - x}{x_{j+d+1} - x_{j+1}} B_{j+1}^d (x) - \end{equation} - - Some important properties about B-splines: - - \begin{itemize} - \item Piece-wise polynomials of degree $d \quad \Rightarrow$ \textbf{smoothness} - \item Compact support $\Rightarrow$ \textbf{sparse matrix system} - \item Partition of unity $\sum_j Bj (x) = 1$, $\forall x \quad \Rightarrow$ \textbf{conservation laws} - \end{itemize} - - \begin{center} - \includegraphics[width = 0.3\textwidth]{\figurespath/bsplines1.png} - \includegraphics[width = 0.3\textwidth]{\figurespath/bsplines3.png} - \includegraphics[width = 0.3\textwidth]{\figurespath/bsplines5.png} - \end{center} - -\end{frame} -% ================================= - - -\end{document} - diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/Config01.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/Config01.pdf deleted file mode 100644 index 022a22133..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/Config01.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/ITER.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/ITER.pdf deleted file mode 100644 index 1e95a16f4..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/ITER.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/Tomography.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/Tomography.pdf deleted file mode 100644 index d602866cd..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/Tomography.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/background.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/background.png deleted file mode 100644 index b01cc16ed..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/background.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/badges.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/badges.png deleted file mode 100644 index 93f256d05..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/badges.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines1.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines1.png deleted file mode 100644 index e9ab358a1..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines1.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines3.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines3.png deleted file mode 100644 index 2c365306e..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines3.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines5.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines5.png deleted file mode 100644 index 391f9bdb1..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/bsplines5.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d.png deleted file mode 100644 index dd2084ef7..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_bis.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_bis.pdf deleted file mode 100644 index bad7dfe86..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_bis.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_bis_ref.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_bis_ref.pdf deleted file mode 100644 index 69c154ebe..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_bis_ref.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_ref.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_ref.png deleted file mode 100644 index 2a6d28f1b..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam1d_ref.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d.png deleted file mode 100644 index cac3efc5b..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_bis.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_bis.pdf deleted file mode 100644 index b393d2507..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_bis.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_bis_ref.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_bis_ref.pdf deleted file mode 100644 index d913accf9..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_bis_ref.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_ref.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_ref.png deleted file mode 100644 index 5cb76a83c..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cam2d_ref.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/ci.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/ci.pdf deleted file mode 100644 index 5e2f27828..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/ci.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/cones.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/cones.png deleted file mode 100644 index 2f1076faa..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/cones.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view1.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view1.png deleted file mode 100644 index a9627d92d..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view1.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view2.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view2.png deleted file mode 100644 index 806e3c881..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view2.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view3.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view3.png deleted file mode 100644 index bd57b9ef8..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/confB3_wp_view3.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/detectors2.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/detectors2.png deleted file mode 100644 index b81669b0e..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/detectors2.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/geom_B2.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/geom_B2.png deleted file mode 100644 index 2b28a0f81..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/geom_B2.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/geom_B3.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/geom_B3.png deleted file mode 100644 index 53a6098fc..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/geom_B3.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/meshes.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/meshes.png deleted file mode 100644 index a5bb8c6d6..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/meshes.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/newiter.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/newiter.png deleted file mode 100644 index d1eab858b..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/newiter.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/nuclear-power.jpg b/Notes_Upgrades/Communications/Euroscipy2019/figures/nuclear-power.jpg deleted file mode 100644 index e2a3e622b..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/nuclear-power.jpg and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/oil-power.jpg b/Notes_Upgrades/Communications/Euroscipy2019/figures/oil-power.jpg deleted file mode 100644 index 0951184ff..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/oil-power.jpg and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/qr-code.png b/Notes_Upgrades/Communications/Euroscipy2019/figures/qr-code.png deleted file mode 100644 index cc3ce60ce..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/qr-code.png and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/reaction.tex b/Notes_Upgrades/Communications/Euroscipy2019/figures/reaction.tex deleted file mode 100644 index a991b29a2..000000000 --- a/Notes_Upgrades/Communications/Euroscipy2019/figures/reaction.tex +++ /dev/null @@ -1,79 +0,0 @@ -% !TEX root = ../LM_defense.tex -% \begin{center} - - -\pgfdeclareradialshading{sphere}{\pgfpoint{0cm}{0cm}}% -{rgb(0cm)=(1,1,1); -rgb(0.7cm)=(0.7,0.1,0); rgb(1cm)=(0.5,0.05,0); rgb(1.05cm)=(1,1,1)} - - \begin{tikzpicture}[->,>=stealth',shorten >=10pt,auto,node distance=3cm, - very thick, color=black] - - \pgfdeclareradialshading{redsphere}{\pgfpoint{-0.2cm}{0.5cm}}% -{rgb(0cm)=(1,1,1); -color(0.7cm)=(beaurouge); color(1cm)=(beaurouge); rgb(1.05cm)=(1,1,1)} - - \pgfdeclareradialshading{greysphere}{\pgfpoint{-0.2cm}{0.5cm}}% -{rgb(0cm)=(1,1,1); -color(0.7cm)=(beaubleu); color(1cm)=(SchoolColor); rgb(1.05cm)=(1,1,1)} - - - \tikzset{plus/.style = {shape = circle, - ball color = SchoolColor, - text = black, - inner sep = 0pt, - outer sep = 0pt, - minimum size = 16 pt, - shading = redsphere}} - - \tikzset{neutron/.style = {shape = circle, - text = black, - inner sep = 0pt, - outer sep = 0pt, - minimum size = 16 pt, - shading = greysphere}} - - \tikzset{boom/.style = {shape = star, - star points = 10, - fill = myyellow, - text = black, - inner sep = 0pt, - outer sep = 0pt, - minimum size = 80 pt}} - - \node[plus] (Dplus) {}; - \node[neutron] (Dneutron) [below left of=Dplus,xshift=1.7cm,yshift=2.1cm]{n}; - - \node[boom] (star)[right of=Dplus,yshift = -1.2cm] {}; - - \node[plus] (Tplus2) [below of=Dplus,yshift=0.2cm,xshift=-8pt]{}; - \node[neutron] (Tneutron) [below right of=Tplus2,xshift=-1.65cm,yshift=2.1cm]{n}; - \node[neutron] (Tneutronbis) [below left of=Tplus2,xshift=1.65 cm,yshift=2.1cm]{n}; - - \node[plus] (Rplus1) [right of=Dplus,yshift = -1.2cm,xshift=0.3cm] {}; - \node[neutron] (Rneutron1) [below left of=Rplus1,xshift=1.8cm,yshift=2.1cm]{}; - \node[plus] (Rplus2) [below left of=Rneutron1,xshift=1.8cm,yshift=2.1cm]{}; - \node[neutron] (Rneutron2) [below right of=Rplus2,xshift=-2cm,yshift=1.9cm]{}; - \node[neutron] (Rneutron3) [right of=Rneutron2,xshift=-2.6 cm,yshift=0cm]{}; - - - \node[neutron] (Neutron) [right of=Rplus1,yshift=1.2cm]{n}; - - \node[plus] (HePlus) [right of=Rplus1,yshift=-1.2cm]{}; - \node[neutron] (Heneu2) [below right of=HePlus,yshift=1.9cm,xshift=-1.8cm]{n}; - \node[plus] (HePlus2) [below of=HePlus,yshift=2.5cm]{}; - \node[neutron] (Heneu3) [below left of=HePlus,yshift=1.9cm,xshift=1.8cm]{n}; - - \draw[->] (Dplus) to (Rplus2); - \draw[->] (Tneutron) to (Rplus2); - \draw[->] (Rplus1) to (Neutron); - \draw[->] (Rneutron3) to (Heneu3); - \node (texte1) [above of=Dplus,black,yshift=-2.3cm,xshift=-0.2cm] {Deuterium}; - \node(texte2)[below of=Tplus2,black,xshift=0cm,yshift=2.3cm] {Tritium}; - \node(texte3)[below of=HePlus,black,xshift=0cm,yshift=2cm] {Helium}; - -\end{tikzpicture} - - - - diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/solar-power.jpg b/Notes_Upgrades/Communications/Euroscipy2019/figures/solar-power.jpg deleted file mode 100644 index 3573cec05..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/solar-power.jpg and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/tofu.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/tofu.pdf deleted file mode 100644 index c026388fa..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/tofu.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/tore_cones1.pdf b/Notes_Upgrades/Communications/Euroscipy2019/figures/tore_cones1.pdf deleted file mode 100644 index f8e76942c..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/tore_cones1.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/Euroscipy2019/figures/wind-power.jpg b/Notes_Upgrades/Communications/Euroscipy2019/figures/wind-power.jpg deleted file mode 100644 index 92be901af..000000000 Binary files a/Notes_Upgrades/Communications/Euroscipy2019/figures/wind-power.jpg and /dev/null differ diff --git a/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.bib b/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.bib deleted file mode 100644 index b98edc6a2..000000000 --- a/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.bib +++ /dev/null @@ -1,10 +0,0 @@ -@article{didier2016, - title={Non-monotonic growth rates of sawtooth precursors evidenced with a new method on ASDEX Upgrade}, - author={Vezinet, D and Igochine, V and Weiland, M and Yu, Q and Gude, A and Meshcheriakov, D and Sertoli, M and EUROfusion MST1 Team and others}, - journal={Nuclear Fusion}, - volume={56}, - number={8}, - pages={086001}, - year={2016}, - publisher={IOP Publishing} -} \ No newline at end of file diff --git a/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.pdf b/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.pdf deleted file mode 100644 index 6911a5803..000000000 Binary files a/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.pdf and /dev/null differ diff --git a/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.tex b/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.tex deleted file mode 100644 index df05ec538..000000000 --- a/Notes_Upgrades/Communications/PyconFR2019/2019_LM_PyconFR.tex +++ /dev/null @@ -1,1074 +0,0 @@ -\documentclass[10pt]{beamer} - -\usepackage{appendixnumberbeamer} -% -%\usepackage{lmodern} -%\usepackage{wrapfig} -\usepackage{tikz} -%\usetikzlibrary{positioning} -\usetikzlibrary{arrows,shapes} -\usepackage{amsmath,esint,esvect} % arrow for vector, maths and more -%\usepackage{datetime} -\usepackage{gensymb}%for degree symbol -%\usepackage{beamerthemesplit} -%\usepackage{graphicx} %trimed images -%\usepackage{pifont} %for dings -% -%\usepackage{import} -%\usepackage{cases} -\usepackage{booktabs} %beautiful tables -\usepackage{pgfplots} -\usepgfplotslibrary{dateplot} -% -\usepackage{siunitx} % SI notations -\sisetup{table-number-alignment=center, exponent-product=\cdot} - - - - -% Bibliography includes -\usepackage[backend=bibtex, citestyle=verbose-trad2,bibstyle=authortitle-icomp,sortcites=true,block=space,firstinits=true]{biblatex} -\addbibresource{2019_LM_PyconFR.bib} -\usepackage{hyperref} - -\usetheme[progressbar=frametitle]{metropolis} - - - - \setbeamertemplate{itemize subitem}{\color{orange}$\blacktriangleright$} - -% --------------Math mode------------------ -\renewcommand\mathfamilydefault{\rmdefault} -% ----------------------------------------- - -% ------ Images path ------------------ -\newcommand{\figurespath}{./figures} - -%% ---------- Editing the footer ------------ -%\makeatother -%\setbeamertemplate{footline} -%{ -% \leavevmode% -% \hbox{% -% \begin{beamercolorbox}[wd=.6\paperwidth,ht=2.25ex,dp=1ex,center]{institute in head/foot}% -% \usebeamerfont{institute in head/foot}\insertshortinstitute -% \end{beamercolorbox}% -% \begin{beamercolorbox}[wd=.4\paperwidth,ht=2.25ex,dp=1ex,center]{date in head/foot}% -% \usebeamerfont{date in head/foot}\insertshortdate\hspace*{2em} -% \insertframenumber{} \hspace*{2ex} -% \end{beamercolorbox}}% -% \vskip0pt% -%} -%\makeatletter -%\setbeamertemplate{navigation symbols}{} -%% ----------------------------------------- - -% ------ Date definition ------------------ -% \newdate{date}{04}{09}{2019} -% ----------------------------------------- - -% ----------New color---------------------- -\definecolor{myblue}{RGB}{51,51,179} -\definecolor{beaubleu2}{cmyk}{1,0,0,0.71} -\definecolor{SchoolColor}{rgb}{0.6471, 0.1098, 0.1882} % Crimson -\definecolor{beaurouge}{HTML}{405684} -\definecolor{beaubleu}{HTML}{CC382C} -\definecolor{myyellow}{rgb}{0.99, 0.82, 0.35} -% ----------------------------------------- - -%% ---------Redifining foot cites----------- -\newrobustcmd*{\footlessfullcite}{\AtNextCite{\renewbibmacro{title}{}\renewbibmacro{in:}{}}\footfullcite} - -%\renewbibmacro{in:}{\hspace{-5pt}} -\AtEveryCitekey{\clearfield{pages}\clearfield{volume}\clearfield{url} -\clearfield{doi}\clearfield{issn}} -%% ----------------------------------------- - -% ---------First page variables------------ -\title{ToFu} -\subtitle{An open-source python/cython library for synthetic tomography diagnostics on tokamaks} -\author[Laura S. Mendoza] % (optional, for multiple authors) -{\textbf{Laura~S.~Mendoza}\inst{1}, \and Didier~Vezinet\inst{2}} -\institute[] % (optional) -{ - \inst{1}% - INRIA Grand-Est, - TONUS Team, Strasbourg, France\\ - - \inst{2}% - CEA, - Cadarache, France -} -\date[\displaydate{date}] % (optional) -{\alert{PyConFr 2019, Bordeaux, France}} -\subject{} - - -% ----------------------------------------- - -%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{document} - -\newcommand{\gradx}{\nablax} -\newcommand{\vpar}{v_\parallel} -\newcommand{\xvec}{\mathbf{x}} -\newcommand{\nablax}{\nabla_{\!\xvec}} - - -% ================================= -%\usebackgroundtemplate{\includegraphics[height=\paperheight,width=\paperwidth]{figures/background.png}}% -\begin{frame} - \titlepage -\end{frame} -% ================================= - -% ================================= -\begin{frame}{Table of contents} - \setbeamertemplate{section in toc}[sections numbered] - \tableofcontents[hideallsubsections] -\end{frame} -% ================================= - -\section{Context} - -% ================================= -\begin{frame} -\frametitle{Context: energy needs vs resources and climate change} - - \begin{center} - \includegraphics[height=1.8cm]{figures/oil-power.jpg}% - \includegraphics[height=1.8cm]{figures/solar-power.jpg}% - \includegraphics[height=1.8cm]{figures/nuclear-power.jpg}% - \includegraphics[height=1.8cm]{figures/wind-power.jpg} - \end{center} - -Worldwide growing energy needs (population, standards of living...)\\ -$\quad \Rightarrow$ Production of $CO_2$, limited resources, radioactive waste, not efficient enough, harmful to surrounding environment\\ - -$\quad \Rightarrow$ need to decrease consumption + alternative production means\\ - -$\quad \Rightarrow$ Need for cleaner, more reliable, more powerful energy source\\ - -%\begin{itemize}%[leftmargin=1em] -%\setbeamertemplate{itemize item}{$\Rightarrow$} -% \item \alert{Fusion}: cleaner, more reliable, more powerful energy source? -%\end{itemize} - -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Context: Controlled fusion and magnetic confinement} - -\begin{columns} - \begin{column}{0.65\textwidth} - \begin{center} - \textbf{D-T Fusion reaction\;\;\;}\vspace{0.3cm} - %\includegraphics[width=3.5cm]{figures/DT_reaction3.png} - \resizebox{0.5\textwidth}{!}{\input{figures/reaction.tex}} - \end{center} - \vspace{-0.5cm} - \begin{itemize}%[leftmargin=1em] - \item Gas $>$ 100 Million\degree K composed of positive ions and negative electrons: plasma - \item Confinement using electromagnetic fields - \item break-even not obtained yet - \end{itemize} - - \end{column} - - \begin{column}{0.35\textwidth} - \includegraphics[width=1.\textwidth]{figures/ITER.pdf} - \end{column} - -\end{columns} - -%\begin{itemize}%[leftmargin=1em] -\begin{center} -In a nutshell: toroidal vacuum vessel, filled with H plasma -\end{center}%\end{itemize} -\vspace{-0.2cm} -%%\begin{itemize}%[leftmargin=1em] -%%\setbeamertemplate{itemize item}{$\Rightarrow$} -%% \item \alert{Fusion codes:} complexity due to the number of parameters, geometry, model, etc. -%%\end{itemize} -\end{frame} -% ================================= - - -\section{Tomography diagnostics} - - -% ================================= -\begin{frame} -\frametitle{Tokamak diagnostics to measure plasma quantities} - - \metroset{block=fill} -\begin{alertblock}{Diagnostics} -Set of instruments to measure plasma quantities, for understanding, control, optimization. -\end{alertblock} - -e.g: magnetic field, neutrons, \textbf{emitted light}, temperature, density...\\[1cm] - - -$\quad \Rightarrow$ cameras (1D or 2D) for measuring light in various wavelengths - - -% -%\begin{itemize} -%\item \textbf{Magnetic} diagnostics: currents, plasma stored energy, plasma shape and position; -% -%\item \textbf{Neutron} diagnostics (ie. cameras, spectrometers, etc.): fusion power; -% -%\item Optical systems (\textbf{interferometers}): temperature and density profiles; -% -%\item Bolometric systems (\textbf{tomography}): spatial distribution of radiated power; -% -%\item \textbf{Spectroscopic}: X-ray wavelength range, impurity species and density, input particle flux, ion temperature, helium density, fueling ratio, plasma rotation, and current density. - -%\item Microwave diagnostics probe the main plasma and the plasma in the divertor region in order to measure plasma position. - -%\end{itemize} - -\end{frame} -% ================================= - - -%% ================================= -%\begin{frame} -%\frametitle{A tokamak as a poloidal + horizontal projections} -% -%\begin{columns} -% -% \begin{column}{0.25\textwidth} -% \includegraphics[width=1.\textwidth]{figures/ITER.pdf} -% \end{column} -% -% \begin{column}{0.75\textwidth} -% \begin{center} -% \textbf{tofu.geom.Config class} -% \end{center} -% \includegraphics[width=1.\textwidth]{figures/Config01.pdf} -% \end{column} -% -%\end{columns} -% -% -%\end{frame} -%% ================================= - - -% ================================= -\begin{frame} -\frametitle{Tomography diagnostics - numerical context} - \vspace{-0.75cm} - - $$M_i(t) = \iiint\limits_{V_i} \vv{\varepsilon(x,t)}\cdot\vv{n} \,\Omega_i \;{d}V$$ - \vspace{-0.75cm} -\begin{columns} - \begin{column}{0.325\textwidth} - - %\def\svgwidth{\linewidth} - %\import{figures/}{detectors.pdf_tex} - \includegraphics[width=\linewidth,trim={0 0 1cm 0}]{figures/Tomography.pdf} - - \end{column} - - \begin{column}{0.675\textwidth} - \begin{center} - - %DIRECT PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Direct problem} (synthetic diagnostic):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Simulated emissivity $\longrightarrow$ integrated measurements\\ - - %INVERSE PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Inverse problem} (tomography):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Integrated measurements $\longrightarrow$ Reconstructed emissivity \\ - - \end{center} - - \end{column} -% -\end{columns} - - -\end{frame} -% ================================= - - - - -% ================================= -\begin{frame} -\frametitle{Tomography diagnostics - numerical context} - - $$M_i(t) = \iiint\limits_{V_i} \vv{\varepsilon(x,t)}\cdot\vv{n} \,\Omega_i \;{d}V$$ - \vspace{-1cm} -\begin{columns} - \begin{column}{0.325\textwidth} - - %\def\svgwidth{\linewidth} - %\import{figures/}{detectors.pdf_tex} - \includegraphics[width=\linewidth,trim={0 0 1cm 0}]{figures/Tomography.pdf} - - \end{column} - - \begin{column}{0.675\textwidth} - \begin{center} - - %DIRECT PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Direct problem} (synthetic diagnostic):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Simulated emissivity $\longrightarrow$ measurements\\ - \alert{Spatial integration} - \vspace{-0.5cm} - - %INVERSE PROBLEM - \begin{block}{} - \begin{itemize} - \item \textcolor{myblue}{\textbf{Inverse problem} (tomography):\\ - } - \end{itemize} - \end{block} - %\textbf{Direct problem} (synthetic diagnostic):\\ -Integrated measurements $\longrightarrow$ Reconstructed emissivity \\ - \alert{Mesh and basis functions construction, spatial integration, data filtering, inversion routines, etc.} - - \end{center} - - \end{column} -% -\end{columns} - -\pause -\vspace{-0.5cm} -\begin{block}{} -\begin{center} -Tomography is \textbf{ill-posed}, very sensitive to errors, noise and bias\\ -$\longrightarrow$ \alert{Reputation for low reproducibility / reliability } -\end{center} - \end{block} -\end{frame} -% ================================= - - - -\section{The ToFu package} - - -% ================================= -\begin{frame} -\frametitle{Motivation: ``current" state} - - In the fusion community, codes for tomography diagnostic are often: - \begin{itemize} - \item developed by physicists (with little programming experience) - \item in Matlab (or IDL) - \item written from scratch, re-done by new students - \item not distributed (few users), rarely documented - \end{itemize} - -... which means -\begin{itemize} - \item waste of resources: time, man-power - \item low traceability, reproducibility - \item low standardization, unclear assumptions / methods - \end{itemize} - -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{A code for Tomography for Fusion} -\textbf{Develop a common tool:} -\begin{columns} -\begin{column}{0.65\textwidth} - \begin{itemize} - \item Generic (geometry independent) - \item Portable (Python) - \item Optimized / parallelized - \item Documented online - \item Continuous integration - \end{itemize} -\end{column} -\begin{column}{0.35\textwidth} -\vspace{-1cm} -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/ci.pdf} -\end{center} -\end{column} -\end{columns} -\vspace{-0.9cm} - -\begin{block}{} - \begin{center} - \alert{\textbf{ToFu}\footnote{repository: \url{https://github.com/ToFuProject/tofu}}\footnote{documentation: \url{https://tofuproject.github.io/tofu/index.html} }\footcite{didier2016}} = \alert{\textbf{To}mography for \textbf{Fu}sion} - \end{center} -\vspace{-5mm} -\end{block} - -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{More about Tofu} - -\begin{columns} -\begin{column}{0.65\textwidth} -\begin{itemize} - \item Created in 2014 - \item Open Source:\textbf{ MIT license} - \item Python 2.7 and \textbf{Python} 3 + \textbf{Cython} - \item Continuous integration: \textbf{Travis} CI - \item \textbf{conda}, \textbf{pip} - \item Two (main) developers: - \begin{itemize} - \item Didier Vezinet (creator, Physics) - \item Laura S. Mendoza (since 06.2018, Applied Maths) - \end{itemize} - \item Contributors: - \begin{itemize} - \item Jorge Morales - \item Florian Le Bourdais - \item Arpan Khandelwal - \item Koyo Munechika - \end{itemize} -\end{itemize} -\end{column} -\begin{column}{0.35\textwidth} -\begin{center} - \includegraphics[width=\textwidth]{figures/qr-code.png} -\end{center} -\end{column} -\end{columns} -\begin{center} - \includegraphics[width=\textwidth]{figures/badges.png} -\end{center} - -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{Tofu's structure} - -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/tofu.pdf} -\end{center} - -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{Tofu's geometry representation} - -\begin{center} - \includegraphics[width=0.6\linewidth]{figures/ITER.pdf} -\end{center} - -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{Tofu's geometry representation} - -\begin{center} - \includegraphics[width=\linewidth]{figures/newiter.png} -\end{center} - -\end{frame} -% ================================= - - -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: modeling of simplified geometry} -% \begin{center} -% \includegraphics[width=\textwidth,trim={0 0 4cm 0}]{figures/geom_B3.png} -% \end{center} -%\end{frame} -%% ================================= -% -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: 3D modeling of a 1D camera} -% \begin{center} -% \includegraphics[width=\textwidth]{figures/cam1d.png} -% \end{center} -%\end{frame} -%% ================================= -% -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: 3D modeling of a 2D camera} -% \begin{center} -% \includegraphics[width=\textwidth]{figures/cam2d.png} -% \end{center} -%\end{frame} -%% ================================= - - -% ================================= -\begin{frame} -\frametitle{tofu.geom: modeling of simplified geometry} -\begin{columns} -% \begin{column}{0.33\textwidth} -% \begin{center} -% \textbf{Geometry configuration} -% \includegraphics[width=\textwidth,trim={0 0 6cm 0}]{figures/geom_B3.png} -% \end{center} -% \pause -% \end{column} - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{1D Camera\\(tofu.geom.CamLOS1D)} - \includegraphics[width=\textwidth]{figures/cam1d_bis.pdf} - \end{center} - \end{column} - \pause - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{2D Camera\\(tofu.geom.CamLOS2D)} - \includegraphics[width=\textwidth]{figures/cam2d_bis.pdf} - \end{center} - \end{column} - \end{columns} -\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{tofu.geom: handle basic reflexions} -\begin{columns} -% \begin{column}{0.33\textwidth} -% \begin{center} -% \textbf{Geometry configuration} -% \includegraphics[width=\textwidth,trim={0 0 6cm 0}]{figures/geom_B3.png} -% \end{center} -% \pause -% \end{column} - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{1D Camera with reflexions\\(tofu.geom.CamLOS1D)} - \includegraphics[width=\textwidth]{figures/cam1d_bis_ref.pdf} - \end{center} - \end{column} - \begin{column}{0.5\textwidth} - \begin{center} - \textbf{2D Camera with reflexions\\(tofu.geom.CamLOS2D)} - \includegraphics[width=\textwidth]{figures/cam2d_bis_ref.pdf} - \end{center} - \end{column} - \end{columns} -\end{frame} -% ================================= - -%% ================================= -%\begin{frame} -%\frametitle{What ToFu can do: computing synthetic signals} -% -%\end{frame} -% ================================= - -% ================================= -\begin{frame} -\frametitle{What ToFu can do} -\begin{itemize} - \item Model simplified 3D geometry - \item 3D modeling of a 1D and 2D LOS camera - \item Handle basic reflections - \item Computing synthetic signals - \item Native support for IMAS interfacing - \item Data easy interactive visualization and basic treatment - \pause - \item ...and soon (being re-written / developed): - \begin{itemize} - \item finite beam width (VOS, in 1.4.2, late 2019) - \item meshing and basis functions (mid 2020) - \item tomographic inversion (late 2020 - 2021) - \item dust particle trajectory tracking (new, Arpan) - \item faster Matplotlib + PyQtGraph visualization - \item magnetic field line tracing (new) - \item statistical data analysis (pandas) integrated - \end{itemize} -\end{itemize} -\end{frame} - - -\section{Code Optimization} - - -% ================================= -\begin{frame} -\frametitle{Geometry reconstruction: ray-tracing techniques} - - To reconstruct emissivity we need to take account: - \begin{itemize} - \item Up to hundreds of structural elements in vessel - \item Scale of the vessel: - $10^4$ bigger than smaller structural detail - \setbeamertemplate{itemize item}{$\Rightarrow$} - - \item Geometry defined with minimal data polygon $(R,Z)$\\ extruded along $\varphi$ - \item Symmetry of vessel along $\varphi$ - - \end{itemize} - - \vspace{0.5cm} - \begin{center} - \includegraphics[height=2.3cm]{figures/confB3_wp_view2.png}% - ~ - \includegraphics[height=2.3cm]{figures/confB3_wp_view1.png}% - ~ - \includegraphics[height=2.3cm]{figures/confB3_wp_view3.png}% - \end{center} - -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Optimization of ray-tracing algorithm} - -\begin{columns} -\begin{column}{0.65\textwidth} - \begin{itemize} - \item Description of geometry: - \begin{itemize} - \item Vessel and structures: set of 2D polygon $\mathcal{P}_j = \cup_{i=1}^n \overline{{\rm A}_i{\rm B}_i}$ - \item Extruded along $[\varphi_{min}, \varphi_{max}]$ - \item Detectors defined as set of rays (of origin $D$ and direction $u$) - \item[{$\Rightarrow$}] Light memory-wise - \end{itemize} - \item[{$\Rightarrow$}] Equivalent to: set of truncated cones (frustums) of generatrix $A_iB_i$ - - \end{itemize} -\end{column} -\begin{column}{0.35\textwidth} -\begin{center} - \includegraphics[width=\linewidth]{figures/tore_cones1.pdf} -\end{center} -\end{column} -\end{columns} - -\vspace{0.3cm} -\begin{alertblock}{Ray-tracing algorithm on fusion device $\longrightarrow$ Computation of cone-Ray intersection} -\end{alertblock} - -$$ -\hspace{-3cm} -\exists (q,k) \in [0;1]\times [0;\infty[, \; -\left\{\begin{array}{ll} -R-R_A = q(R_B-R_A)\\ -Z-Z_A = q(Z_B-Z_A)\\ -DM = k u -\end{array}\right. -$$ - -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{Optimization of ray-tracing algorithm} - - - \begin{itemize} - \item Algorithmic optimizations: - \begin{itemize} - \item Test intersection \textbf{bounding-box} - \item \textbf{special cases} (ray direction, segment, etc.) - \item Cone-Ray intersection algorithm: solution of a\textbf{ quadratic equation} - \end{itemize} - \item Pre-computation of variables - \item Core functions in \textbf{Cython} - \item OpenMP parallelization (Cython \textbf{prange} loops) - \end{itemize} -\pause -\begin{table}[h] % just use this specifier if really needed. - \centering - \label{tab:LOS_init_sirrah} - \sisetup{round-mode=places} - \begin{tabular}{@{}l*{4}{S[table-format=1.2e-1,scientific-notation=true]}@{}} - \toprule - \textbf{Nb LOS} & {$10^3$} & {$10^4$} & {$10^5$} & {$10^6$}\\ - \midrule - original & 32.569 & 310.23 & 3202.38 & 31723.827 $(~8$h$48)$\\ - optimized & 0.0258 & 0.2720 & 2.73581 & 26.589564 $(<30$s$)$\\ - 32 threads & 0.0136 & 0.0466 & 0.3640 & 2.9188 \\ - \bottomrule - \end{tabular} -\end{table} -\end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{Tofu's structure} - -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/tofu.pdf} -\end{center} - -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Optimization of spatial integration routines} - -Integration of \textbf{user-defined function} along a LOS: - \begin{itemize} - \item Integration of a python function \textbf{func} defined by user by: - \begin{itemize} - \item \textbf{numpy}.sum (quad: \textbf{midpoint}) - \item Cython based sum (quad: \textbf{midpoint}) - \item \textbf{Scipy}.integrate.simps - \item \textbf{Scipy}.integrate.romb - \end{itemize} - \item Optional optimizations: - \begin{itemize} - \item calls to \textbf{func}: avoid Cython-Python conversion, user-defined - \item memory: fine resolutions, high number of LOS - \item hybrid: compromise - \end{itemize} - \end{itemize} - -\end{frame} -% ================================= - - -%% ================================= -%\begin{frame} -%\frametitle{Optimization of spatial integration routines} -% \begin{figure} -% \begin{tikzpicture} -% \begin{axis}[ -% mbarplot, -% xlabel={Number of Lines of Sight}, -% ylabel={Execution time}, -% width=0.9\textwidth, -% height=6cm, -% xticklabels={$0$,,$10$,,$10^2$, ,$10^3$,,$10^4$}] -% ] -% -% \addplot plot coordinates {(1, 0.46) (2, 2.24) (3, 18.1) }; -% \addplot plot coordinates {(1, 18) (2, 24) (3, 23.5) (4, 13.2)}; -% \addplot plot coordinates {(1, 0.2) (2, 0.53) (3, 4.32) (4, 40)}; -% \addplot plot coordinates {(1, 0.08) (2, 0.44) (3, 4.4) (4, 40)}; -% -% \legend{ref, mem, calls, hybd} -% -% \end{axis} -% \end{tikzpicture} -% \end{figure} -% \vspace{-0.2cm} -% \begin{itemize} -% \item Space resolution: $10^{-3}$ -% \item Number of time steps: $10^3$ -% \item Integration method: \textbf{sum} (Cython or numpy) on midpoint -% \end{itemize} -% \end{frame} -% -% -%% ================================= - - - -% ================================= -\begin{frame} -\frametitle{Optimization of spatial integration routines} - -\begin{table}[h] % just use this specifier if really needed. - \centering - \label{tab:LOS_init_sirrah} - \sisetup{round-mode=places} - \begin{tabular}{@{}lllll@{}} - \toprule - \textbf{LOS} & {$10$} & {$10^2$} & {$10^3$} & {$10^4$} \\% & {$10^5$}\\ - \midrule - original & 0.46 & 2.24 & 18.1 & x \\%& x \\ - memory & 0.9 & 8.9 & 96 & 945 (6Gb)\\ - calls & 0.207 & 0.53 & 4.32 & x \\ - hybrid & 0.08 & 0.44 & 4.2 & 40.3 (32Gb) \\%& 612 (32Gb)\\ - \bottomrule - \end{tabular} -\end{table} - - \vspace{-0.2cm} - \begin{itemize} - \item Space resolution: $10^{-3}$ - \item Number of time steps: $10^3$ - \item Integration method: \textbf{sum} (Cython or numpy) on midpoint - \end{itemize} - \end{frame} -% ================================= - - -% ================================= -\begin{frame} -\frametitle{What we've learned on code optimization} - -Importance of \textbf{cross disciplinary} expert collaborations: - - \begin{itemize} - \item Understand and define the problem (physics) - \item Create optimal algorithm (mathematics) - \item Write efficient code (computer science) - \end{itemize} - -...and from there: - - \begin{itemize} - \item \textbf{Profile} your code - \item Core functions: \textbf{Cython} (or Numba or Transonic or ...) - \item Cython specific: - \begin{itemize} - \item \textbf{cython --annotate} - \item \textbf{type} your variables and \textbf{inline} your functions! - \item use cython decorators: \textbf{@cython.boundscheck(False)}, \textbf{@cython.wraparound(False)} - \item release the gil (when possible)! - \item see more: \href{https://github.com/ToFuProject/tofu/blob/master/Notebooks/Cython_speedup_notes.ipynb}{\textcolor{blue}{my notes}}, \href{https://github.com/jeremiedbb/tutorial-euroscipy-2019}{\textcolor{blue}{Jeremie du Boisberranger's tutorial}} - - \end{itemize} - \end{itemize} - -\end{frame} -% ================================= - - -\section{What's next} - - -% ================================= -\begin{frame} -\frametitle{Tofu's structure} - -\begin{center} - \includegraphics[width=0.8\linewidth]{figures/tofu.pdf} -\end{center} - -\end{frame} -% ================================= - -% -%% ================================= -%\begin{frame} -%\frametitle{Optimization of ray-tracing algorithm} -% -% -%$$ -%\hspace{-3cm} -%\exists (q,k) \in [0;1]\times [0;\infty[, \; -%\left\{\begin{array}{ll} -%R-R_A = q(R_B-R_A)\\ -%Z-Z_A = q(Z_B-Z_A)\\ -%DM = k u -%\end{array}\right. -%$$ -%\vspace{-0.5cm} -%\begin{columns} -%\begin{column}{0.65\textwidth} -% \begin{itemize} -% \item Vessel and structures defined as polygons -% \item Algorithm based on \textbf{cone-ray intersection} -% \item Core functions written in \textbf{cython} -% \item Parallelization using \textbf{OpenMP} -% \end{itemize} -%\end{column} -%\begin{column}{0.35\textwidth} -%\vspace{-1cm} -%\begin{center} -% \includegraphics[width=\linewidth]{figures/tore_cones1.pdf} -%\end{center} -%\end{column} -%\end{columns} -% -%\begin{table}[h] % just use this specifier if really needed. -% \centering -% \label{tab:LOS_init_sirrah} -% % Visionner le code LaTeX du paragraphe 0 -% \sisetup{round-mode=places} -% \begin{tabular}{@{}l*{4}{S[table-format=1.2e-1,scientific-notation=true]}@{}} -% \toprule -% \textbf{Nb LOS} & {$10^3$} & {$10^4$} & {$10^5$} & {$10^6$}\\ -% \midrule -% original & 32.569 & 310.23 & 3202.38 & 31723.827 $(~8$h$48)$\\ -% optimized & 0.0258 & 0.2720 & 2.73581 & 26.589564 $(<30$s$)$\\ -% 32 threads & 0.0136 & 0.0466 & 0.3640 & 2.9188 \\ -% \bottomrule -% \end{tabular} -%\end{table} -% -% -%\end{frame} -%% ================================= - - - - - - -% ================================= -\begin{frame} -\frametitle{Tofu's main algorithms} - - -\begin{columns} -\begin{column}{0.6\textwidth} -\textbf{Geometry}: - \begin{itemize} - \item Finite beam width (LOS $\Rightarrow$ VOS) - \item More advanced reflections - \item Thermal heat load computation - \end{itemize} -\end{column} -\begin{column}{0.4\textwidth} - -\begin{center} - \hspace{-0.5cm}\includegraphics[width=\linewidth]{figures/cones.png} -\end{center} -\end{column} -\end{columns} - -\vspace{0.2cm} -\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 -\end{itemize} - -\vspace{0.2cm} -\textbf{On the side}: -\begin{itemize} - \item Statistical data analysis (tofu / pandas interface) - \item Basic magnetic field line and particle trajectory tracing - \item continued IMAS support -\end{itemize} - -%\begin{center} -% \includegraphics[width=0.6\linewidth]{figures/meshes.png} -%\end{center} -\end{frame} -% ================================= - - - -% ================================= -\begin{frame} -\frametitle{On geometry discretization: meshing} - - -\begin{columns} -\begin{column}{0.6\textwidth} -Several options for poloidal cut meshing: - -\begin{itemize} - \item Cartesian mesh - \item Polar mesh - \item Adaptive polar mesh - \item Hexagonal mesh - \item Triangular mesh -\end{itemize} - -\end{column} -\begin{column}{0.4\textwidth} - -For basis functions: - -\begin{itemize} - \item B-splines - \item NURBS - \item Box-splines -\end{itemize} -\end{column} -\end{columns} - - - -\begin{center} - \includegraphics[width=0.85\linewidth]{figures/meshes.png} -\end{center} -\vspace{-0.5cm} -\end{frame} -% ================================= - - - - -% ================================= -\begin{frame} -\frametitle{} -{\centering -{\Huge Thank you for your attention!}} -\vspace{3cm} - -{\footnotesize \emph{ This work has been carried out within the framework of the EUROfusion Consortium and has received funding from the Euratom research and training programme 2014-2018 and 2019-2020 under grant agreement No 633053. The views and opinions expressed herein do not necessarily reflect those of the European Commission.}} -\end{frame} -% ================================= - - -% ================================= -\subsection*{Splines interpolation} -\begin{frame} - \frametitle{B(asis)-Splines basis*} - - B-Splines of degree $d$ are defined by the \textbf{recursion} formula: - - \begin{equation} - B_j^{d+1}(x)= \dfrac{x - x_j}{x_{j+d}-x_j} B_j^d(x)+ \dfrac{x_{j+1} - x}{x_{j+d+1} - x_{j+1}} B_{j+1}^d (x) - \end{equation} - - Some important properties about B-splines: - - \begin{itemize} - \item Piece-wise polynomials of degree $d \quad \Rightarrow$ \textbf{smoothness} - \item Compact support $\Rightarrow$ \textbf{sparse matrix system} - \item Partition of unity $\sum_j Bj (x) = 1$, $\forall x \quad \Rightarrow$ \textbf{conservation laws} - \end{itemize} - - \begin{center} - \includegraphics[width = 0.3\textwidth]{\figurespath/bsplines1.png} - \includegraphics[width = 0.3\textwidth]{\figurespath/bsplines3.png} - \includegraphics[width = 0.3\textwidth]{\figurespath/bsplines5.png} - \end{center} - -\end{frame} -% ================================= - - -\end{document} - diff --git a/Notes_Upgrades/Communications/PyconFR2019/figures b/Notes_Upgrades/Communications/PyconFR2019/figures deleted file mode 120000 index b8d0ba1c6..000000000 --- a/Notes_Upgrades/Communications/PyconFR2019/figures +++ /dev/null @@ -1 +0,0 @@ -../Euroscipy2019/figures \ No newline at end of file diff --git a/Notes_Upgrades/Eurofusion/EEG-Interim_Report_template_2MS6HK_v2_0.pages b/Notes_Upgrades/Eurofusion/EEG-Interim_Report_template_2MS6HK_v2_0.pages deleted file mode 100755 index a2cd6c67a..000000000 Binary files a/Notes_Upgrades/Eurofusion/EEG-Interim_Report_template_2MS6HK_v2_0.pages and /dev/null differ diff --git a/Notes_Upgrades/Eurofusion/MENDOZA_IR01_31-12-2018.pdf b/Notes_Upgrades/Eurofusion/MENDOZA_IR01_31-12-2018.pdf deleted file mode 100644 index 818aa7d48..000000000 Binary files a/Notes_Upgrades/Eurofusion/MENDOZA_IR01_31-12-2018.pdf and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.pdf b/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.pdf index 889a32a34..da9e97ee0 100644 Binary files a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.pdf and b/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.pdf differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.tex b/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.tex index ab152264a..c629f0178 100644 --- a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.tex +++ b/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/benchmarking.tex @@ -1,15 +1,11 @@ \documentclass[11pt]{amsart} -\usepackage{geometry} -\geometry{letterpaper} +\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots. +\geometry{letterpaper} % ... or a4paper or a5paper or ... %\geometry{landscape} % Activate for for rotated page geometry -%\usepackage[parfill]{parskip} -% Activate to begin paragraphs with an empty line rather than an indent +%\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent \usepackage{graphicx} \usepackage{amssymb} \usepackage{epstopdf} -\usepackage{booktabs} -\usepackage{siunitx} % international system units, for tabs to align at dot - \DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png} \title{\Large ToFu's benchmarking\\ @@ -18,207 +14,79 @@ \author{Laura S. Mendoza} \author{Didier Vezinet} -\date{} % Activate to display a given date or no date +%\date{} % Activate to display a given date or no date \begin{document} \maketitle \section{Starting Point} -ToFu's versioning is set automatically with each \verb|git| tag. -We will set as a reference point the version number \verb|1.3.22-6-g45cb446|, -which also corresponds to the \verb|git| tag. +ToFu's versioning is set automatically with each \verb|git| tag. We will set as a reference point the version number \verb|1.3.22-6-g45cb446|, which also corresponds to the \verb|git| tag. + +\subsection{Set of tests} -\subsection{Geometry definitions} -\label{sect:configs} -In order to have an extensive benchmarking, we need to set a series of tests -configurations that will encompass the maximum scenarios, as well as allow us -to test the speed-up of simple yet essential methods. Let us first define the -different geometries:\\ +In order to have an extensive benchmarking, we need to set a series of tests configurations that will encompass the maximum scenarios, as well as allow us to test the speed-up of simple yet essential methods. Let us first define the different geometries:\\ \begin{itemize} \item Tests with only a vessel: \begin{itemize} - \item Config A1: + \item   Config A1: \begin{itemize} - \item WEST -- V1 (realistic) : 63 points + \item  WEST -- V1 (realistic) : 63 points \end{itemize} - \item Config A2: - \begin{itemize} - \item TER -- Test (artificial) : 551 points + \item   Config A2: + \begin{itemize} + \item  TER -- Test (artificial) : 551 points \end{itemize} - \item Config A3: + \item   Config A3: \begin{itemize} - \item WESTSep -- Test (artificial, inspired by the - separatrix of an experimental shock of WEST) : 1001 points\\ + \item  WESTSep -- Test (artificial, inspired by the separatrix of an experimental shock of WEST) : 1001 points\\ \end{itemize} \end{itemize} - \item Tests with a vessel and structural elements: + \item      Tests with a vessel and structural elements: \begin{itemize} - \item Config B1: 'min' (only axisymmetric structures) + \item   Config B1 : 'min' (only axisymmetric structures) \begin{itemize} - \item Ves: WEST V0 - \item Struct: + \item  Ves : WEST V0 + \item  Struct : \begin{itemize} - \item Baffle : Baffle-V0 - \item Upper divertor : UpDiv-V1 - \item Lower divertor : LowDiv-V1 + \item         Baffle : Baffle-V0 + \item         Upper divertor : UpDiv-V1 + \item         Lower divertor : LowDiv-V1 \end{itemize} \end{itemize} - \item Config B2: 'light' (same as B1 + some toroidal - structures) + \item  Config B2 : 'light' (same as B1 + some toroidal structures) \begin{itemize} - \item Ves: WEST V0 - \item Struct: + \item Ves : WEST V0 + \item  Struct : \begin{itemize} - \item Baffle: Baffle-V1 - \item Upper divertor: UpDiv-V2 - \item Lower divertor: LowDiv-V2 - \item Inner Bumpers: InnerBumpers-V1 - \item Outer Bumper: OuterBumper-V1 - \item IC antennas: IC1-V1 + IC2-V1 - + IC3-V1 + \item         Baffle : Baffle-V1 + \item         Upper divertor : UpDiv-V2 + \item         Lower divertor : LowDiv-V2 + \item         Inner Bumpers : InnerBumpers-V1 + \item         Outer Bumper : OuterBumper-V1 + \item         IC antennas : IC1-V1 + IC2-V1 + IC3-V1 \end{itemize} \end{itemize} - \item Config B3: 'full' + \item   Config B3 : 'full' \begin{itemize} - \item Ves: WEST-V0 - \item Struct: + \item  Ves : WEST-V0 + \item  Struct : \begin{itemize} - \item Baffle: Baffle-V2 - \item Upper divertor: UpDiv-V3 - \item Lower divertor: LowDiv-V3 - \item Inner Bumpers: InnerBumpers-V3 - \item Outer Bumper: OuterBumper-V3 - \item IC antennas: IC1-V1 + IC2-V1 - + IC3-V1 - \item LH antennas : LH-V1, LH2-V1 - \item Ripple : Ripple-V1 - \item VDE : VDE-V0 + \item         Baffle : Baffle-V2 + \item         Upper divertor : UpDiv-V3 + \item         Lower divertor : LowDiv-V3 + \item         Inner Bumpers : InnerBumpers-V3 + \item         Outer Bumper : OuterBumper-V3 + \item         IC antennas : IC1-V1 + IC2-V1 + IC3-V1 + \item         LH antennas : LH-V1, LH2-V1 + \item         Ripple : Ripple-V1 + \item         VDE : VDE-V0 \end{itemize} \end{itemize} \end{itemize} \end{itemize} -\begin{figure}[h] - \caption{Examples of geometry configurations: A2 and A3} - \centering - \includegraphics[width=0.5\textwidth]{./figures/figure.png} - \includegraphics[width=0.5\textwidth]{./figures/figure2.png} -\end{figure} - - - -The camera is defined as following. -The point of convergence in $(X,Y,Z)$ coordinates is $P = [1.5,3.2,0.]$ it is pointed towards the -device with direction $\vec{n}_{In} = [-0.5,-1.,0.]$ (normalized) of magnitude $F = 0.1$. The -camera is dicretized in a set of LOS, which have a director vector of $D_{12} = [0.3,0.1]$. -We will vary the number of lines of sights in a camera, $N_i = 10^i$, with $i=0, \cdots, 6$.\\ - -\section{Set of tests and initial times} - -As a baseline, we use the set of ToFu's unit-tests for the geometry part. There are a total of 13 -tests testing the most low-level functions, we will exclude for this part the 13th. -The table \ref{tab:UT} shows the execution time needed -for each test on different machines. - -\begin{table}[h] % just use this specifier if really needed. - \centering - \caption{Execution time of unit tests 1 to 13, time computed as the mean of 5 runs}\label{tab:UT} - % \begin{tabular}{@{}lrrrrrr@{}} - \sisetup{round-mode=places} - \begin{tabular}{@{}l*{6}{S[table-format=1.2e-1,scientific-notation=true]}@{}} - \toprule - \textbf{Machine} & {Test 1} & {Test 2} & {Test 3} & {Test 4} & {Test 5} & {Test 6} \\ \midrule - Ubuntu & 0.0003126 & 0.0004468 & 0.0001554 & 0.0003012 & 0.000482 & 0.0052582 \\ - Sirrah & 0.0086206 & 0.0003952 & 0.0001658 & 0.00032 & 0.0005792 & 0.0081134\\ - Atlas & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ - \bottomrule - \end{tabular}\\ - %\begin{tabular}{@{}lrrrrrr@{}} -\begin{tabular}{@{}l*{6}{S[table-format=1.2e-1,scientific-notation=true]}@{}} - \toprule - %% \textbf{Machine} & Test 7 & Test 8 & Test 9 & Test 10 & Test 11 & Test 12 & Test 13 \\ \midrule - %% Ubuntu & 0.0476964 & 0.005901 & 0.0350598 & 0.0479324 & 0.1106498 & 0.0283896 & 0.0061352 \\ - %% Sirrah & 0.0516274 & 0.006856 & 0.046948 & 0.05907 & 0.132117 & 0.036295 & 0.0066378\\ - %% Atlas & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ - \textbf{Machine} & {Test 7} & {Test 8} & {Test 9} & {Test 10} & {Test 11} & {Test 12} \\ \midrule - Ubuntu & 0.0476964 & 0.005901 & 0.0350598 & 0.0479324 & 0.1106498 & 0.0283896 \\ - Sirrah & 0.0516274 & 0.006856 & 0.046948 & 0.05907 & 0.132117 & 0.036295 \\ - Atlas & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 & 0.0 \\ - \bottomrule - \end{tabular} -\end{table} - -In addition we tested the different combination of geometries configurations with the camera defined in -Section~\ref{sect:configs} and the different number of LOS, on the method from the \verb|geometry| module, -\verb|LOS_Calc_PInOut_VesStruct|. This method will be the focus of our optimization. The inital times -are summed up in table ADDTABLEREF. - - -\begin{table}[h] % just use this specifier if really needed. - \centering - \caption{Execution time of the method on different configurations on Sirrah } - \label{tab:LOS_init_sirrah} - % Visionner le code LaTeX du paragraphe 0 - \sisetup{round-mode=places} - \begin{tabular}{@{}c*{6}{S[table-format=1.2e-1,scientific-notation=true]}@{}} - \toprule - \multicolumn{1}{c}{config} & {A1} & {A2} & {A3} & {B1} & {B2} & {B3}\\ - \midrule - V$1$ & 0.0002830028533935 & 0.000288724899291 & 0.0002665519714355 & 0.00046873092651 & 0.001762390136718 & 0.10256910324096\\ - V$10$ & 0.0002257823944091 & 0.000367641448974 & 0.0004203319549560 & 0.00061988830566 & 0.004924774169921 & 0.36218905448913\\ - V$10^2$ & 0.0004072189331054 & 0.001023530960083 & 0.0014843940734863 & 0.00082159042358 & 0.034385681152343 & 2.87086915969848\\ - V$10^3$ & 0.0019013881683349 & 0.008644580841064 & 0.0144457817077636 & 0.00331640243530 & 0.327978849411010 & 28.4926774501800\\ - V$10^{4}$ & 0.0145549774169921 & 0.083053588867187 & 0.1412739753723144 & 0.02720856666564 & 3.225792169570923 & 282.840265989303\\ - V$10^{5}$ & 0.1442494392395019 & 0.837333202362060 & 1.3932499885559082 & 0.26165747642517 & 33.53607034683227 & 2845.76993727684\\ - V$10^{6}$ & 1.5589430332183838 & 8.447954416275024 & 13.903767108917236 & 2.77517032623291 & 329.3016924858093 & 29030.8106548786\\ - \bottomrule - \end{tabular} -\end{table} - - - - -\begin{table}[h] % just use this specifier if really needed. - \centering - \caption{Execution time of the method on different configurations on Ubuntu} - \label{tab:LOS_init_sirrah} - % Visionner le code LaTeX du paragraphe 0 - \sisetup{round-mode=places} - \begin{tabular}{@{}c*{6}{S[table-format=1.2e-1,scientific-notation=true]}@{}} - \toprule - \multicolumn{1}{c}{config} & {A1} & {A2} & {A3} & {B1} & {B2} & {B3}\\ - \midrule - V$1$ & 0.00028395652770996094 & 0.00022459030151367188 & 0.00025248527526 & 0.000370264053344 & 0.00156831741333 & 0.11810493469238281\\ - V$10$ & 0.00027346611022949220 & 0.00028276443481445310 & 0.00033211708068 & 0.000433683395385 & 0.00490784645080 & 0.41411495208740234\\ - V$10^2$ & 0.00055027008056640620 & 0.00079059600830078120 & 0.00115370750427 & 0.000623226165771 & 0.02871012687683 & 3.511296510696411\\ - V$10^3$ & 0.00200867652893066400 & 0.00719046592712402340 & 0.01251053810119 & 0.003671884536743 & 0.26398158073425 & 32.56944823265076\\ - V$10^{4}$ & 0.01538681983947753900 & 0.06923341751098633000 & 0.11263871192932 & 0.023092269897460 & 2.56951785087585 & 310.23827385902405\\ - V$10^{5}$ & 0.11928200721740723000 & 0.67663884162902830000 & 1.12707686424255 & 0.207307100296020 & 25.8998832702636 & 3202.3827385902405\\ - V$10^{6}$ & 1.16081881523132320000 & 6.79208517074585000000 & 11.3137621879577 & 2.094620227813720 & 258.980541706085 & 31723.827385902405\\ - \bottomrule - \end{tabular} -\end{table} - - - - -\begin{table}[h] % just use this specifier if really needed. - \centering - \caption{Execution time of the method on different configurations on Sirrah } - \label{tab:LOS_init_sirrah} - % Visionner le code LaTeX du paragraphe 0 - \sisetup{round-mode=places} - \begin{tabular}{@{}l*{4}{S[table-format=1.2e-1,scientific-notation=true]}@{}} - \toprule - \textbf{Number of LOS} & {$10^3$} & {$10^4$} & {$10^5$} & {$10^6$}\\ - \midrule - original & 32.569 & 310.23 & 3202.38 & 31723.827 $(~8$h$48)$\\ - optimized & 0.0258 & 0.2720 & 2.73581 & 26.589564 $(<30$s$)$\\ - parallelized (32 threads) & 0.0136 & 0.0466 & 0.3640 & 2.9188 \\ - \bottomrule - \end{tabular} -\end{table} +We will also vary the number of lines sights $N_i = 10^i$ with $i=0, \cdots, 6$. -\end{document} +\end{document} diff --git a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/figures/figure.png b/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/figures/figure.png deleted file mode 100644 index 1d7bdb078..000000000 Binary files a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/figures/figure.png and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/figures/figure2.png b/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/figures/figure2.png deleted file mode 100644 index 7817ea0a7..000000000 Binary files a/Notes_Upgrades/Optimize_LOSInOut/Benchmarking/figures/figure2.png and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/Distance_LOS_cone.pdf b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/Distance_LOS_cone.pdf deleted file mode 100644 index 4522fc28c..000000000 Binary files a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/Distance_LOS_cone.pdf and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/Distance_LOS_cone.tex b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/Distance_LOS_cone.tex deleted file mode 100644 index 33aab4459..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/Distance_LOS_cone.tex +++ /dev/null @@ -1,210 +0,0 @@ -\documentclass[a4paper,11pt,twoside,titlepage,openright]{book} - -\usepackage[english]{babel} -\usepackage{color} -\usepackage{graphicx} -\usepackage{amsmath} -\numberwithin{equation}{section} -\usepackage[margin=3cm]{geometry} -\usepackage{hyperref} -\usepackage{epsfig,amsfonts} -\usepackage{transparent} -\usepackage{cases} - -% -\usepackage{xcolor,import} - - -\pagestyle{plain} - -\newcommand{\ud}[1]{\underline{#1}} -\newcommand{\lt}{\left} -\newcommand{\rt}{\right} -\DeclareMathOperator{\e0}{\epsilon_0} -\newcommand{\wdg}{\wedge} -\newcommand{\emis}{\emph{emissivity}} -\newcommand{\ema}{\epsilon^{\eta}} -\newcommand{\hypot}[1]{\textbf{\textcolor{green}{#1}}} - - -\newcommand{\norm}[1]{\left\lVert#1\right\rVert} - - -\begin{document} - -\title{ToFu geometric tools\\ Intersection of a LOS with a cone} -\author{Didier VEZINET \and Laura S. Mendoza} -\date{02.06.2017} -\maketitle - -%\tableofcontents - - - - -\chapter{Definitions} - -\section{Geometry definition in ToFu} - -The definition of a fusion device in ToFu is done by defining the edge of a poloidal plane as a set of segments in a 2D plane. The 3D volume is obtained by an extrusion for cylinders or a revolution for tori. -We consider an orthonormal direct cylindrical coordinate system $(O,\ud{e}_R,\ud{e}_{\theta},\ud{e}_Z)$ associated to the orthonormal direct cartesian coordinate system $(O,\ud{e}_X,\ud{e}_Y,\ud{e}_Z)$. We suppose that all poloidal planes live in $(R,Z)$ and can be obtained after a revolution around the $Z$ axis of the user-defined poloidal plane at $\theta=0$, $\mathcal{P}_0$. Thus, the torus is axisymmetric around the $(O,Z)$ axis (see Figure~\ref{fig:tok-ab}). - - - - -\begin{figure}[h] -\centering{ -\def\svgwidth{0.75\linewidth} -\import{figures/}{tore_cones12.pdf_tex} -\caption{Two examples of a circular torus approximated by a revolved octagon. For each segment $\overline{AB}$ of the octagon there is a cone with origin on the $(O,Z)$ axis.} -\label{fig:tok-ab} -} -\end{figure} - -\section{Notations} - -In order to simplify the computations, let $A$ and $B$ be the end points of a segment $\mathcal{S}_i$ such that $A\neq B$ and $\mathcal{P} = \cup_{i=1}^{n} \mathcal{S}_i = \cup_{i=1}^n \overline{{\rm A}_i{\rm B}_i}$ with $n$ the number of segments given by the user defining the plane $\mathcal{P}$. We define a right circular cone $\mathcal{C}$ of origin $P = ({\rm A},{\rm B}) \cap ({\rm O}, {\rm Z})$ of generatrix $(A,B)$ and of axis $(O,Z)$ (see Figure~\ref{fig:tok-ab}). Thus we can define the edge of the torus as the union of the edges of the frustums $\mathcal{F}_i$ defined by truncating the cones $\mathcal{C}_i$ to the segment $\overline{AB}_i$. - - - -Then, any point $M$ with coordinates $(X,Y,Z)$ or $(R,\theta,Z)$ belongs to the frustum $\mathcal{F}$ if and only if -$$ -\exists q \in [0;1] / -\left\{ \begin{array}{ll} -R-R_A = q(R_B-R_A)\\ -Z-Z_A = q(Z_B-Z_A) -\end{array}\right. -$$ - - -Now let us consider a LOS $L$ (i.e.: a half-infinite line) defined by a point $D$ and a normalized directing vector $u$, of respective coordinates $(X_D,Y_D,Z_D)$ or $(R_D,\theta_D,Z_D)$ and $(u_X,u_Y,u_Z)$. -Then, point M belongs to $L$ if and only if: -$$ -\exists k \in [0;\infty[ / \ud{DM} = k\ud{u} -$$ - - -%=================================================================== - -\chapter{Computing shortest distance between LOS and Frustum} - - -We want to calculate the shortest distance between a 3D ray $\mathcal{R}$ defined by its origin $\vec{D}$ and its unit directional vector $\vec{u}$ and a frustum $\mathcal{F}$ defined by a segment $AB$ extruded around the axis $\vec{N}$ of coordinates $(0,0,1)$. -We want to compute the shortest distance between a point $P$ on the ray $\mathcal{R}$ and a point $Q$ on the frustum $\mathcal{F}$. - - -\begin{figure}[h] -\centering{ -\def\svgwidth{0.3\linewidth} -\import{figures/}{inter_LOS_Poly.pdf_tex}~ -\def\svgwidth{0.45\linewidth} -\import{figures/}{inter_LOS_Poly_plane.pdf_tex} -\caption{Example of closest point between ray and Frustum: 3D space and (R,Q) plane.} -\label{fig:hoz-frus-hoz-los} -} -\end{figure} - - -First, let us write some of the equations that $Q$ respects - -\begin{align*} -(Q-C) \cdot N &= \norm{Q-C} \cos(\tau_\mathcal{C})\\ -R_q-R_A &= q(R_B-R_A)\\ -Z_q-Z_A &= q(Z_B-Z_A) -\end{align*} - -where $\tau_\mathcal{C}$ is the angle between $\vec{AB}$ and $-\vec{N}$. - -\begin{align*} --\vec{N}\cdot\vec{AB} & = \norm{N} \norm{AB} \cos(\tau_\mathcal{C})\\ -z_A - z_B &= \norm{AB} \cos(\tau_\mathcal{C})\\ -\tau_\mathcal{C} &= \arccos\left(\dfrac{z_A - z_B}{\norm{AB}}\right) -\end{align*} - -We are looking to minimize the distance between $P$ and $Q$ which is equivalent to solve the following system. - - -\begin{numcases}{} -\dfrac{\partial}{\partial k} \norm{P-Q}^2 = 0\\[0.2cm] -\label{eq:201} -\dfrac{\partial}{\partial q} \norm{P-Q}^2 = 0 -\label{eq:202} -\end{numcases} - - -with - -\begin{align*} -\norm{P-Q}^2 &= (x_p - x_q)^2 + (y_p - y_q)^2 + (z_p - z_q)^2 \\ - & = x_p^2 + y_p^2 + z_p^2 - 2(x_p x_q + y_p y_q + z_p z_q) + x_q^2 + y_q^2 + z_q^2\\ - & = \norm{P}^2 - 2 + \norm{Q}^2 -\end{align*} - -and - -\begin{numcases}{} -\dfrac{\partial}{\partial k} = \dfrac{\partial}{\partial k} \left( (x_D + k u_x) x_q + (y_D + k u_y) y_q + (z_D + k u_z) z_q \right)\\[0.2cm] -\label{eq:eq203} -\dfrac{\partial}{\partial q} = \dfrac{\partial}{\partial q} \left(x_p R_q \cos(\theta_q) + y_p R_q \sin(\theta_q) + z_p (q(z_B-z_A) - z_A)\right) -\label{eq:eq204} -\end{numcases} - -\begin{figure}[h] -\centering{ - -\def\svgwidth{0.35\linewidth} -\import{figures/}{inter_above.pdf_tex} -\caption{Example of closest point between ray and Frustum: (X,Y) plane.} -\label{fig:inter-above} -} -\end{figure} - -We can see in Figure~\ref{fig:inter-above}, that $\theta_q = \theta_p$. By definition $cos(\theta_p) = x_p/R_p$ and $sin(\theta_p) = y_p/R_p$. Thus $x_p \cos(\theta_q) + y_p \sin(\theta_q) = (x_p^2 + y_p^2)/R_p = R_p$. We introduce this in Equation~\eqref{eq:eq204}. The derivation of Equation~\eqref{eq:eq203} is straightforward. We obtain - -\begin{numcases}{} -\dfrac{\partial}{\partial k} = u_x x_q + u_y y_q + u_z z_q = \, \\[0.2cm] -\label{eq:eq205} -\dfrac{\partial}{\partial q} = R_p (R_B - R_A) + Z_p (Z_B - Z_A) -\label{eq:eq206} -\end{numcases} - -Now, let us derivate the remaining terms in $\norm{P-Q}^2$ - -$$ -\begin{cases}{} -\dfrac{\partial}{\partial k} \norm{P}^2 &= \dfrac{\partial}{\partial k} \left( (x_D + k u_x)^2 + (y_D + k u_y)^2 + (z_D + k u_z)^2 \right)\\[0.2cm] -\label{eq:eq207} -\dfrac{\partial}{\partial q} \norm{Q}^2 &= \dfrac{\partial}{\partial q} \left( R_q^2 + Z_q^2\right) \\[0.2cm] -&= \dfrac{\partial}{\partial q} \left( (q(R_B-R_A)+R_A)^2 + (q(Z_B-Z_A)+Z_A)^2\right) -\label{eq:eq208} -\end{cases} -$$ - -$$ -\begin{cases}{} -\dfrac{\partial}{\partial k} \norm{P}^2 &= 2k(u_x + u_y + u_z) + 2(u_x x_D + u_y y_D + u_z z_D)\\[0.2cm] -& = 2k \norm{u}^2 + 2 \\[0.2cm] -\dfrac{\partial}{\partial q} \norm{Q}^2 &= 2q((R_B - R_A)^2 + (Z_B - Z_A)^2) + 2(R_A(R_B-R_A) + Z_A(Z_B-Z_A))\\[0.2cm] -& = 2q \norm{AB}^2 + 2 -\end{cases} -$$ - -Thus, Equations~\eqref{eq:201}-\eqref{eq:202} become - -$$ -\begin{cases}{} -\dfrac{\partial}{\partial k} \norm{P-Q}^2 &= 2k \norm{u}^2 + 2 - 2 = 0\\[0.2cm] -\dfrac{\partial}{\partial q} \norm{P-Q}^2 &=2q \norm{AB}^2 + 2 - 2(R_p (R_B - R_A) +Z_p (Z_B - Z_A)) = 0 -\end{cases} -$$ - -$$ -\begin{cases}{} -k &= \dfrac{ - }{\norm{u}^2}\\[0.2cm] -q &= \dfrac{(R_p (R_B - R_A) +Z_p (Z_B - Z_A)) - }{\norm{AB}^2} -\end{cases} -$$ - - - -\end{document} diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.pdf b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.pdf deleted file mode 100644 index 17d644a19..000000000 Binary files a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.pdf and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.pdf_tex b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.pdf_tex deleted file mode 100644 index bf0cdbae8..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.pdf_tex +++ /dev/null @@ -1,62 +0,0 @@ -%% Creator: Inkscape inkscape 0.92.2, www.inkscape.org -%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010 -%% Accompanies image file 'inter_LOS_Poly.pdf' (pdf, eps, ps) -%% -%% To include the image in your LaTeX document, write -%% \input{.pdf_tex} -%% instead of -%% \includegraphics{.pdf} -%% To scale the image, write -%% \def\svgwidth{} -%% \input{.pdf_tex} -%% instead of -%% \includegraphics[width=]{.pdf} -%% -%% Images with a different path to the parent latex file can -%% be accessed with the `import' package (which may need to be -%% installed) using -%% \usepackage{import} -%% in the preamble, and then including the image with -%% \import{}{.pdf_tex} -%% Alternatively, one can specify -%% \graphicspath{{/}} -%% -%% For more information, please see info/svg-inkscape on CTAN: -%% http://tug.ctan.org/tex-archive/info/svg-inkscape -%% -\begingroup% - \makeatletter% - \providecommand\color[2][]{% - \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}% - \renewcommand\color[2][]{}% - }% - \providecommand\transparent[1]{% - \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}% - \renewcommand\transparent[1]{}% - }% - \providecommand\rotatebox[2]{#2}% - \ifx\svgwidth\undefined% - \setlength{\unitlength}{487.81336008bp}% - \ifx\svgscale\undefined% - \relax% - \else% - \setlength{\unitlength}{\unitlength * \real{\svgscale}}% - \fi% - \else% - \setlength{\unitlength}{\svgwidth}% - \fi% - \global\let\svgwidth\undefined% - \global\let\svgscale\undefined% - \makeatother% - \begin{picture}(1,0.97810115)% - \put(0,0){\includegraphics[width=\unitlength,page=1]{inter_LOS_Poly.pdf}}% - \put(0.23223768,0.39246314){\color[rgb]{0,0,1}\makebox(0,0)[lb]{\smash{$d$}}}% - \put(0.13909906,0.50199047){\color[rgb]{1,0,0}\makebox(0,0)[lb]{\smash{$P$}}}% - \put(0.353548,0.40618712){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$Q$}}}% - \put(0.53524467,0.93137638){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\mathcal{C}$}}}% - \put(0.71642068,0.54414156){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$A$}}}% - \put(0.81068325,0.31683967){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$B$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=2]{inter_LOS_Poly.pdf}}% - \put(0.53026944,0.69422076){\color[rgb]{0.50196078,0.50196078,0.50196078}\makebox(0,0)[lb]{\smash{$\vec{N}$}}}% - \end{picture}% -\endgroup% diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.svg b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.svg deleted file mode 100644 index c7e06c142..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly.svg +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - $d$ - $P$ - $Q$ - $\mathcal{C}$ - $A$ - $B$ - - $\vec{N}$ - - diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.pdf b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.pdf deleted file mode 100644 index dfe138421..000000000 Binary files a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.pdf and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.pdf_tex b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.pdf_tex deleted file mode 100644 index 049e19b42..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.pdf_tex +++ /dev/null @@ -1,65 +0,0 @@ -%% Creator: Inkscape inkscape 0.92.2, www.inkscape.org -%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010 -%% Accompanies image file 'inter_LOS_Poly_plane.pdf' (pdf, eps, ps) -%% -%% To include the image in your LaTeX document, write -%% \input{.pdf_tex} -%% instead of -%% \includegraphics{.pdf} -%% To scale the image, write -%% \def\svgwidth{} -%% \input{.pdf_tex} -%% instead of -%% \includegraphics[width=]{.pdf} -%% -%% Images with a different path to the parent latex file can -%% be accessed with the `import' package (which may need to be -%% installed) using -%% \usepackage{import} -%% in the preamble, and then including the image with -%% \import{}{.pdf_tex} -%% Alternatively, one can specify -%% \graphicspath{{/}} -%% -%% For more information, please see info/svg-inkscape on CTAN: -%% http://tug.ctan.org/tex-archive/info/svg-inkscape -%% -\begingroup% - \makeatletter% - \providecommand\color[2][]{% - \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}% - \renewcommand\color[2][]{}% - }% - \providecommand\transparent[1]{% - \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}% - \renewcommand\transparent[1]{}% - }% - \providecommand\rotatebox[2]{#2}% - \ifx\svgwidth\undefined% - \setlength{\unitlength}{492.27539741bp}% - \ifx\svgscale\undefined% - \relax% - \else% - \setlength{\unitlength}{\unitlength * \real{\svgscale}}% - \fi% - \else% - \setlength{\unitlength}{\svgwidth}% - \fi% - \global\let\svgwidth\undefined% - \global\let\svgscale\undefined% - \makeatother% - \begin{picture}(1,0.65901119)% - \put(0,0){\includegraphics[width=\unitlength,page=1]{inter_LOS_Poly_plane.pdf}}% - \put(0.67769836,0.41649348){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$A'$}}}% - \put(0.81265194,0.18611843){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$B'$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=2]{inter_LOS_Poly_plane.pdf}}% - \put(0.36810508,0.22524653){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$Q$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=3]{inter_LOS_Poly_plane.pdf}}% - \put(0.12387012,0.35984294){\color[rgb]{1,0,0}\transparent{0.74117649}\makebox(0,0)[lb]{\smash{$P$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=4]{inter_LOS_Poly_plane.pdf}}% - \put(0.55834085,0.44191287){\color[rgb]{0.6,0.6,0.6}\makebox(0,0)[lb]{\smash{$\vec{N}$}}}% - \put(0.53945726,0.61270994){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\mathcal{C}$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=5]{inter_LOS_Poly_plane.pdf}}% - \put(0.27927104,0.40554871){\color[rgb]{1,0,0}\transparent{0.74117649}\makebox(0,0)[lb]{\smash{$D$}}}% - \end{picture}% -\endgroup% diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.svg b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.svg deleted file mode 100644 index 74939d73f..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_LOS_Poly_plane.svg +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - $A'$ - $B'$ - - - - $Q$ - - - - - - - - $\vec{N}$ - $\mathcal{C}$ - - $D$ - - diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.pdf b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.pdf deleted file mode 100644 index 67ed5cd13..000000000 Binary files a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.pdf and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.pdf_tex b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.pdf_tex deleted file mode 100644 index ec0f3a2b3..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.pdf_tex +++ /dev/null @@ -1,67 +0,0 @@ -%% Creator: Inkscape inkscape 0.92.2, www.inkscape.org -%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010 -%% Accompanies image file 'inter_above.pdf' (pdf, eps, ps) -%% -%% To include the image in your LaTeX document, write -%% \input{.pdf_tex} -%% instead of -%% \includegraphics{.pdf} -%% To scale the image, write -%% \def\svgwidth{} -%% \input{.pdf_tex} -%% instead of -%% \includegraphics[width=]{.pdf} -%% -%% Images with a different path to the parent latex file can -%% be accessed with the `import' package (which may need to be -%% installed) using -%% \usepackage{import} -%% in the preamble, and then including the image with -%% \import{}{.pdf_tex} -%% Alternatively, one can specify -%% \graphicspath{{/}} -%% -%% For more information, please see info/svg-inkscape on CTAN: -%% http://tug.ctan.org/tex-archive/info/svg-inkscape -%% -\begingroup% - \makeatletter% - \providecommand\color[2][]{% - \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}% - \renewcommand\color[2][]{}% - }% - \providecommand\transparent[1]{% - \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}% - \renewcommand\transparent[1]{}% - }% - \providecommand\rotatebox[2]{#2}% - \ifx\svgwidth\undefined% - \setlength{\unitlength}{409.08997592bp}% - \ifx\svgscale\undefined% - \relax% - \else% - \setlength{\unitlength}{\unitlength * \real{\svgscale}}% - \fi% - \else% - \setlength{\unitlength}{\svgwidth}% - \fi% - \global\let\svgwidth\undefined% - \global\let\svgscale\undefined% - \makeatother% - \begin{picture}(1,1.12003332)% - \put(0,0){\includegraphics[width=\unitlength,page=1]{inter_above.pdf}}% - \put(0.70276726,0.44332352){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$A$}}}% - \put(0.86246388,0.44116789){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$B$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=2]{inter_above.pdf}}% - \put(0.3301195,0.349197){\color[rgb]{0.30196078,0.30196078,0.30196078}\makebox(0,0)[lb]{\smash{$\vec{N}$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=3]{inter_above.pdf}}% - \put(0.37045323,0.71846731){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$Q$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=4]{inter_above.pdf}}% - \put(0.48263439,0.48175178){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$\theta$}}}% - \put(0,0){\includegraphics[width=\unitlength,page=5]{inter_above.pdf}}% - \put(0.27973261,0.57984393){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$A'$}}}% - \put(0.22508737,0.81900511){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$B'$}}}% - \put(0.20651798,1.02623094){\color[rgb]{1,0.16470588,0.16470588}\makebox(0,0)[lb]{\smash{$A$}}}% - \put(0.47202656,1.06431705){\color[rgb]{1,0.16470588,0.16470588}\makebox(0,0)[lb]{\smash{$B$}}}% - \end{picture}% -\endgroup% diff --git a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.svg b/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.svg deleted file mode 100644 index 95afa0dcd..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/Dist_LOS_Frustum/figures/inter_above.svg +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - $A$ - $B$ - - $\vec{N}$ - - $Q$ - - $\theta$ - - $A'$ - $B'$ - $A$ - $B$ - - diff --git a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.pdf b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.pdf index 674ecb12f..77152cd19 100644 Binary files a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.pdf and b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.pdf differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.tex b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.tex index f0c2a4cc8..e073b0f6a 100644 --- a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.tex +++ b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/LOS_IntersectCone.tex @@ -48,7 +48,7 @@ \section{Geometry definition in ToFu} \begin{figure}[h] \centering{ \def\svgwidth{0.75\linewidth} -\import{figures/}{tore_cones12.pdf_tex} +\import{figures/}{tore_cones12.pdf_tex} \caption{Two examples of a circular torus approximated by a revolved octagon. For each segment $\overline{AB}$ of the octagon there is a cone with origin on the $(O,Z)$ axis.} \label{fig:tok-ab} } @@ -62,7 +62,7 @@ \section{Notations} Then, any point $M$ with coordinates $(X,Y,Z)$ or $(R,\theta,Z)$ belongs to the frustum $\mathcal{F}$ if and only if $$ -\exists q \in [0;1] / +\exists q \in [0;1] / \left\{ \begin{array}{ll} R-R_A = q(R_B-R_A)\\ Z-Z_A = q(Z_B-Z_A) @@ -83,7 +83,7 @@ \chapter{Derivation} \begin{equation} \begin{array}{lll} -\exists (q,k) \in [0;1]\times [0;\infty[ /& & +\exists (q,k) \in [0;1]\times [0;\infty[ /& & \left\{\begin{array}{ll} R-R_A = q(R_B-R_A)\\ Z-Z_A = q(Z_B-Z_A)\\ @@ -143,7 +143,7 @@ \subsection{Plane Frustum: $Z_B = Z_A$} \begin{figure}[h] \centering{ \def\svgwidth{0.5\linewidth} -\import{figures/}{horizontal_cone_hoz_LOS.pdf_tex} +\import{figures/}{horizontal_cone_hoz_LOS.pdf_tex} \caption{Plane frustum and horizontal Line of Sight on the same $Z$-plane.} \label{fig:hoz-frus-hoz-los} } @@ -154,7 +154,7 @@ \subsection{Plane Frustum: $Z_B = Z_A$} \subsection{Non-horizontal cone: $Z_B\neq Z_A$} Then $q=\dfrac{Z_D-Z_A}{Z_B-Z_A}$. -There are acceptable solution only if $q\in[0;1]$. +There are acceptable solution only if $q\in[0;1]$. By introducing $$C = q^2(R_B-R_A)^2 + 2qR_A(R_B-R_A) + R_A^2,$$ we have $$ \left(k\ud{u}_{//} + \ud{D}_{//}\right)^2 - C = 0\\ @@ -192,7 +192,7 @@ \section{Non-horizontal LOS: $u_Z\neq0$} & = \left(q\dfrac{Z_B-Z_A}{u_Z} - \dfrac{Z_D-Z_A}{u_Z}\right)^2\ud{u}_{//}^2 + 2\left(q\dfrac{Z_B-Z_A}{u_Z} - \dfrac{Z_D-Z_A}{u_Z}\right)\ud{u}_{//}\cdot\ud{D}_{//} + \ud{D}_{//}^2\\ & =q^2\left(\dfrac{Z_B-Z_A}{u_Z}\right)^2\ud{u}_{//}^2 - 2q\dfrac{Z_B-Z_A}{u_Z}\dfrac{Z_D-Z_A}{u_Z}\ud{u}_{//}^2 \\ & + \left(\dfrac{Z_D-Z_A}{u_Z}\right)^2\ud{u}_{//}^2 -+ 2q\dfrac{Z_B-Z_A}{u_Z}\ud{u}_{//}\cdot\ud{D}_{//} - 2\dfrac{Z_D-Z_A}{u_Z}\ud{u}_{//}\cdot\ud{D}_{//} + \ud{D}_{//}^2\\ ++ 2q\dfrac{Z_B-Z_A}{u_Z}\ud{u}_{//}\cdot\ud{D}_{//} - 2\dfrac{Z_D-Z_A}{u_Z}\ud{u}_{//}\cdot\ud{D}_{//} + \ud{D}_{//}^2\\ \end{array} $$ @@ -201,7 +201,7 @@ \section{Non-horizontal LOS: $u_Z\neq0$} \begin{array}{lll} 0 &=& q^2\left( (R_B-R_A)^2 - \left(\frac{Z_B-Z_A}{u_Z}\right)^2\ud{u}_{//}^2 \right)\\ & + & 2q\left( R_A(R_B-R_A) + \frac{Z_B-Z_A}{u_Z}\frac{Z_D-Z_A}{u_Z}\ud{u}_{//}^2 - \frac{Z_B-Z_A}{u_Z}\ud{u}_{//}\cdot\ud{D}_{//} \right)\\ -& - & \left(\frac{Z_D-Z_A}{u_Z}\right)^2\ud{u}_{//}^2 + 2\frac{Z_D-Z_A}{u_Z}\ud{u}_{//}\cdot\ud{D}_{//} - \ud{D}_{//}^2 + R_A^2 +& - & \left(\frac{Z_D-Z_A}{u_Z}\right)^2\ud{u}_{//}^2 + 2\frac{Z_D-Z_A}{u_Z}\ud{u}_{//}\cdot\ud{D}_{//} - \ud{D}_{//}^2 + R_A^2 \end{array} $$ @@ -221,7 +221,7 @@ \section{Non-horizontal LOS: $u_Z\neq0$} \subsection{$A=0$: LOS parallel to one of the cone generatrices} Then, because of the shape of the potential solution, we have to discriminate the case $B=0$. -But in this case we have $C=0$. +But in this case we have $C=0$. \begin{itemize} \item if $C=0 \Rightarrow$ no condition on q and k, the LOS is included in the cone $\Rightarrow$ we consider no solution \item if $C\neq 0 \Rightarrow$ Impossible, no solution @@ -278,3 +278,12 @@ \subsubsection{Deriving the potential propagation equations} \end{document} + + +\begin{figure} + \caption{A picture of a gull.} + \centering + \includegraphics[width=0.5\textwidth]{gull} +\end{figure} + + diff --git a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/horizontal_cone_hoz_LOS.pdf_tex b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/horizontal_cone_hoz_LOS.pdf_tex index 63841663b..6d82cff48 100644 --- a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/horizontal_cone_hoz_LOS.pdf_tex +++ b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/horizontal_cone_hoz_LOS.pdf_tex @@ -20,7 +20,7 @@ %% \import{}{.pdf_tex} %% Alternatively, one can specify %% \graphicspath{{/}} -%% +%% %% For more information, please see info/svg-inkscape on CTAN: %% http://tug.ctan.org/tex-archive/info/svg-inkscape %% diff --git a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.pdf b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.pdf deleted file mode 100644 index c175dc10b..000000000 Binary files a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.pdf and /dev/null differ diff --git a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.pdf_tex b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.pdf_tex deleted file mode 100644 index 8d642a802..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.pdf_tex +++ /dev/null @@ -1,69 +0,0 @@ -%% Creator: Inkscape inkscape 0.92.4, www.inkscape.org -%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010 -%% Accompanies image file 'inter.pdf' (pdf, eps, ps) -%% -%% To include the image in your LaTeX document, write -%% \input{.pdf_tex} -%% instead of -%% \includegraphics{.pdf} -%% To scale the image, write -%% \def\svgwidth{} -%% \input{.pdf_tex} -%% instead of -%% \includegraphics[width=]{.pdf} -%% -%% Images with a different path to the parent latex file can -%% be accessed with the `import' package (which may need to be -%% installed) using -%% \usepackage{import} -%% in the preamble, and then including the image with -%% \import{}{.pdf_tex} -%% Alternatively, one can specify -%% \graphicspath{{/}} -%% -%% For more information, please see info/svg-inkscape on CTAN: -%% http://tug.ctan.org/tex-archive/info/svg-inkscape -%% -\begingroup% - \makeatletter% - \providecommand\color[2][]{% - \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}% - \renewcommand\color[2][]{}% - }% - \providecommand\transparent[1]{% - \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}% - \renewcommand\transparent[1]{}% - }% - \providecommand\rotatebox[2]{#2}% - \newcommand*\fsize{\dimexpr\f@size pt\relax}% - \newcommand*\lineheight[1]{\fontsize{\fsize}{#1\fsize}\selectfont}% - \ifx\svgwidth\undefined% - \setlength{\unitlength}{396.07620867bp}% - \ifx\svgscale\undefined% - \relax% - \else% - \setlength{\unitlength}{\unitlength * \real{\svgscale}}% - \fi% - \else% - \setlength{\unitlength}{\svgwidth}% - \fi% - \global\let\svgwidth\undefined% - \global\let\svgscale\undefined% - \makeatother% - \begin{picture}(1,1.2639338)% - \lineheight{1}% - \setlength\tabcolsep{0pt}% - \put(0,0){\includegraphics[width=\unitlength,page=1]{inter.pdf}}% - \put(0.46672079,1.20638687){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$C$\end{tabular}}}}% - \put(0.64731722,0.82871453){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$A$\end{tabular}}}}% - \put(0.74843765,0.58514119){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$B$\end{tabular}}}}% - \put(0,0){\includegraphics[width=\unitlength,page=2]{inter.pdf}}% - \put(0.37513287,0.67549193){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$\vec{N}$\end{tabular}}}}% - \put(0,0){\includegraphics[width=\unitlength,page=3]{inter.pdf}}% - \put(-0.00628726,0.61327448){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$D$\end{tabular}}}}% - \put(0.04510976,0.41850665){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$V$\end{tabular}}}}% - \put(0,0){\includegraphics[width=\unitlength,page=4]{inter.pdf}}% - \put(0.33347418,0.43581937){\color[rgb]{0,0,1}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$d$\end{tabular}}}}% - \put(0.28315919,0.33464838){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\lineheight{1.25}\smash{\begin{tabular}[t]{l}$P$\end{tabular}}}}% - \end{picture}% -\endgroup% diff --git a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.svg b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.svg deleted file mode 100644 index d3aeb868f..000000000 --- a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/inter.svg +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - $C$ - $A$ - $B$ - - - $\vec{N}$ - - diff --git a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/tore_cones12.pdf_tex b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/tore_cones12.pdf_tex index 1e6e59a8f..20522009c 100644 --- a/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/tore_cones12.pdf_tex +++ b/Notes_Upgrades/Optimize_LOSInOut/LOS_IntersectCone/figures/tore_cones12.pdf_tex @@ -20,7 +20,7 @@ %% \import{}{.pdf_tex} %% Alternatively, one can specify %% \graphicspath{{/}} -%% +%% %% For more information, please see info/svg-inkscape on CTAN: %% http://tug.ctan.org/tex-archive/info/svg-inkscape %% diff --git a/README.md b/README.md deleted file mode 100644 index b560cd262..000000000 --- a/README.md +++ /dev/null @@ -1,167 +0,0 @@ -[![Travis-CI](https://travis-ci.org/ToFuProject/tofu.svg?branch=master)](https://travis-ci.org/ToFuProject/tofu) -[![Conda]( https://anaconda.org/tofuproject/tofu/badges/version.svg)](https://anaconda.org/tofuproject/tofu/badges/) -[![](https://anaconda.org/tofuproject/tofu/badges/downloads.svg)](https://anaconda.org/tofuproject/tofu/badges/) -[![](https://anaconda.org/tofuproject/tofu/badges/latest_release_date.svg)](https://anaconda.org/tofuproject/tofu/badges/) -[![](https://anaconda.org/tofuproject/tofu/badges/platforms.svg)](https://anaconda.org/tofuproject/tofu/badges/) -[![](https://anaconda.org/tofuproject/tofu/badges/license.svg)](https://anaconda.org/tofuproject/tofu/badges/) -[![](https://anaconda.org/tofuproject/tofu/badges/installer/conda.svg)](https://anaconda.org/tofuproject/tofu/badges/) -[![](https://codecov.io/gh/ToFuProject/tofu/branch/master/graph/badge.svg)](https://codecov.io/gh/ToFuProject/tofu) -[![](https://badge.fury.io/py/tofu.svg)](https://badge.fury.io/py/tofu) - - -tofu -==== - - -**tofu** stands for **To**mography for **Fu**sion, it is an IMAS-compatible open-source machine-independent python library -with non-open source plugins containing all machine-dependent routines. - -It aims at providing the **fusion** and **plasma** community with an object-oriented, transparent and documented tool for designing **tomography diagnostics**, computing **synthetic signal** (direct problem) as well as **tomographic inversions** (inverse problem). It gives access to a full 3D description of the diagnostic geometry, thus reducing the impact of geometrical approximations on the direct and, most importantly, on the inverse problem. - -**tofu** is relevant for all diagnostics integrating, in a finitie field of view or along a set of lines of sight, a quantity (scalar or vector) for which the plasma can be considered transparent (e.g.: light in the visible, UV, soft and hard X-ray ranges, or electron density for interferometers). - -**tofu** is **command-line oriented**, for maximum flexibility and scriptability. -The absence of a GUI is compensated by built-in one-liners for interactive plots. - - -A sphinx-generated [documentation](https://tofuproject.github.io/tofu/index.html) (to be updated soon), and the code itself is hosted on [GitHub](https://github.com/ToFuProject/tofu). - - - - -## Examples Gallery - - -Here are some examples of what **tofu** can do - -#### Built-in one-liners for interactive camera geometry visualization -

-Built-in one-liners for interactive camera geometry visualization -

- -#### ...both for 1D and 2D cameras, including the basics for multiple reflections handling -

-...both for 1D and 2D cameras, including the basics for multiple reflections handling -

- -#### Built-in plotting of sinograms - -

-Built-in plotting of sinograms -

- -#### Basic magnetic field line tracing - -

-Basic magnetic field line tracing -

- - -#### Multiple 1d profiles interactive plotting -

-Multiple 1d profiles interactive plotting -

- -#### Built-in basic data treatment and interactive plotting: svd and spectrograms -

-Built-in basic data treatment and interactive plotting: svd and spectrograms -

- - - -**tofu** provides the user with a series of python classes for creating, handling and visualizing a diagnostic geometry, meshes and basis functions, -geometry matrices, pre-treating experimental data and computing tomographic inversions. - -Each one of these main tasks is accomplished by a dedicated module in the larger tofu package. - -In its current version, only the geometry and data-handling modules are released. -The others, while operational, are not user-friendly and documented yet, they will be available in future releases. - -The geometry module is sufficient for diagnostic designing and for a synthetic diagnostic approach (i.e.: computing the integrated signal from a simulated 2D or 3D emissivity). -This geometry module allows in particular: - -* To handle linear and toroidal vaccum vessels -* To define apertures and detectors as planar polygons of arbitrary shapes, or to define a spherical converging lens and a circular detector in its focal plane. -* To assign an arbitrary number of apertures to each detector (and the apertures do not have to stand in parallel planes) -* To automatically compute the full Volume of Sight (VOS) in 3D of each {detector+aperture(s)} set -* To discretise the VOS for a numerical 3D integration of a simulated emissivity in order to compute the associated signal - -It is in this geometrical sense that tofu enables a synthetic diagnostic approach, it does not provide the tools for simulating the emissivity (that should be an input, provided by another code). - - -## IMAS-compatibility - - -IMAS is a standardized data structure, it comes as an extra layer on the database of any Tokamak to provide a machine-independent way of accessing scientific data. -tofu has built-in advanced classes for handling the interface with IMAS, hold in the imas2tofu sub-package. -It pre-supposes, of course, that IMAS is installed and operational next to your python install, but tofu does not require IMAS to run in general. -If IMAS is not available, tofu will simply display a warning stating that the imas2tofu sub-package is not usable. - -tofu can thus easily load and handle multiple IDSs (IMAS data structure units) and provide command-line tools for exporting IMAS data to other general tofu classes (e.g.: Cameras, Plasma2D...) and for interactive plotting. -All tofu objects have methods to facailitate in-python-console introspection, the ``__repr__`` method is overloaded to display relevant information, an dthis is widely used to explore the data loaded from IMAS. - -Do you want to use **tofu** on IMAS and don't know where to start? [See our wiki.](https://github.com/ToFuProject/tofu/wiki/Using-tofu-on-IMAS-server) - ----- - - -## Installing tofu - - -### For Windows - - -- [Follow this link to know how to configure your Windows to code on ToFu !](https://github.com/ToFuProject/tofu/wiki/Installing-tofu-on-windows) - -### For Ubuntu / Mac - -#### Standard mode - - ``` conda install -c tofuproject tofu ``` - -#### Developer mode - -Install dependencies - - - python (>= 3.6) - numpy - scipy - matplotlib - cython >= 0.26 - nose - pygments - pandas - - -Checkout the tofu git repository and from the top directory - - - python setup.py build_ext --inplace - python setup.py install - - -## Getting Started - -See our wiki's page: [Getting started](https://github.com/ToFuProject/tofu/wiki/Getting-started) - ------ - - -**Licensing** - -It is distributed under the MIT license and aims at providing the fusion community with -a transparent and modular tool for creating / designing diagnostics and using them for -synthetic diagnostic (direct problem) and tomography (inverse problem). - -**History** - -It was first created at the Max-Planck Institute for Plasma Physics (IPP) in Garching, Germany, -by Didier Vezinet, and is now maintained / debugged / updated by a team of contributors. - - ------ - -**Warning** -This Pypi package focuses on tomography for fusion research. -It uses the same name as a previous package dedicated to a testing framework coupling fixtures and tests loosely, now renamed **reahl-tofu** and developped by Iwan Vosloo since 2006. If you ended up here looking for a web-oriented library, you should probably redirect to the more recent [**reahl-tofu**](https://pypi.python.org/pypi/reahl-tofu) page. diff --git a/README_figures/54300_1dTe_svd.pdf b/README_figures/54300_1dTe_svd.pdf deleted file mode 100644 index 2aad61585..000000000 Binary files a/README_figures/54300_1dTe_svd.pdf and /dev/null differ diff --git a/README_figures/54300_1dTe_svd.png b/README_figures/54300_1dTe_svd.png deleted file mode 100644 index fdabd8918..000000000 Binary files a/README_figures/54300_1dTe_svd.png and /dev/null differ diff --git a/README_figures/CamLOS1D_sino.pdf b/README_figures/CamLOS1D_sino.pdf deleted file mode 100644 index d1951cc9c..000000000 Binary files a/README_figures/CamLOS1D_sino.pdf and /dev/null differ diff --git a/README_figures/CamLOS1D_sino.png b/README_figures/CamLOS1D_sino.png deleted file mode 100644 index 692cafedc..000000000 Binary files a/README_figures/CamLOS1D_sino.png and /dev/null differ diff --git a/README_figures/CamLOS1D_touch.pdf b/README_figures/CamLOS1D_touch.pdf deleted file mode 100644 index 7e1fd3d53..000000000 Binary files a/README_figures/CamLOS1D_touch.pdf and /dev/null differ diff --git a/README_figures/CamLOS1D_touch.png b/README_figures/CamLOS1D_touch.png deleted file mode 100644 index aa5594738..000000000 Binary files a/README_figures/CamLOS1D_touch.png and /dev/null differ diff --git a/README_figures/CamLOS2D_touch_refelect.pdf b/README_figures/CamLOS2D_touch_refelect.pdf deleted file mode 100644 index 74a089d22..000000000 Binary files a/README_figures/CamLOS2D_touch_refelect.pdf and /dev/null differ diff --git a/README_figures/CamLOS2D_touch_refelect.png b/README_figures/CamLOS2D_touch_refelect.png deleted file mode 100644 index cd73f241f..000000000 Binary files a/README_figures/CamLOS2D_touch_refelect.png and /dev/null differ diff --git a/README_figures/MagfieldLines.pdf b/README_figures/MagfieldLines.pdf deleted file mode 100644 index a7afbb6db..000000000 Binary files a/README_figures/MagfieldLines.pdf and /dev/null differ diff --git a/README_figures/MagfieldLines.png b/README_figures/MagfieldLines.png deleted file mode 100644 index 6edcacc41..000000000 Binary files a/README_figures/MagfieldLines.png and /dev/null differ diff --git a/README_figures/Plasma2D_1dneTe.pdf b/README_figures/Plasma2D_1dneTe.pdf deleted file mode 100644 index f0f0b4bf1..000000000 Binary files a/README_figures/Plasma2D_1dneTe.pdf and /dev/null differ diff --git a/README_figures/Plasma2D_1dneTe.png b/README_figures/Plasma2D_1dneTe.png deleted file mode 100644 index 36b6e02c1..000000000 Binary files a/README_figures/Plasma2D_1dneTe.png and /dev/null differ diff --git a/README_figures/cam2d.PNG b/README_figures/cam2d.PNG deleted file mode 100644 index 4eb36e744..000000000 Binary files a/README_figures/cam2d.PNG and /dev/null differ diff --git a/README_figures/configB2.PNG b/README_figures/configB2.PNG deleted file mode 100644 index 54983210e..000000000 Binary files a/README_figures/configB2.PNG and /dev/null differ diff --git a/README_figures/starting_ipython.PNG b/README_figures/starting_ipython.PNG deleted file mode 100644 index 669a9891f..000000000 Binary files a/README_figures/starting_ipython.PNG and /dev/null differ diff --git a/TODO_EndOfVisit_20181212.txt b/TODO_EndOfVisit_20181212.txt deleted file mode 100644 index a2e89a891..000000000 --- a/TODO_EndOfVisit_20181212.txt +++ /dev/null @@ -1,118 +0,0 @@ -Salut Laura, - -Alors les prochaines étapers que je vois (ton avis est évidemment bienvenu): - - -######################### -* Function principale (kIn kOut, indout, vect): -x - Terminer proprement l'optimisation CPU -x - Comprendre et terminer optimisation / profilage mémoire (résidu?) -x - Terminer parallélisation -x - La connecter à la partie orientée objet, en sortant les calculs - preliminaires (limites des boites...) qui ne changeront pas si la - caméra bouge et qu'on refait le calcul (pour optimisation de la - position) - - -######################### -* Autres fonctions nécessaire (inspirées de la principale): - -x 0/ Calculer, pour N points (R,Z) (donc cercle plat en 3D), le point le - long de la LOS le plus proche du cercle: (projection de la ligne - (hyperbole) ou en 3D pbm 4d), retourner k et distance - -x 0.1/ Same as 0/ but give back bool when dist < eps => True - (eps as parameter). - -x 1/ Calculer uniquement kIn / kOut pour N (~1-100) polygones - (ex.: des surfaces de flux) - TODO: pas de structs !! - -x 2/ Calculer, pour N polygones, et lorsque les lignes de visée ne les - traversent pas, la distance la plus courte d entre une ligne et un - polygone (et le paramètre k du point associé sur la ligne). - Retourner d=0 si la ligne traverse (i.e. si il existe un kIn et/ou - un kout) - > parametres entrées: (nvert, poly, vin, lims si lin, los_origin, - los_direction) - - >> Only did it for toroidal polygons... is it really necessary ? - - o Interface Python: - qui appelle une des deux (si il existe un parametre epislon) - x vectoriser à plusieurs polys - x version true/false si >0 et < eps (tableau booleen nlos*npoly) - o Interface Python : - qui appelle une des deux avex une variable pour choisir si LOS/poly ou l'inverse - x plein LOS, plein poly, pour chaque ligne: tableau d'indice (de taille nlos) - indiquant le poly pourlequel la LOS est le plus proche. (min(distance) mais - pour laquelle la LOS ne passe pas à l'intérieur). - Poly sont ordonnees : du plus petit au plus grand - x plein LOS, plein poly, pour chaque poly: tableau d'indice (de taille npoly) - indiquant la LOS pourlequel le poly est le plus proche. (min(distance) mais - pour laquelle la LOS ne passe pas à l'intérieur). - -> 2.1/ Ask Didier (vignetting algo ?) - > In : (list los_orig, list los_dirc, list contour3d, ncontour, list nvert...) - > Out : (list bool[ncontour * nlos]) - > contour 'simple' 3d = sans recoupe. - > 1. bbox - los - triangulation du polygon - - 3/ Calculer, pour N points de l'espace (~10-100) s'il sont visibles par - M autres points (~10^4-10^6), dans une configuration donnée (ex.: des - points le long d'une trajectoire dans la chambre à vide, on veut savoir - quels sont les points du plasma - échantilloné - qui rayonnent - dessus). Retourner un tableau 2D (N,M) de booleens. Je calculerai - l'angle solide et le vecteur directeur vectoriellement ensuite en me - basant sur ce booleen. Un fonction qui retourne ce tableau est donc - suffisante. - - 4/ Idem, mais pour N polygons 3D plans (ou quasi-plans), attention, le - polygone a un sens (i.e.: une face visible, l'autre ne compte pas), - seuls les points du bon coté doivent être comptés comme le voyant - - Eventuellement retourner plutot un tableau d'entier (flags) avec - code (0=pas vu, 1=partiellement, 2=entier), avec tests sur le centre - de masse et les sommets) - - Non-prioritaire : mattre un flag pour désactiver le calcul - d'un seul côté - - 5/ Idem mais calculer aussi l'angle solide associé et le vecteur - directeur vers le centre de masse du polygon - Prioritaire : uniquement pour les polygones vu en entier - - 6/ Pour les fonction 3/ et 5/, dans le cas ou le champ par lequel on - eut multiplier l'angle solide est axisymmétrique (toroidalement - invariant), on peut le multiplier par l'intégrale toroidale de l'angle - solideau lieu de faire un calcul détaillé dans tout le volume. Dans ce - cas, le calcul doit aller plus vite et économiser pas mal de mémoire - puisqu'on écrase sur une dimension). Il fut alors: - - Echantilloner le volume qui nous intéresse (fonction - sample_V() existante, s'en inspirer), en faisant une boucle sur - le grand rayon R (car c'est lui qui détermine le nombre - d'échantillonages toroidaux), c'est cette boucle supérieure - que l'on pourra ensuite parallliser.. - - En déduire un échantillonage (phi,Z), pour chaque point de - l'échantillonage voir si le point / polygone est visible, le - cas échéant calculer l'angle solide (et le vecteur ? à - discuter), puis l'intégrer sur phi. - - A la fin on obtient une carte 2D (R,Z) de l'angle solide - intégré en phi - - 7/ Faire la même chose que 5/ mais en intercalant un nombre arbitraire - d'ouvertires polygonles et de grilles polygonales, calculer l'angle - solide correspondant à l'intersection de tous ces polygones vu du - plasma (i.e. : les photons doivent passer à travers toutes les - ouvertures / griles avant d'atteindre les détecteurs). - - 7/ On va commencer à gérer: - - Les réflexions (spéculaires et diffusives) - - Les réflexions sur un cristal à simple ou double courbure - (pour les spectromètres) - - - 8/ S'attaquer aux maillages (an 2) - -J'arrive ;-) -A toute -Didier diff --git a/_updateversion.py b/_updateversion.py index b14f878f2..83a07ec3e 100644 --- a/_updateversion.py +++ b/_updateversion.py @@ -2,15 +2,15 @@ # coding=utf-8 import sys -import os +import os import subprocess -_HERE = os.path.join(os.path.abspath(os.path.dirname(__file__)),'tofu') +here = os.path.join(os.path.abspath(os.path.dirname(__file__)),'tofu') -def updateversion(path=_HERE): +def updateversion(here=here): # Fetch version from git tags, and write to version.py # Also, when git is not available (PyPi package), use stored version.py - version_py = os.path.join(path,"version.py") + version_py = os.path.join(here,"version.py") try: if sys.version[0]=='2': version_git = subprocess.check_output(["git","describe"]).rstrip() @@ -21,12 +21,11 @@ def updateversion(path=_HERE): except: with open(version_py,'r') as fh: version_git = fh.read().strip().split("=")[-1].replace("'",'') - version_git = version_git.lower().replace('v','') + version_git = version_git[1:] if version_git[0].lower()=='v' else version_git - version_msg = "# Do not edit, pipeline versioning governed by git tags!" + version_msg = "# Do not edit this file, pipeline versioning is governed by git tags !" with open(version_py,"w") as fh: - msg = "{0}__version__ = '{1}'{0}".format(os.linesep, version_git) - fh.write(version_msg + msg) + fh.write((version_msg + os.linesep + '__version__=').replace('',"") + "'%s'" % version_git) return version_git diff --git a/benchmarks/__init__.py b/benchmarks/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/benchmarks/calc_signal_benchmark.py b/benchmarks/calc_signal_benchmark.py index a0dcf9df0..ea2ea21e0 100644 --- a/benchmarks/calc_signal_benchmark.py +++ b/benchmarks/calc_signal_benchmark.py @@ -42,9 +42,9 @@ # Defining defaults ################### -_LRES = [-3, -3, 0] -_LLOS = [5, 5, 0] -_LT = [3, 3, 0] +_LRES = [-2, -2, 0] +_LLOS = [2, 2, 0] +_LT = [2, 2, 0] _NREP = 2 _DRES = abs(_LRES[1] - _LRES[0]) @@ -154,16 +154,19 @@ def benchmark(config=None, func=_FUNC, plasma=None, shot=None, ids=None, # printing file stdout = False + msg_loc = "\ntofu {} loaded from:\n {}\n".format(tfversion, tforigin) if txtfile is None: txtfile = sys.stdout stdout = True + print(msg_loc) elif type(txtfile) is str: - txtfile = open(os.path.join(path,txtfile), 'w') + txtfile = os.path.join(path, txtfile) + with open(txtfile, 'w') as f: + f.write(msg_loc) elif txtfile is True: - txtfile = open(os.path.join(path,name+'.txt'), 'w') - msg_loc = "\ntofu %s loaded from:\n %s\n"%(tfversion,tforigin) - print(msg_loc, file=txtfile) - + txtfile = os.path.join(path, name+'.txt') + with open(txtfile, 'w') as f: + f.write(msg_loc) # config if config is None: @@ -222,12 +225,23 @@ def benchmark(config=None, func=_FUNC, plasma=None, shot=None, ids=None, msg += "res = %s\n"%str(res) msg += "nt = %s\n"%str(nt) msg += "rep = %s\n\n"%str(nrep) - msg += " algo:".ljust(lennames) + ' times:' - print(msg, file=txtfile) + msg += " algo:" + msg = msg.ljust(lennames) + msg += ' times:' + if stdout: + print(msg) + else: + with open(txtfile, 'w') as f: + f.write(msg) err0 = None for ii in range(nalgo): - print('', file=txtfile, flush=True) + if stdout: + print('') + sys.stdout.flush() + else: + with open(txtfile, 'w') as f: + f.write(msg) for jj in range(nnlos): cam = tf.geom.utils.create_CamLOS1D(N12=nlos[jj], config=config, @@ -235,8 +249,12 @@ def benchmark(config=None, func=_FUNC, plasma=None, shot=None, ids=None, Diag='Dummy', **_DCAM) msg = " %s"%(names[ii,jj].ljust(lennames)) - print(msg, file=txtfile, flush=True) - + if stdout: + print(msg) + sys.stdout.flush() + else: + with open(txtfile, 'w') as f: + f.write(msg) for ll in range(nres): msg = " res %s/%s"%(ll+1, nres) for tt in range(nnt): @@ -244,8 +262,8 @@ def benchmark(config=None, func=_FUNC, plasma=None, shot=None, ids=None, for rr in range(nrep): if stdout: msgi = "\r" + msg + " nt %s/%s rep %s/%s"%(tt+1,nnt,rr+1,nrep) - print(msgi, end='', file=txtfile, flush=True) - + print(msgi, end='') + sys.stdout.flush() try: if func is None: t0 = dtm.datetime.now() @@ -279,11 +297,20 @@ def benchmark(config=None, func=_FUNC, plasma=None, shot=None, ids=None, msgi = msg + ': %s'%str(t_av[ii,jj,ll,:]) if stdout: msgi = '\r'+msgi - print(msgi, file=txtfile, flush=True) + print(msgi) + sys.stdout.flush() + else: + with open(txtfile, 'w') as f: + f.write(msgi) + if save: out = {kk:vv for kk,vv in locals().items() if kk in lk} np.savez(pfe, **out) - print(" (saved)", file=txtfile) + if stdout: + print(" (saved)") + else: + with open(txtfile, 'w') as f: + f.write(" (saved)") @@ -312,9 +339,11 @@ def benchmark(config=None, func=_FUNC, plasma=None, shot=None, ids=None, msg += "\n ".join(["%s : %s"%(lalgo[ii].ljust(ln), 100.*np.sum(t_av[ii,...]>=0)/ncase) + ' %' for ii in range(nalgo)]) - print(msg, file=txtfile) - - + if stdout: + print(msg) + else: + with open(txtfile, 'w') as f: + f.write(msg) if err0 is not None: raise err0 @@ -325,7 +354,12 @@ def benchmark(config=None, func=_FUNC, plasma=None, shot=None, ids=None, if save: out = {kk:vv for kk,vv in locals().items() if kk in lk} np.savez(pfe, **out) - print('Saved in:\n %s'%pfe, file=txtfile) + if stdout: + print('Saved in:\n {}'.format(pfe)) + else: + with open(txtfile, 'w') as f: + f.write('Saved in:\n {}'.format(pfe)) + if plot: try: diff --git a/doc/source/aboutus.rst b/doc/source/aboutus.rst deleted file mode 100644 index 0372f55e4..000000000 --- a/doc/source/aboutus.rst +++ /dev/null @@ -1,49 +0,0 @@ -======== -About us -======== - ----------------- - -.. note:: - If you decide to use **tofu** for research and published results please - acknowledge this work by citing_ the project. - -.. _citing: citation.html - -------- -History -------- - -**ToFu** (TOmography for FUsion) is an open-source python library first created -at the Max-Planck Institute for Plasma Physics (IPP) in Garching (Germany) by -Didier Vezinet (as a postdoc) through the years 2014-2016. -It is continuously maintained, debugged and upgraded to this day. - -.. - Authors - -.. include:: authors.rst - ------------ -Contact us ------------ - -If you found a bug in **tofu**, or if you a suggestion, the best is to open -an issue directly on our `github page `_. - -If you want to chat, join our `gitter chat `_. - - -------- -License -------- - -**tofu** is distributed under the very permissive MIT license, thus allowing -free use, keeping in mind that neither the author nor any of the laboratories -in which he worked can be held responsible for unwanted behaviour or results. -It is instead transparency, reproducibility and incremental improvements that -guarantee quality on the long-term. - ---------- - -.. include:: ../../LICENSE.txt diff --git a/doc/source/authors.rst b/doc/source/authors.rst deleted file mode 100644 index c8448659e..000000000 --- a/doc/source/authors.rst +++ /dev/null @@ -1,9 +0,0 @@ --------- -Authors --------- - -* Didier Vezinet (creator) -* Laura S. Mendoza (developper since 2018) -* Florian Le Bourdais -* Jorge Morales -* Arpan Khandelwal diff --git a/doc/source/citation.rst b/doc/source/citation.rst deleted file mode 100644 index 13277ac0f..000000000 --- a/doc/source/citation.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. role:: envvar(literal) -.. role:: command(literal) -.. role:: file(literal) -.. role:: ref(title-reference) - -Citing ToFu -============ - -An article dedicated to describing ToFu and its capacities is in preparation, in the meantime please cite this one_ [#]_, which briefly describes it and uses it to present physics results. Since this paper may not present enough details for the interested reader, please also include a url pointing to this web-based documentation. - -.. _one: http://iopscience.iop.org/article/10.1088/0029-5515/56/8/086001/meta - -.. [#] D. Vezinet et al., 'Non-monotonic growth rates of sawtooth precursors evidenced with a new method on ASDEX Upgrade', Nuclear Fusion **56**, 086001, 2016 - -**Bibtex:** - -:: - - @article{0029-5515-56-8-086001, - author={D. Vezinet and V. Igochine and M. Weiland and Q. Yu and A. Gude and D. Meshcheriakov and M. Sertoli and the Asdex Upgrade - Team and the EUROfusion MST1 Team}, - title={Non-monotonic growth rates of sawtooth precursors evidenced with a new method on ASDEX Upgrade}, - journal={Nuclear Fusion}, - volume={56}, - number={8}, - pages={086001}, - url={http://stacks.iop.org/0029-5515/56/i=8/a=086001}, - year={2016}, - } diff --git a/doc/source/columns.html b/doc/source/columns.html deleted file mode 100644 index 5812a32d7..000000000 --- a/doc/source/columns.html +++ /dev/null @@ -1,22 +0,0 @@ -
-
-
-
-

More about tofu

-

Who are we ? When was tofu created ? - Who are our collaborators ?

- About us -
-
-
-
-
-
-

Tofu's history

-

History of all releases of tofu. - Learn what's new on the latest version

- Releases -
-
-
-
diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst deleted file mode 100644 index cbe3b8077..000000000 --- a/doc/source/contributing.rst +++ /dev/null @@ -1,90 +0,0 @@ - -Contributing to tofu -==================== - -You found a bug, or you want to add something to the library ? This -tutorial will show you how to get the repository and the first steps to -contribute to the project. - -There are many tools and concepts to get familiar with when contributing -to an **open-source python library**. A good place to get started is the -`scikit-project `__. -And here is a list of tools you should get familiar with: - -- ``Python``: the main language of **tofu** -- ``IPython``: powerful interactive shell for python, and check this - `tutorial `__ -- ``git``, and the `feature branch - workflow `__ -- ``github``: follow and watch `our - project `__ -- A text editor: ``emacs``, ``vim``, ``sublime``, or whichever you want - - -We will use Miniconda (light version of Anaconda, but you can also work -with Anaconda or another python package manager of your choice) not only -to install and manage the packages necessary for installing ToFu, but -also to have a working bash-like Terminal. - -- `Get the latest version and install - it. `__ -- Follow the directions (you can use default options) - -We are going to create an environment specific for ToFu. - -:: - - $ conda create -n tofu3 python scipy numpy cython git ipython - $ conda activate tofu3 - -This creates a conda environment named "tofu3" and installs scipy, -numpy, git, ipython and cython. The second command activates this -environment. - -- Create a ssh public key and add it to your GitHub account: `follow - this - tutorial. `__ -- Go to ToFu's GitHub repository: - `here. `__ -- Click on "clone or download" and swith to the option "Use SSH". Copy - the link. -- Move to where you would like to install ToFu ``$ cd some_path`` -- ``$ git clone git@github.com:ToFuProject/tofu.git`` (make sure you - remember the path where you are installing, if you want to install it - into your home repository, just make sure to ``cd ~`` before the - ``git clone...``) - - -- Move to the tofu directory, probably: ``cd ~/tofu`` -- Switch to the ``git`` branch you will be working on. If you are just - starting you probably want to start from the latest develop branch: - ``git checkout devel``. If you are not familiar with **git** take a - look at `this tutorial - (long) `__ or `this short - one `__ -- Compile ``python setup.py build_ext --inplace`` -- Make sure tests are running ``nosetests`` - - - -If you wish to contribute, but don't know where to start, check `our -open issues `__. You can -also read `this -tutorial `__, -on how to contribute to a github project. Before modifying the code, you -should create a new branch (based on the *devel* branch) and switch to it. - -:: - - git checkout -b # probably IssueNumber eg. Issue123 - # change the source code - git add - git commit -m "[a tag] a message that explains what you changed" - git push -u origin - -Now you can open a pull request in our `github -page `__, from your branch, -``theNameOfYourBranch`` to ``devel``. We will review it, comment it, and -accept it. - - diff --git a/doc/source/figures_doc/cam1d_plot.png b/doc/source/figures_doc/cam1d_plot.png deleted file mode 100644 index 6a32fad6e..000000000 Binary files a/doc/source/figures_doc/cam1d_plot.png and /dev/null differ diff --git a/doc/source/figures_doc/cam1d_plot_touch.png b/doc/source/figures_doc/cam1d_plot_touch.png deleted file mode 100644 index c8a4c375b..000000000 Binary files a/doc/source/figures_doc/cam1d_plot_touch.png and /dev/null differ diff --git a/doc/source/figures_doc/cam2d_plot_touch.png b/doc/source/figures_doc/cam2d_plot_touch.png deleted file mode 100644 index 4ac8635bb..000000000 Binary files a/doc/source/figures_doc/cam2d_plot_touch.png and /dev/null differ diff --git a/doc/source/installation.rst b/doc/source/installation.rst deleted file mode 100644 index db49d1a62..000000000 --- a/doc/source/installation.rst +++ /dev/null @@ -1,145 +0,0 @@ -.. _installation: - -Installing tofu -================ - -As of October 2019, `tofu` is still under heavy development. Therefore, installation -instructions are provided officialy for Linux and ITER users. However, instructions -for other platforms are also provided since they have been known to work out for some users. -If installation fails for your use-case, please open an issue over -at `Github. `__ so that we can try adressing it. - -- :ref:`installing-tofu-on-linux` -- :ref:`installing-tofu-on-mac` -- :ref:`installing-tofu-on-windows` -- :ref:`iter-users` -- :ref:`installing-as-a-developer` - - -.. _installing-tofu-on-linux: - -Linux ------ - -To install and use `tofu` on Linux, we recommend to proceed in two steps: install the -Python package manager conda and then install tofu. -We recommend ``Miniconda`` (light version of the Anaconda Python distribution for data science, -but you can also work with ``pip`` or another Python package manager of -your choice). - -- `Get the latest Miniconda version and install - it. `__ -- Install tofu - -:: - - $ conda install -c tofuproject tofu - -- Check that tofu works by printing its version number: - -:: - - python -c "import tofu; print(tofu.__version__)" - -Now you can `follow a tutorial. `__ - -.. _installing-tofu-on-mac: - -Mac OS X --------- - -See :ref:`installing-as-a-developer`. - -.. _installing-tofu-on-windows: - -Windows -------- - -See :ref:`installing-as-a-developer`. - -Additional *caveat*: you may need to open an ``Anaconda prompt`` (usually found by pressing -the Windows key) to run the commands described in the linked section. - - -.. _iter-users: - -Using tofu on a ITER cluster ----------------------------- - -If you have an **ITER** account, you can use **tofu** directly from ITER -Computing Cluster. No need to install tofu ! - -- Ask for access to ITER servers, if you don't have them already. -- For information about the cluster, see `this - link. `__ -- Open a new terminal and connect to server (see link above) -- Create a new file in your ``$HOME`` directory, you can name it - ``load_tofu_modules.sh`` -- Open it and add the following lines: - -:: - - module refresh - source /etc/profile.d/modules.sh # make sure you have the module environment - module purge # unload any previously loaded modules - module load IMAS/3.24.0-4.1.5 # for IMAS data base - module load IPython/6.3.1-intel-2018a-Python-3.6.4 # for iPython - module load PySide2/5.12.0-intel-2018a-Python-3.6.4 - module load ToFu/1.4.0-intel-2018a-Python-3.6.4 # Load tofu :) - -- Convert it to an executable, from the terminal: - ``chmod +x ~/load_tofu_modules.sh`` -- Execute it: ``./load_tofu_modules.sh`` -- If you are going to use *tofu* often, you might want to add the - execution of the script to your ``.bash_profile`` (or ``.bashrc`` - file): - -:: - - echo './load_tofu_modules.sh' >> .bash_profile - -You are all set, open a Python/IPython console and try importing tofu. - -:: - - $ python - In [1]: import tofu as tf - -You can now `follow a tutorial. `__ - - -.. _installing-as-a-developer: - -Installing tofu as a developer ------------------------------- - -To install tofu as a developer, we recommend using the conda ecosystem (Miniconda in particular): - -- `Get the latest Miniconda version and install - it. `__ - -- create a dedicated (Python 3) environment for tofu development and activate it - -:: - - $ conda create -n tofu3 python=3.6 scipy numpy cython git - $ conda activate tofu3 - -- Move to where you would like to install your local copy of ToFu ``$ cd some_path`` -- ``$ git clone https://github.com/ToFuProject/tofu.git`` (make sure you - remember the path where you are installing, if you want to install it - into your home repository, just make sure to ``cd ~`` before the - ``git clone...``) -- Move to the "cloned" tofu directory that has been created by the git clone command: - ``cd ~/tofu`` -- Switch to the ``git`` branch you will be working on. If you are just - starting you probably want to start from the latest develop branch: - ``git checkout devel``. If you are not familiar with **git** take a - look at `this tutorial - (long) `__ or `this short - one `__ -- Run ``pip install -e .[dev]``. This will install dependencies, compile the - tofu Cython extensions and install it into your conda environment while you can still - modify the source files in the current repository.` -- Make sure tofu tests are running by typing ``nosetests`` - diff --git a/doc/source/installation_tabs_source.html b/doc/source/installation_tabs_source.html deleted file mode 100644 index 009709f15..000000000 --- a/doc/source/installation_tabs_source.html +++ /dev/null @@ -1,245 +0,0 @@ - -
-
-

Installing tofu on Linux

- This is a quick tutorial on how to install and use ToFu on Linux. -

Installing Anaconda

-

First thing first: get a python package manager.

-

We recommend Miniconda (light version of Anaconda, - but you can also work with Anaconda, pip - or another python package manager of your choice). -

- -

Installing tofu

-

Now you only need to install tofu

-
$ conda install -c tofuproject tofu 
-

For testing tofu we recommend you also install ipython

-
$ conda install ipython 
-

You are all set, open an ipython console and try importing tofu.

-
$ ipython
-In [1]: import tofu as tf 
-

Now you can - follow a tutorial. -

-
-

Installing tofu on Mac OS X

- This is a quick tutorial on how to install and use ToFu on Linux. -

Installing Anaconda

-

First thing first: get a python package manager.

-

We recommend Miniconda (light version of Anaconda, - but you can also work with Anaconda, pip - or another python package manager of your choice). -

- -

Installing tofu

-

First install the dependencies

-
$ conda install pip cython numpy scipy ipython 
-

tofu is not (yet) packaged with anaconda so we need to install it - using pip

-
$ pip install tofu 
-

You are all set, open an ipython console and try importing tofu.

-
$ ipython
-In [1]: import tofu as tf 
-

Now you can - follow a tutorial. -

-
-

Installing tofu on Windows

- This is a quick tutorial on how to install and use ToFu on Windows. -

Installing Anaconda

-

We will use Miniconda (light version of Anaconda, - but you can also work with Anaconda or another python package manager of - your choice) not only to install and manage the packages necessary for - installing ToFu, but also to have a working bash-like Terminal.

- -

Creating a conda environment

-

We are going to create an environment specific for ToFu.

-
$ conda create -n tofu3 python=3.6 scipy numpy cython git
-$ conda activate tofu3
-$ conda install m2-base # Get some basic Linux/bash commands (ls, cd, mv, ...)
-

This creates a conda environment named "tofu3" and installs scipy, - numpy and cython. The second command activates this environment.

-

Get the repository

-
    -
  • Create a ssh public key and add it to your GitHub account: - follow this tutorial.
  • -
  • Go to ToFu's GitHub repository: here.
  • -
  • Click on "clone or download" and swith to the option "Use SSH". Copy the link.
  • -
  • Move to where you would like to install ToFu - $ cd some_path
  • -
  • $ git clone git@github.com:ToFuProject/tofu.git (make - sure you remember the path where you are installing, if you want to - install it into your home repository, just make sure to - cd ~ before the git clone...)
  • -
-

Installing ToFu

-
    -
  • Move to the tofu directory, probably: cd ~/tofu
  • -
  • Switch to the git branch you will be working on. - If you are just starting you probably want to start from the latest - develop branch: git checkout devel. If you are not - familiar with git take a look at - this tutorial (long) - or this short - one
  • -
  • Compile python setup.py build_ext --inplace
  • -
  • We suggest you installing python inside tofu/usr, - you will have to modify your $PYTHONPATH to include this - path. - - How to modify environment variables on Windows
  • -
  • python setup.py install --prefix=$TOFU_DIR\\usr
  • -
  • Make sure tests are running nosetests
  • -
-

Contribute

-

If you wish to contribute, you will probably need a text editor, you can use Visual Studio's editor.

-
-
-

Using tofu on a ITER cluster

-

If you have an ITER account, you can use - tofu directly from ITER Computing Cluster. - No need to install tofu !

-
    -
  • Ask for access to ITER servers, if you don't have them already.
  • -
  • For information about the cluster, see - - this link.
  • -
  • Open a new terminal and connect to server (see link above)
  • -
  • Create a new file in your $HOME directory, you can - name it load_tofu_modules.sh
  • -
  • Open it and add the following lines:
  • -
-
module refresh
-source /etc/profile.d/modules.sh # make sure you have the module environment
-module purge # unload any previously loaded modules
-module load IMAS/3.24.0-4.1.5 # for IMAS data base
-module load IPython/6.3.1-intel-2018a-Python-3.6.4 # for iPython
-module load PySide2/5.12.0-intel-2018a-Python-3.6.4
-module load ToFu/1.4.0-intel-2018a-Python-3.6.4 # Load tofu :)
-
    -
  • Convert it as an exectuable, from terminal: - chmod +x ~/load_tofu_modules.sh
  • -
  • Execute it: ./load_tofu_modules.sh
  • -
  • If you are going to use tofu often, you might want to add - the execution of the script to your .bash_profile - (or .bashrc file):
  • -
-
echo './load_tofu_modules.sh' >> .bash_profile
-

You are all set, open an ipython console and try importing tofu.

-
$ ipython
-In [1]: import tofu as tf
-

Now you can - follow a tutorial. -

-
-

Installing tofu as a developer or contributor

- You found a bug, or you want to add something to the library ? - This tutorial will show you how to get the repository and the - first steps to contribute to the project. -

First steps

-

There are many tools and concepts to get familiar with when contributing - to an open-source python library. A good place to get started is - the - scikit-project. And here is a list of tools you should get familiar - with: -

    -
  • python: the main language of tofu -
  • ipython: powerful interactive shell for python, and - check this - tutorial
  • -
  • git, and the - - feature branch workflow
  • -
  • github: follow and watch our project -
  • A text editor: emacs, vim, sublime, or whichever you want -
-

-

Installing Anaconda

-

We will use Miniconda (light version of Anaconda, - but you can also work with Anaconda or another python package manager of - your choice) not only to install and manage the packages necessary for - installing ToFu, but also to have a working bash-like Terminal.

- -

Creating a conda environment

-

We are going to create an environment specific for ToFu.

-
$ conda create -n tofu3 python scipy numpy cython git ipython
-$ conda activate tofu3
-

This creates a conda environment named "tofu3" and installs scipy, - numpy, git, ipython and cython. - The second command activates this environment.

-

Get the repository

-
    -
  • Create a ssh public key and add it to your GitHub account: - follow this tutorial.
  • -
  • Go to ToFu's GitHub repository: here.
  • -
  • Click on "clone or download" and swith to the option "Use SSH". Copy the link.
  • -
  • Move to where you would like to install ToFu - $ cd some_path
  • -
  • $ git clone git@github.com:ToFuProject/tofu.git - (make sure you remember the path where you are installing, - if you want to install it into your home repository, just make sure to - cd ~ before the git clone...)
  • -
-

Installing ToFu

-
    -
  • Move to the tofu directory, probably: cd ~/tofu
  • -
  • Switch to the git branch you will be working on. - If you are just starting you probably want to start from the - latest develop branch: git checkout devel. - If you are not familiar with git take a look at - this tutorial - (long) or this - short one
  • -
  • Compile python setup.py build_ext --inplace
  • -
  • Make sure tests are running nosetests
  • -
-

Contribute

-

If you wish to contribute, but don't know where to start, check - our open issues. - You can also read - this tutorial, on how to contribute to a github project. - Before modifying the code, you should create a new branch and switch to - it.

-
git checkout -b <theNameOfYourBranch> # probably IssueNumber eg. Issue123
-# change the source code
-git add <files you changed>
-git commit -m "[a tag] a message that explains what you changed"
-git push -u origin <theNameOfYourBranch>
-

Now you can open a pull request in our github page, - from your branch, theNameOfYourBranch to devel. We will review it, - comment it, and accept it. -

-
diff --git a/doc/source/release_notes/release_notes_140.txt b/doc/source/release_notes/release_notes_140.txt deleted file mode 100644 index 8c0773d68..000000000 --- a/doc/source/release_notes/release_notes_140.txt +++ /dev/null @@ -1,41 +0,0 @@ -What's new in 1.4.0 --------------------- - -* All structures are now inherited from an abstract class (in tofu.geom) and are either of type: - - 'In': there can be plasma inside, they are empty structures (e.g.: Vessel) - - 'Out': there is only plasma outside, they are solid blocks (e.g.: PFC) - -* The Config (in tofu.geom) class handles all Struct instances and provides an easy way to manipulate / visualize the whoel tokamak - -* CamLOS1D and CamLOS2D (standing for 'Camera made of Lines of Sight, arranged in 1D or 2D) are subclasses of the abstract Rays class (in tofu.geom), they: - - provide an easy way to handle multiple Rays / LOS - - compute their intersections with the Struct instances (i.e.: detect vignetting, entry and exit points...) - - plot the LOS in pre-defined interactive figures (plot(), plot_touch() and plot_sinogram() methods) - - provide methods for computing : - the length of each LOS inside an user-provided polygon (e.g.: separatrix) - the distance to a 3D flat circle centered on the tokamak's vertical axis (e.g.magnetic axis) - the synthetic signal (i.e: the LOS-integrals of a user-provided scalar 2D or 3D emissivity field), and plot it using a DataCam1D or DataCam2D class - -* Many LOS-computing routines have been optimized and parallelized by Laura Mendoza using Cython, in particular but not only: - - computation of entry / exit points of each LOS for a large number of PFC / Struct (~ seconds for 1 million LOS and ~ 100 Struct) - - computation of the length of each LOS inside a Polygon (e.g.: separatrix) - - computation of the distance to a circle (e.g.: magnetic axis) - - computation of distance to closed polygons (e.g.: spearatrix) when the LOS passed outside of it - -* DataCam1D and DataCam2D and data-handling classes (in tofu.data), designed to handle data from CamLOS1D or CamLOS2D (i.e.: from 1D or 2D cameras), providing: - - data visualization pre-defined interactive matplotlib figures (plot(), plot_compare() and plot_combine() methods) - - basic data-treatment methods (time step and channel selection, interpolation, base signal substraction, fft, svd, ...) - - spectrogram and svd interactive plotting methods - -* DataCam1DSpectral and DataCam2D spectral (tofu.data) provide equivalent classes for handling data with a spectral resolution in addition coming from 1D or 2D cameras - -* Plasma2D (tofu.data) provides a class for handling multiple 1D (radial) and 2D (cross-section) plasma quantities profiles (Te, ne, rho, psi, zeff...) and: - - provides methods for easy plotting - - allows each quantity to depend on its own time and space references - - handles triangular meshes - - can exports to DataCam1D any 1D profile - -* imas2tofu is a new sub-package addressing imas / tofu interacing, it provides in particular: - - load_Config() : an easy way to load a Config instance from an ids dict provided by the user (from 'wall' ids) - - load_Plasma2D() : an easy way to load a Plasma2D instance from an ids dict provided by the user (from 'equilibrium, core_profile' and 'core_sources' idss) - - load_Diag() : an easy way to load a CamLOS1D instance from an ids dict provided by the user (from a diagnostic-specific ids, e.g.: 'bolometer', 'ece'...) diff --git a/doc/source/release_notes/release_notes_141.rst b/doc/source/release_notes/release_notes_141.rst deleted file mode 100644 index 3ad9c8380..000000000 --- a/doc/source/release_notes/release_notes_141.rst +++ /dev/null @@ -1,291 +0,0 @@ -==================== -What's new in 1.4.1 -==================== - -Summary -======= - -General -------- - -- All tofu object have overloaded **repr** method -- units tests improved, Continuous Integration more complete, several - bugs fixed -- More robust wndows pip installation -- More robust saving to .mat -- tofuplot and tofucalc now provide simple bash interfaces - -The geometry module is now more complete ----------------------------------------- - -- A Config class handles the tokamak geometry -- A CamLOS1D class handles arbitrary sets of LOS -- A CamLOS2D class handles 2D cameras approximated as a set of LOS -- Basic reflexions are taken into account -- Ray-tracing, LOS-campling and LOS-integration algorithls have been - accelerated and parallelized -- Several utility function implemented for easy instance creation and - useful geometrical computations -- The basics of a magnetic field-line tracing algorithm and plotting - routine have been implemented - -IMAS-interfacing ----------------- - -- More robust MultiIDSLoader class for IMAS interfacing -- Can import from IMAS and export as tofu classes -- Very flexible and customizable -- Some classes have a save\_to\_imas() method - -Next to come ------------- - -- Solid angles, solid angles, solid angles - -Detailed Changelog -================== - -Enhancements ------------- - -Geometry -~~~~~~~~ - -Algorithms to compute distance between LOS and a flux surfaces -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- Compute distance between LOS and a circle (*+ vectorial version*) -- Test if a LOS and a circle are close to a epsilon (*+ vectorial - version*) -- Compute distance between LOS and VPoly (*+ vectorial version*) -- Test if a LOS and a VPoly are close to a epsilon (*+ vectorial - version*) -- Compute which LOS is closer to a VPoly -- Compute which VPoly is closer to a LOS - -Algorithms for discretization and sampling -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- Optimization of discretization of 1D lines (simple + complex - version), 2D lines, 2D polygons -- Optimization of LOS sampling and all the different rules: - parallelized and using less memory. - -Calc signal (function integration over LOS): -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- ``LOS_calc_signal`` now cythonized for isotropic and anisotropic - emissivity and several sampling / integration strategies - -Algorithms to check if visible -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- Optimization ``LOS_isVis_PtFromPts_VesStruct`` checks if a point is - visible with respect to a list of points and taking into account a - vessel (with structures, limits, etc.) : function cythonized - properly, speed up ~50% -- ``LOS_areVis_PtsFromPts_VesStruct`` equivalent to last function but - input is a list of points -- ``Dust_calc_SolidAngle`` is now using new versions of above mentioned - functions - -Vignetting -^^^^^^^^^^ - -- Added functions to compute the 3d bounding box of a polygon in 3d - space -- Added functions for the triangulation of a polygon by earclipping -- Added function that tests if intersection between ray and triangle in - space -- Added functions for vignetting : for a set of rays and a sets of - polygons, test if the rays go through the polygons or not. - -Structures and Configuration -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -- ``tf.geom.Struct._get_phithetaproj()``: to get the (phi, theta) - limits in a project of each toroidal occurence of Struct, with - respect to a refpt in (R,Z) -- ``tf.geom.Struct._get_phithetaproj_dist()``: + get the distance -- ``tf.geom.dist._get_phithetaproj_dist()``: generalize to all Struct - of a Config -- Config has set\_colors\_random() - -Solid angles -^^^^^^^^^^^^ - -- Added ``_GG.Dust_calc_SolidAngle`` for computation of a solid angle - on dust particle (multi-pos, multi-pts, with and without vect, with - and without approx, with and without block) - -Basic Reflexions -^^^^^^^^^^^^^^^^ - -- Rays subclasses can now have added reflections - (self.add\_reflections()) -- Reflections can alos be extracted (instead of stored) as a list of - separated cameras using Rays.get\_reflections\_as\_cam() -- Reflections can be of type 'specular', 'diffusive' or 'ccube' -- The reflection type can be forced by the user (identical for all LOS - of a camera) or automatically set by the Structural elements each LOS - touches -- There can be any number of reflections -- Rays.plot() and Rays.plot\_touch() have been updated to properly - represent reflections -- Rays.calc\_signal() and Rays.calc\_signal\_from\_Plasma2D() have been - updated to account for reflections with a user-provided coefficient - -Cythonization -^^^^^^^^^^^^^ - -- Re wrote some numpy function to avoid over heading: hypothenus and - composition of minimum of hypotenus, minimum of vector, tile, - -Extra -^^^^^ - -- Erased *old* functions: - - - ``SLOW_LOS_Calc_PInOut_VesStruct`` - - ``Calc_LOS_PInOut_Lin`` - - ``Calc_LOS_PInOut_Tor`` - -- extract\_svd() now compatible with Py27 and Py36 -- Rays.dgeom['indout'][0,:] now refers to the global index of each - structure (as in config.lStruct) -- Operator overloading of \_\_\_\_repr\_\_\_\_ of all tofu objects with - attribute get\_summary() - -Cameras and visualization -~~~~~~~~~~~~~~~~~~~~~~~~~ - -- overloaded **add** operator to allow for easy CamLOS1D concatenation -- ``tf.geom.dist.plot_phithetaproj_dist()``: plot a static figure with - a place holder for time traces, the (phi,theta) projection (with - aspect ratio), the cross and hor Config projections and legend -- ``Rays.plot_touch()`` now handles: angles (wrote docstring) - -General -~~~~~~~ - -- get\_summary() is now a method of the AbstractToFuObject parent - class, implemented for Config, CamLOS1D, Plasma2D -- saving to .mat file is now more robust (operational) -- Added benchmarking for ``calc_signal`` - -IMAS interfacing ----------------- - -1. libraries that need imas2tofu are only imported if the **IMAS** - module is found (Warning not Error) - -2. **MultiIDSLoader** class now handles all imas interfacing: - -- allows for loading several ids from different idd -- dynamic printing of ids loading -- get\_summary() methods giving an overview of content -- provides a dictionary of shortcuts for fast typing of pre-recorded - imas signals -- provides dictionary of preset ids and signals -- Flexible instanciation, from idd of idd args, ids or ids args, open - or not, get or not -- provides add\_idd(), remove\_idd(), add\_ids(), remove\_ids() -- Include to\_Config(), to\_Plasma2D(), to\_Diag() to export to tofu - objects - -3. \*\*All stored in a single \_core.py\*\*: - -- MultiIDSLoader -- load\_Config(), load\_Plasma2D(), load\_Diag() - -4. **save\_to\_imas()** - -- Actual routines implemented in tf.imas2tofu.\_core -- methods implemented for Struct, Config, CamLOS1D - -5. Other - -- MultiIDSLoader now has calc\_signal() -- ids = 'magfieldlines' returns mag field line tracking from IMAS - equilibrium -- More robust / detailed sanity checks of triangular meshes from IMAS -- Synthetic data and experimental data are now time-synchronized -- Synthetic diag operational on WEST for interferometer, polarimeter, - bremsstrahlung and bolometers - -bash interface: ---------------- - -- tofuplot debugged -- tofucalc created - -Code structure and format -------------------------- - -Restructuring of the geometry modules -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Created Cython include files ``*.pxd`` and ``*.pyx`` for the following -group of functions: - ``_basic_geom_tools.*``: global variables -definition (``_VSMALL`` and ``_SMALL``), and basic geometric tools -(vector calculus, path distance point-point, point-vector,...) - -``_raytracing_tools.*``: for intersection of LOS and different objects -(bounding boxes, poly, surfaces, ...) - ``_distance_tools.*``: distance -between LOS and circle, VPoly and so on - ``_sampling_tools.*``: line, -LOS, poly, volume, and surface sampling - -Installation and portability ----------------------------- - -- Had to use some cpp tools, so had to update the ``setup.py`` -- Updated the ``setup.py`` to be able to "clean" an installation (erase - compilation files) -- Took out the possibility of not using cython, as this is now - impossible -- git dependency is now optional (issue #67 ) -- changes in ``setup.py`` for **Windows** portability -- Now only supporting ``Cython`` versions ``>=0.26`` -- Removed all **pandas** dependencies -- Using ``-O3`` flag instead of ``-O0`` for faster execution time even - if compilation is slower -- Removed all **Polygon** dependencies - -Unit test ---------- - -- Added unit tests for triangulations, and vignetting -- Added unit test for computation of kmin, kmax - ``LOS_Calc_kMinkMax_VesStruct`` -- Update of ``in _vessel`` tests -- Added tests for ``is_visble`` (vectorized and point wise) -- Now by default ``python setup.py nosetests`` with run with: verbose, - detailed erorrs, coverage (nose) and other utilities for debugging. - But most importantly **only tests in ``tofu/tofu/tests/`` will be - run**. -- Testing all get\_sample options in a short new unit test -- Testing all options for LOS\_calc\_signal (method of discretization, - of integration, steps relative, absolute, unique or changing for each - los, etc.). - -Update of documentation ------------------------ - -- Added documentation on how to install on Windows -- Updated, restructured and adde figures to README. Change of format - ``*.rst`` to ``*.md`` -- Updated Wiki pages on GitHub - -Bugs ----- - -- Found several small bugs in the function that computes for a list of - flux surfaces and a list of rays the kmin, kmax -- There was a bug in some special cases of 1D camera definition, when - all Ds are on a similar plane sharing the same D for the 2 first LOS, - solved -- There was a bug in tf.data.\ *plot*\ combine() (wrong graph), solved - (issue #65 ) -- There was another bug with plot\_combine() when several equilibria - were provided, the reference time was not properly defined - (short-term fix, on the long term issue #79 should fix it) - diff --git a/doc/source/releases.rst b/doc/source/releases.rst deleted file mode 100644 index aec92da53..000000000 --- a/doc/source/releases.rst +++ /dev/null @@ -1,8 +0,0 @@ -Latest release -============== - -.. toctree:: - :maxdepth: 1 - - release_notes/release_notes_141.rst - release_notes/release_notes_140.txt diff --git a/doc/source/tofu.data.rst b/doc/source/tofu.data.rst deleted file mode 100644 index a294cb363..000000000 --- a/doc/source/tofu.data.rst +++ /dev/null @@ -1,54 +0,0 @@ -tofu.data package -================= - -Submodules ----------- - -tofu.data.\_comp module ------------------------ - -.. automodule:: tofu.data._comp - :members: - :undoc-members: - :show-inheritance: - -tofu.data.\_core module ------------------------ - -.. automodule:: tofu.data._core - :members: - :undoc-members: - :show-inheritance: - -tofu.data.\_def module ----------------------- - -.. automodule:: tofu.data._def - :members: - :undoc-members: - :show-inheritance: - -tofu.data.\_physics module --------------------------- - -.. automodule:: tofu.data._physics - :members: - :undoc-members: - :show-inheritance: - -tofu.data.\_plot module ------------------------ - -.. automodule:: tofu.data._plot - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: tofu.data - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/tofu.dumpro.rst b/doc/source/tofu.dumpro.rst deleted file mode 100644 index cdcc0331a..000000000 --- a/doc/source/tofu.dumpro.rst +++ /dev/null @@ -1,62 +0,0 @@ -tofu.dumpro package -=================== - -Submodules ----------- - -tofu.dumpro.\_comp module -------------------------- - -.. automodule:: tofu.dumpro._comp - :members: - :undoc-members: - :show-inheritance: - -tofu.dumpro.\_comp\_clusters module ------------------------------------ - -.. automodule:: tofu.dumpro._comp_clusters - :members: - :undoc-members: - :show-inheritance: - -tofu.dumpro.\_core module -------------------------- - -.. automodule:: tofu.dumpro._core - :members: - :undoc-members: - :show-inheritance: - -tofu.dumpro.\_def module ------------------------- - -.. automodule:: tofu.dumpro._def - :members: - :undoc-members: - :show-inheritance: - -tofu.dumpro.\_draft module --------------------------- - -.. automodule:: tofu.dumpro._draft - :members: - :undoc-members: - :show-inheritance: - -tofu.dumpro.\_plot module -------------------------- - -.. automodule:: tofu.dumpro._plot - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: tofu.dumpro - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/tofu.dust.rst b/doc/source/tofu.dust.rst deleted file mode 100644 index ec5e91793..000000000 --- a/doc/source/tofu.dust.rst +++ /dev/null @@ -1,38 +0,0 @@ -tofu.dust package -================= - -Submodules ----------- - -tofu.dust.\_comp module ------------------------ - -.. automodule:: tofu.dust._comp - :members: - :undoc-members: - :show-inheritance: - -tofu.dust.\_core module ------------------------ - -.. automodule:: tofu.dust._core - :members: - :undoc-members: - :show-inheritance: - -tofu.dust.\_plot module ------------------------ - -.. automodule:: tofu.dust._plot - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: tofu.dust - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/tofu.geom.rst b/doc/source/tofu.geom.rst deleted file mode 100644 index a9e81a053..000000000 --- a/doc/source/tofu.geom.rst +++ /dev/null @@ -1,118 +0,0 @@ -tofu.geom package -================= - -Submodules ----------- - -tofu.geom.\_GG module ---------------------- - -.. automodule:: tofu.geom._GG - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_GG02 module ------------------------ - -.. automodule:: tofu.geom._GG02 - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_GG03 module ------------------------ - -.. automodule:: tofu.geom._GG03 - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_basic\_geom\_tools module -------------------------------------- - -.. automodule:: tofu.geom._basic_geom_tools - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_comp module ------------------------ - -.. automodule:: tofu.geom._comp - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_core module ------------------------ - -.. automodule:: tofu.geom._core - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_def module ----------------------- - -.. automodule:: tofu.geom._def - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_distance\_tools module ----------------------------------- - -.. automodule:: tofu.geom._distance_tools - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_plot module ------------------------ - -.. automodule:: tofu.geom._plot - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_raytracing\_tools module ------------------------------------- - -.. automodule:: tofu.geom._raytracing_tools - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_sampling\_tools module ----------------------------------- - -.. automodule:: tofu.geom._sampling_tools - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.\_vignetting\_tools module ------------------------------------- - -.. automodule:: tofu.geom._vignetting_tools - :members: - :undoc-members: - :show-inheritance: - -tofu.geom.utils module ----------------------- - -.. automodule:: tofu.geom.utils - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: tofu.geom - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/tofu.rst b/doc/source/tofu.rst deleted file mode 100644 index 0ad09fb31..000000000 --- a/doc/source/tofu.rst +++ /dev/null @@ -1,64 +0,0 @@ -tofu package -============ - -Subpackages ------------ - -.. toctree:: - - tofu.data - tofu.dumpro - tofu.dust - tofu.geom - -Submodules ----------- - -tofu.\_plot module ------------------- - -.. automodule:: tofu._plot - :members: - :undoc-members: - :show-inheritance: - -tofu.defaults module --------------------- - -.. automodule:: tofu.defaults - :members: - :undoc-members: - :show-inheritance: - -tofu.pathfile module --------------------- - -.. automodule:: tofu.pathfile - :members: - :undoc-members: - :show-inheritance: - -tofu.utils module ------------------ - -.. automodule:: tofu.utils - :members: - :undoc-members: - :show-inheritance: - -tofu.version module -------------------- - -.. automodule:: tofu.version - :members: - :undoc-members: - :show-inheritance: - - -Module contents ---------------- - -.. automodule:: tofu - :members: - :undoc-members: - :show-inheritance: diff --git a/examples/README.rst b/examples/README.rst deleted file mode 100644 index ee8e6c071..000000000 --- a/examples/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -**tofu** examples and tutorials -=============================== - -This directory contains examples and tutorials for **tofu**. diff --git a/examples/tutorials/README.rst b/examples/tutorials/README.rst deleted file mode 100644 index bf8c2af60..000000000 --- a/examples/tutorials/README.rst +++ /dev/null @@ -1,3 +0,0 @@ -Tutorials -````````` -This directory contains tutorial examples for `tofu`. \ No newline at end of file diff --git a/examples/tutorials/plot_basic_tutorial.py b/examples/tutorials/plot_basic_tutorial.py deleted file mode 100644 index 57d49b04a..000000000 --- a/examples/tutorials/plot_basic_tutorial.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -Getting started: 5 minutes tutorial for `tofu` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This is a tutorial that aims to get a new user a little familiar with tofu's - structure. -""" - -# The following imports matplotlib, preferably using a -# backend that allows the plots to be interactive (Qt5Agg). -import matplotlib -try: - matplotlib.use('Qt5Agg') -except ImportError: - matplotlib.use(matplotlib.rcParams['backend']) - -############################################################################### -# We start by loading `tofu`. You might see some warnings at this stage since -# optional modules for `tofu` could -# be missing on the machine you are working on. This can be ignored safely. - -import tofu as tf - -############################################################################### -# We can now create our first configuration. -# In `tofu` speak, a configuration is the geometry of the device and its structures. -# `tofu` provides pre-defined ones for your to try, so we're going to do just that: - -configB2 = tf.geom.utils.create_config("B2") - -############################################################################### -# The configuration can easily be visualized using the `.plot()` method: - -configB2.plot() - -############################################################################### -# Since `tofu` is all about tomography, let's create a 1D camera and plot its output. - -import numpy as np - -cam1d = tf.geom.utils.create_CamLOS1D( - config=configB2, - P=[3.4, 0, 0], - N12=100, - F=0.1, - D12=0.1, - angs=[np.pi, 0, 0], - Name="", - Exp="", - Diag="", -) -# interactive plot -cam1d.plot_touch() - -############################################################################### -# The principle is similar for 2D cameras. - -cam2d = tf.geom.utils.create_CamLOS2D( - config=configB2, - P=[3.4, 0, 0], - N12=100, - F=0.1, - D12=0.1, - angs=[np.pi, 0, 0], - Name="", - Exp="", - Diag="", -) -cam2d.plot_touch() - -############################################################################### -# What comes next is up to you! -# You could now play with the function parameters (change the cameras -# direction, refinement, aperture), -# with the plots (many are interactive) or create you own tomographic -# configuration. diff --git a/examples/tutorials/plot_create_geometry.py b/examples/tutorials/plot_create_geometry.py deleted file mode 100644 index 12306022b..000000000 --- a/examples/tutorials/plot_create_geometry.py +++ /dev/null @@ -1,160 +0,0 @@ -""" -Creating your first Geometry -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This is a tutorial that shows you how to create a simple geometry. -""" - -import numpy as np -import matplotlib.pyplot as plt -import tofu.geom as tfg - - -############################################################################### -# Creating an empty Vessel -# ------------------------ -# -# If a vessel object does not exist yet, you have to create one (otherwise you -# can just load an existing one). -# A vessel object is basically defined by a 2D simple polygon -# (i.e.: non self-intersecting), that is then expanded linearly or toroidally -# depending on the desired configuration. -# This polygon limits the volume available for the plasma, where the emissivity -# can be non-zero. It is typically defined by the inner wall in a tokamak. -# -# Let's define the polygon limiting the vessel as a circle with a divertor-like -# shape at the bottom: - - -# Define the center, radius and lower limit -R0, Z0, rad, ZL = 2.0, 0.0, 1.0, -0.85 -# Define the key points in the divertor region below ZL -Div_R, Div_Z = [R0 - 0.2, R0, R0 + 0.2], [-1.2, -0.9, -1.2] -# Find the angles corresponding to ZL and span the rest -thet1 = np.arcsin((ZL - Z0) / rad) -thet2 = np.pi - thet1 -thet = np.linspace(thet1, thet2, 100) -# Assemble the polygon -poly_R = np.append(R0 + rad * np.cos(thet), Div_R) -poly_Z = np.append(Z0 + rad * np.sin(thet), Div_Z) -# Plot for checking -plt.figure(facecolor="w", figsize=(6, 6)) -plt.plot(poly_R, poly_Z) -plt.axis("equal") - -############################################################################### -# Notice that the polygon does not have to be closed, ToFu will anyway check -# that and close it automatically if necessary. -# Now let's feed this 2D polygon to the appropriate ToFu class and specify that -# it should be a toroidal type (if linear type 'Lin' is chosen, the length -# should be specified by the 'Lim' keyword argument). -# **tofu** also asks for a name to be associated to this instance, and an -# experiment ('Exp') and a shot number (useful when the same experiment changes -# geometry in time). - -# Create a toroidal Ves instance with name 'MyFirstVessel', associated to -# the experiment 'Misc' (for 'Miscellaneous') and shot number 0 -ves = tfg.Ves( - Name="MyFirstVessel", - Poly=[poly_R, poly_Z], - Type="Tor", - Exp="Misc", - shot=0 -) - -############################################################################### -# Now the vessel instance is created. It provides you several key attributes -# and methods (see :class:`~tofu.geom` for details). -# Among them the Id attribute is itself a class instance that contains all -# useful information about this vessel instance for identification, saving... -# In particular, that's where the name, the default saving path, the Type, the -# experiment, the shot number... are all stored. -# A default name for saving was also created that automatically includes not -# only the name you gave but also the module from which this instance was -# created (tofu.geom or tfg), the type of object, the experiment, the shot -# number... -# This recommended default pattern is useful for quick identification of saved -# object, it is advised not to modify it. - -print(ves.Id.SaveName) - -############################################################################### -# Now, we can simply visualise the created vessel by using the dedicated method -# (keyword argument 'Elt' specifies the elements of the instance we want to -# plot, typically one letter corresponds to one element, here we just want the -# polygon): - -# Plot the polygon by default in two projections (cross-section and horizontal) -# and return the list of axes -Lax = ves.plot(element="P") - - -############################################################################### -# The created vessel instance, plotted in cross-section and horizontal -# projections -# Since the vessel is an important object (it defines where the plasma lives), -# all the other ToFu objects rely on it. It is thus important that you save -# it so that it can be used by other ToFu objects when necessary. - -ves.save(path="./") - -############################################################################### -# This method will save the instance as a numpy compressed file (.npz), using -# the path and file name found in ves.Id.SavePath and ves.Id.SaveName. While -# it is highly recommended to stick to the default value for the SaveName, -# but you can easily modify the saving path if you want by specifying it using -# keyword argument Path. - -############################################################################### -# Adding structural elements -# --------------------------- -# -# Like for a vessel, a structural element is mostly defined by a 2D polygon. -# If a vessel instance is provided, the type of the structural element -# (toroidal or linear) is automatically the same as the type of the vessel, -# otherwise the type must be specified. - -# A configuration, short for geometrical configuration is a set of vessel, -# and structural elements. - -# Define two polygons, one that does not enclose the vessel and one that does -thet = np.linspace(0.0, 2.0 * np.pi, 100) -poly1 = [[2.5, 3.5, 3.5, 2.5], [0.0, 0.0, 0.5, 0.5]] # a rectangle -poly2 = [R0 + 0.5 * np.cos(thet), -1.0 + 0.5 * np.sin(thet)] # a circle -poly3 = [[0.8, 1.3, 1.3, 0.8], [-0.5, -0.5, 0.5, 0.5]] # another rectangle -# Create the structural elements with the appropriate ToFu class, specifying -# the experiment and a shot number for keeping track of changes -s1 = tfg.PFC(Name="S1", - Poly=poly1, - Exp="Misc", - shot=0) -# now we create a structure that is not continuous along phi -# but is only defined within certain limits -s2 = tfg.PFC( - Name="S2", - Poly=poly2, - Exp="Misc", - shot=0, - Lim=[[0.0, np.pi], [np.pi / 2.0, np.pi * 3.0 / 2.0]], -) -# and another one, now defined as repetitions centered a position `pos` -# and with a certain `extent` -# here we wanted a structure uniformly repeated 5 times along phi -s3 = tfg.PFC( - Name="S3", - Poly=poly3, - # we dont take the last element of the list as it is 2.*pi = 0 - pos=np.linspace(0.0, 2.0 * np.pi, 6)[:-1], - # 5 repetitions + 5 empty spaces = 10 subdivision of 2. pi - extent=np.pi * 2.0 / 10.0, - Exp="Misc", - shot=0, -) -# Creating a configuration with vessel and structures -config = tfg.Config(Name="test", - Exp="Misc", - lStruct=[ves, s1, s2, s3]) -config.set_colors_random() # to see different colors -config.plot() -config.save() -# sphinx_gallery_thumbnail_number = 3 diff --git a/release_notes/release_notes_140.txt b/release_notes/release_notes_140.txt deleted file mode 100644 index 96ec2db52..000000000 --- a/release_notes/release_notes_140.txt +++ /dev/null @@ -1,41 +0,0 @@ -What's new in 1.4.0: --------------------- - -* All structures are now inherited from an abstract class (in tofu.geom) and are either of type: - - 'In': there can be plasma inside, they are empty structures (e.g.: Vessel) - - 'Out': there is only plasma outside, they are solid blocks (e.g.: PFC) - -* The Config (in tofu.geom) class handles all Struct instances and provides an easy way to manipulate / visualize the whoel tokamak - -* CamLOS1D and CamLOS2D (standing for 'Camera made of Lines of Sight, arranged in 1D or 2D) are subclasses of the abstract Rays class (in tofu.geom), they: - - provide an easy way to handle multiple Rays / LOS - - compute their intersections with the Struct instances (i.e.: detect vignetting, entry and exit points...) - - plot the LOS in pre-defined interactive figures (plot(), plot_touch() and plot_sinogram() methods) - - provide methods for computing : - the length of each LOS inside an user-provided polygon (e.g.: separatrix) - the distance to a 3D flat circle centered on the tokamak's vertical axis (e.g.magnetic axis) - the synthetic signal (i.e: the LOS-integrals of a user-provided scalar 2D or 3D emissivity field), and plot it using a DataCam1D or DataCam2D class - -* Many LOS-computing routines have been optimized and parallelized by Laura Mendoza using Cython, in particular but not only: - - computation of entry / exit points of each LOS for a large number of PFC / Struct (~ seconds for 1 million LOS and ~ 100 Struct) - - computation of the length of each LOS inside a Polygon (e.g.: separatrix) - - computation of the distance to a circle (e.g.: magnetic axis) - - computation of distance to closed polygons (e.g.: spearatrix) when the LOS passed outside of it - -* DataCam1D and DataCam2D and data-handling classes (in tofu.data), designed to handle data from CamLOS1D or CamLOS2D (i.e.: from 1D or 2D cameras), providing: - - data visualization pre-defined interactive matplotlib figures (plot(), plot_compare() and plot_combine() methods) - - basic data-treatment methods (time step and channel selection, interpolation, base signal substraction, fft, svd, ...) - - spectrogram and svd interactive plotting methods - -* DataCam1DSpectral and DataCam2D spectral (tofu.data) provide equivalent classes for handling data with a spectral resolution in addition coming from 1D or 2D cameras - -* Plasma2D (tofu.data) provides a class for handling multiple 1D (radial) and 2D (cross-section) plasma quantities profiles (Te, ne, rho, psi, zeff...) and: - - provides methods for easy plotting - - allows each quantity to depend on its own time and space references - - handles triangular meshes - - can exports to DataCam1D any 1D profile - -* imas2tofu is a new sub-package addressing imas / tofu interacing, it provides in particular: - - load_Config() : an easy way to load a Config instance from an ids dict provided by the user (from 'wall' ids) - - load_Plasma2D() : an easy way to load a Plasma2D instance from an ids dict provided by the user (from 'equilibrium, core_profile' and 'core_sources' idss) - - load_Diag() : an easy way to load a CamLOS1D instance from an ids dict provided by the user (from a diagnostic-specific ids, e.g.: 'bolometer', 'ece'...) diff --git a/release_notes/release_notes_141.md b/release_notes/release_notes_141.md deleted file mode 100644 index 42fb7d68f..000000000 --- a/release_notes/release_notes_141.md +++ /dev/null @@ -1,186 +0,0 @@ -What's new in 1.4.1: --------------------- - -# Summary - -## General -- All tofu object have overloaded __repr__ method -- units tests improved, Continuous Integration more complete, several bugs fixed -- More robust wndows pip installation -- More robust saving to .mat -- tofuplot and tofucalc now provide simple bash interfaces - -## The geometry module is now more complete -- A Config class handles the tokamak geometry -- A CamLOS1D class handles arbitrary sets of LOS -- A CamLOS2D class handles 2D cameras approximated as a set of LOS -- Basic reflexions are taken into account -- Ray-tracing, LOS-campling and LOS-integration algorithls have been accelerated and parallelized -- Several utility function implemented for easy instance creation and useful geometrical computations -- The basics of a magnetic field-line tracing algorithm and plotting routine have been implemented - -## IMAS-interfacing -- More robust MultiIDSLoader class for IMAS interfacing -- Can import from IMAS and export as tofu classes -- Very flexible and customizable -- Some classes have a save_to_imas() method - - -## Next to come -- Solid angles, solid angles, solid angles - - - -# Detailed Changelog - -## Enhancements - -### Geometry - - -#### Algorithms to compute distance between LOS and a flux surfaces - -- Compute distance between LOS and a circle (_+ vectorial version_) -- Test if a LOS and a circle are close to a epsilon (_+ vectorial version_) -- Compute distance between LOS and VPoly (_+ vectorial version_) -- Test if a LOS and a VPoly are close to a epsilon (_+ vectorial version_) -- Compute which LOS is closer to a VPoly -- Compute which VPoly is closer to a LOS - -#### Algorithms for discretization and sampling -- Optimization of discretization of 1D lines (simple + complex version), 2D lines, 2D polygons -- Optimization of LOS sampling and all the different rules: parallelized and using less memory. - -#### Calc signal (function integration over LOS): -- ``LOS_calc_signal`` now cythonized for isotropic and anisotropic emissivity and several sampling / integration strategies - -#### Algorithms to check if visible -- Optimization `LOS_isVis_PtFromPts_VesStruct` checks if a point is visible with respect to a list of points and taking into account a vessel (with structures, limits, etc.) : function cythonized properly, speed up ~50% -- `LOS_areVis_PtsFromPts_VesStruct` equivalent to last function but input is a list of points -- `Dust_calc_SolidAngle` is now using new versions of above mentioned functions - -#### Vignetting - -- Added functions to compute the 3d bounding box of a polygon in 3d space -- Added functions for the triangulation of a polygon by earclipping -- Added function that tests if intersection between ray and triangle in space -- Added functions for vignetting : for a set of rays and a sets of polygons, test if the rays go through the polygons or not. - -#### Structures and Configuration -- `tf.geom.Struct._get_phithetaproj()`: to get the (phi, theta) limits in a project of each toroidal occurence of Struct, with respect to a refpt in (R,Z) -- `tf.geom.Struct._get_phithetaproj_dist()`: + get the distance -- `tf.geom.dist._get_phithetaproj_dist()`: generalize to all Struct of a Config -- Config has set_colors_random() - -#### Solid angles -- Added `_GG.Dust_calc_SolidAngle` for computation of a solid angle on dust particle (multi-pos, multi-pts, with and without vect, with and without approx, with and without block) - -#### Basic Reflexions -* Rays subclasses can now have added reflections (self.add_reflections()) -* Reflections can alos be extracted (instead of stored) as a list of separated cameras using Rays.get_reflections_as_cam() -* Reflections can be of type 'specular', 'diffusive' or 'ccube' -* The reflection type can be forced by the user (identical for all LOS of a camera) or automatically set by the Structural elements each LOS touches -* There can be any number of reflections -* Rays.plot() and Rays.plot_touch() have been updated to properly represent reflections -* Rays.calc_signal() and Rays.calc_signal_from_Plasma2D() have been updated to account for reflections with a user-provided coefficient - -#### Cythonization -- Re wrote some numpy function to avoid over heading: hypothenus and composition of minimum of hypotenus, minimum of vector, tile, - -#### Extra -- Erased *old* functions: - - `SLOW_LOS_Calc_PInOut_VesStruct` - - `Calc_LOS_PInOut_Lin` - - `Calc_LOS_PInOut_Tor` -- extract_svd() now compatible with Py27 and Py36 -- Rays.dgeom['indout'][0,:] now refers to the global index of each structure (as in config.lStruct) -- Operator overloading of __\__repr__\__ of all tofu objects with attribute get_summary() - -### Cameras and visualization - -- overloaded __add__ operator to allow for easy CamLOS1D concatenation -- `tf.geom.dist.plot_phithetaproj_dist()`: plot a static figure with a place holder for time traces, the (phi,theta) projection (with aspect ratio), the cross and hor Config projections and legend -- `Rays.plot_touch()` now handles: angles (wrote docstring) - -### General -- get_summary() is now a method of the AbstractToFuObject parent class, implemented for Config, CamLOS1D, Plasma2D -- saving to .mat file is now more robust (operational) -- Added benchmarking for ``calc_signal`` - -## IMAS interfacing - -1. libraries that need imas2tofu are only imported if the **IMAS** module is found (Warning not Error) - -2. **MultiIDSLoader** class now handles all imas interfacing: -- allows for loading several ids from different idd -- dynamic printing of ids loading -- get_summary() methods giving an overview of content -- provides a dictionary of shortcuts for fast typing of pre-recorded imas signals -- provides dictionary of preset ids and signals -- Flexible instanciation, from idd of idd args, ids or ids args, open or not, get or not -- provides add_idd(), remove_idd(), add_ids(), remove_ids() -- Include to_Config(), to_Plasma2D(), to_Diag() to export to tofu objects - -3. **All stored in a single _core.py**: -- MultiIDSLoader -- load_Config(), load_Plasma2D(), load_Diag() - -4. **save_to_imas()** -- Actual routines implemented in tf.imas2tofu._core -- methods implemented for Struct, Config, CamLOS1D - -5. Other -* MultiIDSLoader now has calc_signal() -* ids = 'magfieldlines' returns mag field line tracking from IMAS equilibrium -* More robust / detailed sanity checks of triangular meshes from IMAS -* Synthetic data and experimental data are now time-synchronized -* Synthetic diag operational on WEST for interferometer, polarimeter, bremsstrahlung and bolometers - -## bash interface: -* tofuplot debugged -* tofucalc created - -## Code structure and format - -### Restructuring of the geometry modules -Created Cython include files `*.pxd` and `*.pyx` for the following group of functions: -- `_basic_geom_tools.*`: global variables definition (`_VSMALL` and `_SMALL`), and basic geometric tools (vector calculus, path distance point-point, point-vector,...) -- `_raytracing_tools.*`: for intersection of LOS and different objects (bounding boxes, poly, surfaces, ...) -- `_distance_tools.*`: distance between LOS and circle, VPoly and so on -- `_sampling_tools.*`: line, LOS, poly, volume, and surface sampling - - -## Installation and portability - -- Had to use some cpp tools, so had to update the `setup.py` -- Updated the `setup.py` to be able to "clean" an installation (erase compilation files) -- Took out the possibility of not using cython, as this is now impossible -- git dependency is now optional (issue #67 ) -- changes in `setup.py` for **Windows** portability -- Now only supporting ``Cython`` versions ``>=0.26`` -- Removed all **pandas** dependencies -- Using ``-O3`` flag instead of ``-O0`` for faster execution time even if compilation is slower -- Removed all **Polygon** dependencies - -## Unit test - -- Added unit tests for triangulations, and vignetting -- Added unit test for computation of kmin, kmax ``LOS_Calc_kMinkMax_VesStruct`` -- Update of `in _vessel` tests -- Added tests for `is_visble` (vectorized and point wise) -- Now by default ``python setup.py nosetests`` with run with: verbose, detailed erorrs, coverage (nose) and other utilities for debugging. But most importantly **only tests in ``tofu/tofu/tests/`` will be run**. -- Testing all get_sample options in a short new unit test -- Testing all options for LOS_calc_signal (method of discretization, of integration, steps relative, absolute, unique or changing for each los, etc.). - -## Update of documentation - -- Added documentation on how to install on Windows -- Updated, restructured and adde figures to README. Change of format `*.rst` to `*.md` -- Updated Wiki pages on GitHub - -## Bugs - -- Found several small bugs in the function that computes for a list of flux surfaces and a list of rays the kmin, kmax -- There was a bug in some special cases of 1D camera definition, when all Ds are on a similar plane sharing the same D for the 2 first LOS, solved -- There was a bug in tf.data._plot_combine() (wrong graph), solved (issue #65 ) -- There was another bug with plot_combine() when several equilibria were provided, the reference time was not properly defined (short-term fix, on the long term issue #79 should fix it) diff --git a/tofu/data/_comp.py b/tofu/data/_comp.py deleted file mode 100644 index 418933439..000000000 --- a/tofu/data/_comp.py +++ /dev/null @@ -1,695 +0,0 @@ -# -*- coding: utf-8 -*- - -# Builtin -import warnings - -# Common -import numpy as np -import scipy.signal as scpsig -import scipy.interpolate as scpinterp -import scipy.linalg as scplin -import scipy.stats as scpstats -from matplotlib.tri import LinearTriInterpolator as mplTriLinInterp - -_fmin_coef = 5. -_ANITYPE = 'sca' -_FILLVALUE = np.nan - - -############################################# -############################################# -############################################# -# Spectrograms -############################################# -############################################# - - -def spectrogram(data, t, - fmin=None, method='scipy-fourier', deg=False, - window='hann', detrend='linear', - nperseg=None, noverlap=None, - boundary='constant', padded=True, wave='morlet', warn=True): - - # Format/check inputs - lm = ['scipy-fourier', 'scipy-stft']#, 'scipy-wavelet'] - if not method in lm: - msg = "Alowed methods are:" - msg += "\n - scipy-fourier: scipy.signal.spectrogram()" - msg += "\n - scipy-stft: scipy.signal.stft()" - #msg += "\n - scpipy-wavelet: scipy.signal.cwt()" - raise Exception(msg) - - nt, nch = data.shape - if t is not None: - assert t.shape==(nt,) - else: - t = np.arange(0,nt) - if not np.allclose(t,t[0]+np.mean(np.diff(t))*np.arange(0,nt)): - msg = "Time vector does not seem to be regularly increasing !" - raise Exception(msg) - dt = np.mean(np.diff(t)) - fs = 1./dt - - # Compute - if method in ['scipy-fourier', 'scipy-stft']: - stft = 'stft' in method - f, tf, lpsd, lang = _spectrogram_scipy_fourier(data, fs, nt, nch, fmin=fmin, - stft=stft, deg=deg, - window=window, - nperseg=nperseg, - noverlap=noverlap, - detrend=detrend, - boundary=boundary, - padded=padded, warn=warn) - tf = tf + t[0] - elif method=='scipy-wavelet': - f, lspect = _spectrogram_scipy_wavelet(data, fs, nt, nch, - fmin=fmin, wave=wave, warn=warn) - tf = t.copy() - - return tf, f, lpsd, lang - - -def _spectrogram_scipy_fourier(data, fs, nt, nch, fmin=None, - window=('tukey', 0.25), deg=False, - nperseg=None, noverlap=None, - detrend='linear', stft=False, - boundary='constant', padded=True, warn=True): - """ Return a spectrogram for each channel, and a common frequency vector - - The min frequency of interest fmin fixes the nb. of pt. per seg. (if None) - The number of overlapping points is set to nperseg-1 if None - The choice of the window type is a trade-off between: - Spectral resolution between similar frequencies/amplitudes: - => - Dynamic range (lots of != frequencies of != amplitudes): - => - Compromise: - => 'hann' - """ - - # Check inputs - if nperseg is None and fmin is None: - fmin = _fmin_coef*(fs/nt) - if warn: - msg = "nperseg and fmin were not provided\n" - msg += " => fmin automatically set to 10.*fs/nt:\n" - msg += " fmin = 10.*{0} / {1} = {2} Hz".format(fs,nt,fmin) - warnings.warn(msg) - - # Format inputs - if nperseg is None: - assert fmin > fs/nt - nperseg = int(np.ceil(fs/fmin)) - - if nperseg%2==1: - nperseg = nperseg + 1 - if noverlap is None: - noverlap = nperseg - 1 - n = int(np.ceil(np.log(nperseg)/np.log(2))) - nfft = 2**n - - # Prepare output - if stft: - f, tf, ssx = scpsig.stft(data, fs=fs, - window=window, nperseg=nperseg, - noverlap=noverlap, nfft=nfft, detrend=detrend, - return_onesided=True, boundary=boundary, - padded=padded, axis=0) - else: - f, tf, ssx = scpsig.spectrogram(data, fs=fs, - window=window, nperseg=nperseg, - noverlap=noverlap, nfft=nfft, - detrend=detrend, return_onesided=True, - scaling='density', axis=0, - mode='complex') - - # Split in list (per channel) - lssx = np.split(ssx, np.arange(1,nch), axis=1) - lssx = [ss.squeeze().T for ss in lssx] - lpsd = [np.abs(ss)**2 for ss in lssx] - lang = [np.angle(ss, deg=deg) for ss in lssx] - - return f, tf, lpsd, lang - - -def _spectrogram_scipy_wavelet(data, fs, nt, nch, fmin=None, wave='morlet', - warn=True): - - if wave!='morlet': - msg = "Only the morlet wavelet implmented so far !" - raise Exception(msg) - - - # Check inputs - if fmin is None: - fmin = _fmin_coef*(fs/nt) - if warn: - msg = "fmin was not provided => set to 10.*fs/nt" - warnings.warn(msg) - - nw = int((1./fmin-2./fs)*fs) - widths = 2.*np.pi*np.linspace(fmin,fs/2.,nw) - wave = eval('scpsig.%s'%wave) - - for ii in range(0,nch): - cwt = scpsig.cwt(data[:,ii], wave, widths) - lcwt.append(np.abs(cwt)**2) - - f = widths/(2.*np.pi) - return f, lcwt - - - -############################################# -############################################# -############################################# -# SVD -############################################# -############################################# - -def calc_svd(data, lapack_driver='gesdd'): - chronos, s, topos = scplin.svd(data, full_matrices=True, compute_uv=True, - overwrite_a=False, check_finite=True, - lapack_driver=lapack_driver) - - # Test if reversed correlation - lind = [np.nanargmax(np.std(data,axis=0)), - np.nanargmax(np.mean(data,axis=0)), - 0, data.shape[1]//2, -1] - - corr = np.zeros((len(lind),2)) - for ii in range(0,len(lind)): - corr[ii,:] = scpstats.pearsonr(chronos[:,0], data[:,lind[ii]]) - - ind = corr[:,1] < 0.05 - if np.any(ind): - corr = corr[ind,0] - if corr[np.argmax(np.abs(corr))] < 0.: - chronos, topos = -chronos, -topos - - return chronos, s, topos - - - - - -############################################# -############################################# -############################################# -# Filtering -############################################# -############################################# - - -def filter_bandpass_fourier(t, data, method='stft', detrend='linear', - df=None, harm=True, - df_out=None, harm_out=True): - """ Return bandpass FFT-filtered signal (and the rest) - - Optionnally include all higher harmonics - Can also exclude a frequency interval and its higher harmonics - - Parameters - ---------- - t : np.ndarray - 1D array, monotonously increasing time vector with regular spacing - data : np.ndarray - 1 or 2D array, with shape[0]=t.size, the data to be filtered - method: str - Flag indicating which method to use: - - 'rfft': scipy.fftpack.rfft - - 'stft': scipy.signal.stft - df : None / list - List or tuple of len()=2, containing the bandpass lower / upper bounds - harm : bool - If True all the higher harmonics of df will also be included - df_out : None / list - List or tuple of len()=2, containing the bandpass lower / upper bounds - to be excluded from filtering (if it overlaps with high harmonics of df) - harm_out : bool - If True, the higher harmonics of the interval df_out are also excluded - Test : bool - If True tests all the input arguments for any mistake - - Returns - ------- - In : np.ndarray - Array with shape=data.shape, filtered signal retrieved from inverse FFT - Out : np.ndarray - Array with shape=data.shape, excluded signal from filtering - - """ - # Check / format inputs - assert data.ndim==2 and t.ndim==1 - assert data.shape[0]==(t.size,) - assert np.allclose(t,np.unique(t)) and np.std(np.diff(t))<=1.e-12 - assert method in ['rfft','stft'] - lC = [df is None, df_out is None] - assert np.sum(lC)<=1, "At least one of df or df_out must be provided !" - assert type(harm) is bool and type(harm_out) is bool - if df is not None: - df = np.unique(df) - assert df.shape==(2,) - if df_out is not None: - df_out = np.unique(df_out) - assert df_out.shape==(2,) - - nt, nch = data.shape - dt = np.mean(np.diff(t)) - fs = 1./dt - - if method=='rfft': - data_in, data_out = _filter_bandpass_rfft(data, t, dt, fs, nt, nch, - df=df, harm=harm, - df_out=df_out, - harm_out=harm_out) - elif methd=='stft': - data_in, data_out = _filter_bandpass_stft(data, t, dt, fs, nt, nch, - df=df, harm=harm, - df_out=df_out, - harm_out=harm_out) - - -def _filter_bandpass_rfft(data, t, dt, fs, - nt, nch, df): - - # Get frequency - f = np.fft.fftfreq(nt, dt) - f = f[f>=0] - if nt%2==0: - f = np.append(f,dt*nt/2) - nf = f.size - - # Get rfft - A = np.fft.rfft(data, axis=0) - assert A.shape[0]==nf, "Problem with frequency scale !" - - # Intervals of interest for reconstruction - if df is None: - indin = np.ones((nf,),dtype=bool) - else: - indin = (f>=df[0]) & (f<=df[1]) - if harm: - for ii in range(1,int(np.floor(f.max()/df[0]))): - indin = indin | ((f>=df[0]*ii) & (f<=df[1]*ii)) - if df_out is not None: - indin = indin & ~((f>=df_out[0]) & (f<=df_out[1])) - if harm_out: - for ii in range(1,int(np.floor(f.max()/df_out[0]))): - indin = indin & ~((f>=df_out[0]*ii) & (f<=df_out[1]*ii)) - - # Reconstructing - Aphys = np.copy(A) - Aphys[~indin,:] = 0 - A[indin,:] = 0 - return np.fft.irfft(Aphys, nt, axis=0), np.fft.irfft(A, nt, axis=0) - - - -def _filter_bandpass_stft(data, t, dt, fs, - nt, nch, df): - - # Get stft - f, tf, ssx = scpsig.stft(data, fs=fs, - window=window, nperseg=nperseg, - noverlap=noverlap, nfft=nfft, detrend=False, - return_onesided=True, boundary=boundary, - padded=padded, axis=0) - ssx = np.abs(ssx)**2 - nf = f.size - - # Intervals of interest for reconstruction - if df is None: - indin = np.ones((nf,),dtype=bool) - else: - indin = (f>=df[0]) & (f<=df[1]) - if harm: - for ii in range(1,int(np.floor(f.max()/df[0]))): - indin = indin | ((f>=df[0]*ii) & (f<=df[1]*ii)) - if df_out is not None: - indin = indin & ~((f>=df_out[0]) & (f<=df_out[1])) - if harm_out: - for ii in range(1,int(np.floor(f.max()/df_out[0]))): - indin = indin & ~((f>=df_out[0]*ii) & (f<=df_out[1]*ii)) - - # Reconstructing - ssxphys = np.copy(ssx) - ssxphys[~indin,:] = 0 - ssx[indin,:] = 0 - data_in = scpsig.istft(ssxphys, fs=fs, window=window, nperseg=nperseg, - noverlap=noverlap, nfft=nfft, - input_onesided=True, boundary=boundary, - time_axis=0, freq_axis=0) - data_out = scpsig.istft(ssx, fs=fs, window=window, nperseg=nperseg, - noverlap=noverlap, nfft=nfft, - input_onesided=True, boundary=boundary, - time_axis=0, freq_axis=0) - - return data_in, data_out - - - - -def filter_svd(data, lapack_driver='gesdd', modes=[]): - """ Return the svd-filtered signal using only the selected mode - - Provide the indices of the modes desired - - """ - # Check input - modes = np.asarray(modes,dtype=int) - assert modes.ndim==1 - assert modes.size>=1, "No modes selected !" - - u, s, v = scplin.svd(data, full_matrices=False, compute_uv=True, - overwrite_a=False, check_finite=True, - lapack_driver=lapack_driver) - indout = np.arange(0,s.size) - indout = np.delete(indout, modes) - - data_in = np.dot(u[:,modes]*s[modes],v[modes,:]) - data_out = np.dot(u[:,indout]*s[indout],v[indout,:]) - return data_in, data_out - - - -############################################# -############################################# -############################################# -# Interpolating -############################################# -############################################# - - -def get_finterp_isotropic(plasma, idquant, idref1d, idref2d, - interp_t='nearest', interp_space=None, - fill_value=None, - idmesh=None, mpltri=None, vquant=None, - tall=None, tbinall=None, ntall=None, - indtq=None, indtr1=None, indtr2=None, - trifind=None): - - if fill_value is None: - fill_value = _FILLVALUE - - # ----------------------------------- - # Interpolate directly on 2d quantity - # ----------------------------------- - if idref1d is None: - - # -------------------- - # Linear interpolation - if interp_space == 1: - - def func(pts, vect=None, t=None, ntall=ntall, - mplTriLinInterp=mplTriLinInterp, - mpltri=mpltri, trifind=trifind, - vquant=vquant, indtq=indtq, - tall=tall, tbinall=tbinall, - idref1d=idref1d, idref2d=idref2d): - - r, z = np.hypot(pts[0,:],pts[1,:]), pts[2,:] - shapeval = list(pts.shape) - shapeval[0] = ntall if t is None else t.size - val = np.full(tuple(shapeval), fill_value) - if t is None: - for ii in range(0,ntall): - val[ii,...] = mplTriLinInterp(mpltri, - vquant[indtq[ii],:], - trifinder=trifind)(r,z).filled(fill_value) - t = tall - else: - ntall, indt, indtu = plasma._get_indtu(t=t, tall=tall, - tbinall=tbinall, - idref1d=idref1d, - idref2d=idref2d)[1:-2] - for ii in range(0,ntall): - ind = indt == indtu[ii] - val[ind,...] = mplTriLinInterp(mpltri, - vquant[indtq[ii],:], - trifinder=trifind)(r,z).filled(fill_value) - return val, t - - # -------------------- - # Degree 0 interpolation - else: - def func(pts, vect=None, t=None, ntall=ntall, - trifind=trifind, - vquant=vquant, indtq=indtq, - tall=tall, tbinall=tbinall, - idref1d=idref1d, idref2d=idref2d): - - r, z = np.hypot(pts[0,:],pts[1,:]), pts[2,:] - shapeval = list(pts.shape) - shapeval[0] = ntall if t is None else t.size - val = np.full(tuple(shapeval), fill_value) - - indpts = trifind(r,z) - indok = indpts > -1 - if t is None: - for ii in range(0,ntall): - val[ii,indok] = vquant[indtq[ii],indpts[indok]] - t = tall - else: - ntall, indt, indtu = plasma._get_indtu(t=t, tall=tall, - tbinall=tbinall, - idref1d=idref1d, - idref2d=idref2d)[1:-2] - for ii in range(0,ntall): - ind = indt == indtu[ii] - val[ind,indok] = vquant[indtq[ii],indpts[indok]] - return val, t - - - else: - vr2 = plasma._ddata[idref2d]['data'] - vr1 = plasma._ddata[idref1d]['data'] - - if interp_space == 1: - - def func(pts, vect=None, t=None, ntall=ntall, - mplTriLinInterp=mplTriLinInterp, - mpltri=mpltri, trifind=trifind, - vquant=vquant, indtq=indtq, - interp_space=interp_space, fill_value=fill_value, - vr1=vr1, indtr1=indtr1, vr2=vr2, indtr2=indtr2, - tall=tall, tbinall=tbinall, - idref1d=idref1d, idref2d=idref2d): - - r, z = np.hypot(pts[0,:],pts[1,:]), pts[2,:] - shapeval = list(pts.shape) - shapeval[0] = ntall if t is None else t.size - val = np.full(tuple(shapeval), fill_value) - t0tri, t0int = 0., 0. - if t is None: - for ii in range(0,ntall): - # get ref values for mapping - # this is the slowest step (~1.8 s) - vii = mplTriLinInterp(mpltri, - vr2[indtr2[ii],:], - trifinder=trifind)(r,z) - - # interpolate 1d - # This is reasonable (~0.15 s) - val[ii,...] = scpinterp.interp1d(vr1[indtr1[ii],:], - vquant[indtq[ii],:], - kind='linear', - bounds_error=False, - fill_value=fill_value)(np.asarray(vii)) - t = tall - else: - out = plasma._get_indtu(t=t, tall=tall, tbinall=tbinall, - idref1d=idref1d, idref2d=idref2d, - indtr1=indtr1, indtr2=indtr2)[1:] - ntall, indt, indtu, indtr1, indtr2 = out - for ii in range(0,ntall): - # get ref values for mapping - vii = mplTriLinInterp(mpltri, - vr2[indtr2[ii],:], - trifinder=trifind)(r,z) - - # interpolate 1d - ind = indt == indtu[ii] - val[ind,...] = scpinterp.interp1d(vr1[indtr1[ii],:], - vquant[indtq[ii],:], - kind='linear', - bounds_error=False, - fill_value=fill_value)(np.asarray(vii)) - val[np.isnan(val)] = fill_value - - return val, t - - else: - def func(pts, vect=None, t=None, ntall=ntall, - trifind=trifind, - vquant=vquant, indtq=indtq, - interp_space=interp_space, fill_value=fill_value, - vr1=vr1, indtr1=indtr1, vr2=vr2, indtr2=indtr2, - tall=tall, tbinall=tbinall, - idref1d=idref1d, idref2d=idref2d): - - r, z = np.hypot(pts[0,:],pts[1,:]), pts[2,:] - shapeval = list(pts.shape) - shapeval[0] = ntall if t is None else t.size - val = np.full(tuple(shapeval), fill_value) - indpts = trifind(r,z) - indok = indpts > -1 - if t is None: - for ii in range(0,ntall): - # interpolate 1d - val[ii,indok] = scpinterp.interp1d(vr1[indtr1[ii],:], - vquant[indtq[ii],:], - kind='linear', - bounds_error=False, - fill_value=fill_value)(vr2[indtr2[ii],indpts[indok]]) - t = tall - else: - out = plasma._get_indtu(t=t, tall=tall, tbinall=tbinall, - idref1d=idref1d, idref2d=idref2d, - indtr1=indtr1, indtr2=indtr2)[1:] - ntall, indt, indtu, indtr1, indtr2 = out - for ii in range(0,ntall): - # interpolate 1d - ind = indt == indtu[ii] - val[ind,indok] = scpinterp.interp1d(vr1[indtr1[ii],:], - vquant[indtq[ii],:], - kind='linear', - bounds_error=False, - fill_value=fill_value)(vr2[indtr2[ii],indpts[indok]]) - return val, t - return func - - -def get_finterp_ani(plasma, idq2dR, idq2dPhi, idq2dZ, - interp_t='nearest', interp_space=None, - fill_value=None, mpltri=None, - idmesh=None, vq2dR=None, - vq2dPhi=None, vq2dZ=None, - tall=None, tbinall=None, ntall=None, - indtq=None, trifind=None, Type=None): - - # ----------------------------------- - # Interpolate directly on 2d quantity - # ----------------------------------- - - if Type is None: - Type = _ANITYPE - if fill_value is None: - fill_value = _FILLVALUE - - # -------------------- - # Linear interpolation - if interp_space == 1: - - def func(pts, vect=None, t=None, ntall=ntall, - mplTriLinInterp=mplTriLinInterp, - mpltri=mpltri, trifind=trifind, - vq2dR=vq2dR, vq2dPhi=vq2dPhi, - vq2dZ=vq2dZ, indtq=indtq, - tall=tall, tbinall=tbinall): - - # Get pts in (r,z,phi) - r, z = np.hypot(pts[0,:],pts[1,:]), pts[2,:] - phi = np.arctan2(pts[1,:],pts[0,:]) - - # Deduce vect in (r,z,phi) - vR = np.cos(phi)*vect[0,:] + np.sin(phi)*vect[1,:] - vPhi = -np.sin(phi)*vect[0,:] + np.cos(phi)*vect[1,:] - vZ = vect[2,:] - - # Prepare output - shapeval = list(pts.shape) - shapeval[0] = ntall if t is None else t.size - valR = np.full(tuple(shapeval), fill_value) - valPhi = np.full(tuple(shapeval), fill_value) - valZ = np.full(tuple(shapeval), fill_value) - - # Interpolate - if t is None: - for ii in range(0,ntall): - valR[ii,...] = mplTriLinInterp(mpltri, - vq2dR[indtq[ii],:], - trifinder=trifind)(r,z) - valPhi[ii,...] = mplTriLinInterp(mpltri, - vq2dPhi[indtq[ii],:], - trifinder=trifind)(r,z) - valZ[ii,...] = mplTriLinInterp(mpltri, - vq2dZ[indtq[ii],:], - trifinder=trifind)(r,z) - t = tall - else: - ntall, indt, indtu = plasma._get_indtu(t=t, tall=tall, - tbinall=tbinall)[1:4] - for ii in range(0,ntall): - ind = indt == indtu[ii] - valR[ind,...] = mplTriLinInterp(mpltri, - vq2dR[indtq[ii],:], - trifinder=trifind)(r,z) - valPhi[ind,...] = mplTriLinInterp(mpltri, - vq2dPhi[indtq[ii],:], - trifinder=trifind)(r,z) - valZ[ind,...] = mplTriLinInterp(mpltri, - vq2dZ[indtq[ii],:], - trifinder=trifind)(r,z) - - - if Type == 'sca': - val = valR*vR[None,:] + valPhi*vPhi[None,:] + valZ*vZ[None,:] - elif Type == 'abs(sca)': - val = np.abs(valR*vR[None,:] + valPhi*vPhi[None,:] + valZ*vZ[None,:]) - - val[np.isnan(val)] = fill_value - return val, t - - # -------------------- - # Degree 0 interpolation - else: - def func(pts, vect=None, t=None, ntall=ntall, - trifind=trifind, - vq2dR=vq2dR, vq2dPhi=vq2dPhi, - vq2dZ=vq2dZ, indtq=indtq, - tall=tall, tbinall=tbinall): - - # Get pts in (r,z,phi) - r, z = np.hypot(pts[0,:],pts[1,:]), pts[2,:] - phi = np.arctan2(pts[1,:],pts[0,:]) - - # Deduce vect in (r,z,phi) - vR = np.cos(phi)*vect[0,:] + np.sin(phi)*vect[1,:] - vphi = -np.sin(phi)*vect[0,:] + np.cos(phi)*vect[1,:] - vZ = vect[2,:] - - # Prepare output - shapeval = list(pts.shape) - shapeval[0] = ntall if t is None else t.size - valR = np.full(tuple(shapeval), fill_value) - valPhi = np.full(tuple(shapeval), fill_value) - valZ = np.full(tuple(shapeval), fill_value) - - # Interpolate - indpts = trifind(r,z) - if t is None: - for ii in range(0,ntall): - valR[ii,...] = vq2dR[indtq[ii],indpts] - valPhi[ii,...] = vq2dPhi[indtq[ii],indpts] - valZ[ii,...] = vq2dZ[indtq[ii],indpts] - t = tall - else: - ntall, indt, indtu = plasma._get_indtu(t=t, tall=tall, - tbinall=tbinall, - idref1d=idref1d, - idref2d=idref2d)[1:] - for ii in range(0,ntall): - ind = indt == indtu[ii] - valR[ind,...] = vq2dR[indtq[ii],indpts] - valPhi[ind,...] = vq2dPhi[indtq[ii],indpts] - valZ[ind,...] = vq2dZ[indtq[ii],indpts] - - if Type == 'sca': - val = valR*vR[None,:] + valPhi*vPhi[None,:] + valZ*vZ[None,:] - elif Type == 'abs(sca)': - val = np.abs(valR*vR[None,:] + valPhi*vPhi[None,:] + valZ*vZ[None,:]) - val[np.isnan(val)] = fill_value - return val, t - return func diff --git a/tofu/data/_core_new.py b/tofu/data/_core_new.py deleted file mode 100644 index 6c9b97937..000000000 --- a/tofu/data/_core_new.py +++ /dev/null @@ -1,1138 +0,0 @@ -# -*- coding: utf-8 -*- - -# Built-in -import sys -import os -# import itertools as itt -import copy -import warnings -from abc import ABCMeta, abstractmethod -import inspect - -# Common -import numpy as np -# import scipy.interpolate as scpinterp -# import matplotlib.pyplot as plt -# from matplotlib.tri import Triangulation as mplTri - - -# tofu -from tofu import __version__ as __version__ -import tofu.pathfile as tfpf -import tofu.utils as utils -try: - import tofu.data._comp as _comp - import tofu.data._plot as _plot - import tofu.data._def as _def - import tofu.data._physics as _physics -except Exception: - from . import _comp as _comp - from . import _plot as _plot - from . import _def as _def - from . import _physics as _physics - -__all__ = ['DataHolder'] # , 'Plasma0D'] - -_SAVEPATH = os.path.abspath('./') -_INTERPT = 'zero' - - -############################################# -############################################# -# Abstract Parent class -############################################# -############################################# - - -class DataHolder(utils.ToFuObject): - """ A generic class for handling data - - Provides methods for: - - introspection - - plateaux finding - - visualization - - """ - # Fixed (class-wise) dictionary of default properties - _ddef = {'Id': {'include': ['Mod', 'Cls', - 'Name', 'version']}, - 'dgroup': ['lref'], - 'dref': ['group', 'size', 'ldata'], - 'ddata': ['refs', 'shape', 'groups', 'data'], - 'params': {'origin': (str, 'unknown'), - 'dim': (str, 'unknown'), - 'quant': (str, 'unknown'), - 'name': (str, 'unknown'), - 'units': (str, 'a.u.')}} - _reserved_all = _ddef['dgroup'] + _ddef['dref'] + _ddef['ddata'] - _show_in_summary = 'all' - - def __init_subclass__(cls, **kwdargs): - # Does not exist before Python 3.6 !!! - # Python 2 - super(DataHolder, cls).__init_subclass__(**kwdargs) - # Python 3 - # super().__init_subclass__(**kwdargs) - cls._ddef = copy.deepcopy(DataHolder._ddef) - # cls._dplot = copy.deepcopy(Struct._dplot) - # cls._set_color_ddef(cls._color) - - def __init__(self, dref=None, ddata=None, - Id=None, Name=None, - fromdict=None, SavePath=os.path.abspath('./'), - SavePath_Include=tfpf.defInclude): - - # Create a dplot at instance level - # self._dplot = copy.deepcopy(self.__class__._dplot) - - kwdargs = locals() - del kwdargs['self'] - # super() - super(DataHolder, self).__init__(**kwdargs) - - def _reset(self): - # Run by the parent class __init__() - # super() - super(DataHolder, self)._reset() - self._dgroup = {kd[0]: kd[1] for kd in self._get_keys_dgroup()} - self._dref = {kd[0]: kd[1] for kd in self._get_keys_dref()} - self._ddata = {kd[0]: kd[1] for kd in self._get_keys_ddata()} - - @classmethod - def _checkformat_inputs_Id(cls, Id=None, Name=None, - include=None, **kwdargs): - if Id is not None: - assert isinstance(Id, utils.ID) - Name = Id.Name - assert isinstance(Name, str), Name - if include is None: - include = cls._ddef['Id']['include'] - kwdargs.update({'Name': Name, 'include': include}) - return kwdargs - - ########### - # Get largs - ########### - - @staticmethod - def _get_largs_dref(): - largs = ['dref'] - return largs - - @staticmethod - def _get_largs_ddata(): - largs = ['ddata'] - return largs - - ########### - # Get check and format inputs - ########### - - # --------------------- - # Methods for checking and formatting inputs - # --------------------- - - def _extract_known_params(self, key, dd): - # Extract relevant parameters - dparams = {kk: vv for kk, vv in dd.items() - if kk not in self._reserved_all} - - # Add minimum default parameters if not already included - for kk, vv in self._ddef['params'].items(): - if kk not in dparams.keys(): - dparams[kk] = vv[1] - else: - # Check type if already included - if not isinstance(dparams[kk], vv[0]): - vtyp = str(type(vv[0])) - msg = "A parameter for %s has the wrong type:\n"%key - msg += " - Provided: type(%s) = %s\n"%(kk, vtyp) - msg += " - Expected %s"%str(self._ddef['params'][kk][0]) - raise Exception(msg) - return dparams - - def _checkformat_dref(self, dref): - c0 = isinstance(dref, dict) - c0 = c0 and all([isinstance(kk, str) and isinstance(vv, dict) - for kk, vv in dref.items()]) - if not c0: - msg = "Provided dref must be dict !\n" - msg += "All its keys must be str !\n" - msg += "All its values must be dict !" - raise Exception(msg) - - # Two options: - # (A) - {'group0':{'t0':{'data':t0, 'units':'s'}, 't1':...}} - # (B) - {'t0':{'data':t0, 'units':'s', 'group':'group0'}, 't1':...} - - cA = all([all([(isinstance(v1, dict) and 'group' not in v1.keys()) - or not isinstance(v1, dict) - for v1 in v0.values()]) - and 'group' not in v0.keys() for v0 in dref.values()]) - cB = all([isinstance(v0.get('group', None), str) - for v0 in dref.values()]) - if not (cA or cB): - msg = "Provided dref must formatted either as a dict with:\n\n" - msg += " - keys = group, values = {ref: data}:\n" - msg += " {'g0':{'t0':{'data':t0, 'units':'s'},\n" - msg += " 't1':{'data':t1, 'units':'h'}},\n" - msg += " 'g1':{'t2':{'data':t2, 'units':'min'}}}\n\n" - msg += " - keys = ref, values = {data, group}:\n" - msg += " {'t0':{'data':t0, 'units':'s', 'group':'g0'},\n" - msg += " 't1':{'data':t1, 'units':'h', 'group':'g0'},\n" - msg += " 't2':{'data':t2, 'units':'min', 'group':'g1'}" - raise Exception(msg) - - if cA: - # Convert to cB - drbis = {} - for k0, v0 in dref.items(): - for k1, v1 in v0.items(): - if isinstance(v1, dict): - drbis[k1] = v1 - drbis['group'] = k0 - else: - drbis[k1] = {'data': v1, 'group': k0} - dref = drbis - - # Check cB - for kk, vv in dref.items(): - - # Check if new group - if vv['group'] not in self._dgroup['lkey']: - self._dgroup['dict'][vv['group']] = {} - self._dgroup['lkey'].append(vv['group']) - - # Check key unicity - if kk in self._ddata['lkey']: - msg = "key '%s' already used !\n"%kk - msg += " => each key must be unique !" - raise Exception(msg) - - # Check data - c0 = 'data' in vv.keys() - data = vv['data'] - if not isinstance(data, np.ndarray): - if isinstance(data, list) or isinstance(data, tuple): - try: - data = np.atleast_1d(data).ravel() - size = data.size - except Exception as err: - c0 = False - else: - size = data.__class__.__name__ - else: - if data.ndim != 1: - data = np.atleast_1d(data).ravel() - size = data.size - - if not c0: - msg = "dref[%s]['data'] must be array-convertible\n"%kk - msg += "The following array conversion failed:\n" - msg += " - np.atleast_1d(dref[%s]['data']).ravel()"%kk - raise Exception(msg) - - # Fill self._dref - self._dref['dict'][kk] = {'size': size, 'group': vv['group']} - self._dref['lkey'].append(kk) - - # Extract and check parameters - dparams = self._extract_known_params(kk, vv) - - # Fill self._ddata - self._ddata['dict'][kk] = dict(data=data, refs=(kk,), - shape=(size,), **dparams) - self._ddata['lkey'].append(kk) - - # ------------- DB (start) - def __repr__(self): - return self.__class__.__name__ - # ------------- DB (end) - - def _checkformat_ddata(self, ddata): - c0 = isinstance(ddata, dict) - c0 = c0 and all([isinstance(kk, str) for kk in ddata.keys()]) - if not c0: - msg = "Provided ddata must be dict !\n" - msg += "All its keys must be str !" - raise Exception(msg) - - # Start check on each key - for kk, vv in ddata.items(): - - # Check value is a dict with proper keys - c0 = isinstance(vv, dict) - c0 = c0 and 'refs' in vv.keys() and isinstance(vv['refs'], tuple) - c0 = c0 and 'data' in vv.keys() - if not c0: - msg = "ddata must contain dict with at least the keys:\n" - msg += " - 'refs': a tuple indicating refs dependencies\n" - msg += " - 'data': a 1d array containing the data" - raise Exception(msg) - - # Check key unicity - if kk in self._ddata['lkey']: - msg = "key '%s' already used !\n"%kk - msg += " => each key must be unique !" - raise Exception(msg) - - # Extract data and shape - data = vv['data'] - if not isinstance(data, np.ndarray): - if isinstance(data, list) or isinstance(data, tuple): - try: - data = np.asarray(data) - shape = data.shape - except Exception as err: - assert type(data) in [list, tuple] - shape = (len(data),) - else: - shape = data.__class__.__name__ - else: - data = np.atleast_1d(np.squeeze(data)) - shape = data.shape - - # Check proper ref (existence and shape / size) - for ii, rr in enumerate(vv['refs']): - if rr not in self._dref['lkey']: - msg = "ddata[%s] depends on an unknown ref !\n"%kk - msg += " - ddata[%s]['refs'] = %s\n"%(kk, rr) - msg += " => %s not in self.dref !\n"%rr - msg += " => self.add_ref( %s ) first !"%rr - raise Exception(msg) - shaprf = tuple(self._dref['dict'][rr]['size'] for rr in vv['refs']) - if not shape == shaprf: - msg = "Inconsistency between data shape and ref size !\n" - msg += " - ddata[%s]['data'] shape: %s\n"%(kk, str(shape)) - msg += " - sizes of refs: %s"%(str(shaprf)) - raise Exception(msg) - - # Extract params and set self._ddata - dparams = self._extract_known_params(kk, vv) - self._ddata['dict'][kk] = dict(data=data, refs=vv['refs'], - shape=shape, **dparams) - self._ddata['lkey'].append(kk) - - def _complement_dgrouprefdata(self): - - # -------------- - # ddata - assert len(self._ddata['lkey']) == len(self._ddata['dict'].keys()) - for k0 in self._ddata['lkey']: - v0 = self._ddata['dict'][k0] - - # Check all ref are in dref - lrefout = [ii for ii in v0['refs'] if ii not in self._dref['lkey']] - if len(lrefout) != 0: - msg = "ddata[%s]['refs'] has keys not in dref:\n"%k0 - msg += " - " + "\n - ".join(lrefout) - raise Exception(msg) - - # set group - grps = tuple(self._dref['dict'][rr]['group'] for rr in v0['refs']) - gout = [gg for gg in grps if gg not in self._dgroup['lkey']] - if len(gout) > 0: - lg = self._dgroup['lkey'] - msg = "Inconsistent grps from self.ddata[%s]['refs']:\n"%k0 - msg += " - grps = %s\n"%str(grps) - msg += " - self._dgroup['lkey'] = %s\n"%str(lg) - msg += " - self.dgroup.keys() = %s"%str(self.dgroup.keys()) - raise Exception(msg) - self._ddata['dict'][k0]['group'] = grps - - # -------------- - # dref - for k0 in self._dref['lkey']: - ldata = [kk for kk in self._ddata['lkey'] - if k0 in self._ddata['dict'][kk]['refs']] - self._dref['dict'][k0]['ldata'] = ldata - assert self._dref['dict'][k0]['group'] in self._dgroup['lkey'] - - # -------------- - # dgroup - for gg in self._dgroup['lkey']: - vg = self._dgroup['dict'][gg] - lref = [rr for rr in self._dref['lkey'] - if self._dref['dict'][rr]['group'] == gg] - ldata = [dd for dd in self._ddata['lkey'] - if any([dd in self._dref['dict'][vref]['ldata'] - for vref in lref])] - # assert vg['depend'] in lidindref - self._dgroup['dict'][gg]['lref'] = lref - self._dgroup['dict'][gg]['ldata'] = ldata - - # -------------- - # params - lparam = self._ddata['lparam'] - for kk in self._ddata['lkey']: - for pp in self._ddata['dict'][kk].keys(): - if pp not in self._reserved_all and pp not in lparam: - lparam.append(pp) - - for kk in self._ddata['lkey']: - for pp in lparam: - if pp not in self._ddata['dict'][kk].keys(): - self._ddata[kk][pp] = None - self._ddata['lparam'] = lparam - - ########### - # Get keys of dictionnaries - ########### - - @staticmethod - def _get_keys_dgroup(): - lk = [('lkey', []), ('dict', {})] - return lk - - @staticmethod - def _get_keys_dref(): - lk = [('lkey', []), ('dict', {})] - return lk - - @staticmethod - def _get_keys_ddata(): - lk = [('lkey', []), ('dict', {}), ('lparam', [])] - return lk - - ########### - # _init - ########### - - def _init(self, dref=None, ddata=None, **kwargs): - kwdargs = dict(dref=dref, ddata=ddata, **kwargs) - largs = self._get_largs_dref() - kwddref = self._extract_kwdargs(kwdargs, largs) - self._set_dref(complement=False, **kwddref) - largs = self._get_largs_ddata() - kwddata = self._extract_kwdargs(kwdargs, largs) - self._set_ddata(**kwddata) - self._dstrip['strip'] = 0 - - ########### - # set dictionaries - ########### - - def _set_dref(self, dref, complement=True): - self._checkformat_dref(dref) - if complement: - self._complement_dgrouprefdata() - - def _set_ddata(self, ddata): - self._checkformat_ddata(ddata) - self._complement_dgrouprefdata() - - # --------------------- - # Methods for adding ref / quantities - # --------------------- - - def add_ref(self, key, data=None, group=None, **kwdargs): - """ Add a reference """ - self._set_dref({key: dict(data=data, group=group, **kwdargs)}) - - def remove_ref(self, key): - """ Remove a reference (all data depending on it are removed too) """ - assert key in self._dref['lkey'] - lkdata = self._dref['dict'][key]['ldata'] - del self._dref['dict'][key] - self._dref['lkey'].remove(key) - for kk in lkdata: - if self._ddata['dict'][kk]['refs'] == (key,): - del self._ddata['dict'][kk] - self._ddata['lkey'].remove(kk) - self._complement_dgrouprefdata() - - def add_data(self, key, data=None, ref=None, **kwdargs): - """ Add a data (all associated ref must be added first)) """ - self._set_ddata({key: dict(data=data, ref=ref, **kwdargs)}) - - def remove_data(self, key, propagate=True): - """ Remove a data - - Any associated ref reated to this data only is removed too (useless) - - """ - if key in self._dref.keys(): - self.remove_ref(key) - else: - assert key in self._ddata['dict'].keys() - if propagate: - # Check if associated ref shall be removed too - lref = self._ddata['dict'][key]['refs'] - for kref in lref: - # Remove if key was the only associated data - if self._dref['dict'][kref]['ldata'] == [key]: - self.remove_ref(kref) - del self._ddata['dict'][key] - self._ddata['lkey'].remove(key) - self._lkdata.remove(key) - self._complement_dgrouprefdata() - - ########### - # strip dictionaries - ########### - - def _strip_ddata(self, strip=0, verb=0): - pass - - ########### - # _strip and get/from dict - ########### - - @classmethod - def _strip_init(cls): - cls._dstrip['allowed'] = [0, 1] - nMax = max(cls._dstrip['allowed']) - doc = """ - 1: None - """ - doc = utils.ToFuObjectBase.strip.__doc__.format(doc, nMax) - cls.strip.__doc__ = doc - - def strip(self, strip=0, verb=True): - # super() - super(DataHolder, self).strip(strip=strip, verb=verb) - - def _strip(self, strip=0, verb=True): - self._strip_ddata(strip=strip, verb=verb) - - def _to_dict(self): - dout = {'dgroup': {'dict': self._dgroup, 'lexcept': None}, - 'dref': {'dict': self._dref, 'lexcept': None}, - 'ddata': {'dict': self._ddata, 'lexcept': None}} - return dout - - def _from_dict(self, fd): - self._dgroup.update(**fd['dgroup']) - self._dref.update(**fd['dref']) - self._ddata.update(**fd['ddata']) - self._complement_dgrouprefdata() - - ########### - # properties - ########### - - @property - def dconfig(self): - """ The dict of configs """ - return self._dconfig - - @property - def dgroup(self): - """ The dict of groups """ - return self._dgroup['dict'] - - @property - def lgroup(self): - """ The dict of groups """ - return self._dgroup['lkey'] - - @property - def dref(self): - """ the dict of references """ - return self._dref['dict'] - - @property - def lref(self): - """ the dict of references """ - return self._dref['lkey'] - - @property - def ddata(self): - """ the dict of data """ - return self._ddata['dict'] - - @property - def ldata(self): - """ the dict of data """ - return self._ddata['lkey'] - - @property - def lparam(self): - """ the dict of data """ - return self._ddata['lparam'] - - # --------------------- - # Add / remove params - # --------------------- - - # UP TO HERE - - def get_param(self, param=None, returnas=np.ndarray): - - # Check inputs and trivial cases - if param is None: - return - assert param in self._ddata['lparam'] - assert returnas in [np.ndarray, dict, list] - - # Get output - if returnas == dict: - out = {kk: self._ddata['dict'][kk][param] - for kk in self._ddata['lkey']} - else: - out = [self._ddata['dict'][kk][param] - for kk in self._ddata['lkey']] - if returnas == np.ndarray: - try: - out = np.asarray(out) - except Exception as err: - msg = "Could not convert %s to array !" - warnings.warn(msg) - return out - - def set_param(self, param=None, values=None, ind=None, key=None): - - # Check and format input - if param is None: - return - assert param in self._ddata['lparam'] - - # Update all keys with common value - ltypes = [str, int, np.int, float, np.float, tuple] - lc = [any([isinstance(values, tt) for tt in ltypes]), - isinstance(values, list), isinstance(values, np.ndarray)] - if not any(lc): - msg = "Accepted types for values include:\n" - msg += " - %s: common to all\n"%str(ltypes) - msg += " - list, np.ndarray: key by key" - raise Exception(msg) - - if lc0: - key = self._ind_tofrom_key(ind=ind, key=key, out='key') - for kk in key: - self._ddata['dict'][kk][param] = values - - # Update relevant keys with corresponding values - else: - key = self._ind_tofrom_key(ind=ind, key=key, out='key') - assert len(key) == len(values) - for kk in range(len(key)): - self._ddata['dict'][key[ii]][param] = values[ii] - - def add_param(self, param, values=None): - assert isinstance(param, str) - assert param not in self._ddata['lparam'] - self._ddata['lparam'].append(param) - self.set_param(param=param, values=values) - - def remove_param(self, param=None): - # Check and format input - if param is None: - return - assert param in self._ddata['lparam'] - - self._ddata['lparam'].remove(param) - for kk in self._ddata['lkey']: - del self._ddata['dict'][kk][param] - - # --------------------- - # Read-only for internal use - # --------------------- - - def select(self, group=None, ref=None, log='all', return_key=True, - **kwdargs): - """ Return the indices / keys of data matching criteria - - The selection is done comparing the value of all provided parameters - The result is a boolean indices array, optionally with the keys list - It can include: - - log = 'all': only the data matching all criteria - - log = 'any': the data matching any criterion - - If log = 'raw', a dict of indices arrays is returned, showing the - details for each criterion - - """ - - # Format and check input - assert log in ['all', 'any', 'raw'] - if log == 'raw': - assert not return_key - - # Get list of relevant criteria - lk = ['group', 'ref'] + list(kwdargs.keys()) - lcrit = [ss for ss in lk if ss is not None] - ncrit = len(lcrit) - - # Prepare array of bool indices and populate - ind = np.ones((ncrit, len(self._ddata['lkey'])), dtype=bool) - for ii in range(ncrit): - critval = eval(lcrit[ii]) - try: - par = self.get_param(lcrit[ii], returnas=np.ndarray) - ind[ii, :] = par == critval - except Exception as err: - ind[ii, :] = [self._ddata['dict'][kk][param] == critval - for kk in self.__lkata] - - # Format output ind - if log == 'all': - ind = np.all(ind, axis=0) - elif log == 'any': - ind = np.any(ind, axis=0) - else: - ind = {lcrit[ii]: ind[ii, :] for ii in range(ncrit)} - - # Also return the list of keys if required - if return_key: - if np.any(ind): - out = ind, lid[ind.nonzero()[0]] - else: - out = ind, np.array([], dtype=int) - else: - out = ind - return out - - def _ind_tofrom_key(self, ind=None, key=None, returnas=int): - - # Check / format input - assert returnas in [int, bool, 'key'] - lc = [ind is not None, key is not None] - assert np.sum(lc) <= 1 - - # Initialize output - out = np.zeros((len(self._ddata['lkey']),), dtype=bool) - - # Test - if lc[0]: - ind = np.atleast_1d(ind).ravel() - assert ind.dtype == np.int or ind.dtype == np.bool - out[ind] = True - if returnas in [int, 'key']: - out = out.nonzero()[0] - if returnas == 'key': - out = [self._ddata['lkey'][ii] for ii in out] - - elif lc[1]: - if isinstance(key, str): - key = [key] - if returnas == 'key': - out = key - else: - for kk in key: - out[self._ddata['lkey'].index(kk)] = True - if returnas == int: - out = out.nonzero()[0] - else: - if returnas == bool: - out[:] = True - elif returnas == int: - out = np.arange(0, len(self._ddata['lkey'])) - else: - out = self._ddata['lkey'] - return out - - # --------------------- - # Methods for showing data - # --------------------- - - def get_summary(self, show=None, show_core=None, - sep=' ', line='-', just='l', - table_sep=None, verb=True, return_=False): - """ Summary description of the object content """ - # # Make sure the data is accessible - # msg = "The data is not accessible because self.strip(2) was used !" - # assert self._dstrip['strip']<2, msg - - # ----------------------- - # Build for groups - col0 = ['group name', 'nb. ref', 'nb. data'] - ar0 = [(k0, - len(self._dgroup['dict'][k0]['lref']), - len(self._dgroup['dict'][k0]['ldata'])) - for k0 in self._dgroup['lkey']] - - # ----------------------- - # Build for refs - col1 = ['ref key', 'group', 'size', 'nb. data'] - ar1 = [(k0, - self._dref['dict'][k0]['group'], - self._dref['dict'][k0]['size'], - len(self._dref['dict'][k0]['ldata'])) - for k0, v0 in self._dref['lkey']] - - # ----------------------- - # Build for ddata - col2 = ['data key'] - if show_core is None: - show_core = self._show_in_summary_core - if isinstance(show_core, str): - show_core = [show_core] - lkcore = ['shape', 'group', 'ref'] - assert all([ss in self._lparams + lkcore for ss in show_core]) - col2 += show_core - - if show is None: - show = self._show_in_summary - if show == 'all': - col2 += self._lparams - else: - if isinstance(show, str): - show = [show] - assert all([ss in self._lparams for ss in show]) - col2 += show - - ar2 = [] - for k0 in self._lkdata: - v0 = self._ddata[k0] - lu = [k0] + [str(v0[cc]) for cc in col2[1:]] - ar2.append(lu) - - return self._get_summary( - [ar0, ar1, ar2], [col0, col1, col2], - sep=sep, line=line, table_sep=table_sep, - verb=verb, return_=return_) - - # --------------------- - # Method for interpolating on ref - # --------------------- - - def get_time_common(self, lkeys, choose=None): - """ Return the common time vector to several quantities - - If they do not have a common time vector, a reference one is choosen - according to criterion choose - """ - # Check all data have time-dependency - dout = {kk: {'t': self.get_time(kk)} for kk in lkeys} - dtu = dict.fromkeys(set([vv['t'] for vv in dout.values()])) - for kt in dtu.keys(): - dtu[kt] = {'ldata': [kk for kk in lkeys if dout[kk]['t'] == kt]} - if len(dtu) == 1: - tref = list(dtu.keys())[0] - else: - lt, lres = zip(*[(kt, np.mean(np.diff(self._ddata[kt]['data']))) - for kt in dtu.keys()]) - if choose is None: - choose = 'min' - if choose == 'min': - tref = lt[np.argmin(lres)] - return dout, dtu, tref - - @staticmethod - def _get_time_common_arrays(dins, choose=None): - dout = dict.fromkeys(dins.keys()) - dtu = {} - for k, v in dins.items(): - c0 = type(k) is str - c0 = c0 and all([ss in v.keys() for ss in ['val', 't']]) - c0 = c0 and all([type(v[ss]) is np.ndarray for ss in ['val', 't']]) - c0 = c0 and v['t'].size in v['val'].shape - if not c0: - msg = "dins must be a dict of the form (at least):\n" - msg += " dins[%s] = {'val': np.ndarray,\n"%str(k) - msg += " 't': np.ndarray}\n" - msg += "Provided: %s"%str(dins) - raise Exception(msg) - - kt, already = id(v['t']), True - if kt not in dtu.keys(): - lisclose = [kk for kk, vv in dtu.items() - if (vv['val'].shape == v['t'].shape - and np.allclose(vv['val'], v['t']))] - assert len(lisclose) <= 1 - if len(lisclose) == 1: - kt = lisclose[0] - else: - already = False - dtu[kt] = {'val': np.atleast_1d(v['t']).ravel(), - 'ldata': [k]} - if already: - dtu[kt]['ldata'].append(k) - assert dtu[kt]['val'].size == v['val'].shape[0] - dout[k] = {'val': v['val'], 't': kt} - - if len(dtu) == 1: - tref = list(dtu.keys())[0] - else: - lt, lres = zip(*[(kt, np.mean(np.diff(dtu[kt]['val']))) - for kt in dtu.keys()]) - if choose is None: - choose = 'min' - if choose == 'min': - tref = lt[np.argmin(lres)] - return dout, dtu, tref - - def _interp_on_common_time(self, lkeys, - choose='min', interp_t=None, t=None, - fill_value=np.nan): - """ Return a dict of time-interpolated data """ - dout, dtu, tref = self.get_time_common(lkeys) - if type(t) is np.ndarray: - tref = np.atleast_1d(t).ravel() - tr = tref - ltu = dtu.keys() - else: - if type(t) is str: - tref = t - tr = self._ddata[tref]['data'] - ltu = set(dtu.keys()) - if tref in dtu.keys(): - ltu = ltu.difference([tref]) - - if interp_t is None: - interp_t = _INTERPT - - # Interpolate - for tt in ltu: - for kk in dtu[tt]['ldata']: - dout[kk]['val'] = scpinterp.interp1d(self._ddata[tt]['data'], - self._ddata[kk]['data'], - kind=interp_t, axis=0, - bounds_error=False, - fill_value=fill_value)(tr) - - if type(tref) is not np.ndarray and tref in dtu.keys(): - for kk in dtu[tref]['ldata']: - dout[kk]['val'] = self._ddata[kk]['data'] - - return dout, tref - - def _interp_on_common_time_arrays(self, dins, - choose='min', interp_t=None, t=None, - fill_value=np.nan): - """ Return a dict of time-interpolated data """ - dout, dtu, tref = self._get_time_common_arrays(dins) - if type(t) is np.ndarray: - tref = np.atleast_1d(t).ravel() - tr = tref - ltu = dtu.keys() - else: - if type(t) is str: - assert t in dout.keys() - tref = dout[t]['t'] - tr = dtu[tref]['val'] - ltu = set(dtu.keys()).difference([tref]) - - if interp_t is None: - interp_t = _INTERPT - - # Interpolate - for tt in ltu: - for kk in dtu[tt]['ldata']: - dout[kk]['val'] = scpinterp.interp1d(dtu[tt]['val'], - dout[kk]['val'], - kind=interp_t, axis=0, - bounds_error=False, - fill_value=fill_value)(tr) - return dout, tref - - def interp_t(self, dkeys, - choose='min', interp_t=None, t=None, - fill_value=np.nan): - # Check inputs - assert type(dkeys) in [list, dict] - if type(dkeys) is list: - dkeys = {kk: {'val': kk} for kk in dkeys} - lc = [(type(kk) is str - and type(vv) is dict - and type(vv.get('val', None)) in [str, np.ndarray]) - for kk, vv in dkeys.items()] - assert all(lc), str(dkeys) - - # Separate by type - dk0 = dict([(kk, vv) for kk, vv in dkeys.items() - if type(vv['val']) is str]) - dk1 = dict([(kk, vv) for kk, vv in dkeys.items() - if type(vv['val']) is np.ndarray]) - assert len(dkeys) == len(dk0) + len(dk1), str(dk0) + '\n' + str(dk1) - - if len(dk0) == len(dkeys): - lk = [v['val'] for v in dk0.values()] - dout, tref = self._interp_on_common_time(lk, choose=choose, - t=t, interp_t=interp_t, - fill_value=fill_value) - dout = {kk: {'val': dout[vv['val']]['val'], - 't': dout[vv['val']]['t']} - for kk, vv in dk0.items()} - elif len(dk1) == len(dkeys): - dout, tref = self._interp_on_common_time_arrays( - dk1, choose=choose, t=t, - interp_t=interp_t, fill_value=fill_value) - - else: - lk = [v['val'] for v in dk0.values()] - if type(t) is np.ndarray: - dout, tref = self._interp_on_common_time( - lk, choose=choose, t=t, - interp_t=interp_t, fill_value=fill_value) - dout1, _ = self._interp_on_common_time_arrays( - dk1, choose=choose, t=t, - interp_t=interp_t, fill_value=fill_value) - else: - dout0, dtu0, tref0 = self.get_time_common(lk, - choose=choose) - dout1, dtu1, tref1 = self._get_time_common_arrays( - dk1, choose=choose) - if type(t) is str: - lc = [t in dtu0.keys(), t in dout1.keys()] - if not any(lc): - msg = "if t is str, it must refer to a valid key:\n" - msg += " - %s\n"%str(dtu0.keys()) - msg += " - %s\n"%str(dout1.keys()) - msg += "Provided: %s"%t - raise Exception(msg) - if lc[0]: - t0, t1 = t, self._ddata[t]['data'] - else: - t0, t1 = dtu1[dout1[t]['t']]['val'], t - tref = t - else: - if choose is None: - choose = 'min' - if choose == 'min': - t0 = self._ddata[tref0]['data'] - t1 = dtu1[tref1]['val'] - dt0 = np.mean(np.diff(t0)) - dt1 = np.mean(np.diff(t1)) - if dt0 < dt1: - t0, t1, tref = tref0, t0, tref0 - else: - t0, t1, tref = t1, tref1, tref1 - - dout, tref = self._interp_on_common_time( - lk, choose=choose, t=t0, - interp_t=interp_t, fill_value=fill_value) - - dout = {kk: {'val': dout[vv['val']]['val'], - 't': dout[vv['val']]['t']} - for kk, vv in dk0.items()} - - dout1, _ = self._interp_on_common_time_arrays( - dk1, choose=choose, t=t1, - interp_t=interp_t, fill_value=fill_value) - - dout.update(dout1) - - return dout, tref - - def _get_indtmult(self, idquant=None, idref1d=None, idref2d=None): - - # Get time vectors and bins - idtq = self._ddata[idquant]['depend'][0] - tq = self._ddata[idtq]['data'] - tbinq = 0.5*(tq[1:]+tq[:-1]) - if idref1d is not None: - idtr1 = self._ddata[idref1d]['depend'][0] - tr1 = self._ddata[idtr1]['data'] - tbinr1 = 0.5*(tr1[1:]+tr1[:-1]) - if idref2d is not None and idref2d != idref1d: - idtr2 = self._ddata[idref2d]['depend'][0] - tr2 = self._ddata[idtr2]['data'] - tbinr2 = 0.5*(tr2[1:]+tr2[:-1]) - - # Get tbinall and tall - if idref1d is None: - tbinall = tbinq - tall = tq - else: - if idref2d is None: - tbinall = np.unique(np.r_[tbinq, tbinr1]) - else: - tbinall = np.unique(np.r_[tbinq, tbinr1, tbinr2]) - tall = np.r_[tbinall[0] - 0.5*(tbinall[1]-tbinall[0]), - 0.5*(tbinall[1:]+tbinall[:-1]), - tbinall[-1] + 0.5*(tbinall[-1]-tbinall[-2])] - - # Get indtqr1r2 (tall with respect to tq, tr1, tr2) - indtq, indtr1, indtr2 = None, None, None - indtq = np.digitize(tall, tbinq) - if idref1d is None: - assert np.all(indtq == np.arange(0, tall.size)) - if idref1d is not None: - indtr1 = np.digitize(tall, tbinr1) - if idref2d is not None: - indtr2 = np.digitize(tall, tbinr2) - - ntall = tall.size - return tall, tbinall, ntall, indtq, indtr1, indtr2 - - @staticmethod - def _get_indtu(t=None, tall=None, tbinall=None, - idref1d=None, idref2d=None, - indtr1=None, indtr2=None): - # Get indt (t with respect to tbinall) - indt, indtu = None, None - if t is not None: - indt = np.digitize(t, tbinall) - indtu = np.unique(indt) - - # Update - tall = tall[indtu] - if idref1d is not None: - assert indtr1 is not None - indtr1 = indtr1[indtu] - if idref2d is not None: - assert indtr2 is not None - indtr2 = indtr2[indtu] - ntall = tall.size - return tall, ntall, indt, indtu, indtr1, indtr2 - - def get_tcommon(self, lq, prefer='finer'): - """ Check if common t, else choose according to prefer - - By default, prefer the finer time resolution - - """ - if type(lq) is str: - lq = [lq] - t = [] - for qq in lq: - ltr = [kk for kk in self._ddata[qq]['depend'] - if self._dindref[kk]['group'] == 'time'] - assert len(ltr) <= 1 - if len(ltr) > 0 and ltr[0] not in t: - t.append(ltr[0]) - assert len(t) >= 1 - if len(t) > 1: - dt = [np.nanmean(np.diff(self._ddata[tt]['data'])) for tt in t] - if prefer == 'finer': - ind = np.argmin(dt) - else: - ind = np.argmax(dt) - else: - ind = 0 - return t[ind], t - - def _get_tcom(self, idquant=None, idref1d=None, - idref2d=None, idq2dR=None): - if idquant is not None: - out = self._get_indtmult(idquant=idquant, - idref1d=idref1d, idref2d=idref2d) - else: - out = self._get_indtmult(idquant=idq2dR) - return out - - # --------------------- - # Methods for plotting data - # --------------------- - - def plot(self, lquant, X=None, - ref1d=None, ref2d=None, - remap=False, res=0.01, interp_space=None, - sharex=False, bck=True): - lDat = self.get_Data(lquant, X=X, remap=remap, - ref1d=ref1d, ref2d=ref2d, - res=res, interp_space=interp_space) - if type(lDat) is list: - kh = lDat[0].plot_combine(lDat[1:], sharex=sharex, bck=bck) - else: - kh = lDat.plot(bck=bck) - return kh - - def plot_combine(self, lquant, lData=None, X=None, - ref1d=None, ref2d=None, - remap=False, res=0.01, interp_space=None, - sharex=False, bck=True): - """ plot combining several quantities from the Plasma2D itself and - optional extra list of Data instances """ - lDat = self.get_Data(lquant, X=X, remap=remap, - ref1d=ref1d, ref2d=ref2d, - res=res, interp_space=interp_space) - if lData is not None: - if type(lDat) is list: - lData = lDat[1:] + lData - else: - lData = lDat[1:] + [lData] - kh = lDat[0].plot_combine(lData, sharex=sharex, bck=bck) - return kh diff --git a/tofu/data/_physics.py b/tofu/data/_physics.py deleted file mode 100644 index 8e3c58b37..000000000 --- a/tofu/data/_physics.py +++ /dev/null @@ -1,54 +0,0 @@ - - - -import numpy as np -import scipy.constants as scpct - - - -def compute_bremzeff(Te=None, ne=None, zeff=None, lamb=None): - """ Return the bremsstrahlun spectral radiance at lamb - - The plasma conditions are set by: - - Te (eV) - - ne (/m3) - - zeff (adim.) - - The wavelength is set by the diagnostics - - lamb (m) - - The vol. spectral emis. is returned in ph / (s.m3.sr.m) - - The computation requires an intermediate : gff(Te, zeff) - """ - ktkeV = Te * 1.e-3 - ktJ = Te * scpct.e - gff = 5.54 - (3.11-np.log(ktkeV))*(0.69-0.13/zeff) - Const = ((scpct.e**6/(scpct.h*scpct.c**3*(np.pi*scpct.epsilon_0)**3)) - * np.sqrt(np.pi/(864.*scpct.m_e**3))) - hc = scpct.h*scpct.c - emis = Const/lamb * ne**2*zeff * np.exp(-hc/(lamb*ktJ)) * gff/np.sqrt(ktJ) - units = r'ph / (s.m3.sr.m)' - return emis, units - - -def compute_fangle(BR=None, BPhi=None, BZ=None, ne=None, lamb=None): - """ The the vector quantity to be integrated on LOS to get faraday angle - - fangle = int_LOS ( abs(sca(quant, u_LOS)) ) - Where: - quant = C * lamb**2 * ne * Bv - - With: - - C = 2.615e-13 (1/T) - - ne (/m3) - - lamb (m) - - Bv (T) - - The resulting faraday angle (after integration) will be in radians - """ - const = scpct.e**3 / (8.*scpct.pi**2 - * scpct.epsilon_0 * scpct.m_e**2 * scpct.c**3) - quant = const * lamb**2 * ne * np.array([BR, BPhi, BZ]) - units = r'rad / m' - return quant, units diff --git a/tofu/dumpro/_comp_clusters.py b/tofu/dumpro/_comp_clusters.py deleted file mode 100644 index 171557961..000000000 --- a/tofu/dumpro/_comp_clusters.py +++ /dev/null @@ -1 +0,0 @@ -# sub-group of computation routines (for example) diff --git a/tofu/dumpro/_def.py b/tofu/dumpro/_def.py deleted file mode 100644 index dd236ed47..000000000 --- a/tofu/dumpro/_def.py +++ /dev/null @@ -1 +0,0 @@ -# default parameters diff --git a/tofu/dumpro/_draft.py b/tofu/dumpro/_draft.py deleted file mode 100644 index dd8f9a826..000000000 --- a/tofu/dumpro/_draft.py +++ /dev/null @@ -1 +0,0 @@ -# testing ground for functions diff --git a/tofu/dumpro/_plot.py b/tofu/dumpro/_plot.py deleted file mode 100644 index c8e19c1d6..000000000 --- a/tofu/dumpro/_plot.py +++ /dev/null @@ -1 +0,0 @@ -# plotting routines (functions also called from _core.py) diff --git a/tofu/geom/_GG.pyx b/tofu/geom/_GG.pyx deleted file mode 100644 index 0462264b8..000000000 --- a/tofu/geom/_GG.pyx +++ /dev/null @@ -1,4229 +0,0 @@ -# cython: boundscheck=False -# cython: wraparound=False -# cython: initializedcheck=False -# cython: cdivision=True -# -# -- Python libraries imports -------------------------------------------------- -import sys -from warnings import warn -import numpy as np -import scipy.integrate as scpintg -from matplotlib.path import Path -if sys.version[0]=='3': - from inspect import signature as insp -elif sys.version[0]=='2': - from inspect import getargspec as insp -# -- Cython libraries imports -------------------------------------------------- -from cpython cimport bool -from cpython.array cimport array, clone -from cython.parallel import prange -from cython.parallel cimport parallel -# -- C libraries imports ------------------------------------------------------- -cimport cython -cimport numpy as np -from libc.math cimport sqrt as Csqrt, ceil as Cceil, fabs as Cabs -from libc.math cimport floor as Cfloor, round as Cround, log2 as Clog2 -from libc.math cimport cos as Ccos, acos as Cacos, sin as Csin, asin as Casin -from libc.math cimport atan2 as Catan2, pi as Cpi -from libc.math cimport NAN as Cnan -from libc.math cimport INFINITY as Cinf -from libc.math cimport isnan as Cisnan -from libc.stdlib cimport malloc, free -# -- ToFu library imports ------------------------------------------------------ -from _basic_geom_tools cimport _VSMALL, _SMALL -cimport _basic_geom_tools as _bgt -cimport _raytracing_tools as _rt -cimport _distance_tools as _dt -cimport _sampling_tools as _st -cimport _vignetting_tools as _vt - -# == Exports =================================================================== -__all__ = ['CoordShift', - "comp_dist_los_circle", - "comp_dist_los_circle_vec", - "comp_dist_los_vpoly", - "comp_dist_los_vpoly_vec", - "is_close_los_vpoly_vec", - "is_close_los_circle", - "is_close_los_circle_vec", - "which_los_closer_vpoly_vec", - "which_vpoly_closer_los_vec", - "LOS_sino_findRootkPMin_Tor", - 'Poly_isClockwise', 'Poly_Order', 'Poly_VolAngTor', - 'poly_area', "poly_area_and_barycenter", - 'Sino_ImpactEnv', 'ConvertImpact_Theta2Xi', - '_Ves_isInside', - 'discretize_line1d', - 'discretize_segment2d', '_Ves_meshCross_FromInd', - 'discretize_vpoly', - '_Ves_Vmesh_Tor_SubFromD_cython', '_Ves_Vmesh_Tor_SubFromInd_cython', - '_Ves_Vmesh_Lin_SubFromD_cython', '_Ves_Vmesh_Lin_SubFromInd_cython', - '_Ves_Smesh_Tor_SubFromD_cython', '_Ves_Smesh_Tor_SubFromInd_cython', - '_Ves_Smesh_TorStruct_SubFromD_cython', - '_Ves_Smesh_TorStruct_SubFromInd_cython', - '_Ves_Smesh_Lin_SubFromD_cython', - '_Ves_Smesh_Lin_SubFromInd_cython', - 'LOS_Calc_PInOut_VesStruct', - "LOS_Calc_kMinkMax_VesStruct", - "LOS_isVis_PtFromPts_VesStruct", - "LOS_areVis_PtsFromPts_VesStruct", - 'check_ff', 'LOS_get_sample', 'LOS_calc_signal', - 'LOS_sino','integrate1d', - "triangulate_by_earclipping", - "vignetting", - "Dust_calc_SolidAngle"] - - -######################################################## -######################################################## -# Coordinates handling -######################################################## - -def CoordShift(Pts, In='(X,Y,Z)', Out='(R,Z)', CrossRef=None): - """ Check the shape of an array of points coordinates and/or converts from - 2D to 3D, 3D to 2D, cylindrical to cartesian... - (CrossRef is an angle (Tor) or a distance (X for Lin)) - """ - cdef str str_ii - cdef long ncoords = Pts.shape[0] - cdef long npts - assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), ( - "Arg In and Out (coordinate format) must be comma-separated !") - assert type(Pts) is np.ndarray and Pts.ndim in [1,2] and \ - ncoords in (2,3), ("Points must be a 1D or 2D np.ndarray " - "of 2 or 3 coordinates !") - okTypes = [int,float,np.int64,np.float64] - assert CrossRef is None or type(CrossRef) in okTypes, ( - "Arg CrossRef must be a float !") - - # Pre-format inputs - In, Out = In.lower(), Out.lower() - - # Get order - Ins = In.replace('(','').replace(')','').split(',') - Outs = Out.replace('(','').replace(')','').split(',') - # TODO: @DV > it looks to me that (x, r, phi) could be a valid in/out-put - # >>>>> ajouter assert pour le moment - assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In!" - assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out!" - InT = 'cyl' if any([ss in Ins for ss in ['r','phi']]) else 'cart' - OutT = 'cyl' if any([ss in Outs for ss in ['r','phi']]) else 'cart' - - ndim = Pts.ndim - if ndim==1: - Pts = np.copy(Pts.reshape((ncoords,1))) - - # Compute - if InT==OutT: - assert all([ss in Ins for ss in Outs]) - pts = [] - for str_ii in Outs: - if str_ii=='phi': - pts.append(np.arctan2(np.sin(Pts[Ins.index(str_ii),:]), - np.cos(Pts[Ins.index(str_ii),:]))) - else: - pts.append(Pts[Ins.index(str_ii),:]) - elif InT=='cart': - pts = [] - for str_ii in Outs: - if str_ii=='r': - assert all([ss in Ins for ss in ['x','y']]) - pts.append(_bgt.compute_hypot(Pts[Ins.index('x'),:], - Pts[Ins.index('y'),:])) - elif str_ii=='z': - assert 'z' in Ins - pts.append(Pts[Ins.index('z'),:]) - elif str_ii=='phi': - if all([ss in Ins for ss in ['x','y']]): - pts.append(np.arctan2(Pts[Ins.index('y'),:], - Pts[Ins.index('x'),:])) - elif CrossRef is not None: - npts = Pts.shape[1] - pts.append( CrossRef*np.ones((npts,)) ) - else: - raise Exception("There is no phi value available !") - # TODO: @VZ > else... ? if Outs = (x, r, phi) ? - else: - pts = [] - for str_ii in Outs: - if str_ii=='x': - if all([ss in Ins for ss in ['r','phi']]) : - # TODO : @VZ : and CrossRef is None ? - # >>> ajouter un warning si crossref a ete defini - pts.append(Pts[Ins.index('r'),:] * - np.cos(Pts[Ins.index('phi'),:])) - elif CrossRef is not None: - npts = Pts.shape[1] - pts.append( CrossRef*np.ones((npts,)) ) - else: - raise Exception("There is no x value available !") - elif str_ii=='y': - assert all([ss in Ins for ss in ['r','phi']]) - pts.append(Pts[Ins.index('r'),:] * - np.sin(Pts[Ins.index('phi'),:])) - elif str_ii=='z': - assert 'z' in Ins - pts.append(Pts[Ins.index('z'),:]) - # TODO : else....? - - # Format output - pts = np.vstack(pts) - if ndim==1: - pts = pts.flatten() - return pts - - -""" -######################################################## -######################################################## -######################################################## -# General Geometry -######################################################## -######################################################## -######################################################## -""" - -######################################################## -######################################################## -# Polygons -######################################################## - - -@cython.cdivision(True) -@cython.wraparound(False) -@cython.boundscheck(False) -def Poly_isClockwise(np.ndarray[double,ndim=2] Poly): - """ Assuming 2D closed Poly ! - TODO @LM : - http://www.faqs.org/faqs/graphics/algorithms-faq/ - A slightly faster method is based on the observation that it isn't - necessary to compute the area. Find the lowest vertex (or, if - there is more than one vertex with the same lowest coordinate, - the rightmost of those vertices) and then take the cross product - of the edges fore and aft of it. Both methods are O(n) for n vertices, - but it does seem a waste to add up the total area when a single cross - product (of just the right edges) suffices. Code for this is - available at ftp://cs.smith.edu/pub/code/polyorient.C (2K). - """ - cdef double res - cdef double[:,::1] mv_poly = np.ascontiguousarray(Poly) - cdef int npts = mv_poly.shape[1] - cdef double[::1] mvx = mv_poly[0,:] - cdef double[::1] mvy = mv_poly[1,:] - cdef int idmin = _bgt.find_ind_lowerright_corner(mvx, mvy, npts) - cdef int idm1 = (idmin - 1) % npts - cdef int idp1 = (idmin + 1) % npts - res = mvx[idm1] * (mvy[idmin] - mvy[idp1]) + \ - mvx[idmin] * (mvy[idp1] - mvy[idm1]) + \ - mvx[idp1] * (mvy[idm1] - mvy[idmin]) - return res < 0. - - -def Poly_Order(np.ndarray[double,ndim=2] Poly, str order='C', Clock=False, - close=True, str layout='(cc,N)', - str layout_in=None, Test=True): - """ - Return a polygon Poly as a np.ndarray formatted according to parameters - - Parameters - ---------- - Poly np.ndarray or list Input polygon under from of (cc,N) or - or tuple (N,cc) np.ndarray (where cc = 2 or 3, the - number of coordinates and N points), or - list or tuple of vertices - order str Flag indicating whether the output - np.ndarray shall be C-contiguous ('C') or - Fortran-contiguous ('F') - Clock bool For 2-dimensional arrays only, flag indi- - cating whether the output array shall - represent a clockwise polygon (True) or - anti-clockwise (False), or should be left - unchanged (None) - close bool For 2-dimensional arrays only, flag indi- - cating whether the output array shall be - closed (True, ie: last point==first point) - or not closed (False) - layout str Flag indicating whether the output - np.ndarray shall be of shape '(cc,N)' - or '(N,cc)' - Test bool Flag indicating whether the inputs should - be tested for conformity, default: True - - Returns - ------- - poly np.ndarray Output formatted polygon - """ - if Test: - assert (2 in np.shape(Poly) or 3 in np.shape(Poly)), \ - "Arg Poly must contain the 2D or 3D coordinates of at least 3 points!" - assert max(np.shape(Poly))>=3, ("Arg Poly must contain the 2D or 3D", - " coordinates of at least 3 points!") - assert order.lower() in ['c','f'], "Arg order must be in ['c','f']!" - assert type(Clock) is bool, "Arg Clock must be a bool!" - assert type(close) is bool, "Arg close must be a bool!" - assert layout.lower() in ['(cc,n)','(n,cc)'], \ - "Arg layout must be in ['(cc,n)','(n,cc)']!" - assert layout_in is None or layout_in.lower() in ['(cc,n)','(n,cc)'],\ - "Arg layout_in must be None or in ['(cc,n)','(n,cc)']!" - - if np.shape(Poly)==(3,3): - assert not layout_in is None, \ - ("Could not resolve the input layout of Poly because shape==(3,3)", - " Please specify if input is in '(cc,n)' or '(n,cc)' format!") - poly = np.array(Poly).T if layout_in.lower()=='(n,cc)' \ - else np.array(Poly) - else: - poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1]\ - else np.array(Poly) - if not np.allclose(poly[:,0],poly[:,-1], atol=_VSMALL): - poly = np.concatenate((poly,poly[:,0:1]),axis=1) - if poly.shape[0]==2 and not Clock is None: - if not Clock==Poly_isClockwise(poly): - poly = poly[:,::-1] - if not close: - poly = poly[:,:-1] - if layout.lower()=='(n,cc)': - poly = poly.T - # TODO : @LM @DV > seems strange to me that we order all polys - # in order "(cc,n)" and just last minute we look at what's actually - # asked - # >> ok - poly = np.ascontiguousarray(poly) if order.lower()=='c' \ - else np.asfortranarray(poly) - return poly - - -def Poly_VolAngTor(np.ndarray[double,ndim=2,mode='c'] Poly): - # TODO : @LM > to check the formulas can they be optimized ? - cdef np.ndarray[double,ndim=1] Ri0 = Poly[0,:-1], Ri1 = Poly[0,1:] - cdef np.ndarray[double,ndim=1] Zi0 = Poly[1,:-1], Zi1 = Poly[1,1:] - cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1) * (Ri0+Ri1)) / 6. - cdef double BV0 = np.sum(0.5 * (Ri0*Zi1 - Zi0*Ri1) * - (Ri1**2 + Ri1*Ri0 + Ri0**2)) / (6.*V) - cdef double BV1 = -np.sum((Ri1**2*Zi0*(2.*Zi1+Zi0) + - 2.*Ri0*Ri1*(Zi0**2-Zi1**2) - - Ri0**2*Zi1*(Zi1+2.*Zi0))/4.) / (6.*V) - return V, np.array([BV0,BV1]) - - -def poly_area(double[:,::1] poly, int npts): - cdef int ii - cdef double area = 0. - # # 2 A(P) = sum_{i=1}^{n} ( x_i (y_{i+1} - y_{i-1}) ) - for ii in range(1,npts): - area += poly[0,ii] * (poly[1,ii+1] - poly[1,ii-1]) - area += poly[0,0] * (poly[1,1] - poly[1,npts-1]) - return area/2 - -def poly_area_and_barycenter(double[:,::1] poly, int npts): - cdef int ii - cdef double a2 - cdef double area - cdef double inva6 - cdef np.ndarray[double,ndim=1] cg = np.zeros((2,)) - cdef double[::1] cg_mv = cg - cdef double[2] p1, p2 - for ii in range(npts): - p1[0] = poly[0,ii] - p1[1] = poly[1,ii] - p2[0] = poly[0,ii+1] - p2[1] = poly[1,ii+1] - a2 = p1[0]*p2[1] - p2[0]*p1[1] - cg[0] += (p1[0] + p2[0])*a2 - cg[1] += (p1[1] + p2[1])*a2 - area = poly_area(poly, npts) - inva6 = 1. / area / 6. - cg[0] = cg[0] * inva6 - cg[1] = cg[1] * inva6 - return cg, area - -""" -############################################################################### -############################################################################### - Sinogram specific -############################################################################### -""" - -def Sino_ImpactEnv(np.ndarray[double,ndim=1] RZ, - np.ndarray[double,ndim=2] Poly, int NP=50, Test=True): - """ Computes impact parameters of a Tor enveloppe - (a `Tor` is a closed 2D polygon) - - D. VEZINET, Aug. 2014 - Parameters - ---------- - RZ : np.ndarray - (2,) array indicating the reference impact point - Poly : np.ndarray - (2,N) array containing the coordinatesof a closed polygon - NP : int - Number of indicating the number of points used for discretising theta between 0 and pi - - Returns - ------- - theta - """ - if Test: - assert RZ.size==2, 'Arg RZ should be a (2,) np.ndarray!' - assert Poly.shape[0]==2, 'Arg Poly should be a (2,N) np.ndarray!' - cdef int NPoly = Poly.shape[1] - # Theta sampling and unit vector - theta = np.linspace(0.,np.pi,NP,endpoint=True) - vect = np.array([np.cos(theta), np.sin(theta)]) - - # Scalar product - sca = np.sum(vect[:,:,np.newaxis]*(Poly-RZ[:,np.newaxis])[:,np.newaxis,:],axis=0) - scamin = np.min(sca,axis=1) - scamax = np.max(sca,axis=1) - return theta, np.array([scamax, scamin]) - - -# For sinograms -def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True): - if hasattr(theta,'__getitem__'): - pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta) - assert pP.shape==pN.shape==theta.shape, ( - "Args pP, pN and theta must have same shape!") - pPbis, pNbis = np.copy(pP), np.copy(pN) - xi = theta - np.pi/2. - ind = xi < 0 - pPbis[ind], pNbis[ind], xi[ind] = -pN[ind], -pP[ind], xi[ind]+np.pi - if sort: - ind = np.argsort(xi) - xi, pP, pN = xi[ind], pPbis[ind], pNbis[ind] - return xi, pP, pN - else: - assert not (hasattr(pP,'__getitem__') or hasattr(pN,'__getitem__')), ( - "Args pP, pN and theta must have same shape!") - xi = theta - np.pi/2. - if xi < 0.: - return xi+np.pi, -pN, -pP - else: - return xi, pP, pN - - -""" -######################################################## -######################################################## -######################################################## -# Ves-specific -######################################################## -######################################################## -######################################################## -""" - - -######################################################## -######################################################## -# isInside -######################################################## - -def _Ves_isInside(double[:, ::1] pts, double[:, ::1] ves_poly, - double[:, ::1] ves_lims=None, int nlim=0, - str ves_type='Tor', str in_format='(X,Y,Z)', bint test=True): - """ - Checks if points Pts are in vessel VPoly. - VPoly should be CLOSED - """ - cdef str err_msg - cdef str ves_type_low = ves_type.lower() - cdef str in_form_low = in_format.lower() - cdef bint is_cartesian - cdef bint is_toroidal = ves_type_low == 'tor' - cdef int[3] order - cdef np.ndarray[int,ndim=1] is_inside - cdef list in_letters = in_form_low.replace('(', - '').replace(')','').split(',') - # preparing format of coordinates: - is_cartesian = all([ss in ['x','y','z'] for ss in in_letters]) - if is_cartesian: - order[0] = in_letters.index('x') - order[1] = in_letters.index('y') - order[2] = in_letters.index('z') - else: - order[0] = in_letters.index('r') - order[1] = in_letters.index('z') - order[2] = in_letters.index('phi') - # -------------------------------------------------------------------------- - if test: - err_msg = "Arg VPoly must be a (2,N) np.ndarray !" - assert ves_poly.shape[0]==2, err_msg - err_msg = "Arg ves_type must be a str in ['Tor','Lin'] !" - assert ves_type_low in ['tor','lin'], err_msg - assert nlim>=0, "nlim should be integer >= 0" - err_msg = "No valid format, you gave =" + in_format - assert (is_cartesian or - all([ss in ['r', 'z', 'phi'] for ss in in_letters])), err_msg - if is_toroidal and ves_lims is not None: - assert is_cartesian or 'phi' in in_letters, err_msg - # -------------------------------------------------------------------------- - is_inside = np.zeros(max(nlim,1)*pts.shape[1],dtype=np.int32) - _rt.is_inside_vessel(pts, ves_poly, ves_lims, nlim, is_toroidal, - is_cartesian, order, is_inside) - if nlim == 0 or nlim==1: - return is_inside.astype(bool) - return is_inside.astype(bool).reshape(nlim, pts.shape[1]) - -# ============================================================================== -# -# LINEAR MESHING -# i.e. Discretizing horizontal lines -# -# ============================================================================== -def discretize_line1d(double[::1] LMinMax, double dstep, - DL=None, bint Lim=True, - str mode='abs', double margin=_VSMALL): - """ - Discretize a 1D segment LMin-LMax. If `mode` is "abs" (absolute), then the - segment will be discretized in cells each of size `dstep`. Else, if `mode` - is "rel" (relative), the meshing step is relative to the segments norm (ie. - the actual discretization step will be (LMax - LMin)/dstep). - It is possible to only one to discretize the segment on a sub-domain. If so, - the sub-domain limits are given in DL. - Parameters - ========== - LMinMax : (2)-double array - Gives the limits LMin and LMax of the segment. LMinMax = [LMin, LMax] - dstep: double - Step of discretization, can be absolute (default) or relative - DL : (optional) (2)-double array - Sub domain of discretization. If not None and if Lim, LMinMax = DL - (can be only on one limit and can be bigger or smaller than original). - Actual desired limits - Lim : (optional) bool - Indicated if the subdomain should be taken into account - mode : (optional) string - If `mode` is "abs" (absolute), then the - segment will be discretized in cells each of size `dstep`. Else, - if "rel" (relative), the meshing step is relative to the segments norm - (the actual discretization step will be (LMax - LMin)/dstep). - margin : (optional) double - Margin value for cell length - Returns - ======= - ldiscret: double array - array of the discretized coordinates on the segment of desired limits - resolution: double - step of discretization - lindex: int array - array of the indices corresponding to ldiscret with respects to the - original segment LMinMax (if no DL, from 0 to N-1) - N : int64 - Number of points on LMinMax segment - """ - cdef int mode_num - cdef str err_mess - cdef str mode_low = mode.lower() - cdef bint mode_is_abs = mode_low == 'abs' - cdef bint mode_is_rel = mode_low == 'rel' - cdef long sz_ld - cdef long[1] N - cdef long* lindex = NULL - cdef double* ldiscret = NULL - cdef double[2] dl_array - cdef double[1] resolution - cdef np.ndarray[double,ndim=1] ld_arr - cdef np.ndarray[long,ndim=1] li_arr - # .. Testing ............................................................... - err_mess = "Mode has to be 'abs' (absolute) or 'rel' (relative)" - assert mode_is_abs or mode_is_rel, err_mess - # .. preparing inputs....................................................... - if DL is None: - dl_array[0] = Cnan - dl_array[1] = Cnan - else: - if DL[0] is None: - dl_array[0] = Cnan - else: - dl_array[0] = DL[0] - if DL[1] is None: - dl_array[1] = Cnan - else: - dl_array[1] = DL[1] - if mode_is_abs: - mode_num = 1 - elif mode_is_rel: - mode_num = 2 - else: - mode_num = -1 # error - #.. calling cython function................................................. - sz_ld = _st.discretize_line1d_core(&LMinMax[0], dstep, dl_array, Lim, - mode_num, margin, &ldiscret, resolution, - &lindex, N) - #.. converting and returning................................................ - ld_arr = np.copy(np.asarray( ldiscret)) - li_arr = np.copy(np.asarray(lindex)).astype(int) - free(ldiscret) - free(lindex) - return ld_arr, resolution[0], li_arr, N[0] - - -# ============================================================================== -# -# 2D MESHING -# i.e. Discretizing polygons -# -# ============================================================================== -def discretize_segment2d(double[::1] LMinMax1, double[::1] LMinMax2, - double dstep1, double dstep2, - D1=None, D2=None, str mode='abs', - double[:,::1] VPoly=None, - double margin=_VSMALL): - """ - Discretizes a 2D segment where the 1st coordinates are defined in LMinMax1 - and the second ones in LMinMax2. The refinement in x is defined by dstep1, - and dstep2 defines the resolution on y. - Optionnally you can give a VPoly to which the discretized in which the - segment has to be included. - This function is basically a generalization of discretize_line1d. - Parameters - ========== - LMinMax1 : (2)-double array - Gives the limits LMin and LMax of the x coordinates of the segment. - LMinMax1 = [xmin, xmax] - LMinMax2 : (2)-double array - Gives the limits LMin and LMax of the y coordinates of the segment. - LMinMax2 = [ymin, ymax] - dstep1 or dstep2 : double - Step of discretization, can be absolute (default) or relative - D1 or D2 : (optional) (2)-double array - Sub domain of discretization. If not None and if Lim, LMinMax = DL - (can be only on one limit and can be bigger or smaller than original). - Actual desired limits - mode : (optional) string - If `mode` is "abs" (absolute), then the - segment will be discretized in cells each of size `dstep`. Else, - if "rel" (relative), the meshing step is relative to the segments norm - (the actual discretization step will be (LMax - LMin)/dstep). - margin : (optional) double - Margin value for cell length - VPoly : (optional) 2d double array - If present, we check that the discretized segment is included in the - path defined by VPoly. - Returns - ======= - ldiscret: double 2d array - array of the discretized coordinates on the segment of desired limits - resolution: double array - step of discretization on 2d (typically resolution-on-x*resolution-on-y) - lindex: int array - array of the indices corresponding to ldiscret with respects to the - original segment LMinMax (if no DL, from 0 to N-1) - resol1 : double - Smallest resolution on x - resol2 : double - Smallest resolution on y - """ - cdef int nn - cdef int ndisc - cdef int ii, jj - cdef int tot_true - cdef int mode_num - cdef int num_pts_vpoly - cdef str err_mess - cdef str mode_low = mode.lower() - cdef long nind1 - cdef long nind2 - cdef int[1] nL0_1 - cdef int[1] nL0_2 - cdef long[1] ncells1 - cdef long[1] ncells2 - cdef double[2] dl1_array - cdef double[2] dl2_array - cdef double[2] resolutions - cdef long[:] lindex_view - cdef double[:] lresol_view - cdef double[:,:] ldiscr_view - cdef int* are_in_poly = NULL - cdef long* lindex1_arr = NULL - cdef long* lindex2_arr = NULL - cdef long* lindex_tmp = NULL - cdef double* ldiscr_tmp = NULL - cdef double* ldiscret1_arr = NULL - cdef double* ldiscret2_arr = NULL - cdef np.ndarray[double,ndim=2] ldiscr - cdef np.ndarray[double,ndim=1] lresol - cdef np.ndarray[long,ndim=1] lindex - # .. Testing ............................................................... - err_mess = "Mode has to be 'abs' (absolute) or 'rel' (relative)" - assert (mode_low == 'abs') or (mode_low == 'rel'), err_mess - # .. Treating subdomains and Limits ........................................ - if D1 is None: - dl1_array[0] = Cnan - dl1_array[1] = Cnan - else: - if D1[0] is None: - dl1_array[0] = Cnan - else: - dl1_array[0] = D1[0] - if D1[1] is None: - dl1_array[1] = Cnan - else: - dl1_array[1] = D1[1] - if D2 is None: - dl2_array[0] = Cnan - dl2_array[1] = Cnan - else: - if D2[0] is None: - dl2_array[0] = Cnan - else: - dl2_array[0] = D2[0] - if D2[1] is None: - dl2_array[1] = Cnan - else: - dl2_array[1] = D2[1] - if mode_low == 'abs': - mode_num = 1 - elif mode_low == 'rel': - mode_num = 2 - else: - # should never reach this point - mode_num = -1 - assert(False) - # .. Discretizing on the first direction ................................... - nind1 = _st.discretize_line1d_core(&LMinMax1[0], dstep1, dl1_array, - True, mode_num, margin, - &ldiscret1_arr, &resolutions[0], - &lindex1_arr, ncells1) - # .. Discretizing on the second direction .................................. - nind2 = _st.discretize_line1d_core(&LMinMax2[0], dstep2, dl2_array, - True, mode_num, margin, - &ldiscret2_arr, &resolutions[1], - &lindex2_arr, ncells2) - #.... - if VPoly is not None: - ndisc = nind1 * nind2 - ldiscr_tmp = malloc(ndisc * 2 * sizeof(double)) - lindex_tmp = malloc(ndisc * sizeof(long)) - for ii in range(nind2): - for jj in range(nind1): - nn = jj + nind1 * ii - ldiscr_tmp[nn] = ldiscret1_arr[jj] - ldiscr_tmp[ndisc + nn] = ldiscret2_arr[ii] - lindex_tmp[nn] = lindex1_arr[jj] + nind1 * lindex2_arr[ii] - num_pts_vpoly = VPoly.shape[1] - 1 - are_in_poly = malloc(ndisc * sizeof(int)) - tot_true = _bgt.is_point_in_path_vec(num_pts_vpoly, - &VPoly[0][0], &VPoly[1][0], - ndisc, - &ldiscr_tmp[0], &ldiscr_tmp[ndisc], - are_in_poly) - ldiscr = np.empty((2, tot_true), dtype=float) - lresol = np.empty((tot_true,), dtype=float) - lindex = np.empty((tot_true,), dtype=int) - ldiscr_view = ldiscr - lindex_view = lindex - lresol_view = lresol - jj = 0 - for ii in range(ndisc): - if are_in_poly[ii]: - lresol_view[jj] = resolutions[0] * resolutions[1] - lindex_view[jj] = lindex_tmp[ii] - ldiscr_view[0,jj] = ldiscr_tmp[ii] - ldiscr_view[1,jj] = ldiscr_tmp[ii + ndisc] - jj = jj + 1 - free(ldiscr_tmp) - free(lindex_tmp) - free(are_in_poly) - free(ldiscret1_arr) - free(ldiscret2_arr) - free(lindex1_arr) - free(lindex2_arr) - return ldiscr, lresol,\ - lindex, resolutions[0], resolutions[1] - else: - ndisc = nind1 * nind2 - ldiscr = np.empty((2, ndisc), dtype=float) - lresol = np.empty((ndisc,), dtype=float) - lindex = np.empty((ndisc,), dtype=int) - ldiscr_view = ldiscr - lindex_view = lindex - lresol_view = lresol - for ii in range(nind2): - for jj in range(nind1): - nn = jj + nind1 * ii - ldiscr_view[0,nn] = ldiscret1_arr[jj] - ldiscr_view[1,nn] = ldiscret2_arr[ii] - lindex_view[nn] = lindex1_arr[jj] + nind1 * lindex2_arr[ii] - lresol_view[nn] = resolutions[0] * resolutions[1] - free(ldiscret1_arr) - free(ldiscret2_arr) - free(lindex1_arr) - free(lindex2_arr) - return ldiscr, lresol,\ - lindex, resolutions[0], resolutions[1] - -def _Ves_meshCross_FromInd(double[::1] MinMax1, double[::1] MinMax2, double d1, - double d2, long[::1] ind, str dSMode='abs', - double margin=_VSMALL): - cdef int NP = ind.size - cdef int ii - cdef double d1r, d2r - cdef int N1, N2 - cdef int i1, i2 - cdef np.ndarray[double,ndim=2] Pts = np.empty((2,NP)) - cdef np.ndarray[double,ndim=1] dS - cdef long[2] ncells - cdef double[2] resolution - cdef double[2] dl_array - cdef double* X1 = NULL - cdef double* X2 = NULL - cdef long* dummy = NULL - cdef str mode_low = dSMode.lower() - cdef int mode_num - # .. Testing ............................................................... - assert (mode_low == 'abs') or (mode_low == 'rel'), "Mode has to be " +\ - "'abs' (absolute) or 'rel' (relative)" - #.. preparing inputs........................................................ - dl_array[0] = Cnan - dl_array[1] = Cnan - if mode_low == 'abs': - mode_num = 1 - elif mode_low == 'rel': - mode_num = 2 - else: - # should never reach this point - mode_num = -1 - assert(False) - #.. calling cython function................................................. - _st.discretize_line1d_core(&MinMax1[0], d1, dl_array, True, mode_num, - margin, &X1, &resolution[0], &dummy, - &ncells[0]) - _st.discretize_line1d_core(&MinMax2[0], d2, dl_array, True, mode_num, - margin, &X2, &resolution[1], &dummy, - &ncells[1]) - d1r = resolution[0] - d2r = resolution[1] - N1 = ncells[0] - N2 = ncells[1] - dS = d1r*d2r*np.ones((NP,)) - for ii in range(0,NP): - i2 = ind[ii] // N1 - i1 = ind[ii]-i2*N1 - Pts[0,ii] = X1[i1] - Pts[1,ii] = X2[i2] - free(X1) - free(X2) - free(dummy) - return Pts, dS, d1r, d2r - - -def discretize_vpoly(double[:,::1] VPoly, double dL, - str mode='abs', list D1=None, list D2=None, - double margin=_VSMALL, double DIn=0., - double[:,::1] VIn=None): - """ - Discretizes a VPoly (2D polygon of a cross section in (R,Z) coordinates). - The refinement on R and Z is defined dL. - Optionnally you can give a coefficient (DIn) and the normal vectors going - inwards the VPoly (VIn), and the result will be slightly shifted inwards - (or outwards if DIn<0) of DIn*VIn. - Parameters - ========== - VPoly : (2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the Vessel - dL : double - Step of discretization, can be absolute (default) or relative - D1 or D2 : (optional) (2)-double array - Sub domain of discretization. - (can be only on one limit and can be bigger or smaller than original). - Actual desired limits - mode : (optional) string - If `mode` is "abs" (absolute), then the - segment will be discretized in cells each of size `dstep`. Else, - if "rel" (relative), the meshing step is relative to the segments norm - margin : (optional) double - Margin value for cell length - Returns - ======= - return PtsCross, resol, ind_arr, N_arr, Rref_arr, VPolybis - PtsCross: double 2d array - array of the discretized coordinates of the VPoly - resol: double 1d array - step of discretization on 2d - ind_arr: int 1d array - array of the indices corresponding to ldiscret with respects to the - original VPoly - N_arr : int 1d array - number of cells on each segment of the VPoly - Rref_arr : double 1d array - reference Radius coordinates, not shifted even if DIn <> 0. - If DIn == 0, then Rref_arr = PtsCross[0, ...] - VPolybis : - - """ - cdef int NP=VPoly.shape[1] - cdef int[1] sz_vb, sz_ot - cdef double* XCross = NULL - cdef double* YCross = NULL - cdef double* XPolybis = NULL - cdef double* YPolybis = NULL - cdef double* Rref = NULL - cdef double* resolution = NULL - cdef long* ind = NULL - cdef long* numcells = NULL - cdef np.ndarray[double,ndim=2] PtsCross, VPolybis - cdef np.ndarray[double,ndim=1] PtsCrossX, PtsCrossY - cdef np.ndarray[double,ndim=1] VPolybisX, VpolybisY - cdef np.ndarray[double,ndim=1] Rref_arr, resol - cdef np.ndarray[long,ndim=1] ind_arr, N_arr - cdef np.ndarray[long,ndim=1] ind_in - cdef str mode_low = mode.lower() - cdef int mode_num - # .. Testing ............................................................... - assert (mode_low == 'abs') or (mode_low == 'rel'), "Mode has to be 'abs' (absolute)" +\ - " or 'rel' (relative)" - assert (not (DIn == 0.) or VIn is not None) - # .. preparing inputs....................................................... - if mode_low == 'abs': - mode_num = 1 - elif mode_low == 'rel': - mode_num = 2 - else: - # should never reach this point - mode_num = -1 - assert(False) - _st.discretize_vpoly_core(VPoly, dL, mode_num, margin, DIn, VIn, - &XCross, &YCross, &resolution, - &ind, &numcells, &Rref, &XPolybis, &YPolybis, - &sz_vb[0], &sz_ot[0], NP) - assert not ((XCross == NULL) or (YCross == NULL) - or (XPolybis == NULL) or (YPolybis == NULL)) - PtsCrossX = np.array( XCross) - PtsCrossY = np.array( YCross) - PtsCross = np.array([PtsCrossX,PtsCrossY]) - VPolybisX = np.array( XPolybis) - VPolybisY = np.array( YPolybis) - VPolybis = np.array([VPolybisX, VPolybisY]) - resol = np.array( resolution) - Rref_arr = np.array( Rref) - ind_arr = np.array( ind) - N_arr = np.array( numcells) - if D1 is not None: - indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1]) - PtsCross = PtsCross[:,indin] - resol = resol[indin] - ind_arr = ind_arr[indin] - if D2 is not None: - indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1]) - PtsCross = PtsCross[:,indin] - resol = resol[indin] - ind_arr = ind_arr[indin] - free(XCross) - free(YCross) - free(XPolybis) - free(YPolybis) - free(resolution) - free(Rref) - free(ind) - free(numcells) - return PtsCross, resol, ind_arr, N_arr, Rref_arr, VPolybis - - -# ============================================================================== -# -# 3D MESHING in TOROIDAL configurations -# i.e. Discretizing Volumes -# -# ============================================================================== -def _Ves_Vmesh_Tor_SubFromD_cython(double dR, double dZ, double dRPhi, - double[::1] RMinMax, double[::1] ZMinMax, - double[::1] DR=None, double[::1] DZ=None, - DPhi=None, VPoly=None, - str Out='(X,Y,Z)', double margin=_VSMALL): - """ - Return the desired submesh indicated by the limits (DR,DZ,DPhi), - for the desired resolution (dR,dZ,dRphi) - """ - cdef double[::1] R0, R, Z, dRPhir, dPhir, NRPhi, hypot - cdef double dRr0, dRr, dZr, DPhi0, DPhi1 - cdef double abs0, abs1, phi, indiijj - cdef long[::1] indR0, indR, indZ, Phin, NRPhi0 - cdef int NR0, NR, NZ, Rn, Zn, nRPhi0, indR0ii, ii, jj, nPhi0, nPhi1, zz - cdef int NP, NRPhi_int, Rratio - cdef np.ndarray[double,ndim=2] Pts, indI - cdef np.ndarray[double,ndim=1] iii, dV, ind - - # Get the actual R and Z resolutions and mesh elements - R0, dRr0, indR0, NR0 = discretize_line1d(RMinMax, dR, None, - Lim=True, margin=margin) - R, dRr, indR, NR = discretize_line1d(RMinMax, dR, DR, Lim=True, - margin=margin) - Z, dZr, indZ, NZ = discretize_line1d(ZMinMax, dZ, DZ, Lim=True, - margin=margin) - Rn = len(R) - Zn = len(Z) - - # Get the limits if any (and make sure to replace them in the proper - # quadrants) - if DPhi is None: - DPhi0, DPhi1 = -Cpi, Cpi - else: - DPhi0 = Catan2(Csin(DPhi[0]), Ccos(DPhi[0])) - DPhi1 = Catan2(Csin(DPhi[1]), Ccos(DPhi[1])) - - dRPhir, dPhir = np.empty((Rn,)), np.empty((Rn,)) - Phin = np.empty((Rn,),dtype=int) - NRPhi = np.empty((Rn,)) - NRPhi0 = np.zeros((Rn,),dtype=int) - nRPhi0, indR0ii = 0, 0 - NP, NPhimax = 0, 0 - Rratio = int(Cceil(R[Rn-1]/R[0])) - for ii in range(0,Rn): - # Get the actual RPhi resolution and Phi mesh elements (! depends on R!) - NRPhi[ii] = Cceil(2.*Cpi*R[ii]/dRPhi) - NRPhi_int = int(NRPhi[ii]) - dPhir[ii] = 2.*Cpi/NRPhi[ii] - dRPhir[ii] = dPhir[ii]*R[ii] - # Get index and cumulated indices from background - for jj in range(indR0ii,NR0): - if R0[jj]==R[ii]: - indR0ii = jj - break - else: - nRPhi0 += Cceil(2.*Cpi*R0[jj]/dRPhi) - NRPhi0[ii] = nRPhi0*NZ - # Get indices of phi - # Get the extreme indices of the mesh elements that really need to - # be created within those limits - abs0 = Cabs(DPhi0+Cpi) - if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii]) < margin*dPhir[ii]: - nPhi0 = int(Cround((DPhi0+Cpi)/dPhir[ii])) - else: - nPhi0 = int(Cfloor((DPhi0+Cpi)/dPhir[ii])) - abs1 = Cabs(DPhi1+Cpi) - if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii]) < margin*dPhir[ii]: - nPhi1 = int(Cround((DPhi1+Cpi)/dPhir[ii])-1) - else: - nPhi1 = int(Cfloor((DPhi1+Cpi)/dPhir[ii])) - - if DPhi0( nPhi0+jj ) - else: - #indI.append(list(range(nPhi0,NRPhi_int)+list(range(0,nPhi1+1)))) - Phin[ii] = nPhi1+1+NRPhi_int-nPhi0 - if ii==0: - indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1)) - for jj in range(0,NRPhi_int-nPhi0): - indI[ii,jj] = ( nPhi0+jj ) - for jj in range(NRPhi_int-nPhi0,Phin[ii]): - indI[ii,jj] = ( jj- (NRPhi_int-nPhi0) ) - NP += Zn*Phin[ii] - Pts = np.empty((3,NP)) - ind = np.empty((NP,)) - dV = np.empty((NP,)) - # Compute Pts, dV and ind - # This triple loop is the longest part, it takes ~90% of the CPU time - NP = 0 - if Out.lower()=='(x,y,z)': - for ii in range(0,Rn): - # To make sure the indices are in increasing order - iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) - for zz in range(0,Zn): - for jj in range(0,Phin[ii]): - indiijj = iii[jj] - phi = -Cpi + (0.5+indiijj)*dPhir[ii] - Pts[0,NP] = R[ii]*Ccos(phi) - Pts[1,NP] = R[ii]*Csin(phi) - Pts[2,NP] = Z[zz] - ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj - dV[NP] = dRr*dZr*dRPhir[ii] - NP += 1 - else: - for ii in range(0,Rn): - iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) - #assert iii.size==Phin[ii] and np.all(np.unique(iii)==iii) - for zz in range(0,Zn): - for jj in range(0,Phin[ii]): - indiijj = iii[jj] #indI[ii,iii[jj]] - Pts[0,NP] = R[ii] - Pts[1,NP] = Z[zz] - Pts[2,NP] = -Cpi + (0.5+indiijj)*dPhir[ii] - ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj - dV[NP] = dRr*dZr*dRPhir[ii] - NP += 1 - if VPoly is not None: - if Out.lower()=='(x,y,z)': - hypot = _bgt.compute_hypot(Pts[0,:],Pts[1,:]) - indin = Path(VPoly.T).contains_points(np.array([hypot,Pts[2,:]]).T, - transform=None, radius=0.0) - Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin] - Ru = np.unique(hypot) - else: - indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, - radius=0.0) - Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin] - Ru = np.unique(Pts[0,:]) - # TODO : Warning : do we need the following lines ???? - # if not np.all(Ru==R): - # dRPhir = np.array([dRPhir[ii] for ii in range(0,len(R)) \ - # if R[ii] in Ru]) - return Pts, dV, ind.astype(int), dRr, dZr, np.asarray(dRPhir) - - -def _Ves_Vmesh_Tor_SubFromInd_cython(double dR, double dZ, double dRPhi, - double[::1] RMinMax, double[::1] ZMinMax, - long[::1] ind, str Out='(X,Y,Z)', - double margin=_VSMALL): - """ Return the desired submesh indicated by the (numerical) indices, - for the desired resolution (dR,dZ,dRphi) - """ - cdef double[::1] R, Z, dRPhirRef, dPhir, Ru, dRPhir - cdef double dRr, dZr, phi - cdef long[::1] indR, indZ, NRPhi0, NRPhi - cdef long NR, NZ, Rn, Zn, NP=len(ind), Rratio - cdef int ii=0, jj=0, iiR, iiZ, iiphi - cdef double[:,::1] Phi - cdef np.ndarray[double,ndim=2] Pts=np.empty((3,NP)) - cdef np.ndarray[double,ndim=1] dV=np.empty((NP,)) - - # Get the actual R and Z resolutions and mesh elements - R, dRr, indR, NR = discretize_line1d(RMinMax, dR, None, Lim=True, - margin=margin) - Z, dZr, indZ, NZ = discretize_line1d(ZMinMax, dZ, None, Lim=True, - margin=margin) - Rn, Zn = len(R), len(Z) - - # Number of Phi per R - dRPhirRef, dPhir = np.empty((NR,)), np.empty((NR,)) - Ru, dRPhir = np.zeros((NR,)), np.nan*np.ones((NR,)) - NRPhi, NRPhi0 = np.empty((NR,),dtype=int), np.empty((NR+1,),dtype=int) - Rratio = int(Cceil(R[NR-1]/R[0])) - for ii in range(0,NR): - NRPhi[ii] = (Cceil(2.*Cpi*R[ii]/dRPhi)) - dRPhirRef[ii] = 2.*Cpi*R[ii]/(NRPhi[ii]) - dPhir[ii] = 2.*Cpi/(NRPhi[ii]) - if ii==0: - NRPhi0[ii] = 0 - Phi = np.empty((NR,NRPhi[ii]*Rratio+1)) - else: - NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]*NZ - for jj in range(0,NRPhi[ii]): - Phi[ii,jj] = -Cpi + (0.5+jj)*dPhir[ii] - - if Out.lower()=='(x,y,z)': - for ii in range(0,NP): - for jj in range(0,NR+1): - if ind[ii]-NRPhi0[jj]<0.: - break - iiR = jj-1 - iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR] - iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR] - phi = Phi[iiR,iiphi] - Pts[0,ii] = R[iiR]*Ccos(phi) - Pts[1,ii] = R[iiR]*Csin(phi) - Pts[2,ii] = Z[iiZ] - dV[ii] = dRr*dZr*dRPhirRef[iiR] - if Ru[iiR]==0.: - dRPhir[iiR] = dRPhirRef[iiR] - Ru[iiR] = 1. - else: - for ii in range(0,NP): - for jj in range(0,NR+1): - if ind[ii]-NRPhi0[jj]<0.: - break - iiR = jj-1 - iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR] - iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR] - Pts[0,ii] = R[iiR] - Pts[1,ii] = Z[iiZ] - Pts[2,ii] = Phi[iiR,iiphi] - dV[ii] = dRr*dZr*dRPhirRef[iiR] - if Ru[iiR]==0.: - dRPhir[iiR] = dRPhirRef[iiR] - Ru[iiR] = 1. - return Pts, dV, dRr, dZr, np.asarray(dRPhir)[~np.isnan(dRPhir)] - - -# ============================================================================== -# -# 3D MESHING in LINEAR configurations -# i.e. Discretizing Volumes -# -# ============================================================================== - -def _Ves_Vmesh_Lin_SubFromD_cython(double dX, double dY, double dZ, - double[::1] XMinMax, double[::1] YMinMax, - double[::1] ZMinMax, - double[::1] DX=None, - double[::1] DY=None, - double[::1] DZ=None, VPoly=None, - double margin=_VSMALL): - """ Return the desired submesh indicated by the limits (DX,DY,DZ), - for the desired resolution (dX,dY,dZ) - """ - cdef double[::1] X, Y, Z - cdef double dXr, dYr, dZr, dV - cdef np.ndarray[long,ndim=1] indX, indY, indZ - cdef int NX, NY, NZ, Xn, Yn, Zn - cdef np.ndarray[double,ndim=2] Pts - cdef np.ndarray[long,ndim=1] ind - - # Get the actual X, Y and Z resolutions and mesh elements - X, dXr, indX, NX = discretize_line1d(XMinMax, dX, DX, Lim=True, - margin=margin) - Y, dYr, indY, NY = discretize_line1d(YMinMax, dY, DY, Lim=True, - margin=margin) - Z, dZr, indZ, NZ = discretize_line1d(ZMinMax, dZ, DZ, Lim=True, - margin=margin) - Xn, Yn, Zn = len(X), len(Y), len(Z) - - Pts = np.array([np.tile(X,(Yn*Zn,1)).flatten(), - np.tile(np.repeat(Y,Xn),(Zn,1)).flatten(), - np.repeat(Z,Xn*Yn)]) - ind = np.repeat(NX*NY*indZ,Xn*Yn) + \ - np.tile(np.repeat(NX*indY,Xn),(Zn,1)).flatten() + \ - np.tile(indX,(Yn*Zn,1)).flatten() - dV = dXr*dYr*dZr - - if VPoly is not None: - indin = Path(VPoly.T).contains_points(Pts[1:,:].T, transform=None, - radius=0.0) - Pts, ind = Pts[:,indin], ind[indin] - - return Pts, dV, ind.astype(int), dXr, dYr, dZr - - -def _Ves_Vmesh_Lin_SubFromInd_cython(double dX, double dY, double dZ, - double[::1] XMinMax, double[::1] YMinMax, - double[::1] ZMinMax, - np.ndarray[long,ndim=1] ind, - double margin=_VSMALL): - """ Return the desired submesh indicated by the limits (DX,DY,DZ), - for the desired resolution (dX,dY,dZ) - """ - - cdef np.ndarray[double,ndim=1] X, Y, Z - cdef double dXr, dYr, dZr, dV - cdef long[::1] bla - cdef np.ndarray[long,ndim=1] indX, indY, indZ - cdef int NX, NY, NZ, Xn, Yn, Zn - cdef np.ndarray[double,ndim=2] Pts - - # Get the actual X, Y and Z resolutions and mesh elements - X, dXr, bla, NX = discretize_line1d(XMinMax, dX, None, Lim=True, - margin=margin) - Y, dYr, bla, NY = discretize_line1d(YMinMax, dY, None, Lim=True, - margin=margin) - Z, dZr, bla, NZ = discretize_line1d(ZMinMax, dZ, None, Lim=True, - margin=margin) - - indZ = ind // (NX*NY) - indY = (ind - NX*NY*indZ) // NX - indX = ind - NX*NY*indZ - NX*indY - Pts = np.array([X[indX.astype(int)], - Y[indY.astype(int)], - Z[indZ.astype(int)]]) - dV = dXr*dYr*dZr - - return Pts, dV, dXr, dYr, dZr - - - -######################################################## -######################################################## -# Meshing - Surface - Tor -######################################################## - -def _getBoundsinter2AngSeg(bool Full, double Phi0, double Phi1, - double DPhi0, double DPhi1): - """ Return inter=True if an intersection exist (all angles in radians - in [-pi;pi]) - - If inter, return Bounds, a list of tuples indicating the segments defining - the intersection, with - The intervals are ordered from lowest index to highest index (with respect - to [Phi0,Phi1]) - """ - if Full: - Bounds = [[DPhi0,DPhi1]] if DPhi0<=DPhi1 else [[-Cpi,DPhi1],[DPhi0,Cpi]] - inter = True - Faces = [None, None] - - else: - inter, Bounds, Faces = False, None, [False,False] - if Phi0<=Phi1: - if DPhi0<=DPhi1: - if DPhi0<=Phi1 and DPhi1>=Phi0: - inter = True - Bounds = [[None,None]] - Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0 - Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1 - Faces[0] = DPhi0<=Phi0 - Faces[1] = DPhi1>=Phi1 - else: - if DPhi0<=Phi1 or DPhi1>=Phi0: - inter = True - if DPhi0<=Phi1 and DPhi1>=Phi0: - Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]] - Faces = [True,True] - else: - Bounds = [[None,None]] - if DPhi0<=Phi1: - Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0 - Bounds[0][1] = Phi1 - Faces[0] = DPhi0<=Phi0 - Faces[1] = True - else: - Bounds[0][0] = Phi0 - Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1 - Faces[0] = True - Faces[1] = DPhi1>=Phi1 - else: - if DPhi0<=DPhi1: - if DPhi0<=Phi1 or DPhi1>=Phi0: - inter = True - if DPhi0<=Phi1 and DPhi1>=Phi0: - Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]] - Faces = [True,True] - else: - Bounds = [[None,None]] - if DPhi0<=Phi1: - Bounds[0][0] = DPhi0 - Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1 - Faces[1] = DPhi1>=Phi1 - else: - Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0 - Bounds[0][1] = DPhi1 - Faces[0] = DPhi0<=Phi0 - else: - inter = True - if DPhi0>=Phi0 and DPhi1>=Phi0: - Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]] - Faces = [True,True] - elif DPhi0<=Phi1 and DPhi1<=Phi1: - Bounds = [[Phi0,Cpi],[-Cpi,DPhi1],[DPhi0,Phi1]] - Faces = [True,True] - else: - Bounds = [[None,Cpi],[-Cpi,None]] - Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0 - Bounds[1][1] = Phi1 if DPhi1>=Phi1 else DPhi1 - Faces[0] = DPhi0<=Phi0 - Faces[1] = DPhi1>=Phi1 - return inter, Bounds, Faces - - - - -@cython.cdivision(True) -@cython.wraparound(False) -@cython.boundscheck(False) -def _Ves_Smesh_Tor_SubFromD_cython(double dL, double dRPhi, - double[:,::1] VPoly, - DR=None, DZ=None, DPhi=None, - double DIn=0., VIn=None, PhiMinMax=None, - str Out='(X,Y,Z)', double margin=_VSMALL): - """ Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi) - for the desired resolution (dR,dZ,dRphi) - """ - cdef double[::1] R, Z, dPhir, NRPhi#, dPhi, NRZPhi_cum0, indPhi, phi - cdef double dRr0, dRr, dZr, DPhi0, DPhi1, DDPhi, DPhiMinMax - cdef double abs0, abs1, phi, indiijj - cdef long[::1] indR0, indR, indZ, Phin, NRPhi0, Indin - cdef int NR0, NR, NZ, Rn, Zn, nRPhi0, indR0ii, ii, jj0=0, jj, nPhi0, nPhi1 - cdef int zz, NP, NRPhi_int, Rratio, Ln - cdef np.ndarray[double,ndim=2] Pts, indI, PtsCross, VPbis - cdef np.ndarray[double,ndim=1] R0, dS, ind, dLr, Rref, dRPhir, iii - cdef np.ndarray[long,ndim=1] indL, NL, indok - - # To avoid warnings: - indI = np.empty((1,1)) - # Pre-format input - if PhiMinMax is None: - PhiMinMax = [-Cpi,Cpi] - DPhiMinMax = 2.*Cpi - Full = True - else: - PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), - Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))] - DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0] \ - else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0] - Full = False - - # Get the limits if any (and make sure to replace them in the proper - # quadrants) - if DPhi is None: - DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1] - else: - DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]), - Ccos(DPhi[0])) - DPhi1 = PhiMinMax[1] if DPhi[1] is None else Catan2(Csin(DPhi[1]), - Ccos(DPhi[1])) - DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0 - - inter, Bounds, Faces = _getBoundsinter2AngSeg(Full, PhiMinMax[0], - PhiMinMax[1], DPhi0, DPhi1) - - if inter: - - BC = list(Bounds) - nBounds = len(Bounds) - for ii in range(0,nBounds): - if BC[ii][0]=DR[0]) & (R0<=DR[1]) - if DZ is not None: - indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1]) - PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], \ - indL[indin], Rref[indin] - Ln = indin.sum() - Indin = indin.nonzero()[0].astype(np.long) - - dRPhir, dPhir = np.empty((Ln,)), np.empty((Ln,)) - Phin = np.zeros((Ln,),dtype=int) - NRPhi = np.empty((Ln,)) - NRPhi0 = np.zeros((Ln,),dtype=int) - nRPhi0, indR0ii = 0, 0 - NP, NPhimax = 0, 0 - Rratio = int(Cceil(np.max(Rref)/np.min(Rref))) - indBounds = np.empty((2,nBounds),dtype=int) - for ii in range(0,Ln): - # Get the actual RPhi resolution and Phi mesh elements - # (! depends on R!) - NRPhi[ii] = Cceil(DPhiMinMax*Rref[ii]/dRPhi) - NRPhi_int = int(NRPhi[ii]) - dPhir[ii] = DPhiMinMax/NRPhi[ii] - dRPhir[ii] = dPhir[ii]*Rref[ii] - # Get index and cumulated indices from background - for jj0 in range(indR0ii,NR0): - if jj0==Indin[ii]: - indR0ii = jj0 - break - else: - nRPhi0 += Cceil(DPhiMinMax*R0[jj0]/dRPhi) - NRPhi0[ii] = nRPhi0 - # Get indices of phi - # Get the extreme indices of the mesh elements that really need to - # be created within those limits - for kk in range(0,nBounds): - abs0 = BC[kk][0]-PhiMinMax[0] - if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])( kkb ) - jj += 1 - NP += Phin[ii] - - # Finish counting to get total number of points - if jj0<=NR0-1: - for jj0 in range(indR0ii,NR0): - nRPhi0 += Cceil(DPhiMinMax*R0[jj0]/dRPhi) - - # Compute Pts, dV and ind - Pts = np.nan*np.ones((3,NP)) - ind = np.nan*np.ones((NP,)) - dS = np.nan*np.ones((NP,)) - # This triple loop is the longest part, it takes ~90% of the CPU time - NP = 0 - if Out.lower()=='(x,y,z)': - for ii in range(0,Ln): - # Some rare cases with doubles have to be eliminated: - iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) - for jj in range(0,len(iii)): - indiijj = iii[jj] - phi = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii] - Pts[0,NP] = PtsCross[0,ii]*Ccos(phi) - Pts[1,NP] = PtsCross[0,ii]*Csin(phi) - Pts[2,NP] = PtsCross[1,ii] - ind[NP] = NRPhi0[ii] + indiijj - dS[NP] = dLr[ii]*dRPhir[ii] - NP += 1 - else: - for ii in range(0,Ln): - iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) - for jj in range(0,len(iii)): - indiijj = iii[jj] - Pts[0,NP] = PtsCross[0,ii] - Pts[1,NP] = PtsCross[1,ii] - Pts[2,NP] = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii] - ind[NP] = NRPhi0[ii] + indiijj - dS[NP] = dLr[ii]*dRPhir[ii] - NP += 1 - indok = (~np.isnan(ind)).nonzero()[0].astype(np.long) - ind = ind[indok] - dS = dS[indok] - if len(indok)==1: - Pts = Pts[:,indok].reshape((3,1)) - else: - Pts = Pts[:,indok] - else: - Pts, dS, ind, NL, Rref, dRPhir, nRPhi0 = np.ones((3,0)), np.ones((0,)),\ - np.ones((0,)), np.nan*np.ones((VPoly.shape[1]-1,)),\ - np.ones((0,)), np.ones((0,)), 0 - return np.ascontiguousarray(Pts), dS, ind.astype(int), NL, dLr, Rref, dRPhir, nRPhi0, VPbis - - - -@cython.cdivision(True) -@cython.wraparound(False) -@cython.boundscheck(False) -def _Ves_Smesh_Tor_SubFromInd_cython(double dL, double dRPhi, - double[:,::1] VPoly, long[::1] ind, - double DIn=0., VIn=None, PhiMinMax=None, - str Out='(X,Y,Z)', double margin=_VSMALL): - """ Return the desired submesh indicated by the (numerical) indices, - for the desired resolution (dR,dZ,dRphi) - """ - cdef double[::1] dRPhirRef, dPhir - cdef long[::1] indL, NRPhi0, NRPhi - cdef long NR, NZ, Rn, Zn, NP=len(ind), Rratio - cdef int ii=0, jj=0, iiL, iiphi, Ln, nn=0, kk=0, nRPhi0 - cdef double[:,::1] Phi - cdef np.ndarray[double,ndim=2] Pts=np.empty((3,NP)), indI, PtsCross, VPbis - cdef np.ndarray[double,ndim=1] R0, dS=np.empty((NP,)), dLr, dRPhir, Rref - cdef np.ndarray[long,ndim=1] NL - - # Pre-format input - if PhiMinMax is None: - PhiMinMax = [-Cpi,Cpi] - DPhiMinMax = 2.*Cpi - else: - PhiMinMax = [Catan2(Csin(PhiMinMax[0]), Ccos(PhiMinMax[0])), - Catan2(Csin(PhiMinMax[1]), Ccos(PhiMinMax[1]))] - if PhiMinMax[1]>=PhiMinMax[0]: - DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] - else: - DPhiMinMax = 2.*Cpi + PhiMinMax[1] - PhiMinMax[0] - - - # Get the actual R and Z resolutions and mesh elements - PtsCross, dLrRef, indL,\ - NL, RrefRef, VPbis = discretize_vpoly(VPoly, dL, D1=None, D2=None, - margin=margin, DIn=DIn, VIn=VIn) - Ln = dLrRef.size - # Number of Phi per R - dRPhirRef, dPhir, dRPhir = np.empty((Ln,)), np.empty((Ln,)), -np.ones((Ln,)) - dLr, Rref = -np.ones((Ln,)), -np.ones((Ln,)) - NRPhi, NRPhi0 = np.empty((Ln,),dtype=int), np.empty((Ln,),dtype=int) - Rratio = int(Cceil(np.max(RrefRef)/np.min(RrefRef))) - for ii in range(0,Ln): - NRPhi[ii] = (Cceil(DPhiMinMax*RrefRef[ii]/dRPhi)) - dRPhirRef[ii] = DPhiMinMax*RrefRef[ii]/(NRPhi[ii]) - dPhir[ii] = DPhiMinMax/(NRPhi[ii]) - if ii==0: - NRPhi0[ii] = 0 - Phi = np.empty((Ln,NRPhi[ii]*Rratio+1)) - else: - NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1] - for jj in range(0,NRPhi[ii]): - Phi[ii,jj] = PhiMinMax[0] + (0.5+jj)*dPhir[ii] - nRPhi0 = NRPhi0[Ln-1]+NRPhi[Ln-1] - - if Out.lower()=='(x,y,z)': - for ii in range(0,NP): - for jj in range(0,Ln+1): - if ind[ii]-NRPhi0[jj]<0.: - break - iiL = jj-1 - iiphi = ind[ii] - NRPhi0[iiL] - Pts[0,ii] = PtsCross[0,iiL]*Ccos(Phi[iiL,iiphi]) - Pts[1,ii] = PtsCross[0,iiL]*Csin(Phi[iiL,iiphi]) - Pts[2,ii] = PtsCross[1,iiL] - dS[ii] = dLrRef[iiL]*dRPhirRef[iiL] - if dRPhir[iiL]==-1.: - dRPhir[iiL] = dRPhirRef[iiL] - dLr[iiL] = dLrRef[iiL] - Rref[iiL] = RrefRef[iiL] - - else: - for ii in range(0,NP): - for jj in range(0,Ln+1): - if ind[ii]-NRPhi0[jj]<0.: - break - iiL = jj-1 - iiphi = ind[ii] - NRPhi0[iiL] - Pts[0,ii] = PtsCross[0,iiL] - Pts[1,ii] = PtsCross[1,iiL] - Pts[2,ii] = Phi[iiL,iiphi] - dS[ii] = dLrRef[iiL]*dRPhirRef[iiL] - if dRPhir[iiL]==-1.: - dRPhir[iiL] = dRPhirRef[iiL] - dLr[iiL] = dLrRef[iiL] - Rref[iiL] = RrefRef[iiL] - return Pts, dS, NL, dLr[dLr>-0.5], Rref[Rref>-0.5], \ - dRPhir[dRPhir>-0.5], nRPhi0, VPbis - - - -######################################################## -######################################################## -# Meshing - Surface - TorStruct -######################################################## - - -@cython.cdivision(True) -@cython.wraparound(False) -@cython.boundscheck(False) -def _Ves_Smesh_TorStruct_SubFromD_cython(double[::1] PhiMinMax, double dL, - double dRPhi, - double[:,::1] VPoly, - list DR=None, - list DZ=None, - double[::1] DPhi=None, - double DIn=0., VIn=None, - str Out='(X,Y,Z)', - double margin=_VSMALL): - """Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), - for the desired resolution (dR,dZ,dRphi) - """ - cdef double Dphi, dR0r=0., dZ0r=0. - cdef int NR0=0, NZ0=0, R0n, Z0n, NRPhi0 - cdef double[::1] phiMinMax = np.array([Catan2(Csin(PhiMinMax[0]), - Ccos(PhiMinMax[0])), - Catan2(Csin(PhiMinMax[1]), - Ccos(PhiMinMax[1]))]) - cdef np.ndarray[double, ndim=1] R0, Z0, dsF, dSM, dLr, Rref, dRPhir, dS - cdef np.ndarray[long,ndim=1] indR0, indZ0, iind, iindF, indM, NL, ind - cdef np.ndarray[double,ndim=2] ptsrz, pts, PtsM, VPbis, Pts - cdef list LPts=[], LdS=[], Lind=[] - - # Pre-format input - if PhiMinMax is None: - PhiMinMax = np.array([-Cpi,Cpi]) - DPhiMinMax = 2.*Cpi - Full = True - else: - PhiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), - Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]) - DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0]\ - else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0] - Full = False - - # Get the limits if any and make sure to replace them in the proper quadrant - if DPhi is None: - DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1] - else: - DPhi0 = PhiMinMax[0] if DPhi[0] is None \ - else Catan2(Csin(DPhi[0]),Ccos(DPhi[0])) - DPhi1 = PhiMinMax[1] if DPhi[1] is None \ - else Catan2(Csin(DPhi[1]),Ccos(DPhi[1])) - DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0 - - inter, Bounds, Faces = _getBoundsinter2AngSeg(Full, PhiMinMax[0], - PhiMinMax[1], DPhi0, DPhi1) - - if inter: - BC = list(Bounds) - nBounds = len(Bounds) - for ii in range(0,nBounds): - if BC[ii][0]1 \ - else ptsrz[:,indin].reshape((2,1)) - iindF = iind[indin] - dsF = dR0r*dZ0r*np.ones((indin.sum(),)) - - # First face - if Faces[0]: - if Out.lower()=='(x,y,z)': - pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), - ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), - ptsrz[1,:]]) - else: - pts = np.array([ptsrz[0,:], - ptsrz[1,:], - (phiMinMax[0]+Dphi)*np.ones((indin.sum(),))]) - LPts.append( pts ) - Lind.append( iindF ) - LdS.append( dsF ) - - # Main body - PtsM, dSM,\ - indM, NL,\ - dLr, Rref,\ - dRPhir, nRPhi0,\ - VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly, - DR=DR, DZ=DZ, - DPhi=[DPhi0,DPhi1], - DIn=DIn, VIn=VIn, - PhiMinMax=phiMinMax, - Out=Out, margin=margin) - - if PtsM.shape[1]>=1: - if PtsM.shape[1]==1: - LPts.append(PtsM.reshape((3,1))) - else: - LPts.append(PtsM) - Lind.append( indM + NR0*NZ0 ) - LdS.append( dSM ) - - # Second face - if Faces[1]: - if Out.lower()=='(x,y,z)': - pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), - ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), - ptsrz[1,:]]) - else: - pts = np.array([ptsrz[0,:], - ptsrz[1,:], - (phiMinMax[1]-Dphi)*np.ones((indin.sum(),))]) - LPts.append( pts ) - Lind.append( iindF + NR0*NZ0 + nRPhi0 ) - LdS.append( dsF ) - - # Aggregate - if len(LPts)==1: - Pts = LPts[0] - ind = Lind[0] - dS = LdS[0] - else: - Pts = np.concatenate(tuple(LPts),axis=1) - ind = np.concatenate(tuple(Lind)).astype(int) - dS = np.concatenate(tuple(LdS)) - - else: - Pts, dS, ind, NL, Rref = np.ones((3,0)), np.ones((0,)),\ - np.ones((0,),dtype=int), np.ones((0,),dtype=int),\ - np.nan*np.ones((VPoly.shape[1]-1,)) - dLr, dR0r, dZ0r, dRPhir, VPbis = np.ones((0,)), 0., 0.,\ - np.ones((0,)), np.asarray(VPoly) - - return Pts, dS, ind, NL, dLr, Rref, dR0r, dZ0r, dRPhir, VPbis - - - -@cython.cdivision(True) -@cython.wraparound(False) -@cython.boundscheck(False) -def _Ves_Smesh_TorStruct_SubFromInd_cython(double[::1] PhiMinMax, double dL, - double dRPhi, double[:,::1] VPoly, - np.ndarray[long,ndim=1] ind, - double DIn=0., VIn=None, - str Out='(X,Y,Z)', - double margin=_VSMALL): - """ Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi) - for the desired resolution (dR,dZ,dRphi) """ - cdef double Dphi, dR0r, dZ0r - cdef int NR0, NZ0, R0n, Z0n, NRPhi0 - cdef double[::1] phiMinMax = np.array([Catan2(Csin(PhiMinMax[0]), - Ccos(PhiMinMax[0])), - Catan2(Csin(PhiMinMax[1]), - Ccos(PhiMinMax[1]))]) - cdef np.ndarray[double, ndim=1] R0, Z0, dsF, dSM, dLr, Rref, dRPhir, dS - cdef np.ndarray[long,ndim=1] bla, indR0, indZ0, iind, iindF, indM, NL - cdef np.ndarray[double,ndim=2] ptsrz, pts, PtsM, VPbis, Pts - cdef list LPts=[], LdS=[], Lind=[] - - # Pre-format input - # Required distance effective at max R - Dphi = DIn/np.max(VPoly[0,:]) if DIn!=0. else 0. - - # Get the basic meshes for the faces - R0, dR0r, bla, NR0 = discretize_line1d(np.array([np.min(VPoly[0,:]), - np.max(VPoly[0,:])]), - dL, DL=None, Lim=True, - margin=margin) - Z0, dZ0r, bla, NZ0 = discretize_line1d(np.array([np.min(VPoly[1,:]), - np.max(VPoly[1,:])]), - dL, DL=None, Lim=True, - margin=margin) - - PtsM, dSM, indM,\ - NL, dLr, Rref,\ - dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly, - DR=None, DZ=None, - DPhi=None, - DIn=DIn, VIn=VIn, - PhiMinMax=phiMinMax, - Out=Out, margin=margin) - # First face - ii = (ind0: - indZ0 = ind[ii] // NR0 - indR0 = (ind[ii]-indZ0*NR0) - if Out.lower()=='(x,y,z)': - pts = np.array([R0[indR0]*Ccos(phiMinMax[0]+Dphi), - R0[indR0]*Csin(phiMinMax[0]+Dphi), Z0[indZ0]]) - else: - pts = np.array([R0[indR0], Z0[indZ0], - (phiMinMax[0]+Dphi)*np.ones((nii,))]) - pts = pts if nii>1 else pts.reshape((3,1)) - LPts.append( pts ) - LdS.append( dR0r*dZ0r*np.ones((nii,)) ) - - # Main body - ii = (ind>=NR0*NZ0) & (ind0: - pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1\ - else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1)) - LPts.append( PtsM[:,ind[ii]-NR0*NZ0] ) - LdS.append( dSM[ind[ii]-NR0*NZ0] ) - - # Second face - ii = (ind >= NR0*NZ0+PtsM.shape[1] ).nonzero()[0] - nii = len(ii) - if nii>0: - indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0 - indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0 - if Out.lower()=='(x,y,z)': - pts = np.array([R0[indR0]*Ccos(phiMinMax[1]-Dphi), - R0[indR0]*Csin(phiMinMax[1]-Dphi), Z0[indZ0]]) - else: - pts = np.array([R0[indR0], Z0[indZ0], - (phiMinMax[1]-Dphi)*np.ones((nii,))]) - pts = pts if nii>1 else pts.reshape((3,1)) - LPts.append( pts ) - LdS.append( dR0r*dZ0r*np.ones((nii,)) ) - - # Aggregate - if len(LPts)==1: - Pts = LPts[0] - dS = LdS[0] - elif len(LPts)>1: - Pts = np.concatenate(tuple(LPts),axis=1) - dS = np.concatenate(tuple(LdS)) - - return Pts, dS, NL, dLr, Rref, dR0r, dZ0r, dRPhir, VPbis - - - - - - -######################################################## -######################################################## -# Meshing - Surface - Lin -######################################################## - -cdef inline int _check_DLvsLMinMax(double[::1] LMinMax, - list DL=None): - cdef int inter = 1 - cdef bint dl0_is_not_none - cdef bint dl1_is_not_none - if DL is not None: - dl0_is_not_none = DL[0] is not None - dl1_is_not_none = DL[1] is not None - if len(DL) != 2 or LMinMax[0]>=LMinMax[1]: - assert(False) - if dl0_is_not_none and dl1_is_not_none and DL[0] >= DL[1]: - assert(False) - if dl0_is_not_none and DL[0]>LMinMax[1]: - inter = 0 - elif dl1_is_not_none and DL[1]=LMinMax[1]: - DL[1] = None - return inter - - - -@cython.cdivision(True) -@cython.wraparound(False) -@cython.boundscheck(False) -def _Ves_Smesh_Lin_SubFromD_cython(double[::1] XMinMax, double dL, double dX, - double[:,::1] VPoly, - list DX=None, list DY=None, list DZ=None, - double DIn=0., VIn=None, - double margin=_VSMALL): - """Return the desired surfacic submesh indicated by the limits (DX,DY,DZ), - for the desired resolution (dX,dL) """ - cdef np.ndarray[double,ndim=1] X, Y0, Z0 - cdef double dXr, dY0r, dZ0r - cdef int NY0, NZ0, Y0n, Z0n, NX, Xn, Ln, NR0, inter=1 - cdef np.ndarray[double,ndim=2] Pts, PtsCross, VPbis - cdef np.ndarray[double,ndim=1] dS, dLr, Rref - cdef np.ndarray[long,ndim=1] indX, indY0, indZ0, indL, NL, ind - - # Preformat - # Adjust limits - interX = _check_DLvsLMinMax(XMinMax, DX) - interY = _check_DLvsLMinMax(np.array([np.min(VPoly[0,:]), - np.max(VPoly[0,:])]), DY) - interZ = _check_DLvsLMinMax(np.array([np.min(VPoly[1,:]), - np.max(VPoly[1,:])]), DZ) - - if interX==1 and interY==1 and interZ==1: - - # Get the mesh for the faces - Y0, dY0r,\ - indY0, NY0 = discretize_line1d(np.array([np.min(VPoly[0,:]), - np.max(VPoly[0,:])]), - dL, DL=DY, Lim=True, margin=margin) - Z0, dZ0r,\ - indZ0, NZ0 = discretize_line1d(np.array([np.min(VPoly[1,:]), - np.max(VPoly[1,:])]), - dL, DL=DZ, Lim=True, margin=margin) - Y0n, Z0n = len(Y0), len(Z0) - - # Get the actual R and Z resolutions and mesh elements - X, dXr, indX, NX = discretize_line1d(XMinMax, dX, - DL=DX, - Lim=True, margin=margin) - Xn = len(X) - PtsCross, dLr, indL,\ - NL, Rref, VPbis = discretize_vpoly(VPoly, dL, D1=None, D2=None, - margin=margin, DIn=DIn, VIn=VIn) - NR0 = Rref.size - indin = np.ones((PtsCross.shape[1],),dtype=bool) - if DY is not None: - if DY[0] is not None: - indin = indin & (PtsCross[0,:]>=DY[0]) - if DY[1] is not None: - indin = indin & (PtsCross[0,:]<=DY[1]) - if DZ is not None: - if DZ[0] is not None: - indin = indin & (PtsCross[1,:]>=DZ[0]) - if DZ[1] is not None: - indin = indin & (PtsCross[1,:]<=DZ[1]) - PtsCross, dLr,\ - indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin] - Ln = indin.sum() - # Agregating - Pts = np.array([np.repeat(X,Ln), - np.tile(PtsCross[0,:],Xn), - np.tile(PtsCross[1,:],Xn)]) - ind = NY0*NZ0 + np.repeat(indX*NR0,Ln) + np.tile(indL,Xn) - dS = np.tile(dLr*dXr,Xn) - if DX is None or DX[0] is None: - pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), - np.tile(Y0,Z0n), - np.repeat(Z0,Y0n)]) - iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n) - indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, - radius=0.0) - if np.any(indin): - pts = pts[:,indin].reshape((3,1)) if indin.sum()==1\ - else pts[:,indin] - Pts = np.concatenate((pts,Pts),axis=1) - ind = np.concatenate((iind[indin], ind)) - dS = np.concatenate((dY0r*dZ0r*np.ones((indin.sum(),)),dS)) - if DX is None or DX[1] is None: - pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), - np.tile(Y0,Z0n), - np.repeat(Z0,Y0n)]) - iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) +\ - np.tile(indY0,Z0n) - indin = Path(VPoly.T).contains_points(pts[1:,:].T, - transform=None, - radius=0.0) - if np.any(indin): - pts = pts[:,indin].reshape((3,1)) if indin.sum()==1\ - else pts[:,indin] - Pts = np.concatenate((Pts,pts),axis=1) - ind = np.concatenate((ind,iind[indin])) - dS = np.concatenate((dS,dY0r*dZ0r*np.ones((indin.sum(),)))) - - else: - Pts, dS, ind,\ - NL, dLr, Rref = np.ones((3,0)), np.ones((0,)),\ - np.ones((0,),dtype=int), np.ones((0,),dtype=int),\ - np.ones((0,)), np.ones((0,)) - dXr, dY0r, dZ0r, VPbis = 0., 0., 0., np.ones((3,0)) - - return Pts, dS, ind, NL, dLr, Rref, dXr, dY0r, dZ0r, VPbis - - - -@cython.cdivision(True) -@cython.wraparound(False) -@cython.boundscheck(False) -def _Ves_Smesh_Lin_SubFromInd_cython(double[::1] XMinMax, double dL, double dX, - double[:,::1] VPoly, np.ndarray[long,ndim=1] ind, - double DIn=0., VIn=None, double margin=_VSMALL): - " Return the desired surfacic submesh indicated by ind, for the desired resolution (dX,dL) " - cdef double dXr, dY0r, dZ0r - cdef int NX, NY0, NZ0, Ln, NR0, nii - cdef list LPts, LdS - cdef np.ndarray[double,ndim=2] Pts, PtsCross, VPbis - cdef np.ndarray[double,ndim=1] X, Y0, Z0, dS, dLr, Rref - cdef np.ndarray[long,ndim=1] indX, indY0, indZ0, indL, NL, ii - - # Get the mesh for the faces - Y0, dY0r, bla, NY0 = discretize_line1d(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=None, Lim=True, margin=margin) - Z0, dZ0r, bla, NZ0 = discretize_line1d(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=None, Lim=True, margin=margin) - - # Get the actual R and Z resolutions and mesh elements - X, dXr, bla, NX = discretize_line1d(XMinMax, dX, DL=None, Lim=True, margin=margin) - PtsCross, dLr, bla, NL, Rref, VPbis = discretize_vpoly(VPoly, dL, - D1=None, D2=None, - margin=margin, - DIn=DIn, VIn=VIn) - Ln = PtsCross.shape[1] - - LPts, LdS = [], [] - # First face - ii = (ind0: - indZ0 = ind[ii] // NY0 - indY0 = (ind[ii]-indZ0*NY0) - if nii==1: - LPts.append( np.array([[XMinMax[0]+DIn], [Y0[indY0]], [Z0[indZ0]]]) ) - else: - LPts.append( np.array([(XMinMax[0]+DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) ) - LdS.append( dY0r*dZ0r*np.ones((nii,)) ) - - # Cylinder - ii = ((ind>=NY0*NZ0) & (ind0: - indX = (ind[ii]-NY0*NZ0) // Ln - indL = (ind[ii]-NY0*NZ0 - Ln*indX) - if nii==1: - LPts.append( np.array([[X[indX]], [PtsCross[0,indL]], [PtsCross[1,indL]]]) ) - LdS.append( np.array([dXr*dLr[indL]]) ) - else: - LPts.append( np.array([X[indX], PtsCross[0,indL], PtsCross[1,indL]]) ) - LdS.append( dXr*dLr[indL] ) - - # End face - ii = (ind >= NY0*NZ0+NX*Ln).nonzero()[0].astype(np.long) - nii = len(ii) - if nii>0: - indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0 - indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0 - if nii==1: - LPts.append( np.array([[XMinMax[1]-DIn], [Y0[indY0]], [Z0[indZ0]]]) ) - else: - LPts.append( np.array([(XMinMax[1]-DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) ) - LdS.append( dY0r*dZ0r*np.ones((nii,)) ) - - # Format output - if len(LPts)==1: - Pts, dS = LPts[0], LdS[0] - else: - Pts = np.concatenate(tuple(LPts),axis=1) - dS = np.concatenate(tuple(LdS)) - - return Pts, dS, NL, dLr, Rref, dXr, dY0r, dZ0r, VPbis - - - - -""" -######################################################## -######################################################## -######################################################## -# LOS-specific -######################################################## -######################################################## -######################################################## -""" - - - - -######################################################## -######################################################## -# PIn POut -######################################################## - - -# ============================================================================= -# = Set of functions for Ray-tracing -# ============================================================================= -def LOS_Calc_PInOut_VesStruct(double[:, ::1] ray_orig, - double[:, ::1] ray_vdir, - double[:, ::1] ves_poly, - double[:, ::1] ves_norm, - long[::1] lstruct_nlim=None, - double[::1] ves_lims=None, - double[::1] lstruct_polyx=None, - double[::1] lstruct_polyy=None, - list lstruct_lims=None, - double[::1] lstruct_normx=None, - double[::1] lstruct_normy=None, - long[::1] lnvert=None, - int nstruct_tot=0, - int nstruct_lim=0, - double rmin=-1, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - bint forbid=1, bint test=1, int num_threads=16): - """ - Computes the entry and exit point of all provided LOS for the provided - vessel polygon (toroidal or linear) with its associated structures. - Return the normal vector at impact and the index of the impact segment - - Params - ====== - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the Vessel - ves_norm : (2, num_vertex-1) double array - Normal vectors going "inwards" of the edges of the Polygon defined - by ves_poly - nstruct : int - Total number of structures (counting each limited structure as one) - ves_lims : array - Contains the limits min and max of vessel - lstruct_poly : list - List of coordinates of the vertices of all structures on poloidal plane - lstruct_lims : list - List of limits of all structures - lstruct_nlim : array of ints - List of number of limits for all structures - lstruct_norm : list - List of coordinates of "inwards" normal vectors of the polygon of all - the structures - rmin : double - Minimal radius of vessel to take into consideration - eps_ : double - Small value, acceptance of error - vtype : string - Type of vessel ("Tor" or "Lin") - forbid : bool - Should we forbid values behind visible radius ? (see rmin) - test : bool - Should we run tests ? - num_threads : int - The num_threads argument indicates how many threads the team should - consist of. If not given, OpenMP will decide how many threads to use. - Typically this is the number of cores available on the machine. - Returns - ====== - coeff_inter_in : (nlos) array - scalars level of "in" intersection of the LOS (if k=0 at origin) - coeff_inter_out : (nlos) array - scalars level of "out" intersection of the LOS (if k=0 at origin) - vperp_out : (3, nlos) array - Coordinates of the normal vector of impact of the LOS (NaN if none) - ind_inter_out : (3, nlos) - Index of structure impacted by LOS: ind_inter_out[:,ind_los]=(i,j,k) - where k is the index of edge impacted on the j-th sub structure of the - structure number i. If the LOS impacted the vessel i=j=0 - """ - cdef str vt_lower = ves_type.lower() - cdef str error_message - cdef int sz_ves_lims - cdef int nlos = ray_orig.shape[1] - cdef int npts_poly = ves_norm.shape[1] - cdef bint bool1, bool2 - cdef double min_poly_r - cdef array vperp_out = clone(array('d'), nlos * 3, True) - cdef array coeff_inter_in = clone(array('d'), nlos, True) - cdef array coeff_inter_out = clone(array('d'), nlos, True) - cdef array ind_inter_out = clone(array('i'), nlos * 3, True) - # == Testing inputs ======================================================== - if test: - error_message = "ray_orig and ray_vdir must have the same shape: "\ - + "(3,) or (3,NL)!" - assert tuple(ray_orig.shape) == tuple(ray_vdir.shape) and \ - ray_orig.shape[0] == 3, error_message - error_message = "ves_poly and ves_norm must have the same shape (2,NS)!" - assert ves_poly.shape[0] == 2 and ves_norm.shape[0] == 2, error_message - bool1 = lstruct_lims is None or len(lstruct_normy) == len(lstruct_normy) - bool2 = lstruct_normx is None or len(lstruct_polyx) == len(lstruct_polyy) - error_message = "lstruct_poly, lstruct_lims, lstruct_norm must be None"\ - + " or lists of same len!" - assert bool1 and bool2, error_message - error_message = "[eps_uz,eps_vz,eps_a,eps_b] must be floats < 1.e-4!" - assert all([ee < 1.e-4 for ee in [eps_uz, eps_a, - eps_vz, eps_b, - eps_plane]]), error_message - error_message = "ves_type must be a str in ['Tor','Lin']!" - assert vt_lower in ['tor', 'lin'], error_message - error_message = "If you define structures you must define all the "\ - + "structural variables: \n"\ - + " - lstruct_polyx, lstruct_polyy, lstruct_lims,\n"\ - + " - lstruct_nlim, nstruct_tot, nstruct_lim,\n"\ - + " - lnvert, lstruct_normx, lstruct_normy\n" - bool1 = ((lstruct_polyx is not None) - or (lstruct_polyy is not None) - or (lstruct_normx is not None) - or (lstruct_normy is not None) - or (lstruct_nlim is not None) - or (lstruct_lims is not None) - or (lnvert is not None) - or (nstruct_tot > 0) or (nstruct_lim > 0)) - if bool1: - try: - bool1 = ((len(lstruct_polyx) > 0) - or (len(lstruct_polyy) > 0) - or (len(lstruct_normx) > 0) - or (len(lstruct_normy) > 0) - or (len(lstruct_nlim) > 0) - or (len(lstruct_lims) > 0) - or (len(lnvert) > 0) - or (nstruct_tot > 0) - or (nstruct_lim > 0)) - bool2 = ((len(lstruct_polyx) > 0) - and (len(lstruct_polyy) > 0) - and (len(lstruct_normx) > 0) - and (len(lstruct_normy) > 0) - and (len(lstruct_nlim) > 0) - and (len(lstruct_lims) > 0) - and (len(lnvert) > 0) - and (nstruct_tot > 0) - and (nstruct_lim > 0)) - assert (not bool1 or bool2), error_message - except Exception: - assert False, error_message - else: - bool2 = ((lstruct_polyx is not None) - and (lstruct_polyy is not None) - and (lstruct_normx is not None) - and (lstruct_normy is not None) - and (lstruct_nlim is not None) - and (lstruct_lims is not None) - and (lnvert is not None) - and (nstruct_tot > 0) and (nstruct_lim > 0)) - assert (not bool1 or bool2), error_message - # ========================================================================== - sz_ves_lims = np.size(ves_lims) - min_poly_r = _bgt.comp_min(ves_poly[0, ...], npts_poly-1) - _rt.compute_inout_tot(nlos, npts_poly, - ray_orig, ray_vdir, - ves_poly, ves_norm, - lstruct_nlim, ves_lims, - lstruct_polyx, lstruct_polyy, - lstruct_lims, lstruct_normx, - lstruct_normy, lnvert, - nstruct_tot, nstruct_lim, - sz_ves_lims, min_poly_r, rmin, - eps_uz, eps_a, eps_vz, eps_b, - eps_plane, vt_lower, - forbid, num_threads, - coeff_inter_out, coeff_inter_in, vperp_out, - ind_inter_out) - return np.asarray(coeff_inter_in), np.asarray(coeff_inter_out),\ - np.transpose(np.asarray(vperp_out).reshape(nlos,3)),\ - np.transpose(np.asarray(ind_inter_out, - dtype=int).reshape(nlos, 3)) - - -# ============================================================================= -# = Ray tracing when we only want kMin / kMax -# - (useful when working with flux surfaces) -# ============================================================================= -def LOS_Calc_kMinkMax_VesStruct(double[:, ::1] ray_orig, - double[:, ::1] ray_vdir, - list ves_poly, - list ves_norm, - int num_surf, - long[::1] lnvert, - double[::1] ves_lims=None, - double rmin=-1, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - bint forbid=1, bint test=1, int num_threads=16): - """ - Computes the entry and exit point of all provided LOS for the provided - polygons (toroidal or linear) of IN structures (non-solid, or `empty` - inside for the LOS). - Attention: the surfaces can be limited, but they all have to have the - same limits defined by (ves_lims) - Return the set of kmin / kmax for each In struct and for each LOS - - Params - ====== - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - num_surf : int - number of surfaxes, aka 'in' structures or 'vessels' - ves_poly : (num_surf, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the `in` structures - ves_norm : (num_surf, 2, num_vertex-1) double array - Normal vectors going "inwards" of the edges of the Polygon defined - by ves_poly - ves_lims : array - Contains the limits min and max of vessel - rmin : double - Minimal radius of vessel to take into consideration - eps : double - Small value, acceptance of error - vtype : string - Type of vessel ("Tor" or "Lin") - forbid : bool - Should we forbid values behind visible radius ? (see rmin) - test : bool - Should we run tests ? - num_threads : int - The num_threads argument indicates how many threads the team should - consist of. If not given, OpenMP will decide how many threads to use. - Typically this is the number of cores available on the machine. - Return - ====== - coeff_inter_in : (num_surf, nlos) array - scalars level of "in" intersection of the LOS (if k=0 at origin) for - each surface - [kmin(surf0, los0), kmin(surf0, los1), ..., kmin(surf1, los0),....] - coeff_inter_out : (num_surf, nlos) array - scalars level of "out" intersection of the LOS (if k=0 at origin) for - each surface - [kmax(surf0, los0), kmax(surf0, los1), ..., kmax(surf1, los0),....] - """ - cdef int npts_poly - cdef int nlos = ray_orig.shape[1] - cdef int ind_struct = 0 - cdef int ind_surf - cdef double crit2_base = eps_uz * eps_uz /400. - cdef double lim_min = 0. - cdef double lim_max = 0. - cdef double rmin2 = 0. - cdef str error_message - cdef bint forbidbis, forbid0 - cdef bint bool1, bool2 - cdef array coeff_inter_in = clone(array('d'), nlos * num_surf, True) - cdef array coeff_inter_out = clone(array('d'), nlos * num_surf, True) - cdef int *llimits = NULL - cdef long *lsz_lim = NULL - cdef bint are_limited - cdef double[2] lbounds_ves - cdef double[2] lim_ves - cdef double[:,::1] tmp_poly - cdef double[:,::1] tmp_norm - cdef double* ptr_coeff_in - cdef double* ptr_coeff_out - - # initializations ... - ptr_coeff_in = coeff_inter_in.data.as_doubles - ptr_coeff_out = coeff_inter_out.data.as_doubles - - # == Testing inputs ======================================================== - if test: - error_message = "ray_orig and ray_vdir must have the same shape: "\ - + "(3,) or (3,NL)!" - assert tuple(ray_orig.shape) == tuple(ray_vdir.shape) and \ - ray_orig.shape[0] == 3, error_message - error_message = "[eps_uz,eps_vz,eps_a,eps_b] must be floats < 1.e-4!" - assert all([ee < 1.e-4 for ee in [eps_uz, eps_a, - eps_vz, eps_b, - eps_plane]]), error_message - error_message = "ves_type must be a str in ['Tor','Lin']!" - assert ves_type.lower() in ['tor', 'lin'], error_message - - # ========================================================================== - if ves_type.lower() == 'tor': - # .. if there are, we get the limits for the vessel .................... - if ves_lims is None or np.size(ves_lims) == 0: - are_limited = False - lbounds_ves[0] = 0 - lbounds_ves[1] = 0 - else: - are_limited = True - lbounds_ves[0] = Catan2(Csin(ves_lims[0]), Ccos(ves_lims[0])) - lbounds_ves[1] = Catan2(Csin(ves_lims[1]), Ccos(ves_lims[1])) - # -- Toroidal case ----------------------------------------------------- - for ind_surf in range(num_surf): - # rmin is necessary to avoid looking on the other side of the tok - if rmin < 0.: - rmin = 0.95*min(np.min(ves_poly[ind_surf][0, ...]), - _bgt.comp_min_hypot(ray_orig[0, ...], - ray_orig[1, ...], - nlos)) - rmin2 = rmin*rmin - # Variable to avoid looking "behind" blind spot of tore - if forbid: - forbid0, forbidbis = 1, 1 - else: - forbid0, forbidbis = 0, 0 - # Getting size of poly - npts_poly = lnvert[ind_surf] - tmp_poly = ves_poly[ind_surf] - tmp_norm = ves_norm[ind_surf] - # -- Computing intersection between LOS and Vessel ----------------- - _rt.raytracing_minmax_struct_tor(nlos, ray_vdir, ray_orig, - &ptr_coeff_out[ind_surf*nlos], - &ptr_coeff_in[ind_surf*nlos], - forbid0, forbidbis, - rmin, rmin2, crit2_base, - npts_poly, lbounds_ves, - are_limited, - &tmp_poly[0][0], - &tmp_poly[1][0], - &tmp_norm[0][0], - &tmp_norm[1][0], - eps_uz, eps_vz, eps_a, - eps_b, eps_plane, - num_threads) - else: - # .. if there are, we get the limits for the vessel .................... - if ves_lims is None or np.size(ves_lims) == 0: - are_limited = False - lbounds_ves[0] = 0 - lbounds_ves[1] = 0 - else: - are_limited = True - lbounds_ves[0] = ves_lims[0] - lbounds_ves[1] = ves_lims[1] - - # -- Cylindrical case -------------------------------------------------- - for ind_surf in range(num_surf): - # Getting size of poly - npts_poly = lnvert[ind_surf] - tmp_poly = ves_poly[ind_surf] - tmp_norm = ves_norm[ind_surf] - _rt.raytracing_minmax_struct_lin(nlos, ray_orig, ray_vdir, - npts_poly, - &tmp_poly[0][0], - &tmp_poly[1][0], - &tmp_norm[0][0], - &tmp_norm[1][0], - lbounds_ves[0], lbounds_ves[1], - &ptr_coeff_out[ind_surf*nlos], - &ptr_coeff_in[ind_surf*nlos], - eps_plane) - - return np.asarray(coeff_inter_in), np.asarray(coeff_inter_out) - - -def LOS_areVis_PtsFromPts_VesStruct(np.ndarray[double, ndim=2,mode='c'] pts1, - np.ndarray[double, ndim=2,mode='c'] pts2, - double[:, ::1] ves_poly=None, - double[:, ::1] ves_norm=None, - double[::1] k=None, - double[:, ::1] ray_orig=None, - double[:, ::1] ray_vdir=None, - double[::1] ves_lims=None, - long[::1] lstruct_nlim=None, - double[::1] lstruct_polyx=None, - double[::1] lstruct_polyy=None, - list lstruct_lims=None, - double[::1] lstruct_normx=None, - double[::1] lstruct_normy=None, - long[::1] lnvert=None, - int nstruct_tot=0, - int nstruct_lim=0, - double rmin=-1, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, - str ves_type='tor', - bint forbid=True, - bint test=True, - int num_threads=16): - """ - Return an array of booleans indicating whether each point in pts is - visible from the point P = [pt0, pt1, pt2] considering vignetting a given - configuration. - `k` optional argument : distance between points and P - ray_orig = np.tile(np.r_[pt0,pt1,pt2], (npts,1)).T - ray_vdir = (pts-ray_orig)/k - """ - cdef str msg - cdef int npts1=pts1.shape[1] - cdef int npts2=pts2.shape[1] - cdef bint bool1, bool2 - cdef np.ndarray[double, ndim=2, mode='c'] ind = np.empty((npts1, npts2), - dtype=float) - # == Testing inputs ======================================================== - if test: - msg = "ves_poly and ves_norm are not optional arguments" - assert ves_poly is not None and ves_norm is not None, msg - bool1 = (ves_poly.shape[0]==2 and ves_norm.shape[0]==2 - and ves_norm.shape[1]==ves_poly.shape[1]-1) - msg = "Args ves_poly and ves_norm must be of the same shape (2,NS)!" - assert bool1, msg - bool1 = lstruct_lims is None or len(lstruct_normy) == len(lstruct_normx) - bool2 = lstruct_normx is None or len(lstruct_polyx) == len(lstruct_polyy) - msg = "Args lstruct_polyx, lstruct_polyy, lstruct_lims, lstruct_normx,"\ - + " lstruct_normy, must be None or lists of same len()!" - assert bool1 and bool2, msg - msg = "[eps_uz,eps_vz,eps_a,eps_b] must be floats < 1.e-4!" - assert all([ee < 1.e-4 for ee in [eps_uz, eps_a, - eps_vz, eps_b, - eps_plane]]), msg - msg = "ves_type must be a str in ['Tor','Lin']!" - assert ves_type.lower() in ['tor', 'lin'], msg - - _rt.are_visible_vec_vec(pts1, npts1, - pts2, npts2, - ves_poly, ves_norm, - ind, k, ves_lims, - lstruct_nlim, - lstruct_polyx, lstruct_polyy, - lstruct_lims, - lstruct_normx, lstruct_normy, - lnvert, nstruct_tot, nstruct_lim, - rmin, eps_uz, eps_a, eps_vz, eps_b, - eps_plane, ves_type.lower(), - forbid, test, num_threads) - return ind - - -def LOS_isVis_PtFromPts_VesStruct(double pt0, double pt1, double pt2, - np.ndarray[double, ndim=2,mode='c'] pts, - double[:, ::1] ves_poly=None, - double[:, ::1] ves_norm=None, - double[::1] k=None, - double[::1] ves_lims=None, - long[::1] lstruct_nlim=None, - double[::1] lstruct_polyx=None, - double[::1] lstruct_polyy=None, - list lstruct_lims=None, - double[::1] lstruct_normx=None, - double[::1] lstruct_normy=None, - long[::1] lnvert=None, - int nstruct_tot=0, - int nstruct_lim=0, - double rmin=-1, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - bint forbid=True, - bint test=True, - int num_threads=16): - """ - Return an array of booleans indicating whether each point in pts is - visible from the point P = [pt0, pt1, pt2] considering vignetting a given - configuration. - `k` optional argument : distance between points and P - ray_orig = np.tile(np.r_[pt0,pt1,pt2], (npts,1)).T - ray_vdir = (pts-ray_orig)/k - """ - cdef str msg - cdef int npts=pts.shape[1] - cdef bint bool1, bool2 - cdef np.ndarray[double, ndim=1, mode='c'] ind = np.empty((npts), - dtype=float) - # == Testing inputs ======================================================== - if test: - msg = "ves_poly and ves_norm are not optional arguments" - assert ves_poly is not None and ves_norm is not None, msg - bool1 = (ves_poly.shape[0]==2 and ves_norm.shape[0]==2 - and ves_norm.shape[1]==ves_poly.shape[1]-1) - msg = "Args ves_poly and ves_norm must be of the same shape (2,NS)!" - assert bool1, msg - bool1 = lstruct_lims is None or len(lstruct_normy) == len(lstruct_normx) - bool2 = lstruct_normx is None or len(lstruct_polyx) == len(lstruct_polyy) - msg = "Args lstruct_polyx, lstruct_polyy, lstruct_lims, lstruct_normx,"\ - + " lstruct_normy, must be None or lists of same len()!" - assert bool1 and bool2, msg - msg = "[eps_uz,eps_vz,eps_a,eps_b] must be floats < 1.e-4!" - assert all([ee < 1.e-4 for ee in [eps_uz, eps_a, - eps_vz, eps_b, - eps_plane]]), msg - msg = "ves_type must be a str in ['Tor','Lin']!" - assert ves_type.lower() in ['tor', 'lin'], msg - # ... - _rt.is_visible_pt_vec(pt0, pt1, pt2, - pts, npts, - ves_poly, ves_norm, - ind, k, ves_lims, - lstruct_nlim, - lstruct_polyx, lstruct_polyy, - lstruct_lims, - lstruct_normx, lstruct_normy, - lnvert, nstruct_tot, nstruct_lim, - rmin, eps_uz, eps_a, eps_vz, eps_b, - eps_plane, ves_type.lower(), - forbid, test, num_threads) - return ind - -# ============================================================================== -# -# VIGNETTING -# -# ============================================================================== -def triangulate_by_earclipping(np.ndarray[double,ndim=2] poly): - cdef int nvert = poly.shape[1] - cdef np.ndarray[long,ndim=1] ltri = np.empty((nvert-2)*3, dtype=int) - cdef double* diff = NULL - cdef bint* lref = NULL - # Initialization ........................................................... - diff = malloc(3*nvert*sizeof(double)) - lref = malloc(nvert*sizeof(bint)) - _vt.compute_diff3d(&poly[0,0], nvert, diff) - _vt.are_points_reflex(nvert, diff, lref) - # Calling core function..................................................... - _vt.earclipping_poly(&poly[0,0], <ri[0], diff, lref, nvert) - free(diff) - free(lref) - return ltri - -def vignetting(double[:, ::1] ray_orig, - double[:, ::1] ray_vdir, - list vignett_poly, - long[::1] lnvert, - int num_threads=16): - """ - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - vignett_poly : (num_vign, 3, num_vertex) double list of arrays - Coordinates of the vertices of the Polygon defining the 3D vignett. - POLY CLOSED - lnvert : (num_vign) long array - Number of vertices for each vignett (without counting the rebound) - Returns - ====== - goes_through: (num_vign, nlos) bool array - Indicates for each vignett if each LOS wents through or not - """ - cdef int ii - cdef int nvign, nlos - cdef np.ndarray[np.uint8_t,ndim=1,cast=True] goes_through - cdef long** ltri = NULL - cdef double* lbounds = NULL - cdef double** data = NULL - cdef bint* bool_res = NULL - cdef np.ndarray[double, ndim=2, mode="c"] temp - # -- Initialization -------------------------------------------------------- - nvign = len(vignett_poly) - nlos = ray_orig.shape[1] - goes_through = np.empty((nlos*nvign),dtype=bool) - # re writting vignett_poly to C type: - data = malloc(nvign*sizeof(double *)) - for ii in range(nvign): - temp = vignett_poly[ii] - data[ii] = &temp[0,0] - # -- Preparation ----------------------------------------------------------- - lbounds = malloc(sizeof(double) * 6 * nvign) - _rt.compute_3d_bboxes(data, &lnvert[0], nvign, &lbounds[0], - num_threads=num_threads) - ltri = malloc(sizeof(long*)*nvign) - _vt.triangulate_polys(data, &lnvert[0], nvign, ltri, - num_threads) - # -- We call core function ------------------------------------------------- - bool_res = malloc(nlos*nvign*sizeof(bint)) - _vt.vignetting_core(ray_orig, ray_vdir, data, &lnvert[0], &lbounds[0], - ltri, nvign, nlos, &bool_res[0],num_threads) - for ii in range(nlos*nvign): - goes_through[ii] = bool_res[ii] - # -- Cleaning up ----------------------------------------------------------- - free(bool_res) - free(lbounds) - # We have to free each array for each vignett: - for ii in range(nvign): - free(ltri[ii]) - free(ltri) # and now we can free the main pointer - free(data) - return goes_through - - -# ============================================================================== -# -# LOS SAMPLING -# -# ============================================================================== -def LOS_get_sample(int nlos, dL, double[:,::1] los_lims, str dmethod='abs', - str method='sum', bint Test=True, int num_threads=16): - """ - Return the sampled line, with the specified method - - 'sum' : return N segments centers - - 'simps': return N+1 egdes, N even (for scipy.integrate.simps) - - 'romb' : return N+1 edges, N+1 = 2**k+1 (for scipy.integrate.romb) - The dmethod defines if the discretization step given is absolute ('abs') - or relative ('rel') - Params - ====== - dL: double or list of doubles - If dL is a single double: discretization step for all LOS. - Else dL should be a list of size nlos with the discretization - step for each nlos. - los_lims: (2, nlos) double array - For each nlos, it given the maximum and minimum limits of the ray - dmethod: string - type of discretization step: 'abs' for absolute or 'rel' for relative - method: string - method of quadrature on the LOS - Test: bool - to indicate if tests should be done or not - - How to recompute Points coordinates from results - ------- - k, res, lind = Los_get_sample(...) - nbrepet = np.r_[lind[0], np.diff(lind), k.size - lind[-1]] - kus = k * np.repeat(ray_vdir, nbrepet, axis=1) - Pts = np.repeat(ray_orig, nbrepet, axis=1) + kus - """ - cdef str error_message - cdef str dmode = dmethod.lower() - cdef str imode = method.lower() - cdef int sz1_dls, sz2_dls - cdef int sz_coeff - cdef int n_imode, n_dmode - cdef bint dl_is_list - cdef bint bool1, bool2 - cdef double[::1] dl_view - cdef np.ndarray[double,ndim=1] dLr - cdef np.ndarray[double,ndim=1] coeff_arr - cdef np.ndarray[long,ndim=1] los_ind - cdef long* tmp_arr - cdef double* los_coeffs = NULL - cdef double** coeff_ptr = NULL - cdef long* los_ind_ptr = NULL - # .. ray_orig shape needed for testing and in algo ......................... - dLr = np.zeros((nlos,), dtype=float) - los_ind = np.zeros((nlos,), dtype=int) - dl_is_list = hasattr(dL, '__iter__') - # .. verifying arguments ................................................... - if Test: - sz1_dls = los_lims.shape[0] - sz2_dls = los_lims.shape[1] - assert sz1_dls == 2, "Dim 0 of arg los_lims should be 2" - error_message = "Args los_lims should have dim 1 = nlos" - assert nlos == sz2_dls, error_message - bool1 = not dl_is_list and dL > 0. - bool2 = dl_is_list and len(dL)==nlos and np.all(dL>0.) - assert bool1 or bool2, "Arg dL must be a double or a List, and dL >0.!" - error_message = "Argument dmethod (discretization method) should be in"\ - +" ['abs','rel'], for absolute or relative." - assert dmode in ['abs','rel'], error_message - error_message = "Wrong method of integration." \ - + " Options are: ['sum','simps','romb', 'linspace']" - assert imode in ['sum','simps','romb','linspace'], error_message - # Init - coeff_ptr = malloc(sizeof(double*)) - los_ind_ptr = malloc(nlos*sizeof(long)) - coeff_ptr[0] = NULL - # Getting number of modes: - n_dmode = _st.get_nb_dmode(dmode) - n_imode = _st.get_nb_imode(imode) - # -- Core functions -------------------------------------------------------- - if not dl_is_list: - # Case with unique discretization step dL - sz_coeff = _st.los_get_sample_core_const_res(nlos, - &los_lims[0,0], - &los_lims[1,0], - n_dmode, n_imode, - dL, - &coeff_ptr[0], - &dLr[0], - &los_ind_ptr[0], - num_threads) - else: - # Case with different resolution for each LOS - dl_view=dL - _st.los_get_sample_core_var_res(nlos, - &los_lims[0,0], - &los_lims[1,0], - n_dmode, n_imode, - &dl_view[0], - &coeff_ptr[0], - &dLr[0], - &los_ind_ptr[0], - num_threads) - sz_coeff = los_ind_ptr[nlos-1] - coeffs = np.copy(np.asarray(coeff_ptr[0])) - indices = np.copy(np.asarray(los_ind_ptr).astype(int)) - # -- freeing ----------------------------------------------------------- - if not los_ind_ptr == NULL: - free(los_ind_ptr) - if not coeff_ptr == NULL: - if not coeff_ptr[0] == NULL: - free(coeff_ptr[0]) - free(coeff_ptr) - return coeffs, dLr, indices[:nlos-1] - - - -###################################################################### -# Signal calculation -###################################################################### -cdef get_insp(ff): - out = insp(ff) - if sys.version[0]=='3': - pars = out.parameters.values() - na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD - and pp.default is pp.empty) for pp in pars]) - kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD - and pp.default is not pp.empty)] - else: - nat, nak = len(out.args), len(out.defaults) - na = nat-nak - kw = [out.args[ii] for ii in range(nat-1,na-1,-1)][::-1] - return na, kw - - - -def check_ff(ff, t=None, Ani=None, bool Vuniq=False): - cdef bool ani - cdef int nt = -1 - # ... - stre = "Input emissivity function (ff)" - assert hasattr(ff,'__call__'), stre+" must be a callable (function)!" - na, kw = get_insp(ff) - assert na==1, stre+" must take only one positional argument: ff(Pts)!" - assert 't' in kw, stre+" must have kwarg 't=None' for time vector!" - C = type(t) in [int,float,np.int64,np.float64] or hasattr(t,'__iter__') - assert t is None or C, "Arg t must be None, a scalar or an iterable!" - Pts = np.array([[1,2],[3,4],[5,6]]) - NP = Pts.shape[1] - try: - out = ff(Pts, t=t) - except Exception: - Str = stre+" must take one positional arg: a (3,N) np.ndarray" - assert False, Str - if hasattr(t,'__iter__'): - nt = len(t) - Str = ("ff(Pts,t=t), where Pts is a (3,N) np.array and " - +"t a len()=nt iterable, must return a (nt,N) np.ndarray!") - assert type(out) is np.ndarray and out.shape==(nt,NP), Str - else: - Str = ("When fed a (3,N) np.array only, or if t is a scalar," - +" ff must return a (N,) np.ndarray!") - assert type(out) is np.ndarray and out.shape==(NP,), Str - - ani = ('Vect' in kw) if Ani is None else Ani - if ani: - Str = "If Ani=True, ff must take a keyword argument 'Vect=None'!" - assert 'Vect' in kw, Str - Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape) - try: - out = ff(Pts, Vect=Vect, t=t) - except Exception: - Str = "If Ani=True, ff must handle multiple points Pts (3,N) with " - if Vuniq: - Str += "a unique common vector (Vect as a len()=3 iterable)" - else: - Str += "multiple vectors (Vect as a (3,N) np.ndarray)" - assert False, Str - if hasattr(t,'__iter__'): - Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when " - +"Pts is (3,N), Vect is provided and t is (nt,)") - assert type(out) is np.ndarray and out.shape==(nt,NP), Str - else: - Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when " - +"Pts is (3,N), Vect is provided and t is (nt,)") - assert type(out) is np.ndarray and out.shape==(NP,), Str - return ani - - -def integrate1d(y, double dx, t=None, str method='sum'): - """ Generic integration method ['sum','simps','romb'] - - Not used internally - Useful when the sampling points need to be interpolated via equilibrium - """ - cdef unsigned int nt, axm - if t is None or not hasattr(t,'__iter__'): - nt = 1 - axm = 0 - else: - nt = len(t) - axm = 1 - ind = np.isnan(y) - if np.any(ind): - y = y.copy() - y[ind] = 0. - - cdef np.ndarray[double,ndim=1] s = np.empty((nt,),dtype=float) - - if method=='sum': - s = np.sum(y, axis=axm)*dx - elif method=='simps': - s = scpintg.simps(y, x=None, dx=dx, axis=axm) - elif method=='romb': - s = scpintg.romb(y, dx=dx, axis=axm, show=False) - else: - raise Exception("Arg method must be in ['sum','simps','romb']") - return s - - -def LOS_calc_signal(func, double[:,::1] ray_orig, double[:,::1] ray_vdir, res, - double[:,::1] lims, str dmethod='abs', - str method='sum', bint ani=False, - t=None, fkwdargs={}, str minimize='calls', - bint Test=True, int num_threads=16): - """ Compute the synthetic signal, minimizing either function calls or memory - Params - ===== - func : python function st. func(pts, t=None, vect=None) => data - with pts : ndarray (3, npts) - points where function is evaluated - vect : ndarray(3, npts) - if anisotropic signal vector of emiss. - t: ndarray(m) - times where to compute the function - returns: data : ndarray(nt,nraf) if nt = 1, the array must be 2D - values of func at pts, at given time - func is the function to be integrated along the LOS - ray_orig: ndarray (3, nlos) LOS origins - ray_vdir: ndarray (3, nlos) LOS directional vector - res: double or list of doubles - If res is a single double: discretization step for all LOS. - Else res should be a list of size nlos with the discretization - step for each nlos. - lims: (2, nlos) double array - For each nlos, it given the maximum and minimum limits of the ray - dmethod: string - type of discretization step: 'abs' for absolute or 'rel' for relative - method: string - method of quadrature on the LOS - ani : bool - to indicate if emission is anisotropic or not - t : None or array-like - times where to integrate - minimize: string - "calls" : we use algorithm to minimize the calls to 'func' (default) - "memory": we use algorithm to minimize memory used - "hybrid": a mix of both methods - Test : bool - we test if the inputs are giving in a proper way. - num_threads: int - number of threads if we want to parallelize the code. - """ - cdef str error_message - cdef str dmode = dmethod.lower() - cdef str imode = method.lower() - cdef str minim = minimize.lower() - cdef int jjp1 - cdef int sz1_ds - cdef int sz1_us, sz2_us - cdef int sz1_dls, sz2_dls - cdef int n_imode, n_dmode - cdef bint res_is_list - cdef bint C0, C1 - cdef list ltime - cdef double loc_r - cdef unsigned int nlos - cdef unsigned int nt=0, ii, jj - cdef long[1] nb_rows - cdef long[::1] indbis - cdef double[1] loc_eff_res - cdef double[::1] reseff_mv - cdef double[::1] res_mv - cdef double[::1,:] sig_mv - cdef double[:,::1] val_mv - cdef double[:,::1] pts_mv - cdef double[:,::1] usbis_mv - cdef double[:,::1] val_2d - cdef np.ndarray[double,ndim=2] usbis - cdef np.ndarray[double,ndim=2] pts - cdef np.ndarray[double,ndim=2, mode='fortran'] sig - cdef np.ndarray[double,ndim=1] reseff - cdef np.ndarray[double,ndim=1] k - cdef np.ndarray[double,ndim=1] res_arr - cdef np.ndarray[long,ndim=1] ind - cdef long* ind_arr = NULL - cdef double* reseff_arr = NULL - cdef double** coeff_ptr = NULL - # .. ray_orig shape needed for testing and in algo ............................... - sz1_ds = ray_orig.shape[0] - nlos = ray_orig.shape[1] - res_is_list = hasattr(res, '__iter__') - # .. verifying arguments ................................................... - if Test: - sz1_us = ray_vdir.shape[0] - sz2_us = ray_vdir.shape[1] - sz1_dls = lims.shape[0] - sz2_dls = lims.shape[1] - assert sz1_ds == 3, "Dim 0 of arg ray_orig should be 3" - assert sz1_us == 3, "Dim 0 of arg ray_vdir should be 3" - assert sz1_dls == 2, "Dim 0 of arg lims should be 2" - error_message = "Args ray_orig, ray_vdir, lims should have same dimension 1" - assert nlos == sz2_us == sz2_dls, error_message - C0 = not res_is_list and res > 0. - C1 = res_is_list and len(res)==nlos and np.all(res>0.) - assert C0 or C1, "Arg res must be a double or a List, and all res >0.!" - error_message = "Argument dmethod (discretization method) should be in"\ - +" ['abs','rel'], for absolute or relative." - assert dmode in ['abs','rel'], error_message - error_message = "Wrong method of integration." \ - + " Options are: ['sum','simps','romb']" - assert imode in ['sum','simps','romb'], error_message - error_message = "Wrong minimize optimization."\ - + " Options are: ['calls','memory','hybrid']" - assert minim in ['calls','memory','hybrid'], error_message - # -- Preformat output signal ----------------------------------------------- - if t is None: - if minim == 'memory': - minim = 'calls' - error_message = "If t is None !" - error_message += " => there is no point in using minimize='memory'" - error_message += " => switching to minimize = '%s'"%minim - warn(error_message) - nt = 1 - ltime = [None] - elif not hasattr(t,'__iter__'): - nt = 1 - ltime = [t] - else: - nt = len(t) - if isinstance(t, list): - ltime = t - else: - ltime = t.tolist() - # -- Inizializations ------------------------------------------------------- - # Getting number of modes: - n_dmode = _st.get_nb_dmode(dmode) - n_imode = _st.get_nb_imode(imode) - # Initialization result - sig = np.empty((nt,nlos),dtype=float,order='F') - sig_mv = sig - # If the resolution is the same for every LOS, we create a tab - if res_is_list : - res_arr = np.asarray(res) - else: - res_arr = np.ones((nlos,), dtype=float) * res - res_mv = res_arr - # -------------------------------------------------------------------------- - # Minimize function calls: sample (vect), call (once) and integrate - if minim == 'calls': - if not method=='sum': - # Discretize all LOS - k, reseff, ind = LOS_get_sample(nlos, res_arr, lims, - dmethod=dmode, method=imode, - num_threads=num_threads, Test=Test) - nbrep = np.r_[ind[0], np.diff(ind), k.size - ind[nlos-2]] - # get pts and values - usbis = np.repeat(ray_vdir, nbrep, axis=1) - pts = np.repeat(ray_orig, nbrep, axis=1) + k[None,:]*usbis - # memory view: - reseff_mv = reseff - indbis = np.concatenate(([0],ind,[k.size])) - else: - coeff_ptr = malloc(sizeof(double*)) - coeff_ptr[0] = NULL - reseff_arr = malloc(nlos*sizeof(double)) - ind_arr = malloc(nlos*sizeof(long)) - # we sample lines of sight - _st.los_get_sample_core_var_res(nlos, - &lims[0,0], - &lims[1,0], - n_dmode, n_imode, - &res_arr[0], - &coeff_ptr[0], - &reseff_arr[0], - &ind_arr[0], - num_threads) - sz_coeff = ind_arr[nlos-1] - pts = np.empty((3,sz_coeff)) - usbis = np.empty((3,sz_coeff)) - usbis_mv = usbis - pts_mv = pts - _st.los_get_sample_pts(nlos, - &pts_mv[0,0], - &pts_mv[1,0], - &pts_mv[2,0], - &usbis_mv[0,0], - &usbis_mv[1,0], - &usbis_mv[2,0], - ray_orig, ray_vdir, - coeff_ptr[0], - ind_arr, - num_threads) - if ani: - val_2d = func(pts, t=t, vect=-usbis, **fkwdargs) - else: - val_2d = func(pts, t=t, **fkwdargs) - # Integrate - if method=='sum': - # # .. original version ..................................... - # indbis = np.concatenate(([0],ind,[k.size])) - # for ii in range(1,nlos): - # sig[:,ii] = np.sum(val_2d[:,indbis[ii]:indbis[ii+1]], - # axis=-1)*reseff_mv[ii] - # # .......................................................... - # Calling integration function - _st.integrate_sum_nlos(nlos, nt, - val_2d, - sig_mv, - ind_arr, - reseff_arr, - num_threads) - # Cleaning up... - free(coeff_ptr[0]) - free(coeff_ptr) - free(reseff_arr) - free(ind_arr) - elif method=='simps': - for ii in range(nlos): - jj = indbis[ii] - jjp1 = indbis[ii+1] - val_mv = val_2d[:,jj:jjp1] - loc_r = reseff_mv[ii] - sig[:,ii] = scpintg.simps(val_mv, - x=None, dx=loc_r, axis=-1) - else: - for ii in range(nlos): - sig[:,ii] = scpintg.romb(val_2d[:,indbis[ii]:indbis[ii+1]], - dx=reseff_mv[ii], axis=1, show=False) - # -------------------------------------------------------------------------- - # Minimize memory use: loop everything, starting with LOS - # then pts then time - elif minim == 'memory': - # loop over LOS and parallelize - if ani: - if n_imode == 0: - for ii in range(nlos): - pts, usbis = _st.call_get_sample_single_ani(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - # loop over time for calling and integrating - for jj in range(nt): - val = func(pts, t=ltime[jj], vect=-usbis, **fkwdargs) - sig[jj, ii] = np.sum(val)*loc_eff_res[0] - elif n_imode == 1: - for ii in range(nlos): - pts, usbis = _st.call_get_sample_single_ani(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - # loop over time for calling and integrating - for jj in range(nt): - val = func(pts, t=ltime[jj], vect=-usbis, **fkwdargs) - sig[jj, ii] = scpintg.simps(val, x=None, - dx=loc_eff_res[0]) - elif n_imode == 2: - for ii in range(nlos): - pts, usbis = _st.call_get_sample_single_ani(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - # loop over time for calling and integrating - for jj in range(nt): - val = func(pts, t=ltime[jj], vect=-usbis, **fkwdargs) - sig[jj, ii] = scpintg.romb(val, show=False, - dx=loc_eff_res[0]) - else: - # -- not anisotropic ------------------------------------------------------ - if n_imode == 0: - for ii in range(nlos): - pts = _st.call_get_sample_single(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - # loop over time for calling and integrating - for jj in range(nt): - val = func(pts, t=ltime[jj], **fkwdargs) - sig[jj, ii] = np.sum(val)*loc_eff_res[0] - elif n_imode == 1: - for ii in range(nlos): - pts = _st.call_get_sample_single(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - # loop over time for calling and integrating - for jj in range(nt): - val = func(pts, t=ltime[jj], **fkwdargs) - sig[jj, ii] = scpintg.simps(val, x=None, - dx=loc_eff_res[0]) - elif n_imode == 2: - for ii in range(nlos): - pts = _st.call_get_sample_single(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - # loop over time for calling and integrating - for jj in range(nt): - val = func(pts, t=ltime[jj], **fkwdargs) - sig[jj, ii] = scpintg.romb(val, show=False, - dx=loc_eff_res[0]) - # -------------------------------------------------------------------------- - # HYBRID method: Minimize memory and calls (compromise): loop everything, - # starting with LOS, call func only once for each los (treat all times) - # loop over time for integrals - else: - # loop over LOS - if ani: - if n_imode == 0: - print("about to use new method") - for ii in range(nlos): - pts, usbis = _st.call_get_sample_single_ani(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - val_2d = func(pts, t=t, vect=-usbis, **fkwdargs) - # this is almost always the quickest solution... but can - # probably be better. We'll investigate some time - # how to make it faster, and for the time being we leave - # the numpy alternative commented - _st.integrate_c_sum_mat(val_2d, &sig_mv[0,ii], nt, - nb_rows[0], - loc_eff_res[0], num_threads) - # sig_mv[:, ii] = np.sum(val, axis=-1)*loc_eff_res[0] - elif n_imode == 1: - for ii in range(nlos): - pts, usbis = _st.call_get_sample_single_ani(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - val = func(pts, t=t, vect=-usbis, **fkwdargs) - # integration - sig[:, ii] = scpintg.simps(val, x=None, axis=-1, - dx=loc_eff_res[0]) - elif n_imode == 2: - for ii in range(nlos): - pts, usbis = _st.call_get_sample_single_ani(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - val = func(pts, t=t, vect=-usbis, **fkwdargs) - sig[:, ii] = scpintg.romb(val, show=False, axis=1, - dx=loc_eff_res[0]) - else: - # -- not anisotropic ------------------------------------------------------ - if n_imode == 0: - for ii in range(nlos): - pts = _st.call_get_sample_single(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - val_2d = func(pts, t=t, **fkwdargs) - # this is almost always the quickest solution... but can - # probably be better. We'll investigate some time - # how to make it faster, and for the time being we leave - # the numpy alternative commented - _st.integrate_c_sum_mat(val_2d, &sig_mv[0,ii], - nt, nb_rows[0], - loc_eff_res[0], num_threads) - # sig[:, ii] = np.sum(val,axis=-1)*loc_eff_res[0] - elif n_imode == 1: - for ii in range(nlos): - pts = _st.call_get_sample_single(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - val = func(pts, t=t, **fkwdargs) - sig[:, ii] = scpintg.simps(val, x=None, axis=-1, - dx=loc_eff_res[0]) - elif n_imode == 2: - for ii in range(nlos): - pts = _st.call_get_sample_single(lims[0,0], lims[1,0], - res_mv[ii], - n_dmode, n_imode, - &loc_eff_res[0], - &nb_rows[0], - ray_orig[:,ii:ii+1], - ray_vdir[:,ii:ii+1]) - val = func(pts, t=t, **fkwdargs) - sig[:, ii] = scpintg.romb(val, show=False, axis=1, - dx=loc_eff_res[0]) - return sig - - -###################################################################### -# Sinogram-specific -###################################################################### - - -def LOS_sino_findRootkPMin_Tor(double uParN, double uN, double Sca, double RZ0, - double RZ1, double ScaP, double DParN, - double kOut, double D0, double D1, double D2, - double u0, double u1, double u2, str Mode='LOS'): - """ - Rendre "vectoriel" sur LOS et sur les cercles (deux boucles "for") - intersection ligne et cercle - double uParN : composante de u parallel au plan (x,y) - double uN : uz - double Sca : ??? produit scalaire ... ? - double RZ0 : Grand rayon du cercle - double RZ1 : Z - => cercle est centré au point (0, 0, RZ1) et rayon RZ0 - double ScaP : .... ? - double DParN : D origine de LOS.... ? N => norme de la composante du vecteur OD - double kOut : kmax où on peut trouver un résultat - double D0, double D1, double D2 : composantes de D (origine LOS) - double u0, double u1, double u2 : composantes de U (direction LOS) - str Mode='LOS' : si LOS pas de sol après kmax) - ::: Faire une fonction double mais qui renvoit QUE un tableau de bool avec true si - la distance est plus petite qu'un certain eps, false sinon. - TODO: ........... @LM - """ - cdef double a4 = (uParN*uN*uN)**2, a3 = 2*( (Sca-RZ1*u2)*(uParN*uN)**2 + ScaP*uN**4 ) - cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2 - cdef double a1 = 2*( ScaP*(Sca-RZ1*u2)**2 + (Sca-RZ1*u2)*(DParN*uN)**2 - ScaP*(RZ0*uParN)**2 ) - cdef double a0 = ((Sca-RZ1*u2)*DParN)**2 - (RZ0*ScaP)**2 - cdef np.ndarray roo = np.roots(np.array([a4,a3,a2,a1,a0])) - cdef list KK = list(np.real(roo[np.isreal(roo)])) # There might be several solutions - cdef list Pk, Pk2D, rk - cdef double kk, kPMin - if Mode=='LOS': # Take solution on physical LOS - if any([kk>=0 and kk<=kOut for kk in KK]): - KK = [kk for kk in KK if kk>=0 and kk<=kOut] - Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK] - Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk] - rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D] - kPMin = KK[rk.index(min(rk))] - else: - kPMin = min([Cabs(kk) for kk in KK]) # Else, take the one closest to D - else: - Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK] - Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk] - rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D] - kPMin = KK[rk.index(min(rk))] - return kPMin # + distance au cercle - - - -cdef LOS_sino_Tor(double D0, double D1, double D2, double u0, double u1, - double u2, double RZ0, double RZ1, str Mode='LOS', double - kOut=Cinf): - - cdef double uN = Csqrt(u0**2+u1**2+u2**2), uParN = Csqrt(u0**2+u1**2), DParN = Csqrt(D0**2+D1**2) - cdef double Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1 - cdef double kPMin - if uParN == 0.: - kPMin = (RZ1-D2)/u2 - else: - kPMin = LOS_sino_findRootkPMin_Tor(uParN, uN, Sca, RZ0, RZ1, ScaP, DParN, kOut, D0, D1, D2, u0, u1, u2, Mode=Mode) - cdef double PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2 - cdef double PMin2norm = Csqrt(PMin0**2+PMin1**2) - cdef double PMin2D0 = PMin2norm, PMin2D1 = PMin2 - cdef double RMin = Csqrt((PMin2D0-RZ0)**2+(PMin2D1-RZ1)**2) - cdef double eTheta0 = -PMin1/PMin2norm, eTheta1 = PMin0/PMin2norm, eTheta2 = 0. - cdef double vP0 = PMin2D0-RZ0, vP1 = PMin2D1-RZ1 - cdef double Theta = Catan2(vP1,vP0) - cdef double ImpTheta = Theta if Theta>=0 else Theta + np.pi - cdef double er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta) - cdef double p = vP0*er2D0 + vP1*er2D1 - cdef double uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN - cdef double phi = Casin(-uN0*eTheta0 -uN1*eTheta1 -uN2*eTheta2) - return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p, ImpTheta, phi - - - -cdef inline void NEW_LOS_sino_Tor(double orig0, double orig1, double orig2, - double dirv0, double dirv1, double dirv2, - double circ_radius, double circ_normz, - double[9] results, - bint is_LOS_Mode=False, - double kOut=Cinf) nogil: - cdef double[3] dirv, orig - cdef double[2] res - cdef double normu, normu_sqr - cdef double kPMin - - normu_sqr = dirv0 * dirv0 + dirv1 * dirv1 + dirv2 * dirv2 - normu = Csqrt(normu_sqr) - dirv[0] = dirv0 - dirv[2] = dirv2 - dirv[1] = dirv1 - orig[0] = orig0 - orig[1] = orig1 - orig[2] = orig2 - - if dirv0 == 0. and dirv1 == 0.: - kPMin = (circ_normz-orig2)/dirv2 - else: - _dt.dist_los_circle_core(dirv, orig, - circ_radius, circ_normz, - normu_sqr, res) - kPMin = res[0] - if is_LOS_Mode and kPMin > kOut: - kPMin = kOut - - # Computing the point's coordinates......................................... - cdef double PMin0 = orig0 + kPMin * dirv0 - cdef double PMin1 = orig1 + kPMin * dirv1 - cdef double PMin2 = orig2 + kPMin * dirv2 - cdef double PMin2norm = Csqrt(PMin0**2+PMin1**2) - cdef double RMin = Csqrt((PMin2norm - circ_radius)**2 - + (PMin2 - circ_normz)**2) - cdef double vP0 = PMin2norm - circ_radius - cdef double vP1 = PMin2 - circ_normz - cdef double Theta = Catan2(vP1, vP0) - cdef double ImpTheta = Theta if Theta>=0 else Theta + Cpi - cdef double er2D0 = Ccos(ImpTheta) - cdef double er2D1 = Csin(ImpTheta) - cdef double p0 = vP0*er2D0 + vP1*er2D1 - cdef double eTheta0 = -PMin1 / PMin2norm - cdef double eTheta1 = PMin0 / PMin2norm - cdef double normu0 = dirv0/normu - cdef double normu1 = dirv1/normu - cdef double phi = Casin(-normu0 * eTheta0 - normu1 * eTheta1) - # Filling the results ...................................................... - results[0] = PMin0 - results[1] = PMin1 - results[2] = PMin2 - results[3] = kPMin - results[4] = RMin - results[5] = Theta - results[6] = p0 - results[7] = ImpTheta - results[8] = phi - return - -cdef inline void NEW_los_sino_tor_vec(int nlos, - double[:,::1] origins, - double[:,::1] directions, - double circ_radius, - double circ_normz, - double[:,::1] los_closest_coords, - double[::1] los_closest_coeffs, - double[::1] circle_closest_rmin, - double[::1] circle_closest_theta, - double[::1] circle_closest_p, - double[::1] circle_closest_imptheta, - double[::1] circle_closest_phi, - bint is_LOS_Mode=False, - double[::1] kOut=None) nogil: - cdef int ind_los - cdef double* dirv - cdef double* orig - cdef double* res - cdef double normu, normu_sq - cdef double kPMin, PMin2norm, Theta - cdef double vP0 = 0.0 - cdef double vP1 = 0.0 - cdef double eTheta0 - cdef double eTheta1 - cdef double normu0 - cdef double normu1 - cdef double distance - cdef double PMin0, PMin1, PMin2 - - with nogil, parallel(): - dirv = malloc(3*sizeof(double)) - orig = malloc(3*sizeof(double)) - res = malloc(2*sizeof(double)) - for ind_los in prange(nlos): - dirv[0] = directions[0, ind_los] - dirv[1] = directions[1, ind_los] - dirv[2] = directions[2, ind_los] - orig[0] = origins[0, ind_los] - orig[1] = origins[1, ind_los] - orig[2] = origins[2, ind_los] - normu_sq = dirv[0] * dirv[0] + dirv[1] * dirv[1] + dirv[2] * dirv[2] - normu = Csqrt(normu_sq) - # Computing coeff of closest on line................................ - if dirv[0] == 0. and dirv[1] == 0.: - kPMin = (circ_normz-orig[2])/dirv[2] - else: - _dt.dist_los_circle_core(dirv, orig, circ_radius, - circ_normz, normu_sq, res) - kPMin = res[0] - distance = res[1] - if is_LOS_Mode and kOut is not None and kPMin > kOut[ind_los]: - kPMin = kOut[ind_los] - los_closest_coeffs[ind_los] = kPMin - - # Computing the info of the closest point on LOS & Circle........... - PMin0 = orig[0] + kPMin * dirv[0] - PMin1 = orig[1] + kPMin * dirv[1] - PMin2 = orig[2] + kPMin * dirv[2] - los_closest_coords[0, ind_los] = PMin0 - los_closest_coords[1, ind_los] = PMin1 - los_closest_coords[2, ind_los] = PMin2 - # Computing RMin: - PMin2norm = Csqrt(PMin0**2+PMin1**2) - circle_closest_rmin[ind_los] = Csqrt((PMin2norm - circ_radius)**2 - + (PMin2 - circ_normz)**2) - # Theta and ImpTheta: - vP0 = PMin2norm - circ_radius - vP1 = PMin2 - circ_normz - Theta = Catan2(vP1, vP0) - circle_closest_theta[ind_los] = Theta - if Theta < 0: - Theta = Theta + Cpi - circle_closest_imptheta[ind_los] = Theta - circle_closest_p[ind_los] = vP0 * Ccos(Theta) + vP1 * Csin(Theta) - # Phi: - eTheta0 = - PMin1 / PMin2norm - eTheta1 = PMin0 / PMin2norm - normu0 = dirv[0]/normu - normu1 = dirv[1]/normu - circle_closest_phi[ind_los] = Casin(-normu0 * eTheta0 - normu1 * eTheta1) - free(dirv) - free(orig) - free(res) - return - - - -cdef LOS_sino_Lin(double D0, double D1, double D2, double u0, double u1, double - u2, double RZ0, double RZ1, str Mode='LOS', double kOut=Cinf): - cdef double kPMin - if u0**2==1.: - kPMin = 0. - else: - kPMin = ( (RZ0-D1)*u1+(RZ1-D2)*u2 ) / (1-u0**2) - kPMin = kOut if Mode=='LOS' and kPMin > kOut else kPMin - cdef double PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2 - cdef double RMin = Csqrt((PMin1-RZ0)**2+(PMin2-RZ1)**2) - cdef double vP0 = PMin1-RZ0, vP1 = PMin2-RZ1 - cdef double Theta = Catan2(vP1,vP0) - cdef double ImpTheta = Theta if Theta>=0 else Theta + np.pi - cdef double er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta) - cdef double p0 = vP0*er2D0 + vP1*er2D1 - cdef double uN = Csqrt(u0**2+u1**2+u2**2) - cdef double uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN - cdef double phi = Catan2(uN0, Csqrt(uN1**2+uN2**2)) - return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p0, ImpTheta, phi - - -def LOS_sino(double[:,::1] D, double[:,::1] u, double[::1] RZ, double[::1] kOut, - str Mode='LOS', str VType='Tor', bint try_new_algo=True): - cdef unsigned int nL = D.shape[1], ii - cdef tuple out - cdef np.ndarray[double,ndim=2] PMin = np.empty((3,nL)) - cdef np.ndarray[double,ndim=1] kPMin=np.empty((nL,)), RMin=np.empty((nL,)) - cdef np.ndarray[double,ndim=1] Theta=np.empty((nL,)), p=np.empty((nL,)) - cdef np.ndarray[double,ndim=1] ImpTheta=np.empty((nL,)), phi=np.empty((nL,)) - cdef double[9] results - cdef bint is_LOS_Mode - if VType.lower()=='tor': - if not try_new_algo: - for ii in range(0,nL): - out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii], - u[0,ii],u[1,ii],u[2,ii], - RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii]) - ((PMin[0,ii],PMin[1,ii],PMin[2,ii]), - kPMin[ii], RMin[ii], Theta[ii], - p[ii], ImpTheta[ii], phi[ii]) = out - else: - is_LOS_Mode = Mode.lower() == 'los' - NEW_los_sino_tor_vec(nL, D, u, RZ[0], RZ[1], - PMin, kPMin, RMin, Theta, p, - ImpTheta, phi, - is_LOS_Mode=is_LOS_Mode, - kOut=kOut) - else: - for ii in range(0,nL): - out = LOS_sino_Lin(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii], - RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii]) - ((PMin[0,ii],PMin[1,ii],PMin[2,ii]), - kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out - return PMin, kPMin, RMin, Theta, p, ImpTheta, phi - - - - - - - - -######################################################## -######################################################## -######################################################## -# Solid Angle -######################################################## -######################################################## -######################################################## - - -###################################################### -###################################################### -# Dust -###################################################### -###################################################### - -def Dust_calc_SolidAngle(pos, r, pts, - approx=True, out_coefonly=False, - VType='Tor', VPoly=None, VIn=None, VLim=None, - LSPoly=None, LSLim=None, LSVIn=None, Forbid=True, - Test=True): - """ Compute the solid angle of a moving particle of varying radius as seen - from any number of pixed points - - Can be done w/o the approximation that r<ray_vdir.data, - ray_orig.data, - radius, circ_z, norm_dir, res) - return np.asarray(res) - -def comp_dist_los_circle_vec(int nlos, int ncircles, - np.ndarray[double,ndim=2,mode='c'] dirs, - np.ndarray[double,ndim=2,mode='c'] oris, - np.ndarray[double,ndim=1,mode='c'] circle_radius, - np.ndarray[double,ndim=1,mode='c'] circle_z, - np.ndarray[double,ndim=1,mode='c'] norm_dir = None, - int num_threads=48): - """ - This function computes the intersection of a Ray (or Line Of Sight) - and a circle in 3D. It returns `kmin`, the coefficient such that the - ray of origin O = [ori1, ori2, ori3] and of directional vector - D = [dir1, dir2, dir3] is closest to the circle of radius `radius` - and centered `(0, 0, circ_z)` at the point P = O + kmin * D. - The variable `norm_dir` is the squared norm of the direction of the ray. - This is the vectorial version, we expect the directions and origins to be: - dirs = [[dir1_los1, dir2_los1, dir3_los1], [dir1_los2,...] - oris = [[ori1_los1, ori2_los1, ori3_los1], [ori1_los2,...] - Returns - ======= - res : (2, nlos, ncircles) - res = [res_k, res_d] where res_k is a (nlos, ncircles) numpy array - with the k coefficients for each LOS where the minimum distance - to each circle is reached - is met for each circle, and res_d is a (nlos, ncircles) numpy array - with the distance between each LOS to each circle - --- - This is the PYTHON function, use only if you need this computation from - Python, if you need it from Cython, use `dist_los_circle_core` - """ - cdef array kmin_tab = clone(array('d'), nlos*ncircles, True) - cdef array dist_tab = clone(array('d'), nlos*ncircles, True) - - if norm_dir is None: - norm_dir = -np.ones(nlos) - _dt.comp_dist_los_circle_vec_core(nlos, ncircles, - dirs.data, - oris.data, - circle_radius.data, - circle_z.data, - norm_dir.data, - kmin_tab, dist_tab, num_threads) - return np.asarray(kmin_tab).reshape(nlos, ncircles), \ - np.asarray(dist_tab).reshape(nlos, ncircles) - - -# ============================================================================== -# -# TEST CLOSENESS CIRCLE - LOS -# -# ============================================================================== - -def is_close_los_circle(np.ndarray[double,ndim=1,mode='c'] ray_vdir, - np.ndarray[double,ndim=1,mode='c'] ray_orig, - double radius, double circ_z, double eps, - double norm_dir=-1.0): - """ - This function checks if at maximum a LOS is at a distance epsilon - form a cirlce - The result is True when distance < epsilon - --- - This is the PYTHON function, use only if you need this computation from - Python, if you need it from Cython, use `is_los_close_circle_core` - """ - return _dt.is_close_los_circle_core(ray_vdir.data, - ray_orig.data, - radius, circ_z, norm_dir, eps) - -def is_close_los_circle_vec(int nlos, int ncircles, double epsilon, - np.ndarray[double,ndim=2,mode='c'] dirs, - np.ndarray[double,ndim=2,mode='c'] oris, - np.ndarray[double,ndim=1,mode='c'] circle_radius, - np.ndarray[double,ndim=1,mode='c'] circle_z, - np.ndarray[double,ndim=1,mode='c'] norm_dir=None, - int num_threads=48): - """ - This function checks if at maximum a LOS is at a distance epsilon - form a cirlce. Vectorial version - The result is True when distance < epsilon - --- - This is the PYTHON function, use only if you need this computation from - Python, if you need it from Cython, use `is_los_close_circle_core` - """ - cdef array res = clone(array('i'), nlos, True) - - if norm_dir is None: - norm_dir = -np.ones(nlos) - _dt.is_close_los_circle_vec_core(nlos, ncircles, - epsilon, - dirs.data, - oris.data, - circle_radius.data, - circle_z.data, - norm_dir.data, - res, num_threads) - return np.asarray(res, dtype=bool).reshape(nlos, ncircles) - -# ============================================================================== -# -# DISTANCE BETWEEN LOS AND EXT-POLY -# -# ============================================================================== -def comp_dist_los_vpoly(double[:, ::1] ray_orig, - double[:, ::1] ray_vdir, - double[:, ::1] ves_poly, - double disc_step=0.1, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - int num_threads=16, bint debug=False, - int debug_nlos=-1): - """ - This function computes the distance (and the associated k) between nlos - Rays (or LOS) and an `IN` structure (a polygon extruded around the axis - (0,0,1), eg. a flux surface). - For more details on the algorithm please see PDF: .pdf #TODO - - Params - ====== - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the Vessel - eps_ : double - Small value, acceptance of error - Returns - ======= - kmin_vpoly : (nlos) double array - Of the form [k_0, k_1, ..., k_n], where k_i is the coefficient - such that the i-th ray (LOS) is closest to the extruded polygon - at the point P_i = orig[i] + kmin[i] * vdir[i] - dist_vpoly : (nlos) double array - `distance[i]` is the distance from P_i to the extruded polygon. - --- - This is the PYTHON function, use only if you need this computation from - Python, if you need it from Cython, use `simple_dist_los_vpoly_core` - """ - cdef int npts_poly = ves_poly.shape[1] - cdef int nlos = ray_orig.shape[1] - cdef int ii, ind_vert, ind_los - cdef double* res_loc = NULL - cdef double* loc_org = NULL - cdef double* loc_dir = NULL - cdef double crit2, invuz, dpar2, upar2, upscaDp - cdef double crit2_base = eps_uz * eps_uz /400. - cdef np.ndarray[double,ndim=1] dist = np.empty((nlos,),dtype=float) - cdef np.ndarray[double,ndim=1] kmin = np.empty((nlos,),dtype=float) - cdef double* list_vpoly_x = NULL - cdef double* list_vpoly_y = NULL - cdef int new_npts_poly - # == Discretizing vpolys =================================================== - _st.simple_discretize_vpoly_core(ves_poly, - npts_poly, - disc_step, # discretization step - &list_vpoly_x, - &list_vpoly_y, - &new_npts_poly, - 1, # mode = absolute - _VSMALL) - # == Defining parallel part ================================================ - with nogil, parallel(num_threads=num_threads): - # We use local arrays for each thread so... - loc_org = malloc(sizeof(double) * 3) - loc_dir = malloc(sizeof(double) * 3) - res_loc = malloc(2*sizeof(double)) - # == The parallelization over the LOS ================================== - for ind_los in prange(nlos, schedule='dynamic'): - loc_org[0] = ray_orig[0, ind_los] - loc_org[1] = ray_orig[1, ind_los] - loc_org[2] = ray_orig[2, ind_los] - loc_dir[0] = ray_vdir[0, ind_los] - loc_dir[1] = ray_vdir[1, ind_los] - loc_dir[2] = ray_vdir[2, ind_los] - # -- Computing values that depend on the LOS/ray ------------------- - upscaDp = loc_dir[0]*loc_org[0] + loc_dir[1]*loc_org[1] - upar2 = loc_dir[0]*loc_dir[0] + loc_dir[1]*loc_dir[1] - dpar2 = loc_org[0]*loc_org[0] + loc_org[1]*loc_org[1] - invuz = 1./loc_dir[2] - crit2 = upar2*crit2_base - _dt.simple_dist_los_vpoly_core(loc_org, loc_dir, - list_vpoly_x, - list_vpoly_y, - new_npts_poly, upscaDp, - upar2, dpar2, - invuz, crit2, - eps_uz, eps_vz, - eps_a, eps_b, - res_loc) - kmin[ind_los] = res_loc[0] - dist[ind_los] = res_loc[1] - free(loc_org) - free(loc_dir) - free(res_loc) - free(list_vpoly_x) - free(list_vpoly_y) - return kmin, dist - -def comp_dist_los_vpoly_vec(int nvpoly, int nlos, - np.ndarray[double,ndim=2,mode='c'] ray_orig, - np.ndarray[double,ndim=2,mode='c'] ray_vdir, - np.ndarray[double,ndim=3,mode='c'] ves_poly, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - str algo_type='simple', int num_threads=16): - """ - This function computes the distance (and the associated k) between nlos - Rays (or LOS) and several `IN` structures (polygons extruded around the axis - (0,0,1), eg. flux surfaces). - For more details on the algorithm please see PDF: .pdf #TODO - - Params - ====== - nvpoly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces - WARNING : we suppose all poly are nested in each other, - from inner to outer - eps_ : double - Small value, acceptance of error - Returns - ======= - kmin_vpoly : (npoly, nlos) double array - Of the form [k_00, k_01, ..., k_0n, k_10, k_11, ..., k_1n, ...] - where k_ij is the coefficient for the j-th flux surface - such that the i-th ray (LOS) is closest to the extruded polygon - at the point P_i = orig[i] + kmin[i] * vdir[i] - dist_vpoly : (npoly, nlos) double array - `distance[i * num_poly + j]` is the distance from P_i to the i-th - extruded poly. - --- - This is the PYTHON function, use only if you need this computation from - Python, if you need it from Cython, use `comp_dist_los_vpoly_vec_core` - """ - if not algo_type.lower() == "simple" or not ves_type.lower() == "tor": - assert False, "The function is only implemented with the simple"\ - + " algorithm and for toroidal vessels... Sorry!" - warn("This function supposes that the polys are nested from inner to outer", - Warning) - - cdef np.ndarray[double, ndim=1] kmin = np.empty((nvpoly*nlos,), dtype=float) - cdef np.ndarray[double, ndim=1] dist = np.empty((nvpoly*nlos,), dtype=float) - cdef int algo_num = 0 - cdef int ves_num = 1 - _dt.comp_dist_los_vpoly_vec_core(nvpoly, nlos, - ray_orig.data, - ray_vdir.data, - ves_poly, - eps_uz, eps_a, - eps_vz, eps_b, - eps_plane, - ves_num, - algo_num, - &kmin[0], &dist[0], - 0.05, - num_threads) - return kmin.reshape(nlos, nvpoly),\ - dist.reshape(nlos, nvpoly) - -# ============================================================================== -# -# ARE LOS AND EXT-POLY CLOSE -# -# ============================================================================== - -def is_close_los_vpoly_vec(int nvpoly, int nlos, - np.ndarray[double,ndim=2,mode='c'] ray_orig, - np.ndarray[double,ndim=2,mode='c'] ray_vdir, - np.ndarray[double,ndim=3,mode='c'] ves_poly, - double epsilon, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - str algo_type='simple', int num_threads=16): - """ - This function tests if the distance between nlos Rays (or LOS) and - several `IN` structures (polygons extruded around the axis (0,0,1), - eg. flux surfaces) is smaller than `epsilon`. - For more details on the algorithm please see PDF: .pdf #TODO - - Params - ====== - nvpoly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces - WARNING : we suppose all poly are nested in each other, - and the first one is the smallest one - epsilon : double - Value for testing if distance < epsilon - eps_ : double - Small value, acceptance of error - Returns - ======= - are_close : (npoly * nlos) bool array - `are_close[i * num_poly + j]` indicates if distance between i-th LOS - and j-th poly are closer than epsilon. (True if distanceray_orig.data, - ray_vdir.data, - ves_poly, - eps_uz, eps_a, - eps_vz, eps_b, - eps_plane, - epsilon, - are_close, - num_threads) - return np.asarray(are_close, dtype=bool).reshape(nlos, nvpoly) - -# ============================================================================== -# -# WHICH LOS/VPOLY IS CLOSER -# -# ============================================================================== - -def which_los_closer_vpoly_vec(int nvpoly, int nlos, - np.ndarray[double,ndim=2,mode='c'] ray_orig, - np.ndarray[double,ndim=2,mode='c'] ray_vdir, - np.ndarray[double,ndim=3,mode='c'] ves_poly, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - str algo_type='simple', int num_threads=16): - """ - Params - ====== - nvpoly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces - WARNING : we suppose all poly are nested in each other, - and the first one is the smallest one - eps_ : double - Small value, acceptance of error - Returns - ======= - ind_close_los : (npoly) int array - Of the form [ind_0, ind_1, ..., ind_(npoly-1)] - where ind_i is the coefficient for the i-th flux surface - such that the ind_i-th ray (LOS) is closest to the extruded polygon - among all other LOS without going over it. - --- - This is the PYTHON function, use only if you need this computation from - Python, if you need it from Cython, use `which_los_closer_vpoly_vec_core` - """ - warn("This function supposes that the polys are nested from inner to outer", - Warning) - - # ========================================================================== - if not algo_type.lower() == "simple" or not ves_type.lower() == "tor": - assert False, "The function is only implemented with the simple"\ - + " algorithm and for toroidal vessels... Sorry!" - warn("This function supposes that the polys are nested from inner to outer", - Warning) - # ========================================================================== - - cdef array ind_close_tab = clone(array('i'), nvpoly, True) - _dt.which_los_closer_vpoly_vec_core(nvpoly, nlos, - ray_orig.data, - ray_vdir.data, - ves_poly, - eps_uz, eps_a, - eps_vz, eps_b, - eps_plane, - ind_close_tab, - num_threads) - return np.asarray(ind_close_tab) - -def which_vpoly_closer_los_vec(int nvpoly, int nlos, - np.ndarray[double,ndim=2,mode='c'] ray_orig, - np.ndarray[double,ndim=2,mode='c'] ray_vdir, - np.ndarray[double,ndim=3,mode='c'] ves_poly, - double eps_uz=_SMALL, double eps_a=_VSMALL, - double eps_vz=_VSMALL, double eps_b=_VSMALL, - double eps_plane=_VSMALL, str ves_type='Tor', - str algo_type='simple', int num_threads=16): - """ - Params - ====== - nvpoly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces - WARNING : we suppose all poly are nested in each other, - and the first one is the smallest one - eps_ : double - Small value, acceptance of error - Returns - ======= - ind_close_los : (nlos) int array - Of the form [ind_0, ind_1, ..., ind_(nlos-1)] - where ind_i is the coefficient for the i-th LOS (ray) - such that the ind_i-th poly (flux surface) is closest to the LOS - among all other poly without going over it. - --- - This is the PYTHON function, use only if you need this computation from - Python, if you need it from Cython, use `which_vpoly_closer_los_vec_core` - """ - warn("This function supposes that the polys are nested from inner to outer", - Warning) - # ========================================================================== - if not algo_type.lower() == "simple" or not ves_type.lower() == "tor": - assert False, "The function is only implemented with the simple"\ - + " algorithm and for toroidal vessels... Sorry!" - warn("This function supposes that the polys are nested from inner to outer", - Warning) - # ========================================================================== - - cdef array ind_close_tab = clone(array('i'), nlos, True) - _dt.which_vpoly_closer_los_vec_core(nvpoly, nlos, - ray_orig.data, - ray_vdir.data, - ves_poly, - eps_uz, eps_a, - eps_vz, eps_b, - eps_plane, - ind_close_tab, - num_threads) - return np.asarray(ind_close_tab) diff --git a/tofu/geom/_basic_geom_tools.pxd b/tofu/geom/_basic_geom_tools.pxd deleted file mode 100644 index 7e91b3d26..000000000 --- a/tofu/geom/_basic_geom_tools.pxd +++ /dev/null @@ -1,117 +0,0 @@ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -# -################################################################################ -# Utility functions for basic geometry : -# - vector calculus (cross product, dot product, norm, ...) -# - cythonization of matplotlib path functions (is point in a path?) -# - cythonization of some numpy functions (hypotenus, tile, sum) -################################################################################ -cimport cython -from cpython.array cimport array, clone - -# ============================================================================== -# == Geometry global variables -# ============================================================================== -# Values defined in the *.pyx file -cdef double _VSMALL -cdef double _SMALL - -cdef extern from "_fast_sum.c": - void sum_rows_blocks(double *orig, double *out, int n_rows, int n_cols) nogil - -cdef extern from "_fast_sum.c": - void sum_par_mat(double *orig, double *out, int n_rows, int n_cols) nogil - -cdef extern from "_fast_sum.c": - double sum_par_one_row(double *orig, int n_rows) nogil - -# ============================================================================== -# == Redifinition of functions -# ============================================================================== -cdef bint is_point_in_path(const int nvert, - const double* vertx, - const double* verty, - const double testx, - const double testy) nogil - -cdef int is_point_in_path_vec(const int nvert, - const double* vertx, - const double* verty, - const int npts, - const double* testx, - const double* testy, - int* is_in_path) nogil - -cdef void compute_inv_and_sign(const double[3] ray_vdir, - int[3] sign, - double[3] inv_direction) nogil - -cdef array compute_hypot(const double[::1] xpts, const double[::1] ypts, - int npts=*) - -cdef double comp_min_hypot(const double[::1] xpts, const double[::1] ypts, - int npts=*) nogil - -cdef double comp_min(double[::1] vec, int npts) nogil - -cdef void tile_3_to_2d(double v0, double v1, double v2, int npts, - double[:,::1] res) nogil -# ============================================================================== -# = Polygon helpers -# ============================================================================== -cdef int find_ind_lowerright_corner(const double[::1] xpts, - const double[::1] ypts, - int npts) nogil - -# ============================================================================== -# == Vector Calculus Helpers -# ============================================================================== -cdef void compute_cross_prod(const double[3] vec_a, - const double[3] vec_b, - double[3] res) nogil - -cdef void compute_dist_pt_vec(const double pt0, const double pt1, - const double pt2, const int npts, - const double[:, ::1] vec, - double* dist) nogil - -cdef void compute_dist_vec_vec(const double[:, ::1] vec1, const int npts1, - const double[:, ::1] vec2, const int npts2, - double[:, ::1] dist) nogil - -cdef double compute_norm(const double[3] vec) nogil - -cdef double compute_dot_prod(const double[3] vec_a, - const double[3] vec_b) nogil - -cdef double compute_g(double s, double m2b2, double rm0sqr, - double m0sqr, double b1sqr) nogil - -cdef double compute_bisect(double m2b2, double rm0sqr, - double m0sqr, double b1sqr, - double smin, double smax) nogil - -cdef double compute_find(double m2b2, double rm0sqr, - double m0sqr, double b1sqr, - double t0, double t1, double f0, double f1, - int maxIterations, double root) nogil - -cdef void compute_diff_div(const double[:, ::1] vec1, - const double[:, ::1] vec2, - const double* div, - const int npts, - double[:, ::1] res) nogil - -# ============================================================================== -# == Matrix sum (np.sum) -# ============================================================================== -cdef void sum_by_rows(double *orig, double *out, - int n_rows, int n_cols) nogil - -cdef void sum_naive_rows(double* orig, double* out, - int n_rows, int n_cols) nogil -cdef double sum_naive(double* orig, int n_cols) nogil - -cdef long sum_naive_int(long* orig, int n_cols) nogil diff --git a/tofu/geom/_basic_geom_tools.pyx b/tofu/geom/_basic_geom_tools.pyx deleted file mode 100644 index dd87af10e..000000000 --- a/tofu/geom/_basic_geom_tools.pyx +++ /dev/null @@ -1,396 +0,0 @@ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -cimport cython - -from cython.parallel import prange -from cpython.array cimport array, clone -from libc.math cimport cos as Ccos, sin as Csin -from libc.math cimport atan2 as Catan2 -from libc.math cimport sqrt as Csqrt -from libc.math cimport fabs as Cabs -from libc.math cimport NAN as Cnan -from libc.stdlib cimport malloc, free -# -cdef double _VSMALL = 1.e-9 -cdef double _SMALL = 1.e-6 - -# ============================================================================== -# = Point in path -# ============================================================================== -cdef inline bint is_point_in_path(const int nvert, - const double* vertx, - const double* verty, - const double testx, - const double testy) nogil: - """ - Computes if a point of coordiates (testx, testy) is in the polygon defined - by nvert vertices of coordinates (vertx, verty). - - !! -- WARNING: the poly should be CLOSED and nvert = vpoly.shape[1]-1 -- !! - Params - ====== - nvert : int - number of DIFFERENT vertices in polygon - vertx : double array - x-coordinates of polygon - verty : double array - y-coordinate of polygon - testx : double - x-coordinate of point to be tested if in or out of polygon - testy : double - y-coordinate of point to be tested if in or out of polygon - Returns - ======= - bool : True if point is in the polygon, else False - """ - cdef int i - cdef bint c = 0 - for i in range(nvert): - if ( ((verty[i]>testy) != (verty[i+1]>testy)) and - (testx < (vertx[i+1]-vertx[i]) * (testy-verty[i]) \ - / (verty[i+1]-verty[i]) + vertx[i]) ): - c = not c - return c - -cdef inline int is_point_in_path_vec(const int nvert, - const double* vertx, - const double* verty, - const int npts, - const double* testx, - const double* testy, - int* is_in_path) nogil: - """ - Computes if a series of points of coordiates (testx[ii], testy[ii]) is in - the polygon defined by nvert vertices of coordinates (vertx, verty) - Params - ====== - nvert : int - number of vertices in polygon - vertx : double array - x-coordinates of polygon - verty : double array - y-coordinate of polygon - npts : int - number of points to test if in poly or not - testx : double array - x-coordinates of points to be tested if in or out of polygon - testy : double array - y-coordinates of points to be tested if in or out of polygon - is_in_path : bint array - True if point is in the polygon, else False - Returns - ======= - The number of "true" - """ - cdef int ii - cdef int tot_true = 0 - cdef bint c = 0 - for ii in range(npts): - c = is_point_in_path(nvert, vertx, verty, testx[ii], testy[ii]) - is_in_path[ii] = c - tot_true += c*1 - return tot_true - - -# ============================================================================== -# = Computing inverse of vector and sign of each element -# ============================================================================== -cdef inline void compute_inv_and_sign(const double[3] ray_vdir, - int[3] sign, - double[3] inv_direction) nogil: - """ - Computes the inverse direction and sign of each coordinate of a vector. - Params - ====== - ray_vdir : (3) double array - direction of the LOS - sign : (3) int array - for each coordinate of the direction, indicates if negative or not - If sign[i] = 1, ray_vdir[i] < 0, else sign[i] = 0 - inv_direction : (3) double array - Inverse on each axis of direction of LOS - """ - cdef int t0 = 1000000 - # computing sign and direction - for ii in range(3): - if ray_vdir[ii] * ray_vdir[ii] < _VSMALL: - inv_direction[ii] = 1. / _VSMALL - else: - inv_direction[ii] = 1. / ray_vdir[ii] - if ray_vdir[ii] < 0.: - sign[ii] = 1 - else: - sign[ii] = 0 - return - -# ============================================================================== -# = Computing Hypothenus -# ============================================================================= -cdef inline array compute_hypot(const double[::1] xpts, const double[::1] ypts, - int npts=-1): - cdef int ii - cdef array hypot - cdef double* ptr_hypot - if npts == -1: - npts = xpts.shape[0] - hypot = clone(array('d'), npts, False) - ptr_hypot = hypot.data.as_doubles - with nogil: - for ii in range(npts): - ptr_hypot[ii] = Csqrt(xpts[ii]*xpts[ii] + ypts[ii]*ypts[ii]) - return hypot - -cdef inline double comp_min_hypot(const double[::1] xpts, - const double[::1] ypts, - int npts=-1) nogil: - cdef int ii - cdef double tmp - cdef double hypot = xpts[0]*xpts[0] + ypts[0]*ypts[0] - if npts == -1: - npts = xpts.shape[0] - for ii in range(npts): - tmp = xpts[ii]*xpts[ii] + ypts[ii]*ypts[ii] - if tmp < hypot: - hypot = tmp - return Csqrt(hypot) - -cdef inline double comp_min(double[::1] vec, int npts) nogil: - cdef int ii - cdef double res = vec[0] - for ii in range(1,npts): - if vec[ii] < res: - res = vec[ii] - return res - - -# ============================================================================== -# == VECTOR CALCULUS HELPERS -# ============================================================================== -cdef inline void compute_cross_prod(const double[3] vec_a, - const double[3] vec_b, - double[3] res) nogil: - res[0] = vec_a[1]*vec_b[2] - vec_a[2]*vec_b[1] - res[1] = vec_a[2]*vec_b[0] - vec_a[0]*vec_b[2] - res[2] = vec_a[0]*vec_b[1] - vec_a[1]*vec_b[0] - return - -cdef inline double compute_dot_prod(const double[3] vec_a, - const double[3] vec_b) nogil: - return vec_a[0] * vec_b[0] + vec_a[1] * vec_b[1] + vec_a[2] * vec_b[2] - -cdef inline double compute_norm(const double[3] vec) nogil: - return Csqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]) - -cdef inline double compute_g(double s, double m2b2, double rm0sqr, - double m0sqr, double b1sqr) nogil: - return s + m2b2 - rm0sqr*s / Csqrt(m0sqr*s*s + b1sqr) - -cdef inline double compute_bisect(double m2b2, double rm0sqr, - double m0sqr, double b1sqr, - double smin, double smax) nogil: - cdef int maxIterations = 10000 - cdef double root = 0. - root = compute_find(m2b2, rm0sqr, m0sqr, b1sqr, - smin, smax, -1.0, 1.0, maxIterations, root) - gmin = compute_g(root, m2b2, rm0sqr, m0sqr, b1sqr) - return root - -cdef inline double compute_find(double m2b2, double rm0sqr, - double m0sqr, double b1sqr, - double t0, double t1, double f0, double f1, - int maxIterations, double root) nogil: - cdef double fm, product - if (t0 < t1): - # Test the endpoints to see whether F(t) is zero. - if f0 == 0.: - root = t0 - return root - if f1 == 0.: - root = t1 - return root - if f0*f1 > 0.: - # It is not known whether the interval bounds a root. - return root - for i in range(2, maxIterations+1): - root = (0.5) * (t0 + t1) - if (root == t0 or root == t1): - # The numbers t0 and t1 are consecutive floating-point - # numbers. - break - fm = compute_g(root, m2b2, rm0sqr, m0sqr, b1sqr) - product = fm * f0 - if (product < 0.): - t1 = root - f1 = fm - elif (product > 0.): - t0 = root - f0 = fm - else: - break - return root - else: - return root - -# ============================================================================== -# = Tiling -# ============================================================================== -cdef inline void tile_3_to_2d(double v0, double v1, double v2, - int npts, double[:,::1] res) nogil: - """ - This function will probably not be very useful but might be used for - inspiration (if indeed faster than using numpy in cython). - It creates an array of shape (3, npts) as such : - [v0, ... v0] - [v1, ... v1] - [v2, ... v2] - Equivalent to : - tab = np.tile(np.r_[v0,v1,v2], (npts,1)).T - """ - cdef int ii - for ii in range(npts): - res[0,ii] = v0 - res[1,ii] = v1 - res[2,ii] = v2 - return - -# ============================================================================== -# = Polygon helpers -# ============================================================================== -cdef inline int find_ind_lowerright_corner(const double[::1] xpts, - const double[::1] ypts, - int npts) nogil: - cdef int ii - cdef int res = 0 - cdef double minx = xpts[0] - cdef double miny = ypts[0] - for ii in range(1,npts): - if miny > ypts[ii]: - minx = xpts[ii] - miny = ypts[ii] - res = ii - elif miny == ypts[ii]: - if minx < xpts[ii]: - minx = xpts[ii] - miny = ypts[ii] - res = ii - return res - -# ============================================================================== -# = Distance -# ============================================================================== -cdef inline void compute_dist_pt_vec(const double pt0, const double pt1, - const double pt2, int npts, - const double[:, ::1] vec, - double* dist) nogil: - """ - Compute the distance between the point P = [pt0, pt1, pt2] and each point - Q_i, where vec = {Q_0, Q_1, ..., Q_npts-1} - """ - cdef int ii - - for ii in range(npts): - dist[ii] = Csqrt((pt0 - vec[0, ii])*(pt0 - vec[0, ii]) - + (pt1 - vec[1, ii])*(pt1 - vec[1, ii]) - + (pt2 - vec[2, ii])*(pt2 - vec[2, ii])) - return - -cdef inline void compute_dist_vec_vec(const double[:, ::1] vec1, const int npts1, - const double[:, ::1] vec2, const int npts2, - double[:, ::1] dist) nogil: - """ - Compute the distance between each point P_i and each point - Q_i, where vec1 = {P_0, P_1, ..., P_npts1-1} and - vec2 = {Q_0, Q_1, ..., Q_npts2-1} - """ - cdef int ii, jj - - for ii in range(npts1): - for jj in range(npts2): - dist[ii,jj] = Csqrt((vec1[0,ii] - vec2[0, ii]) - * (vec1[0,ii] - vec2[0, ii]) - + (vec1[1,ii] - vec2[1, ii]) - * (vec1[1,ii] - vec2[1, ii]) - + (vec1[2,ii] - vec2[2, ii]) - * (vec1[2,ii] - vec2[2, ii])) - return - -cdef inline void compute_diff_div(const double[:, ::1] vec1, - const double[:, ::1] vec2, - const double* div, - const int npts, - double[:, ::1] res) nogil: - """ - Computes : - res = (vec1 - vec2) / div - """ - cdef int ii - cdef double invd - for ii in range(npts): - invd = Cnan - if div[ii] != 0. : - invd = 1./div[ii] - res[0, ii] = (vec1[0,ii] - vec2[0,ii]) * invd - res[1, ii] = (vec1[1,ii] - vec2[1,ii]) * invd - res[2, ii] = (vec1[2,ii] - vec2[2,ii]) * invd - return - -# ============================================================================== -# == Matrix sum (np.sum) -# ============================================================================== -cdef inline void sum_by_rows(double *orig, double *out, - int n_rows, int n_cols) nogil: - cdef int b, i, j - cdef int left - cdef int max_r = 8 - cdef int n_blocks = n_rows/max_r - cdef double* res - # .. initialization - res = malloc(max_r*sizeof(double)) - for b in prange(n_blocks): - for i in range(max_r): - res[i] = 0 - for j in range(n_cols): - for i in range(max_r): #calculate sum for max_r-rows simultaniously - res[i]+=orig[(b*max_r+i)*n_cols+j] - for i in range(max_r): - out[b*max_r+i]=res[i] - # left_overs: - left = n_rows - n_blocks*max_r; - for i in prange(max_r): - res[i] = 0 - for j in prange(n_cols): - for i in range(left): #calculate sum for left rows simultaniously - res[i]+=orig[(n_blocks*max_r)*n_cols+j] - for i in prange(left): - out[n_blocks*max_r+i]=res[i] - free(res) - return - - - -# ........... -cdef inline void sum_naive_rows(double* orig, double* out, - int n_rows, int n_cols) nogil: - cdef int ii, jj - for ii in prange(n_rows): - out[ii] = 0 - for jj in range(n_cols): - out[ii] += orig[ii*n_cols + jj] - - return - - -cdef inline double sum_naive(double* orig, int n_cols) nogil: - cdef int ii - cdef double out = 0. - for ii in prange(n_cols): - out += orig[ii] - return out - -cdef inline long sum_naive_int(long* orig, int n_cols) nogil: - cdef int ii - cdef long out = 0 - for ii in prange(n_cols): - out += orig[ii] - return out diff --git a/tofu/geom/_distance_tools.pxd b/tofu/geom/_distance_tools.pxd deleted file mode 100644 index ec6d2d495..000000000 --- a/tofu/geom/_distance_tools.pxd +++ /dev/null @@ -1,127 +0,0 @@ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -# -################################################################################ -# Utility functions related to the distance between a LOS and a VPoly: -# - Compute distance between LOS and a circle (unit and vectorial) -# - Test if a LOS and a circle are close (unit and vectorial) to a epsilon -# - Compute distance between LOS and VPoly (unit and vectorial) -# - Test if a LOS and a VPoly are close (unit and vectorial) to a epsilon -# - Compute which LOS is closer to a VPoly -# - Compute which VPoly is closer to a LOS -################################################################################ - -# ============================================================================== -# == DISTANCE CIRCLE - LOS -# ============================================================================== -cdef void dist_los_circle_core(const double[3] direct, - const double[3] origin, - const double radius, const double circ_z, - double norm_dir, - double[2] result) nogil - -cdef void comp_dist_los_circle_vec_core(int num_los, int num_cir, - double* los_directions, - double* los_origins, - double* circle_radius, - double* circle_z, - double* norm_dir_tab, - double[::1] res_k, - double[::1] res_dist, - int num_threads) nogil - -# ============================================================================== -# == TEST CLOSENESS CIRCLE - LOS -# ============================================================================== -cdef bint is_close_los_circle_core(const double[3] direct, - const double[3] origin, - double radius, double circ_z, - double norm_dir, double eps) nogil - -cdef void is_close_los_circle_vec_core(int num_los, int num_cir, - double eps, - double* los_directions, - double* los_origins, - double* circle_radius, - double* circle_z, - double* norm_dir_tab, - int[::1] res, int num_threads) nogil - -# ============================================================================== -# == DISTANCE BETWEEN LOS AND EXT-POLY -# ============================================================================== -cdef void comp_dist_los_vpoly_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - int ves_type, - int algo_type, - double* res_k, - double* res_dist, - double disc_step, - int num_threads) nogil - -cdef void simple_dist_los_vpoly_core(const double[3] ray_orig, - const double[3] ray_vdir, - const double* lpolyx, - const double* lpolyy, - const int nvert, - const double upscaDp, - const double upar2, - const double dpar2, - const double invuz, - const double crit2, - const double eps_uz, - const double eps_vz, - const double eps_a, - const double eps_b, - double* res_final) nogil - -# ============================================================================== -# == ARE LOS AND EXT-POLY CLOSE -# ============================================================================== -cdef void is_close_los_vpoly_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - double epsilon, - int[::1] are_close, - int num_threads) nogil - -# ============================================================================== -# == WHICH LOS/VPOLY IS CLOSER -# ============================================================================== -cdef void which_los_closer_vpoly_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - int[::1] ind_close_tab, - int num_threads) nogil - -cdef void which_vpoly_closer_los_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - int[::1] ind_close_tab, - int num_threads) nogil diff --git a/tofu/geom/_distance_tools.pyx b/tofu/geom/_distance_tools.pyx deleted file mode 100644 index b7e61ec90..000000000 --- a/tofu/geom/_distance_tools.pyx +++ /dev/null @@ -1,1320 +0,0 @@ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -# -################################################################################ -# Utility functions related to the distance between a LOS and a VPoly: -# - Compute distance between LOS and a circle (unit and vectorial) -# - Test if a LOS and a circle are close (unit and vectorial) to a epsilon -# - Compute distance between LOS and VPoly (unit and vectorial) -# - Test if a LOS and a VPoly are close (unit and vectorial) to a epsilon -# - Compute which LOS is closer to a VPoly -# - Compute which VPoly is closer to a LOS -################################################################################ -cimport cython -from cython.parallel import prange -from cython.parallel cimport parallel -from libc.math cimport fabs as Cabs -from libc.math cimport sqrt as Csqrt -from libc.math cimport NAN as Cnan -from libc.stdlib cimport malloc, free -from _basic_geom_tools cimport _VSMALL -cimport _basic_geom_tools as _bgt -cimport _sampling_tools as _st - -# ============================================================================== -# == DISTANCE CIRCLE - LOS -# ============================================================================== -cdef inline void dist_los_circle_core(const double[3] direct, - const double[3] origin, - const double radius, const double circ_z, - double norm_dir, - double[2] result) nogil: - """ - This function computes the intersection of a Ray (or Line Of Sight) - and a horizontal circle in 3. It returns `kmin` the coefficient such that - the ray of origin O = [ori1, ori2, ori3] and of directional vector - D = [dir1, dir2, dir3] is closest to the circle of radius `radius`, - center `(0, 0, circ_z)` and of normal (0,0,1) at the point P = O + kmin * D. - And `distance` the distance between the two closest points - The variable `norm_dir` is the norm of the direction of the ray. - if you haven't normalized the ray (and for optimization reasons you dont - want to, you can pass norm_dir = -1 - --- - Source: https://www.geometrictools.com/Documentation/DistanceToCircle3.pdf - The line is P(t) = B+t*M. The circle is |X-C| = r with Dot(N,X-C)=0. - - Params - ====== - direct : double (3) array - directional vector of the ray - origin : double (3) array - origin of the array (in 3d) - radius : double - radius of the circle - circ_z : double - 3rd coordinate of the center of the circle - ie. the circle center is (0,0, circ_z) - norm_dir : double (3) array - normal of the direction of the vector (for computation performance) - result : double (2) array - - result[0] will contain the k coefficient to find the line point closest - closest point - - result[1] will contain the DISTANCE from line closest point to circle - to the circle - """ - cdef int numRoots, i - cdef double zero = 0., m0sqr, m0, rm0 - cdef double lambd, m2b2, b1sqr, b1, r0sqr, twoThirds, sHat, gHat, cutoff, s - cdef double[3] D - cdef double[3] MxN - cdef double[3] DxN - cdef double[3] NxDelta - cdef double[3] circle_normal - cdef double[3] roots - cdef double[3] diff - cdef double[3] direction - cdef double[3] line_closest - cdef double[3] circle_center - cdef double[3] circle_closest - cdef double tmin - cdef double distance - cdef double inv_norm_dir - - if norm_dir < 0: - norm_dir = Csqrt(_bgt.compute_dot_prod(direct, direct)) - inv_norm_dir = 1./ norm_dir - # .. initialization ..... - for i in range(3): - circle_center[i] = 0. - circle_normal[i] = 0. - roots[i] = 0. - # we normalize direction - direction[i] = direct[i] * inv_norm_dir - circle_normal[2] = 1 - circle_center[2] = circ_z - - D[0] = origin[0] - D[1] = origin[1] - D[2] = origin[2] - circ_z - _bgt.compute_cross_prod(direction, circle_normal, MxN) - _bgt.compute_cross_prod(D, circle_normal, DxN) - m0sqr = _bgt.compute_dot_prod(MxN, MxN) - - if (m0sqr > zero): - # Compute the critical points s for F'(s) = 0. - numRoots = 0 - - # The line direction M and the plane normal N are not parallel. Move - # the line origin B = (b0,b1,b2) to B' = B + lambd*direction = - # (0,b1',b2'). - m0 = Csqrt(m0sqr) - rm0 = radius * m0 - lambd = -_bgt.compute_dot_prod(MxN, DxN) / m0sqr - for i in range(3): - D[i] += lambd * direction[i] - DxN[i] += lambd * MxN[i] - m2b2 = _bgt.compute_dot_prod(direction, D) - b1sqr = _bgt.compute_dot_prod(DxN, DxN) - if (b1sqr > zero) : - # B' = (0,b1',b2') where b1' != 0. See Sections 1.1.2 and 1.2.2 - # of the PDF documentation. - b1 = Csqrt(b1sqr) - rm0sqr = radius * m0sqr - if (rm0sqr > b1): - twoThirds = 2.0 / 3.0 - sHat = Csqrt((rm0sqr * b1sqr)**twoThirds - b1sqr) / m0 - gHat = rm0sqr * sHat / Csqrt(m0sqr * sHat * sHat + b1sqr) - cutoff = gHat - sHat - if (m2b2 <= -cutoff): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2, -m2b2 + rm0) - roots[numRoots] = s - numRoots += 1 - if (m2b2 == -cutoff): - roots[numRoots] = -sHat - numRoots += 1 - elif (m2b2 >= cutoff): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -m2b2) - roots[numRoots] = s - numRoots += 1 - if (m2b2 == cutoff): - roots[numRoots] = sHat - numRoots += 1 - else: - if (m2b2 <= zero): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2, - -m2b2 + rm0) - roots[numRoots] = s - numRoots += 1 - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -sHat) - roots[numRoots] = s - numRoots += 1 - else: - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -m2b2) - roots[numRoots] = s - numRoots += 1 - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, sHat, - -m2b2 + rm0) - roots[numRoots] = s - numRoots += 1 - else: - if (m2b2 < zero): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2, - -m2b2 + rm0) - elif (m2b2 > zero): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -m2b2) - else: - s = zero - roots[numRoots] = s - numRoots += 1 - else: - # The new line origin is B' = (0,0,b2'). - if (m2b2 < zero): - s = -m2b2 + rm0 - roots[numRoots] = s - numRoots += 1 - elif (m2b2 > zero): - s = -m2b2 - rm0 - roots[numRoots] = s - numRoots += 1 - else: - s = -m2b2 + rm0 - roots[numRoots] = s - numRoots += 1 - s = -m2b2 - rm0 - roots[numRoots] = s - numRoots += 1 - # Checking which one is the closest solution............................ - tmin = roots[0] + lambd - for i in range(1,numRoots): - t = roots[i] + lambd - if (t>0 and tmalloc(3*sizeof(double)) - orig = malloc(3*sizeof(double)) - loc_res = malloc(2*sizeof(double)) - for ind_los in prange(num_los): - for i in range(3): - dirv[i] = los_directions[ind_los * 3 + i] - orig[i] = los_origins[ind_los * 3 + i] - norm_dir = norm_dir_tab[ind_los] - if norm_dir < 0.: - norm_dir = Csqrt(_bgt.compute_dot_prod(dirv, dirv)) - for ind_cir in range(num_cir): - radius = circle_radius[ind_cir] - circ_z = circle_z[ind_cir] - dist_los_circle_core(dirv, orig, radius, circ_z, - norm_dir, loc_res) - res_k[ind_los * num_cir + ind_cir] = loc_res[0] - res_dist[ind_los * num_cir + ind_cir] = loc_res[1] - free(dirv) - free(orig) - free(loc_res) - return - -# ============================================================================== -# == TEST CLOSENESS CIRCLE - LOS -# ============================================================================== -cdef inline bint is_close_los_circle_core(const double[3] direct, - const double[3] origin, - double radius, double circ_z, - double norm_dir, double eps) nogil: - # Source: https://www.geometrictools.com/Documentation/DistanceToCircle3.pdf - # The line is P(t) = B+t*M. The circle is |X-C| = r with Dot(N,X-C)=0. - cdef int numRoots, i - cdef double zero = 0., m0sqr, m0, rm0 - cdef double lambd, m2b2, b1sqr, b1, r0sqr, twoThirds, sHat, gHat, cutoff, s - cdef double[3] D - cdef double[3] MxN - cdef double[3] DxN - cdef double[3] NxDelta - cdef double[3] circle_normal - cdef double[3] roots - cdef double[3] diff - cdef double[3] circle_center - cdef double[3] circle_closest - cdef double[3] line_closest - cdef double[3] direction - cdef double tmin - cdef double distance - cdef double inv_norm_dir - cdef bint are_close - - # .. initialization ..... - if norm_dir < 0: - norm_dir = Csqrt(_bgt.compute_dot_prod(direct, direct)) - inv_norm_dir = 1./ norm_dir - # .. initialization ..... - for i in range(3): - circle_center[i] = 0. - circle_normal[i] = 0. - roots[i] = 0. - # we normalize direction - direction[i] = direct[i] * inv_norm_dir - circle_normal[2] = 1 - circle_center[2] = circ_z - - D[0] = origin[0] - D[1] = origin[1] - D[2] = origin[2] - circ_z - _bgt.compute_cross_prod(direction, circle_normal, MxN) - _bgt.compute_cross_prod(D, circle_normal, DxN) - m0sqr = _bgt.compute_dot_prod(MxN, MxN) - - if (m0sqr > zero): - # Compute the critical points s for F'(s) = 0. - numRoots = 0 - # The line direction M and the plane normal N are not parallel. Move - # the line origin B = (b0,b1,b2) to B' = B + lambd*direction = - # (0,b1',b2'). - m0 = Csqrt(m0sqr) - rm0 = radius * m0 - lambd = -_bgt.compute_dot_prod(MxN, DxN) / m0sqr - for i in range(3): - D[i] += lambd * direction[i] - DxN[i] += lambd * MxN[i] - m2b2 = _bgt.compute_dot_prod(direction, D) - b1sqr = _bgt.compute_dot_prod(DxN, DxN) - if (b1sqr > zero) : - # B' = (0,b1',b2') where b1' != 0. See Sections 1.1.2 and 1.2.2 - # of the PDF documentation. - b1 = Csqrt(b1sqr) - rm0sqr = radius * m0sqr - if (rm0sqr > b1): - twoThirds = 2.0 / 3.0 - sHat = Csqrt((rm0sqr * b1sqr)**twoThirds - b1sqr) / m0 - gHat = rm0sqr * sHat / Csqrt(m0sqr * sHat * sHat + b1sqr) - cutoff = gHat - sHat - if (m2b2 <= -cutoff): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2, -m2b2 + rm0) - roots[numRoots] = s - numRoots += 1 - if (m2b2 == -cutoff): - roots[numRoots] = -sHat - numRoots += 1 - elif (m2b2 >= cutoff): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -m2b2) - roots[numRoots] = s - numRoots += 1 - if (m2b2 == cutoff): - roots[numRoots] = sHat - numRoots += 1 - else: - if (m2b2 <= zero): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2, - -m2b2 + rm0) - roots[numRoots] = s - numRoots += 1 - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -sHat) - roots[numRoots] = s - numRoots += 1 - else: - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -m2b2) - roots[numRoots] = s - numRoots += 1 - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, sHat, - -m2b2 + rm0) - roots[numRoots] = s - numRoots += 1 - else: - if (m2b2 < zero): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2, - -m2b2 + rm0) - elif (m2b2 > zero): - s = _bgt.compute_bisect(m2b2, rm0sqr, m0sqr, b1sqr, -m2b2 - rm0, - -m2b2) - else: - s = zero - roots[numRoots] = s - numRoots += 1 - else: - # The new line origin is B' = (0,0,b2'). - if (m2b2 < zero): - s = -m2b2 + rm0 - roots[numRoots] = s - numRoots += 1 - elif (m2b2 > zero): - s = -m2b2 - rm0 - roots[numRoots] = s - numRoots += 1 - else: - s = -m2b2 + rm0 - roots[numRoots] = s - numRoots += 1 - s = -m2b2 - rm0 - roots[numRoots] = s - numRoots += 1 - # Checking which one is the closest solution............................ - tmin = roots[0] + lambd - for i in range(1,numRoots): - t = roots[i] + lambd - if (t>0 and tmalloc(3*sizeof(double)) - orig = malloc(3*sizeof(double)) - for ind_los in prange(num_los): - for i in range(3): - dirv[i] = los_directions[ind_los * 3 + i] - orig[i] = los_origins[ind_los * 3 + i] - norm_dir = norm_dir_tab[ind_los] - if norm_dir < 0.: - norm_dir = Csqrt(_bgt.compute_dot_prod(dirv, dirv)) - for ind_cir in range(num_cir): - radius = circle_radius[ind_cir] - circ_z = circle_z[ind_cir] - res[ind_los * num_cir - + ind_cir] = is_close_los_circle_core(dirv, orig, radius, - circ_z, norm_dir, eps) - free(dirv) - free(orig) - return - -# ============================================================================== -# == DISTANCE BETWEEN LOS AND EXT-POLY -# ============================================================================== -cdef inline void comp_dist_los_vpoly_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - int ves_type, - int algo_type, - double* res_k, - double* res_dist, - double disc_step, - int num_threads) nogil: - """ - This function computes the distance (and the associated k) between nlos - Rays (or LOS) and several `IN` structures (polygons extruded around the axis - (0,0,1), eg. flux surfaces). - For more details on the algorithm please see PDF: .pdf #TODO - - Params - ====== - num_poly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces. - WARNING : we suppose all poly are nested in each other, - from inner to outer - eps_ : double - Small value, acceptance of error - algo_type : int - If algo_type = 0, then simple algo will be used - ves_type : int - If ves_type = 1, then geo is TOROIDAL - Returns - ======= - kmin_vpoly : (npoly, nlos) double array - Of the form [k_00, k_01, ..., k_0n, k_10, k_11, ..., k_1n, ...] - where k_ij is the coefficient for the j-th flux surface - such that the i-th ray (LOS) is closest to the extruded polygon - at the point P_i = orig[i] + kmin[i] * vdir[i] - dist_vpoly : (npoly, nlos) double array - `distance[j, i]` is the distance from P_i to the i-th extruded poly. - --- - This is the CYTHON function, use only if you need this computation from - Cython, if you need it from Python, use `comp_dist_los_vpoly_vec` - """ - cdef int i, ind_los, ind_pol, ind_pol2 - cdef int npts_poly - cdef double* loc_res - cdef double* loc_dir - cdef double* loc_org - cdef double* lpolyx - cdef double* lpolyy - cdef double crit2, invuz, dpar2, upar2, upscaDp - cdef double crit2_base = eps_uz * eps_uz /400. - cdef double** list_vpoly_x = NULL - cdef double** list_vpoly_y = NULL - cdef int* list_npts = NULL - # == Tests and warnings ==================================================== - with gil: - if not algo_type == 0 or not ves_type == 1: - assert False - from warnings import warn - warn("This algo supposes that the polys are nested from inner to outer", - Warning) - # == Discretizing vpolys =================================================== - list_vpoly_x = malloc(sizeof(double*)*num_poly) - list_vpoly_y = malloc(sizeof(double*)*num_poly) - list_npts = malloc(sizeof(int)*num_poly) - for ind_pol in range(num_poly): - list_vpoly_x[ind_pol] = NULL - list_vpoly_y[ind_pol] = NULL - _st.simple_discretize_vpoly_core(ves_poly[ind_pol], - ves_poly[ind_pol].shape[1], - disc_step, # discretization step - &list_vpoly_x[ind_pol], - &list_vpoly_y[ind_pol], - &list_npts[ind_pol], - 1, # mode = absolute - _VSMALL) - # == Defining parallel part ================================================ - with nogil, parallel(num_threads=num_threads): - # We use local arrays for each thread so... - loc_dir = malloc(3*sizeof(double)) - loc_org = malloc(3*sizeof(double)) - loc_res = malloc(2*sizeof(double)) - # == The parallelization over the LOS ================================== - for ind_los in prange(nlos, schedule='dynamic'): - for i in range(3): - loc_dir[i] = ray_vdir[ind_los * 3 + i] - loc_org[i] = ray_orig[ind_los * 3 + i] - # -- Computing values that depend on the LOS/ray ------------------- - upscaDp = loc_dir[0]*loc_org[0] + loc_dir[1]*loc_org[1] - upar2 = loc_dir[0]*loc_dir[0] + loc_dir[1]*loc_dir[1] - dpar2 = loc_org[0]*loc_org[0] + loc_org[1]*loc_org[1] - invuz = 1./loc_dir[2] - crit2 = upar2*crit2_base - # -- Looping over each flux surface--------------------------------- - for ind_pol in range(num_poly): - simple_dist_los_vpoly_core(loc_org, loc_dir, - list_vpoly_x[ind_pol], - list_vpoly_y[ind_pol], - list_npts[ind_pol], - upscaDp, - upar2, dpar2, - invuz, crit2, - eps_uz, eps_vz, - eps_a, eps_b, - loc_res) - if not res_k == NULL: - res_k[ind_los * num_poly + ind_pol] = loc_res[0] - res_dist[ind_los * num_poly + ind_pol] = loc_res[1] - if not loc_res[1] == loc_res[1] : #is nan - for ind_pol2 in range(ind_pol, num_poly): - res_k[ind_los * num_poly + ind_pol2] = Cnan - res_dist[ind_los * num_poly + ind_pol2] = Cnan - continue - free(loc_dir) - free(loc_org) - free(loc_res) - free(list_vpoly_x) - free(list_vpoly_y) - free(list_npts) - return - -cdef inline void simple_dist_los_vpoly_core(const double[3] ray_orig, - const double[3] ray_vdir, - const double* lpolyx, - const double* lpolyy, - const int nvert, - const double upscaDp, - const double upar2, - const double dpar2, - const double invuz, - const double crit2, - const double eps_uz, - const double eps_vz, - const double eps_a, - const double eps_b, - double* res_final) nogil: - """ - This function computes the distance (and the associated k) between a Ray - (or Line Of Sight) and an `IN` structure (a polygon extruded around the axis - (0,0,1), eg. a flux surface). - For more details on the algorithm please see PDF: .pdf #TODO - - Params - ====== - ray_orig : (3) double array - LOS origin point coordinates, noted often : `u` - ray_vdir : (3) double array - LOS normalized direction vector, noted often : `D` - lpolyx : (num_vertex) double array - 1st coordinates of the vertices of the Polygon defining the poloidal - cut of the Vessel - lpolyy : (num_vertex) double array - 2nd coordinates of the vertices of the Polygon defining the poloidal - cut of the Vessel - nvert : integer - number of vertices describing the polygon - upscaDp : double - if u = [ux, uy, uz] is the direction of the ray, and D=[dx, dy, dz] - its origin, then upscaDp = ux*dx + uy*dy - upar2 : double - if u = [ux, uy, uz] is the direction of the ray, and D=[dx, dy, dz] - its origin, then upar2 = ux*ux + uy*uy - dpar2 : double - if u = [ux, uy, uz] is the direction of the ray, and D=[dx, dy, dz] - its origin, then dpar2 = dx*dx + dy*dy - invuz : double - inverse of uz (vdir[2]) - eps_ : double - Small value, acceptance of error - Returns - ======= - kmin_vpoly : (num_los) double array - Of the form [k_0, k_1, ..., k_n], where k_i is the coefficient - such that the i-th ray (LOS) is closest to the extruded polygon - at the point P_i = orig[i] + kmin[i] * vdir[i] - dist_vpoly : (num_los) double array - `distance[i]` is the distance from P_i to the extruded polygon. - if the i-th LOS intersects the poly, then distance[i] = Cnan - --- - This is the Cython version, only accessible from cython. If you need - to use it from Python please use: comp_dist_los_vpoly - """ - cdef int jj - cdef int indin=0 - cdef int indout=0 - cdef double norm_dir2, norm_dir2_ori - cdef double radius_z - cdef double q, coeff, sqd, k - cdef double v0, v1, val_a, val_b - cdef double[2] res_a - cdef double[2] res_b - cdef double[3] circle_tangent - cdef double rdotvec - res_final[0] = 1000000000 - res_final[1] = 1000000000 - - # == Compute all solutions ================================================= - # Set tolerance value for ray_vdir[2,ii] - # eps_uz is the tolerated DZ across 20m (max Tokamak size) - norm_dir2 = Csqrt(_bgt.compute_dot_prod(ray_vdir, ray_vdir)) - norm_dir2_ori = norm_dir2 - for jj in range(3): - ray_vdir[jj] = ray_vdir[jj] / norm_dir2 - norm_dir2 = 1. - if ray_vdir[2] * ray_vdir[2] < crit2: - # -- Case with horizontal semi-line ------------------------------------ - for jj in range(nvert-1): - if (lpolyy[jj+1] - lpolyy[jj])**2 > eps_vz * eps_vz: - # If segment AB is NOT horizontal, then we can compute distance - # between LOS and cone. - # First we compute the "circle" on the cone that lives on the - # same plane as the line - q = (ray_orig[2] - lpolyy[jj]) / (lpolyy[jj+1] - lpolyy[jj]) - if q < 0. : - # Then we only need to compute distance to circle C_A - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj], lpolyy[jj], - norm_dir2, res_a) - elif q > 1: - # Then we only need to compute distance to circle C_B - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj+1], lpolyy[jj+1], - norm_dir2, res_a) - else: - # The we need to compute the radius (the height is Z_D) - # of the circle in the same plane as the LOS and compute the - # distance between the LOS and circle. - radius_z = q * (lpolyx[jj+1] - lpolyx[jj]) + lpolyx[jj] - dist_los_circle_core(ray_vdir, ray_orig, - radius_z, ray_orig[2], - norm_dir2, res_a) - if res_a[1] < _VSMALL: - # The line is either tangent or intersects the frustum - # we need to make the difference - k = res_a[0] - # we compute the ray from circle center to P - circle_tangent[0] = -ray_orig[0] - k * ray_vdir[0] - circle_tangent[1] = -ray_orig[1] - k * ray_vdir[1] - circle_tangent[2] = 0. # the line is horizontal - rdotvec = _bgt.compute_dot_prod(circle_tangent, - ray_vdir) - if Cabs(rdotvec) > _VSMALL: - # There is an intersection, distance = Cnan - res_final[1] = Cnan # distance - res_final[0] = Cnan # k - # no need to continue - return - if (res_final[1] - res_a[1] > _VSMALL - or (res_final[1] == res_a[1] - and res_final[0] - res_a[0] > _VSMALL)): - res_final[0] = res_a[0] # k - res_final[1] = res_a[1] # distance - else: - # -- case with horizontal cone (aka cone is a plane annulus) --- - if (Cabs(ray_orig[2] - lpolyy[jj]) > _VSMALL - and Csqrt(dpar2) >= min(lpolyx[jj], lpolyx[jj+1]) - and Csqrt(dpar2) <= max(lpolyx[jj], lpolyx[jj+1])): - # if ray and annulus are NOT on the same plane: - # AND the origin is somewhere in the annulus (on the - # X,Y plane), the origin is the closest and distance - # is the difference of height - if Cabs(ray_orig[2] - lpolyy[jj]) <= res_final[1]: - res_final[0] = 0 # k - res_final[1] = Cabs(ray_orig[2] - lpolyy[jj]) - else: - # Then the shortest distance is the distance to the - # outline circles - # computing dist to cricle C_A of radius R_A and height Z_A - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj], lpolyy[jj], - norm_dir2, res_a) - if res_a[1] < _VSMALL: - # The line is either tangent or intersects the frustum - # we need to make the difference - k = res_a[0] - # we compute the ray from circle center to P - circle_tangent[0] = -ray_orig[0] - k * ray_vdir[0] - circle_tangent[1] = -ray_orig[1] - k * ray_vdir[1] - circle_tangent[2] = 0. # the ray is horizontal - rdotvec = _bgt.compute_dot_prod(circle_tangent, - ray_vdir) - if Cabs(rdotvec) > _VSMALL: - # There is an intersection, distance = Cnan - res_final[1] = Cnan # distance - res_final[0] = Cnan # k - # no need to continue - return - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj+1], lpolyy[jj+1], - norm_dir2, res_b) - if res_b[1] < _VSMALL: - # The line is either tangent or intersects the frustum - # we need to make the difference - k = res_b[0] - # we compute the ray from circle center to P - circle_tangent[0] = -ray_orig[0] - k * ray_vdir[0] - circle_tangent[1] = -ray_orig[1] - k * ray_vdir[1] - circle_tangent[2] = 0. # the ray is horizontal - rdotvec = _bgt.compute_dot_prod(circle_tangent, - ray_vdir) - if Cabs(rdotvec) > _VSMALL: - # There is an intersection, distance = Cnan - res_final[1] = Cnan # distance - res_final[0] = Cnan # k - # no need to continue - return - # The result is the one associated to the shortest distance - if (res_final[1] - res_a[1] > _VSMALL - or (res_final[1] == res_a[1] - and res_final[0] - res_a[0] > _VSMALL)): - res_final[0] = res_a[0] # k - res_final[1] = res_a[1] # distance - if (res_final[1] - res_b[1] > _VSMALL - or (res_final[1] == res_b[1] - and res_final[0] - res_b[0] > _VSMALL)): - res_final[0] = res_b[0] # k - res_final[1] = res_b[1] # distance - else: - # == More general non-horizontal semi-line case ======================== - for jj in range(nvert-1): - v0 = lpolyx[jj+1]-lpolyx[jj] - v1 = lpolyy[jj+1]-lpolyy[jj] - val_a = v0 * v0 - upar2 * v1 * invuz * v1 * invuz - val_b = lpolyx[jj] * v0 + v1 * invuz * ( - (ray_orig[2] - lpolyy[jj]) * upar2 * invuz - upscaDp) - coeff = - upar2 * (ray_orig[2] - lpolyy[jj])**2 * invuz * invuz +\ - 2. * upscaDp * (ray_orig[2]-lpolyy[jj]) * invuz -\ - dpar2 + lpolyx[jj] * lpolyx[jj] - if (val_a * val_a < eps_a * eps_a): - if (val_b * val_b < eps_b * eps_b): - # let's see if C is 0 or not - if coeff * coeff < eps_a * eps_a : - # then LOS included in cone and then we can choose point - # such that q = 0, k = (z_A - z_D) / uz - res_a[0] = (lpolyy[jj] - ray_orig[2]) * invuz - res_a[1] = 0 # distance = 0 since LOS in cone - elif v0 * v0 < eps_a and upar2 * upar2 < eps_a: - # cylinder and vertical line - if (ray_orig[2] <= max(lpolyy[jj], lpolyy[jj+1]) - and ray_orig[2] >= min(lpolyy[jj], lpolyy[jj+1])): - # origin of line in the length of cylinder: - res_a[0] = 0 - res_a[1] = Cabs(upar2 - lpolyx[jj]) - elif (lpolyy[jj] >= ray_orig[2] - and ray_orig[2] <= lpolyy[jj+1]): - # ray origin below cylinder - if ray_vdir[2] < 0: - # if the ray is going down origin is the closest - res_a[0] = 0 - res_a[1] = Csqrt((lpolyx[jj] - upar2)**2 - + (min(lpolyy[jj], lpolyy[jj+1]) - - ray_orig[2])**2) - else: - res_a[0] = (min(lpolyy[jj], lpolyy[jj+1]) - - ray_orig[2]) * invuz - res_a[1] = Cabs(lpolyx[jj] - upar2) - else: - # ray origin above cylinder - if ray_vdir[2] > 0: - # if the ray is going up origin is the closest - res_a[0] = 0 - res_a[1] = Csqrt((lpolyx[jj] - upar2)**2 - + (max(lpolyy[jj], lpolyy[jj+1]) - - ray_orig[2])**2) - else: - res_a[0] = (max(lpolyy[jj], lpolyy[jj+1]) - - ray_orig[2]) * invuz - res_a[1] = Cabs(lpolyx[jj] - upar2) - else: # (val_b * val_b > eps_b * eps_b): - q = -coeff / (2. * val_b) - if q < 0. : - # Then we only need to compute distance to circle C_A - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj], lpolyy[jj], - norm_dir2, res_a) - elif q > 1: - # Then we only need to compute distance to circle C_B - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj+1], lpolyy[jj+1], - norm_dir2, res_a) - else : - k = (q * v1 - (ray_orig[2] - lpolyy[jj])) * invuz - if k >= 0.: - # Then there is an intersection - res_final[0] = Cnan - res_final[1] = Cnan - return # no need to move forward - else: - # The closest point on the line is the LOS origin - res_a[0] = 0 - res_a[1] = -k * Csqrt(norm_dir2) - if (res_final[1] - res_a[1] > _VSMALL - or (res_final[1] == res_a[1] - and res_final[0] - res_a[0] > _VSMALL)): - res_final[0] = res_a[0] # k - res_final[1] = res_a[1] # distance - elif (val_b * val_b >= val_a * coeff): - sqd = Csqrt(val_b * val_b - val_a * coeff) - # First solution - q = (-val_b + sqd) / val_a - if q < 0: - # Then we only need to compute distance to circle C_A - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj], lpolyy[jj], - norm_dir2, res_a) - elif q > 1: - # Then we only need to compute distance to circle C_B - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj+1], lpolyy[jj+1], - norm_dir2, res_a) - else : - k = (q * v1 - (ray_orig[2] - lpolyy[jj])) * invuz - if k >= 0.: - # There is an intersection - res_final[0] = Cnan - res_final[1] = Cnan - return # no need to continue - else: - # The closest point on the LOS is its origin - res_a[0] = 0 - res_a[1] = -k * Csqrt(norm_dir2) - if (res_final[1] - res_a[1] > _VSMALL - or (res_final[1] == res_a[1] - and res_final[0] - res_a[0] > _VSMALL)): - res_final[0] = res_a[0] # k - res_final[1] = res_a[1] # distance - # Second solution - q = (-val_b - sqd) / val_a - if q < 0: - # Then we only need to compute distance to circle C_A - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj], lpolyy[jj], - norm_dir2, res_b) - elif q > 1: - # Then we only need to compute distance to circle C_B - dist_los_circle_core(ray_vdir, ray_orig, - lpolyx[jj+1], lpolyy[jj+1], - norm_dir2, res_b) - else: - k = (q * v1 - (ray_orig[2] - lpolyy[jj])) * invuz - if k>=0.: - # there is an intersection - res_final[0] = Cnan - res_final[1] = Cnan - return # no need to continue - else: - # The closest point on the LOS is its origin - res_b[0] = 0 - res_b[1] = -k * Csqrt(norm_dir2) - if (res_final[1] - res_b[1] > _VSMALL - or (res_final[1] == res_b[1] - and res_final[0] - res_b[0] > _VSMALL)): - res_final[0] = res_b[0] - res_final[1] = res_b[1] - res_final[0] = res_final[0] / norm_dir2_ori - return - -# ============================================================================== -# == ARE LOS AND EXT-POLY CLOSE -# ============================================================================== -cdef inline void is_close_los_vpoly_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - double epsilon, - int[::1] are_close, - int num_threads) nogil: - """ - This function computes the distance (and the associated k) between nlos - Rays (or LOS) and several `IN` structures (polygons extruded around the axis - (0,0,1), eg. flux surfaces). - For more details on the algorithm please see PDF: .pdf #TODO - - Params - ====== - num_poly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces. - WARNING : we suppose all poly are nested in each other, - and the first one is the smallest one - epsilon : double - Value for testing if distance < epsilon - eps_ : double - Small value, acceptance of error - Returns - ======= - are_close : (npoly * num_los) bool array - `are_close[i * num_poly + j]` indicates if distance between i-th LOS - and j-th poly are closer than epsilon. (True if distancemalloc(3*sizeof(double)) - loc_org = malloc(3*sizeof(double)) - loc_res = malloc(2*sizeof(double)) - # == The parallelization over the LOS ================================== - for ind_los in prange(nlos, schedule='dynamic'): - for i in range(3): - loc_dir[i] = ray_vdir[ind_los * 3 + i] - loc_org[i] = ray_orig[ind_los * 3 + i] - # -- Computing values that depend on the LOS/ray ------------------- - upscaDp = loc_dir[0]*loc_org[0] + loc_dir[1]*loc_org[1] - upar2 = loc_dir[0]*loc_dir[0] + loc_dir[1]*loc_dir[1] - dpar2 = loc_org[0]*loc_org[0] + loc_org[1]*loc_org[1] - invuz = 1./loc_dir[2] - crit2 = upar2*crit2_base - # -- Looping over each flux surface--------------------------------- - for ind_pol in range(num_poly): - npts_poly = ves_poly[ind_pol].shape[1] - simple_dist_los_vpoly_core(loc_org, loc_dir, - &ves_poly[ind_pol][0][0], - &ves_poly[ind_pol][1][0], - npts_poly, upscaDp, - upar2, dpar2, - invuz, crit2, - eps_uz, eps_vz, - eps_a, eps_b, - loc_res) - if loc_res[1] < epsilon: - are_close[ind_los * num_poly + ind_pol] = 1 - elif loc_res[1] == loc_res[1]: # is nan - continue - free(loc_dir) - free(loc_org) - free(loc_res) - return - -# ============================================================================== -# == WHICH LOS/VPOLY IS CLOSER -# ============================================================================== -cdef inline void which_los_closer_vpoly_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - int[::1] ind_close_tab, - int num_threads) nogil: - """ - Params - ====== - num_poly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces. - WARNING : we suppose all poly are nested in each other, - and the first one is the smallest one - eps_ : double - Small value, acceptance of error - Returns - ======= - ind_close_tab : (npoly) int array - Of the form [ind_0, ind_1, ..., ind_(npoly-1)] - where ind_i is the coefficient for the i-th flux surface - such that the ind_i-th ray (LOS) is closest to the extruded polygon - among all other LOS without going over it. - --- - This is the CYTHON function, use only if you need this computation from - Cython, if you need it from Python, use `comp_dist_los_vpoly_vec` - """ - cdef int i, ind_los, ind_pol, ind_pol2, indloc - cdef int npts_poly - cdef double* loc_res - cdef double* loc_dir - cdef double* loc_org - cdef double loc_dist - cdef double* lpolyx - cdef double* lpolyy - cdef double crit2, invuz, dpar2, upar2, upscaDp - cdef double crit2_base = eps_uz * eps_uz /400. - cdef double* dist = malloc(sizeof(double)*num_poly*nlos) - - for indloc in range(num_poly): - ind_close_tab[indloc] = -1 - comp_dist_los_vpoly_vec_core(num_poly, nlos, - ray_orig, - ray_vdir, - ves_poly, - eps_uz, eps_a, - eps_vz, eps_b, - eps_plane, - True, #ves_type is Tor - 0, #algo_type is Simple - NULL, dist, - 0.01, - num_threads) - - # We use local arrays for each thread so... - for ind_pol in range(num_poly): - loc_dist = 100000000. - for ind_los in range(nlos): - if (dist[ind_los*num_poly + ind_pol] < loc_dist): - ind_close_tab[ind_pol] = ind_los - loc_dist = dist[ind_los*num_poly + ind_pol] - free(dist) - return - -cdef inline void which_vpoly_closer_los_vec_core(int num_poly, int nlos, - double* ray_orig, - double* ray_vdir, - double[:,:,::1] ves_poly, - double eps_uz, - double eps_a, - double eps_vz, - double eps_b, - double eps_plane, - int[::1] ind_close_tab, - int num_threads) nogil: - """ - Params - ====== - num_poly : int - Number of flux surfaces - nlos : int - Number of LOS - ray_orig : (3, nlos) double array - LOS origin points coordinates - ray_vdir : (3, nlos) double array - LOS normalized direction vector - ves_poly : (num_pol, 2, num_vertex) double array - Coordinates of the vertices of the Polygon defining the 2D poloidal - cut of the different IN surfaces. - WARNING : we suppose all poly are nested in each other, - and the first one is the smallest one - eps_ : double - Small value, acceptance of error - Returns - ======= - ind_close_los : (nlos) int array - Of the form [ind_0, ind_1, ..., ind_(nlos-1)] - where ind_i is the coefficient for the i-th LOS (ray) - such that the ind_i-th poly (flux surface) is closest to the LOS - among all other poly without going over it. - --- - This is the CYTHON function, use only if you need this computation from - Cython, if you need it from Python, use `comp_dist_los_vpoly_vec` - """ - cdef int i, ind_los, ind_pol, ind_pol2, indloc - cdef int npts_poly - cdef double* loc_res - cdef double* loc_dir - cdef double* loc_org - cdef double* lpolyx - cdef double* lpolyy - cdef double crit2, invuz, dpar2, upar2, upscaDp - cdef double crit2_base = eps_uz * eps_uz /400. - - # initialization ............................................... - for indloc in range(nlos): - ind_close_tab[indloc] = num_poly-1 - - # == Defining parallel part ================================================ - with nogil, parallel(num_threads=num_threads): - # We use local arrays for each thread so... - loc_dir = malloc(3*sizeof(double)) - loc_org = malloc(3*sizeof(double)) - loc_res = malloc(2*sizeof(double)) - # == The parallelization over the LOS ================================== - for ind_los in prange(nlos, schedule='dynamic'): - for i in range(3): - loc_dir[i] = ray_vdir[ind_los * 3 + i] - loc_org[i] = ray_orig[ind_los * 3 + i] - # -- Computing values that depend on the LOS/ray ------------------- - upscaDp = loc_dir[0]*loc_org[0] + loc_dir[1]*loc_org[1] - upar2 = loc_dir[0]*loc_dir[0] + loc_dir[1]*loc_dir[1] - dpar2 = loc_org[0]*loc_org[0] + loc_org[1]*loc_org[1] - invuz = 1./loc_dir[2] - crit2 = upar2*crit2_base - # -- Looping over each flux surface--------------------------------- - for ind_pol in range(num_poly): - npts_poly = ves_poly[ind_pol].shape[1] - simple_dist_los_vpoly_core(loc_org, loc_dir, - &ves_poly[ind_pol][0][0], - &ves_poly[ind_pol][1][0], - npts_poly, upscaDp, - upar2, dpar2, - invuz, crit2, - eps_uz, eps_vz, - eps_a, eps_b, - loc_res) - # filling the array when nan found ............................. - if not loc_res[1] == loc_res[1]: - #the closer poly is the one just before - ind_close_tab[ind_los] = ind_pol-1 - continue - free(loc_dir) - free(loc_org) - free(loc_res) - return diff --git a/tofu/geom/_fast_sum.c b/tofu/geom/_fast_sum.c deleted file mode 100644 index 3d4c5a7af..000000000 --- a/tofu/geom/_fast_sum.c +++ /dev/null @@ -1,56 +0,0 @@ -// C - algorithm for fast sum of a matrix (similar to np.sum(), sum row by row) -#include // for size_t - -#define MAX 8 -void sum_rows_blocks(double *orig, double *out, int n_rows, int n_cols){ - int n_blocks=n_rows/MAX; - int b; - int j; - int i; - for (b=0; b - coordinates of the lowerleftback point and of the upperrightfront point - of the bounding box of the polygon - """ - cdef int ii - cdef double xmax=vertx[0], xmin=vertx[0] - cdef double ymax=verty[0], ymin=verty[0] - cdef double zmax=vertz[0], zmin=vertz[0] - cdef double tmp_val - for ii in range(1, nvert): - # x.... - tmp_val = vertx[ii] - if tmp_val > xmax: - xmax = tmp_val - elif tmp_val < xmin : - xmin = tmp_val - # y.... - tmp_val = verty[ii] - if tmp_val > ymax: - ymax = tmp_val - elif tmp_val < ymin : - ymin = tmp_val - # z.... - tmp_val = vertz[ii] - if tmp_val > zmax: - zmax = tmp_val - elif tmp_val < zmin : - zmin = tmp_val - bounds[0] = xmin - bounds[1] = ymin - bounds[2] = zmin - bounds[3] = xmax - bounds[4] = ymax - bounds[5] = zmax - return - -# ============================================================================== -# = Computation of Bounding Boxes (in toroidal configuration) -# ============================================================================== -cdef inline void comp_bbox_poly_tor(const int nvert, - const double* vertr, - const double* vertz, - double[6] bounds) nogil: - """ - Computes bounding box of a toroidally continous structure defined by - the vertices vert. - Params - ===== - nvert : integer - Number of vertices in the poygon - vert : double array - Coordinates of the polygon defining the structure in the poloidal - plane such that vert[0:3, ii] = (x_i, y_i) the coordinates of the - i-th vertex - bounds : (6) double array - coordinates of the lowerleftback point and of the upperrightfront - point of the bounding box of the structure toroidally continous on - the tore. - """ - cdef int ii - cdef double rmax=vertr[0], zmin=vertz[0], zmax=vertz[0] - cdef double tmp_val - for ii in range(1, nvert): - tmp_val = vertr[ii] - if tmp_val > rmax: - rmax = tmp_val - tmp_val = vertz[ii] - if tmp_val > zmax: - zmax = tmp_val - elif tmp_val < zmin: - zmin = tmp_val - bounds[0] = -rmax - bounds[1] = -rmax - bounds[2] = zmin - bounds[3] = rmax - bounds[4] = rmax - bounds[5] = zmax - return - -cdef inline void comp_bbox_poly_tor_lim(const int nvert, - const double* vertr, - const double* vertz, - double[6] bounds, - const double lmin, - const double lmax) nogil: - """ - Computes bounding box of a toroidally limited structure defined by - the vertices vert, and limited to the angles (lmin, lmax) - Params - ===== - nvert : integer - Number of vertices in the poygon - vert : double array - Coordinates of the polygon defining the structure in the poloidal plane - such that vert[0:3, ii] = (x_i, y_i) the coordinates of the i-th vertex - bounds : (6) double array - coordinates of the lowerleftback point and of the upperrightfront point - of the bounding box of the structure toroidally limited on the tore. - lmin : double - minimum toroidal angle where the structure lays. - lmax : double - maximum toroidal angle where the structure lays. - """ - cdef int ii - cdef double toto=100000. - cdef double xmin=toto, xmax=-toto - cdef double ymin=toto, ymax=-toto - cdef double zmin=toto, zmax=-toto - cdef double cos_min, sin_min - cdef double cos_max, sin_max - cdef double half_pi = 0.5 * Cpi - cdef double[3] temp - cdef double[6] bounds_min - # ... - cos_min = Ccos(lmin) - sin_min = Csin(lmin) - cos_max = Ccos(lmax) - sin_max = Csin(lmax) - if (lmin >= 0.) and (lmax >= 0.): - if lmax > half_pi and lmin < half_pi: - comp_bbox_poly_tor(nvert, vertr, vertz, &bounds_min[0]) - if ymax < bounds_min[4]: - ymax = bounds_min[4] - elif lmax < half_pi and lmin > half_pi: - comp_bbox_poly_tor(nvert, vertr, vertz, &bounds_min[0]) - if ymin > bounds_min[1]: - ymin = bounds_min[1] - elif (lmin <= 0 and lmax <= 0): - if lmax < -half_pi and lmin > -half_pi: - comp_bbox_poly_tor(nvert, vertr, vertz, &bounds_min[0]) - if ymin > bounds_min[1]: - ymin = bounds_min[1] - elif lmax > -half_pi and lmin < -half_pi: - comp_bbox_poly_tor(nvert, vertr, vertz, &bounds_min[0]) - if ymax < bounds_min[4]: - ymax = bounds_min[4] - elif (Cabs(Cabs(lmin) - Cpi) > _VSMALL - and Cabs(Cabs(lmax) - Cpi) > _VSMALL): - if lmin >= 0 : - # lmin and lmax of opposite signs, so lmax < 0. Divide and conquer: - comp_bbox_poly_tor_lim(nvert, vertr, vertz, &bounds[0], lmin, Cpi) - comp_bbox_poly_tor_lim(nvert, vertr, vertz, &bounds_min[0], - -Cpi, lmax) - else: - # lmin and lmax of opposite signs, so lmax <= 0. Divide and conquer: - comp_bbox_poly_tor_lim(nvert, vertr, vertz, &bounds[0], lmin, -0.0) - comp_bbox_poly_tor_lim(nvert, vertr, vertz, &bounds_min[0], 0, lmax) - # we compute the extremes of the two boxes: - for ii in range(3): - if bounds[ii] > bounds_min[ii]: - bounds[ii] = bounds_min[ii] - for ii in range(3, 6): - if bounds[ii] < bounds_min[ii]: - bounds[ii] = bounds_min[ii] - return - for ii in range(nvert): - temp[0] = vertr[ii] - temp[1] = vertz[ii] - coordshift_simple1d(temp, False, 1., cos_min, sin_min) - # initialization: - if xmin > temp[0]: - xmin = temp[0] - if xmax < temp[0]: - xmax = temp[0] - if ymin > temp[1]: - ymin = temp[1] - if ymax < temp[1]: - ymax = temp[1] - if zmin > temp[2]: - zmin = temp[2] - if zmax < temp[2]: - zmax = temp[2] - # ..... - temp[0] = vertr[ii] - temp[1] = vertz[ii] - coordshift_simple1d(temp, False, 1., cos_max, sin_max) - if xmin > temp[0]: - xmin = temp[0] - if xmax < temp[0]: - xmax = temp[0] - if ymin > temp[1]: - ymin = temp[1] - if ymax < temp[1]: - ymax = temp[1] - if zmin > temp[2]: - zmin = temp[2] - if zmax < temp[2]: - zmax = temp[2] - bounds[0] = xmin - bounds[1] = ymin - bounds[2] = zmin - bounds[3] = xmax - bounds[4] = ymax - bounds[5] = zmax - return - -cdef inline void coordshift_simple1d(double[3] pts, bint in_is_cartesian, - double CrossRef, double cos_phi, - double sin_phi) nogil: - """ - Similar to coordshift but only pas from 3D cartesian to 3D toroidal - coordinates or vice-versa. - """ - cdef double x, y, z - cdef double r, p - if in_is_cartesian: - if CrossRef==0.: - x = pts[0] - y = pts[1] - z = pts[2] - pts[0] = Csqrt(x*x+y*y) - pts[1] = z - pts[2] = Catan2(y,x) - else: - x = pts[0] - y = pts[1] - z = pts[2] - pts[0] = Csqrt(x*x+y*y) - pts[1] = z - pts[2] = CrossRef - else: - if CrossRef==0.: - r = pts[0] - z = pts[1] - p = pts[2] - pts[0] = r*Ccos(p) - pts[1] = r*Csin(p) - pts[2] = z - else: - r = pts[0] - z = pts[1] - pts[0] = r*cos_phi - pts[1] = r*sin_phi - pts[2] = z - return - - -cdef inline void is_inside_vessel(double[:, ::1] pts, double[:, ::1] ves_poly, - double[:,::1] ves_lims, int nlim, - bint is_toroidal, bint in_is_cartesian, - int[3] order, - int[::1] is_inside) nogil: - """ - check if points are inside given vessel - pts : points to check if inside - ves_poly : (2, nvert) array defining polygon of the vessel - ves_lims : (2, nlim) limits of the vessel, None if contiguous - nlim : number of limits - is_toroidal : true if vessel is toroidal - in_is_cartesian : true if pts coordinates are given in cartesian coordinates - order : order where the coordinates are stored, for example : - - (x,y,z) => order = (0, 1, 2) - - (z,x,y) => order = (1, 2, 0) - - (r, z, phi) => order = (0, 1, 2) - - (z, r, phi) => order = (1, 0, 2) - is_inside : result, array of bools of size npts - """ - cdef int ii, jj - cdef int fst - cdef int npts = pts.shape[1] - cdef int nvert = ves_poly.shape[1] - 1 - cdef double[3] shift_pts - cdef double[2] lims - cdef double rii, zii, pii - cdef bint in_ves - # -------------------------------------------------------------------------- - if is_toroidal: - if ves_lims is None or nlim == 0: - if in_is_cartesian: - for ii in range(npts): - shift_pts[0] = pts[order[0], ii] - shift_pts[1] = pts[order[1], ii] - shift_pts[2] = pts[order[2], ii] - coordshift_simple1d(shift_pts, in_is_cartesian, - -1, # we dont care about phi - -1, -1) # no need for these args - is_inside[ii] = is_point_in_path(nvert, - &ves_poly[0][0], - &ves_poly[1][0], - shift_pts[0], shift_pts[1]) - else: - is_point_in_path_vec(nvert, &ves_poly[0][0], &ves_poly[1][0], - npts, &pts[order[0]][0], &pts[order[1]][0], - &is_inside[0]) - else: - # -- There are limits ---------------------------------------------- - if in_is_cartesian: - for jj in range(nlim): - fst = jj * npts - lims[0] = Catan2(Csin(ves_lims[jj][0]), - Ccos(ves_lims[jj][0])) - lims[1] = Catan2(Csin(ves_lims[jj][1]), - Ccos(ves_lims[jj][1])) - if lims[0] < lims[1]: - for ii in range(npts): - shift_pts[0] = pts[order[0], ii] - shift_pts[1] = pts[order[1], ii] - shift_pts[2] = pts[order[2], ii] - coordshift_simple1d(shift_pts, in_is_cartesian, - 0, # we need to compute phi - -1, -1) # no need for these args - in_ves = is_point_in_path(nvert, - &ves_poly[0][0], - &ves_poly[1][0], - shift_pts[0], - shift_pts[1]) - is_inside[fst + ii] = (in_ves - & (shift_pts[2]>=lims[0]) - & (shift_pts[2]<=lims[1])) - else: - for ii in range(npts): - shift_pts[0] = pts[order[0], ii] - shift_pts[1] = pts[order[1], ii] - shift_pts[2] = pts[order[2], ii] - coordshift_simple1d(shift_pts, in_is_cartesian, - 0, # we need to compute phi - -1, -1) # no need for these args - in_ves = is_point_in_path(nvert, - &ves_poly[0][0], - &ves_poly[1][0], - shift_pts[0], - shift_pts[1]) - is_inside[fst + ii] = (in_ves - & ((shift_pts[2]>=lims[0]) - | (shift_pts[2]<=lims[1]))) - else: - # -- in coordinates: polar ------------------------------------- - for jj in range(nlim): - fst = jj * npts - lims[0] = Catan2(Csin(ves_lims[jj][0]), - Ccos(ves_lims[jj][0])) - lims[1] = Catan2(Csin(ves_lims[jj][1]), - Ccos(ves_lims[jj][1])) - if lims[0] < lims[1]: - for ii in range(npts): - rii = pts[order[0],ii] - zii = pts[order[1],ii] - pii = Catan2(Csin(pts[order[2],ii]), - Ccos(pts[order[2],ii])) - in_ves = is_point_in_path(nvert, - &ves_poly[0][0], - &ves_poly[1][0], - rii, zii) - is_inside[fst + ii] = (in_ves - & (pii>=lims[0]) - & (pii<=lims[1])) - else: - for ii in range(npts): - rii = pts[order[0],ii] - zii = pts[order[1],ii] - pii = Catan2(Csin(pts[order[2],ii]), - Ccos(pts[order[2],ii])) - in_ves = is_point_in_path(nvert, - &ves_poly[0][0], - &ves_poly[1][0], - rii, zii) - is_inside[fst + ii] = (in_ves - & ((pii>=lims[0]) - | (pii<=lims[1]))) - else: - # -- Cylindrical case -------------------------------------------------- - if in_is_cartesian: - for jj in range(nlim): - fst = jj * npts - for ii in range(npts): - in_ves = is_point_in_path(nvert, - &ves_poly[0][0], - &ves_poly[1][0], - pts[order[1],ii], - pts[order[2],ii]) - is_inside[fst + ii] = (in_ves - & (pts[order[0],ii]>=ves_lims[0][0]) - & (pts[order[0],ii]<=ves_lims[0][1])) - else: - # polar coordinates - for jj in range(nlim): - fst = jj * npts - for ii in range(npts): - shift_pts[0] = pts[order[0], ii] - shift_pts[1] = pts[order[1], ii] - shift_pts[2] = pts[order[2], ii] - coordshift_simple1d(shift_pts, in_is_cartesian, - 0, # we need to compute phi - -1, -1) # no need for these args - in_ves = is_point_in_path(nvert, - &ves_poly[0][0], - &ves_poly[1][0], - shift_pts[1], - shift_pts[2]) - is_inside[fst + ii] = (in_ves - & (shift_pts[0]>=ves_lims[0][0]) - & (shift_pts[0]<=ves_lims[0][1])) - return - - - - - -# ============================================================================== -# = Raytracing basic tools: intersection ray and axis aligned bounding box -# ============================================================================== -cdef inline bint inter_ray_aabb_box(const int[3] sign, - const double[3] inv_direction, - const double* bounds, - const double[3] ds, - const bint countin) nogil: - """ - Computes intersection between a ray (LOS) and a axis aligned bounding - box. It returns True if ray intersects box, else False. - Params - ===== - sign : (3) int array - Sign of the direction of the ray. - If sign[i] = 1, ray_vdir[i] < 0, else sign[i] = 0 - inv_direction : (3) double array - Inverse on each axis of direction of LOS - bounds : (6) double array - [3d coords of lowerleftback point of bounding box, - 3d coords of upperrightfront point of bounding box] - ds : (3) double array - [3d coords of origin of ray] - Returns - ======= - True if ray intersects bounding box, else False - """ - cdef double tmin, tmax, tymin, tymax - cdef double tzmin, tzmax - cdef int t0 = 1000000 - cdef bint res - - # computing intersection - tmin = (bounds[sign[0]*3] - ds[0]) * inv_direction[0] - tmax = (bounds[(1-sign[0])*3] - ds[0]) * inv_direction[0] - tymin = (bounds[(sign[1])*3 + 1] - ds[1]) * inv_direction[1] - tymax = (bounds[(1-sign[1])*3+1] - ds[1]) * inv_direction[1] - if ( (tmin > tymax) or (tymin > tmax) ): - return 0 - if (tymin > tmin): - tmin = tymin - if (tymax < tmax): - tmax = tymax - if not inv_direction[2] == 1./_VSMALL: - tzmin = (bounds[(sign[2])*3+2] - ds[2]) * inv_direction[2] - tzmax = (bounds[(1-sign[2])*3+2] - ds[2]) * inv_direction[2] - else: - tzmin = Cnan - tzmax = Cnan - if ( (tmin > tzmax) or (tzmin > tmax) ): - return 0 - if (tzmin > tmin): - tmin = tzmin - if (tzmax < tmax): - tmax = tzmax - if countin and (tmin < 0.) and (tmax < 0.): - return 0 - elif not countin and tmin < 0: - return 0 - - res = (tmin < t0) and (tmax > -t0) - return res - - -# ============================================================================== -# = Raytracing basic tools: intersection ray and triangle (in 3d space) -# ============================================================================== -cdef inline bint inter_ray_triangle(const double[3] ray_orig, - const double[3] ray_vdir, - const double* vert0, - const double* vert1, - const double* vert2) nogil: - cdef int ii - cdef double det, invdet, u, v - cdef double[3] edge1, edge2 - cdef double[3] pvec, tvec, qvec - #... - for ii in range(3): - edge1[ii] = vert1[ii] - vert0[ii] - edge2[ii] = vert2[ii] - vert0[ii] - # begin calculating determinant also used to calculate U parameter - _bgt.compute_cross_prod(ray_vdir, edge2, pvec) - # if determinant is near zero ray lies in plane of triangle - det = _bgt.compute_dot_prod(edge1, pvec) - if Cabs(det) < _VSMALL: - return False - invdet = 1./det - # calculate distance from vert to ray origin - for ii in range(3): - tvec[ii] = ray_orig[ii] - vert0[ii] - # calculate U parameter and test bounds - u = _bgt.compute_dot_prod(tvec, pvec) * invdet - if u < 0. or u > 1.: - return False - # prepare to test V parameter - _bgt.compute_cross_prod(tvec, edge1, qvec) - # calculate V parameter and test bounds - v = _bgt.compute_dot_prod(ray_vdir, qvec) * invdet - if v < 0. or u + v > 1.: - return False - return True - -# ============================================================================== -# = Raytracing on a Torus -# ============================================================================== -cdef inline void raytracing_inout_struct_tor(const int num_los, - const double[:,::1] ray_vdir, - const double[:,::1] ray_orig, - double[::1] coeff_inter_out, - double[::1] coeff_inter_in, - double[::1] vperp_out, - const long[::1] lstruct_nlim, - int[::1] ind_inter_out, - const bint forbid0, - const bint forbidbis_org, - const double rmin, - const double rmin2, - const double crit2_base, - const int nstruct_lim, - const double* lbounds, - const double* langles, - const int* lis_limited, - const long* lnvert, - const long* lsz_lim, - const double* lstruct_polyx, - const double* lstruct_polyy, - const double* lstruct_normx, - const double* lstruct_normy, - const double eps_uz, - const double eps_vz, - const double eps_a, - const double eps_b, - const double eps_plane, - const int num_threads, - const bint is_out_struct) nogil: - """ - Computes the entry and exit point of all provided LOS/rays for a set of - structures that can be of type "OUT" (is_out_struct=True) or "IN" - (is_out_struct=False) in a TORE. An "OUT" structure cannot be penetrated - whereas an "IN" structure can. The latter is typically a vessel and are - toroidally continous. If a structure is limited we can determine the number - of limits and the limits itself. For optimization reasons we will also pass - the bounding box limits. And the information of the last intersected point, - if any. - This functions is parallelized. - - Params - ====== - num_los : int - Total number of lines of sight (LOS) (aka. rays) - ray_vdir : (3, num_los) double array - LOS normalized direction vector - ray_orig : (3, num_los) double array - LOS origin points coordinates - coeff_inter_out : (num_los) double array - Coefficient of exit (kout) of the last point of intersection for each LOS - with the global geometry (with ALL structures) - coeff_inter_in : (num_los) double array - Coefficient of entry (kin) of the last point of intersection for each LOS - with the global geometry (with ALL structures). If intersection at origin - k = 0, if no intersection k = NAN - vperp_out : (3*num_los) double array - Coordinates of the normal vector of impact of the LOS (0 if none). It is - stored in the following way [v_{0,x}, v_{0,y}, v_{0,z}, ..., v_{n-1,z}] - lstruct_nlim : array of ints - List of number of limits for all structures - ind_inter_out : (3 * num_los) - Index of structure impacted by LOS such that: - ind_inter_out[ind_los*3:ind_los*3+3]=(i,j,k) - where k is the index of edge impacted on the j-th sub structure of the - structure number i. If the LOS impacted the vessel i=j=0 - forbid0 : bool - Should we forbid values behind visible radius ? (see Rmin). If false, - will test "hidden" part always, else, it will depend on the LOS and - on forbidbis. - forbidbis: bint - Should we forbid values behind visible radius for each LOS ? - rmin : double - Minimal radius of vessel to take into consideration - rmin2 : double - Squared valued of the minimal radius - crit2_base : double - Critical value to evaluate for each LOS if horizontal or not - nstruct_lim : int - Number of OUT structures (not counting the limited versions). - If not is_out_struct then length of vpoly. - lbounds : (6 * nstruct) double array - Coordinates of lower and upper edges of the bounding box for each - structures (nstruct = sum_i(nstruct_lim * lsz_lim[i]) - If not is_out_struct then NULL - langles : (2 * nstruct) double array - Minimum and maximum angles where the structure lives. If the structure - number 'i' is toroidally continous then langles[i:i+2] = [0, 0]. - lis_limited : (nstruct) int array - List of bool to know if the structures (or the vessel) is limited or not. - lnvert : (nstruct_lim) int array - List of vertices of each polygon for each structure - If not is_out_struct then NULL - lsz_lim : (nstruct) int array - List of the total number of structures before the ith structure. First - element is always 0, else lsz_lim[i] = sum_j(lstruct_nlim[j], j=0..i-1) - If not is_out_struct then NULL - lstruct_polyx : (ntotnvert) - List of "x" coordinates of the polygon's vertices of all structures on - the poloidal plane - lstruct_polyy : (ntotnvert) - List of "y" coordinates of the polygon's vertices of all structures on - the poloidal plane - lstruct_normx : (2, num_vertex-1) double array - List of "x" coordinates of the normal vectors going "inwards" of the - edges of the Polygon defined by lstruct_poly - lstruct_normy : (2, num_vertex-1) double array - List of "y" coordinates of the normal vectors going "inwards" of the - edges of the Polygon defined by lstruct_poly - eps : double - Small value, acceptance of error - num_threads : int - The num_threads argument indicates how many threads the team should - consist of. If not given, OpenMP will decide how many threads to use. - Typically this is the number of cores available on the machine. - is_out_struct : bint - Bool to determine if the structure is "OUT" or "IN". An "OUT" structure - cannot be penetrated whereas an "IN" structure can. The latter is - typically a vessel and are toroidally continous. - """ - cdef double upscaDp=0., upar2=0., dpar2=0., crit2=0., idpar2=0. - cdef double dist = 0., s1x = 0., s1y = 0., s2x = 0., s2y = 0. - cdef double lim_min=0., lim_max=0., invuz=0. - cdef int totnvert=0 - cdef int nvert - cdef int ind_struct, ind_bounds - cdef int ind_los, ii, jj, kk - cdef bint lim_is_none - cdef bint found_new_kout - cdef bint inter_bbox - cdef bint forbidbis = forbidbis_org - cdef double* last_pout = NULL - cdef double* kpout_loc = NULL - cdef double* kpin_loc = NULL - cdef double* invr_ray = NULL - cdef double* loc_org = NULL - cdef double* loc_dir = NULL - cdef double* lim_ves = NULL - cdef double* loc_vp = NULL - cdef int* sign_ray = NULL - cdef int* ind_loc = NULL - - # == Defining parallel part ================================================ - with nogil, parallel(num_threads=num_threads): - # We use local arrays for each thread so - loc_org = malloc(sizeof(double) * 3) - loc_dir = malloc(sizeof(double) * 3) - loc_vp = malloc(sizeof(double) * 3) - kpin_loc = malloc(sizeof(double) * 1) - kpout_loc = malloc(sizeof(double) * 1) - ind_loc = malloc(sizeof(int) * 1) - if is_out_struct: - # if the structure is "out" (solid) we need more arrays - last_pout = malloc(sizeof(double) * 3) - invr_ray = malloc(sizeof(double) * 3) - lim_ves = malloc(sizeof(double) * 2) - sign_ray = malloc(sizeof(int) * 3) - - # == The parallelization over the LOS ================================== - for ind_los in prange(num_los, schedule='dynamic'): - ind_struct = 0 - loc_org[0] = ray_orig[0, ind_los] - loc_org[1] = ray_orig[1, ind_los] - loc_org[2] = ray_orig[2, ind_los] - loc_dir[0] = ray_vdir[0, ind_los] - loc_dir[1] = ray_vdir[1, ind_los] - loc_dir[2] = ray_vdir[2, ind_los] - loc_vp[0] = 0. - loc_vp[1] = 0. - loc_vp[2] = 0. - if is_out_struct: - # if structure is of "Out" type, then we compute the last - # point where it went out of a structure. - ind_loc[0] = ind_inter_out[2+3*ind_los] - kpin_loc[0] = coeff_inter_out[ind_los] - last_pout[0] = kpin_loc[0] * loc_dir[0] + loc_org[0] - last_pout[1] = kpin_loc[0] * loc_dir[1] + loc_org[1] - last_pout[2] = kpin_loc[0] * loc_dir[2] + loc_org[2] - compute_inv_and_sign(loc_dir, sign_ray, invr_ray) - else: - kpout_loc[0] = 0 - kpin_loc[0] = 0 - ind_loc[0] = 0 - - # -- Computing values that depend on the LOS/ray ------------------- - upscaDp = loc_dir[0]*loc_org[0] + loc_dir[1]*loc_org[1] - upar2 = loc_dir[0]*loc_dir[0] + loc_dir[1]*loc_dir[1] - dpar2 = loc_org[0]*loc_org[0] + loc_org[1]*loc_org[1] - idpar2 = 1./dpar2 - invuz = 1./loc_dir[2] - crit2 = upar2*crit2_base - - # -- Prepare in case forbid is True -------------------------------- - if forbid0 and not dpar2>0: - forbidbis = 0 - if forbidbis: - # Compute coordinates of the 2 points where the tangents touch - # the inner circle - dist = Csqrt(dpar2-rmin2) - s1x = (rmin2 * loc_org[0] + rmin * loc_org[1] * dist) * idpar2 - s1y = (rmin2 * loc_org[1] - rmin * loc_org[0] * dist) * idpar2 - s2x = (rmin2 * loc_org[0] - rmin * loc_org[1] * dist) * idpar2 - s2y = (rmin2 * loc_org[1] + rmin * loc_org[0] * dist) * idpar2 - - # == Case "OUT" structure ========================================== - if is_out_struct: - # We work on each structure - for ii in range(nstruct_lim): - # -- Getting structure's data ------------------------------ - if ii == 0: - nvert = lnvert[0] - totnvert = 0 - else: - totnvert = lnvert[ii-1] - nvert = lnvert[ii] - totnvert - ind_struct = lsz_lim[ii] - # -- Working on the structure limited ---------------------- - for jj in range(lstruct_nlim[ii]): - lim_min = langles[(ind_struct+jj)*2] - lim_max = langles[(ind_struct+jj)*2 + 1] - lim_is_none = lis_limited[ind_struct+jj] == 1 - # We test if it is really necessary to compute the inter - # ie. we check if the ray intersects the bounding box - - inter_bbox = inter_ray_aabb_box(sign_ray, invr_ray, - &lbounds[(ind_struct - + jj)*6], - loc_org, - True) - if not inter_bbox: - continue - # We check that the bounding box is not "behind" - # the last POut encountered - inter_bbox = inter_ray_aabb_box(sign_ray, invr_ray, - &lbounds[(ind_struct - + jj)*6], - last_pout, False) - if inter_bbox: - continue - # Else, we compute the new values - found_new_kout \ - = comp_inter_los_vpoly(loc_org, - loc_dir, - &lstruct_polyx[totnvert], - &lstruct_polyy[totnvert], - &lstruct_normx[totnvert-ii], - &lstruct_normy[totnvert-ii], - nvert-1, - lim_is_none, - lim_min, lim_max, - forbidbis, - upscaDp, upar2, - dpar2, invuz, - s1x, s1y, - s2x, s2y, - crit2, eps_uz, - eps_vz, eps_a, - eps_b, eps_plane, - False, - kpin_loc, - kpout_loc, - ind_loc, - loc_vp) - if found_new_kout : - coeff_inter_out[ind_los] = kpin_loc[0] - vperp_out[0+3*ind_los] = loc_vp[0] - vperp_out[1+3*ind_los] = loc_vp[1] - vperp_out[2+3*ind_los] = loc_vp[2] - ind_inter_out[2+3*ind_los] = ind_loc[0] - ind_inter_out[0+3*ind_los] = 1+ii - ind_inter_out[1+3*ind_los] = jj - last_pout[0] = (coeff_inter_out[ind_los] * - loc_dir[0]) + loc_org[0] - last_pout[1] = (coeff_inter_out[ind_los] * - loc_dir[1]) + loc_org[1] - last_pout[2] = (coeff_inter_out[ind_los] * - loc_dir[2]) + loc_org[2] - else: - # == Case "IN" structure ======================================= - # Nothing to do but compute intersection between vessel and LOS - found_new_kout = comp_inter_los_vpoly(loc_org, loc_dir, - lstruct_polyx, - lstruct_polyy, - lstruct_normx, - lstruct_normy, - nstruct_lim, - lis_limited[0], - langles[0], langles[1], - forbidbis, - upscaDp, upar2, - dpar2, invuz, - s1x, s1y, s2x, s2y, - crit2, eps_uz, eps_vz, - eps_a,eps_b, eps_plane, - True, - kpin_loc, kpout_loc, - ind_loc, loc_vp) - if found_new_kout: - coeff_inter_in[ind_los] = kpin_loc[0] - coeff_inter_out[ind_los] = kpout_loc[0] - ind_inter_out[2+3*ind_los] = ind_loc[0] - ind_inter_out[0+3*ind_los] = 0 - ind_inter_out[1+3*ind_los] = 0 - vperp_out[0+3*ind_los] = loc_vp[0] - vperp_out[1+3*ind_los] = loc_vp[1] - vperp_out[2+3*ind_los] = loc_vp[2] - - else: - coeff_inter_in[ind_los] = Cnan - coeff_inter_out[ind_los] = Cnan - ind_inter_out[2+3*ind_los] = 0 - ind_inter_out[0+3*ind_los] = 0 - ind_inter_out[1+3*ind_los] = 0 - vperp_out[0+3*ind_los] = 0. - vperp_out[1+3*ind_los] = 0. - vperp_out[2+3*ind_los] = 0. - # end case IN/OUT - free(loc_org) - free(loc_dir) - free(loc_vp) - free(kpin_loc) - free(kpout_loc) - free(ind_loc) - if is_out_struct: - free(last_pout) - free(lim_ves) - free(invr_ray) - free(sign_ray) - return - - -# ------------------------------------------------------------------ -cdef inline bint comp_inter_los_vpoly(const double[3] ray_orig, - const double[3] ray_vdir, - const double* lpolyx, - const double* lpolyy, - const double* normx, - const double* normy, - const int nvert, - const bint lim_is_none, - const double lim_min, - const double lim_max, - const bint forbidbis, - const double upscaDp, const double upar2, - const double dpar2, const double invuz, - const double s1x, const double s1y, - const double s2x, const double s2y, - const double crit2, const double eps_uz, - const double eps_vz, const double eps_a, - const double eps_b, const double eps_pln, - const bint is_in_struct, - double[1] kpin_loc, double[1] kpout_loc, - int[1] ind_loc, double[3] vperpin) nogil: - """ - Computes the entry and exit point of ONE provided LOS/rays for a single - structure that can be of type "OUT" (is_out_struct=True) or "IN" - (is_out_struct=False). An "OUT" structure cannot be penetrated whereas an - "IN" structure can. The latter is typically a vessel and are toroidally - continous. If a structure is limited we can determine the number of limits - and the limits itself. For optimization reasons we will also pass the - bounding box limits. And the information of the last intersected point, if - any. - - Params - ====== - ray_vdir : (3) double array - LOS normalized direction vector - ray_orig : (3) double array - LOS origin points coordinates - lpolyx : (ntotnvert) - List of "x" coordinates of the polygon's vertices of the structures on - the poloidal plane - lpolyy : (ntotnvert) - List of "y" coordinates of the polygon's vertices of the structures on - the poloidal plane - normx : (2, num_vertex-1) double array - List of "x" coordinates of the normal vectors going "inwards" of the - edges of the Polygon defined by lpolyx/y - normy : (2, num_vertex-1) double array - List of "y" coordinates of the normal vectors going "inwards" of the - edges of the Polygon defined by lpolyxy - nvert : int - Number of vertices on the polygon - lim_is_none : bint - Bool to know if the structures (or the vessel) is limited or not. - lim_min : double - Minimum angle where the structure lives. If the structure - is toroidally continous then lim_min = 0 - lim_max : double - Maximum angle where the structure lives. If the structure - is toroidally continous then lim_min = 0 - forbidbis: bint - Should we forbid values behind visible radius for each LOS ? - upscaDp: double - Scalar product between LOS' origin and direction - upar2 : double - Norm direction LOS - dpar2 : double - Norm origin LOS - invuz : double - Inverse of 3rd component of direction. ie. if direction is (ux, uy, uz) - then invuz = 1/uz - s1x, s1y, s2x, s2y : double - Compute coordinates of the 2 points where the tangents touch the inner - circle of the Tore, only needed if forbidbis = 0 - crit2 : double - Critical value to evaluate for each LOS if horizontal or not - eps : double - Small value, acceptance of error - is_in_struct : bint - Bool to determine if the structure is "OUT" or "IN". An "OUT" structure - cannot be penetrated whereas an "IN" structure can. The latter is - typically a vessel and are toroidally continous. - kpout_loc : double array - Coefficient of exit (kout) of the last point of intersection for the LOS - with the structure or vessel - kpin_loc : double array - Coefficient of exit (kin) of the last point of intersection for the LOS - with the structure or vessel - vperpin : (3) double array - Coordinates of the normal vector of impact of the LOS (0 if none) - Return - ====== - bool : If true, there was in impact - If false, no intersection between LOS and structure - """ - cdef int jj - cdef int done=0 - cdef int indin=0 - cdef int indout=0 - cdef bint inter_bbox - cdef double kout, kin - cdef double res_kin = kpin_loc[0] - cdef double res_kout = kpout_loc[0] - cdef double sca=0., sca0=0., sca1=0., sca2=0. - cdef double q, coeff, delta, sqd, k, sol0, sol1, phi=0. - cdef double v0, v1, val_a, val_b, ephi_in0, ephi_in1 - cdef double sout1, sout0 - cdef double sin1, sin0 - cdef double invupar2 - cdef double cosl0, cosl1, sinl0, sinl1 - cdef double[3] opp_dir - - # -- Computing some seful values ------------------------------------------- - cosl0 = Ccos(lim_min) - cosl1 = Ccos(lim_max) - sinl0 = Csin(lim_min) - sinl1 = Csin(lim_max) - invupar2 = 1./upar2 - # == Compute all solutions ================================================= - # Set tolerance value for ray_vdir[2,ii] - # eps_uz is the tolerated DZ across 20m (max Tokamak size) - kout, kin, done = 1.e12, 1.e12, 0 - if ray_vdir[2] * ray_vdir[2] < crit2: - # -- Case with horizontal semi-line ------------------------------------ - for jj in range(nvert): - # Solutions exist only in the case with non-horizontal - # segment (i.e.: cone, not plane) - if (lpolyy[jj+1] - lpolyy[jj])**2 > eps_vz * eps_vz: - q = (ray_orig[2] - lpolyy[jj]) / (lpolyy[jj+1] - lpolyy[jj]) - # The intersection must stand on the segment - if q>=0 and q<1: - coeff = q * q * (lpolyx[jj+1]-lpolyx[jj])**2 + \ - 2. * q * lpolyx[jj] * (lpolyx[jj+1] - lpolyx[jj]) + \ - lpolyx[jj] * lpolyx[jj] - delta = upscaDp * upscaDp - upar2 * (dpar2 - coeff) - if delta>0.: - sqd = Csqrt(delta) - # The intersection must be on the semi-line (i.e.: k>=0) - # First solution - if -upscaDp - sqd >= 0: - k = (-upscaDp - sqd) * invupar2 - sol0 = ray_orig[0] + k * ray_vdir[0] - sol1 = ray_orig[1] + k * ray_vdir[1] - if forbidbis: - sca0 = (sol0-s1x)*ray_orig[0] + \ - (sol1-s1y)*ray_orig[1] - sca1 = (sol0-s1x)*s1x + (sol1-s1y)*s1y - sca2 = (sol0-s2x)*s2x + (sol1-s2y)*s2y - if not forbidbis or (forbidbis and not - (sca0<0 and sca1<0 and - sca2<0)): - # Get the normalized perpendicular vector - # at intersection - phi = Catan2(sol1, sol0) - # Check sol inside the Lim - if lim_is_none or (not lim_is_none and - ((lim_minlim_max and - (phi>=lim_min or - phi<=lim_max)))): - # Get the scalar product to determine - # entry or exit point - sca = Ccos(phi)*normx[jj]*ray_vdir[0] + \ - Csin(phi)*normx[jj]*ray_vdir[1] + \ - normy[jj]*ray_vdir[2] - if sca<=0 and k=0 and k=0: - k = (-upscaDp + sqd)*invupar2 - sol0 = ray_orig[0] + k * ray_vdir[0] - sol1 = ray_orig[1] + k * ray_vdir[1] - if forbidbis: - sca0 = (sol0-s1x) * ray_orig[0] + \ - (sol1-s1y) * ray_orig[1] - sca1 = (sol0-s1x) * s1x + (sol1-s1y) * s1y - sca2 = (sol0-s2x) * s2x + (sol1-s2y) * s2y - if not forbidbis or (forbidbis and not - (sca0<0 and sca1<0 and - sca2<0)): - # Get the normalized perpendicular vector - # at intersection - phi = Catan2(sol1,sol0) - if lim_is_none or (not lim_is_none and - ((lim_minlim_max and - (phi>=lim_min or - phi<=lim_max)) - )): - # Get the scalar product to determine - # entry or exit point - sca = Ccos(phi)*normx[jj]*ray_vdir[0] + \ - Csin(phi)*normx[jj]*ray_vdir[1] + \ - normy[jj]*ray_vdir[2] - if sca<=0 and k=0 and k eps_b * eps_b)): - q = -coeff / (2. * val_b) - if q >= 0. and q < 1.: - k = (q * v1 - (ray_orig[2] - lpolyy[jj])) * invuz - if k >= 0: - sol0 = ray_orig[0] + k * ray_vdir[0] - sol1 = ray_orig[1] + k * ray_vdir[1] - if forbidbis: - sca0 = (sol0-s1x)*ray_orig[0] + \ - (sol1-s1y)*ray_orig[1] - sca1 = (sol0-s1x)*s1x + (sol1-s1y)*s1y - sca2 = (sol0-s2x)*s2x + (sol1-s2y)*s2y - if sca0<0 and sca1<0 and sca2<0: - continue - # Get the normalized perpendicular vect at intersection - phi = Catan2(sol1,sol0) - if lim_is_none or (not lim_is_none and - ((lim_min < lim_max and - lim_min <= phi and - phi <= lim_max) or - (lim_min > lim_max and - (phi >= lim_min or - phi <= lim_max)))): - # Get the scal prod to determine entry or exit point - sca = Ccos(phi) * normx[jj] * ray_vdir[0] + \ - Csin(phi) * normx[jj] * ray_vdir[1] + \ - normy[jj] * ray_vdir[2] - if sca<=0 and k=0 and k= eps_a * eps_a) and - (val_b * val_b > val_a * coeff)): - sqd = Csqrt(val_b * val_b - val_a * coeff) - # First solution - q = (-val_b + sqd) / val_a - if q >= 0. and q < 1.: - k = (q * v1 - (ray_orig[2] - lpolyy[jj])) * invuz - if k >= 0.: - sol0 = ray_orig[0] + k * ray_vdir[0] - sol1 = ray_orig[1] + k * ray_vdir[1] - if forbidbis: - sca0 = (sol0-s1x) * ray_orig[0] + \ - (sol1-s1y) * ray_orig[1] - sca1 = (sol0-s1x) * s1x + (sol1-s1y) * s1y - sca2 = (sol0-s2x) * s2x + (sol1-s2y) * s2y - if not forbidbis or (forbidbis and - not (sca0<0 and sca1<0 and - sca2<0)): - # Get the normalized perpendicular vector at inter - phi = Catan2(sol1, sol0) - if lim_is_none or (not lim_is_none and - ((lim_min < lim_max and - lim_min <= phi and - phi <= lim_max) or - (lim_min > lim_max and - (phi >= lim_min or - phi <= lim_max)))): - # Get the scal prod to determine in or out point - sca = Ccos(phi) * normx[jj] * ray_vdir[0] + \ - Csin(phi) * normx[jj] * ray_vdir[1] + \ - normy[jj] * ray_vdir[2] - if sca<=0 and k=0 and k= 0. and q < 1.: - k = (q * v1 - (ray_orig[2] - lpolyy[jj])) * invuz - if k>=0.: - sol0 = ray_orig[0] + k * ray_vdir[0] - sol1 = ray_orig[1] + k * ray_vdir[1] - if forbidbis: - sca0 = (sol0-s1x) * ray_orig[0] + \ - (sol1-s1y) * ray_orig[1] - sca1 = (sol0-s1x) * s1x + (sol1-s1y) * s1y - sca2 = (sol0-s2x) * s2x + (sol1-s2y) * s2y - if not forbidbis or (forbidbis and - not (sca0<0 and sca1<0 and - sca2<0)): - # Get the normalized perpendicular vector at inter - phi = Catan2(sol1,sol0) - if lim_is_none or (not lim_is_none and - ((lim_min < lim_max and - lim_min <= phi and - phi <= lim_max) or - (lim_min>lim_max and - (phi>=lim_min or - phi<=lim_max)))): - # Get the scal prod to determine if in or out - sca = Ccos(phi) * normx[jj] * ray_vdir[0] + \ - Csin(phi) * normx[jj] * ray_vdir[1] + \ - normy[jj] * ray_vdir[2] - if sca<=0 and k=0 and k eps_pln: - k = -(ray_orig[0] * ephi_in0 + ray_orig[1] * ephi_in1) \ - /(ray_vdir[0] * ephi_in0 + ray_vdir[1] * ephi_in1) - if k >= 0: - # Check if in ves_poly - sol0 = (ray_orig[0] + k * ray_vdir[0]) * cosl0 + \ - (ray_orig[1] + k * ray_vdir[1]) * sinl0 - sol1 = ray_orig[2] + k * ray_vdir[2] - inter_bbox = is_point_in_path(nvert, lpolyx, lpolyy, sol0, sol1) - if inter_bbox: - # Check PIn (POut not possible for limited torus) - sca = ray_vdir[0] * ephi_in0 + ray_vdir[1] * ephi_in1 - if sca<=0 and k=0 and k eps_pln: - k = -(ray_orig[0] * ephi_in0 + ray_orig[1] * ephi_in1)\ - /(ray_vdir[0] * ephi_in0 + ray_vdir[1] * ephi_in1) - if k >= 0: - sol0 = (ray_orig[0] + k * ray_vdir[0]) * cosl1 +\ - (ray_orig[1] + k * ray_vdir[1]) * sinl1 - sol1 = ray_orig[2] + k * ray_vdir[2] - # Check if in ves_poly - inter_bbox = is_point_in_path(nvert, lpolyx, lpolyy, sol0, sol1) - if inter_bbox: - # Check PIn (POut not possible for limited torus) - sca = ray_vdir[0]*ephi_in0 + ray_vdir[1]*ephi_in1 - if sca<=0 and k=0 and kEpsPlane: - k = -( (Ds[1,ii] - polyx_tab[jj]) * normx_tab[jj] + - (Ds[2,ii] - polyy_tab[jj]) * normy_tab[jj]) \ - / scauVin - # Only if on good side of semi-line - if k>=0.: - V1 = polyx_tab[jj+1]-polyx_tab[jj] - V2 = polyy_tab[jj+1]-polyy_tab[jj] - if (V1**2 + V2**2 > _VSMALL): - q = ( (Ds[1,ii] + k * us[1,ii] - polyx_tab[jj]) * V1 - + (Ds[2,ii] + k * us[2,ii] - polyy_tab[jj]) * V2) \ - / (V1*V1 + V2*V2) - # Only of on the fraction of plane - if q>=0. and q<1.: - X = Ds[0,ii] + k*us[0,ii] - # Only if within limits - if X>=L0 and X<=L1: - sca = us[1,ii] * normx_tab[jj] \ - + us[2,ii] * normy_tab[jj] - # Only if new - if sca<=0 and k=0 and kEpsPlane: - # First face - k = -(Ds[0,ii]-L0)/us[0,ii] - # Only if on good side of semi-line - if k>=0.: - # Only if inside VPoly - is_in_path = is_point_in_path(Ns, polyx_tab, polyy_tab, - Ds[1,ii]+k*us[1,ii], - Ds[2,ii]+k*us[2,ii]) - if is_in_path: - if us[0,ii]<=0 and k=0 and k=0.: - # Only if inside VPoly - is_in_path = is_point_in_path(Ns, polyx_tab, polyy_tab, - Ds[1,ii]+k*us[1,ii], - Ds[2,ii]+k*us[2,ii]) - if is_in_path: - if us[0,ii]>=0 and kmalloc(nstruct_tot * 6 * sizeof(double)) - cdef double *langles = malloc(nstruct_tot * 2 * sizeof(double)) - cdef int *llimits = NULL - cdef long *lsz_lim = NULL - cdef int[1] llim_ves - cdef double[2] lbounds_ves - cdef double[2] lim_ves - cdef long[::1] lstruct_nlim - # ========================================================================== - if ves_type == 'tor': - # .. if there are, we get the limits for the vessel .................... - if ves_lims is None or sz_ves_lims == 0: - are_limited = False - lbounds_ves[0] = 0 - lbounds_ves[1] = 0 - llim_ves[0] = 1 - else: - are_limited = True - lbounds_ves[0] = Catan2(Csin(ves_lims[0]), Ccos(ves_lims[0])) - lbounds_ves[1] = Catan2(Csin(ves_lims[1]), Ccos(ves_lims[1])) - llim_ves[0] = 0 - # -- Toroidal case ----------------------------------------------------- - # rmin is necessary to avoid looking on the other side of the tokamak - if rmin < 0.: - rmin = 0.95*min(min_poly_r, - _bgt.comp_min_hypot(ray_orig[0, ...], - ray_orig[1, ...], - num_los)) - rmin2 = rmin*rmin - # Variable to avoid looking "behind" blind spot of tore - if forbid: - forbid0, forbidbis = 1, 1 - else: - forbid0, forbidbis = 0, 0 - # -- Computing intersection between LOS and Vessel --------------------- - raytracing_inout_struct_tor(num_los, ray_vdir, ray_orig, - coeff_inter_out, coeff_inter_in, - vperp_out, None, ind_inter_out, - forbid0, forbidbis, - rmin, rmin2, crit2_base, - npts_poly, NULL, lbounds_ves, - llim_ves, NULL, NULL, - &ves_poly[0][0], - &ves_poly[1][0], - &ves_norm[0][0], - &ves_norm[1][0], - eps_uz, eps_vz, eps_a, eps_b, eps_plane, - num_threads, False) # structure is in - # -- Treating the structures (if any) ---------------------------------- - if nstruct_tot > 0: - ind_struct = 0 - llimits = malloc(nstruct_tot * sizeof(int)) - lsz_lim = malloc(nstruct_lim * sizeof(long)) - lstruct_nlim = lstruct_nlim_org.copy() - for ii in range(nstruct_lim): - # For fast accessing - len_lim = lstruct_nlim[ii] - # We get the limits if any - if len_lim == 0: - lslim = [None] - lstruct_nlim[ii] = lstruct_nlim[ii] + 1 - elif len_lim == 1: - lslim = [[lstruct_lims[ii][0, 0], lstruct_lims[ii][0, 1]]] - else: - lslim = lstruct_lims[ii] - # We get the number of vertices and limits of the struct's poly - if ii == 0: - lsz_lim[0] = 0 - nvert = lnvert[0] - ind_min = 0 - else: - nvert = lnvert[ii] - lnvert[ii - 1] - lsz_lim[ii] = lstruct_nlim[ii-1] + lsz_lim[ii-1] - ind_min = lnvert[ii-1] - # and loop over the limits (one continous structure) - for jj in range(max(len_lim,1)): - # We compute the structure's bounding box: - if lslim[jj] is not None: - lim_ves[0] = lslim[jj][0] - lim_ves[1] = lslim[jj][1] - llimits[ind_struct] = 0 # False : struct is limited - lim_min = Catan2(Csin(lim_ves[0]), Ccos(lim_ves[0])) - lim_max = Catan2(Csin(lim_ves[1]), Ccos(lim_ves[1])) - comp_bbox_poly_tor_lim(nvert, - &lstruct_polyx[ind_min], - &lstruct_polyy[ind_min], - &lbounds[ind_struct*6], - lim_min, lim_max) - else: - llimits[ind_struct] = 1 # True : is continous - comp_bbox_poly_tor(nvert, - &lstruct_polyx[ind_min], - &lstruct_polyy[ind_min], - &lbounds[ind_struct*6]) - lim_min = 0. - lim_max = 0. - langles[ind_struct*2] = lim_min - langles[ind_struct*2 + 1] = lim_max - ind_struct = 1 + ind_struct - # end loops over structures - # -- Computing intersection between structures and LOS ------------- - raytracing_inout_struct_tor(num_los, ray_vdir, ray_orig, - coeff_inter_out, coeff_inter_in, - vperp_out, lstruct_nlim, - ind_inter_out, - forbid0, forbidbis, - rmin, rmin2, crit2_base, - nstruct_lim, - lbounds, langles, llimits, - &lnvert[0], lsz_lim, - &lstruct_polyx[0], - &lstruct_polyy[0], - &lstruct_normx[0], - &lstruct_normy[0], - eps_uz, eps_vz, eps_a, - eps_b, eps_plane, - num_threads, - True) # the structure is "OUT" - free(lsz_lim) - free(llimits) - else: - # -- Cylindrical case -------------------------------------------------- - # .. if there are, we get the limits for the vessel .................... - if ves_lims is None or sz_ves_lims == 0: - are_limited = False - lbounds_ves[0] = 0 - lbounds_ves[1] = 0 - else: - are_limited = True - lbounds_ves[0] = ves_lims[0] - lbounds_ves[1] = ves_lims[1] - - raytracing_inout_struct_lin(num_los, ray_orig, ray_vdir, npts_poly, - &ves_poly[0][0], &ves_poly[1][0], - &ves_norm[0][0], &ves_norm[1][0], - lbounds_ves[0], lbounds_ves[1], - coeff_inter_in, coeff_inter_out, - vperp_out, ind_inter_out, eps_plane, - 0, 0) # The vessel is strcuture 0,0 - # -- Treating the structures (if any) ---------------------------------- - if nstruct_tot > 0: - ind_struct = 0 - lstruct_nlim = lstruct_nlim_org.copy() - for ii in range(nstruct_lim): - # -- Analyzing the limits -------------------------------------- - len_lim = lstruct_nlim[ii] - # We get the limits if any - if len_lim == 0: - lslim = [None] - lstruct_nlim[ii] = lstruct_nlim[ii] + 1 - elif len_lim == 1: - lslim = [[lstruct_lims[ii][0, 0], lstruct_lims[ii][0, 1]]] - else: - lslim = lstruct_lims[ii] - if ii == 0: - nvert = lnvert[0] - ind_min = 0 - else: - nvert = lnvert[ii] - lnvert[ii - 1] - ind_min = lnvert[ii-1] - # and loop over the limits (one continous structure) - for jj in range(max(len_lim,1)): - if lslim[jj] is not None: - lbounds_ves[0] = lslim[jj][0] - lbounds_ves[1] = lslim[jj][1] - raytracing_inout_struct_lin(num_los, ray_orig, ray_vdir, - nvert-1, - &lstruct_polyx[ind_min], - &lstruct_polyy[ind_min], - &lstruct_normx[ind_min-ii], - &lstruct_normy[ind_min-ii], - lbounds_ves[0], - lbounds_ves[1], - coeff_inter_in, - coeff_inter_out, - vperp_out, ind_inter_out, - eps_plane, ii+1, jj) - free(lbounds) - free(langles) - return - - -# ============================================================================== -# = Raytracing on a Torus only KMin and KMax -# ============================================================================== -cdef inline void raytracing_minmax_struct_tor(const int num_los, - const double[:,::1] ray_vdir, - const double[:,::1] ray_orig, - double* coeff_inter_out, - double* coeff_inter_in, - const bint forbid0, - const bint forbidbis_org, - const double rmin, double rmin2, - const double crit2_base, - const int npts_poly, - const double* langles, - const bint is_limited, - const double* surf_polyx, - const double* surf_polyy, - const double* surf_normx, - const double* surf_normy, - const double eps_uz, - const double eps_vz, - const double eps_a, - const double eps_b, - const double eps_plane, - const int num_threads) nogil: - """ - Computes the entry and exit point of all provided LOS/rays for a set of - "IN" structures in a TORE. A "in" structure is typically a vessel, or - flux surface and are (noramally) toroidally continous but you can specify - if it is otherwise with lis_limited and langles. - This functions is parallelized. - - Params - ====== - num_los : int - Total number of lines of sight (LOS) (aka. rays) - ray_vdir : (3, num_los) double array - LOS normalized direction vector - ray_orig : (3, num_los) double array - LOS origin points coordinates - coeff_inter_out : (num_los*num_surf) double array - Coefficient of exit (kout) of the last point of intersection for each LOS - with the global geometry (with ALL structures) - coeff_inter_in : (num_los*num_surf) double array - Coefficient of entry (kin) of the last point of intersection for each LOS - with the global geometry (with ALL structures). If intersection at origin - k = 0, if no intersection k = NAN - forbid0 : bool - Should we forbid values behind visible radius ? (see Rmin). If false, - will test "hidden" part always, else, it will depend on the LOS and - on forbidbis. - forbidbis: bint - Should we forbid values behind visible radius for each LOS ? - rmin : double - Minimal radius of vessel to take into consideration - rmin2 : double - Squared valued of the minimal radius - crit2_base : double - Critical value to evaluate for each LOS if horizontal or not - npts_poly : int - Number of OUT structures (not counting the limited versions). - If not is_out_struct then length of vpoly. - langles : (2 * nstruct) double array - Minimum and maximum angles where the structure lives. If the structure - number 'i' is toroidally continous then langles[i:i+2] = [0, 0]. - is_limited : bint - bool to know if the flux surface is limited or not - surf_polyx : (ntotnvert) - List of "x" coordinates of the polygon's vertices on - the poloidal plane - surf_polyy : (ntotnvert) - List of "y" coordinates of the polygon's vertices on - the poloidal plane - surf_normx : (2, num_vertex-1) double array - List of "x" coordinates of the normal vectors going "inwards" of the - edges of the Polygon defined by surf_poly - surf_normy : (2, num_vertex-1) double array - List of "y" coordinates of the normal vectors going "inwards" of the - edges of the Polygon defined by surf_poly - eps : double - Small value, acceptance of error - num_threads : int - The num_threads argument indicates how many threads the team should - consist of. If not given, OpenMP will decide how many threads to use. - Typically this is the number of cores available on the machine. - """ - cdef double upscaDp=0., upar2=0., dpar2=0., crit2=0., idpar2=0. - cdef double dist = 0., s1x = 0., s1y = 0., s2x = 0., s2y = 0. - cdef double lim_min=0., lim_max=0., invuz=0. - cdef int totnvert=0 - cdef int nvert - cdef int ind_struct, ind_bounds - cdef int ind_los, ii, jj, kk - cdef bint lim_is_none - cdef bint found_new_kout - cdef bint forbidbis = forbidbis_org - cdef double[3] dummy - cdef int[1] silly - cdef double* kpout_loc = NULL - cdef double* kpin_loc = NULL - cdef double* loc_org = NULL - cdef double* loc_dir = NULL - - # == Defining parallel part ================================================ - with nogil, parallel(num_threads=num_threads): - # We use local arrays for each thread so - loc_org = malloc(sizeof(double) * 3) - loc_dir = malloc(sizeof(double) * 3) - kpin_loc = malloc(sizeof(double) * 1) - kpout_loc = malloc(sizeof(double) * 1) - # == The parallelization over the LOS ================================== - for ind_los in prange(num_los, schedule='dynamic'): - ind_struct = 0 - loc_org[0] = ray_orig[0, ind_los] - loc_org[1] = ray_orig[1, ind_los] - loc_org[2] = ray_orig[2, ind_los] - loc_dir[0] = ray_vdir[0, ind_los] - loc_dir[1] = ray_vdir[1, ind_los] - loc_dir[2] = ray_vdir[2, ind_los] - kpout_loc[0] = 0 - kpin_loc[0] = 0 - # -- Computing values that depend on the LOS/ray ------------------- - upscaDp = loc_dir[0]*loc_org[0] + loc_dir[1]*loc_org[1] - upar2 = loc_dir[0]*loc_dir[0] + loc_dir[1]*loc_dir[1] - dpar2 = loc_org[0]*loc_org[0] + loc_org[1]*loc_org[1] - idpar2 = 1./dpar2 - invuz = 1./loc_dir[2] - crit2 = upar2*crit2_base - - # -- Prepare in case forbid is True -------------------------------- - if forbid0 and not dpar2>0: - forbidbis = 0 - if forbidbis: - # Compute coordinates of the 2 points where the tangents touch - # the inner circle - dist = Csqrt(dpar2-rmin2) - s1x = (rmin2 * loc_org[0] + rmin * loc_org[1] * dist) * idpar2 - s1y = (rmin2 * loc_org[1] - rmin * loc_org[0] * dist) * idpar2 - s2x = (rmin2 * loc_org[0] - rmin * loc_org[1] * dist) * idpar2 - s2y = (rmin2 * loc_org[1] + rmin * loc_org[0] * dist) * idpar2 - - # == Case "IN" structure ======================================= - # Nothing to do but compute intersection between vessel and LOS - found_new_kout = comp_inter_los_vpoly(loc_org, loc_dir, - surf_polyx, - surf_polyy, - surf_normx, - surf_normy, - npts_poly-1, - not is_limited, - langles[0], langles[1], - forbidbis, - upscaDp, upar2, - dpar2, invuz, - s1x, s1y, s2x, s2y, - crit2, eps_uz, eps_vz, - eps_a,eps_b, eps_plane, - True, - kpin_loc, kpout_loc, - silly, dummy) - if found_new_kout: - coeff_inter_in[ind_los] = kpin_loc[0] - coeff_inter_out[ind_los] = kpout_loc[0] - else: - coeff_inter_in[ind_los] = Cnan - coeff_inter_out[ind_los] = Cnan - free(loc_org) - free(loc_dir) - free(kpin_loc) - free(kpout_loc) - return - - -# ============================================================================== -# = Raytracing on a Cylinder only KMin and KMax -# ============================================================================== -cdef inline void raytracing_minmax_struct_lin(const int Nl, - const double[:,::1] Ds, - const double [:,::1] us, - const int Ns, - const double* polyx_tab, - const double* polyy_tab, - const double* normx_tab, - const double* normy_tab, - const double L0, - const double L1, - double* kin_tab, - double* kout_tab, - const double EpsPlane) nogil: - cdef bint is_in_path - cdef int ii=0, jj=0 - cdef double kin, kout, scauVin, q, X, sca, k - cdef int indin=0, indout=0, Done=0 - - kin_tab[ii] = Cnan - kout_tab[ii] = Cnan - - for ii in range(0,Nl): - kout = 1.e12 - kin = 1.e12 - Done = 0 - # For cylinder - for jj in range(0,Ns): - scauVin = us[1,ii] * normx_tab[jj] + us[2,ii] * normy_tab[jj] - # Only if plane not parallel to line - if Cabs(scauVin)>EpsPlane: - k = -( (Ds[1,ii] - polyx_tab[jj]) * normx_tab[jj] + - (Ds[2,ii] - polyy_tab[jj]) * normy_tab[jj]) \ - / scauVin - # Only if on good side of semi-line - if k>=0.: - V1 = polyx_tab[jj+1]-polyx_tab[jj] - V2 = polyy_tab[jj+1]-polyy_tab[jj] - q = ( (Ds[1,ii] + k * us[1,ii] - polyx_tab[jj]) * V1 - + (Ds[2,ii] + k * us[2,ii] - polyy_tab[jj]) * V2) \ - / (V1*V1 + V2*V2) - # Only of on the fraction of plane - if q>=0. and q<1.: - X = Ds[0,ii] + k*us[0,ii] - - # Only if within limits - if X>=L0 and X<=L1: - sca = us[1,ii] * normx_tab[jj] \ - + us[2,ii] * normy_tab[jj] - # Only if new - if sca<=0 and k=0 and kEpsPlane: - # First face - k = -(Ds[0,ii]-L0)/us[0,ii] - # Only if on good side of semi-line - if k>=0.: - # Only if inside VPoly - is_in_path = is_point_in_path(Ns, polyx_tab, polyy_tab, - Ds[1,ii]+k*us[1,ii], - Ds[2,ii]+k*us[2,ii]) - if is_in_path: - if us[0,ii]<=0 and k=0 and k=0.: - # Only if inside VPoly - is_in_path = is_point_in_path(Ns, polyx_tab, polyy_tab, - Ds[1,ii]+k*us[1,ii], - Ds[2,ii]+k*us[2,ii]) - if is_in_path: - if us[0,ii]>=0 and k malloc(npts*sizeof(double)) - _bgt.compute_dist_pt_vec(pt0, pt1, pt2, npts, pts, &dist_arr[0]) - _bgt.compute_diff_div(pts, ray_orig, dist_arr, npts, ray_vdir) - else: - _bgt.compute_diff_div(pts, ray_orig, &k[0], npts, ray_vdir) - # -------------------------------------------------------------------------- - sz_ves_lims = np.size(ves_lims) - min_poly_r = _bgt.comp_min(ves_poly[0, ...], npts_poly-1) - compute_inout_tot(npts, npts_poly, - ray_orig, ray_vdir, - ves_poly, ves_norm, - lstruct_nlim, ves_lims, - lstruct_polyx, lstruct_polyy, - lstruct_lims, lstruct_normx, - lstruct_normy, lnvert, - nstruct_tot, nstruct_lim, - sz_ves_lims, min_poly_r, rmin, - eps_uz, eps_a, eps_vz, eps_b, - eps_plane, ves_type, - forbid, num_threads, - coeff_inter_out, coeff_inter_in, vperp_out, - ind_inter_out) - # -------------------------------------------------------------------------- - # Get ind - if k == None: - is_vis_mask(ind, dist_arr, coeff_inter_out, npts) - free(dist_arr) - else: - is_vis_mask(ind, &k[0], coeff_inter_out, npts) - return - -cdef inline void is_vis_mask(double[::1] ind, double* k, - double[::1] coeff_inter_out, - int npts) nogil: - cdef int ii - for ii in range(npts): - ind[ii] = 1 - if k[ii] > coeff_inter_out[ii]: - ind[ii] = 0 - return - -cdef inline void are_visible_vec_vec(double[:, ::1] pts1, int npts1, - double[:,::1] pts2, int npts2, - double[:, ::1] ves_poly, - double[:, ::1] ves_norm, - double[:, ::1] ind, - double[::1] k, - double[::1] ves_lims, - long[::1] lstruct_nlim, - double[::1] lstruct_polyx, - double[::1] lstruct_polyy, - list lstruct_lims, - double[::1] lstruct_normx, - double[::1] lstruct_normy, - long[::1] lnvert, - int nstruct_tot, - int nstruct_lim, - double rmin, - double eps_uz, double eps_a, - double eps_vz, double eps_b, - double eps_plane, str ves_type, - bint forbid, - bint test, int num_threads): - cdef np.ndarray[double, ndim=2, mode='c'] ray_orig_arr - cdef np.ndarray[double, ndim=2, mode='c'] ray_vdir_arr - cdef np.ndarray[double, ndim=2, mode='c'] dist_arr - cdef double[:,::1] ray_orig - cdef double[:,::1] ray_vdir - cdef int ii - # We compute for each point in the polygon - for ii in range(npts1): - is_visible_pt_vec(pts1[0,ii], pts1[1,ii], pts1[2,ii], - pts2, npts2, - ves_poly, ves_norm, - ind[ii,...], k, ves_lims, - lstruct_nlim, - lstruct_polyx, lstruct_polyy, - lstruct_lims, - lstruct_normx, lstruct_normy, - lnvert, nstruct_tot, nstruct_lim, - rmin, eps_uz, eps_a, eps_vz, eps_b, - eps_plane, ves_type, - forbid, test, num_threads) - return diff --git a/tofu/geom/_sampling_tools.pxd b/tofu/geom/_sampling_tools.pxd deleted file mode 100644 index 6161625f2..000000000 --- a/tofu/geom/_sampling_tools.pxd +++ /dev/null @@ -1,145 +0,0 @@ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -# -cimport numpy as cnp -# ============================================================================== -# = LINEAR MESHING -# ============================================================================== -cdef long discretize_line1d_core(double* LMinMax, double dstep, - double[2] DL, bint Lim, - int mode, double margin, - double** ldiscret_arr, - double[1] resolution, - long** lindex_arr, long[1] N) nogil - -cdef void first_discretize_line1d_core(double* LMinMax, - double dstep, - double[1] resolution, - long[1] num_cells, - long[1] Nind, - int[1] nL0, - double[2] DL, - bint Lim, - int mode, - double margin) nogil - -cdef void second_discretize_line1d_core(double* LMinMax, - double* ldiscret, - long* lindex, - int nL0, - double resolution, - long Nind) nogil - -cdef void simple_discretize_line1d(double[2] LMinMax, double dstep, - int mode, double margin, - double** ldiscret_arr, - double[1] resolution, - long[1] N) nogil -# ============================================================================== -# = Vessel's poloidal cut discretization -# ============================================================================== - -cdef void discretize_vpoly_core(double[:, ::1] VPoly, double dstep, - int mode, double margin, double DIn, - double[:, ::1] VIn, - double** XCross, double** YCross, - double** reso, long** ind, - long** numcells, double** Rref, - double** XPolybis, double** YPolybis, - int[1] tot_sz_vb, int[1] tot_sz_ot, - int NP) nogil - -# ------------------------------------------------------------------------------ -# - Simplified version of previous algo -# ------------------------------------------------------------------------------ -cdef void simple_discretize_vpoly_core(double[:, ::1] VPoly, - int num_pts, - double dstep, - double** XCross, - double** YCross, - int[1] new_nb_pts, - int mode, - double margin) nogil - -# ============================================================================== -# == LOS sampling -# ============================================================================== - -# -- LOS sampling for a single ray --------------------------------------------- -cdef int get_nb_imode(str imode) - -cdef int get_nb_dmode(str dmode) - -cdef int los_get_sample_single(double los_kmin, double los_kmax, - double resol, int imethod, int imode, - double[1] eff_res, double** coeffs) nogil - -# -- Calc signal utility function --------------------------------------------- -cdef call_get_sample_single_ani(double los_kmin, double los_kmax, - double resol, - int n_dmode, int n_imode, - double[1] eff_res, - long[1] nb_rows, - double[:,::1] ray_orig, - double[:,::1] ray_vdir) - -cdef cnp.ndarray[double,ndim=2,mode='c'] call_get_sample_single(double los_kmin, double los_kmax, - double resol, - int n_dmode, int n_imode, - double[1] eff_res, - long[1] nb_rows, - double[:,::1] ray_orig, - double[:,::1] ray_vdir) - -cdef int los_get_sample_core_const_res(int nlos, - double* los_lim_min, - double* los_lim_max, - int n_dmode, int n_imode, - double val_resol, - double** coeff_ptr, - double* dLr, - long* los_ind, - int num_threads) nogil - -cdef void los_get_sample_core_var_res(int nlos, - double* los_lim_min, - double* los_lim_max, - int n_dmode, int n_imode, - double* resol, - double** coeff_ptr, - double* dLr, - long* los_ind, - int num_threads) nogil - -cdef void los_get_sample_pts(int nlos, - double* ptx, - double* pty, - double* ptz, - double* usx, - double* usy, - double* usz, - double[:,::1] ray_orig, - double[:,::1] ray_vdir, - double* coeff_ptr, - long* los_ind, - int num_threads) nogil - -# -- Integrations utility function --------------------------------------------- -cdef void integrate_sum_nlos(int nlos, int nt, - double[:,::1] val_2d, - double[::1,:] sig_mv, - long* ind_arr, - double* reseff_arr, - int num_threads) nogil - -cdef void integrate_c_sum_mat(double[:,::1] val_mv, - double* sig, - int nrows, int ncols, - double loc_eff_res, - int num_threads) nogil - -cdef double integrate_c_sum_vec(double* val_mv, - int nza, - double loc_eff_res, - int num_threads) nogil diff --git a/tofu/geom/_sampling_tools.pyx b/tofu/geom/_sampling_tools.pyx deleted file mode 100644 index 234721b07..000000000 --- a/tofu/geom/_sampling_tools.pyx +++ /dev/null @@ -1,1567 +0,0 @@ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -# -################################################################################ -# Utility functions for sampling and discretizating -################################################################################ -from libc.math cimport ceil as Cceil, fabs as Cabs -from libc.math cimport floor as Cfloor, round as Cround -from libc.math cimport sqrt as Csqrt -from libc.math cimport isnan as Cisnan -from libc.math cimport NAN as Cnan -from libc.math cimport log2 as Clog2 -from libc.stdlib cimport malloc, free, realloc -from cython.parallel import prange -from cython.parallel cimport parallel -from _basic_geom_tools cimport _VSMALL -# for utility functions: -import numpy as np -cimport numpy as cnp -# tofu libs -cimport _basic_geom_tools as _bgt - - -# ============================================================================== -# = LINEAR MESHING -# ============================================================================== -cdef inline long discretize_line1d_core(double* lminmax, double dstep, - double[2] dl, bint lim, - int mode, double margin, - double** ldiscret_arr, - double[1] resolution, - long** lindex_arr, long[1] n) nogil: - cdef int[1] nL0 - cdef long[1] nind - - first_discretize_line1d_core(lminmax, dstep, - resolution, n, nind, nL0, - dl, lim, mode, margin) - if ldiscret_arr[0] == NULL: - ldiscret_arr[0] = malloc(nind[0] * sizeof(double)) - else: - ldiscret_arr[0] = realloc(ldiscret_arr[0], - nind[0] * sizeof(double)) - if lindex_arr[0] == NULL: - lindex_arr[0] = malloc(nind[0] * sizeof(long)) - else: - lindex_arr[0] = realloc(lindex_arr[0], nind[0] * sizeof(long)) - second_discretize_line1d_core(lminmax, ldiscret_arr[0], lindex_arr[0], - nL0[0], resolution[0], nind[0]) - return nind[0] - -cdef inline void first_discretize_line1d_core(double* lminmax, - double dstep, - double[1] resolution, - long[1] ncells, - long[1] nind, - int[1] nl0, - double[2] dl, - bint lim, - int mode, - double margin) nogil: - """ - Computes the resolution, the desired limits, and the number of cells when - discretising the segmen lminmax with the given parameters. It doesn't do the - actual discretization. - For that part, please refer to: second_discretize_line1d_core - """ - cdef int nl1, ii, jj - cdef double abs0, abs1 - cdef double inv_resol, new_margin - cdef double[2] desired_limits - - # .. Computing "real" discretization step, depending on `mode`.............. - if mode == 1: # absolute - ncells[0] = Cceil((lminmax[1] - lminmax[0]) / dstep) - else: # relative - ncells[0] = Cceil(1./dstep) - resolution[0] = (lminmax[1] - lminmax[0]) / ncells[0] - # .. Computing desired limits .............................................. - if Cisnan(dl[0]) and Cisnan(dl[1]): - desired_limits[0] = lminmax[0] - desired_limits[1] = lminmax[1] - else: - if Cisnan(dl[0]): - dl[0] = lminmax[0] - if Cisnan(dl[1]): - dl[1] = lminmax[1] - if lim and dl[0]<=lminmax[0]: - dl[0] = lminmax[0] - if lim and dl[1]>=lminmax[1]: - dl[1] = lminmax[1] - desired_limits[0] = dl[0] - desired_limits[1] = dl[1] - # .. Get the extreme indices of the mesh elements that really need to be - # created within those limits............................................... - inv_resol = 1./resolution[0] - new_margin = margin*resolution[0] - abs0 = Cabs(desired_limits[0] - lminmax[0]) - if abs0 - resolution[0] * Cfloor(abs0 * inv_resol) < new_margin: - nl0[0] = int(Cround((desired_limits[0] - lminmax[0]) * inv_resol)) - else: - nl0[0] = int(Cfloor((desired_limits[0] - lminmax[0]) * inv_resol)) - abs1 = Cabs(desired_limits[1] - lminmax[0]) - if abs1 - resolution[0] * Cfloor(abs1 * inv_resol) < new_margin: - nl1 = int(Cround((desired_limits[1] - lminmax[0]) * inv_resol) - 1) - else: - nl1 = int(Cfloor((desired_limits[1] - lminmax[0]) * inv_resol)) - # Get the total number of indices - nind[0] = nl1 + 1 - nl0[0] - return - -cdef inline void second_discretize_line1d_core(double* lminmax, - double* ldiscret, - long* lindex, - int nl0, - double resolution, - long nind) nogil: - """ - Does the actual discretization of the segment lminmax. - Computes the coordinates of the cells on the discretized segment and the - associated list of indices. - This function need some parameters computed with the first algorithm: - first_discretize_line1d_core - """ - cdef int ii, jj - # .. Computing coordinates and indices ..................................... - for ii in range(nind): - jj = nl0 + ii - lindex[ii] = jj - ldiscret[ii] = lminmax[0] + (0.5 + jj) * resolution - return - - -cdef inline void simple_discretize_line1d(double[2] lminmax, double dstep, - int mode, double margin, - double** ldiscret_arr, - double[1] resolution, - long[1] n) nogil: - """ - Similar version, more simple : - - Not possible to define a sub set - - Gives back a discretized line WITH the min boundary - - WITHOUT max boundary - """ - cdef int ii - cdef int ncells - cdef double resol - cdef double first = lminmax[0] - - if mode == 1: # absolute - ncells = Cceil((lminmax[1] - first) / dstep) - else: # relative - ncells = Cceil(1./dstep) - if ncells < 1 : - ncells = 1 - resol = (lminmax[1] - first) / ncells - resolution[0] = resol - n[0] = ncells - if ldiscret_arr[0] == NULL: - ldiscret_arr[0] = malloc(n[0] * sizeof(double)) - else: - ldiscret_arr[0] = realloc(ldiscret_arr[0], - n[0] * sizeof(double)) - for ii in range(ncells): - ldiscret_arr[0][ii] = first + resol * ii - return - -# ============================================================================== -# = Vessel's poloidal cut discretization -# ============================================================================== - -cdef inline void discretize_vpoly_core(double[:, ::1] ves_poly, double dstep, - int mode, double margin, double din, - double[:, ::1] ves_vin, - double** xcross, double** ycross, - double** reso, long** ind, - long** ncells, double** rref, - double** xpolybis, double** ypolybis, - int[1] tot_sz_vb, int[1] tot_sz_ot, - int np) nogil: - cdef Py_ssize_t sz_vbis = 0 - cdef Py_ssize_t sz_others = 0 - cdef Py_ssize_t last_sz_vbis = 0 - cdef Py_ssize_t last_sz_othr = 0 - cdef int ii, jj - cdef double v0, v1 - cdef double rv0, rv1 - cdef double inv_norm - cdef double shiftx, shifty - cdef double[1] loc_resolu - cdef double[2] lminmax - cdef double[2] dl_array - cdef double* ldiscret = NULL - cdef long* lindex = NULL - - #.. initialization.......................................................... - lminmax[0] = 0. - dl_array[0] = Cnan - dl_array[1] = Cnan - ncells[0] = malloc((np-1)*sizeof(long)) - #.. Filling arrays.......................................................... - if Cabs(din) < _VSMALL: - for ii in range(np-1): - v0 = ves_poly[0,ii+1]-ves_poly[0,ii] - v1 = ves_poly[1,ii+1]-ves_poly[1,ii] - lminmax[1] = Csqrt(v0 * v0 + v1 * v1) - inv_norm = 1. / lminmax[1] - discretize_line1d_core(lminmax, dstep, dl_array, True, - mode, margin, &ldiscret, loc_resolu, - &lindex, &ncells[0][ii]) - # .. preparing Poly bis array...................................... - last_sz_vbis = sz_vbis - sz_vbis += 1 + ncells[0][ii] - xpolybis[0] = realloc(xpolybis[0], sz_vbis*sizeof(double)) - ypolybis[0] = realloc(ypolybis[0], sz_vbis*sizeof(double)) - xpolybis[0][sz_vbis - (1 + ncells[0][ii])] = ves_poly[0, ii] - ypolybis[0][sz_vbis - (1 + ncells[0][ii])] = ves_poly[1, ii] - # .. preparing other arrays ........................................ - last_sz_othr = sz_others - sz_others += ncells[0][ii] - reso[0] = realloc(reso[0], sizeof(double)*sz_others) - rref[0] = realloc(rref[0], sizeof(double)*sz_others) - xcross[0] = realloc(xcross[0], sizeof(double)*sz_others) - ycross[0] = realloc(ycross[0], sizeof(double)*sz_others) - ind[0] = realloc(ind[0], sizeof(long)*sz_others) - # ... - v0 = v0 * inv_norm - v1 = v1 * inv_norm - rv0 = loc_resolu[0]*v0 - rv1 = loc_resolu[0]*v1 - for jj in range(ncells[0][ii]): - ind[0][last_sz_othr + jj] = last_sz_othr + jj - reso[0][last_sz_othr + jj] = loc_resolu[0] - rref[0][last_sz_othr + jj] = ves_poly[0,ii] + ldiscret[jj] * v0 - xcross[0][last_sz_othr + jj] = ves_poly[0,ii] + ldiscret[jj] * v0 - ycross[0][last_sz_othr + jj] = ves_poly[1,ii] + ldiscret[jj] * v1 - xpolybis[0][last_sz_vbis + jj] = ves_poly[0,ii] + jj * rv0 - ypolybis[0][last_sz_vbis + jj] = ves_poly[1,ii] + jj * rv1 - # We close the polygon of VPolybis - sz_vbis += 1 - xpolybis[0] = realloc(xpolybis[0], sz_vbis*sizeof(double)) - ypolybis[0] = realloc(ypolybis[0], sz_vbis*sizeof(double)) - xpolybis[0][sz_vbis - 1] = ves_poly[0, 0] - ypolybis[0][sz_vbis - 1] = ves_poly[1, 0] - else: - for ii in range(np-1): - v0 = ves_poly[0,ii+1]-ves_poly[0,ii] - v1 = ves_poly[1,ii+1]-ves_poly[1,ii] - lminmax[1] = Csqrt(v0 * v0 + v1 * v1) - inv_norm = 1. / lminmax[1] - discretize_line1d_core(lminmax, dstep, dl_array, True, - mode, margin, &ldiscret, loc_resolu, - &lindex, &ncells[0][ii]) - # .. prepaaring Poly bis array...................................... - last_sz_vbis = sz_vbis - sz_vbis += 1 + ncells[0][ii] - xpolybis[0] = realloc(xpolybis[0], sz_vbis*sizeof(double)) - ypolybis[0] = realloc(ypolybis[0], sz_vbis*sizeof(double)) - xpolybis[0][sz_vbis - (1 + ncells[0][ii])] = ves_poly[0, ii] - ypolybis[0][sz_vbis - (1 + ncells[0][ii])] = ves_poly[1, ii] - # .. preparing other arrays ........................................ - last_sz_othr = sz_others - sz_others += ncells[0][ii] - reso[0] = realloc(reso[0], sizeof(double)*sz_others) - rref[0] = realloc(rref[0], sizeof(double)*sz_others) - xcross[0] = realloc(xcross[0], sizeof(double)*sz_others) - ycross[0] = realloc(ycross[0], sizeof(double)*sz_others) - ind[0] = realloc(ind[0], sizeof(long)*sz_others) - # ... - v0 = v0 * inv_norm - v1 = v1 * inv_norm - rv0 = loc_resolu[0]*v0 - rv1 = loc_resolu[0]*v1 - shiftx = din*ves_vin[0,ii] - shifty = din*ves_vin[1,ii] - for jj in range(ncells[0][ii]): - ind[0][last_sz_othr] = last_sz_othr - reso[0][last_sz_othr] = loc_resolu[0] - rref[0][last_sz_othr] = ves_poly[0,ii] + ldiscret[jj]*v0 - xcross[0][last_sz_othr] = ves_poly[0,ii] + ldiscret[jj]*v0 + shiftx - ycross[0][last_sz_othr] = ves_poly[1,ii] + ldiscret[jj]*v1 + shifty - xpolybis[0][last_sz_vbis + jj] = ves_poly[0,ii] + jj * rv0 - ypolybis[0][last_sz_vbis + jj] = ves_poly[1,ii] + jj * rv1 - last_sz_othr += 1 - # We close the polygon of VPolybis - sz_vbis += 1 - xpolybis[0] = realloc(xpolybis[0], sz_vbis*sizeof(double)) - ypolybis[0] = realloc(ypolybis[0], sz_vbis*sizeof(double)) - xpolybis[0][sz_vbis - 1] = ves_poly[0, 0] - ypolybis[0][sz_vbis - 1] = ves_poly[1, 0] - tot_sz_vb[0] = sz_vbis - tot_sz_ot[0] = sz_others - return - - -# ------------------------------------------------------------------------------ -# - Simplified version of previous algo -# ------------------------------------------------------------------------------ -cdef inline void simple_discretize_vpoly_core(double[:, ::1] ves_poly, - int num_pts, - double dstep, - double** xcross, - double** ycross, - int[1] new_nb_pts, - int mode, - double margin) nogil: - cdef Py_ssize_t sz_others = 0 - cdef Py_ssize_t last_sz_othr = 0 - cdef int ii, jj - cdef double v0, v1 - cdef double inv_norm - cdef double[1] loc_resolu - cdef double[2] lminmax - cdef long[1] ncells - cdef double* ldiscret = NULL - #.. initialization.......................................................... - lminmax[0] = 0. - #.. Filling arrays.......................................................... - for ii in range(num_pts-1): - v0 = ves_poly[0,ii+1]-ves_poly[0,ii] - v1 = ves_poly[1,ii+1]-ves_poly[1,ii] - lminmax[1] = Csqrt(v0 * v0 + v1 * v1) - inv_norm = 1. / lminmax[1] - simple_discretize_line1d(lminmax, dstep, mode, margin, - &ldiscret, loc_resolu, &ncells[0]) - # .. preparing other arrays ........................................ - last_sz_othr = sz_others - sz_others += ncells[0] - xcross[0] = realloc(xcross[0], sizeof(double)*sz_others) - ycross[0] = realloc(ycross[0], sizeof(double)*sz_others) - # ... - v0 = v0 * inv_norm - v1 = v1 * inv_norm - for jj in range(ncells[0]): - xcross[0][last_sz_othr + jj] = ves_poly[0,ii] + ldiscret[jj] * v0 - ycross[0][last_sz_othr + jj] = ves_poly[1,ii] + ldiscret[jj] * v1 - # We close the polygon of VPolybis - new_nb_pts[0] = sz_others - free(ldiscret) - return - - -# ============================================================================== -# == LOS sampling -# ============================================================================== - -# -- Quadrature Rules : Middle Rule -------------------------------------------- -cdef inline void middle_rule_single(int num_raf, - double los_kmin, - double loc_resol, - double* los_coeffs) nogil: - # Middle quadrature rule with relative resolution step - # for a single particle - cdef Py_ssize_t jj - for jj in range(num_raf): - los_coeffs[jj] = los_kmin + (0.5 + jj)*loc_resol - return - -cdef inline void middle_rule_rel(int nlos, int num_raf, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double* los_coeffs, - long* los_ind, - int num_threads) nogil: - # Middle quadrature rule with relative resolution step - # for MULTIPLE LOS - cdef Py_ssize_t ii - cdef int first_index - cdef double inv_nraf - cdef double loc_resol - inv_nraf = 1./num_raf - # doing special case ilos = 0: - los_ind[0] = num_raf - loc_resol = (los_kmax[0] - los_kmin[0])*inv_nraf - eff_resolution[0] = loc_resol - first_index = 0 - middle_rule_single(num_raf, los_kmin[0], - loc_resol, &los_coeffs[first_index]) - # Now for the rest: - with nogil, parallel(num_threads=num_threads): - for ii in prange(1, nlos): - los_ind[ii] = num_raf + los_ind[ii-1] - loc_resol = (los_kmax[ii] - los_kmin[ii])*inv_nraf - eff_resolution[ii] = loc_resol - first_index = ii*num_raf - middle_rule_single(num_raf, los_kmin[ii], - loc_resol, &los_coeffs[first_index]) - return - -cdef inline void middle_rule_abs_s1_single(double inv_resol, - double los_kmin, - double los_kmax, - double* eff_resolution, - long* ind_cum) nogil: - # Middle quadrature rule with absolute resolution step - # for one LOS - # First step of the function, this function should be called - # before middle_rule_abs_s2, this function computes the resolutions - # and the right indices - cdef int num_raf - cdef double seg_length - cdef double loc_resol - # ... - seg_length = los_kmax - los_kmin - num_raf = (Cceil(seg_length*inv_resol)) - loc_resol = seg_length / num_raf - eff_resolution[0] = loc_resol - ind_cum[0] = num_raf - return - - -cdef inline void middle_rule_abs_s1(int nlos, double resol, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* ind_cum, - int num_threads) nogil: - # Middle quadrature rule with absolute resolution step - # for SEVERAL LOS - # First step of the function, this function should be called - # before middle_rule_abs_s2, this function computes the resolutions - # and the right indices - cdef Py_ssize_t ii - cdef double inv_resol - # ... - with nogil, parallel(num_threads=num_threads): - inv_resol = 1./resol - for ii in prange(nlos): - middle_rule_abs_s1_single(inv_resol, los_kmin[ii], - los_kmax[ii], - &eff_resolution[ii], - &ind_cum[ii]) - return - -cdef inline void middle_rule_abs_s2(int nlos, - double* los_kmin, - double* eff_resolution, - long* ind_cum, - double* los_coeffs, - int num_threads) nogil: - # Middle quadrature rule with absolute resolution step - # for SEVERAL LOS - # First step of the function, this function should be called - # before middle_rule_abs_s2, this function computes the coeffs - cdef Py_ssize_t ii - cdef long num_raf - cdef long first_index - cdef double loc_resol - cdef double loc_x - # Treating the first ilos seperately - num_raf = ind_cum[0] - first_index = 0 - loc_resol = eff_resolution[0] - loc_x = los_kmin[0] - middle_rule_single(num_raf, loc_x, loc_resol, - &los_coeffs[first_index]) - # filling tab...... CANNOT BE PARALLEL !! - for ii in range(1, nlos): - num_raf = ind_cum[ii] - first_index = ind_cum[ii-1] - ind_cum[ii] = first_index + ind_cum[ii] - loc_resol = eff_resolution[ii] - loc_x = los_kmin[ii] - middle_rule_single(num_raf, loc_x, loc_resol, - &los_coeffs[first_index]) - return - - -cdef inline void middle_rule_abs_var_s1(int nlos, - double* los_kmin, - double* los_kmax, - double* resolutions, - double* eff_resolution, - long* los_ind, - long* los_nraf, - int num_threads) nogil: - # Middle quadrature rule with absolute variable resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int num_raf - cdef int first_index - cdef double loc_resol - cdef double seg_length - # Treating first ilos first ...................................... - seg_length = los_kmax[0] - los_kmin[0] - num_raf = (Cceil(seg_length/resolutions[0])) - loc_resol = seg_length / num_raf - # keeping values - los_nraf[0] = num_raf - eff_resolution[0] = loc_resol - los_ind[0] = num_raf - first_index = 0 - # Now the rest ................................................... - for ii in range(1,nlos): - seg_length = los_kmax[ii] - los_kmin[ii] - num_raf = (Cceil(seg_length/resolutions[ii])) - loc_resol = seg_length / num_raf - # keeping values - los_nraf[ii] = num_raf - eff_resolution[ii] = loc_resol - first_index = los_ind[ii-1] - los_ind[ii] = num_raf + first_index - return - - - - -cdef inline void middle_rule_abs_var_s2(int nlos, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Middle quadrature rule with absolute variable resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int num_raf - cdef int first_index - cdef double loc_resol - - # Treting ilos= 0 first ....................................... - first_index = 0 - loc_resol = eff_resolution[0] - num_raf = los_nraf[0] - middle_rule_single(num_raf, - los_kmin[0], - loc_resol, - &los_coeffs[0][first_index]) - # ... - with nogil, parallel(num_threads=num_threads): - for ii in prange(1, nlos): - first_index = los_ind[ii-1] - loc_resol = eff_resolution[ii] - num_raf = los_nraf[ii] - middle_rule_single(num_raf, - los_kmin[ii], - loc_resol, - &los_coeffs[0][first_index]) - return - - -cdef inline void middle_rule_abs_var(int nlos, - double* los_kmin, - double* los_kmax, - double* resolutions, - double* eff_resolution, - double** los_coeffs, - long* los_ind, - int num_threads) nogil: - # Middle quadrature rule with absolute variable resolution step - # for SEVERAL LOS - cdef long* los_nraf - los_nraf = malloc(nlos * sizeof(long)) - middle_rule_abs_var_s1(nlos, los_kmin, los_kmax, resolutions, - eff_resolution, los_ind, &los_nraf[0], - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - middle_rule_abs_var_s2(nlos, los_kmin, los_kmax, - eff_resolution, los_coeffs, - los_ind, los_nraf, num_threads) - - # ... - free(los_nraf) - return - - - -cdef inline void middle_rule_rel_var_s1(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* los_ind, - long* los_nraf, - int num_threads) nogil: - # Middle quadrature rule with relative variable resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int num_raf - cdef int first_index - cdef double seg_length - cdef double loc_resol - # ... Treating the first los ..................................... - num_raf = (Cceil(1./resolutions[0])) - loc_resol = (los_kmax[0] - los_kmin[0])/num_raf - eff_resolution[0] = loc_resol - los_nraf[0] = num_raf - first_index = 0 - los_ind[0] = num_raf - # .. Treating the rest of los .................................... - for ii in range(1,nlos): - num_raf = (Cceil(1./resolutions[ii])) - loc_resol = (los_kmax[ii] - los_kmin[ii])/num_raf - eff_resolution[ii] = loc_resol - los_nraf[ii] = num_raf - first_index = los_ind[ii-1] - los_ind[ii] = num_raf + first_index - return - - -cdef inline void middle_rule_rel_var_s2(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Middle quadrature rule with relative variable resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int num_raf - cdef int first_index - cdef double loc_resol - # .. Treating first los ......................................... - num_raf = los_nraf[0] - loc_resol = eff_resolution[0] - first_index = 0 - middle_rule_single(num_raf, los_kmin[0], loc_resol, - &los_coeffs[0][first_index]) - # ... and the rest of los ....................................... - with nogil, parallel(num_threads=num_threads): - for ii in prange(1, nlos): - num_raf = los_nraf[ii] - loc_resol = eff_resolution[ii] - first_index = los_ind[ii-1] - middle_rule_single(num_raf, los_kmin[ii], loc_resol, - &los_coeffs[0][first_index]) - return - -cdef inline void middle_rule_rel_var(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, - int num_threads) nogil: - # Middle quadrature rule with relative variable resolution step - # for SEVERAL LOS - cdef long* los_nraf - # ... - los_nraf = malloc(nlos * sizeof(long)) - middle_rule_rel_var_s1(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_ind, - los_nraf, - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - middle_rule_rel_var_s2(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_coeffs, - los_ind, - los_nraf, - num_threads) - free(los_nraf) - return - -# -- Quadrature Rules : Left Rule ---------------------------------------------- -cdef inline void left_rule_single(int num_raf, - double loc_x, - double loc_resol, - double* los_coeffs) nogil: - # Left quadrature rule with relative resolution step - # for one LOS - cdef Py_ssize_t jj - # ... - for jj in range(num_raf + 1): - los_coeffs[jj] = loc_x + jj * loc_resol - return - - -cdef inline void left_rule_rel(int nlos, int num_raf, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double* los_coeffs, - long* los_ind, int num_threads) nogil: - # Left quadrature rule with relative resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int first_index - cdef double inv_nraf - cdef double loc_resol - cdef double loc_x - inv_nraf = 1./num_raf - # ... - with nogil, parallel(num_threads=num_threads): - for ii in prange(nlos): - loc_x = los_kmin[ii] - loc_resol = (los_kmax[ii] - loc_x)*inv_nraf - eff_resolution[ii] = loc_resol - first_index = ii*(num_raf + 1) - los_ind[ii] = first_index + num_raf + 1 - left_rule_single(num_raf, loc_x, loc_resol, - &los_coeffs[first_index]) - return - - -cdef inline void simps_left_rule_abs_s1(int nlos, double resol, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Simpson left quadrature rule with absolute resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int num_raf - cdef int first_index - cdef double seg_length - cdef double loc_resol - cdef double inv_resol = 1./resol - # ... Treating the first los ....................................... - seg_length = los_kmax[0] - los_kmin[0] - num_raf = (Cceil(seg_length*inv_resol)) - if num_raf%2==1: - num_raf = num_raf + 1 - loc_resol = seg_length / num_raf - eff_resolution[0] = loc_resol - los_nraf[0] = num_raf - first_index = 0 - los_ind[0] = num_raf + 1 - # ... Treating the rest of los ..................................... - for ii in range(1, nlos): - seg_length = los_kmax[ii] - los_kmin[ii] - num_raf = (Cceil(seg_length*inv_resol)) - if num_raf%2==1: - num_raf = num_raf + 1 - loc_resol = seg_length / num_raf - eff_resolution[ii] = loc_resol - los_nraf[ii] = num_raf - first_index = los_ind[ii -1] - los_ind[ii] = num_raf + 1 + first_index - return - -cdef inline void left_rule_abs_s2(int nlos, double resol, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Simpson left quadrature rule with absolute resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii, jj - cdef int num_raf - cdef int first_index - cdef double loc_resol - # ... Treating the first los ......................................... - num_raf = los_nraf[0] - loc_resol = eff_resolution[0] - first_index = 0 - left_rule_single(num_raf, los_kmin[0], loc_resol, - &los_coeffs[0][first_index]) - # ... Treating the rest of the los ................................... - with nogil, parallel(num_threads=num_threads): - for ii in prange(1,nlos): - num_raf = los_nraf[ii] - loc_resol = eff_resolution[ii] - first_index = los_ind[ii -1] - left_rule_single(num_raf, los_kmin[ii], loc_resol, - &los_coeffs[0][first_index]) - return - - -cdef inline void simps_left_rule_abs(int nlos, double resol, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, - int num_threads) nogil: - # Simpson left quadrature rule with absolute resolution step - # for SEVERAL LOS - cdef long* los_nraf - # ... - los_nraf = malloc(nlos * sizeof(long)) - simps_left_rule_abs_s1(nlos, resol, - los_kmin, los_kmax, - eff_resolution, - los_ind, - los_nraf, - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - los_coeffs[0][0] = -1. - los_coeffs[0][1] = -1. - los_coeffs[0][2] = -1. - left_rule_abs_s2(nlos, resol, - los_kmin, los_kmax, - eff_resolution, - los_coeffs, - los_ind, - los_nraf, - num_threads) - free(los_nraf) - return - - -cdef inline void romb_left_rule_abs_s1(int nlos, double resol, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Romboid left quadrature rule with relative resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii, jj - cdef int num_raf - cdef int first_index - cdef double seg_length - cdef double loc_resol - cdef double inv_resol = 1./resol - # ... Treating the first los .................................... - seg_length = los_kmax[0] - los_kmin[0] - num_raf = (Cceil(seg_length*inv_resol)) - num_raf = 2**((Cceil(Clog2(num_raf)))) - loc_resol = seg_length / num_raf - eff_resolution[0] = loc_resol - los_nraf[0] = num_raf - first_index = 0 - los_ind[0] = num_raf + 1 - # ... Treating the rest of the los .............................. - for ii in range(1, nlos): - seg_length = los_kmax[ii] - los_kmin[ii] - num_raf = (Cceil(seg_length*inv_resol)) - num_raf = 2**((Cceil(Clog2(num_raf)))) - loc_resol = seg_length / num_raf - eff_resolution[ii] = loc_resol - los_nraf[ii] = num_raf - first_index = los_ind[ii-1] - los_ind[ii] = num_raf + 1 + first_index - return - - -cdef inline void romb_left_rule_abs(int nlos, double resol, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, int num_threads) nogil: - # Romboid left quadrature rule with relative resolution step - # for SEVERAL LOS - cdef long* los_nraf - # ... - los_nraf = malloc(nlos * sizeof(long)) - romb_left_rule_abs_s1(nlos, resol, - los_kmin, los_kmax, - eff_resolution, - los_ind, - los_nraf, - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - left_rule_abs_s2(nlos, resol, - los_kmin, los_kmax, - eff_resolution, - los_coeffs, - los_ind, - los_nraf, - num_threads) - free(los_nraf) - return - - -cdef inline void simps_left_rule_rel_var_s1(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Simpson left quadrature rule with variable relative resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int num_raf - cdef int first_index - cdef double loc_resol - num_raf = (Cceil(1./resolutions[0])) - if num_raf%2==1: - num_raf = num_raf+1 - loc_resol = (los_kmax[0] - los_kmin[0])/num_raf - eff_resolution[0] = loc_resol - los_nraf[0] = num_raf - first_index = 0 - los_ind[0] = num_raf + 1 - # ... - for ii in range(1, nlos): - num_raf = (Cceil(1./resolutions[ii])) - if num_raf%2==1: - num_raf = num_raf+1 - loc_resol = (los_kmax[ii] - los_kmin[ii]) / num_raf - eff_resolution[ii] = loc_resol - los_nraf[ii] = num_raf - first_index = los_ind[ii-1] - los_ind[ii] = num_raf + 1 + first_index - return - - -cdef inline void left_rule_rel_var_s2(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Simpson left quadrature rule with variable relative resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii - cdef int num_raf - cdef int first_index - cdef double loc_resol - # .. Treating first los ......................................... - num_raf = los_nraf[0] - loc_resol = eff_resolution[0] - first_index = 0 - left_rule_single(num_raf, los_kmin[0], loc_resol, - &los_coeffs[0][first_index]) - # ... and the rest of los ....................................... - with nogil, parallel(num_threads=num_threads): - for ii in prange(1,nlos): - num_raf = los_nraf[ii] - loc_resol = eff_resolution[ii] - first_index = los_ind[ii-1] - left_rule_single(num_raf, los_kmin[ii], loc_resol, - &los_coeffs[0][first_index]) - return - - -cdef inline void simps_left_rule_rel_var(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, - int num_threads) nogil: - # Simpson left quadrature rule with variable relative resolution step - # for SEVERAL LOS - cdef long* los_nraf - # ... - los_nraf = malloc(nlos * sizeof(long)) - simps_left_rule_rel_var_s1(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_ind, - los_nraf, - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - left_rule_rel_var_s2(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_coeffs, - los_ind, - los_nraf, - num_threads) - free(los_nraf) - return - - -cdef inline void simps_left_rule_abs_var_s1(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Simpson left quadrature rule with absolute variable resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii, jj - cdef int num_raf - cdef int first_index - cdef double seg_length - cdef double loc_resol - seg_length = los_kmax[0] - los_kmin[0] - num_raf = (Cceil(seg_length/resolutions[0])) - if num_raf%2==1: - num_raf = num_raf+1 - loc_resol = seg_length / num_raf - eff_resolution[0] = loc_resol - los_nraf[0] = num_raf - first_index = 0 - los_ind[0] = num_raf + 1 - # ... - for ii in range(1,nlos): - seg_length = los_kmax[ii] - los_kmin[ii] - num_raf = (Cceil(seg_length/resolutions[ii])) - if num_raf%2==1: - num_raf = num_raf+1 - loc_resol = seg_length / num_raf - eff_resolution[ii] = loc_resol - los_nraf[ii] = num_raf - first_index = los_ind[ii-1] - los_ind[ii] = num_raf + 1 + first_index - return - - - - -cdef inline void simps_left_rule_abs_var(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, - int num_threads) nogil: - # Simpson left quadrature rule with absolute variable resolution step - # for SEVERAL LOS - cdef long* los_nraf - # ... - los_nraf = malloc(nlos * sizeof(long)) - simps_left_rule_abs_var_s1(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_ind, - los_nraf, - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - left_rule_rel_var_s2(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_coeffs, - los_ind, - los_nraf, - num_threads) - free(los_nraf) - return - - -cdef inline void romb_left_rule_rel_var_s1(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Romboid left quadrature rule with relative variable resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii, jj - cdef int num_raf - cdef int first_index - cdef double loc_resol - num_raf = (Cceil(1./resolutions[0])) - num_raf = 2**((Cceil(Clog2(num_raf)))) - loc_resol = (los_kmax[0] - los_kmin[0])/num_raf - eff_resolution[0] = loc_resol - los_nraf[0] = num_raf - first_index = 0 - los_ind[0] = num_raf + 1 - # ... - for ii in range(1,nlos): - num_raf = (Cceil(1./resolutions[ii])) - num_raf = 2**((Cceil(Clog2(num_raf)))) - loc_resol = (los_kmax[ii] - los_kmin[ii]) / num_raf - eff_resolution[ii] = loc_resol - los_nraf[ii] = num_raf - first_index = los_ind[ii-1] - los_ind[ii] = num_raf + 1 + first_index - return - - -cdef inline void romb_left_rule_rel_var(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, - int num_threads) nogil: - # Romboid left quadrature rule with relative variable resolution step - # for SEVERAL LOS - cdef long* los_nraf - # ... - los_nraf = malloc(nlos * sizeof(long)) - romb_left_rule_rel_var_s1(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_ind, - los_nraf, - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - left_rule_rel_var_s2(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_coeffs, - los_ind, - los_nraf, - num_threads) - free(los_nraf) - return - - -cdef inline void romb_left_rule_abs_var_s1(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - long* los_ind, long* los_nraf, - int num_threads) nogil: - # Romboid left quadrature rule with absolute variable resolution step - # for SEVERAL LOS - cdef Py_ssize_t ii, jj - cdef int num_raf - cdef int first_index - cdef double seg_length - cdef double loc_resol - seg_length = los_kmax[0] - los_kmin[0] - num_raf = (Cceil(seg_length/resolutions[0])) - num_raf = 2**((Cceil(Clog2(num_raf)))) - loc_resol = seg_length / num_raf - eff_resolution[0] = loc_resol - los_nraf[0] = num_raf - first_index = 0 - los_ind[0] = num_raf + 1 - # ... - for ii in range(1,nlos): - seg_length = los_kmax[ii] - los_kmin[ii] - num_raf = (Cceil(seg_length/resolutions[ii])) - num_raf = 2**((Cceil(Clog2(num_raf)))) - loc_resol = seg_length / num_raf - eff_resolution[ii] = loc_resol - los_nraf[ii] = num_raf - first_index = los_ind[ii-1] - los_ind[ii] = num_raf + 1 + first_index - return - - -cdef inline void romb_left_rule_abs_var(int nlos, double* resolutions, - double* los_kmin, - double* los_kmax, - double* eff_resolution, - double** los_coeffs, - long* los_ind, - int num_threads) nogil: - # Romboid left quadrature rule with absolute variable resolution step - # for SEVERAL LOS - cdef long* los_nraf - # ... - los_nraf = malloc(nlos * sizeof(long)) - romb_left_rule_abs_var_s1(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_ind, - los_nraf, - num_threads) - los_coeffs[0] = malloc(los_ind[nlos-1]*sizeof(double)) - left_rule_rel_var_s2(nlos, resolutions, - los_kmin, los_kmax, - eff_resolution, - los_coeffs, - los_ind, - los_nraf, - num_threads) - free(los_nraf) - return - -# -- Get number of integration mode -------------------------------------------- -cdef inline int get_nb_imode(str imode) : - # gil required........... - if imode == 'sum': - return 0 - if imode == 'simps': - return 1 - if imode == 'romb': - return 2 - return -1 - -cdef inline int get_nb_dmode(str dmode) : - # gil required........... - if dmode == 'rel': - return 1 - return 0 # absolute - - -# ============================================================================== -# == LOS sampling Algorithm for a SINGLE LOS -# ============================================================================== -cdef inline int los_get_sample_single(double los_kmin, double los_kmax, - double resol, int n_dmode, int n_imode, - double[1] eff_res, - double** coeffs) nogil: - """ - Sampling line of sight of origin ray_orig, direction vector ray_vdir, - with discretization step resol, using the discretization method n_dmode, - and the quadrature rule n_imode. los_kmin defines the first limit of the LOS - Out parameters - -------------- - eff_res : effective resolution used - coeffs : 'k' coefficients on ray. - Returns - ======= - size of elements in coeffs[0] - The different type of discretizations and quadratures: - n_dmode - ======= - - 0 : the discretization step given is absolute ('abs') - - 1 : the discretization step given is relative ('rel') - n_imode - ===== - - 0 : 'sum' quadrature, using the n segment centers - - 1 : 'simps' return n+1 egdes, n even (for scipy.integrate.simps) - - 2 : 'romb' return n+1 edges, n+1 = 2**k+1 (for scipy.integrate.romb) - """ - cdef int nraf - cdef long[1] ind_cum - cdef double invnraf - cdef double invresol - cdef double seg_length - # ... - if n_dmode == 1: - # discretization step is relative - nraf = Cceil(1./resol) - if n_imode==0: - # 'sum' quad - coeffs[0] = malloc(nraf*sizeof(double)) - eff_res[0] = (los_kmax - los_kmin)/resol - middle_rule_single(nraf, los_kmin, eff_res[0], - &coeffs[0][0]) - return nraf - elif n_imode==1: - # 'simps' quad - if nraf%2==1: - nraf = nraf+1 - invnraf = 1./nraf - coeffs[0] = malloc((nraf + 1)*sizeof(double)) - eff_res[0] = (los_kmax - los_kmin)*invnraf - left_rule_single(nraf, los_kmin, - eff_res[0], &coeffs[0][0]) - return nraf + 1 - elif n_imode==2: - # 'romb' quad - nraf = 2**((Cceil(Clog2(nraf)))) - invnraf = 1./nraf - coeffs[0] = malloc((nraf + 1)*sizeof(double)) - eff_res[0] = (los_kmax - los_kmin)*invnraf - left_rule_single(nraf, los_kmin, - eff_res[0], &coeffs[0][0]) - return nraf + 1 - else: - # discretization step is absolute, n_dmode==0 - if n_imode==0: - # 'sum' quad - invresol = 1./resol - middle_rule_abs_s1_single(invresol, los_kmin, los_kmax, - &eff_res[0], &ind_cum[0]) - coeffs[0] = malloc((ind_cum[0])*sizeof(double)) - middle_rule_single(ind_cum[0], los_kmin, eff_res[0], - &coeffs[0][0]) - return ind_cum[0] - elif n_imode==1: - # 'simps' quad - seg_length = los_kmax - los_kmin - nraf = (Cceil(seg_length/resol)) - if nraf%2==1: - nraf = nraf+1 - eff_res[0] = seg_length / nraf - coeffs[0] = malloc((nraf+1)*sizeof(double)) - left_rule_single(nraf, los_kmin, eff_res[0], - &coeffs[0][0]) - return nraf + 1 - elif n_imode==2: - # 'romb' quad - seg_length = los_kmax - los_kmin - nraf = (Cceil(seg_length/resol)) - nraf = 2**((Cceil(Clog2(nraf)))) - eff_res[0] = seg_length / nraf - coeffs[0] = malloc((nraf+1)*sizeof(double)) - left_rule_single(nraf, los_kmin, eff_res[0], - &coeffs[0][0]) - return nraf + 1 - return -1 - - -# ============================================================================== -# == Utility functions for signal computation (LOS_calc_signal) -# ============================================================================== - -# -- anisotropic case ---------------------------------------------------- -cdef inline call_get_sample_single_ani(double los_kmin, double los_kmax, - double resol, - int n_dmode, int n_imode, - double[1] eff_res, - long[1] nb_rows, - double[:,::1] ray_orig, - double[:,::1] ray_vdir): - # This function doesn't compute anything new. - # It's a utility function for LOS_calc_signal to avoid reptitions - # It samples a LOS and recreates the points on that LOS - # plus this is for the anisotropic version so it also compute usbis - cdef int sz_coeff - cdef double** los_coeffs = NULL - cdef cnp.ndarray[double,ndim=1,mode='c'] ksbis - cdef cnp.ndarray[double,ndim=2,mode='c'] usbis - cdef cnp.ndarray[double,ndim=2,mode='c'] pts - - # Initialization utility array - los_coeffs = malloc(sizeof(double*)) - los_coeffs[0] = NULL - # Sampling - sz_coeff = los_get_sample_single(los_kmin, los_kmax, - resol, - n_dmode, n_imode, - &eff_res[0], - &los_coeffs[0]) - nb_rows[0] = sz_coeff - # computing points - usbis = np.repeat(ray_vdir, sz_coeff, axis=1) - ksbis = np.asarray(los_coeffs[0]) - pts = ray_orig + ksbis[None,:] * usbis - if los_coeffs != NULL: - if los_coeffs[0] != NULL: - free(los_coeffs[0]) - free(los_coeffs) - return pts, usbis - -# -- not anisotropic ------------------------------------------------------ -cdef inline cnp.ndarray[double,ndim=2,mode='c'] call_get_sample_single(double los_kmin, double los_kmax, - double resol, - int n_dmode, int n_imode, - double[1] eff_res, - long[1] nb_rows, - double[:,::1] ray_orig, - double[:,::1] ray_vdir): - # This function doesn't compute anything new. - # It's a utility function for LOS_calc_signal to avoid reptitions - # It samples a LOS and recreates the points on that LOS - # plus this is for the anisotropic version so it also compute usbis - cdef int sz_coeff - cdef int ii, jj - cdef double** los_coeffs = NULL - cdef cnp.ndarray[double,ndim=2,mode='c'] pts - # Initialization utility array - los_coeffs = malloc(sizeof(double*)) - los_coeffs[0] = NULL - # Sampling - sz_coeff = los_get_sample_single(los_kmin, los_kmax, - resol, - n_dmode, n_imode, - &eff_res[0], - &los_coeffs[0]) - nb_rows[0] = sz_coeff - # computing points - pts = ray_orig \ - + np.asarray(los_coeffs[0]) \ - * np.repeat(ray_vdir, sz_coeff, axis=1) - if los_coeffs != NULL: - if los_coeffs[0] != NULL: - free(los_coeffs[0]) - free(los_coeffs) - return pts - - -# -- LOS get sample utility ----------------------------------------------- -cdef inline int los_get_sample_core_const_res(int nlos, - double* los_lim_min, - double* los_lim_max, - int n_dmode, int n_imode, - double val_resol, - double** coeff_ptr, - double* dLr, - long* los_ind, - int num_threads) nogil: - # ... - cdef int N - cdef int ntmp - if n_dmode==1: # relative - # return coeff_arr, dLr, los_ind[:nlos-1] - N = Cceil(1./val_resol) - if n_imode==0: # sum - #coeff_arr = np.empty((N*nlos,), dtype=float) - coeff_ptr[0] = malloc(sizeof(double)*N*nlos) - middle_rule_rel(nlos, N, los_lim_min, los_lim_max, - &dLr[0], coeff_ptr[0], los_ind, - num_threads=num_threads) - return N*nlos - elif n_imode==1: #simps - N = N if N%2==0 else N+1 - # coeff_arr = np.empty(((N+1)*nlos,), dtype=float) - coeff_ptr[0] = malloc(sizeof(double)*(N+1)*nlos) - left_rule_rel(nlos, N, - los_lim_min, los_lim_max, &dLr[0], - coeff_ptr[0], los_ind, - num_threads=num_threads) - return (N+1)*nlos - elif n_imode==2: #romb - N = 2**(Cceil(Clog2(N))) - # coeff_arr = np.empty(((N+1)*nlos,), dtype=float) - coeff_ptr[0] = malloc(sizeof(double)*(N+1)*nlos) - left_rule_rel(nlos, N, - los_lim_min, los_lim_max, - &dLr[0], coeff_ptr[0], los_ind, - num_threads=num_threads) - return (N+1)*nlos - else: # absolute - if n_imode==0: #sum - middle_rule_abs_s1(nlos, val_resol, los_lim_min, los_lim_max, - &dLr[0], los_ind, - num_threads=num_threads) - #ntmp = np.sum(los_ind) - #coeff_arr = np.empty((ntmp,), dtype=float) - ntmp = _bgt.sum_naive_int(los_ind, nlos) - coeff_ptr[0] = malloc(sizeof(double)*ntmp) - middle_rule_abs_s2(nlos, los_lim_min, &dLr[0], - los_ind, coeff_ptr[0], - num_threads=num_threads) - return ntmp - elif n_imode==1:# simps - simps_left_rule_abs(nlos, val_resol, - los_lim_min, los_lim_max, - &dLr[0], coeff_ptr, los_ind, - num_threads=num_threads) - return los_ind[nlos-1] - else:# romb - romb_left_rule_abs(nlos, val_resol, - los_lim_min, los_lim_max, - &dLr[0], coeff_ptr, los_ind, - num_threads=num_threads) - return los_ind[nlos-1] - return -1 - -cdef inline void los_get_sample_core_var_res(int nlos, - double* los_lim_min, - double* los_lim_max, - int n_dmode, int n_imode, - double* resol, - double** coeff_ptr, - double* eff_res, - long* los_ind, - int num_threads) nogil: - if n_dmode==0: #absolute - if n_imode==0: # sum - middle_rule_abs_var(nlos, - los_lim_min, los_lim_max, - resol, &eff_res[0], - coeff_ptr, los_ind, - num_threads=num_threads) - elif n_imode==1:# simps - simps_left_rule_abs_var(nlos, resol, - los_lim_min, los_lim_max, - &eff_res[0], coeff_ptr, los_ind, - num_threads=num_threads) - else: # romb - romb_left_rule_abs_var(nlos, resol, - los_lim_min, los_lim_max, - &eff_res[0], coeff_ptr, los_ind, - num_threads=num_threads) - else: # relative - if n_imode==0: # sum - middle_rule_rel_var(nlos, resol, - los_lim_min, los_lim_max, - &eff_res[0], coeff_ptr, los_ind, - num_threads=num_threads) - elif n_imode==1: # simps - simps_left_rule_rel_var(nlos, resol, - los_lim_min, los_lim_max, - &eff_res[0], coeff_ptr, los_ind, - num_threads=num_threads) - else: # romb - romb_left_rule_rel_var(nlos, resol, - los_lim_min, los_lim_max, - &eff_res[0], coeff_ptr, los_ind, - num_threads=num_threads) - return - - -# # -- utility for calc signal --------------------------------------------------- -cdef inline void los_get_sample_pts(int nlos, - double* ptx, - double* pty, - double* ptz, - double* usx, - double* usy, - double* usz, - double[:,::1] ray_orig, - double[:,::1] ray_vdir, - double* coeff_ptr, - long* los_ind, - int num_threads) nogil: - cdef double loc_ox, loc_oy, loc_oz - cdef double loc_vx, loc_vy, loc_vz - cdef int ii, jj - # Initialization - loc_ox = ray_orig[0,0] - loc_oy = ray_orig[1,0] - loc_oz = ray_orig[2,0] - loc_vx = ray_vdir[0,0] - loc_vy = ray_vdir[1,0] - loc_vz = ray_vdir[2,0] - for ii in range(los_ind[0]): - ptx[ii] = loc_ox + coeff_ptr[ii] + loc_vx - pty[ii] = loc_oy + coeff_ptr[ii] + loc_vy - ptz[ii] = loc_oz + coeff_ptr[ii] + loc_vz - usx[ii] = loc_vx - usy[ii] = loc_vy - usz[ii] = loc_vz - # Other lines of sights: - for jj in range(1, nlos): - loc_ox = ray_orig[0,jj] - loc_oy = ray_orig[1,jj] - loc_oz = ray_orig[2,jj] - loc_vx = ray_vdir[0,jj] - loc_vy = ray_vdir[1,jj] - loc_vz = ray_vdir[2,jj] - for ii in range(los_ind[jj-1], los_ind[jj]): - ptx[ii] = loc_ox + coeff_ptr[ii] + loc_vx - pty[ii] = loc_oy + coeff_ptr[ii] + loc_vy - ptz[ii] = loc_oz + coeff_ptr[ii] + loc_vz - usx[ii] = loc_vx - usy[ii] = loc_vy - usz[ii] = loc_vz - return - - -# -- calling sampling and intergrating with sum -------------------------------- -cdef inline void integrate_sum_nlos(int nlos, int nt, - double[:,::1] val_2d, - double[::1,:] sig_mv, - long* ind_arr, - double* reseff_arr, - int num_threads) nogil: - cdef int ii, jj - cdef int jjp1 - jj = 0 - jjp1 = ind_arr[0] - integrate_c_sum_mat(val_2d[:,jj:jjp1], - &sig_mv[0,0], - nt, jjp1 - jj, - reseff_arr[0], num_threads) - with nogil, parallel(num_threads=num_threads): - for ii in prange(1,nlos): - # sig[:,ii] = np.sum(val_2d[:,indbis[ii]:indbis[ii+1]], - # axis=-1)*reseff_mv[ii] - jj = ind_arr[ii-1] - jjp1 = ind_arr[ii] - integrate_c_sum_mat(val_2d[:,jj:jjp1], - &sig_mv[0,ii], - nt, jjp1 - jj, - reseff_arr[ii], num_threads) - return - -cdef inline void integrate_c_sum_mat(double[:,::1] val_mv, - double* sig, - int nrows, int ncols, - double loc_eff_res, - int num_threads) nogil: - cdef double* vsum - cdef int jj - # ... - vsum = malloc(nrows*sizeof(double)) - _bgt.sum_rows_blocks(&val_mv[0,0], &vsum[0], - nrows, ncols) - # _bgt.sum_by_rows(val_mv, &vsum[0], - # nrows, ncols) - # _bgt.sum_naive_rows(val_mv, &vsum[0], - # nrows, ncols) - # _bgt.sum_par_mat(val_mv, &vsum[0], - # nrows, ncols) - for jj in range(nrows): - sig[jj] = vsum[jj] * loc_eff_res - free(vsum) - return - - -cdef inline double integrate_c_sum_vec(double* val_mv, - int nsz, - double loc_eff_res, - int num_threads) nogil: - cdef double vsum - cdef int jj - # ... - vsum = _bgt.sum_par_one_row(val_mv, nsz) - return vsum * loc_eff_res diff --git a/tofu/geom/_vignetting_tools.pxd b/tofu/geom/_vignetting_tools.pxd deleted file mode 100644 index 880a1fbd2..000000000 --- a/tofu/geom/_vignetting_tools.pxd +++ /dev/null @@ -1,46 +0,0 @@ -# distutils: language=c++ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -# -################################################################################ -# Utility functions for the earclipping techinque for triangulation of a -# polygon. This is really useful when vignetting, as the computation to know -# if a ray intersected a polygon, is easier if we check if the polygon is -# discretized in triangles and then we check if the ray intersected each -# triangle. -################################################################################ -cdef void compute_diff3d(double* orig, - int nvert, - double* diff) nogil - -cdef void are_points_reflex(int nvert, - double* diff, - bint* are_reflex) nogil - -cdef bint is_pt_in_tri(double[3] v0, double[3] v1, - double ax, double ay, double az, - double px, double py, double pz) nogil - -cdef void earclipping_poly(double* vignett, - long* ltri, - double* diff, - bint* lref, - int nvert) nogil - -cdef int triangulate_polys(double** vignett_poly, - long* lnvert, - int nvign, - long** ltri, - int num_threads) nogil except -1 - -cdef void vignetting_core(double[:, ::1] ray_orig, - double[:, ::1] ray_vdir, - double** vignett, - long* lnvert, - double* lbounds, - long** ltri, - int nvign, - int nlos, - bint* goes_through, - int num_threads) nogil diff --git a/tofu/geom/_vignetting_tools.pyx b/tofu/geom/_vignetting_tools.pyx deleted file mode 100644 index 94a487a88..000000000 --- a/tofu/geom/_vignetting_tools.pyx +++ /dev/null @@ -1,356 +0,0 @@ -# distutils: language=c++ -# cython: boundscheck=False -# cython: wraparound=False -# cython: cdivision=True -# -################################################################################ -# Utility functions for the earclipping techinque for triangulation of a -# polygon. This is really useful when vignetting, as the computation to know -# if a ray intersected a polygon, is easier if we check if the polygon is -# discretized in triangles and then we check if the ray intersected each -# triangle. -################################################################################ -cimport cython -from cython.parallel import prange -from cython.parallel cimport parallel -from libcpp.vector cimport vector -from libc.stdlib cimport malloc, free -cimport _raytracing_tools as _rt -cimport _basic_geom_tools as _bgt - - -# ============================================================================== -# = Basic utilities: is angle reflex, vector np.diff, is point in triangle,... -# ============================================================================== -cdef inline bint is_reflex(const double[3] u, - const double[3] v) nogil: - """ - Determines if the angle between U and -V is reflex (angle > pi) or not. - Warning: note the MINUS in front of V, this was done as this is the only - form how we will need this function. but it is NOT general. - """ - cdef int ii - cdef double sumc - cdef double[3] ucrossv - # ... - _bgt.compute_cross_prod(u, v, ucrossv) - sumc = 0.0 - for ii in range(3): - # normally it should be a sum, but it is a minus cause is we have (U,-V) - sumc = ucrossv[ii] - return sumc >= 0. - -cdef inline void compute_diff3d(double* orig, - int nvert, - double* diff) nogil: - cdef int ivert - for ivert in range(nvert-1): - diff[ivert*3 + 0] = orig[0*nvert+(ivert+1)] - orig[0*nvert+ivert] - diff[ivert*3 + 1] = orig[1*nvert+(ivert+1)] - orig[1*nvert+ivert] - diff[ivert*3 + 2] = orig[2*nvert+(ivert+1)] - orig[2*nvert+ivert] - # doing the last point: - diff[3*(nvert-1) + 0] = orig[0*nvert] - orig[0*nvert+(nvert-1)] - diff[3*(nvert-1) + 1] = orig[1*nvert] - orig[1*nvert+(nvert-1)] - diff[3*(nvert-1) + 2] = orig[2*nvert] - orig[2*nvert+(nvert-1)] - return - -cdef inline void are_points_reflex(int nvert, - double* diff, - bint* are_reflex) nogil: - """ - Determines if the interior angles of a polygons are reflex - (angle > pi) or not. - """ - cdef int ivert - cdef int icoord - cdef double[3] u1, v1, un, vn - # .. Computing if reflex or not ........................................... - for ivert in range(1,nvert): - are_reflex[ivert] = is_reflex(&diff[ivert*3], &diff[(ivert-1)*3]) - # doing first point: - are_reflex[0] = is_reflex(&diff[0], &diff[(nvert-1)*3]) - return - -cdef inline bint is_pt_in_tri(double[3] v0, double[3] v1, - double Ax, double Ay, double Az, - double px, double py, double pz) nogil: - """ - Tests if point P is on the triangle A, B, C such that - v0 = C - A - v1 = -B + A - and A = (Ax, Ay, Az) and P = (px, py, pz) - """ - cdef double[3] v2 - cdef double dot00, dot01, dot02 - cdef double dot11, dot12 - cdef double invDenom - cdef double u, v - cdef double denom - # computing vector between A and P - v2[0] = px - Ax - v2[1] = py - Ay - v2[2] = pz - Az - # compute dot products - dot00 = _bgt.compute_dot_prod(v0, v0) - dot01 = -_bgt.compute_dot_prod(v0, v1) - dot02 = _bgt.compute_dot_prod(v0, v2) - dot11 = _bgt.compute_dot_prod(v1, v1) - dot12 = -_bgt.compute_dot_prod(v1, v2) - # Compute barycentric coordinates - denom = dot00 * dot11 - dot01 * dot01 - invDenom = 1. / denom - u = (dot11 * dot02 - dot01 * dot12) * invDenom - v = (dot00 * dot12 - dot01 * dot02) * invDenom - # Check if point is in triangle - return (u >= 0) and (v >= 0) and (u + v <= 1) - - -# ============================================================================== -# = Earclipping method: getting one ear of a poly, triangulate poly, ... -# ============================================================================== -cdef inline int get_one_ear(double* polygon, - double* diff, - bint* lref, - vector[int] working_index, - int nvert, int orig_nvert) nogil: - """ - A polygon's "ear" is defined as a triangle of vert_i-1, vert_i, vert_i+1, - points on the polygon, where the point vert_i has the following properties: - - Its interior angle is not reflex (angle < pi) - - None of the other vertices of the polygon are in the triangle formed - by its two annexing points - Note: only reflex edges can be on the triangle - polygon : (3*nvert) [x0, x1, x2..., x_nvert, y0, y1, ... y_nvert, z0...] - diff : (3*nvert) [P1 - P0, P2-P1, ...] - lref : (nvert) [is_reflex(P0), is_reflex(P1), ...] - working_index : to avoid memory allocation and deallocation, we work with - with only ONE vector, that allow us to know which of the orignal - orig_nvert vertices is still being used. - At the beginning working_index = range(orig_nvert) - if we took out ONE ear (vertex), for example vertex ii, then: - nvert = orig_nvert - 1 - working_index = [0,..., ii-1,ii+1,ii+2,...orig_nvert] - and the other tabs are also updated: - diff = [P1-P0,...., Pii+1 - Pii-1, X, ....] - lref = [ .. is_reflex(Pii-1), X, is_reflex(Pii+1),..] - where X represents values that will never be used ! - """ - cdef int iloc - cdef int i, j - cdef int wi, wj - cdef int wip1, wim1 - cdef bint a_pt_in_tri - for i in range(1, nvert-1): - wi = working_index[i] - if not lref[wi]: - # angle is not reflex - a_pt_in_tri = False - # we get some useful values - wip1 = working_index[i+1] - wim1 = working_index[i-1] - # We can test if there is another vertex in the 'ear' - for j in range(nvert): - wj = working_index[j] - # We only test reflex angles, and points that are not - # edges of the triangle - if (lref[wj] and wj != wim1 and wj != wip1 and wj != wi): - if is_pt_in_tri(&diff[wi*3], &diff[wim1*3], - polygon[0*orig_nvert+wi], - polygon[1*orig_nvert+wi], - polygon[2*orig_nvert+wi], - polygon[0*orig_nvert+wj], - polygon[1*orig_nvert+wj], - polygon[2*orig_nvert+wj]): - # We found a point in the triangle, thus is not ear - # no need to keep testing.... - a_pt_in_tri = True - break - # Let's check if there was a point in the triangle.... - if not a_pt_in_tri: - return i # if not, we found an ear - # if we havent returned, either, there was an error somerwhere - with gil: - assert False, "Got here but shouldnt have " - return -1 - -cdef inline void earclipping_poly(double* vignett, - long* ltri, - double* diff, - bint* lref, - int nvert) nogil: - """ - Triangulates a polygon by earclipping an edge at a time. - vignett : (3*nvert) coordinates of poly - nvert : number of vertices - Result - ltri : (3*(nvert-2)) int array, indices of triangles - """ - # init... - cdef int loc_nv = nvert - cdef int itri = 0 - cdef int ii, jj - cdef int wi, wim1, wip1 - cdef int iear - cdef vector[int] working_index - # .. First computing the edges coodinates ................................. - # .. and checking if the angles defined by the edges are reflex or not..... - # initialization of working index tab: - for ii in range(nvert): - working_index.push_back(ii) - # .. Loop .................................................................. - for itri in range(nvert-3): - iear = get_one_ear(vignett, &diff[0], &lref[0], - working_index, loc_nv, nvert) - wim1 = working_index[iear-1] - wi = working_index[iear] - wip1 = working_index[iear+1] - ltri[itri*3] = wim1 - ltri[itri*3+1] = wi - ltri[itri*3+2] = wip1 - # updates on the "information" arrays: - diff[wim1*3] = vignett[0*nvert+wip1] - vignett[0*nvert+wim1] - diff[wim1*3+1] = vignett[1*nvert+wip1] - vignett[1*nvert+wim1] - diff[wim1*3+2] = vignett[2*nvert+wip1] - vignett[2*nvert+wim1] - #... theoritically we should get rid of off diff[wip1] as well but - # we'll just not use it, however we have to update lref - # if an angle is not reflex, then it will stay so, only chage if reflex - if lref[wim1]: - if iear >= 2: - lref[wim1] = is_reflex(&diff[3*wim1], - &diff[3*working_index[iear-2]]) - else: - lref[wim1] = is_reflex(&diff[3*wim1], - &diff[3*working_index[loc_nv-1]]) - if lref[wip1]: - lref[wip1] = is_reflex(&diff[wip1*3], - &diff[wim1*3]) - # last but not least update on number of vertices and working indices - loc_nv = loc_nv - 1 - working_index.erase(working_index.begin()+iear) - # we only have three points left, so that is the last triangle: - ltri[(itri+1)*3] = working_index[0] - ltri[(itri+1)*3+1] = working_index[1] - ltri[(itri+1)*3+2] = working_index[2] - return - -# ============================================================================== -# = Polygons triangulation and Intersection Ray-Poly -# ============================================================================== -cdef inline int triangulate_polys(double** vignett_poly, - long* lnvert, - int nvign, - long** ltri, - int num_threads) nogil except -1: - """ - Triangulates a list 3d polygon using the earclipping techinque - https://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf - Returns - ltri: 3*(nvert-2)*nvign : - = [{tri_0_0, tri_0_1, ... tri_0_nvert0}, ..., {tri_nvign_0, ...}] - where tri_i_j are the 3 indices of the vertex forming a sub-triangle - on each vertex (-2) and for each vignett - """ - cdef int ivign, ii - cdef int nvert - cdef double* diff = NULL - cdef bint* lref = NULL - # ... - # -- Defining parallel part ------------------------------------------------ - with nogil, parallel(num_threads=num_threads): - for ivign in prange(nvign): - nvert = lnvert[ivign] - diff = malloc(3*nvert*sizeof(double)) - lref = malloc(nvert*sizeof(bint)) - ltri[ivign] = malloc((nvert-2)*3*sizeof(long)) - if not diff or not lref or not ltri[ivign]: - with gil: - raise MemoryError() - try: - compute_diff3d(vignett_poly[ivign], nvert, &diff[0]) - are_points_reflex(nvert, diff, &lref[0]) - earclipping_poly(vignett_poly[ivign], <ri[ivign][0], - &diff[0], &lref[0], nvert) - finally: - free(diff) - free(lref) - - return 0 - -cdef inline bint inter_ray_poly(const double[3] ray_orig, - const double[3] ray_vdir, - double* vignett, - int nvert, - long* ltri) nogil: - cdef int ii, jj - cdef double[3] pt1 - cdef double[3] pt2 - cdef double[3] pt3 - #... - for ii in range(nvert-2): - for jj in range(3): - pt1[jj] = vignett[ltri[3*ii+0] + jj * nvert] - pt2[jj] = vignett[ltri[3*ii+1] + jj * nvert] - pt3[jj] = vignett[ltri[3*ii+2] + jj * nvert] - if _rt.inter_ray_triangle(ray_orig, ray_vdir, pt1, pt2, pt3): - return True - return False - -# ============================================================================== -# = Vignetting -# ============================================================================== -cdef inline void vignetting_core(double[:, ::1] ray_orig, - double[:, ::1] ray_vdir, - double** vignett, - long* lnvert, - double* lbounds, - long** ltri, - int nvign, - int nlos, - bint* goes_through, - int num_threads) nogil: - cdef int ilos, ivign - cdef int jj - cdef int nvert - cdef bint inter_bbox - cdef double* loc_org = NULL - cdef double* loc_dir = NULL - cdef double* invr_ray = NULL - cdef int* sign_ray = NULL - # == Defining parallel part ================================================ - with nogil, parallel(num_threads=num_threads): - # We use local arrays for each thread so - loc_org = malloc(sizeof(double) * 3) - loc_dir = malloc(sizeof(double) * 3) - invr_ray = malloc(sizeof(double) * 3) - sign_ray = malloc(sizeof(int) * 3) - for ilos in prange(nlos): - loc_org[0] = ray_orig[0, ilos] - loc_org[1] = ray_orig[1, ilos] - loc_org[2] = ray_orig[2, ilos] - loc_dir[0] = ray_vdir[0, ilos] - loc_dir[1] = ray_vdir[1, ilos] - loc_dir[2] = ray_vdir[2, ilos] - _bgt.compute_inv_and_sign(loc_dir, sign_ray, invr_ray) - jj = ilos*nvign - for ivign in range(nvign): - nvert = lnvert[ivign] - # -- We check if intersection with bounding box --------------- - inter_bbox = _rt.inter_ray_aabb_box(sign_ray, invr_ray, - &lbounds[6*ivign], - &loc_org[0], - countin=True) - if not inter_bbox: - goes_through[ivign + jj] = False - continue - # -- if none, we continue -------------------------------------- - goes_through[ivign + jj] = inter_ray_poly(&loc_org[0], - &loc_dir[0], - vignett[ivign], - nvert, - ltri[ivign]) - - free(loc_org) - free(loc_dir) - free(invr_ray) - free(sign_ray) - return diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_BlV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_BlV0.txt deleted file mode 100644 index 2596eeceb..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_BlV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = BlV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -1.082999999999999963e+00 -1.199999999999999956e+00 -1.082999999999999963e+00 -2.399999999999999911e+00 -1.155000000000000027e+00 -2.399999999999999911e+00 -1.154999530098605787e+00 -1.199999999999999956e+00 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_BuV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_BuV0.txt deleted file mode 100644 index 364018196..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_BuV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = BuV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -1.082000000000000073e+00 2.399999999999999911e+00 -1.082000000000000073e+00 1.199999999999999956e+00 -1.154999704364031432e+00 1.199999999999999956e+00 -1.155000000000000027e+00 2.399999999999999911e+00 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_CSV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_CSV0.txt deleted file mode 100644 index e15ee7d97..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_CSV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = CSV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -6.690000000000000391e-01 8.750000000000000000e-01 -6.690000000000000391e-01 -8.449999999999999734e-01 -8.120000000000000551e-01 -8.449999999999999734e-01 -8.120000000000000551e-01 8.750000000000000000e-01 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivLow1V0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivLow1V0.txt deleted file mode 100644 index 7ba6aa81e..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivLow1V0.txt +++ /dev/null @@ -1,14 +0,0 @@ -#Name = DivLow1V0 -#Exp = WEST -#CLs = CoilPF -1.000000000000000000e+01 0.000000000000000000e+00 -2.042206995923038004e+00 -7.415929999999999467e-01 -2.042207050252251133e+00 -7.075930000000000275e-01 -1.980792770570662276e+00 -7.075930000000000275e-01 -1.980793050544402689e+00 -7.730069999999999997e-01 -2.042206995923038004e+00 -7.730069999999999997e-01 -2.044793069367166982e+00 -7.730069999999999997e-01 -2.044792623226619366e+00 -8.070069999999999188e-01 -2.106206893914508438e+00 -8.070069999999999188e-01 -2.106207112893221378e+00 -7.415929999999999467e-01 -2.044793069367166982e+00 -7.415929999999999467e-01 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivLow2V0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivLow2V0.txt deleted file mode 100644 index c53365e7b..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivLow2V0.txt +++ /dev/null @@ -1,14 +0,0 @@ -#Name = DivLow2V0 -#Exp = WEST -#CLs = CoilPF -1.000000000000000000e+01 0.000000000000000000e+00 -2.197207179608240857e+00 -8.042129999999999557e-01 -2.197207006883284297e+00 -7.702130000000000365e-01 -2.135793040491517747e+00 -7.702130000000000365e-01 -2.135792222643860150e+00 -8.356270000000000087e-01 -2.197207179608240857e+00 -8.356270000000000087e-01 -2.199792764232576303e+00 -8.356270000000000087e-01 -2.199793278210023129e+00 -8.696269999999999278e-01 -2.261207341145433425e+00 -8.696269999999999278e-01 -2.261206680372229716e+00 -8.042129999999999557e-01 -2.199792764232576303e+00 -8.042129999999999557e-01 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivUp1V0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivUp1V0.txt deleted file mode 100644 index 8ed6a1cd7..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivUp1V0.txt +++ /dev/null @@ -1,14 +0,0 @@ -#Name = DivUp1V0 -#Exp = WEST -#CLs = CoilPF -1.000000000000000000e+01 0.000000000000000000e+00 -2.042207645190126097e+00 7.759070000000000134e-01 -1.980793050544402689e+00 7.759070000000000134e-01 -1.980792770570662276e+00 7.104930000000000412e-01 -2.042207050252251133e+00 7.104930000000000412e-01 -2.042207645190126097e+00 7.444930000000000714e-01 -2.044793069367166982e+00 7.444930000000000714e-01 -2.106207112893221378e+00 7.444930000000000714e-01 -2.106206893914508438e+00 8.099070000000000435e-01 -2.044792623226619366e+00 8.099070000000000435e-01 -2.044793069367166982e+00 7.759070000000000134e-01 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivUp2V0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivUp2V0.txt deleted file mode 100644 index 6c0762f53..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DivUp2V0.txt +++ /dev/null @@ -1,14 +0,0 @@ -#Name = DivUp2V0 -#Exp = WEST -#CLs = CoilPF -1.000000000000000000e+01 0.000000000000000000e+00 -2.197207179608240857e+00 8.385270000000000223e-01 -2.135792222643860150e+00 8.385270000000000223e-01 -2.135793040491517747e+00 7.731130000000000502e-01 -2.197207006883284297e+00 7.731130000000000502e-01 -2.197207179608240857e+00 8.071130000000000804e-01 -2.199792764232576303e+00 8.071130000000000804e-01 -2.261206680372229716e+00 8.071130000000000804e-01 -2.261207341145433425e+00 8.725270000000000525e-01 -2.199793278210023129e+00 8.725270000000000525e-01 -2.199792764232576303e+00 8.385270000000000223e-01 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DlV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DlV0.txt deleted file mode 100644 index 7096f7665..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DlV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = DlV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -2.748000164891553077e+00 -1.745999999999999996e+00 -2.748000164891553077e+00 -2.108999999999999986e+00 -3.015000352983229881e+00 -2.108999999999999986e+00 -3.015000352983229881e+00 -1.745999999999999996e+00 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DuV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DuV0.txt deleted file mode 100644 index e09f9de19..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_DuV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = DuV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -2.748000164891553077e+00 2.108999999999999986e+00 -2.748000164891553077e+00 1.745999999999999996e+00 -3.015000352983229881e+00 1.745999999999999996e+00 -3.015000352983229881e+00 2.108999999999999986e+00 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_ElV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_ElV0.txt deleted file mode 100644 index 5a000cbd6..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_ElV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = ElV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -3.627999857166479991e+00 -1.346000000000000085e+00 -3.627999857166479991e+00 -1.735999999999999988e+00 -3.914999605251704207e+00 -1.735999999999999988e+00 -3.914999605251704207e+00 -1.346000000000000085e+00 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_EuV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_EuV0.txt deleted file mode 100644 index 46d40f69e..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_EuV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = EuV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -3.627999857166479991e+00 1.735999999999999988e+00 -3.627999857166479991e+00 1.346000000000000085e+00 -3.914999605251704207e+00 1.346000000000000085e+00 -3.914999605251704207e+00 1.735999999999999988e+00 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_FlV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_FlV0.txt deleted file mode 100644 index e2c9165ca..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_FlV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = FlV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -4.229999603353291171e+00 -4.520000000000000129e-01 -4.229999603353291171e+00 -8.399999999999999689e-01 -4.519000173463263437e+00 -8.399999999999999689e-01 -4.519000173463263437e+00 -4.520000000000000129e-01 diff --git a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_FuV0.txt b/tofu/geom/inputs/TFG_CoilPF_ExpWEST_FuV0.txt deleted file mode 100644 index 9af172cd0..000000000 --- a/tofu/geom/inputs/TFG_CoilPF_ExpWEST_FuV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -#Name = FuV0 -#Exp = WEST -#CLs = CoilPF -4.000000000000000000e+00 0.000000000000000000e+00 -4.229999603353291171e+00 8.379999999999999671e-01 -4.229999603353291171e+00 4.500000000000000111e-01 -4.519000173463263437e+00 4.500000000000000111e-01 -4.519000173463263437e+00 8.379999999999999671e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV0.txt deleted file mode 100644 index 1a14e3ea5..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV0.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BaffleV0 -1.300000000000000000e+01 0.000000000000000000e+00 -2.615000000000000213e+00 -8.394000000000001460e-01 -2.635000000000000231e+00 -8.394000000000001460e-01 -2.635000000000000231e+00 -7.304000000000001602e-01 -2.694999999999999840e+00 -7.304000000000001602e-01 -2.785600000000000076e+00 -6.934000000000000163e-01 -2.785600000000000076e+00 -6.754000000000000004e-01 -2.389499999999999957e+00 -6.754000000000000004e-01 -2.380900000000000016e+00 -6.815999999999999837e-01 -2.380900000000000016e+00 -6.872000000000000330e-01 -2.389499999999999957e+00 -6.934000000000000163e-01 -2.462000000000000188e+00 -6.934000000000000163e-01 -2.471999999999999975e+00 -7.304000000000001602e-01 -2.615000000000000213e+00 -7.304000000000001602e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV1.txt deleted file mode 100644 index 17f44d16d..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV1.txt +++ /dev/null @@ -1,35 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BaffleV1 -3.100000000000000000e+01 0.000000000000000000e+00 -2.580000000000000071e+00 -8.594000000000001638e-01 -2.669999999999999929e+00 -8.594000000000001638e-01 -2.669999999999999929e+00 -8.394000000000001460e-01 -2.635000000000000231e+00 -8.394000000000001460e-01 -2.635000000000000231e+00 -7.304000000000001602e-01 -2.694999999999999840e+00 -7.304000000000001602e-01 -2.697999999999999954e+00 -7.084000000000000297e-01 -2.750000000000000000e+00 -7.084000000000000297e-01 -2.750000000000000000e+00 -6.934000000000000163e-01 -2.785600000000000076e+00 -6.934000000000000163e-01 -2.785600000000000076e+00 -6.754000000000000004e-01 -2.726570000000000160e+00 -6.754000000000000004e-01 -2.617669999999999941e+00 -6.754000000000000004e-01 -2.465250000000000163e+00 -6.754000000000000004e-01 -2.389499999999999957e+00 -6.754000000000000004e-01 -2.386699999999999822e+00 -6.757999999999999563e-01 -2.384199999999999875e+00 -6.771000000000000352e-01 -2.382200000000000539e+00 -6.791000000000000369e-01 -2.380900000000000016e+00 -6.815999999999999837e-01 -2.380500000000000060e+00 -6.844000000000000083e-01 -2.380900000000000016e+00 -6.872000000000000330e-01 -2.382200000000000539e+00 -6.896999999999999797e-01 -2.384199999999999875e+00 -6.916999999999999815e-01 -2.386699999999999822e+00 -6.930000000000000604e-01 -2.389499999999999957e+00 -6.934000000000000163e-01 -2.462000000000000188e+00 -6.934000000000000163e-01 -2.462000000000000188e+00 -7.134000000000001451e-01 -2.471999999999999975e+00 -7.304000000000001602e-01 -2.615000000000000213e+00 -7.304000000000001602e-01 -2.615000000000000213e+00 -8.394000000000001460e-01 -2.580000000000000071e+00 -8.394000000000001460e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV2.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV2.txt deleted file mode 100644 index db01b64ae..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BaffleV2.txt +++ /dev/null @@ -1,263 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BaffleV2 -3.100000000000000000e+01 2.280000000000000000e+02 -2.580000000000000071e+00 -8.594000000000001638e-01 -2.669999999999999929e+00 -8.594000000000001638e-01 -2.669999999999999929e+00 -8.394000000000001460e-01 -2.635000000000000231e+00 -8.394000000000001460e-01 -2.635000000000000231e+00 -7.304000000000001602e-01 -2.694999999999999840e+00 -7.304000000000001602e-01 -2.697999999999999954e+00 -7.084000000000000297e-01 -2.750000000000000000e+00 -7.084000000000000297e-01 -2.750000000000000000e+00 -6.934000000000000163e-01 -2.785600000000000076e+00 -6.934000000000000163e-01 -2.785600000000000076e+00 -6.754000000000000004e-01 -2.726570000000000160e+00 -6.754000000000000004e-01 -2.617669999999999941e+00 -6.754000000000000004e-01 -2.465250000000000163e+00 -6.754000000000000004e-01 -2.389499999999999957e+00 -6.754000000000000004e-01 -2.386699999999999822e+00 -6.757999999999999563e-01 -2.384199999999999875e+00 -6.771000000000000352e-01 -2.382200000000000539e+00 -6.791000000000000369e-01 -2.380900000000000016e+00 -6.815999999999999837e-01 -2.380500000000000060e+00 -6.844000000000000083e-01 -2.380900000000000016e+00 -6.872000000000000330e-01 -2.382200000000000539e+00 -6.896999999999999797e-01 -2.384199999999999875e+00 -6.916999999999999815e-01 -2.386699999999999822e+00 -6.930000000000000604e-01 -2.389499999999999957e+00 -6.934000000000000163e-01 -2.462000000000000188e+00 -6.934000000000000163e-01 -2.462000000000000188e+00 -7.134000000000001451e-01 -2.471999999999999975e+00 -7.304000000000001602e-01 -2.615000000000000213e+00 -7.304000000000001602e-01 -2.615000000000000213e+00 -8.394000000000001460e-01 -2.580000000000000071e+00 -8.394000000000001460e-01 -1.377891514732365076e-02 2.717069855371586837e-02 -4.133674544197096096e-02 2.717069855371587184e-02 -6.889457573661829370e-02 2.717069855371587184e-02 -9.645240603126560563e-02 2.717069855371587184e-02 -1.240102363259128759e-01 2.717069855371588571e-02 -1.515680666205601879e-01 2.717069855371589959e-02 -1.791258969152074998e-01 2.717069855371589959e-02 -2.066837272098548117e-01 2.717069855371589959e-02 -2.342415575045021237e-01 2.717069855371589959e-02 -2.617993877991494078e-01 2.717069855371589959e-02 -2.893572180937967198e-01 2.717069855371589959e-02 -3.169150483884440317e-01 2.717069855371589959e-02 -3.444728786830913436e-01 2.717069855371589959e-02 -3.720307089777386556e-01 2.717069855371589959e-02 -3.995885392723859675e-01 2.717069855371589959e-02 -4.271463695670333349e-01 2.717069855371589959e-02 -4.547041998616805913e-01 2.717069855371589959e-02 -4.822620301563280143e-01 2.717069855371589959e-02 -5.098198604509751597e-01 2.717069855371589959e-02 -5.373776907456224716e-01 2.717069855371589959e-02 -5.649355210402697836e-01 2.717069855371589959e-02 -5.924933513349170955e-01 2.717069855371589959e-02 -6.200511816295644074e-01 2.717069855371589959e-02 -6.476090119242117193e-01 2.717069855371589959e-02 -6.751668422188590313e-01 2.717069855371589959e-02 -7.027246725135063432e-01 2.717069855371589959e-02 -7.302825028081536551e-01 2.717069855371589959e-02 -7.578403331028009671e-01 2.717069855371589959e-02 -7.853981633974482790e-01 2.717069855371589959e-02 -8.129559936920955909e-01 2.717069855371589959e-02 -8.405138239867429029e-01 2.717069855371589959e-02 -8.680716542813902148e-01 2.717069855371589959e-02 -8.956294845760375267e-01 2.717069855371589959e-02 -9.231873148706848387e-01 2.717069855371589959e-02 -9.507451451653320396e-01 2.717069855371589959e-02 -9.783029754599794625e-01 2.717069855371589959e-02 -1.005860805754626774e+00 2.717069855371578857e-02 -1.033418636049273864e+00 2.717069855371567755e-02 -1.060976466343921398e+00 2.717069855371567755e-02 -1.088534296638568488e+00 2.717069855371567755e-02 -1.116092126933216022e+00 2.717069855371567755e-02 -1.143649957227863112e+00 2.717069855371567755e-02 -1.171207787522510646e+00 2.717069855371567755e-02 -1.198765617817157736e+00 2.717069855371567755e-02 -1.226323448111805270e+00 2.717069855371567755e-02 -1.253881278406452360e+00 2.717069855371567755e-02 -1.281439108701099894e+00 2.717069855371567755e-02 -1.308996938995746984e+00 2.717069855371567755e-02 -1.336554769290394518e+00 2.717069855371567755e-02 -1.364112599585041607e+00 2.717069855371567755e-02 -1.391670429879689141e+00 2.717069855371567755e-02 -1.419228260174336231e+00 2.717069855371567755e-02 -1.446786090468983765e+00 2.717069855371567755e-02 -1.474343920763630855e+00 2.717069855371567755e-02 -1.501901751058278389e+00 2.717069855371567755e-02 -1.529459581352925479e+00 2.717069855371567755e-02 -1.557017411647573013e+00 2.717069855371567755e-02 -1.584575241942220103e+00 2.717069855371567755e-02 -1.612133072236867637e+00 2.717069855371567755e-02 -1.639690902531514727e+00 2.717069855371567755e-02 -1.667248732826162261e+00 2.717069855371567755e-02 -1.694806563120809351e+00 2.717069855371567755e-02 -1.722364393415456885e+00 2.717069855371567755e-02 -1.749922223710103975e+00 2.717069855371567755e-02 -1.777480054004751509e+00 2.717069855371567755e-02 -1.805037884299398598e+00 2.717069855371567755e-02 -1.832595714594046132e+00 2.717069855371567755e-02 -1.860153544888693222e+00 2.717069855371567755e-02 -1.887711375183340756e+00 2.717069855371567755e-02 -1.915269205477987846e+00 2.717069855371567755e-02 -1.942827035772635380e+00 2.717069855371567755e-02 -1.970384866067282470e+00 2.717069855371567755e-02 -1.997942696361930004e+00 2.717069855371545550e-02 -2.025500526656577094e+00 2.717069855371523346e-02 -2.053058356951224184e+00 2.717069855371523346e-02 -2.080616187245871718e+00 2.717069855371523346e-02 -2.108174017540519252e+00 2.717069855371523346e-02 -2.135731847835166342e+00 2.717069855371523346e-02 -2.163289678129813431e+00 2.717069855371523346e-02 -2.190847508424460965e+00 2.717069855371523346e-02 -2.218405338719108499e+00 2.717069855371523346e-02 -2.245963169013755589e+00 2.717069855371523346e-02 -2.273520999308402679e+00 2.717069855371523346e-02 -2.301078829603050213e+00 2.717069855371523346e-02 -2.328636659897697747e+00 2.717069855371523346e-02 -2.356194490192344837e+00 2.717069855371523346e-02 -2.383752320486991927e+00 2.717069855371523346e-02 -2.411310150781639461e+00 2.717069855371523346e-02 -2.438867981076286995e+00 2.717069855371523346e-02 -2.466425811370934085e+00 2.717069855371523346e-02 -2.493983641665581175e+00 2.717069855371523346e-02 -2.521541471960228709e+00 2.717069855371523346e-02 -2.549099302254876243e+00 2.717069855371523346e-02 -2.576657132549523332e+00 2.717069855371523346e-02 -2.604214962844170422e+00 2.717069855371523346e-02 -2.631772793138817956e+00 2.717069855371523346e-02 -2.659330623433465490e+00 2.717069855371523346e-02 -2.686888453728112580e+00 2.717069855371523346e-02 -2.714446284022759670e+00 2.717069855371523346e-02 -2.742004114317407204e+00 2.717069855371523346e-02 -2.769561944612054738e+00 2.717069855371523346e-02 -2.797119774906701828e+00 2.717069855371523346e-02 -2.824677605201348918e+00 2.717069855371523346e-02 -2.852235435495996452e+00 2.717069855371523346e-02 -2.879793265790643986e+00 2.717069855371523346e-02 -2.907351096085291076e+00 2.717069855371523346e-02 -2.934908926379938165e+00 2.717069855371523346e-02 -2.962466756674585699e+00 2.717069855371523346e-02 -2.990024586969233233e+00 2.717069855371523346e-02 -3.017582417263880323e+00 2.717069855371523346e-02 -3.045140247558527413e+00 2.717069855371523346e-02 -3.072698077853174947e+00 2.717069855371523346e-02 -3.100255908147822481e+00 2.717069855371523346e-02 -3.127813738442469571e+00 2.717069855371523346e-02 --3.127813738442470015e+00 2.717069855371523346e-02 --3.100255908147822481e+00 2.717069855371523346e-02 --3.072698077853174947e+00 2.717069855371523346e-02 --3.045140247558527857e+00 2.717069855371523346e-02 --3.017582417263880767e+00 2.717069855371523346e-02 --2.990024586969233233e+00 2.717069855371523346e-02 --2.962466756674585699e+00 2.717069855371523346e-02 --2.934908926379938610e+00 2.717069855371523346e-02 --2.907351096085291520e+00 2.717069855371523346e-02 --2.879793265790643986e+00 2.717069855371523346e-02 --2.852235435495996452e+00 2.717069855371523346e-02 --2.824677605201349362e+00 2.717069855371523346e-02 --2.797119774906702272e+00 2.717069855371523346e-02 --2.769561944612054738e+00 2.717069855371523346e-02 --2.742004114317407648e+00 2.717069855371523346e-02 --2.714446284022760114e+00 2.717069855371523346e-02 --2.686888453728113024e+00 2.717069855371523346e-02 --2.659330623433465934e+00 2.717069855371523346e-02 --2.631772793138817956e+00 2.717069855371523346e-02 --2.604214962844170422e+00 2.717069855371523346e-02 --2.576657132549523777e+00 2.717069855371523346e-02 --2.549099302254876687e+00 2.717069855371523346e-02 --2.521541471960229153e+00 2.717069855371523346e-02 --2.493983641665581619e+00 2.717069855371523346e-02 --2.466425811370934529e+00 2.717069855371523346e-02 --2.438867981076287439e+00 2.717069855371523346e-02 --2.411310150781639461e+00 2.717069855371523346e-02 --2.383752320486992371e+00 2.717069855371523346e-02 --2.356194490192345281e+00 2.717069855371523346e-02 --2.328636659897698191e+00 2.717069855371523346e-02 --2.301078829603050657e+00 2.717069855371523346e-02 --2.273520999308402679e+00 2.717069855371567755e-02 --2.245963169013756033e+00 2.717069855371612164e-02 --2.218405338719108943e+00 2.717069855371612164e-02 --2.190847508424461854e+00 2.717069855371612164e-02 --2.163289678129813876e+00 2.717069855371612164e-02 --2.135731847835166786e+00 2.717069855371612164e-02 --2.108174017540519696e+00 2.717069855371612164e-02 --2.080616187245871274e+00 2.717069855371612164e-02 --2.053058356951224628e+00 2.717069855371612164e-02 --2.025500526656577094e+00 2.717069855371612164e-02 --1.997942696361930226e+00 2.717069855371612164e-02 --1.970384866067283136e+00 2.717069855371612164e-02 --1.942827035772635158e+00 2.717069855371612164e-02 --1.915269205477988068e+00 2.717069855371612164e-02 --1.887711375183340978e+00 2.717069855371612164e-02 --1.860153544888693000e+00 2.717069855371612164e-02 --1.832595714594045910e+00 2.717069855371612164e-02 --1.805037884299398820e+00 2.717069855371612164e-02 --1.777480054004751731e+00 2.717069855371612164e-02 --1.749922223710104641e+00 2.717069855371612164e-02 --1.722364393415456663e+00 2.717069855371612164e-02 --1.694806563120809573e+00 2.717069855371612164e-02 --1.667248732826162483e+00 2.717069855371612164e-02 --1.639690902531514505e+00 2.717069855371612164e-02 --1.612133072236867415e+00 2.717069855371612164e-02 --1.584575241942220325e+00 2.717069855371612164e-02 --1.557017411647573235e+00 2.717069855371612164e-02 --1.529459581352926145e+00 2.717069855371612164e-02 --1.501901751058278167e+00 2.717069855371612164e-02 --1.474343920763631077e+00 2.717069855371612164e-02 --1.446786090468983987e+00 2.717069855371612164e-02 --1.419228260174336009e+00 2.717069855371612164e-02 --1.391670429879688919e+00 2.717069855371612164e-02 --1.364112599585041830e+00 2.717069855371612164e-02 --1.336554769290394740e+00 2.717069855371612164e-02 --1.308996938995747650e+00 2.717069855371612164e-02 --1.281439108701099672e+00 2.717069855371612164e-02 --1.253881278406452582e+00 2.717069855371612164e-02 --1.226323448111805492e+00 2.717069855371612164e-02 --1.198765617817157514e+00 2.717069855371612164e-02 --1.171207787522510424e+00 2.717069855371612164e-02 --1.143649957227863334e+00 2.717069855371612164e-02 --1.116092126933216244e+00 2.717069855371612164e-02 --1.088534296638569154e+00 2.717069855371612164e-02 --1.060976466343921176e+00 2.717069855371612164e-02 --1.033418636049274086e+00 2.717069855371612164e-02 --1.005860805754626996e+00 2.717069855371612164e-02 --9.783029754599799066e-01 2.717069855371612164e-02 --9.507451451653319285e-01 2.717069855371612164e-02 --9.231873148706848387e-01 2.717069855371612164e-02 --8.956294845760377488e-01 2.717069855371612164e-02 --8.680716542813906589e-01 2.717069855371612164e-02 --8.405138239867435690e-01 2.717069855371612164e-02 --8.129559936920955909e-01 2.717069855371612164e-02 --7.853981633974485010e-01 2.717069855371612164e-02 --7.578403331028014112e-01 2.717069855371612164e-02 --7.302825028081534331e-01 2.717069855371612164e-02 --7.027246725135063432e-01 2.717069855371612164e-02 --6.751668422188593643e-01 2.717069855371612164e-02 --6.476090119242121634e-01 2.717069855371612164e-02 --6.200511816295650735e-01 2.717069855371612164e-02 --5.924933513349170955e-01 2.717069855371612164e-02 --5.649355210402700056e-01 2.717069855371612164e-02 --5.373776907456229157e-01 2.717069855371612164e-02 --5.098198604509749376e-01 2.717069855371612164e-02 --4.822620301563278478e-01 2.717069855371612164e-02 --4.547041998616807579e-01 2.717069855371612164e-02 --4.271463695670336680e-01 2.717069855371612164e-02 --3.995885392723866336e-01 2.717069855371612164e-02 --3.720307089777386000e-01 2.717069855371612164e-02 --3.444728786830915102e-01 2.717069855371612164e-02 --3.169150483884444203e-01 2.717069855371612164e-02 --2.893572180937964422e-01 2.717069855371612164e-02 --2.617993877991493523e-01 2.717069855371612164e-02 --2.342415575045022624e-01 2.717069855371612164e-02 --2.066837272098552003e-01 2.717069855371612164e-02 --1.791258969152081659e-01 2.717069855371612164e-02 --1.515680666205601324e-01 2.717069855371612164e-02 --1.240102363259130425e-01 2.717069855371612164e-02 --9.645240603126595258e-02 2.717069855371612164e-02 --6.889457573661796064e-02 2.717069855371612164e-02 --4.133674544197088463e-02 2.717069855371612164e-02 --1.377891514732378954e-02 2.717069855371612164e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV0.txt deleted file mode 100644 index 388cac916..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV0.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperInnerV0 -1.500000000000000000e+01 6.000000000000000000e+00 -1.774999999999999911e+00 5.929919999999999636e-01 -1.774999999999999911e+00 -5.935410000000000963e-01 -1.884989804382506628e+00 -5.917240000000000277e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.873750141219779675e+00 -4.447155115314402885e-01 -1.856339514974657767e+00 -3.343851997842514634e-01 -1.843875949550754845e+00 -2.233744240736200981e-01 -1.836383298232798778e+00 -1.119509098580846185e-01 -1.833876759397041756e+00 -2.779374865840749179e-04 -1.836358204793972160e+00 1.113896333018938728e-01 -1.843826943346401626e+00 2.228133966765704910e-01 -1.856259555650231263e+00 3.337978467736253951e-01 -1.873650437331630725e+00 4.441642303822337379e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.884858077486472272e+00 5.911770000000000636e-01 -0.000000000000000000e+00 1.466499482091261075e-01 -1.047197551196597631e+00 1.466499482091260242e-01 -2.094395102393195263e+00 1.466499482091263573e-01 -3.141592653589793116e+00 1.466499482091263573e-01 --2.094395102393196151e+00 1.466499482091254691e-01 --1.047197551196597631e+00 1.466499482091254691e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV1.txt deleted file mode 100644 index 3b0257757..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV1.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperInnerV1 -3.300000000000000000e+01 6.000000000000000000e+00 -1.774999999999999911e+00 5.929919999999999636e-01 -1.774999999999999911e+00 -5.935410000000000963e-01 -1.884989804382506628e+00 -5.917240000000000277e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.875106992951602214e+00 -4.513690000000000202e-01 -1.866890611583081006e+00 -4.459352038706899113e-01 -1.872685437679804110e+00 -4.379689999999999972e-01 -1.857409787613115926e+00 -3.411669999999999980e-01 -1.849362673268954538e+00 -3.353125653571015774e-01 -1.855570209144887128e+00 -3.275339999999999918e-01 -1.844636314596457272e+00 -2.301459999999999895e-01 -1.836937656155643861e+00 -2.240010572285803248e-01 -1.843419523820880146e+00 -2.165839999999999987e-01 -1.836844375171723831e+00 -1.188050000000000078e-01 -1.829351210110599979e+00 -1.122565205010035427e-01 -1.836228783631549621e+00 -1.050630000000000036e-01 -1.834029505237306790e+00 -7.086999999999999550e-03 -1.826909683447074828e+00 -2.806498309795785531e-04 -1.834028139211882458e+00 6.529000000000000081e-03 -1.836205097098088324e+00 1.045050000000000007e-01 -1.829325787346844479e+00 1.116969181786534593e-01 -1.836817956587424083e+00 1.182470000000000049e-01 -1.843372016779304401e+00 2.160279999999999978e-01 -1.836887454465587544e+00 2.234439862157564793e-01 -1.844585709478689495e+00 2.295900000000000163e-01 -1.855496283519048051e+00 3.269810000000000216e-01 -1.849286448529055216e+00 3.347572222043389556e-01 -1.857333629936474440e+00 3.406139999999999723e-01 -1.872587325520495005e+00 4.374190000000000023e-01 -1.866791171573341401e+00 4.453844133024648655e-01 -1.875006148741384937e+00 4.508190000000000253e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.884858077486472272e+00 5.911770000000000636e-01 -0.000000000000000000e+00 1.466499482091261075e-01 -1.047197551196597631e+00 1.466499482091260242e-01 -2.094395102393195263e+00 1.466499482091263573e-01 -3.141592653589793116e+00 1.466499482091263573e-01 --2.094395102393196151e+00 1.466499482091254691e-01 --1.047197551196597631e+00 1.466499482091254691e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV2.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV2.txt deleted file mode 100644 index 37e26cfb4..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV2.txt +++ /dev/null @@ -1,107 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperInnerV2 -9.700000000000000000e+01 6.000000000000000000e+00 -1.774999999999999911e+00 5.929919999999999636e-01 -1.774999999999999911e+00 -5.935410000000000963e-01 -1.878584461467729616e+00 -5.935410000000000963e-01 -1.881246150023436092e+00 -5.950389999999999846e-01 -1.884989804382506628e+00 -5.917240000000000277e-01 -1.896201911053250866e+00 -5.581660000000000510e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.891491027405892922e+00 -5.317150000000000487e-01 -1.884897522350220456e+00 -4.993809999999999638e-01 -1.878304017294591288e+00 -4.670460000000000167e-01 -1.875106992951602214e+00 -4.513690000000000202e-01 -1.869208335188991210e+00 -4.474680000000000324e-01 -1.851571663171587945e+00 -4.510649999999999937e-01 -1.850745955007871979e+00 -4.464930000000000287e-01 -1.868526014175344807e+00 -4.436869999999999981e-01 -1.872685437679804110e+00 -4.379689999999999972e-01 -1.870191322807642775e+00 -4.221650000000000125e-01 -1.865047179633802399e+00 -3.895679999999999699e-01 -1.859903902485287031e+00 -3.569710000000000383e-01 -1.857409787613115926e+00 -3.411669999999999980e-01 -1.851691729813577769e+00 -3.370070000000000010e-01 -1.833911670646108272e+00 -3.398129999999999762e-01 -1.833271892572402972e+00 -3.350690000000000057e-01 -1.851159492102449899e+00 -3.330609999999999959e-01 -1.855570209144887128e+00 -3.275339999999999918e-01 -1.853784833870694815e+00 -3.116340000000000221e-01 -1.850103078858040373e+00 -2.788399999999999768e-01 -1.846421689870707761e+00 -2.460459999999999869e-01 -1.844636314596457272e+00 -2.301459999999999895e-01 -1.839110017013936060e+00 -2.257350000000000190e-01 -1.821222417483927103e+00 -2.277440000000000020e-01 -1.820807148338615233e+00 -2.231160000000000088e-01 -1.838766807469071285e+00 -2.219079999999999941e-01 -1.843419523820880146e+00 -2.165839999999999987e-01 -1.842346486220765245e+00 -2.006200000000000205e-01 -1.840131949496285557e+00 -1.676949999999999830e-01 -1.837918278797237459e+00 -1.347689999999999999e-01 -1.836844375171723831e+00 -1.188050000000000078e-01 -1.831520132034862414e+00 -1.141520000000000035e-01 -1.813560838929866081e+00 -1.153600000000000042e-01 -1.813346258204703965e+00 -1.105780000000000096e-01 -1.831342264122684638e+00 -1.101740000000000080e-01 -1.836228783631549621e+00 -1.050630000000000036e-01 -1.835869949730917217e+00 -8.906699999999999340e-02 -1.835128961421785387e+00 -5.607500000000000678e-02 -1.834388339137871915e+00 -2.308299999999999935e-02 -1.834029505237306790e+00 -7.086999999999999550e-03 -1.828918476800155402e+00 -2.201000000000000265e-03 -1.810923836907560203e+00 -2.605000000000000111e-03 -1.810922470882174506e+00 2.040999999999999846e-03 -1.828918476800155402e+00 1.641000000000000097e-03 -1.834028139211882458e+00 6.529000000000000081e-03 -1.834383875036247780e+00 2.252499999999999988e-02 -1.835116801167707701e+00 5.551700000000000385e-02 -1.835849361273685698e+00 8.850900000000000434e-02 -1.836205097098088324e+00 1.045050000000000007e-01 -1.831317211563851410e+00 1.096150000000000041e-01 -1.813322071671218616e+00 1.100140000000000007e-01 -1.813534920345621471e+00 1.147969999999999963e-01 -1.831494579476008244e+00 1.135929999999999995e-01 -1.836817956587424083e+00 1.182470000000000049e-01 -1.837888262136738282e+00 1.342110000000000247e-01 -1.840094736683413279e+00 1.671380000000000088e-01 -1.842301711230003747e+00 2.000639999999999918e-01 -1.843372016779304401e+00 2.160279999999999978e-01 -1.838717568376666112e+00 2.213509999999999922e-01 -1.820757409246217984e+00 2.225550000000000028e-01 -1.821171812366148002e+00 2.271819999999999951e-01 -1.839059411896200924e+00 2.251779999999999893e-01 -1.844585709478689495e+00 2.295900000000000163e-01 -1.846366120651318665e+00 2.454910000000000148e-01 -1.850041679511572612e+00 2.782860000000000333e-01 -1.853715872346406890e+00 3.110799999999999677e-01 -1.855496283519048051e+00 3.269810000000000216e-01 -1.851084200451184270e+00 3.325059999999999683e-01 -1.833196600921188857e+00 3.345110000000000583e-01 -1.833835512969470116e+00 3.392550000000000288e-01 -1.851616438162342559e+00 3.364530000000000021e-01 -1.857333629936474440e+00 3.406139999999999723e-01 -1.859824146732427019e+00 3.564189999999999858e-01 -1.864960227728462927e+00 3.890170000000000017e-01 -1.870096308724499945e+00 4.216139999999999888e-01 -1.872587325520495005e+00 4.374190000000000023e-01 -1.868426535990644899e+00 4.431370000000000031e-01 -1.850645610797756024e+00 4.459380000000000011e-01 -1.851471318961490198e+00 4.505100000000000215e-01 -1.869109357004292482e+00 4.469180000000000375e-01 -1.875006148741384937e+00 4.508190000000000253e-01 -1.878200075008251035e+00 4.664970000000000505e-01 -1.884786383911450036e+00 4.988330000000000264e-01 -1.891372692814665690e+00 5.311690000000000023e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.896076880309709445e+00 5.576219999999999510e-01 -1.884858077486472272e+00 5.911770000000000636e-01 -1.881113557102016332e+00 5.944909999999999917e-01 -1.880810658446245620e+00 5.945529999999999982e-01 -1.878451868546276993e+00 5.929919999999999636e-01 -0.000000000000000000e+00 1.466499482091261075e-01 -1.047197551196597631e+00 1.466499482091260242e-01 -2.094395102393195263e+00 1.466499482091263573e-01 -3.141592653589793116e+00 1.466499482091263573e-01 --2.094395102393196151e+00 1.466499482091254691e-01 --1.047197551196597631e+00 1.466499482091254691e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV3.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV3.txt deleted file mode 100644 index 8c53d11ff..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperInnerV3.txt +++ /dev/null @@ -1,119 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperInnerV3 -9.700000000000000000e+01 1.800000000000000000e+01 -1.774999999999999911e+00 5.929919999999999636e-01 -1.774999999999999911e+00 -5.935410000000000963e-01 -1.878584461467729616e+00 -5.935410000000000963e-01 -1.881246150023436092e+00 -5.950389999999999846e-01 -1.884989804382506628e+00 -5.917240000000000277e-01 -1.896201911053250866e+00 -5.581660000000000510e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.891491027405892922e+00 -5.317150000000000487e-01 -1.884897522350220456e+00 -4.993809999999999638e-01 -1.878304017294591288e+00 -4.670460000000000167e-01 -1.875106992951602214e+00 -4.513690000000000202e-01 -1.869208335188991210e+00 -4.474680000000000324e-01 -1.851571663171587945e+00 -4.510649999999999937e-01 -1.850745955007871979e+00 -4.464930000000000287e-01 -1.868526014175344807e+00 -4.436869999999999981e-01 -1.872685437679804110e+00 -4.379689999999999972e-01 -1.870191322807642775e+00 -4.221650000000000125e-01 -1.865047179633802399e+00 -3.895679999999999699e-01 -1.859903902485287031e+00 -3.569710000000000383e-01 -1.857409787613115926e+00 -3.411669999999999980e-01 -1.851691729813577769e+00 -3.370070000000000010e-01 -1.833911670646108272e+00 -3.398129999999999762e-01 -1.833271892572402972e+00 -3.350690000000000057e-01 -1.851159492102449899e+00 -3.330609999999999959e-01 -1.855570209144887128e+00 -3.275339999999999918e-01 -1.853784833870694815e+00 -3.116340000000000221e-01 -1.850103078858040373e+00 -2.788399999999999768e-01 -1.846421689870707761e+00 -2.460459999999999869e-01 -1.844636314596457272e+00 -2.301459999999999895e-01 -1.839110017013936060e+00 -2.257350000000000190e-01 -1.821222417483927103e+00 -2.277440000000000020e-01 -1.820807148338615233e+00 -2.231160000000000088e-01 -1.838766807469071285e+00 -2.219079999999999941e-01 -1.843419523820880146e+00 -2.165839999999999987e-01 -1.842346486220765245e+00 -2.006200000000000205e-01 -1.840131949496285557e+00 -1.676949999999999830e-01 -1.837918278797237459e+00 -1.347689999999999999e-01 -1.836844375171723831e+00 -1.188050000000000078e-01 -1.831520132034862414e+00 -1.141520000000000035e-01 -1.813560838929866081e+00 -1.153600000000000042e-01 -1.813346258204703965e+00 -1.105780000000000096e-01 -1.831342264122684638e+00 -1.101740000000000080e-01 -1.836228783631549621e+00 -1.050630000000000036e-01 -1.835869949730917217e+00 -8.906699999999999340e-02 -1.835128961421785387e+00 -5.607500000000000678e-02 -1.834388339137871915e+00 -2.308299999999999935e-02 -1.834029505237306790e+00 -7.086999999999999550e-03 -1.828918476800155402e+00 -2.201000000000000265e-03 -1.810923836907560203e+00 -2.605000000000000111e-03 -1.810922470882174506e+00 2.040999999999999846e-03 -1.828918476800155402e+00 1.641000000000000097e-03 -1.834028139211882458e+00 6.529000000000000081e-03 -1.834383875036247780e+00 2.252499999999999988e-02 -1.835116801167707701e+00 5.551700000000000385e-02 -1.835849361273685698e+00 8.850900000000000434e-02 -1.836205097098088324e+00 1.045050000000000007e-01 -1.831317211563851410e+00 1.096150000000000041e-01 -1.813322071671218616e+00 1.100140000000000007e-01 -1.813534920345621471e+00 1.147969999999999963e-01 -1.831494579476008244e+00 1.135929999999999995e-01 -1.836817956587424083e+00 1.182470000000000049e-01 -1.837888262136738282e+00 1.342110000000000247e-01 -1.840094736683413279e+00 1.671380000000000088e-01 -1.842301711230003747e+00 2.000639999999999918e-01 -1.843372016779304401e+00 2.160279999999999978e-01 -1.838717568376666112e+00 2.213509999999999922e-01 -1.820757409246217984e+00 2.225550000000000028e-01 -1.821171812366148002e+00 2.271819999999999951e-01 -1.839059411896200924e+00 2.251779999999999893e-01 -1.844585709478689495e+00 2.295900000000000163e-01 -1.846366120651318665e+00 2.454910000000000148e-01 -1.850041679511572612e+00 2.782860000000000333e-01 -1.853715872346406890e+00 3.110799999999999677e-01 -1.855496283519048051e+00 3.269810000000000216e-01 -1.851084200451184270e+00 3.325059999999999683e-01 -1.833196600921188857e+00 3.345110000000000583e-01 -1.833835512969470116e+00 3.392550000000000288e-01 -1.851616438162342559e+00 3.364530000000000021e-01 -1.857333629936474440e+00 3.406139999999999723e-01 -1.859824146732427019e+00 3.564189999999999858e-01 -1.864960227728462927e+00 3.890170000000000017e-01 -1.870096308724499945e+00 4.216139999999999888e-01 -1.872587325520495005e+00 4.374190000000000023e-01 -1.868426535990644899e+00 4.431370000000000031e-01 -1.850645610797756024e+00 4.459380000000000011e-01 -1.851471318961490198e+00 4.505100000000000215e-01 -1.869109357004292482e+00 4.469180000000000375e-01 -1.875006148741384937e+00 4.508190000000000253e-01 -1.878200075008251035e+00 4.664970000000000505e-01 -1.884786383911450036e+00 4.988330000000000264e-01 -1.891372692814665690e+00 5.311690000000000023e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.896076880309709445e+00 5.576219999999999510e-01 -1.884858077486472272e+00 5.911770000000000636e-01 -1.881113557102016332e+00 5.944909999999999917e-01 -1.880810658446245620e+00 5.945529999999999982e-01 -1.878451868546276993e+00 5.929919999999999636e-01 --4.935000000000000497e-02 4.990000000000005542e-02 -0.000000000000000000e+00 4.700000000000015277e-02 -4.935000000000000497e-02 4.990000000000005542e-02 -9.978475511965976263e-01 4.990000000000005542e-02 -1.047197551196597631e+00 4.700000000000015277e-02 -1.096547551196597636e+00 4.990000000000005542e-02 -2.045045102393195258e+00 4.990000000000005542e-02 -2.094395102393195263e+00 4.699999999999970868e-02 -2.143745102393195268e+00 4.990000000000005542e-02 -3.092242653589793111e+00 4.990000000000005542e-02 -3.141592653589793116e+00 4.700000000000059686e-02 --3.092242653589793555e+00 4.990000000000005542e-02 --2.143745102393195712e+00 4.990000000000005542e-02 --2.094395102393196151e+00 4.700000000000059686e-02 --2.045045102393196590e+00 4.990000000000005542e-02 --1.096547551196597192e+00 4.990000000000005542e-02 --1.047197551196597631e+00 4.700000000000059686e-02 --9.978475511965981815e-01 4.990000000000005542e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV0.txt deleted file mode 100644 index 3549dd483..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV0.txt +++ /dev/null @@ -1,21 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperOuterV0 -1.600000000000000000e+01 1.000000000000000000e+00 -2.948030682892055498e+00 5.081299999999999706e-01 -3.033215611778265153e+00 3.664728658561393071e-01 -3.076121706618749396e+00 2.666751672124843542e-01 -3.105174879642744745e+00 1.619838278019379574e-01 -3.119834844754606706e+00 5.432548796861114832e-02 -3.119834844754606706e+00 -5.432548796861114832e-02 -3.105174879642744745e+00 -1.619838278019379574e-01 -3.076121706618749396e+00 -2.666751672124843542e-01 -3.033215611778265153e+00 -3.664728658561393071e-01 -2.948030682892055498e+00 -5.081299999999999706e-01 -3.109405693186561681e+00 -5.426119999999999832e-01 -3.362327806491359983e+00 -5.704500000000000542e-02 -3.550000000000000266e+00 -5.714999999999999941e-02 -3.550000000000000266e+00 5.714999999999999941e-02 -3.363484197010594201e+00 5.673700000000000271e-02 -3.107995761040384775e+00 5.446670000000000122e-01 -2.385377619458727949e+00 1.161666666666665293e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV1.txt deleted file mode 100644 index dcdabf2f1..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV1.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperOuterV1 -3.200000000000000000e+01 1.000000000000000000e+00 -2.948030682892055498e+00 5.081299999999999706e-01 -3.030468583296153984e+00 3.710410000000000097e-01 -3.038304623759351841e+00 3.690915906790889767e-01 -3.035316625456395467e+00 3.615860000000000185e-01 -3.070346949291724581e+00 2.801070000000000504e-01 -3.080719697300204896e+00 2.684158138010583894e-01 -3.080033294092289875e+00 2.525800000000000267e-01 -3.103751191863484582e+00 1.671140000000000125e-01 -3.110779064964014129e+00 1.631375844697134370e-01 -3.105893703948671813e+00 1.567050000000000110e-01 -3.119116199618731766e+00 5.960300000000000320e-02 -3.125544436105028190e+00 5.471343519475990735e-02 -3.119834844754606706e+00 4.900000000000000189e-02 -3.119834844754606706e+00 -4.900000000000000189e-02 -3.125544436105028190e+00 -5.471343519475990735e-02 -3.119116199618731766e+00 -5.960300000000000320e-02 -3.105893703948671813e+00 -1.567050000000000110e-01 -3.110779064964014129e+00 -1.631375844697134370e-01 -3.103751191863484582e+00 -1.671140000000000125e-01 -3.080033294092289875e+00 -2.525800000000000267e-01 -3.080719697300204896e+00 -2.684158138010583894e-01 -3.070346949291724581e+00 -2.801070000000000504e-01 -3.035316625456395467e+00 -3.615860000000000185e-01 -3.038304623759351841e+00 -3.690915906790889767e-01 -3.030468583296153984e+00 -3.710410000000000097e-01 -2.948030682892055498e+00 -5.081299999999999706e-01 -3.109405693186561681e+00 -5.426119999999999832e-01 -3.362327806491359983e+00 -5.704500000000000542e-02 -3.550000000000000266e+00 -5.714999999999999941e-02 -3.550000000000000266e+00 5.714999999999999941e-02 -3.363484197010594201e+00 5.673700000000000271e-02 -3.107995761040384775e+00 5.446670000000000122e-01 -2.385377619458727949e+00 1.161666666666665293e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV2.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV2.txt deleted file mode 100644 index c274317c4..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV2.txt +++ /dev/null @@ -1,97 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperOuterV2 -9.200000000000000000e+01 1.000000000000000000e+00 -2.964289065309421378e+00 5.237580000000000569e-01 -2.949734965944058818e+00 5.149930000000000341e-01 -2.948030682892055498e+00 5.081299999999999706e-01 -2.988685050245676322e+00 4.422350000000000447e-01 -3.007349649084555931e+00 4.149979999999999780e-01 -3.022702963370367701e+00 3.856859999999999733e-01 -3.030468583296153984e+00 3.710410000000000097e-01 -3.037326191335069314e+00 3.693349999999999689e-01 -3.051880939811381310e+00 3.781010000000000204e-01 -3.053535836228224110e+00 3.748740000000000405e-01 -3.037931764183158911e+00 3.681549999999999545e-01 -3.035316625456395467e+00 3.615860000000000185e-01 -3.042232689871864793e+00 3.476060000000000261e-01 -3.055270009813371601e+00 3.172919999999999630e-01 -3.068307345834996536e+00 2.869789999999999841e-01 -3.070346949291724581e+00 2.801070000000000504e-01 -3.073682277413363639e+00 2.715640000000000276e-01 -3.080247526791474844e+00 2.689479999999999649e-01 -3.095870610693217895e+00 2.756669999999999954e-01 -3.097075532151097210e+00 2.722450000000000148e-01 -3.080688496977420421e+00 2.676960000000000450e-01 -3.077210831750402331e+00 2.615410000000000235e-01 -3.080033294092289875e+00 2.525800000000000267e-01 -3.082518126719290485e+00 2.466100000000000236e-01 -3.091344758816783944e+00 2.148130000000000039e-01 -3.100171409974777692e+00 1.830159999999999842e-01 -3.103751191863484582e+00 1.671140000000000125e-01 -3.109901705612252876e+00 1.636340000000000017e-01 -3.126270188738650813e+00 1.681829999999999992e-01 -3.127001558863218733e+00 1.646299999999999986e-01 -3.110169525377193711e+00 1.623350000000000071e-01 -3.105893703948671813e+00 1.567050000000000110e-01 -3.108803698811651195e+00 1.410970000000000002e-01 -3.113257685716683820e+00 1.083990000000000092e-01 -3.117711677373165902e+00 7.570099999999999052e-02 -3.119116199618731766e+00 5.960300000000000320e-02 -3.124741735841379597e+00 5.532399999999999818e-02 -3.141573879719686158e+00 5.761900000000000355e-02 -3.141819085035291614e+00 5.399999999999999939e-02 -3.124831480890129853e+00 5.399999999999999939e-02 -3.119834844754606706e+00 4.900000000000000189e-02 -3.120609846604506465e+00 3.300000000000000155e-02 -3.120046300237386383e+00 1.149999999999999981e-02 -3.120609846604506465e+00 0.000000000000000000e+00 -3.120609846604506465e+00 -3.300000000000000155e-02 -3.119834844754606706e+00 -4.900000000000000189e-02 -3.124831480890129853e+00 -5.399999999999999939e-02 -3.141819085035291614e+00 -5.399999999999999939e-02 -3.141573879719686158e+00 -5.761900000000000355e-02 -3.124741735841379597e+00 -5.532399999999999818e-02 -3.119116199618731766e+00 -5.960300000000000320e-02 -3.117711677373165902e+00 -7.570099999999999052e-02 -3.113257685716683820e+00 -1.083990000000000092e-01 -3.108803698811651195e+00 -1.410970000000000002e-01 -3.105893703948671813e+00 -1.567050000000000110e-01 -3.110169525377193711e+00 -1.623350000000000071e-01 -3.127001558863218733e+00 -1.646299999999999986e-01 -3.126270188738650813e+00 -1.681829999999999992e-01 -3.109901705612252876e+00 -1.636340000000000017e-01 -3.103751191863484582e+00 -1.671140000000000125e-01 -3.100171409974777692e+00 -1.830159999999999842e-01 -3.091344758816783944e+00 -2.148130000000000039e-01 -3.082518126719290485e+00 -2.466100000000000236e-01 -3.080033294092289875e+00 -2.525800000000000267e-01 -3.077210831750402331e+00 -2.615410000000000235e-01 -3.080688496977420421e+00 -2.676960000000000450e-01 -3.097075532151097210e+00 -2.722450000000000148e-01 -3.095870610693217895e+00 -2.756669999999999954e-01 -3.080247526791474844e+00 -2.689479999999999649e-01 -3.073682277413363639e+00 -2.715640000000000276e-01 -3.070346949291724581e+00 -2.801070000000000504e-01 -3.068307345834996536e+00 -2.869789999999999841e-01 -3.055270009813371601e+00 -3.172919999999999630e-01 -3.042232689871864793e+00 -3.476060000000000261e-01 -3.035316625456395467e+00 -3.615860000000000185e-01 -3.037931764183158911e+00 -3.681549999999999545e-01 -3.053535836228224110e+00 -3.748740000000000405e-01 -3.051880939811381310e+00 -3.781010000000000204e-01 -3.037326191335069314e+00 -3.693349999999999689e-01 -3.030468583296153984e+00 -3.710410000000000097e-01 -3.022702963370367701e+00 -3.856859999999999733e-01 -3.005693982131414366e+00 -4.139610000000000234e-01 -2.988685050245676322e+00 -4.422350000000000447e-01 -2.948030682892055498e+00 -5.081299999999999706e-01 -2.949734965944058818e+00 -5.149930000000000341e-01 -2.964289065309421378e+00 -5.237580000000000569e-01 -3.109405693186561681e+00 -5.426119999999999832e-01 -3.362327806491359983e+00 -5.704500000000000542e-02 -3.550000000000000266e+00 -5.714999999999999941e-02 -3.550000000000000266e+00 5.714999999999999941e-02 -3.363484197010594201e+00 5.673700000000000271e-02 -3.107995761040384775e+00 5.446670000000000122e-01 -2.385377619458727949e+00 1.161666666666665293e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV3.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV3.txt deleted file mode 100644 index 8fab66fb9..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_BumperOuterV3.txt +++ /dev/null @@ -1,100 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = BumperOuterV3 -9.200000000000000000e+01 4.000000000000000000e+00 -2.964289065309421378e+00 5.237580000000000569e-01 -2.949734965944058818e+00 5.149930000000000341e-01 -2.948030682892055498e+00 5.081299999999999706e-01 -2.988685050245676322e+00 4.422350000000000447e-01 -3.007349649084555931e+00 4.149979999999999780e-01 -3.022702963370367701e+00 3.856859999999999733e-01 -3.030468583296153984e+00 3.710410000000000097e-01 -3.037326191335069314e+00 3.693349999999999689e-01 -3.051880939811381310e+00 3.781010000000000204e-01 -3.053535836228224110e+00 3.748740000000000405e-01 -3.037931764183158911e+00 3.681549999999999545e-01 -3.035316625456395467e+00 3.615860000000000185e-01 -3.042232689871864793e+00 3.476060000000000261e-01 -3.055270009813371601e+00 3.172919999999999630e-01 -3.068307345834996536e+00 2.869789999999999841e-01 -3.070346949291724581e+00 2.801070000000000504e-01 -3.073682277413363639e+00 2.715640000000000276e-01 -3.080247526791474844e+00 2.689479999999999649e-01 -3.095870610693217895e+00 2.756669999999999954e-01 -3.097075532151097210e+00 2.722450000000000148e-01 -3.080688496977420421e+00 2.676960000000000450e-01 -3.077210831750402331e+00 2.615410000000000235e-01 -3.080033294092289875e+00 2.525800000000000267e-01 -3.082518126719290485e+00 2.466100000000000236e-01 -3.091344758816783944e+00 2.148130000000000039e-01 -3.100171409974777692e+00 1.830159999999999842e-01 -3.103751191863484582e+00 1.671140000000000125e-01 -3.109901705612252876e+00 1.636340000000000017e-01 -3.126270188738650813e+00 1.681829999999999992e-01 -3.127001558863218733e+00 1.646299999999999986e-01 -3.110169525377193711e+00 1.623350000000000071e-01 -3.105893703948671813e+00 1.567050000000000110e-01 -3.108803698811651195e+00 1.410970000000000002e-01 -3.113257685716683820e+00 1.083990000000000092e-01 -3.117711677373165902e+00 7.570099999999999052e-02 -3.119116199618731766e+00 5.960300000000000320e-02 -3.124741735841379597e+00 5.532399999999999818e-02 -3.141573879719686158e+00 5.761900000000000355e-02 -3.141819085035291614e+00 5.399999999999999939e-02 -3.124831480890129853e+00 5.399999999999999939e-02 -3.119834844754606706e+00 4.900000000000000189e-02 -3.120609846604506465e+00 3.300000000000000155e-02 -3.120046300237386383e+00 1.149999999999999981e-02 -3.120609846604506465e+00 0.000000000000000000e+00 -3.120609846604506465e+00 -3.300000000000000155e-02 -3.119834844754606706e+00 -4.900000000000000189e-02 -3.124831480890129853e+00 -5.399999999999999939e-02 -3.141819085035291614e+00 -5.399999999999999939e-02 -3.141573879719686158e+00 -5.761900000000000355e-02 -3.124741735841379597e+00 -5.532399999999999818e-02 -3.119116199618731766e+00 -5.960300000000000320e-02 -3.117711677373165902e+00 -7.570099999999999052e-02 -3.113257685716683820e+00 -1.083990000000000092e-01 -3.108803698811651195e+00 -1.410970000000000002e-01 -3.105893703948671813e+00 -1.567050000000000110e-01 -3.110169525377193711e+00 -1.623350000000000071e-01 -3.127001558863218733e+00 -1.646299999999999986e-01 -3.126270188738650813e+00 -1.681829999999999992e-01 -3.109901705612252876e+00 -1.636340000000000017e-01 -3.103751191863484582e+00 -1.671140000000000125e-01 -3.100171409974777692e+00 -1.830159999999999842e-01 -3.091344758816783944e+00 -2.148130000000000039e-01 -3.082518126719290485e+00 -2.466100000000000236e-01 -3.080033294092289875e+00 -2.525800000000000267e-01 -3.077210831750402331e+00 -2.615410000000000235e-01 -3.080688496977420421e+00 -2.676960000000000450e-01 -3.097075532151097210e+00 -2.722450000000000148e-01 -3.095870610693217895e+00 -2.756669999999999954e-01 -3.080247526791474844e+00 -2.689479999999999649e-01 -3.073682277413363639e+00 -2.715640000000000276e-01 -3.070346949291724581e+00 -2.801070000000000504e-01 -3.068307345834996536e+00 -2.869789999999999841e-01 -3.055270009813371601e+00 -3.172919999999999630e-01 -3.042232689871864793e+00 -3.476060000000000261e-01 -3.035316625456395467e+00 -3.615860000000000185e-01 -3.037931764183158911e+00 -3.681549999999999545e-01 -3.053535836228224110e+00 -3.748740000000000405e-01 -3.051880939811381310e+00 -3.781010000000000204e-01 -3.037326191335069314e+00 -3.693349999999999689e-01 -3.030468583296153984e+00 -3.710410000000000097e-01 -3.022702963370367701e+00 -3.856859999999999733e-01 -3.005693982131414366e+00 -4.139610000000000234e-01 -2.988685050245676322e+00 -4.422350000000000447e-01 -2.948030682892055498e+00 -5.081299999999999706e-01 -2.949734965944058818e+00 -5.149930000000000341e-01 -2.964289065309421378e+00 -5.237580000000000569e-01 -3.109405693186561681e+00 -5.426119999999999832e-01 -3.362327806491359983e+00 -5.704500000000000542e-02 -3.550000000000000266e+00 -5.714999999999999941e-02 -3.550000000000000266e+00 5.714999999999999941e-02 -3.363484197010594201e+00 5.673700000000000271e-02 -3.107995761040384775e+00 5.446670000000000122e-01 -2.313989730786773613e+00 2.762401690564741941e-02 -2.342218653172106535e+00 2.782565206554243886e-02 -2.370346757977491947e+00 2.762401690564741941e-02 -2.398222818833007697e+00 2.732156416580444613e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV0.txt deleted file mode 100644 index 29c622a7f..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowGCV0 -4.000000000000000000e+00 0.000000000000000000e+00 -1.902626435582053910e+00 -6.154902827152386457e-01 -2.434837737556048598e+00 -8.305132827152387209e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV1.txt deleted file mode 100644 index 47ff02b57..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV1.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowGCV1 -7.000000000000000000e+00 0.000000000000000000e+00 -1.902626435582053910e+00 -6.154902827152386457e-01 -2.434837737556048598e+00 -8.305132827152387209e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.212685554715615233e+00 -7.022950072313642877e-01 -2.209232438638541129e+00 -7.035034792486342115e-01 -2.207588154363356203e+00 -7.002307512678921375e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV2.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV2.txt deleted file mode 100644 index 2d89e59f7..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV2.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowGCV2 -1.600000000000000000e+01 0.000000000000000000e+00 -1.902626435582053910e+00 -6.154902827152386457e-01 -2.434837737556048598e+00 -8.305132827152387209e-01 -2.447370736589166818e+00 -7.994890000000000052e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.227616286707609916e+00 -7.084909999999999819e-01 -2.224663193534248684e+00 -7.067720000000000669e-01 -2.212811500979918744e+00 -7.019840000000000524e-01 -2.210208725133669283e+00 -7.030890000000000750e-01 -2.202716006712168273e+00 -7.216330000000000799e-01 -2.199827431074083073e+00 -7.247799999999999798e-01 -2.208817766999351395e+00 -7.025270000000000126e-01 -2.207712377122074354e+00 -6.999239999999999906e-01 -2.194203348135719267e+00 -6.944660000000000277e-01 -2.193326454009981941e+00 -6.941500000000000448e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 -1.906370658127374718e+00 -5.812169999999999837e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV3.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV3.txt deleted file mode 100644 index c48b89ae7..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowGCV3.txt +++ /dev/null @@ -1,476 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowGCV3 -1.600000000000000000e+01 4.560000000000000000e+02 -1.902626435582053910e+00 -6.154902827152386457e-01 -2.434837737556048598e+00 -8.305132827152387209e-01 -2.447370736589166818e+00 -7.994890000000000052e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.227616286707609916e+00 -7.084909999999999819e-01 -2.224663193534248684e+00 -7.067720000000000669e-01 -2.212811500979918744e+00 -7.019840000000000524e-01 -2.210208725133669283e+00 -7.030890000000000750e-01 -2.202716006712168273e+00 -7.216330000000000799e-01 -2.199827431074083073e+00 -7.247799999999999798e-01 -2.208817766999351395e+00 -7.025270000000000126e-01 -2.207712377122074354e+00 -6.999239999999999906e-01 -2.194203348135719267e+00 -6.944660000000000277e-01 -2.193326454009981941e+00 -6.941500000000000448e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 -1.906370658127374718e+00 -5.812169999999999837e-01 -6.889457573661827115e-03 1.347308789839129529e-02 -2.066837272098548742e-02 1.347308789839129529e-02 -3.444728786830913297e-02 1.347308789839129703e-02 -4.822620301563278894e-02 1.347308789839130050e-02 -6.200511816295642409e-02 1.347308789839130050e-02 -7.578403331028009393e-02 1.347308789839130050e-02 -8.956294845760374990e-02 1.347308789839130050e-02 -1.033418636049274059e-01 1.347308789839130050e-02 -1.171207787522510618e-01 1.347308789839130050e-02 -1.308996938995747039e-01 1.347308789839130050e-02 -1.446786090468983599e-01 1.347308789839130050e-02 -1.584575241942220714e-01 1.347308789839130050e-02 -1.722364393415456718e-01 1.347308789839130050e-02 -1.860153544888693278e-01 1.347308789839130050e-02 -1.997942696361929282e-01 1.347308789839130050e-02 -2.135731847835166397e-01 1.347308789839130050e-02 -2.273520999308402402e-01 1.347308789839130050e-02 -2.411310150781639516e-01 1.347308789839130050e-02 -2.549099302254874688e-01 1.347308789839130050e-02 -2.686888453728112358e-01 1.347308789839130050e-02 -2.824677605201348918e-01 1.347308789839130050e-02 -2.962466756674585477e-01 1.347308789839130050e-02 -3.100255908147822037e-01 1.347308789839130050e-02 -3.238045059621058597e-01 1.347308789839130050e-02 -3.375834211094295156e-01 1.347308789839130050e-02 -3.513623362567531716e-01 1.347308789839130050e-02 -3.651412514040768276e-01 1.347308789839130050e-02 -3.789201665514004835e-01 1.347308789839130050e-02 -3.926990816987241950e-01 1.347308789839130050e-02 -4.064779968460477955e-01 1.347308789839130050e-02 -4.202569119933714514e-01 1.347308789839130050e-02 -4.340358271406951074e-01 1.347308789839130050e-02 -4.478147422880187634e-01 1.347308789839130050e-02 -4.615936574353424193e-01 1.347308789839130050e-02 -4.753725725826660753e-01 1.347308789839130050e-02 -4.891514877299897313e-01 1.347308789839130050e-02 -5.029304028773133872e-01 1.347308789839118948e-02 -5.167093180246369322e-01 1.347308789839107845e-02 -5.304882331719606992e-01 1.347308789839107845e-02 -5.442671483192842441e-01 1.347308789839107845e-02 -5.580460634666080111e-01 1.347308789839107845e-02 -5.718249786139315560e-01 1.347308789839107845e-02 -5.856038937612553230e-01 1.347308789839107845e-02 -5.993828089085788680e-01 1.347308789839107845e-02 -6.131617240559026349e-01 1.347308789839107845e-02 -6.269406392032261799e-01 1.347308789839107845e-02 -6.407195543505499469e-01 1.347308789839107845e-02 -6.544984694978734918e-01 1.347308789839107845e-02 -6.682773846451973698e-01 1.347308789839107845e-02 -6.820562997925208037e-01 1.347308789839107845e-02 -6.958352149398445707e-01 1.347308789839107845e-02 -7.096141300871681157e-01 1.347308789839107845e-02 -7.233930452344918827e-01 1.347308789839107845e-02 -7.371719603818154276e-01 1.347308789839107845e-02 -7.509508755291391946e-01 1.347308789839107845e-02 -7.647297906764627395e-01 1.347308789839107845e-02 -7.785087058237865065e-01 1.347308789839107845e-02 -7.922876209711100515e-01 1.347308789839107845e-02 -8.060665361184338185e-01 1.347308789839107845e-02 -8.198454512657573634e-01 1.347308789839107845e-02 -8.336243664130811304e-01 1.347308789839107845e-02 -8.474032815604045643e-01 1.347308789839107845e-02 -8.611821967077283313e-01 1.347308789839107845e-02 -8.749611118550519873e-01 1.347308789839107845e-02 -8.887400270023757543e-01 1.347308789839107845e-02 -9.025189421496992992e-01 1.347308789839107845e-02 -9.162978572970230662e-01 1.347308789839107845e-02 -9.300767724443466111e-01 1.347308789839107845e-02 -9.438556875916703781e-01 1.347308789839107845e-02 -9.576346027389939231e-01 1.347308789839107845e-02 -9.714135178863175790e-01 1.347308789839107845e-02 -9.851924330336412350e-01 1.347308789839107845e-02 -9.989713481809651130e-01 1.347308789839107845e-02 -1.012750263328288547e+00 1.347308789839107845e-02 -1.026529178475612092e+00 1.347308789839107845e-02 -1.040308093622935859e+00 1.347308789839107845e-02 -1.054087008770259626e+00 1.347308789839107845e-02 -1.067865923917583171e+00 1.347308789839107845e-02 -1.081644839064906716e+00 1.347308789839107845e-02 -1.095423754212230483e+00 1.347308789839107845e-02 -1.109202669359554250e+00 1.347308789839107845e-02 -1.122981584506877795e+00 1.347308789839107845e-02 -1.136760499654201340e+00 1.347308789839107845e-02 -1.150539414801525107e+00 1.347308789839107845e-02 -1.164318329948848874e+00 1.347308789839107845e-02 -1.178097245096172418e+00 1.347308789839107845e-02 -1.191876160243495963e+00 1.347308789839107845e-02 -1.205655075390819730e+00 1.347308789839107845e-02 -1.219433990538143497e+00 1.347308789839107845e-02 -1.233212905685467042e+00 1.347308789839107845e-02 -1.246991820832790587e+00 1.347308789839107845e-02 -1.260770735980114354e+00 1.347308789839107845e-02 -1.274549651127438121e+00 1.347308789839107845e-02 -1.288328566274761666e+00 1.347308789839107845e-02 -1.302107481422085211e+00 1.347308789839107845e-02 -1.315886396569408978e+00 1.347308789839107845e-02 -1.329665311716732745e+00 1.347308789839107845e-02 -1.343444226864056290e+00 1.347308789839107845e-02 -1.357223142011379835e+00 1.347308789839107845e-02 -1.371002057158703602e+00 1.347308789839107845e-02 -1.384780972306027369e+00 1.347308789839107845e-02 -1.398559887453350914e+00 1.347308789839107845e-02 -1.412338802600674459e+00 1.347308789839107845e-02 -1.426117717747998226e+00 1.347308789839107845e-02 -1.439896632895321993e+00 1.347308789839107845e-02 -1.453675548042645538e+00 1.347308789839107845e-02 -1.467454463189969083e+00 1.347308789839107845e-02 -1.481233378337292850e+00 1.347308789839107845e-02 -1.495012293484616617e+00 1.347308789839107845e-02 -1.508791208631940162e+00 1.347308789839107845e-02 -1.522570123779263707e+00 1.347308789839107845e-02 -1.536349038926587474e+00 1.347308789839107845e-02 -1.550127954073911241e+00 1.347308789839107845e-02 -1.563906869221234786e+00 1.347308789839107845e-02 -1.577685784368558330e+00 1.347308789839107845e-02 -1.591464699515882097e+00 1.347308789839107845e-02 -1.605243614663205864e+00 1.347308789839107845e-02 -1.619022529810529409e+00 1.347308789839107845e-02 -1.632801444957852954e+00 1.347308789839107845e-02 -1.646580360105176721e+00 1.347308789839107845e-02 -1.660359275252500488e+00 1.347308789839107845e-02 -1.674138190399824033e+00 1.347308789839107845e-02 -1.687917105547147578e+00 1.347308789839107845e-02 -1.701696020694471345e+00 1.347308789839107845e-02 -1.715474935841795112e+00 1.347308789839107845e-02 -1.729253850989118657e+00 1.347308789839107845e-02 -1.743032766136442202e+00 1.347308789839107845e-02 -1.756811681283765969e+00 1.347308789839107845e-02 -1.770590596431089514e+00 1.347308789839107845e-02 -1.784369511578413281e+00 1.347308789839107845e-02 -1.798148426725736826e+00 1.347308789839107845e-02 -1.811927341873060371e+00 1.347308789839107845e-02 -1.825706257020384138e+00 1.347308789839107845e-02 -1.839485172167707905e+00 1.347308789839107845e-02 -1.853264087315031450e+00 1.347308789839107845e-02 -1.867043002462354995e+00 1.347308789839107845e-02 -1.880821917609678762e+00 1.347308789839107845e-02 -1.894600832757002529e+00 1.347308789839107845e-02 -1.908379747904326074e+00 1.347308789839107845e-02 -1.922158663051649619e+00 1.347308789839107845e-02 -1.935937578198973386e+00 1.347308789839107845e-02 -1.949716493346297153e+00 1.347308789839107845e-02 -1.963495408493620697e+00 1.347308789839107845e-02 -1.977274323640944242e+00 1.347308789839107845e-02 -1.991053238788268009e+00 1.347308789839107845e-02 -2.004832153935591776e+00 1.347308789839107845e-02 -2.018611069082915321e+00 1.347308789839107845e-02 -2.032389984230238866e+00 1.347308789839107845e-02 -2.046168899377562411e+00 1.347308789839107845e-02 -2.059947814524886400e+00 1.347308789839107845e-02 -2.073726729672209945e+00 1.347308789839107845e-02 -2.087505644819533490e+00 1.347308789839107845e-02 -2.101284559966857479e+00 1.347308789839107845e-02 -2.115063475114181024e+00 1.347308789839107845e-02 -2.128842390261504569e+00 1.347308789839107845e-02 -2.142621305408828114e+00 1.347308789839107845e-02 -2.156400220556151659e+00 1.347308789839107845e-02 -2.170179135703475648e+00 1.347308789839107845e-02 -2.183958050850799193e+00 1.347308789839107845e-02 -2.197736965998122738e+00 1.347308789839107845e-02 -2.211515881145446727e+00 1.347308789839107845e-02 -2.225294796292770272e+00 1.347308789839107845e-02 -2.239073711440093817e+00 1.347308789839107845e-02 -2.252852626587417362e+00 1.347308789839107845e-02 -2.266631541734740907e+00 1.347308789839107845e-02 -2.280410456882064896e+00 1.347308789839107845e-02 -2.294189372029388441e+00 1.347308789839107845e-02 -2.307968287176711986e+00 1.347308789839107845e-02 -2.321747202324035975e+00 1.347308789839107845e-02 -2.335526117471359520e+00 1.347308789839107845e-02 -2.349305032618683065e+00 1.347308789839107845e-02 -2.363083947766006609e+00 1.347308789839107845e-02 -2.376862862913330154e+00 1.347308789839107845e-02 -2.390641778060654143e+00 1.347308789839107845e-02 -2.404420693207977688e+00 1.347308789839107845e-02 -2.418199608355301233e+00 1.347308789839107845e-02 -2.431978523502625222e+00 1.347308789839107845e-02 -2.445757438649948767e+00 1.347308789839107845e-02 -2.459536353797272312e+00 1.347308789839107845e-02 -2.473315268944595857e+00 1.347308789839107845e-02 -2.487094184091919402e+00 1.347308789839107845e-02 -2.500873099239243391e+00 1.347308789839107845e-02 -2.514652014386566936e+00 1.347308789839107845e-02 -2.528430929533890481e+00 1.347308789839107845e-02 -2.542209844681214470e+00 1.347308789839107845e-02 -2.555988759828538015e+00 1.347308789839107845e-02 -2.569767674975861560e+00 1.347308789839107845e-02 -2.583546590123185105e+00 1.347308789839107845e-02 -2.597325505270508650e+00 1.347308789839107845e-02 -2.611104420417832639e+00 1.347308789839107845e-02 -2.624883335565156184e+00 1.347308789839107845e-02 -2.638662250712479729e+00 1.347308789839107845e-02 -2.652441165859803274e+00 1.347308789839107845e-02 -2.666220081007127263e+00 1.347308789839107845e-02 -2.679998996154450808e+00 1.347308789839107845e-02 -2.693777911301774353e+00 1.347308789839107845e-02 -2.707556826449097898e+00 1.347308789839107845e-02 -2.721335741596421443e+00 1.347308789839107845e-02 -2.735114656743745432e+00 1.347308789839107845e-02 -2.748893571891068976e+00 1.347308789839107845e-02 -2.762672487038392521e+00 1.347308789839107845e-02 -2.776451402185716510e+00 1.347308789839107845e-02 -2.790230317333040055e+00 1.347308789839107845e-02 -2.804009232480363600e+00 1.347308789839107845e-02 -2.817788147627687145e+00 1.347308789839107845e-02 -2.831567062775010690e+00 1.347308789839107845e-02 -2.845345977922334679e+00 1.347308789839107845e-02 -2.859124893069658224e+00 1.347308789839107845e-02 -2.872903808216981769e+00 1.347308789839107845e-02 -2.886682723364305758e+00 1.347308789839107845e-02 -2.900461638511629303e+00 1.347308789839107845e-02 -2.914240553658952848e+00 1.347308789839107845e-02 -2.928019468806276393e+00 1.347308789839107845e-02 -2.941798383953599938e+00 1.347308789839107845e-02 -2.955577299100923927e+00 1.347308789839107845e-02 -2.969356214248247472e+00 1.347308789839107845e-02 -2.983135129395571017e+00 1.347308789839107845e-02 -2.996914044542895006e+00 1.347308789839107845e-02 -3.010692959690218551e+00 1.347308789839107845e-02 -3.024471874837542096e+00 1.347308789839107845e-02 -3.038250789984865641e+00 1.347308789839107845e-02 -3.052029705132189186e+00 1.347308789839107845e-02 -3.065808620279513175e+00 1.347308789839107845e-02 -3.079587535426836720e+00 1.347308789839107845e-02 -3.093366450574160265e+00 1.347308789839107845e-02 -3.107145365721484254e+00 1.347308789839107845e-02 -3.120924280868807799e+00 1.347308789839107845e-02 -3.134703196016131344e+00 1.347308789839107845e-02 --3.134703196016131788e+00 1.347308789839107845e-02 --3.120924280868808243e+00 1.347308789839107845e-02 --3.107145365721484254e+00 1.347308789839107845e-02 --3.093366450574160709e+00 1.347308789839107845e-02 --3.079587535426837164e+00 1.347308789839107845e-02 --3.065808620279513175e+00 1.347308789839107845e-02 --3.052029705132189630e+00 1.347308789839107845e-02 --3.038250789984866085e+00 1.347308789839107845e-02 --3.024471874837542540e+00 1.347308789839107845e-02 --3.010692959690218995e+00 1.347308789839107845e-02 --2.996914044542895006e+00 1.347308789839107845e-02 --2.983135129395571461e+00 1.347308789839107845e-02 --2.969356214248247916e+00 1.347308789839107845e-02 --2.955577299100923927e+00 1.347308789839107845e-02 --2.941798383953600382e+00 1.347308789839107845e-02 --2.928019468806276837e+00 1.347308789839107845e-02 --2.914240553658953292e+00 1.347308789839107845e-02 --2.900461638511629747e+00 1.347308789839107845e-02 --2.886682723364305758e+00 1.347308789839107845e-02 --2.872903808216981769e+00 1.347308789839107845e-02 --2.859124893069658668e+00 1.347308789839107845e-02 --2.845345977922334679e+00 1.347308789839107845e-02 --2.831567062775011134e+00 1.347308789839107845e-02 --2.817788147627687145e+00 1.347308789839107845e-02 --2.804009232480364044e+00 1.347308789839107845e-02 --2.790230317333040055e+00 1.347308789839107845e-02 --2.776451402185716510e+00 1.347308789839107845e-02 --2.762672487038392966e+00 1.347308789839107845e-02 --2.748893571891069421e+00 1.347308789839107845e-02 --2.735114656743745876e+00 1.347308789839107845e-02 --2.721335741596421443e+00 1.347308789839107845e-02 --2.707556826449098342e+00 1.347308789839107845e-02 --2.693777911301774797e+00 1.347308789839107845e-02 --2.679998996154451252e+00 1.347308789839107845e-02 --2.666220081007127707e+00 1.347308789839107845e-02 --2.652441165859803274e+00 1.347308789839107845e-02 --2.638662250712480173e+00 1.347308789839107845e-02 --2.624883335565156628e+00 1.347308789839107845e-02 --2.611104420417832195e+00 1.347308789839107845e-02 --2.597325505270509094e+00 1.347308789839107845e-02 --2.583546590123185549e+00 1.347308789839107845e-02 --2.569767674975861560e+00 1.347308789839107845e-02 --2.555988759828538459e+00 1.347308789839107845e-02 --2.542209844681214026e+00 1.347308789839107845e-02 --2.528430929533890925e+00 1.347308789839107845e-02 --2.514652014386567380e+00 1.347308789839107845e-02 --2.500873099239243391e+00 1.347308789839107845e-02 --2.487094184091919846e+00 1.347308789839107845e-02 --2.473315268944595857e+00 1.347308789839107845e-02 --2.459536353797272756e+00 1.347308789839107845e-02 --2.445757438649949211e+00 1.347308789839107845e-02 --2.431978523502625222e+00 1.347308789839107845e-02 --2.418199608355301677e+00 1.347308789839107845e-02 --2.404420693207978132e+00 1.347308789839107845e-02 --2.390641778060654143e+00 1.347308789839107845e-02 --2.376862862913330599e+00 1.347308789839107845e-02 --2.363083947766007054e+00 1.347308789839107845e-02 --2.349305032618683509e+00 1.347308789839107845e-02 --2.335526117471359964e+00 1.347308789839107845e-02 --2.321747202324035975e+00 1.347308789839107845e-02 --2.307968287176712430e+00 1.347308789839107845e-02 --2.294189372029388885e+00 1.347308789839107845e-02 --2.280410456882064896e+00 1.347308789839152254e-02 --2.266631541734740907e+00 1.347308789839196663e-02 --2.252852626587417806e+00 1.347308789839196663e-02 --2.239073711440094261e+00 1.347308789839196663e-02 --2.225294796292770716e+00 1.347308789839196663e-02 --2.211515881145446727e+00 1.347308789839196663e-02 --2.197736965998123182e+00 1.347308789839196663e-02 --2.183958050850799193e+00 1.347308789839196663e-02 --2.170179135703475648e+00 1.347308789839196663e-02 --2.156400220556151659e+00 1.347308789839196663e-02 --2.142621305408828114e+00 1.347308789839196663e-02 --2.128842390261505013e+00 1.347308789839196663e-02 --2.115063475114181468e+00 1.347308789839196663e-02 --2.101284559966857923e+00 1.347308789839196663e-02 --2.087505644819533490e+00 1.347308789839196663e-02 --2.073726729672209945e+00 1.347308789839196663e-02 --2.059947814524886400e+00 1.347308789839196663e-02 --2.046168899377562855e+00 1.347308789839196663e-02 --2.032389984230239310e+00 1.347308789839196663e-02 --2.018611069082915765e+00 1.347308789839196663e-02 --2.004832153935591776e+00 1.347308789839196663e-02 --1.991053238788268454e+00 1.347308789839196663e-02 --1.977274323640944909e+00 1.347308789839196663e-02 --1.963495408493620475e+00 1.347308789839196663e-02 --1.949716493346296931e+00 1.347308789839196663e-02 --1.935937578198973386e+00 1.347308789839196663e-02 --1.922158663051649841e+00 1.347308789839196663e-02 --1.908379747904326296e+00 1.347308789839196663e-02 --1.894600832757002751e+00 1.347308789839196663e-02 --1.880821917609679206e+00 1.347308789839196663e-02 --1.867043002462355661e+00 1.347308789839196663e-02 --1.853264087315031228e+00 1.347308789839196663e-02 --1.839485172167707683e+00 1.347308789839196663e-02 --1.825706257020384138e+00 1.347308789839196663e-02 --1.811927341873060593e+00 1.347308789839196663e-02 --1.798148426725737048e+00 1.347308789839196663e-02 --1.784369511578413503e+00 1.347308789839196663e-02 --1.770590596431089958e+00 1.347308789839196663e-02 --1.756811681283766413e+00 1.347308789839196663e-02 --1.743032766136442868e+00 1.347308789839196663e-02 --1.729253850989118435e+00 1.347308789839196663e-02 --1.715474935841794890e+00 1.347308789839196663e-02 --1.701696020694471345e+00 1.347308789839196663e-02 --1.687917105547147800e+00 1.347308789839196663e-02 --1.674138190399824255e+00 1.347308789839196663e-02 --1.660359275252500710e+00 1.347308789839196663e-02 --1.646580360105177165e+00 1.347308789839196663e-02 --1.632801444957852732e+00 1.347308789839196663e-02 --1.619022529810529187e+00 1.347308789839196663e-02 --1.605243614663205642e+00 1.347308789839196663e-02 --1.591464699515882097e+00 1.347308789839196663e-02 --1.577685784368558553e+00 1.347308789839196663e-02 --1.563906869221235008e+00 1.347308789839196663e-02 --1.550127954073911463e+00 1.347308789839196663e-02 --1.536349038926587918e+00 1.347308789839196663e-02 --1.522570123779264373e+00 1.347308789839196663e-02 --1.508791208631939940e+00 1.347308789839196663e-02 --1.495012293484616395e+00 1.347308789839196663e-02 --1.481233378337292850e+00 1.347308789839196663e-02 --1.467454463189969305e+00 1.347308789839196663e-02 --1.453675548042645760e+00 1.347308789839196663e-02 --1.439896632895322215e+00 1.347308789839196663e-02 --1.426117717747998670e+00 1.347308789839196663e-02 --1.412338802600674237e+00 1.347308789839196663e-02 --1.398559887453350692e+00 1.347308789839196663e-02 --1.384780972306027147e+00 1.347308789839196663e-02 --1.371002057158703602e+00 1.347308789839196663e-02 --1.357223142011380057e+00 1.347308789839196663e-02 --1.343444226864056512e+00 1.347308789839196663e-02 --1.329665311716732967e+00 1.347308789839196663e-02 --1.315886396569409422e+00 1.347308789839196663e-02 --1.302107481422085877e+00 1.347308789839196663e-02 --1.288328566274761444e+00 1.347308789839196663e-02 --1.274549651127437899e+00 1.347308789839196663e-02 --1.260770735980114354e+00 1.347308789839196663e-02 --1.246991820832790809e+00 1.347308789839196663e-02 --1.233212905685467264e+00 1.347308789839196663e-02 --1.219433990538143719e+00 1.347308789839196663e-02 --1.205655075390820175e+00 1.347308789839196663e-02 --1.191876160243495741e+00 1.347308789839196663e-02 --1.178097245096172196e+00 1.347308789839196663e-02 --1.164318329948848652e+00 1.347308789839196663e-02 --1.150539414801525107e+00 1.347308789839196663e-02 --1.136760499654201562e+00 1.347308789839196663e-02 --1.122981584506878017e+00 1.347308789839196663e-02 --1.109202669359554472e+00 1.347308789839196663e-02 --1.095423754212230927e+00 1.347308789839196663e-02 --1.081644839064907382e+00 1.347308789839196663e-02 --1.067865923917582949e+00 1.347308789839196663e-02 --1.054087008770259404e+00 1.347308789839196663e-02 --1.040308093622935859e+00 1.347308789839196663e-02 --1.026529178475612314e+00 1.347308789839196663e-02 --1.012750263328288769e+00 1.347308789839196663e-02 --9.989713481809653350e-01 1.347308789839196663e-02 --9.851924330336416791e-01 1.347308789839196663e-02 --9.714135178863181341e-01 1.347308789839196663e-02 --9.576346027389938120e-01 1.347308789839196663e-02 --9.438556875916701561e-01 1.347308789839196663e-02 --9.300767724443466111e-01 1.347308789839196663e-02 --9.162978572970230662e-01 1.347308789839196663e-02 --9.025189421496995212e-01 1.347308789839196663e-02 --8.887400270023759763e-01 1.347308789839196663e-02 --8.749611118550524314e-01 1.347308789839196663e-02 --8.611821967077288864e-01 1.347308789839196663e-02 --8.474032815604054525e-01 1.347308789839196663e-02 --8.336243664130809083e-01 1.347308789839196663e-02 --8.198454512657573634e-01 1.347308789839196663e-02 --8.060665361184338185e-01 1.347308789839196663e-02 --7.922876209711102735e-01 1.347308789839196663e-02 --7.785087058237867286e-01 1.347308789839196663e-02 --7.647297906764632947e-01 1.347308789839196663e-02 --7.509508755291396387e-01 1.347308789839196663e-02 --7.371719603818152056e-01 1.347308789839196663e-02 --7.233930452344916606e-01 1.347308789839196663e-02 --7.096141300871681157e-01 1.347308789839196663e-02 --6.958352149398446818e-01 1.347308789839196663e-02 --6.820562997925210258e-01 1.347308789839196663e-02 --6.682773846451974809e-01 1.347308789839196663e-02 --6.544984694978739359e-01 1.347308789839196663e-02 --6.407195543505503910e-01 1.347308789839196663e-02 --6.269406392032268460e-01 1.347308789839196663e-02 --6.131617240559024129e-01 1.347308789839196663e-02 --5.993828089085788680e-01 1.347308789839196663e-02 --5.856038937612553230e-01 1.347308789839196663e-02 --5.718249786139317781e-01 1.347308789839196663e-02 --5.580460634666082331e-01 1.347308789839196663e-02 --5.442671483192846882e-01 1.347308789839196663e-02 --5.304882331719611432e-01 1.347308789839196663e-02 --5.167093180246367101e-01 1.347308789839196663e-02 --5.029304028773131652e-01 1.347308789839196663e-02 --4.891514877299896757e-01 1.347308789839196663e-02 --4.753725725826661308e-01 1.347308789839196663e-02 --4.615936574353425303e-01 1.347308789839196663e-02 --4.478147422880189854e-01 1.347308789839196663e-02 --4.340358271406954405e-01 1.347308789839196663e-02 --4.202569119933719510e-01 1.347308789839196663e-02 --4.064779968460483506e-01 1.347308789839196663e-02 --3.926990816987239175e-01 1.347308789839196663e-02 --3.789201665514004280e-01 1.347308789839196663e-02 --3.651412514040768276e-01 1.347308789839196663e-02 --3.513623362567533381e-01 1.347308789839196663e-02 --3.375834211094297932e-01 1.347308789839196663e-02 --3.238045059621062483e-01 1.347308789839196663e-02 --3.100255908147826478e-01 1.347308789839196663e-02 --2.962466756674582702e-01 1.347308789839196663e-02 --2.824677605201346697e-01 1.347308789839196663e-02 --2.686888453728111248e-01 1.347308789839196663e-02 --2.549099302254875243e-01 1.347308789839196663e-02 --2.411310150781640627e-01 1.347308789839196663e-02 --2.273520999308405177e-01 1.347308789839196663e-02 --2.135731847835169728e-01 1.347308789839196663e-02 --1.997942696361934278e-01 1.347308789839196663e-02 --1.860153544888698551e-01 1.347308789839196663e-02 --1.722364393415454498e-01 1.347308789839196663e-02 --1.584575241942219326e-01 1.347308789839196663e-02 --1.446786090468983599e-01 1.347308789839196663e-02 --1.308996938995748149e-01 1.347308789839196663e-02 --1.171207787522512561e-01 1.347308789839196663e-02 --1.033418636049277251e-01 1.347308789839196663e-02 --8.956294845760416623e-02 1.347308789839196663e-02 --7.578403331028064904e-02 1.347308789839196663e-02 --6.200511816295618817e-02 1.347308789839196663e-02 --4.822620301563265016e-02 1.347308789839196663e-02 --3.444728786830910522e-02 1.347308789839196663e-02 --2.066837272098556721e-02 1.347308789839196663e-02 --6.889457573662017068e-03 1.347308789839196663e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV0.txt deleted file mode 100644 index 54c378698..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV0.txt +++ /dev/null @@ -1,16 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowITERV0 -1.200000000000000000e+01 0.000000000000000000e+00 -1.951437505566089081e+00 -6.255000000000000560e-01 -2.356617780927638517e+00 -7.892007772062769044e-01 -2.366357483076916512e+00 -7.650965613562188405e-01 -1.961176771605507296e+00 -6.013950000000000129e-01 -1.958885928041752988e+00 -6.069560000000000510e-01 -1.932087169846381736e+00 -5.961290000000000200e-01 -1.933963616764545090e+00 -5.914880000000000138e-01 -1.907861744381128100e+00 -5.809440000000000159e-01 -1.896249179496460657e+00 -6.096869999999999790e-01 -1.922350157298612583e+00 -6.202309999999999768e-01 -1.926468561322763895e+00 -6.100359999999999117e-01 -1.953266400999362107e+00 -6.208640000000000825e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV1.txt deleted file mode 100644 index c04c44e3f..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV1.txt +++ /dev/null @@ -1,50 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowITERV1 -4.600000000000000000e+01 0.000000000000000000e+00 -1.951437505566089081e+00 -6.255000000000000560e-01 -2.356617780927638517e+00 -7.892007772062769044e-01 -2.366357483076916512e+00 -7.650965613562188405e-01 -2.354999236708075649e+00 -7.605073031009804696e-01 -2.343409411897963146e+00 -7.558247865905033391e-01 -2.331819587087849754e+00 -7.511422700800263197e-01 -2.320229762277737251e+00 -7.464597535695493002e-01 -2.308639937467623859e+00 -7.417772370590722808e-01 -2.297050112657511356e+00 -7.370947205485952614e-01 -2.285460287847397964e+00 -7.324122040381182419e-01 -2.273870463037285461e+00 -7.277296875276412225e-01 -2.262280638227172069e+00 -7.230471710171642030e-01 -2.250690813417059566e+00 -7.183646545066871836e-01 -2.239100988606946174e+00 -7.136821379962101641e-01 -2.227511163796833227e+00 -7.089996214857331447e-01 -2.215921338986720279e+00 -7.043171049752561252e-01 -2.204331514176606888e+00 -6.996345884647789948e-01 -2.192741689366494384e+00 -6.949520719543019753e-01 -2.181151864556380993e+00 -6.902695554438249559e-01 -2.169562039746268489e+00 -6.855870389333479364e-01 -2.157972214936155098e+00 -6.809045224228709170e-01 -2.146382390126042594e+00 -6.762220059123938976e-01 -2.134792565315929203e+00 -6.715394894019168781e-01 -2.123202740505816699e+00 -6.668569728914398587e-01 -2.111612915695703308e+00 -6.621744563809628392e-01 -2.100023090885590804e+00 -6.574919398704858198e-01 -2.088433266075477412e+00 -6.528094233600088003e-01 -2.076843441265364909e+00 -6.481269068495317809e-01 -2.065253616455251517e+00 -6.434443903390547614e-01 -2.053663791645139014e+00 -6.387618738285777420e-01 -2.042073966835025622e+00 -6.340793573181006115e-01 -2.030484142024913119e+00 -6.293968408076235921e-01 -2.018894317214799727e+00 -6.247143242971465726e-01 -2.007304492404687224e+00 -6.200318077866695532e-01 -1.995714667594573832e+00 -6.153492912761925338e-01 -1.984124842784460885e+00 -6.106667747657155143e-01 -1.972535017974347937e+00 -6.059842582552384949e-01 -1.961176771605507296e+00 -6.013950000000000129e-01 -1.958885928041752988e+00 -6.069560000000000510e-01 -1.932087169846381736e+00 -5.961290000000000200e-01 -1.933963616764545090e+00 -5.914880000000000138e-01 -1.907861744381128100e+00 -5.809440000000000159e-01 -1.896249179496460657e+00 -6.096869999999999790e-01 -1.922350157298612583e+00 -6.202309999999999768e-01 -1.926468561322763895e+00 -6.100359999999999117e-01 -1.953266400999362107e+00 -6.208640000000000825e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV2.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV2.txt deleted file mode 100644 index 81380e0c5..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV2.txt +++ /dev/null @@ -1,153 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowITERV2 -1.490000000000000000e+02 0.000000000000000000e+00 -1.951437505566089081e+00 -6.255000000000000560e-01 -2.356617780927638517e+00 -7.892007772062769044e-01 -2.356992838111822142e+00 -7.882735613562188437e-01 -2.366357483076916512e+00 -7.650965613562188405e-01 -2.355230815149348178e+00 -7.606005613562190071e-01 -2.345866170185388455e+00 -7.837775613562190102e-01 -2.345403013301709194e+00 -7.835910448457419353e-01 -2.354767658266803565e+00 -7.604140448457419321e-01 -2.343640990339235231e+00 -7.559180448457418766e-01 -2.334276345375275064e+00 -7.790950448457418798e-01 -2.333813188491596247e+00 -7.789085283352648048e-01 -2.343177833456690617e+00 -7.557315283352648017e-01 -2.332051165529122283e+00 -7.512355283352648572e-01 -2.322686520565162560e+00 -7.744125283352648603e-01 -2.322223363681483299e+00 -7.742260118247877854e-01 -2.331588008646577670e+00 -7.510490118247877822e-01 -2.320461340719009335e+00 -7.465530118247878377e-01 -2.311096695755049168e+00 -7.697300118247878409e-01 -2.310633538871370352e+00 -7.695434953143107659e-01 -2.319998183836464722e+00 -7.463664953143107628e-01 -2.308871515908896388e+00 -7.418704953143108183e-01 -2.299506870944936221e+00 -7.650474953143108214e-01 -2.299043714061257404e+00 -7.648609788038337465e-01 -2.308408359026351775e+00 -7.416839788038337433e-01 -2.297281691098783440e+00 -7.371879788038337988e-01 -2.287917046134823273e+00 -7.603649788038338020e-01 -2.287453889251144457e+00 -7.601784622933567270e-01 -2.296818534216238827e+00 -7.370014622933567239e-01 -2.285691866288670493e+00 -7.325054622933567794e-01 -2.276327221324710326e+00 -7.556824622933567825e-01 -2.275864064441031509e+00 -7.554959457828797076e-01 -2.285228709406125880e+00 -7.323189457828797044e-01 -2.274102041478557545e+00 -7.278229457828797599e-01 -2.264737396514597378e+00 -7.509999457828797631e-01 -2.264274239630918562e+00 -7.508134292724026881e-01 -2.273638884596012932e+00 -7.276364292724026850e-01 -2.262512216668444598e+00 -7.231404292724027405e-01 -2.253147571704484431e+00 -7.463174292724027437e-01 -2.252684414820805614e+00 -7.461309127619256687e-01 -2.262049059785899985e+00 -7.229539127619256655e-01 -2.250922391858331650e+00 -7.184579127619257211e-01 -2.241557746894371483e+00 -7.416349127619257242e-01 -2.241094590010692666e+00 -7.414483962514486493e-01 -2.250459234975787037e+00 -7.182713962514486461e-01 -2.239332567048218703e+00 -7.137753962514487016e-01 -2.229967922084258536e+00 -7.369523962514487048e-01 -2.229504765200579719e+00 -7.367658797409716298e-01 -2.238869410165674090e+00 -7.135888797409716267e-01 -2.227742742238105755e+00 -7.090928797409716822e-01 -2.218378097274145588e+00 -7.322698797409716853e-01 -2.217914940390466327e+00 -7.320833632304946104e-01 -2.227279585355560698e+00 -7.089063632304946072e-01 -2.216152917427992364e+00 -7.044103632304946627e-01 -2.206788272464032641e+00 -7.275873632304946659e-01 -2.206325115580353380e+00 -7.274008467200174799e-01 -2.215689760545447751e+00 -7.042238467200174767e-01 -2.204563092617879416e+00 -6.997278467200176433e-01 -2.195198447653919693e+00 -7.229048467200176464e-01 -2.194735290770240432e+00 -7.227183302095404605e-01 -2.204099935735334803e+00 -6.995413302095404573e-01 -2.192973267807766469e+00 -6.950453302095405128e-01 -2.183608622843806746e+00 -7.182223302095405160e-01 -2.183145465960127485e+00 -7.180358136990634410e-01 -2.192510110925221856e+00 -6.948588136990634379e-01 -2.181383442997653521e+00 -6.903628136990634934e-01 -2.172018798033693798e+00 -7.135398136990634965e-01 -2.171555641150014537e+00 -7.133532971885864216e-01 -2.180920286115108908e+00 -6.901762971885864184e-01 -2.169793618187540574e+00 -6.856802971885864739e-01 -2.160428973223580851e+00 -7.088572971885864771e-01 -2.159965816339901590e+00 -7.086707806781094021e-01 -2.169330461304995961e+00 -6.854937806781093990e-01 -2.158203793377427626e+00 -6.809977806781094545e-01 -2.148839148413467903e+00 -7.041747806781094576e-01 -2.148375991529788642e+00 -7.039882641676323827e-01 -2.157740636494883013e+00 -6.808112641676323795e-01 -2.146613968567314679e+00 -6.763152641676324350e-01 -2.137249323603354956e+00 -6.994922641676324382e-01 -2.136786166719675695e+00 -6.993057476571553632e-01 -2.146150811684770066e+00 -6.761287476571553601e-01 -2.135024143757201731e+00 -6.716327476571554156e-01 -2.125659498793242008e+00 -6.948097476571554187e-01 -2.125196341909562747e+00 -6.946232311466783438e-01 -2.134560986874657118e+00 -6.714462311466783406e-01 -2.123434318947088784e+00 -6.669502311466783961e-01 -2.114069673983129061e+00 -6.901272311466783993e-01 -2.113606517099449800e+00 -6.899407146362013243e-01 -2.122971162064544171e+00 -6.667637146362013212e-01 -2.111844494136975836e+00 -6.622677146362013767e-01 -2.102479849173016113e+00 -6.854447146362013799e-01 -2.102016692289336852e+00 -6.852581981257243049e-01 -2.111381337254431223e+00 -6.620811981257243017e-01 -2.100254669326862889e+00 -6.575851981257243573e-01 -2.090890024362903166e+00 -6.807621981257243604e-01 -2.090426867479223905e+00 -6.805756816152472854e-01 -2.099791512444318275e+00 -6.573986816152472823e-01 -2.088664844516749941e+00 -6.529026816152473378e-01 -2.079300199552790218e+00 -6.760796816152473410e-01 -2.078837042669110957e+00 -6.758931651047702660e-01 -2.088201687634205328e+00 -6.527161651047702629e-01 -2.077075019706636994e+00 -6.482201651047703184e-01 -2.067710374742676827e+00 -6.713971651047703215e-01 -2.067247217858998010e+00 -6.712106485942932466e-01 -2.076611862824092380e+00 -6.480336485942932434e-01 -2.065485194896524046e+00 -6.435376485942932989e-01 -2.056120549932563879e+00 -6.667146485942933021e-01 -2.055657393048885062e+00 -6.665281320838162271e-01 -2.065022038013979433e+00 -6.433511320838162240e-01 -2.053895370086411098e+00 -6.388551320838162795e-01 -2.044530725122450932e+00 -6.620321320838162826e-01 -2.044067568238772115e+00 -6.618456155733392077e-01 -2.053432213203866485e+00 -6.386686155733392045e-01 -2.042305545276298151e+00 -6.341726155733391490e-01 -2.032940900312337984e+00 -6.573496155733391522e-01 -2.032477743428659167e+00 -6.571630990628620772e-01 -2.041842388393753538e+00 -6.339860990628620740e-01 -2.030715720466185203e+00 -6.294900990628621296e-01 -2.021351075502225036e+00 -6.526670990628621327e-01 -2.020887918618546220e+00 -6.524805825523850578e-01 -2.030252563583640590e+00 -6.293035825523850546e-01 -2.019125895656072256e+00 -6.248075825523851101e-01 -2.009761250692112089e+00 -6.479845825523851133e-01 -2.009298093808433272e+00 -6.477980660419080383e-01 -2.018662738773527643e+00 -6.246210660419080352e-01 -2.007536070845959308e+00 -6.201250660419080907e-01 -1.998171425881999141e+00 -6.433020660419080938e-01 -1.997708268998320102e+00 -6.431155495314310189e-01 -2.007072913963414695e+00 -6.199385495314310157e-01 -1.995946246035846139e+00 -6.154425495314310712e-01 -1.986581601071886194e+00 -6.386195495314310744e-01 -1.986118444188207155e+00 -6.384330330209539994e-01 -1.995483089153301526e+00 -6.152560330209539963e-01 -1.984356421225733191e+00 -6.107600330209540518e-01 -1.974991776261773246e+00 -6.339370330209540549e-01 -1.974528619378094207e+00 -6.337505165104769800e-01 -1.983893264343188578e+00 -6.105735165104769768e-01 -1.972766596415620244e+00 -6.060775165104770323e-01 -1.963401951451660299e+00 -6.292545165104770355e-01 -1.962938794567981260e+00 -6.290679999999999605e-01 -1.972303439533075631e+00 -6.058909999999999574e-01 -1.961176771605507296e+00 -6.013950000000000129e-01 -1.958885928041752988e+00 -6.069560000000000510e-01 -1.932087169846381736e+00 -5.961290000000000200e-01 -1.933963616764545090e+00 -5.914880000000000138e-01 -1.907861744381128100e+00 -5.809440000000000159e-01 -1.896249179496460657e+00 -6.096869999999999790e-01 -1.922350157298612583e+00 -6.202309999999999768e-01 -1.926468561322763895e+00 -6.100359999999999117e-01 -1.953266400999362107e+00 -6.208640000000000825e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV3.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV3.txt deleted file mode 100644 index 76078539d..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivLowITERV3.txt +++ /dev/null @@ -1,609 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivLowITERV3 -1.490000000000000000e+02 4.560000000000000000e+02 -1.951437505566089081e+00 -6.255000000000000560e-01 -2.356617780927638517e+00 -7.892007772062769044e-01 -2.356992838111822142e+00 -7.882735613562188437e-01 -2.366357483076916512e+00 -7.650965613562188405e-01 -2.355230815149348178e+00 -7.606005613562190071e-01 -2.345866170185388455e+00 -7.837775613562190102e-01 -2.345403013301709194e+00 -7.835910448457419353e-01 -2.354767658266803565e+00 -7.604140448457419321e-01 -2.343640990339235231e+00 -7.559180448457418766e-01 -2.334276345375275064e+00 -7.790950448457418798e-01 -2.333813188491596247e+00 -7.789085283352648048e-01 -2.343177833456690617e+00 -7.557315283352648017e-01 -2.332051165529122283e+00 -7.512355283352648572e-01 -2.322686520565162560e+00 -7.744125283352648603e-01 -2.322223363681483299e+00 -7.742260118247877854e-01 -2.331588008646577670e+00 -7.510490118247877822e-01 -2.320461340719009335e+00 -7.465530118247878377e-01 -2.311096695755049168e+00 -7.697300118247878409e-01 -2.310633538871370352e+00 -7.695434953143107659e-01 -2.319998183836464722e+00 -7.463664953143107628e-01 -2.308871515908896388e+00 -7.418704953143108183e-01 -2.299506870944936221e+00 -7.650474953143108214e-01 -2.299043714061257404e+00 -7.648609788038337465e-01 -2.308408359026351775e+00 -7.416839788038337433e-01 -2.297281691098783440e+00 -7.371879788038337988e-01 -2.287917046134823273e+00 -7.603649788038338020e-01 -2.287453889251144457e+00 -7.601784622933567270e-01 -2.296818534216238827e+00 -7.370014622933567239e-01 -2.285691866288670493e+00 -7.325054622933567794e-01 -2.276327221324710326e+00 -7.556824622933567825e-01 -2.275864064441031509e+00 -7.554959457828797076e-01 -2.285228709406125880e+00 -7.323189457828797044e-01 -2.274102041478557545e+00 -7.278229457828797599e-01 -2.264737396514597378e+00 -7.509999457828797631e-01 -2.264274239630918562e+00 -7.508134292724026881e-01 -2.273638884596012932e+00 -7.276364292724026850e-01 -2.262512216668444598e+00 -7.231404292724027405e-01 -2.253147571704484431e+00 -7.463174292724027437e-01 -2.252684414820805614e+00 -7.461309127619256687e-01 -2.262049059785899985e+00 -7.229539127619256655e-01 -2.250922391858331650e+00 -7.184579127619257211e-01 -2.241557746894371483e+00 -7.416349127619257242e-01 -2.241094590010692666e+00 -7.414483962514486493e-01 -2.250459234975787037e+00 -7.182713962514486461e-01 -2.239332567048218703e+00 -7.137753962514487016e-01 -2.229967922084258536e+00 -7.369523962514487048e-01 -2.229504765200579719e+00 -7.367658797409716298e-01 -2.238869410165674090e+00 -7.135888797409716267e-01 -2.227742742238105755e+00 -7.090928797409716822e-01 -2.218378097274145588e+00 -7.322698797409716853e-01 -2.217914940390466327e+00 -7.320833632304946104e-01 -2.227279585355560698e+00 -7.089063632304946072e-01 -2.216152917427992364e+00 -7.044103632304946627e-01 -2.206788272464032641e+00 -7.275873632304946659e-01 -2.206325115580353380e+00 -7.274008467200174799e-01 -2.215689760545447751e+00 -7.042238467200174767e-01 -2.204563092617879416e+00 -6.997278467200176433e-01 -2.195198447653919693e+00 -7.229048467200176464e-01 -2.194735290770240432e+00 -7.227183302095404605e-01 -2.204099935735334803e+00 -6.995413302095404573e-01 -2.192973267807766469e+00 -6.950453302095405128e-01 -2.183608622843806746e+00 -7.182223302095405160e-01 -2.183145465960127485e+00 -7.180358136990634410e-01 -2.192510110925221856e+00 -6.948588136990634379e-01 -2.181383442997653521e+00 -6.903628136990634934e-01 -2.172018798033693798e+00 -7.135398136990634965e-01 -2.171555641150014537e+00 -7.133532971885864216e-01 -2.180920286115108908e+00 -6.901762971885864184e-01 -2.169793618187540574e+00 -6.856802971885864739e-01 -2.160428973223580851e+00 -7.088572971885864771e-01 -2.159965816339901590e+00 -7.086707806781094021e-01 -2.169330461304995961e+00 -6.854937806781093990e-01 -2.158203793377427626e+00 -6.809977806781094545e-01 -2.148839148413467903e+00 -7.041747806781094576e-01 -2.148375991529788642e+00 -7.039882641676323827e-01 -2.157740636494883013e+00 -6.808112641676323795e-01 -2.146613968567314679e+00 -6.763152641676324350e-01 -2.137249323603354956e+00 -6.994922641676324382e-01 -2.136786166719675695e+00 -6.993057476571553632e-01 -2.146150811684770066e+00 -6.761287476571553601e-01 -2.135024143757201731e+00 -6.716327476571554156e-01 -2.125659498793242008e+00 -6.948097476571554187e-01 -2.125196341909562747e+00 -6.946232311466783438e-01 -2.134560986874657118e+00 -6.714462311466783406e-01 -2.123434318947088784e+00 -6.669502311466783961e-01 -2.114069673983129061e+00 -6.901272311466783993e-01 -2.113606517099449800e+00 -6.899407146362013243e-01 -2.122971162064544171e+00 -6.667637146362013212e-01 -2.111844494136975836e+00 -6.622677146362013767e-01 -2.102479849173016113e+00 -6.854447146362013799e-01 -2.102016692289336852e+00 -6.852581981257243049e-01 -2.111381337254431223e+00 -6.620811981257243017e-01 -2.100254669326862889e+00 -6.575851981257243573e-01 -2.090890024362903166e+00 -6.807621981257243604e-01 -2.090426867479223905e+00 -6.805756816152472854e-01 -2.099791512444318275e+00 -6.573986816152472823e-01 -2.088664844516749941e+00 -6.529026816152473378e-01 -2.079300199552790218e+00 -6.760796816152473410e-01 -2.078837042669110957e+00 -6.758931651047702660e-01 -2.088201687634205328e+00 -6.527161651047702629e-01 -2.077075019706636994e+00 -6.482201651047703184e-01 -2.067710374742676827e+00 -6.713971651047703215e-01 -2.067247217858998010e+00 -6.712106485942932466e-01 -2.076611862824092380e+00 -6.480336485942932434e-01 -2.065485194896524046e+00 -6.435376485942932989e-01 -2.056120549932563879e+00 -6.667146485942933021e-01 -2.055657393048885062e+00 -6.665281320838162271e-01 -2.065022038013979433e+00 -6.433511320838162240e-01 -2.053895370086411098e+00 -6.388551320838162795e-01 -2.044530725122450932e+00 -6.620321320838162826e-01 -2.044067568238772115e+00 -6.618456155733392077e-01 -2.053432213203866485e+00 -6.386686155733392045e-01 -2.042305545276298151e+00 -6.341726155733391490e-01 -2.032940900312337984e+00 -6.573496155733391522e-01 -2.032477743428659167e+00 -6.571630990628620772e-01 -2.041842388393753538e+00 -6.339860990628620740e-01 -2.030715720466185203e+00 -6.294900990628621296e-01 -2.021351075502225036e+00 -6.526670990628621327e-01 -2.020887918618546220e+00 -6.524805825523850578e-01 -2.030252563583640590e+00 -6.293035825523850546e-01 -2.019125895656072256e+00 -6.248075825523851101e-01 -2.009761250692112089e+00 -6.479845825523851133e-01 -2.009298093808433272e+00 -6.477980660419080383e-01 -2.018662738773527643e+00 -6.246210660419080352e-01 -2.007536070845959308e+00 -6.201250660419080907e-01 -1.998171425881999141e+00 -6.433020660419080938e-01 -1.997708268998320102e+00 -6.431155495314310189e-01 -2.007072913963414695e+00 -6.199385495314310157e-01 -1.995946246035846139e+00 -6.154425495314310712e-01 -1.986581601071886194e+00 -6.386195495314310744e-01 -1.986118444188207155e+00 -6.384330330209539994e-01 -1.995483089153301526e+00 -6.152560330209539963e-01 -1.984356421225733191e+00 -6.107600330209540518e-01 -1.974991776261773246e+00 -6.339370330209540549e-01 -1.974528619378094207e+00 -6.337505165104769800e-01 -1.983893264343188578e+00 -6.105735165104769768e-01 -1.972766596415620244e+00 -6.060775165104770323e-01 -1.963401951451660299e+00 -6.292545165104770355e-01 -1.962938794567981260e+00 -6.290679999999999605e-01 -1.972303439533075631e+00 -6.058909999999999574e-01 -1.961176771605507296e+00 -6.013950000000000129e-01 -1.958885928041752988e+00 -6.069560000000000510e-01 -1.932087169846381736e+00 -5.961290000000000200e-01 -1.933963616764545090e+00 -5.914880000000000138e-01 -1.907861744381128100e+00 -5.809440000000000159e-01 -1.896249179496460657e+00 -6.096869999999999790e-01 -1.922350157298612583e+00 -6.202309999999999768e-01 -1.926468561322763895e+00 -6.100359999999999117e-01 -1.953266400999362107e+00 -6.208640000000000825e-01 -6.889457573661827115e-03 1.352029445766848338e-02 -2.066837272098548742e-02 1.352029445766848338e-02 -3.444728786830913297e-02 1.352029445766848512e-02 -4.822620301563278894e-02 1.352029445766848859e-02 -6.200511816295642409e-02 1.352029445766848165e-02 -7.578403331028009393e-02 1.352029445766847471e-02 -8.956294845760374990e-02 1.352029445766847471e-02 -1.033418636049274059e-01 1.352029445766847471e-02 -1.171207787522510618e-01 1.352029445766847471e-02 -1.308996938995747039e-01 1.352029445766848859e-02 -1.446786090468983599e-01 1.352029445766850246e-02 -1.584575241942220714e-01 1.352029445766850246e-02 -1.722364393415456718e-01 1.352029445766850246e-02 -1.860153544888693278e-01 1.352029445766850246e-02 -1.997942696361929282e-01 1.352029445766850246e-02 -2.135731847835166397e-01 1.352029445766850246e-02 -2.273520999308402402e-01 1.352029445766850246e-02 -2.411310150781639516e-01 1.352029445766850246e-02 -2.549099302254874688e-01 1.352029445766847471e-02 -2.686888453728112358e-01 1.352029445766844695e-02 -2.824677605201348918e-01 1.352029445766844695e-02 -2.962466756674585477e-01 1.352029445766844695e-02 -3.100255908147822037e-01 1.352029445766844695e-02 -3.238045059621058597e-01 1.352029445766844695e-02 -3.375834211094295156e-01 1.352029445766844695e-02 -3.513623362567531716e-01 1.352029445766844695e-02 -3.651412514040768276e-01 1.352029445766844695e-02 -3.789201665514004835e-01 1.352029445766844695e-02 -3.926990816987241950e-01 1.352029445766844695e-02 -4.064779968460477955e-01 1.352029445766844695e-02 -4.202569119933714514e-01 1.352029445766844695e-02 -4.340358271406951074e-01 1.352029445766844695e-02 -4.478147422880187634e-01 1.352029445766844695e-02 -4.615936574353424193e-01 1.352029445766844695e-02 -4.753725725826660753e-01 1.352029445766844695e-02 -4.891514877299897313e-01 1.352029445766844695e-02 -5.029304028773133872e-01 1.352029445766844695e-02 -5.167093180246369322e-01 1.352029445766844695e-02 -5.304882331719606992e-01 1.352029445766844695e-02 -5.442671483192842441e-01 1.352029445766844695e-02 -5.580460634666080111e-01 1.352029445766844695e-02 -5.718249786139315560e-01 1.352029445766844695e-02 -5.856038937612553230e-01 1.352029445766844695e-02 -5.993828089085788680e-01 1.352029445766844695e-02 -6.131617240559026349e-01 1.352029445766844695e-02 -6.269406392032261799e-01 1.352029445766844695e-02 -6.407195543505499469e-01 1.352029445766844695e-02 -6.544984694978734918e-01 1.352029445766844695e-02 -6.682773846451973698e-01 1.352029445766844695e-02 -6.820562997925208037e-01 1.352029445766844695e-02 -6.958352149398445707e-01 1.352029445766844695e-02 -7.096141300871681157e-01 1.352029445766844695e-02 -7.233930452344918827e-01 1.352029445766844695e-02 -7.371719603818154276e-01 1.352029445766844695e-02 -7.509508755291391946e-01 1.352029445766844695e-02 -7.647297906764627395e-01 1.352029445766844695e-02 -7.785087058237865065e-01 1.352029445766844695e-02 -7.922876209711100515e-01 1.352029445766844695e-02 -8.060665361184338185e-01 1.352029445766844695e-02 -8.198454512657573634e-01 1.352029445766844695e-02 -8.336243664130811304e-01 1.352029445766844695e-02 -8.474032815604045643e-01 1.352029445766844695e-02 -8.611821967077283313e-01 1.352029445766844695e-02 -8.749611118550519873e-01 1.352029445766844695e-02 -8.887400270023757543e-01 1.352029445766844695e-02 -9.025189421496992992e-01 1.352029445766844695e-02 -9.162978572970230662e-01 1.352029445766844695e-02 -9.300767724443466111e-01 1.352029445766844695e-02 -9.438556875916703781e-01 1.352029445766844695e-02 -9.576346027389939231e-01 1.352029445766844695e-02 -9.714135178863175790e-01 1.352029445766844695e-02 -9.851924330336412350e-01 1.352029445766844695e-02 -9.989713481809651130e-01 1.352029445766833593e-02 -1.012750263328288547e+00 1.352029445766822491e-02 -1.026529178475612092e+00 1.352029445766822491e-02 -1.040308093622935859e+00 1.352029445766822491e-02 -1.054087008770259626e+00 1.352029445766822491e-02 -1.067865923917583171e+00 1.352029445766822491e-02 -1.081644839064906716e+00 1.352029445766822491e-02 -1.095423754212230483e+00 1.352029445766822491e-02 -1.109202669359554250e+00 1.352029445766822491e-02 -1.122981584506877795e+00 1.352029445766822491e-02 -1.136760499654201340e+00 1.352029445766822491e-02 -1.150539414801525107e+00 1.352029445766822491e-02 -1.164318329948848874e+00 1.352029445766822491e-02 -1.178097245096172418e+00 1.352029445766822491e-02 -1.191876160243495963e+00 1.352029445766822491e-02 -1.205655075390819730e+00 1.352029445766822491e-02 -1.219433990538143497e+00 1.352029445766822491e-02 -1.233212905685467042e+00 1.352029445766822491e-02 -1.246991820832790587e+00 1.352029445766822491e-02 -1.260770735980114354e+00 1.352029445766822491e-02 -1.274549651127438121e+00 1.352029445766822491e-02 -1.288328566274761666e+00 1.352029445766822491e-02 -1.302107481422085211e+00 1.352029445766822491e-02 -1.315886396569408978e+00 1.352029445766822491e-02 -1.329665311716732745e+00 1.352029445766822491e-02 -1.343444226864056290e+00 1.352029445766822491e-02 -1.357223142011379835e+00 1.352029445766822491e-02 -1.371002057158703602e+00 1.352029445766822491e-02 -1.384780972306027369e+00 1.352029445766822491e-02 -1.398559887453350914e+00 1.352029445766822491e-02 -1.412338802600674459e+00 1.352029445766822491e-02 -1.426117717747998226e+00 1.352029445766822491e-02 -1.439896632895321993e+00 1.352029445766822491e-02 -1.453675548042645538e+00 1.352029445766822491e-02 -1.467454463189969083e+00 1.352029445766822491e-02 -1.481233378337292850e+00 1.352029445766822491e-02 -1.495012293484616617e+00 1.352029445766822491e-02 -1.508791208631940162e+00 1.352029445766822491e-02 -1.522570123779263707e+00 1.352029445766822491e-02 -1.536349038926587474e+00 1.352029445766822491e-02 -1.550127954073911241e+00 1.352029445766822491e-02 -1.563906869221234786e+00 1.352029445766822491e-02 -1.577685784368558330e+00 1.352029445766822491e-02 -1.591464699515882097e+00 1.352029445766822491e-02 -1.605243614663205864e+00 1.352029445766822491e-02 -1.619022529810529409e+00 1.352029445766822491e-02 -1.632801444957852954e+00 1.352029445766822491e-02 -1.646580360105176721e+00 1.352029445766822491e-02 -1.660359275252500488e+00 1.352029445766822491e-02 -1.674138190399824033e+00 1.352029445766822491e-02 -1.687917105547147578e+00 1.352029445766822491e-02 -1.701696020694471345e+00 1.352029445766822491e-02 -1.715474935841795112e+00 1.352029445766822491e-02 -1.729253850989118657e+00 1.352029445766822491e-02 -1.743032766136442202e+00 1.352029445766822491e-02 -1.756811681283765969e+00 1.352029445766822491e-02 -1.770590596431089514e+00 1.352029445766822491e-02 -1.784369511578413281e+00 1.352029445766822491e-02 -1.798148426725736826e+00 1.352029445766822491e-02 -1.811927341873060371e+00 1.352029445766822491e-02 -1.825706257020384138e+00 1.352029445766822491e-02 -1.839485172167707905e+00 1.352029445766822491e-02 -1.853264087315031450e+00 1.352029445766822491e-02 -1.867043002462354995e+00 1.352029445766822491e-02 -1.880821917609678762e+00 1.352029445766822491e-02 -1.894600832757002529e+00 1.352029445766822491e-02 -1.908379747904326074e+00 1.352029445766822491e-02 -1.922158663051649619e+00 1.352029445766822491e-02 -1.935937578198973386e+00 1.352029445766822491e-02 -1.949716493346297153e+00 1.352029445766822491e-02 -1.963495408493620697e+00 1.352029445766822491e-02 -1.977274323640944242e+00 1.352029445766822491e-02 -1.991053238788268009e+00 1.352029445766822491e-02 -2.004832153935591776e+00 1.352029445766844695e-02 -2.018611069082915321e+00 1.352029445766866900e-02 -2.032389984230238866e+00 1.352029445766866900e-02 -2.046168899377562411e+00 1.352029445766866900e-02 -2.059947814524886400e+00 1.352029445766866900e-02 -2.073726729672209945e+00 1.352029445766866900e-02 -2.087505644819533490e+00 1.352029445766866900e-02 -2.101284559966857479e+00 1.352029445766866900e-02 -2.115063475114181024e+00 1.352029445766866900e-02 -2.128842390261504569e+00 1.352029445766866900e-02 -2.142621305408828114e+00 1.352029445766866900e-02 -2.156400220556151659e+00 1.352029445766866900e-02 -2.170179135703475648e+00 1.352029445766866900e-02 -2.183958050850799193e+00 1.352029445766866900e-02 -2.197736965998122738e+00 1.352029445766866900e-02 -2.211515881145446727e+00 1.352029445766866900e-02 -2.225294796292770272e+00 1.352029445766866900e-02 -2.239073711440093817e+00 1.352029445766866900e-02 -2.252852626587417362e+00 1.352029445766866900e-02 -2.266631541734740907e+00 1.352029445766866900e-02 -2.280410456882064896e+00 1.352029445766866900e-02 -2.294189372029388441e+00 1.352029445766866900e-02 -2.307968287176711986e+00 1.352029445766866900e-02 -2.321747202324035975e+00 1.352029445766866900e-02 -2.335526117471359520e+00 1.352029445766866900e-02 -2.349305032618683065e+00 1.352029445766866900e-02 -2.363083947766006609e+00 1.352029445766866900e-02 -2.376862862913330154e+00 1.352029445766866900e-02 -2.390641778060654143e+00 1.352029445766866900e-02 -2.404420693207977688e+00 1.352029445766866900e-02 -2.418199608355301233e+00 1.352029445766866900e-02 -2.431978523502625222e+00 1.352029445766866900e-02 -2.445757438649948767e+00 1.352029445766866900e-02 -2.459536353797272312e+00 1.352029445766866900e-02 -2.473315268944595857e+00 1.352029445766866900e-02 -2.487094184091919402e+00 1.352029445766866900e-02 -2.500873099239243391e+00 1.352029445766866900e-02 -2.514652014386566936e+00 1.352029445766866900e-02 -2.528430929533890481e+00 1.352029445766866900e-02 -2.542209844681214470e+00 1.352029445766866900e-02 -2.555988759828538015e+00 1.352029445766866900e-02 -2.569767674975861560e+00 1.352029445766866900e-02 -2.583546590123185105e+00 1.352029445766866900e-02 -2.597325505270508650e+00 1.352029445766866900e-02 -2.611104420417832639e+00 1.352029445766866900e-02 -2.624883335565156184e+00 1.352029445766866900e-02 -2.638662250712479729e+00 1.352029445766866900e-02 -2.652441165859803274e+00 1.352029445766866900e-02 -2.666220081007127263e+00 1.352029445766866900e-02 -2.679998996154450808e+00 1.352029445766866900e-02 -2.693777911301774353e+00 1.352029445766866900e-02 -2.707556826449097898e+00 1.352029445766866900e-02 -2.721335741596421443e+00 1.352029445766866900e-02 -2.735114656743745432e+00 1.352029445766866900e-02 -2.748893571891068976e+00 1.352029445766866900e-02 -2.762672487038392521e+00 1.352029445766866900e-02 -2.776451402185716510e+00 1.352029445766866900e-02 -2.790230317333040055e+00 1.352029445766866900e-02 -2.804009232480363600e+00 1.352029445766866900e-02 -2.817788147627687145e+00 1.352029445766866900e-02 -2.831567062775010690e+00 1.352029445766866900e-02 -2.845345977922334679e+00 1.352029445766866900e-02 -2.859124893069658224e+00 1.352029445766866900e-02 -2.872903808216981769e+00 1.352029445766866900e-02 -2.886682723364305758e+00 1.352029445766866900e-02 -2.900461638511629303e+00 1.352029445766866900e-02 -2.914240553658952848e+00 1.352029445766866900e-02 -2.928019468806276393e+00 1.352029445766866900e-02 -2.941798383953599938e+00 1.352029445766866900e-02 -2.955577299100923927e+00 1.352029445766866900e-02 -2.969356214248247472e+00 1.352029445766866900e-02 -2.983135129395571017e+00 1.352029445766866900e-02 -2.996914044542895006e+00 1.352029445766866900e-02 -3.010692959690218551e+00 1.352029445766866900e-02 -3.024471874837542096e+00 1.352029445766866900e-02 -3.038250789984865641e+00 1.352029445766866900e-02 -3.052029705132189186e+00 1.352029445766866900e-02 -3.065808620279513175e+00 1.352029445766866900e-02 -3.079587535426836720e+00 1.352029445766866900e-02 -3.093366450574160265e+00 1.352029445766866900e-02 -3.107145365721484254e+00 1.352029445766866900e-02 -3.120924280868807799e+00 1.352029445766866900e-02 -3.134703196016131344e+00 1.352029445766866900e-02 --3.134703196016131788e+00 1.352029445766866900e-02 --3.120924280868808243e+00 1.352029445766866900e-02 --3.107145365721484254e+00 1.352029445766866900e-02 --3.093366450574160709e+00 1.352029445766866900e-02 --3.079587535426837164e+00 1.352029445766866900e-02 --3.065808620279513175e+00 1.352029445766866900e-02 --3.052029705132189630e+00 1.352029445766866900e-02 --3.038250789984866085e+00 1.352029445766866900e-02 --3.024471874837542540e+00 1.352029445766866900e-02 --3.010692959690218995e+00 1.352029445766866900e-02 --2.996914044542895006e+00 1.352029445766866900e-02 --2.983135129395571461e+00 1.352029445766866900e-02 --2.969356214248247916e+00 1.352029445766866900e-02 --2.955577299100923927e+00 1.352029445766866900e-02 --2.941798383953600382e+00 1.352029445766866900e-02 --2.928019468806276837e+00 1.352029445766866900e-02 --2.914240553658953292e+00 1.352029445766866900e-02 --2.900461638511629747e+00 1.352029445766866900e-02 --2.886682723364305758e+00 1.352029445766866900e-02 --2.872903808216981769e+00 1.352029445766866900e-02 --2.859124893069658668e+00 1.352029445766866900e-02 --2.845345977922334679e+00 1.352029445766866900e-02 --2.831567062775011134e+00 1.352029445766866900e-02 --2.817788147627687145e+00 1.352029445766866900e-02 --2.804009232480364044e+00 1.352029445766866900e-02 --2.790230317333040055e+00 1.352029445766866900e-02 --2.776451402185716510e+00 1.352029445766866900e-02 --2.762672487038392966e+00 1.352029445766866900e-02 --2.748893571891069421e+00 1.352029445766866900e-02 --2.735114656743745876e+00 1.352029445766866900e-02 --2.721335741596421443e+00 1.352029445766866900e-02 --2.707556826449098342e+00 1.352029445766866900e-02 --2.693777911301774797e+00 1.352029445766866900e-02 --2.679998996154451252e+00 1.352029445766866900e-02 --2.666220081007127707e+00 1.352029445766866900e-02 --2.652441165859803274e+00 1.352029445766866900e-02 --2.638662250712480173e+00 1.352029445766866900e-02 --2.624883335565156628e+00 1.352029445766866900e-02 --2.611104420417832195e+00 1.352029445766866900e-02 --2.597325505270509094e+00 1.352029445766866900e-02 --2.583546590123185549e+00 1.352029445766866900e-02 --2.569767674975861560e+00 1.352029445766866900e-02 --2.555988759828538459e+00 1.352029445766866900e-02 --2.542209844681214026e+00 1.352029445766866900e-02 --2.528430929533890925e+00 1.352029445766866900e-02 --2.514652014386567380e+00 1.352029445766866900e-02 --2.500873099239243391e+00 1.352029445766866900e-02 --2.487094184091919846e+00 1.352029445766866900e-02 --2.473315268944595857e+00 1.352029445766866900e-02 --2.459536353797272756e+00 1.352029445766866900e-02 --2.445757438649949211e+00 1.352029445766866900e-02 --2.431978523502625222e+00 1.352029445766866900e-02 --2.418199608355301677e+00 1.352029445766866900e-02 --2.404420693207978132e+00 1.352029445766866900e-02 --2.390641778060654143e+00 1.352029445766866900e-02 --2.376862862913330599e+00 1.352029445766866900e-02 --2.363083947766007054e+00 1.352029445766866900e-02 --2.349305032618683509e+00 1.352029445766866900e-02 --2.335526117471359964e+00 1.352029445766866900e-02 --2.321747202324035975e+00 1.352029445766866900e-02 --2.307968287176712430e+00 1.352029445766866900e-02 --2.294189372029388885e+00 1.352029445766866900e-02 --2.280410456882064896e+00 1.352029445766866900e-02 --2.266631541734740907e+00 1.352029445766866900e-02 --2.252852626587417806e+00 1.352029445766866900e-02 --2.239073711440094261e+00 1.352029445766866900e-02 --2.225294796292770716e+00 1.352029445766866900e-02 --2.211515881145446727e+00 1.352029445766866900e-02 --2.197736965998123182e+00 1.352029445766866900e-02 --2.183958050850799193e+00 1.352029445766866900e-02 --2.170179135703475648e+00 1.352029445766866900e-02 --2.156400220556151659e+00 1.352029445766866900e-02 --2.142621305408828114e+00 1.352029445766866900e-02 --2.128842390261505013e+00 1.352029445766866900e-02 --2.115063475114181468e+00 1.352029445766866900e-02 --2.101284559966857923e+00 1.352029445766866900e-02 --2.087505644819533490e+00 1.352029445766866900e-02 --2.073726729672209945e+00 1.352029445766866900e-02 --2.059947814524886400e+00 1.352029445766866900e-02 --2.046168899377562855e+00 1.352029445766866900e-02 --2.032389984230239310e+00 1.352029445766866900e-02 --2.018611069082915765e+00 1.352029445766866900e-02 --2.004832153935591776e+00 1.352029445766866900e-02 --1.991053238788268454e+00 1.352029445766866900e-02 --1.977274323640944909e+00 1.352029445766866900e-02 --1.963495408493620475e+00 1.352029445766866900e-02 --1.949716493346296931e+00 1.352029445766866900e-02 --1.935937578198973386e+00 1.352029445766866900e-02 --1.922158663051649841e+00 1.352029445766866900e-02 --1.908379747904326296e+00 1.352029445766866900e-02 --1.894600832757002751e+00 1.352029445766866900e-02 --1.880821917609679206e+00 1.352029445766866900e-02 --1.867043002462355661e+00 1.352029445766866900e-02 --1.853264087315031228e+00 1.352029445766866900e-02 --1.839485172167707683e+00 1.352029445766866900e-02 --1.825706257020384138e+00 1.352029445766866900e-02 --1.811927341873060593e+00 1.352029445766866900e-02 --1.798148426725737048e+00 1.352029445766866900e-02 --1.784369511578413503e+00 1.352029445766866900e-02 --1.770590596431089958e+00 1.352029445766866900e-02 --1.756811681283766413e+00 1.352029445766866900e-02 --1.743032766136442868e+00 1.352029445766866900e-02 --1.729253850989118435e+00 1.352029445766866900e-02 --1.715474935841794890e+00 1.352029445766866900e-02 --1.701696020694471345e+00 1.352029445766866900e-02 --1.687917105547147800e+00 1.352029445766866900e-02 --1.674138190399824255e+00 1.352029445766866900e-02 --1.660359275252500710e+00 1.352029445766866900e-02 --1.646580360105177165e+00 1.352029445766866900e-02 --1.632801444957852732e+00 1.352029445766866900e-02 --1.619022529810529187e+00 1.352029445766866900e-02 --1.605243614663205642e+00 1.352029445766866900e-02 --1.591464699515882097e+00 1.352029445766866900e-02 --1.577685784368558553e+00 1.352029445766866900e-02 --1.563906869221235008e+00 1.352029445766866900e-02 --1.550127954073911463e+00 1.352029445766866900e-02 --1.536349038926587918e+00 1.352029445766866900e-02 --1.522570123779264373e+00 1.352029445766866900e-02 --1.508791208631939940e+00 1.352029445766866900e-02 --1.495012293484616395e+00 1.352029445766866900e-02 --1.481233378337292850e+00 1.352029445766866900e-02 --1.467454463189969305e+00 1.352029445766866900e-02 --1.453675548042645760e+00 1.352029445766866900e-02 --1.439896632895322215e+00 1.352029445766866900e-02 --1.426117717747998670e+00 1.352029445766866900e-02 --1.412338802600674237e+00 1.352029445766866900e-02 --1.398559887453350692e+00 1.352029445766866900e-02 --1.384780972306027147e+00 1.352029445766866900e-02 --1.371002057158703602e+00 1.352029445766866900e-02 --1.357223142011380057e+00 1.352029445766866900e-02 --1.343444226864056512e+00 1.352029445766866900e-02 --1.329665311716732967e+00 1.352029445766866900e-02 --1.315886396569409422e+00 1.352029445766866900e-02 --1.302107481422085877e+00 1.352029445766866900e-02 --1.288328566274761444e+00 1.352029445766866900e-02 --1.274549651127437899e+00 1.352029445766866900e-02 --1.260770735980114354e+00 1.352029445766866900e-02 --1.246991820832790809e+00 1.352029445766866900e-02 --1.233212905685467264e+00 1.352029445766866900e-02 --1.219433990538143719e+00 1.352029445766866900e-02 --1.205655075390820175e+00 1.352029445766866900e-02 --1.191876160243495741e+00 1.352029445766866900e-02 --1.178097245096172196e+00 1.352029445766866900e-02 --1.164318329948848652e+00 1.352029445766866900e-02 --1.150539414801525107e+00 1.352029445766866900e-02 --1.136760499654201562e+00 1.352029445766866900e-02 --1.122981584506878017e+00 1.352029445766866900e-02 --1.109202669359554472e+00 1.352029445766866900e-02 --1.095423754212230927e+00 1.352029445766866900e-02 --1.081644839064907382e+00 1.352029445766866900e-02 --1.067865923917582949e+00 1.352029445766866900e-02 --1.054087008770259404e+00 1.352029445766866900e-02 --1.040308093622935859e+00 1.352029445766866900e-02 --1.026529178475612314e+00 1.352029445766866900e-02 --1.012750263328288769e+00 1.352029445766866900e-02 --9.989713481809653350e-01 1.352029445766866900e-02 --9.851924330336416791e-01 1.352029445766866900e-02 --9.714135178863181341e-01 1.352029445766866900e-02 --9.576346027389938120e-01 1.352029445766866900e-02 --9.438556875916701561e-01 1.352029445766866900e-02 --9.300767724443466111e-01 1.352029445766866900e-02 --9.162978572970230662e-01 1.352029445766866900e-02 --9.025189421496995212e-01 1.352029445766866900e-02 --8.887400270023759763e-01 1.352029445766866900e-02 --8.749611118550524314e-01 1.352029445766866900e-02 --8.611821967077288864e-01 1.352029445766866900e-02 --8.474032815604054525e-01 1.352029445766866900e-02 --8.336243664130809083e-01 1.352029445766866900e-02 --8.198454512657573634e-01 1.352029445766866900e-02 --8.060665361184338185e-01 1.352029445766866900e-02 --7.922876209711102735e-01 1.352029445766866900e-02 --7.785087058237867286e-01 1.352029445766866900e-02 --7.647297906764632947e-01 1.352029445766866900e-02 --7.509508755291396387e-01 1.352029445766866900e-02 --7.371719603818152056e-01 1.352029445766866900e-02 --7.233930452344916606e-01 1.352029445766866900e-02 --7.096141300871681157e-01 1.352029445766866900e-02 --6.958352149398446818e-01 1.352029445766866900e-02 --6.820562997925210258e-01 1.352029445766866900e-02 --6.682773846451974809e-01 1.352029445766866900e-02 --6.544984694978739359e-01 1.352029445766866900e-02 --6.407195543505503910e-01 1.352029445766866900e-02 --6.269406392032268460e-01 1.352029445766866900e-02 --6.131617240559024129e-01 1.352029445766866900e-02 --5.993828089085788680e-01 1.352029445766866900e-02 --5.856038937612553230e-01 1.352029445766866900e-02 --5.718249786139317781e-01 1.352029445766866900e-02 --5.580460634666082331e-01 1.352029445766866900e-02 --5.442671483192846882e-01 1.352029445766866900e-02 --5.304882331719611432e-01 1.352029445766866900e-02 --5.167093180246367101e-01 1.352029445766866900e-02 --5.029304028773131652e-01 1.352029445766866900e-02 --4.891514877299896757e-01 1.352029445766866900e-02 --4.753725725826661308e-01 1.352029445766866900e-02 --4.615936574353425303e-01 1.352029445766866900e-02 --4.478147422880189854e-01 1.352029445766866900e-02 --4.340358271406954405e-01 1.352029445766866900e-02 --4.202569119933719510e-01 1.352029445766866900e-02 --4.064779968460483506e-01 1.352029445766866900e-02 --3.926990816987239175e-01 1.352029445766866900e-02 --3.789201665514004280e-01 1.352029445766866900e-02 --3.651412514040768276e-01 1.352029445766866900e-02 --3.513623362567533381e-01 1.352029445766866900e-02 --3.375834211094297932e-01 1.352029445766866900e-02 --3.238045059621062483e-01 1.352029445766866900e-02 --3.100255908147826478e-01 1.352029445766866900e-02 --2.962466756674582702e-01 1.352029445766866900e-02 --2.824677605201346697e-01 1.352029445766866900e-02 --2.686888453728111248e-01 1.352029445766866900e-02 --2.549099302254875243e-01 1.352029445766866900e-02 --2.411310150781640627e-01 1.352029445766866900e-02 --2.273520999308405177e-01 1.352029445766866900e-02 --2.135731847835169728e-01 1.352029445766866900e-02 --1.997942696361934278e-01 1.352029445766866900e-02 --1.860153544888698551e-01 1.352029445766866900e-02 --1.722364393415454498e-01 1.352029445766866900e-02 --1.584575241942219326e-01 1.352029445766866900e-02 --1.446786090468983599e-01 1.352029445766866900e-02 --1.308996938995748149e-01 1.352029445766866900e-02 --1.171207787522512561e-01 1.352029445766866900e-02 --1.033418636049277251e-01 1.352029445766866900e-02 --8.956294845760416623e-02 1.352029445766866900e-02 --7.578403331028064904e-02 1.352029445766866900e-02 --6.200511816295618817e-02 1.352029445766866900e-02 --4.822620301563265016e-02 1.352029445766866900e-02 --3.444728786830910522e-02 1.352029445766866900e-02 --2.066837272098556721e-02 1.352029445766866900e-02 --6.889457573662017068e-03 1.352029445766866900e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV0.txt deleted file mode 100644 index ad4d6252a..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV0.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivUpV0 -4.000000000000000000e+00 0.000000000000000000e+00 -1.940255148972423349e+00 6.400599999999999623e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -2.356570853318228131e+00 8.082580000000000320e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV1.txt deleted file mode 100644 index 2eb5b7518..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV1.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivUpV1 -5.000000000000000000e+00 0.000000000000000000e+00 -1.940255148972423349e+00 6.400599999999999623e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -2.210377932124336198e+00 7.042090000000000849e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -2.356570853318228131e+00 8.082580000000000320e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV2.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV2.txt deleted file mode 100644 index 7f085df48..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV2.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivUpV2 -8.000000000000000000e+00 0.000000000000000000e+00 -1.940255148972423349e+00 6.400599999999999623e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -2.193063686624034503e+00 6.970100000000000184e-01 -2.194472200950834839e+00 6.974790000000000711e-01 -2.224787647063197760e+00 7.097269999999999968e-01 -2.227692177624637448e+00 7.114080000000000403e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -2.356570853318228131e+00 8.082580000000000320e-01 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV3.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV3.txt deleted file mode 100644 index 6c6eb8bc3..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_DivUpV3.txt +++ /dev/null @@ -1,468 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = DivUpV3 -8.000000000000000000e+00 4.560000000000000000e+02 -1.940255148972423349e+00 6.400599999999999623e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -2.193063686624034503e+00 6.970100000000000184e-01 -2.194472200950834839e+00 6.974790000000000711e-01 -2.224787647063197760e+00 7.097269999999999968e-01 -2.227692177624637448e+00 7.114080000000000403e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -2.356570853318228131e+00 8.082580000000000320e-01 -6.889457573661827115e-03 1.346468224529038214e-02 -2.066837272098548742e-02 1.346468224529038388e-02 -3.444728786830913297e-02 1.346468224529038735e-02 -4.822620301563278894e-02 1.346468224529039082e-02 -6.200511816295642409e-02 1.346468224529038388e-02 -7.578403331028009393e-02 1.346468224529037694e-02 -8.956294845760374990e-02 1.346468224529037694e-02 -1.033418636049274059e-01 1.346468224529037694e-02 -1.171207787522510618e-01 1.346468224529037694e-02 -1.308996938995747039e-01 1.346468224529039082e-02 -1.446786090468983599e-01 1.346468224529040469e-02 -1.584575241942220714e-01 1.346468224529040469e-02 -1.722364393415456718e-01 1.346468224529040469e-02 -1.860153544888693278e-01 1.346468224529040469e-02 -1.997942696361929282e-01 1.346468224529040469e-02 -2.135731847835166397e-01 1.346468224529040469e-02 -2.273520999308402402e-01 1.346468224529040469e-02 -2.411310150781639516e-01 1.346468224529040469e-02 -2.549099302254874688e-01 1.346468224529040469e-02 -2.686888453728112358e-01 1.346468224529040469e-02 -2.824677605201348918e-01 1.346468224529040469e-02 -2.962466756674585477e-01 1.346468224529040469e-02 -3.100255908147822037e-01 1.346468224529040469e-02 -3.238045059621058597e-01 1.346468224529040469e-02 -3.375834211094295156e-01 1.346468224529040469e-02 -3.513623362567531716e-01 1.346468224529040469e-02 -3.651412514040768276e-01 1.346468224529040469e-02 -3.789201665514004835e-01 1.346468224529040469e-02 -3.926990816987241950e-01 1.346468224529040469e-02 -4.064779968460477955e-01 1.346468224529040469e-02 -4.202569119933714514e-01 1.346468224529040469e-02 -4.340358271406951074e-01 1.346468224529040469e-02 -4.478147422880187634e-01 1.346468224529040469e-02 -4.615936574353424193e-01 1.346468224529040469e-02 -4.753725725826660753e-01 1.346468224529040469e-02 -4.891514877299897313e-01 1.346468224529040469e-02 -5.029304028773133872e-01 1.346468224529029367e-02 -5.167093180246369322e-01 1.346468224529018265e-02 -5.304882331719606992e-01 1.346468224529018265e-02 -5.442671483192842441e-01 1.346468224529018265e-02 -5.580460634666080111e-01 1.346468224529018265e-02 -5.718249786139315560e-01 1.346468224529018265e-02 -5.856038937612553230e-01 1.346468224529018265e-02 -5.993828089085788680e-01 1.346468224529018265e-02 -6.131617240559026349e-01 1.346468224529018265e-02 -6.269406392032261799e-01 1.346468224529018265e-02 -6.407195543505499469e-01 1.346468224529018265e-02 -6.544984694978734918e-01 1.346468224529018265e-02 -6.682773846451973698e-01 1.346468224529018265e-02 -6.820562997925208037e-01 1.346468224529018265e-02 -6.958352149398445707e-01 1.346468224529018265e-02 -7.096141300871681157e-01 1.346468224529018265e-02 -7.233930452344918827e-01 1.346468224529018265e-02 -7.371719603818154276e-01 1.346468224529018265e-02 -7.509508755291391946e-01 1.346468224529018265e-02 -7.647297906764627395e-01 1.346468224529018265e-02 -7.785087058237865065e-01 1.346468224529018265e-02 -7.922876209711100515e-01 1.346468224529018265e-02 -8.060665361184338185e-01 1.346468224529018265e-02 -8.198454512657573634e-01 1.346468224529018265e-02 -8.336243664130811304e-01 1.346468224529018265e-02 -8.474032815604045643e-01 1.346468224529018265e-02 -8.611821967077283313e-01 1.346468224529018265e-02 -8.749611118550519873e-01 1.346468224529018265e-02 -8.887400270023757543e-01 1.346468224529018265e-02 -9.025189421496992992e-01 1.346468224529018265e-02 -9.162978572970230662e-01 1.346468224529018265e-02 -9.300767724443466111e-01 1.346468224529018265e-02 -9.438556875916703781e-01 1.346468224529018265e-02 -9.576346027389939231e-01 1.346468224529018265e-02 -9.714135178863175790e-01 1.346468224529018265e-02 -9.851924330336412350e-01 1.346468224529018265e-02 -9.989713481809651130e-01 1.346468224529029367e-02 -1.012750263328288547e+00 1.346468224529040469e-02 -1.026529178475612092e+00 1.346468224529040469e-02 -1.040308093622935859e+00 1.346468224529040469e-02 -1.054087008770259626e+00 1.346468224529040469e-02 -1.067865923917583171e+00 1.346468224529040469e-02 -1.081644839064906716e+00 1.346468224529040469e-02 -1.095423754212230483e+00 1.346468224529040469e-02 -1.109202669359554250e+00 1.346468224529040469e-02 -1.122981584506877795e+00 1.346468224529040469e-02 -1.136760499654201340e+00 1.346468224529040469e-02 -1.150539414801525107e+00 1.346468224529040469e-02 -1.164318329948848874e+00 1.346468224529040469e-02 -1.178097245096172418e+00 1.346468224529040469e-02 -1.191876160243495963e+00 1.346468224529040469e-02 -1.205655075390819730e+00 1.346468224529040469e-02 -1.219433990538143497e+00 1.346468224529040469e-02 -1.233212905685467042e+00 1.346468224529040469e-02 -1.246991820832790587e+00 1.346468224529040469e-02 -1.260770735980114354e+00 1.346468224529040469e-02 -1.274549651127438121e+00 1.346468224529040469e-02 -1.288328566274761666e+00 1.346468224529040469e-02 -1.302107481422085211e+00 1.346468224529040469e-02 -1.315886396569408978e+00 1.346468224529040469e-02 -1.329665311716732745e+00 1.346468224529040469e-02 -1.343444226864056290e+00 1.346468224529040469e-02 -1.357223142011379835e+00 1.346468224529040469e-02 -1.371002057158703602e+00 1.346468224529040469e-02 -1.384780972306027369e+00 1.346468224529040469e-02 -1.398559887453350914e+00 1.346468224529040469e-02 -1.412338802600674459e+00 1.346468224529040469e-02 -1.426117717747998226e+00 1.346468224529040469e-02 -1.439896632895321993e+00 1.346468224529040469e-02 -1.453675548042645538e+00 1.346468224529040469e-02 -1.467454463189969083e+00 1.346468224529040469e-02 -1.481233378337292850e+00 1.346468224529040469e-02 -1.495012293484616617e+00 1.346468224529040469e-02 -1.508791208631940162e+00 1.346468224529040469e-02 -1.522570123779263707e+00 1.346468224529040469e-02 -1.536349038926587474e+00 1.346468224529040469e-02 -1.550127954073911241e+00 1.346468224529040469e-02 -1.563906869221234786e+00 1.346468224529040469e-02 -1.577685784368558330e+00 1.346468224529040469e-02 -1.591464699515882097e+00 1.346468224529040469e-02 -1.605243614663205864e+00 1.346468224529040469e-02 -1.619022529810529409e+00 1.346468224529040469e-02 -1.632801444957852954e+00 1.346468224529040469e-02 -1.646580360105176721e+00 1.346468224529040469e-02 -1.660359275252500488e+00 1.346468224529040469e-02 -1.674138190399824033e+00 1.346468224529040469e-02 -1.687917105547147578e+00 1.346468224529040469e-02 -1.701696020694471345e+00 1.346468224529040469e-02 -1.715474935841795112e+00 1.346468224529040469e-02 -1.729253850989118657e+00 1.346468224529040469e-02 -1.743032766136442202e+00 1.346468224529040469e-02 -1.756811681283765969e+00 1.346468224529040469e-02 -1.770590596431089514e+00 1.346468224529040469e-02 -1.784369511578413281e+00 1.346468224529040469e-02 -1.798148426725736826e+00 1.346468224529040469e-02 -1.811927341873060371e+00 1.346468224529040469e-02 -1.825706257020384138e+00 1.346468224529040469e-02 -1.839485172167707905e+00 1.346468224529040469e-02 -1.853264087315031450e+00 1.346468224529040469e-02 -1.867043002462354995e+00 1.346468224529040469e-02 -1.880821917609678762e+00 1.346468224529040469e-02 -1.894600832757002529e+00 1.346468224529040469e-02 -1.908379747904326074e+00 1.346468224529040469e-02 -1.922158663051649619e+00 1.346468224529040469e-02 -1.935937578198973386e+00 1.346468224529040469e-02 -1.949716493346297153e+00 1.346468224529040469e-02 -1.963495408493620697e+00 1.346468224529040469e-02 -1.977274323640944242e+00 1.346468224529040469e-02 -1.991053238788268009e+00 1.346468224529040469e-02 -2.004832153935591776e+00 1.346468224529040469e-02 -2.018611069082915321e+00 1.346468224529040469e-02 -2.032389984230238866e+00 1.346468224529040469e-02 -2.046168899377562411e+00 1.346468224529040469e-02 -2.059947814524886400e+00 1.346468224529040469e-02 -2.073726729672209945e+00 1.346468224529040469e-02 -2.087505644819533490e+00 1.346468224529040469e-02 -2.101284559966857479e+00 1.346468224529040469e-02 -2.115063475114181024e+00 1.346468224529040469e-02 -2.128842390261504569e+00 1.346468224529040469e-02 -2.142621305408828114e+00 1.346468224529040469e-02 -2.156400220556151659e+00 1.346468224529040469e-02 -2.170179135703475648e+00 1.346468224529040469e-02 -2.183958050850799193e+00 1.346468224529040469e-02 -2.197736965998122738e+00 1.346468224529040469e-02 -2.211515881145446727e+00 1.346468224529040469e-02 -2.225294796292770272e+00 1.346468224529040469e-02 -2.239073711440093817e+00 1.346468224529040469e-02 -2.252852626587417362e+00 1.346468224529040469e-02 -2.266631541734740907e+00 1.346468224529040469e-02 -2.280410456882064896e+00 1.346468224529040469e-02 -2.294189372029388441e+00 1.346468224529040469e-02 -2.307968287176711986e+00 1.346468224529040469e-02 -2.321747202324035975e+00 1.346468224529040469e-02 -2.335526117471359520e+00 1.346468224529040469e-02 -2.349305032618683065e+00 1.346468224529040469e-02 -2.363083947766006609e+00 1.346468224529040469e-02 -2.376862862913330154e+00 1.346468224529040469e-02 -2.390641778060654143e+00 1.346468224529040469e-02 -2.404420693207977688e+00 1.346468224529040469e-02 -2.418199608355301233e+00 1.346468224529040469e-02 -2.431978523502625222e+00 1.346468224529040469e-02 -2.445757438649948767e+00 1.346468224529040469e-02 -2.459536353797272312e+00 1.346468224529040469e-02 -2.473315268944595857e+00 1.346468224529040469e-02 -2.487094184091919402e+00 1.346468224529040469e-02 -2.500873099239243391e+00 1.346468224529040469e-02 -2.514652014386566936e+00 1.346468224529040469e-02 -2.528430929533890481e+00 1.346468224529040469e-02 -2.542209844681214470e+00 1.346468224529040469e-02 -2.555988759828538015e+00 1.346468224529040469e-02 -2.569767674975861560e+00 1.346468224529040469e-02 -2.583546590123185105e+00 1.346468224529040469e-02 -2.597325505270508650e+00 1.346468224529040469e-02 -2.611104420417832639e+00 1.346468224529040469e-02 -2.624883335565156184e+00 1.346468224529040469e-02 -2.638662250712479729e+00 1.346468224529040469e-02 -2.652441165859803274e+00 1.346468224529040469e-02 -2.666220081007127263e+00 1.346468224529040469e-02 -2.679998996154450808e+00 1.346468224529040469e-02 -2.693777911301774353e+00 1.346468224529040469e-02 -2.707556826449097898e+00 1.346468224529040469e-02 -2.721335741596421443e+00 1.346468224529040469e-02 -2.735114656743745432e+00 1.346468224529040469e-02 -2.748893571891068976e+00 1.346468224529040469e-02 -2.762672487038392521e+00 1.346468224529040469e-02 -2.776451402185716510e+00 1.346468224529040469e-02 -2.790230317333040055e+00 1.346468224529040469e-02 -2.804009232480363600e+00 1.346468224529040469e-02 -2.817788147627687145e+00 1.346468224529040469e-02 -2.831567062775010690e+00 1.346468224529040469e-02 -2.845345977922334679e+00 1.346468224529040469e-02 -2.859124893069658224e+00 1.346468224529040469e-02 -2.872903808216981769e+00 1.346468224529040469e-02 -2.886682723364305758e+00 1.346468224529040469e-02 -2.900461638511629303e+00 1.346468224529040469e-02 -2.914240553658952848e+00 1.346468224529040469e-02 -2.928019468806276393e+00 1.346468224529040469e-02 -2.941798383953599938e+00 1.346468224529040469e-02 -2.955577299100923927e+00 1.346468224529040469e-02 -2.969356214248247472e+00 1.346468224529040469e-02 -2.983135129395571017e+00 1.346468224529040469e-02 -2.996914044542895006e+00 1.346468224529040469e-02 -3.010692959690218551e+00 1.346468224529040469e-02 -3.024471874837542096e+00 1.346468224529040469e-02 -3.038250789984865641e+00 1.346468224529040469e-02 -3.052029705132189186e+00 1.346468224529040469e-02 -3.065808620279513175e+00 1.346468224529040469e-02 -3.079587535426836720e+00 1.346468224529040469e-02 -3.093366450574160265e+00 1.346468224529040469e-02 -3.107145365721484254e+00 1.346468224529040469e-02 -3.120924280868807799e+00 1.346468224529040469e-02 -3.134703196016131344e+00 1.346468224529040469e-02 --3.134703196016131788e+00 1.346468224529040469e-02 --3.120924280868808243e+00 1.346468224529040469e-02 --3.107145365721484254e+00 1.346468224529040469e-02 --3.093366450574160709e+00 1.346468224529040469e-02 --3.079587535426837164e+00 1.346468224529040469e-02 --3.065808620279513175e+00 1.346468224529040469e-02 --3.052029705132189630e+00 1.346468224529040469e-02 --3.038250789984866085e+00 1.346468224529040469e-02 --3.024471874837542540e+00 1.346468224529040469e-02 --3.010692959690218995e+00 1.346468224529040469e-02 --2.996914044542895006e+00 1.346468224529040469e-02 --2.983135129395571461e+00 1.346468224529040469e-02 --2.969356214248247916e+00 1.346468224529040469e-02 --2.955577299100923927e+00 1.346468224529040469e-02 --2.941798383953600382e+00 1.346468224529040469e-02 --2.928019468806276837e+00 1.346468224529040469e-02 --2.914240553658953292e+00 1.346468224529040469e-02 --2.900461638511629747e+00 1.346468224529040469e-02 --2.886682723364305758e+00 1.346468224529040469e-02 --2.872903808216981769e+00 1.346468224529040469e-02 --2.859124893069658668e+00 1.346468224529040469e-02 --2.845345977922334679e+00 1.346468224529040469e-02 --2.831567062775011134e+00 1.346468224529040469e-02 --2.817788147627687145e+00 1.346468224529040469e-02 --2.804009232480364044e+00 1.346468224529040469e-02 --2.790230317333040055e+00 1.346468224529040469e-02 --2.776451402185716510e+00 1.346468224529040469e-02 --2.762672487038392966e+00 1.346468224529040469e-02 --2.748893571891069421e+00 1.346468224529040469e-02 --2.735114656743745876e+00 1.346468224529040469e-02 --2.721335741596421443e+00 1.346468224529040469e-02 --2.707556826449098342e+00 1.346468224529040469e-02 --2.693777911301774797e+00 1.346468224529040469e-02 --2.679998996154451252e+00 1.346468224529040469e-02 --2.666220081007127707e+00 1.346468224529040469e-02 --2.652441165859803274e+00 1.346468224529040469e-02 --2.638662250712480173e+00 1.346468224529040469e-02 --2.624883335565156628e+00 1.346468224529040469e-02 --2.611104420417832195e+00 1.346468224529040469e-02 --2.597325505270509094e+00 1.346468224529040469e-02 --2.583546590123185549e+00 1.346468224529040469e-02 --2.569767674975861560e+00 1.346468224529040469e-02 --2.555988759828538459e+00 1.346468224529040469e-02 --2.542209844681214026e+00 1.346468224529040469e-02 --2.528430929533890925e+00 1.346468224529040469e-02 --2.514652014386567380e+00 1.346468224529040469e-02 --2.500873099239243391e+00 1.346468224529040469e-02 --2.487094184091919846e+00 1.346468224529040469e-02 --2.473315268944595857e+00 1.346468224529040469e-02 --2.459536353797272756e+00 1.346468224529040469e-02 --2.445757438649949211e+00 1.346468224529040469e-02 --2.431978523502625222e+00 1.346468224529040469e-02 --2.418199608355301677e+00 1.346468224529040469e-02 --2.404420693207978132e+00 1.346468224529040469e-02 --2.390641778060654143e+00 1.346468224529040469e-02 --2.376862862913330599e+00 1.346468224529040469e-02 --2.363083947766007054e+00 1.346468224529040469e-02 --2.349305032618683509e+00 1.346468224529040469e-02 --2.335526117471359964e+00 1.346468224529040469e-02 --2.321747202324035975e+00 1.346468224529040469e-02 --2.307968287176712430e+00 1.346468224529040469e-02 --2.294189372029388885e+00 1.346468224529040469e-02 --2.280410456882064896e+00 1.346468224529040469e-02 --2.266631541734740907e+00 1.346468224529040469e-02 --2.252852626587417806e+00 1.346468224529040469e-02 --2.239073711440094261e+00 1.346468224529040469e-02 --2.225294796292770716e+00 1.346468224529040469e-02 --2.211515881145446727e+00 1.346468224529040469e-02 --2.197736965998123182e+00 1.346468224529040469e-02 --2.183958050850799193e+00 1.346468224529040469e-02 --2.170179135703475648e+00 1.346468224529040469e-02 --2.156400220556151659e+00 1.346468224529040469e-02 --2.142621305408828114e+00 1.346468224529040469e-02 --2.128842390261505013e+00 1.346468224529040469e-02 --2.115063475114181468e+00 1.346468224529040469e-02 --2.101284559966857923e+00 1.346468224529040469e-02 --2.087505644819533490e+00 1.346468224529040469e-02 --2.073726729672209945e+00 1.346468224529040469e-02 --2.059947814524886400e+00 1.346468224529040469e-02 --2.046168899377562855e+00 1.346468224529040469e-02 --2.032389984230239310e+00 1.346468224529040469e-02 --2.018611069082915765e+00 1.346468224529040469e-02 --2.004832153935591776e+00 1.346468224529040469e-02 --1.991053238788268454e+00 1.346468224529040469e-02 --1.977274323640944909e+00 1.346468224529040469e-02 --1.963495408493620475e+00 1.346468224529040469e-02 --1.949716493346296931e+00 1.346468224529040469e-02 --1.935937578198973386e+00 1.346468224529040469e-02 --1.922158663051649841e+00 1.346468224529040469e-02 --1.908379747904326296e+00 1.346468224529040469e-02 --1.894600832757002751e+00 1.346468224529040469e-02 --1.880821917609679206e+00 1.346468224529040469e-02 --1.867043002462355661e+00 1.346468224529040469e-02 --1.853264087315031228e+00 1.346468224529040469e-02 --1.839485172167707683e+00 1.346468224529040469e-02 --1.825706257020384138e+00 1.346468224529040469e-02 --1.811927341873060593e+00 1.346468224529040469e-02 --1.798148426725737048e+00 1.346468224529040469e-02 --1.784369511578413503e+00 1.346468224529040469e-02 --1.770590596431089958e+00 1.346468224529040469e-02 --1.756811681283766413e+00 1.346468224529040469e-02 --1.743032766136442868e+00 1.346468224529040469e-02 --1.729253850989118435e+00 1.346468224529040469e-02 --1.715474935841794890e+00 1.346468224529040469e-02 --1.701696020694471345e+00 1.346468224529040469e-02 --1.687917105547147800e+00 1.346468224529040469e-02 --1.674138190399824255e+00 1.346468224529040469e-02 --1.660359275252500710e+00 1.346468224529040469e-02 --1.646580360105177165e+00 1.346468224529040469e-02 --1.632801444957852732e+00 1.346468224529040469e-02 --1.619022529810529187e+00 1.346468224529040469e-02 --1.605243614663205642e+00 1.346468224529040469e-02 --1.591464699515882097e+00 1.346468224529040469e-02 --1.577685784368558553e+00 1.346468224529040469e-02 --1.563906869221235008e+00 1.346468224529040469e-02 --1.550127954073911463e+00 1.346468224529040469e-02 --1.536349038926587918e+00 1.346468224529040469e-02 --1.522570123779264373e+00 1.346468224529040469e-02 --1.508791208631939940e+00 1.346468224529040469e-02 --1.495012293484616395e+00 1.346468224529040469e-02 --1.481233378337292850e+00 1.346468224529040469e-02 --1.467454463189969305e+00 1.346468224529040469e-02 --1.453675548042645760e+00 1.346468224529040469e-02 --1.439896632895322215e+00 1.346468224529040469e-02 --1.426117717747998670e+00 1.346468224529040469e-02 --1.412338802600674237e+00 1.346468224529040469e-02 --1.398559887453350692e+00 1.346468224529040469e-02 --1.384780972306027147e+00 1.346468224529040469e-02 --1.371002057158703602e+00 1.346468224529040469e-02 --1.357223142011380057e+00 1.346468224529040469e-02 --1.343444226864056512e+00 1.346468224529040469e-02 --1.329665311716732967e+00 1.346468224529040469e-02 --1.315886396569409422e+00 1.346468224529040469e-02 --1.302107481422085877e+00 1.346468224529040469e-02 --1.288328566274761444e+00 1.346468224529040469e-02 --1.274549651127437899e+00 1.346468224529040469e-02 --1.260770735980114354e+00 1.346468224529040469e-02 --1.246991820832790809e+00 1.346468224529040469e-02 --1.233212905685467264e+00 1.346468224529040469e-02 --1.219433990538143719e+00 1.346468224529040469e-02 --1.205655075390820175e+00 1.346468224529040469e-02 --1.191876160243495741e+00 1.346468224529040469e-02 --1.178097245096172196e+00 1.346468224529040469e-02 --1.164318329948848652e+00 1.346468224529040469e-02 --1.150539414801525107e+00 1.346468224529040469e-02 --1.136760499654201562e+00 1.346468224529040469e-02 --1.122981584506878017e+00 1.346468224529040469e-02 --1.109202669359554472e+00 1.346468224529040469e-02 --1.095423754212230927e+00 1.346468224529040469e-02 --1.081644839064907382e+00 1.346468224529040469e-02 --1.067865923917582949e+00 1.346468224529040469e-02 --1.054087008770259404e+00 1.346468224529040469e-02 --1.040308093622935859e+00 1.346468224529040469e-02 --1.026529178475612314e+00 1.346468224529040469e-02 --1.012750263328288769e+00 1.346468224529040469e-02 --9.989713481809653350e-01 1.346468224529040469e-02 --9.851924330336416791e-01 1.346468224529040469e-02 --9.714135178863181341e-01 1.346468224529040469e-02 --9.576346027389938120e-01 1.346468224529040469e-02 --9.438556875916701561e-01 1.346468224529040469e-02 --9.300767724443466111e-01 1.346468224529040469e-02 --9.162978572970230662e-01 1.346468224529040469e-02 --9.025189421496995212e-01 1.346468224529040469e-02 --8.887400270023759763e-01 1.346468224529040469e-02 --8.749611118550524314e-01 1.346468224529040469e-02 --8.611821967077288864e-01 1.346468224529040469e-02 --8.474032815604054525e-01 1.346468224529040469e-02 --8.336243664130809083e-01 1.346468224529040469e-02 --8.198454512657573634e-01 1.346468224529040469e-02 --8.060665361184338185e-01 1.346468224529040469e-02 --7.922876209711102735e-01 1.346468224529040469e-02 --7.785087058237867286e-01 1.346468224529040469e-02 --7.647297906764632947e-01 1.346468224529040469e-02 --7.509508755291396387e-01 1.346468224529040469e-02 --7.371719603818152056e-01 1.346468224529040469e-02 --7.233930452344916606e-01 1.346468224529040469e-02 --7.096141300871681157e-01 1.346468224529040469e-02 --6.958352149398446818e-01 1.346468224529040469e-02 --6.820562997925210258e-01 1.346468224529040469e-02 --6.682773846451974809e-01 1.346468224529040469e-02 --6.544984694978739359e-01 1.346468224529040469e-02 --6.407195543505503910e-01 1.346468224529040469e-02 --6.269406392032268460e-01 1.346468224529040469e-02 --6.131617240559024129e-01 1.346468224529040469e-02 --5.993828089085788680e-01 1.346468224529040469e-02 --5.856038937612553230e-01 1.346468224529040469e-02 --5.718249786139317781e-01 1.346468224529040469e-02 --5.580460634666082331e-01 1.346468224529040469e-02 --5.442671483192846882e-01 1.346468224529040469e-02 --5.304882331719611432e-01 1.346468224529040469e-02 --5.167093180246367101e-01 1.346468224529040469e-02 --5.029304028773131652e-01 1.346468224529040469e-02 --4.891514877299896757e-01 1.346468224529040469e-02 --4.753725725826661308e-01 1.346468224529040469e-02 --4.615936574353425303e-01 1.346468224529040469e-02 --4.478147422880189854e-01 1.346468224529040469e-02 --4.340358271406954405e-01 1.346468224529040469e-02 --4.202569119933719510e-01 1.346468224529040469e-02 --4.064779968460483506e-01 1.346468224529040469e-02 --3.926990816987239175e-01 1.346468224529040469e-02 --3.789201665514004280e-01 1.346468224529040469e-02 --3.651412514040768276e-01 1.346468224529040469e-02 --3.513623362567533381e-01 1.346468224529040469e-02 --3.375834211094297932e-01 1.346468224529040469e-02 --3.238045059621062483e-01 1.346468224529040469e-02 --3.100255908147826478e-01 1.346468224529040469e-02 --2.962466756674582702e-01 1.346468224529040469e-02 --2.824677605201346697e-01 1.346468224529040469e-02 --2.686888453728111248e-01 1.346468224529040469e-02 --2.549099302254875243e-01 1.346468224529040469e-02 --2.411310150781640627e-01 1.346468224529040469e-02 --2.273520999308405177e-01 1.346468224529040469e-02 --2.135731847835169728e-01 1.346468224529040469e-02 --1.997942696361934278e-01 1.346468224529040469e-02 --1.860153544888698551e-01 1.346468224529040469e-02 --1.722364393415454498e-01 1.346468224529040469e-02 --1.584575241942219326e-01 1.346468224529040469e-02 --1.446786090468983599e-01 1.346468224529040469e-02 --1.308996938995748149e-01 1.346468224529040469e-02 --1.171207787522512561e-01 1.346468224529040469e-02 --1.033418636049277251e-01 1.346468224529040469e-02 --8.956294845760416623e-02 1.346468224529040469e-02 --7.578403331028064904e-02 1.346468224529040469e-02 --6.200511816295618817e-02 1.346468224529040469e-02 --4.822620301563265016e-02 1.346468224529040469e-02 --3.444728786830910522e-02 1.346468224529040469e-02 --2.066837272098556721e-02 1.346468224529040469e-02 --6.889457573662017068e-03 1.346468224529040469e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC1V0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_IC1V0.txt deleted file mode 100644 index 281810b3a..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC1V0.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = IC1V0 -3.900000000000000000e+01 2.000000000000000000e+00 -3.049005749077952299e+00 -4.949109999999999898e-01 -3.136699800685844863e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 3.350000000000000200e-01 -3.136699800685844863e+00 3.350000000000000200e-01 -3.049005749077952299e+00 4.949109999999999898e-01 -2.893161745241203509e+00 5.041050000000000253e-01 -2.868988600429927427e+00 5.047989999999999977e-01 -2.871351109810510671e+00 4.642505000000000104e-01 -2.880800806826291804e+00 4.239039999999999475e-01 -2.897086029556440678e+00 3.858314999999999939e-01 -2.913304122262888374e+00 3.561050000000000049e-01 -2.928108437504038264e+00 3.259269999999999667e-01 -2.941589917755801586e+00 2.951289999999999747e-01 -2.953723233749382615e+00 2.637690000000000312e-01 -2.964484053313650946e+00 2.319070000000000020e-01 -2.973852348038931837e+00 1.996034999999999893e-01 -2.981810080005999453e+00 1.669204999999999994e-01 -2.988341430914152053e+00 1.339190000000000103e-01 -2.993434791052786537e+00 1.006630000000000025e-01 -2.997079661606716794e+00 6.721550000000001135e-02 -2.999269602916132094e+00 3.363950000000000273e-02 -3.000000000000000000e+00 0.000000000000000000e+00 -2.999269602916132094e+00 -3.363950000000000273e-02 -2.997079661606716794e+00 -6.721550000000001135e-02 -2.993434791052786537e+00 -1.006630000000000025e-01 -2.988341430914152053e+00 -1.339190000000000103e-01 -2.981810080005999453e+00 -1.669204999999999994e-01 -2.973852348038931837e+00 -1.996034999999999893e-01 -2.964484053313650946e+00 -2.319070000000000020e-01 -2.953723233749382615e+00 -2.637690000000000312e-01 -2.941589917755801586e+00 -2.951289999999999747e-01 -2.928108437504038264e+00 -3.259269999999999667e-01 -2.913304122262888374e+00 -3.561050000000000049e-01 -2.897086029556440678e+00 -3.858314999999999939e-01 -2.880800806826291804e+00 -4.239039999999999475e-01 -2.871351109810510671e+00 -4.642505000000000104e-01 -2.868988600429927427e+00 -5.047989999999999977e-01 -2.893161745241203509e+00 -5.041050000000000253e-01 -5.942104641579788460e-01 3.208299999999997265e-02 -8.020529374374847364e-01 3.208299999999997265e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC1V1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_IC1V1.txt deleted file mode 100644 index 2c8456499..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC1V1.txt +++ /dev/null @@ -1,132 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = IC1V1 -1.260000000000000000e+02 2.000000000000000000e+00 -3.049005749077952299e+00 -4.949109999999999898e-01 -3.136699800685844863e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 3.350000000000000200e-01 -3.136699800685844863e+00 3.350000000000000200e-01 -3.049005749077952299e+00 4.949109999999999898e-01 -2.893161745241203509e+00 5.041050000000000253e-01 -2.868988600429927427e+00 5.047989999999999977e-01 -2.871232184874885185e+00 4.650779999999999914e-01 -2.895160089779413415e+00 4.687679999999999625e-01 -2.895365652775027776e+00 4.673419999999999797e-01 -2.871470034746136601e+00 4.634230000000000294e-01 -2.880540609070497915e+00 4.246979999999999644e-01 -2.903440859048059597e+00 4.328899999999999970e-01 -2.903890317399827392e+00 4.315220000000000167e-01 -2.881061004582085250e+00 4.231099999999999861e-01 -2.896681761097305241e+00 3.865560000000000107e-01 -2.917799801957522199e+00 3.990020000000000233e-01 -2.918035678212157702e+00 3.976850000000000107e-01 -2.897490298015576116e+00 3.851070000000000326e-01 -2.913040700743232847e+00 3.566139999999999866e-01 -2.933599304008877695e+00 3.691920000000000202e-01 -2.934567534544293643e+00 3.671619999999999884e-01 -2.913567543782543900e+00 3.555960000000000232e-01 -2.927866929907000149e+00 3.264469999999999872e-01 -2.948963642126518181e+00 3.380129999999999524e-01 -2.949926909762506266e+00 3.359390000000000431e-01 -2.928349945101076379e+00 3.254070000000000018e-01 -2.941371435684154267e+00 2.956590000000000051e-01 -2.962960298264976533e+00 3.061909999999999910e-01 -2.963832468411404797e+00 3.040769999999999862e-01 -2.941808399827448461e+00 2.945989999999999998e-01 -2.953527647901719178e+00 2.643079999999999874e-01 -2.975561006607239989e+00 2.737859999999999738e-01 -2.976340676090472481e+00 2.716350000000000153e-01 -2.953918819597046053e+00 2.632300000000000195e-01 -2.964312061526618081e+00 2.324539999999999940e-01 -2.986742832507685907e+00 2.408600000000000185e-01 -2.987429169303660093e+00 2.386770000000000003e-01 -2.964656045100683812e+00 2.313600000000000101e-01 -2.973705061107083214e+00 2.001579999999999748e-01 -2.996485074357254863e+00 2.074759999999999938e-01 -2.997074716166638897e+00 2.052649999999999753e-01 -2.973999634970780903e+00 1.990490000000000037e-01 -2.981686523884328643e+00 1.674809999999999910e-01 -3.004768121776298262e+00 1.736959999999999893e-01 -3.005260809651117526e+00 1.714610000000000023e-01 -2.981933636127670706e+00 1.663600000000000079e-01 -2.988242170622883442e+00 1.344840000000000202e-01 -3.011575234559607850e+00 1.395860000000000156e-01 -3.011971213063827868e+00 1.373319999999999819e-01 -2.988440691205420663e+00 1.333540000000000003e-01 -2.993359959519476199e+00 1.012320000000000025e-01 -3.016894619915909459e+00 1.052099999999999980e-01 -3.017192241518522611e+00 1.029410000000000047e-01 -2.993509622586097318e+00 1.000939999999999885e-01 -2.997029823473389865e+00 6.778700000000000003e-02 -3.020715965495475608e+00 7.063400000000000234e-02 -3.020914655701153251e+00 6.835399999999999809e-02 -2.997129499740043723e+00 6.664400000000000879e-02 -2.999244195333032881e+00 3.421300000000000036e-02 -3.023031121185379533e+00 3.592300000000000354e-02 -3.023130877419521578e+00 3.363700000000000023e-02 -2.999295010499231307e+00 3.306600000000000511e-02 -3.000000000000000000e+00 5.739999999999999660e-04 -3.023837023205159902e+00 1.143999999999999835e-03 -3.023837023205159902e+00 -1.143999999999999835e-03 -3.000000000000000000e+00 -5.739999999999999660e-04 -2.999295010499231307e+00 -3.306600000000000511e-02 -3.023130877419521578e+00 -3.363700000000000023e-02 -3.023031121185379533e+00 -3.592300000000000354e-02 -2.999244195333032881e+00 -3.421300000000000036e-02 -2.997129499740043723e+00 -6.664400000000000879e-02 -3.020914655701153251e+00 -6.835399999999999809e-02 -3.020715965495475608e+00 -7.063400000000000234e-02 -2.997029823473389865e+00 -6.778700000000000003e-02 -2.993509622586097318e+00 -1.000939999999999885e-01 -3.017192241518522611e+00 -1.029410000000000047e-01 -3.016894619915909459e+00 -1.052099999999999980e-01 -2.993359959519476199e+00 -1.012320000000000025e-01 -2.988440691205420663e+00 -1.333540000000000003e-01 -3.011971213063827868e+00 -1.373319999999999819e-01 -3.011575234559607850e+00 -1.395860000000000156e-01 -2.988242170622883442e+00 -1.344840000000000202e-01 -2.981933636127670706e+00 -1.663600000000000079e-01 -3.005260809651117526e+00 -1.714610000000000023e-01 -3.004768121776298262e+00 -1.736959999999999893e-01 -2.981686523884328643e+00 -1.674809999999999910e-01 -2.973999634970780903e+00 -1.990490000000000037e-01 -2.997074716166638897e+00 -2.052649999999999753e-01 -2.996485074357254863e+00 -2.074759999999999938e-01 -2.973705061107083214e+00 -2.001579999999999748e-01 -2.964656045100683812e+00 -2.313600000000000101e-01 -2.987429169303660093e+00 -2.386770000000000003e-01 -2.986742832507685907e+00 -2.408600000000000185e-01 -2.964312061526618081e+00 -2.324539999999999940e-01 -2.953918819597046053e+00 -2.632300000000000195e-01 -2.976340676090472481e+00 -2.716350000000000153e-01 -2.975561006607239989e+00 -2.737859999999999738e-01 -2.953527647901719178e+00 -2.643079999999999874e-01 -2.941808399827448461e+00 -2.945989999999999998e-01 -2.963832468411404797e+00 -3.040769999999999862e-01 -2.962960298264976533e+00 -3.061909999999999910e-01 -2.941371435684154267e+00 -2.956590000000000051e-01 -2.928349945101076379e+00 -3.254070000000000018e-01 -2.949926909762506266e+00 -3.359390000000000431e-01 -2.948963642126518181e+00 -3.380129999999999524e-01 -2.927866929907000149e+00 -3.264469999999999872e-01 -2.913567543782543900e+00 -3.555960000000000232e-01 -2.934651442255531428e+00 -3.671619999999999884e-01 -2.933599304008877695e+00 -3.691920000000000202e-01 -2.913040700743232847e+00 -3.566139999999999866e-01 -2.897490298015576116e+00 -3.851070000000000326e-01 -2.918035678212157702e+00 -3.976850000000000107e-01 -2.917799801957522199e+00 -3.990020000000000233e-01 -2.896681761097305241e+00 -3.865560000000000107e-01 -2.881061004582085250e+00 -4.231099999999999861e-01 -2.903884643094994722e+00 -4.315220000000000167e-01 -2.903440859048059597e+00 -4.328899999999999970e-01 -2.880540609070497915e+00 -4.246979999999999644e-01 -2.871470034746136601e+00 -4.634230000000000294e-01 -2.895365652775027776e+00 -4.673419999999999797e-01 -2.895160089779413415e+00 -4.687679999999999625e-01 -2.871232184874885185e+00 -4.650779999999999914e-01 -2.868988600429927427e+00 -5.047989999999999977e-01 -2.893161745241203509e+00 -5.041050000000000253e-01 -5.942104641579788460e-01 3.208299999999997265e-02 -8.020529374374847364e-01 3.208299999999997265e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC2V0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_IC2V0.txt deleted file mode 100644 index bddcee9c1..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC2V0.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = IC2V0 -3.900000000000000000e+01 2.000000000000000000e+00 -3.049005749077952299e+00 -4.949109999999999898e-01 -3.136699800685844863e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 3.350000000000000200e-01 -3.136699800685844863e+00 3.350000000000000200e-01 -3.049005749077952299e+00 4.949109999999999898e-01 -2.893161745241203509e+00 5.041050000000000253e-01 -2.868988600429927427e+00 5.047989999999999977e-01 -2.871351109810510671e+00 4.642505000000000104e-01 -2.880800806826291804e+00 4.239039999999999475e-01 -2.897086029556440678e+00 3.858314999999999939e-01 -2.913304122262888374e+00 3.561050000000000049e-01 -2.928108437504038264e+00 3.259269999999999667e-01 -2.941589917755801586e+00 2.951289999999999747e-01 -2.953723233749382615e+00 2.637690000000000312e-01 -2.964484053313650946e+00 2.319070000000000020e-01 -2.973852348038931837e+00 1.996034999999999893e-01 -2.981810080005999453e+00 1.669204999999999994e-01 -2.988341430914152053e+00 1.339190000000000103e-01 -2.993434791052786537e+00 1.006630000000000025e-01 -2.997079661606716794e+00 6.721550000000001135e-02 -2.999269602916132094e+00 3.363950000000000273e-02 -3.000000000000000000e+00 0.000000000000000000e+00 -2.999269602916132094e+00 -3.363950000000000273e-02 -2.997079661606716794e+00 -6.721550000000001135e-02 -2.993434791052786537e+00 -1.006630000000000025e-01 -2.988341430914152053e+00 -1.339190000000000103e-01 -2.981810080005999453e+00 -1.669204999999999994e-01 -2.973852348038931837e+00 -1.996034999999999893e-01 -2.964484053313650946e+00 -2.319070000000000020e-01 -2.953723233749382615e+00 -2.637690000000000312e-01 -2.941589917755801586e+00 -2.951289999999999747e-01 -2.928108437504038264e+00 -3.259269999999999667e-01 -2.913304122262888374e+00 -3.561050000000000049e-01 -2.897086029556440678e+00 -3.858314999999999939e-01 -2.880800806826291804e+00 -4.239039999999999475e-01 -2.871351109810510671e+00 -4.642505000000000104e-01 -2.868988600429927427e+00 -5.047989999999999977e-01 -2.893161745241203509e+00 -5.041050000000000253e-01 -1.641408015354576477e+00 3.208300000000008367e-02 -1.849250488634082590e+00 3.208300000000008367e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC2V1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_IC2V1.txt deleted file mode 100644 index c24e48782..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC2V1.txt +++ /dev/null @@ -1,132 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = IC2V1 -1.260000000000000000e+02 2.000000000000000000e+00 -3.049005749077952299e+00 -4.949109999999999898e-01 -3.136699800685844863e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 3.350000000000000200e-01 -3.136699800685844863e+00 3.350000000000000200e-01 -3.049005749077952299e+00 4.949109999999999898e-01 -2.893161745241203509e+00 5.041050000000000253e-01 -2.868988600429927427e+00 5.047989999999999977e-01 -2.871232184874885185e+00 4.650779999999999914e-01 -2.895160089779413415e+00 4.687679999999999625e-01 -2.895365652775027776e+00 4.673419999999999797e-01 -2.871470034746136601e+00 4.634230000000000294e-01 -2.880540609070497915e+00 4.246979999999999644e-01 -2.903440859048059597e+00 4.328899999999999970e-01 -2.903890317399827392e+00 4.315220000000000167e-01 -2.881061004582085250e+00 4.231099999999999861e-01 -2.896681761097305241e+00 3.865560000000000107e-01 -2.917799801957522199e+00 3.990020000000000233e-01 -2.918035678212157702e+00 3.976850000000000107e-01 -2.897490298015576116e+00 3.851070000000000326e-01 -2.913040700743232847e+00 3.566139999999999866e-01 -2.933599304008877695e+00 3.691920000000000202e-01 -2.934567534544293643e+00 3.671619999999999884e-01 -2.913567543782543900e+00 3.555960000000000232e-01 -2.927866929907000149e+00 3.264469999999999872e-01 -2.948963642126518181e+00 3.380129999999999524e-01 -2.949926909762506266e+00 3.359390000000000431e-01 -2.928349945101076379e+00 3.254070000000000018e-01 -2.941371435684154267e+00 2.956590000000000051e-01 -2.962960298264976533e+00 3.061909999999999910e-01 -2.963832468411404797e+00 3.040769999999999862e-01 -2.941808399827448461e+00 2.945989999999999998e-01 -2.953527647901719178e+00 2.643079999999999874e-01 -2.975561006607239989e+00 2.737859999999999738e-01 -2.976340676090472481e+00 2.716350000000000153e-01 -2.953918819597046053e+00 2.632300000000000195e-01 -2.964312061526618081e+00 2.324539999999999940e-01 -2.986742832507685907e+00 2.408600000000000185e-01 -2.987429169303660093e+00 2.386770000000000003e-01 -2.964656045100683812e+00 2.313600000000000101e-01 -2.973705061107083214e+00 2.001579999999999748e-01 -2.996485074357254863e+00 2.074759999999999938e-01 -2.997074716166638897e+00 2.052649999999999753e-01 -2.973999634970780903e+00 1.990490000000000037e-01 -2.981686523884328643e+00 1.674809999999999910e-01 -3.004768121776298262e+00 1.736959999999999893e-01 -3.005260809651117526e+00 1.714610000000000023e-01 -2.981933636127670706e+00 1.663600000000000079e-01 -2.988242170622883442e+00 1.344840000000000202e-01 -3.011575234559607850e+00 1.395860000000000156e-01 -3.011971213063827868e+00 1.373319999999999819e-01 -2.988440691205420663e+00 1.333540000000000003e-01 -2.993359959519476199e+00 1.012320000000000025e-01 -3.016894619915909459e+00 1.052099999999999980e-01 -3.017192241518522611e+00 1.029410000000000047e-01 -2.993509622586097318e+00 1.000939999999999885e-01 -2.997029823473389865e+00 6.778700000000000003e-02 -3.020715965495475608e+00 7.063400000000000234e-02 -3.020914655701153251e+00 6.835399999999999809e-02 -2.997129499740043723e+00 6.664400000000000879e-02 -2.999244195333032881e+00 3.421300000000000036e-02 -3.023031121185379533e+00 3.592300000000000354e-02 -3.023130877419521578e+00 3.363700000000000023e-02 -2.999295010499231307e+00 3.306600000000000511e-02 -3.000000000000000000e+00 5.739999999999999660e-04 -3.023837023205159902e+00 1.143999999999999835e-03 -3.023837023205159902e+00 -1.143999999999999835e-03 -3.000000000000000000e+00 -5.739999999999999660e-04 -2.999295010499231307e+00 -3.306600000000000511e-02 -3.023130877419521578e+00 -3.363700000000000023e-02 -3.023031121185379533e+00 -3.592300000000000354e-02 -2.999244195333032881e+00 -3.421300000000000036e-02 -2.997129499740043723e+00 -6.664400000000000879e-02 -3.020914655701153251e+00 -6.835399999999999809e-02 -3.020715965495475608e+00 -7.063400000000000234e-02 -2.997029823473389865e+00 -6.778700000000000003e-02 -2.993509622586097318e+00 -1.000939999999999885e-01 -3.017192241518522611e+00 -1.029410000000000047e-01 -3.016894619915909459e+00 -1.052099999999999980e-01 -2.993359959519476199e+00 -1.012320000000000025e-01 -2.988440691205420663e+00 -1.333540000000000003e-01 -3.011971213063827868e+00 -1.373319999999999819e-01 -3.011575234559607850e+00 -1.395860000000000156e-01 -2.988242170622883442e+00 -1.344840000000000202e-01 -2.981933636127670706e+00 -1.663600000000000079e-01 -3.005260809651117526e+00 -1.714610000000000023e-01 -3.004768121776298262e+00 -1.736959999999999893e-01 -2.981686523884328643e+00 -1.674809999999999910e-01 -2.973999634970780903e+00 -1.990490000000000037e-01 -2.997074716166638897e+00 -2.052649999999999753e-01 -2.996485074357254863e+00 -2.074759999999999938e-01 -2.973705061107083214e+00 -2.001579999999999748e-01 -2.964656045100683812e+00 -2.313600000000000101e-01 -2.987429169303660093e+00 -2.386770000000000003e-01 -2.986742832507685907e+00 -2.408600000000000185e-01 -2.964312061526618081e+00 -2.324539999999999940e-01 -2.953918819597046053e+00 -2.632300000000000195e-01 -2.976340676090472481e+00 -2.716350000000000153e-01 -2.975561006607239989e+00 -2.737859999999999738e-01 -2.953527647901719178e+00 -2.643079999999999874e-01 -2.941808399827448461e+00 -2.945989999999999998e-01 -2.963832468411404797e+00 -3.040769999999999862e-01 -2.962960298264976533e+00 -3.061909999999999910e-01 -2.941371435684154267e+00 -2.956590000000000051e-01 -2.928349945101076379e+00 -3.254070000000000018e-01 -2.949926909762506266e+00 -3.359390000000000431e-01 -2.948963642126518181e+00 -3.380129999999999524e-01 -2.927866929907000149e+00 -3.264469999999999872e-01 -2.913567543782543900e+00 -3.555960000000000232e-01 -2.934651442255531428e+00 -3.671619999999999884e-01 -2.933599304008877695e+00 -3.691920000000000202e-01 -2.913040700743232847e+00 -3.566139999999999866e-01 -2.897490298015576116e+00 -3.851070000000000326e-01 -2.918035678212157702e+00 -3.976850000000000107e-01 -2.917799801957522199e+00 -3.990020000000000233e-01 -2.896681761097305241e+00 -3.865560000000000107e-01 -2.881061004582085250e+00 -4.231099999999999861e-01 -2.903884643094994722e+00 -4.315220000000000167e-01 -2.903440859048059597e+00 -4.328899999999999970e-01 -2.880540609070497915e+00 -4.246979999999999644e-01 -2.871470034746136601e+00 -4.634230000000000294e-01 -2.895365652775027776e+00 -4.673419999999999797e-01 -2.895160089779413415e+00 -4.687679999999999625e-01 -2.871232184874885185e+00 -4.650779999999999914e-01 -2.868988600429927427e+00 -5.047989999999999977e-01 -2.893161745241203509e+00 -5.041050000000000253e-01 -1.641408015354576477e+00 3.208300000000008367e-02 -1.849250488634082590e+00 3.208300000000008367e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC3V0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_IC3V0.txt deleted file mode 100644 index 9900b08ed..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC3V0.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = IC3V0 -3.900000000000000000e+01 2.000000000000000000e+00 -3.049005749077952299e+00 -4.949109999999999898e-01 -3.136699800685844863e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 3.350000000000000200e-01 -3.136699800685844863e+00 3.350000000000000200e-01 -3.049005749077952299e+00 4.949109999999999898e-01 -2.893161745241203509e+00 5.041050000000000253e-01 -2.868988600429927427e+00 5.047989999999999977e-01 -2.871351109810510671e+00 4.642505000000000104e-01 -2.880800806826291804e+00 4.239039999999999475e-01 -2.897086029556440678e+00 3.858314999999999939e-01 -2.913304122262888374e+00 3.561050000000000049e-01 -2.928108437504038264e+00 3.259269999999999667e-01 -2.941589917755801586e+00 2.951289999999999747e-01 -2.953723233749382615e+00 2.637690000000000312e-01 -2.964484053313650946e+00 2.319070000000000020e-01 -2.973852348038931837e+00 1.996034999999999893e-01 -2.981810080005999453e+00 1.669204999999999994e-01 -2.988341430914152053e+00 1.339190000000000103e-01 -2.993434791052786537e+00 1.006630000000000025e-01 -2.997079661606716794e+00 6.721550000000001135e-02 -2.999269602916132094e+00 3.363950000000000273e-02 -3.000000000000000000e+00 0.000000000000000000e+00 -2.999269602916132094e+00 -3.363950000000000273e-02 -2.997079661606716794e+00 -6.721550000000001135e-02 -2.993434791052786537e+00 -1.006630000000000025e-01 -2.988341430914152053e+00 -1.339190000000000103e-01 -2.981810080005999453e+00 -1.669204999999999994e-01 -2.973852348038931837e+00 -1.996034999999999893e-01 -2.964484053313650946e+00 -2.319070000000000020e-01 -2.953723233749382615e+00 -2.637690000000000312e-01 -2.941589917755801586e+00 -2.951289999999999747e-01 -2.928108437504038264e+00 -3.259269999999999667e-01 -2.913304122262888374e+00 -3.561050000000000049e-01 -2.897086029556440678e+00 -3.858314999999999939e-01 -2.880800806826291804e+00 -4.239039999999999475e-01 -2.871351109810510671e+00 -4.642505000000000104e-01 -2.868988600429927427e+00 -5.047989999999999977e-01 -2.893161745241203509e+00 -5.041050000000000253e-01 --2.896448039830680443e+00 3.208300000000008367e-02 --2.688605566551174775e+00 3.208300000000008367e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC3V1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_IC3V1.txt deleted file mode 100644 index d8c45d1ef..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_IC3V1.txt +++ /dev/null @@ -1,132 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = IC3V1 -1.260000000000000000e+02 2.000000000000000000e+00 -3.049005749077952299e+00 -4.949109999999999898e-01 -3.136699800685844863e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 -3.350000000000000200e-01 -3.399999999999999911e+00 3.350000000000000200e-01 -3.136699800685844863e+00 3.350000000000000200e-01 -3.049005749077952299e+00 4.949109999999999898e-01 -2.893161745241203509e+00 5.041050000000000253e-01 -2.868988600429927427e+00 5.047989999999999977e-01 -2.871232184874885185e+00 4.650779999999999914e-01 -2.895160089779413415e+00 4.687679999999999625e-01 -2.895365652775027776e+00 4.673419999999999797e-01 -2.871470034746136601e+00 4.634230000000000294e-01 -2.880540609070497915e+00 4.246979999999999644e-01 -2.903440859048059597e+00 4.328899999999999970e-01 -2.903890317399827392e+00 4.315220000000000167e-01 -2.881061004582085250e+00 4.231099999999999861e-01 -2.896681761097305241e+00 3.865560000000000107e-01 -2.917799801957522199e+00 3.990020000000000233e-01 -2.918035678212157702e+00 3.976850000000000107e-01 -2.897490298015576116e+00 3.851070000000000326e-01 -2.913040700743232847e+00 3.566139999999999866e-01 -2.933599304008877695e+00 3.691920000000000202e-01 -2.934567534544293643e+00 3.671619999999999884e-01 -2.913567543782543900e+00 3.555960000000000232e-01 -2.927866929907000149e+00 3.264469999999999872e-01 -2.948963642126518181e+00 3.380129999999999524e-01 -2.949926909762506266e+00 3.359390000000000431e-01 -2.928349945101076379e+00 3.254070000000000018e-01 -2.941371435684154267e+00 2.956590000000000051e-01 -2.962960298264976533e+00 3.061909999999999910e-01 -2.963832468411404797e+00 3.040769999999999862e-01 -2.941808399827448461e+00 2.945989999999999998e-01 -2.953527647901719178e+00 2.643079999999999874e-01 -2.975561006607239989e+00 2.737859999999999738e-01 -2.976340676090472481e+00 2.716350000000000153e-01 -2.953918819597046053e+00 2.632300000000000195e-01 -2.964312061526618081e+00 2.324539999999999940e-01 -2.986742832507685907e+00 2.408600000000000185e-01 -2.987429169303660093e+00 2.386770000000000003e-01 -2.964656045100683812e+00 2.313600000000000101e-01 -2.973705061107083214e+00 2.001579999999999748e-01 -2.996485074357254863e+00 2.074759999999999938e-01 -2.997074716166638897e+00 2.052649999999999753e-01 -2.973999634970780903e+00 1.990490000000000037e-01 -2.981686523884328643e+00 1.674809999999999910e-01 -3.004768121776298262e+00 1.736959999999999893e-01 -3.005260809651117526e+00 1.714610000000000023e-01 -2.981933636127670706e+00 1.663600000000000079e-01 -2.988242170622883442e+00 1.344840000000000202e-01 -3.011575234559607850e+00 1.395860000000000156e-01 -3.011971213063827868e+00 1.373319999999999819e-01 -2.988440691205420663e+00 1.333540000000000003e-01 -2.993359959519476199e+00 1.012320000000000025e-01 -3.016894619915909459e+00 1.052099999999999980e-01 -3.017192241518522611e+00 1.029410000000000047e-01 -2.993509622586097318e+00 1.000939999999999885e-01 -2.997029823473389865e+00 6.778700000000000003e-02 -3.020715965495475608e+00 7.063400000000000234e-02 -3.020914655701153251e+00 6.835399999999999809e-02 -2.997129499740043723e+00 6.664400000000000879e-02 -2.999244195333032881e+00 3.421300000000000036e-02 -3.023031121185379533e+00 3.592300000000000354e-02 -3.023130877419521578e+00 3.363700000000000023e-02 -2.999295010499231307e+00 3.306600000000000511e-02 -3.000000000000000000e+00 5.739999999999999660e-04 -3.023837023205159902e+00 1.143999999999999835e-03 -3.023837023205159902e+00 -1.143999999999999835e-03 -3.000000000000000000e+00 -5.739999999999999660e-04 -2.999295010499231307e+00 -3.306600000000000511e-02 -3.023130877419521578e+00 -3.363700000000000023e-02 -3.023031121185379533e+00 -3.592300000000000354e-02 -2.999244195333032881e+00 -3.421300000000000036e-02 -2.997129499740043723e+00 -6.664400000000000879e-02 -3.020914655701153251e+00 -6.835399999999999809e-02 -3.020715965495475608e+00 -7.063400000000000234e-02 -2.997029823473389865e+00 -6.778700000000000003e-02 -2.993509622586097318e+00 -1.000939999999999885e-01 -3.017192241518522611e+00 -1.029410000000000047e-01 -3.016894619915909459e+00 -1.052099999999999980e-01 -2.993359959519476199e+00 -1.012320000000000025e-01 -2.988440691205420663e+00 -1.333540000000000003e-01 -3.011971213063827868e+00 -1.373319999999999819e-01 -3.011575234559607850e+00 -1.395860000000000156e-01 -2.988242170622883442e+00 -1.344840000000000202e-01 -2.981933636127670706e+00 -1.663600000000000079e-01 -3.005260809651117526e+00 -1.714610000000000023e-01 -3.004768121776298262e+00 -1.736959999999999893e-01 -2.981686523884328643e+00 -1.674809999999999910e-01 -2.973999634970780903e+00 -1.990490000000000037e-01 -2.997074716166638897e+00 -2.052649999999999753e-01 -2.996485074357254863e+00 -2.074759999999999938e-01 -2.973705061107083214e+00 -2.001579999999999748e-01 -2.964656045100683812e+00 -2.313600000000000101e-01 -2.987429169303660093e+00 -2.386770000000000003e-01 -2.986742832507685907e+00 -2.408600000000000185e-01 -2.964312061526618081e+00 -2.324539999999999940e-01 -2.953918819597046053e+00 -2.632300000000000195e-01 -2.976340676090472481e+00 -2.716350000000000153e-01 -2.975561006607239989e+00 -2.737859999999999738e-01 -2.953527647901719178e+00 -2.643079999999999874e-01 -2.941808399827448461e+00 -2.945989999999999998e-01 -2.963832468411404797e+00 -3.040769999999999862e-01 -2.962960298264976533e+00 -3.061909999999999910e-01 -2.941371435684154267e+00 -2.956590000000000051e-01 -2.928349945101076379e+00 -3.254070000000000018e-01 -2.949926909762506266e+00 -3.359390000000000431e-01 -2.948963642126518181e+00 -3.380129999999999524e-01 -2.927866929907000149e+00 -3.264469999999999872e-01 -2.913567543782543900e+00 -3.555960000000000232e-01 -2.934651442255531428e+00 -3.671619999999999884e-01 -2.933599304008877695e+00 -3.691920000000000202e-01 -2.913040700743232847e+00 -3.566139999999999866e-01 -2.897490298015576116e+00 -3.851070000000000326e-01 -2.918035678212157702e+00 -3.976850000000000107e-01 -2.917799801957522199e+00 -3.990020000000000233e-01 -2.896681761097305241e+00 -3.865560000000000107e-01 -2.881061004582085250e+00 -4.231099999999999861e-01 -2.903884643094994722e+00 -4.315220000000000167e-01 -2.903440859048059597e+00 -4.328899999999999970e-01 -2.880540609070497915e+00 -4.246979999999999644e-01 -2.871470034746136601e+00 -4.634230000000000294e-01 -2.895365652775027776e+00 -4.673419999999999797e-01 -2.895160089779413415e+00 -4.687679999999999625e-01 -2.871232184874885185e+00 -4.650779999999999914e-01 -2.868988600429927427e+00 -5.047989999999999977e-01 -2.893161745241203509e+00 -5.041050000000000253e-01 --2.896448039830680443e+00 3.208300000000008367e-02 --2.688605566551174775e+00 3.208300000000008367e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH1V0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_LH1V0.txt deleted file mode 100644 index 2d079aab1..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH1V0.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = LH1V0 -3.900000000000000000e+01 2.000000000000000000e+00 -3.044780693243757774e+00 -4.949109999999999898e-01 -3.107833904684217163e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 3.180000000000000049e-01 -3.107833904684217163e+00 3.180000000000000049e-01 -3.044780693243757774e+00 4.949109999999999898e-01 -2.893059712127533434e+00 5.041050000000000253e-01 -2.869115048167717230e+00 5.047989999999999977e-01 -2.871475220568535214e+00 4.642505000000000104e-01 -2.880915079803645362e+00 4.239039999999999475e-01 -2.897184470647450105e+00 3.858314999999999939e-01 -2.913386258869197665e+00 3.561050000000000049e-01 -2.928176206214729405e+00 3.259269999999999667e-01 -2.941644655680222709e+00 2.951289999999999747e-01 -2.953766325423418770e+00 2.637690000000000312e-01 -2.964516663994923640e+00 2.319070000000000020e-01 -2.973876076688413583e+00 1.996034999999999893e-01 -2.981826377056054689e+00 1.669204999999999994e-01 -2.988352293009314931e+00 1.339190000000000103e-01 -2.993440622120721262e+00 1.006630000000000025e-01 -2.997082113834418138e+00 6.721550000000001135e-02 -2.999269995011077938e+00 3.363950000000000273e-02 -3.000000000000000000e+00 0.000000000000000000e+00 -2.999269995011077938e+00 -3.363950000000000273e-02 -2.997082113834418138e+00 -6.721550000000001135e-02 -2.993440622120721262e+00 -1.006630000000000025e-01 -2.988286590271198140e+00 -1.339190000000000103e-01 -2.981826377056054689e+00 -1.669204999999999994e-01 -2.973876076688413583e+00 -1.996034999999999893e-01 -2.964502839567379588e+00 -2.319070000000000020e-01 -2.953766325423418770e+00 -2.637690000000000312e-01 -2.941644655680222709e+00 -2.951289999999999747e-01 -2.928176206214729405e+00 -3.259269999999999667e-01 -2.913386258869197665e+00 -3.561050000000000049e-01 -2.897184470647450105e+00 -3.858314999999999939e-01 -2.880915079803645362e+00 -4.239039999999999475e-01 -2.871475220568535214e+00 -4.642505000000000104e-01 -2.869115048167717230e+00 -5.047989999999999977e-01 -2.893059712127533434e+00 -5.041050000000000253e-01 --8.121855700000000233e-01 3.333333999999998909e-02 --5.840778349999999897e-01 3.333333000000004986e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH1V1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_LH1V1.txt deleted file mode 100644 index bc3a77b93..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH1V1.txt +++ /dev/null @@ -1,132 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = LH1V1 -1.260000000000000000e+02 2.000000000000000000e+00 -3.044780693243757774e+00 -4.949109999999999898e-01 -3.107833904684217163e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 3.180000000000000049e-01 -3.107833904684217163e+00 3.180000000000000049e-01 -3.044780693243757774e+00 4.949109999999999898e-01 -2.893059712127533434e+00 5.041050000000000253e-01 -2.869115048167717230e+00 5.047989999999999977e-01 -2.871356378445165003e+00 4.650779999999999914e-01 -2.895054712512507678e+00 4.687679999999999625e-01 -2.895260149838732033e+00 4.673419999999999797e-01 -2.871594062691905869e+00 4.634230000000000294e-01 -2.880654819392295174e+00 4.246979999999999644e-01 -2.903329301636539128e+00 4.328899999999999970e-01 -2.903777601803601005e+00 4.315220000000000167e-01 -2.881175340214995995e+00 4.231099999999999861e-01 -2.896780664414922324e+00 3.865560000000000107e-01 -2.917674381907263914e+00 3.990020000000000233e-01 -2.917900461640007936e+00 3.976850000000000107e-01 -2.897588276879977887e+00 3.851070000000000326e-01 -2.913122788147675557e+00 3.566139999999999866e-01 -2.933450727161458715e+00 3.691920000000000202e-01 -2.934501378337782462e+00 3.671619999999999884e-01 -2.913649729590719772e+00 3.555960000000000232e-01 -2.927935306141395522e+00 3.264469999999999872e-01 -2.948801343380880624e+00 3.380129999999999524e-01 -2.949763071809159865e+00 3.359390000000000431e-01 -2.928417106288062843e+00 3.254070000000000018e-01 -2.941426659002225996e+00 2.956590000000000051e-01 -2.962784989008413028e+00 3.061909999999999910e-01 -2.963656386303281653e+00 3.040769999999999862e-01 -2.941862652358219421e+00 2.945989999999999998e-01 -2.953571252549659132e+00 2.643079999999999874e-01 -2.975375333992480442e+00 2.737859999999999738e-01 -2.976154255184515929e+00 2.716350000000000153e-01 -2.953961398297178853e+00 2.632300000000000195e-01 -2.964344863811784414e+00 2.324539999999999940e-01 -2.986548141768861964e+00 2.408600000000000185e-01 -2.987232463341812583e+00 2.386770000000000003e-01 -2.964688464178063310e+00 2.313600000000000101e-01 -2.973728259248752170e+00 2.001579999999999748e-01 -2.996281368108780985e+00 2.074759999999999938e-01 -2.996870381410558171e+00 2.052649999999999753e-01 -2.974023894128074996e+00 1.990490000000000037e-01 -2.981702890860188138e+00 1.674809999999999910e-01 -3.004556496895482542e+00 1.736959999999999893e-01 -3.005049476279062048e+00 1.714610000000000023e-01 -2.981949863251920796e+00 1.663600000000000079e-01 -2.988253155515101511e+00 1.344840000000000202e-01 -3.011357863027227300e+00 1.395860000000000156e-01 -3.011754085023580441e+00 1.373319999999999819e-01 -2.988451430503528350e+00 1.333540000000000003e-01 -2.993366180933850540e+00 1.012320000000000025e-01 -3.016673350655395769e+00 1.052099999999999980e-01 -3.016970697067113960e+00 1.029410000000000047e-01 -2.993515063307591983e+00 1.000939999999999885e-01 -2.997032009376604744e+00 6.778700000000000003e-02 -3.020490867071005781e+00 7.063400000000000234e-02 -3.020689333367970519e+00 6.835399999999999809e-02 -2.997132218292231531e+00 6.664400000000000879e-02 -2.999244949959060769e+00 3.421300000000000036e-02 -3.022805413067019664e+00 3.592300000000000354e-02 -3.022904297751372038e+00 3.363700000000000023e-02 -2.999295040063095108e+00 3.306600000000000511e-02 -3.000000000000000000e+00 5.739999999999999660e-04 -3.023609184170302555e+00 1.143999999999999835e-03 -3.023609184170302555e+00 -1.143999999999999835e-03 -3.000000000000000000e+00 -5.739999999999999660e-04 -2.999295040063095108e+00 -3.306600000000000511e-02 -3.022904297751372038e+00 -3.363700000000000023e-02 -3.022805413067019664e+00 -3.592300000000000354e-02 -2.999244949959060769e+00 -3.421300000000000036e-02 -2.997132218292231531e+00 -6.664400000000000879e-02 -3.020689333367970519e+00 -6.835399999999999809e-02 -3.020490867071005781e+00 -7.063400000000000234e-02 -2.997032009376604744e+00 -6.778700000000000003e-02 -2.993515063307591983e+00 -1.000939999999999885e-01 -3.016970697067113960e+00 -1.029410000000000047e-01 -3.016673350655395769e+00 -1.052099999999999980e-01 -2.993366180933850540e+00 -1.012320000000000025e-01 -2.988451430503528350e+00 -1.333540000000000003e-01 -3.011754085023580441e+00 -1.373319999999999819e-01 -3.011357863027227300e+00 -1.395860000000000156e-01 -2.988121750038867930e+00 -1.344840000000000202e-01 -2.981949863251920796e+00 -1.663600000000000079e-01 -3.005049476279062048e+00 -1.714610000000000023e-01 -3.004556496895482542e+00 -1.736959999999999893e-01 -2.981702890860188138e+00 -1.674809999999999910e-01 -2.974023894128074996e+00 -1.990490000000000037e-01 -2.996870381410558171e+00 -2.052649999999999753e-01 -2.996281368108780985e+00 -2.074759999999999938e-01 -2.973728259248752170e+00 -2.001579999999999748e-01 -2.964660815322974763e+00 -2.313600000000000101e-01 -2.987232463341812583e+00 -2.386770000000000003e-01 -2.986548141768861964e+00 -2.408600000000000185e-01 -2.964344863811784414e+00 -2.324539999999999940e-01 -2.953961398297178853e+00 -2.632300000000000195e-01 -2.976154255184515929e+00 -2.716350000000000153e-01 -2.975375333992480442e+00 -2.737859999999999738e-01 -2.953571252549659132e+00 -2.643079999999999874e-01 -2.941862652358219421e+00 -2.945989999999999998e-01 -2.963656386303281653e+00 -3.040769999999999862e-01 -2.962784989008413028e+00 -3.061909999999999910e-01 -2.941426659002225996e+00 -2.956590000000000051e-01 -2.928417106288062843e+00 -3.254070000000000018e-01 -2.949763071809159865e+00 -3.359390000000000431e-01 -2.948801343380880624e+00 -3.380129999999999524e-01 -2.927935306141395522e+00 -3.264469999999999872e-01 -2.913649729590719772e+00 -3.555960000000000232e-01 -2.934501378337782462e+00 -3.671619999999999884e-01 -2.933450727161458715e+00 -3.691920000000000202e-01 -2.913122788147675557e+00 -3.566139999999999866e-01 -2.897588276879977887e+00 -3.851070000000000326e-01 -2.917900461640007936e+00 -3.976850000000000107e-01 -2.917674381907263914e+00 -3.990020000000000233e-01 -2.896780664414922324e+00 -3.865560000000000107e-01 -2.881175340214995995e+00 -4.231099999999999861e-01 -2.903777601803601005e+00 -4.315220000000000167e-01 -2.903329301636539128e+00 -4.328899999999999970e-01 -2.880654819392295174e+00 -4.246979999999999644e-01 -2.871594062691905869e+00 -4.634230000000000294e-01 -2.895260149838732033e+00 -4.673419999999999797e-01 -2.895054712512507678e+00 -4.687679999999999625e-01 -2.871356378445165003e+00 -4.650779999999999914e-01 -2.869115048167717230e+00 -5.047989999999999977e-01 -2.893059712127533434e+00 -5.041050000000000253e-01 --8.121855700000000233e-01 3.333333999999998909e-02 --5.840778349999999897e-01 3.333333000000004986e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH2V0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_LH2V0.txt deleted file mode 100644 index adbfa0a63..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH2V0.txt +++ /dev/null @@ -1,45 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = LH2V0 -3.900000000000000000e+01 2.000000000000000000e+00 -3.044780693243757774e+00 -4.949109999999999898e-01 -3.107833904684217163e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 3.180000000000000049e-01 -3.107833904684217163e+00 3.180000000000000049e-01 -3.044780693243757774e+00 4.949109999999999898e-01 -2.893059712127533434e+00 5.041050000000000253e-01 -2.869115048167717230e+00 5.047989999999999977e-01 -2.871475220568535214e+00 4.642505000000000104e-01 -2.880915079803645362e+00 4.239039999999999475e-01 -2.897184470647450105e+00 3.858314999999999939e-01 -2.913386258869197665e+00 3.561050000000000049e-01 -2.928176206214729405e+00 3.259269999999999667e-01 -2.941644655680222709e+00 2.951289999999999747e-01 -2.953766325423418770e+00 2.637690000000000312e-01 -2.964516663994923640e+00 2.319070000000000020e-01 -2.973876076688413583e+00 1.996034999999999893e-01 -2.981826377056054689e+00 1.669204999999999994e-01 -2.988352293009314931e+00 1.339190000000000103e-01 -2.993440622120721262e+00 1.006630000000000025e-01 -2.997082113834418138e+00 6.721550000000001135e-02 -2.999269995011077938e+00 3.363950000000000273e-02 -3.000000000000000000e+00 0.000000000000000000e+00 -2.999269995011077938e+00 -3.363950000000000273e-02 -2.997082113834418138e+00 -6.721550000000001135e-02 -2.993440622120721262e+00 -1.006630000000000025e-01 -2.988286590271198140e+00 -1.339190000000000103e-01 -2.981826377056054689e+00 -1.669204999999999994e-01 -2.973876076688413583e+00 -1.996034999999999893e-01 -2.964502839567379588e+00 -2.319070000000000020e-01 -2.953766325423418770e+00 -2.637690000000000312e-01 -2.941644655680222709e+00 -2.951289999999999747e-01 -2.928176206214729405e+00 -3.259269999999999667e-01 -2.913386258869197665e+00 -3.561050000000000049e-01 -2.897184470647450105e+00 -3.858314999999999939e-01 -2.880915079803645362e+00 -4.239039999999999475e-01 -2.871475220568535214e+00 -4.642505000000000104e-01 -2.869115048167717230e+00 -5.047989999999999977e-01 -2.893059712127533434e+00 -5.041050000000000253e-01 --4.631197200000000125e-01 3.333333999999998909e-02 --2.350119850000000066e-01 3.333332999999999435e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH2V1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_LH2V1.txt deleted file mode 100644 index 8ce0ba90e..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_LH2V1.txt +++ /dev/null @@ -1,132 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = LH2V1 -1.260000000000000000e+02 2.000000000000000000e+00 -3.044780693243757774e+00 -4.949109999999999898e-01 -3.107833904684217163e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 -3.180000000000000049e-01 -3.399999999999999911e+00 3.180000000000000049e-01 -3.107833904684217163e+00 3.180000000000000049e-01 -3.044780693243757774e+00 4.949109999999999898e-01 -2.893059712127533434e+00 5.041050000000000253e-01 -2.869115048167717230e+00 5.047989999999999977e-01 -2.871356378445165003e+00 4.650779999999999914e-01 -2.895054712512507678e+00 4.687679999999999625e-01 -2.895260149838732033e+00 4.673419999999999797e-01 -2.871594062691905869e+00 4.634230000000000294e-01 -2.880654819392295174e+00 4.246979999999999644e-01 -2.903329301636539128e+00 4.328899999999999970e-01 -2.903777601803601005e+00 4.315220000000000167e-01 -2.881175340214995995e+00 4.231099999999999861e-01 -2.896780664414922324e+00 3.865560000000000107e-01 -2.917674381907263914e+00 3.990020000000000233e-01 -2.917900461640007936e+00 3.976850000000000107e-01 -2.897588276879977887e+00 3.851070000000000326e-01 -2.913122788147675557e+00 3.566139999999999866e-01 -2.933450727161458715e+00 3.691920000000000202e-01 -2.934501378337782462e+00 3.671619999999999884e-01 -2.913649729590719772e+00 3.555960000000000232e-01 -2.927935306141395522e+00 3.264469999999999872e-01 -2.948801343380880624e+00 3.380129999999999524e-01 -2.949763071809159865e+00 3.359390000000000431e-01 -2.928417106288062843e+00 3.254070000000000018e-01 -2.941426659002225996e+00 2.956590000000000051e-01 -2.962784989008413028e+00 3.061909999999999910e-01 -2.963656386303281653e+00 3.040769999999999862e-01 -2.941862652358219421e+00 2.945989999999999998e-01 -2.953571252549659132e+00 2.643079999999999874e-01 -2.975375333992480442e+00 2.737859999999999738e-01 -2.976154255184515929e+00 2.716350000000000153e-01 -2.953961398297178853e+00 2.632300000000000195e-01 -2.964344863811784414e+00 2.324539999999999940e-01 -2.986548141768861964e+00 2.408600000000000185e-01 -2.987232463341812583e+00 2.386770000000000003e-01 -2.964688464178063310e+00 2.313600000000000101e-01 -2.973728259248752170e+00 2.001579999999999748e-01 -2.996281368108780985e+00 2.074759999999999938e-01 -2.996870381410558171e+00 2.052649999999999753e-01 -2.974023894128074996e+00 1.990490000000000037e-01 -2.981702890860188138e+00 1.674809999999999910e-01 -3.004556496895482542e+00 1.736959999999999893e-01 -3.005049476279062048e+00 1.714610000000000023e-01 -2.981949863251920796e+00 1.663600000000000079e-01 -2.988253155515101511e+00 1.344840000000000202e-01 -3.011357863027227300e+00 1.395860000000000156e-01 -3.011754085023580441e+00 1.373319999999999819e-01 -2.988451430503528350e+00 1.333540000000000003e-01 -2.993366180933850540e+00 1.012320000000000025e-01 -3.016673350655395769e+00 1.052099999999999980e-01 -3.016970697067113960e+00 1.029410000000000047e-01 -2.993515063307591983e+00 1.000939999999999885e-01 -2.997032009376604744e+00 6.778700000000000003e-02 -3.020490867071005781e+00 7.063400000000000234e-02 -3.020689333367970519e+00 6.835399999999999809e-02 -2.997132218292231531e+00 6.664400000000000879e-02 -2.999244949959060769e+00 3.421300000000000036e-02 -3.022805413067019664e+00 3.592300000000000354e-02 -3.022904297751372038e+00 3.363700000000000023e-02 -2.999295040063095108e+00 3.306600000000000511e-02 -3.000000000000000000e+00 5.739999999999999660e-04 -3.023609184170302555e+00 1.143999999999999835e-03 -3.023609184170302555e+00 -1.143999999999999835e-03 -3.000000000000000000e+00 -5.739999999999999660e-04 -2.999295040063095108e+00 -3.306600000000000511e-02 -3.022904297751372038e+00 -3.363700000000000023e-02 -3.022805413067019664e+00 -3.592300000000000354e-02 -2.999244949959060769e+00 -3.421300000000000036e-02 -2.997132218292231531e+00 -6.664400000000000879e-02 -3.020689333367970519e+00 -6.835399999999999809e-02 -3.020490867071005781e+00 -7.063400000000000234e-02 -2.997032009376604744e+00 -6.778700000000000003e-02 -2.993515063307591983e+00 -1.000939999999999885e-01 -3.016970697067113960e+00 -1.029410000000000047e-01 -3.016673350655395769e+00 -1.052099999999999980e-01 -2.993366180933850540e+00 -1.012320000000000025e-01 -2.988451430503528350e+00 -1.333540000000000003e-01 -3.011754085023580441e+00 -1.373319999999999819e-01 -3.011357863027227300e+00 -1.395860000000000156e-01 -2.988121750038867930e+00 -1.344840000000000202e-01 -2.981949863251920796e+00 -1.663600000000000079e-01 -3.005049476279062048e+00 -1.714610000000000023e-01 -3.004556496895482542e+00 -1.736959999999999893e-01 -2.981702890860188138e+00 -1.674809999999999910e-01 -2.974023894128074996e+00 -1.990490000000000037e-01 -2.996870381410558171e+00 -2.052649999999999753e-01 -2.996281368108780985e+00 -2.074759999999999938e-01 -2.973728259248752170e+00 -2.001579999999999748e-01 -2.964660815322974763e+00 -2.313600000000000101e-01 -2.987232463341812583e+00 -2.386770000000000003e-01 -2.986548141768861964e+00 -2.408600000000000185e-01 -2.964344863811784414e+00 -2.324539999999999940e-01 -2.953961398297178853e+00 -2.632300000000000195e-01 -2.976154255184515929e+00 -2.716350000000000153e-01 -2.975375333992480442e+00 -2.737859999999999738e-01 -2.953571252549659132e+00 -2.643079999999999874e-01 -2.941862652358219421e+00 -2.945989999999999998e-01 -2.963656386303281653e+00 -3.040769999999999862e-01 -2.962784989008413028e+00 -3.061909999999999910e-01 -2.941426659002225996e+00 -2.956590000000000051e-01 -2.928417106288062843e+00 -3.254070000000000018e-01 -2.949763071809159865e+00 -3.359390000000000431e-01 -2.948801343380880624e+00 -3.380129999999999524e-01 -2.927935306141395522e+00 -3.264469999999999872e-01 -2.913649729590719772e+00 -3.555960000000000232e-01 -2.934501378337782462e+00 -3.671619999999999884e-01 -2.933450727161458715e+00 -3.691920000000000202e-01 -2.913122788147675557e+00 -3.566139999999999866e-01 -2.897588276879977887e+00 -3.851070000000000326e-01 -2.917900461640007936e+00 -3.976850000000000107e-01 -2.917674381907263914e+00 -3.990020000000000233e-01 -2.896780664414922324e+00 -3.865560000000000107e-01 -2.881175340214995995e+00 -4.231099999999999861e-01 -2.903777601803601005e+00 -4.315220000000000167e-01 -2.903329301636539128e+00 -4.328899999999999970e-01 -2.880654819392295174e+00 -4.246979999999999644e-01 -2.871594062691905869e+00 -4.634230000000000294e-01 -2.895260149838732033e+00 -4.673419999999999797e-01 -2.895054712512507678e+00 -4.687679999999999625e-01 -2.871356378445165003e+00 -4.650779999999999914e-01 -2.869115048167717230e+00 -5.047989999999999977e-01 -2.893059712127533434e+00 -5.041050000000000253e-01 --4.631197200000000125e-01 3.333333999999998909e-02 --2.350119850000000066e-01 3.333332999999999435e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_RippleV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_RippleV0.txt deleted file mode 100644 index df330f5f5..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_RippleV0.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = RippleV0 -5.000000000000000000e+00 6.000000000000000000e+00 -2.436000100788996203e+00 8.359999999999999654e-01 -2.436000100788996203e+00 8.059940000000000992e-01 -2.714000046877118155e+00 8.059940000000000992e-01 -2.719999914875182778e+00 8.119939999999999936e-01 -2.719999914875182778e+00 8.270000000000000684e-01 -0.000000000000000000e+00 1.706749418153607339e-02 -1.047197551196597631e+00 1.706749418153608033e-02 -2.094395102393195263e+00 1.706749418153563624e-02 -3.141592653589793116e+00 1.706749418153563624e-02 --2.094395102393196151e+00 1.706749418153563624e-02 --1.047197551196597631e+00 1.706749418153563624e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_RippleV1.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_RippleV1.txt deleted file mode 100644 index 3fae698ac..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_RippleV1.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = RippleV1 -8.000000000000000000e+00 6.000000000000000000e+00 -2.436000100788996203e+00 8.359999999999999654e-01 -2.436000100788996203e+00 8.059940000000000992e-01 -2.714000046877118155e+00 8.059940000000000992e-01 -2.716321257938758560e+00 8.064679999999999627e-01 -2.718242324210628613e+00 8.077509999999999968e-01 -2.719527210485123803e+00 8.096740000000000048e-01 -2.719999914875182778e+00 8.119939999999999936e-01 -2.719999914875182778e+00 8.270000000000000684e-01 -0.000000000000000000e+00 1.706749418153607339e-02 -1.047197551196597631e+00 1.706749418153608033e-02 -2.094395102393195263e+00 1.706749418153563624e-02 -3.141592653589793116e+00 1.706749418153563624e-02 --2.094395102393196151e+00 1.706749418153563624e-02 --1.047197551196597631e+00 1.706749418153563624e-02 diff --git a/tofu/geom/inputs/TFG_PFC_ExpWEST_VDEV0.txt b/tofu/geom/inputs/TFG_PFC_ExpWEST_VDEV0.txt deleted file mode 100644 index 7826b0667..000000000 --- a/tofu/geom/inputs/TFG_PFC_ExpWEST_VDEV0.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Cls = PFC -# Exp = WEST -# Name = VDEV0 -4.000000000000000000e+00 2.400000000000000000e+01 -2.766000000000000014e+00 7.491999999999999771e-01 -2.766000000000000014e+00 8.511999999999999567e-01 -2.455999999999999961e+00 8.511999999999999567e-01 -2.455999999999999961e+00 7.491999999999999771e-01 -2.783841192613706883e-01 4.458062045193411649e-02 -4.197475815363611584e-01 4.458062045193411649e-02 -6.274499696602365839e-01 4.458062045193411649e-02 -7.688134319352269985e-01 4.458062045193411649e-02 -1.325581670457968375e+00 4.458062045193411649e-02 -1.466945132732958790e+00 4.458062045193411649e-02 -1.674647520856834326e+00 4.458062045193411649e-02 -1.816010983131824741e+00 4.458062045193411649e-02 -2.372779221654566228e+00 4.458062045193411649e-02 -2.514142683929556199e+00 4.458062045193411649e-02 -2.721845072053431736e+00 4.458062045193411649e-02 -2.863208534328422594e+00 4.458062045193411649e-02 --2.863208534328423038e+00 4.458062045193411649e-02 --2.721845072053432180e+00 4.458062045193411649e-02 --2.514142683929557531e+00 4.458062045193411649e-02 --2.372779221654566673e+00 4.458062045193411649e-02 --1.816010983131824519e+00 4.458062045193500467e-02 --1.674647520856834548e+00 4.458062045193500467e-02 --1.466945132732959012e+00 4.458062045193500467e-02 --1.325581670457969041e+00 4.458062045193500467e-02 --7.688134319352272206e-01 4.458062045193500467e-02 --6.274499696602371390e-01 4.458062045193500467e-02 --4.197475815363607698e-01 4.458062045193500467e-02 --2.783841192613707993e-01 4.458062045193500467e-02 diff --git a/tofu/geom/inputs/TFG_PlasmaDomain_ExpWEST_Sep.txt b/tofu/geom/inputs/TFG_PlasmaDomain_ExpWEST_Sep.txt deleted file mode 100644 index aeedb0ebc..000000000 --- a/tofu/geom/inputs/TFG_PlasmaDomain_ExpWEST_Sep.txt +++ /dev/null @@ -1,1004 +0,0 @@ -# Cls = PlasmaDomain -# Exp = WEST -# Name = Sep -1.000000000000000000e+03 0.000000000000000000e+00 -3.005648536124243542e+00 2.084322371406848590e-02 -3.005638414120836988e+00 2.397626895148138870e-02 -3.005628292117429989e+00 2.710931418889429151e-02 -3.005618170114023435e+00 3.024235942630719431e-02 -3.005608048110616881e+00 3.337540466372009712e-02 -3.005597926107209883e+00 3.650844990113299993e-02 -3.005587804103803329e+00 3.964149513854590273e-02 -3.005569500373650893e+00 4.277697735788336258e-02 -3.005428470742310676e+00 4.594901430608907406e-02 -3.005287441110970903e+00 4.912105125429479247e-02 -3.005146411479630686e+00 5.229308820250050394e-02 -3.005005381848290913e+00 5.546512515070622235e-02 -3.004864352216951140e+00 5.863716209891194076e-02 -3.004723322585610923e+00 6.180919904711765223e-02 -3.004583281307685372e+00 6.476719996956600833e-02 -3.004450158503658042e+00 6.622694871171286302e-02 -3.004317035699631155e+00 6.768669745385971770e-02 -3.004183912895604269e+00 6.914644619600657238e-02 -3.004050790091576939e+00 7.060619493815342707e-02 -3.003917667287550053e+00 7.206594368030028175e-02 -3.003784544483523167e+00 7.352569242244713643e-02 -3.003638797490480794e+00 7.508036061592751609e-02 -3.003438345678373533e+00 7.704634643185323539e-02 -3.003237893866265829e+00 7.901233224777896857e-02 -3.003037442054158124e+00 8.097831806370468788e-02 -3.002836990242050863e+00 8.294430387963040718e-02 -3.002636538429943158e+00 8.491028969555612649e-02 -3.002436086617835453e+00 8.687627551148184579e-02 -3.002176682716541478e+00 8.915697982327112914e-02 -3.001740422547688247e+00 9.238183962265110460e-02 -3.001304162378834572e+00 9.560669942203108007e-02 -3.000867902209981342e+00 9.883155922141105554e-02 -3.000431642041127667e+00 1.020564190207910310e-01 -2.999995381872274436e+00 1.052812788201709926e-01 -2.999559121703420761e+00 1.085061386195509681e-01 -2.999091089115812014e+00 1.116592470112286323e-01 -2.998553157206941044e+00 1.146545023059611784e-01 -2.998015225298070519e+00 1.176497576006937107e-01 -2.997477293389199993e+00 1.206450128954262707e-01 -2.996939361480329023e+00 1.236402681901588169e-01 -2.996401429571458497e+00 1.266355234848913491e-01 -2.995863497662587527e+00 1.296307787796238953e-01 -2.995099482313898775e+00 1.333421509447535735e-01 -2.993958661232178908e+00 1.382470512272118146e-01 -2.992817840150459041e+00 1.431519515096700002e-01 -2.991677019068739174e+00 1.480568517921282135e-01 -2.990536197987019307e+00 1.529617520745864545e-01 -2.989395376905299440e+00 1.578666523570446678e-01 -2.988254555823579572e+00 1.627715526395028811e-01 -2.987217423516842718e+00 1.668743650598397965e-01 -2.986313605349368849e+00 1.699459216574493725e-01 -2.985409787181895425e+00 1.730174782550589763e-01 -2.984505969014421556e+00 1.760890348526685523e-01 -2.983602150846947687e+00 1.791605914502781283e-01 -2.982698332679474262e+00 1.822321480478877320e-01 -2.981794514512000394e+00 1.853037046454973080e-01 -2.981293769391726300e+00 1.869850382283283208e-01 -2.981196097318651095e+00 1.872761487963807703e-01 -2.981098425245576333e+00 1.875672593644332198e-01 -2.981000753172501128e+00 1.878583699324856693e-01 -2.980903081099426366e+00 1.881494805005381188e-01 -2.980805409026351604e+00 1.884405910685905683e-01 -2.980707736953276399e+00 1.887317016366430178e-01 -2.979891184241582724e+00 1.910752976927962143e-01 -2.978515502144296612e+00 1.950152713508055968e-01 -2.977139820047010943e+00 1.989552450088149793e-01 -2.975764137949724830e+00 2.028952186668243063e-01 -2.974388455852438717e+00 2.068351923248336888e-01 -2.973012773755152605e+00 2.107751659828430157e-01 -2.971637091657866936e+00 2.147151396408524260e-01 -2.970393280911519440e+00 2.180108494281801923e-01 -2.969228592975735825e+00 2.209200008930989889e-01 -2.968063905039952211e+00 2.238291523580178133e-01 -2.966899217104168152e+00 2.267383038229366377e-01 -2.965734529168384537e+00 2.296474552878554065e-01 -2.964569841232600478e+00 2.325566067527742309e-01 -2.963405153296816863e+00 2.354657582176930553e-01 -2.962970586574493748e+00 2.365336808823980952e-01 -2.962867893131016395e+00 2.367646813651878845e-01 -2.962765199687539042e+00 2.369956818479776461e-01 -2.962662506244062133e+00 2.372266823307674355e-01 -2.962559812800584780e+00 2.374576828135571971e-01 -2.962457119357107427e+00 2.376886832963469864e-01 -2.962354425913630074e+00 2.379196837791367480e-01 -2.961214215789543580e+00 2.404299035679735019e-01 -2.959728166771920410e+00 2.436998631254926051e-01 -2.958242117754297240e+00 2.469698226830117083e-01 -2.956756068736674070e+00 2.502397822405307837e-01 -2.955270019719050900e+00 2.535097417980498591e-01 -2.953783970701427730e+00 2.567797013555689900e-01 -2.952297921683804560e+00 2.600496609130880099e-01 -2.950865383448767254e+00 2.629456746680623458e-01 -2.949445193855865899e+00 2.657553932378339812e-01 -2.948025004262964099e+00 2.685651118076055610e-01 -2.946604814670062300e+00 2.713748303773772519e-01 -2.945184625077160501e+00 2.741845489471488317e-01 -2.943764435484258701e+00 2.769942675169205226e-01 -2.942344245891357346e+00 2.798039860866921580e-01 -2.940296309166996469e+00 2.834348307018639823e-01 -2.938158694280998073e+00 2.871829790378073177e-01 -2.936021079395000122e+00 2.909311273737505976e-01 -2.933883464509002170e+00 2.946792757096938775e-01 -2.931745849623004219e+00 2.984274240456372129e-01 -2.929608234737006267e+00 3.021755723815804928e-01 -2.927470619851008315e+00 3.059237207175238282e-01 -2.927158514514890175e+00 3.064441360801789527e-01 -2.926968109815430097e+00 3.067493692446149334e-01 -2.926777705115970463e+00 3.070546024090509141e-01 -2.926587300416510384e+00 3.073598355734868948e-01 -2.926396895717050750e+00 3.076650687379228755e-01 -2.926206491017590672e+00 3.079703019023588562e-01 -2.926016086318131038e+00 3.082755350667948369e-01 -2.924126153576449560e+00 3.112308904111747432e-01 -2.922236220834768528e+00 3.141862457555546495e-01 -2.920346288093087050e+00 3.171416010999345003e-01 -2.918456355351406017e+00 3.200969564443144066e-01 -2.916566422609724540e+00 3.230523117886942575e-01 -2.914676489868043507e+00 3.260076671330741638e-01 -2.912854521178554812e+00 3.288524199057545339e-01 -2.912052013271956508e+00 3.300381341029421933e-01 -2.911249505365357759e+00 3.312238483001299638e-01 -2.910446997458759455e+00 3.324095624973176788e-01 -2.909644489552160707e+00 3.335952766945053383e-01 -2.908841981645562402e+00 3.347809908916930532e-01 -2.908039473738963654e+00 3.359667050888807682e-01 -2.907179997415981987e+00 3.372188505568199379e-01 -2.905921742178315892e+00 3.389360149200189576e-01 -2.904663486940649797e+00 3.406531792832180328e-01 -2.903405231702983702e+00 3.423703436464171634e-01 -2.902146976465317607e+00 3.440875080096162386e-01 -2.900888721227651956e+00 3.458046723728153138e-01 -2.899630465989985861e+00 3.475218367360143334e-01 -2.898343513857292830e+00 3.492603860737117372e-01 -2.896932208512817297e+00 3.510916036342350277e-01 -2.895520903168342208e+00 3.529228211947582627e-01 -2.894109597823866675e+00 3.547540387552815533e-01 -2.892698292479391142e+00 3.565852563158047883e-01 -2.891286987134915609e+00 3.584164738763280789e-01 -2.889875681790440076e+00 3.602476914368513694e-01 -2.888682202090218976e+00 3.617960997404173207e-01 -2.888142199322759396e+00 3.624960802731112541e-01 -2.887602196555300260e+00 3.631960608058052431e-01 -2.887062193787841125e+00 3.638960413384991766e-01 -2.886522191020381989e+00 3.645960218711931100e-01 -2.885982188252922853e+00 3.652960024038870435e-01 -2.885442185485463717e+00 3.659959829365810324e-01 -2.884389410088742611e+00 3.672902182623003497e-01 -2.882208534907643838e+00 3.698918141326751896e-01 -2.880027659726545508e+00 3.724934100030501405e-01 -2.877846784545447179e+00 3.750950058734250914e-01 -2.875665909364348405e+00 3.776966017438000423e-01 -2.873485034183250075e+00 3.802981976141749931e-01 -2.871304159002151746e+00 3.828997934845499440e-01 -2.869069415079492646e+00 3.854914961048540034e-01 -2.866744889920898931e+00 3.880667099750400029e-01 -2.864420364762305216e+00 3.906419238452260023e-01 -2.862095839603711500e+00 3.932171377154120018e-01 -2.859771314445117785e+00 3.957923515855980567e-01 -2.857446789286524069e+00 3.983675654557840007e-01 -2.855122264127930354e+00 4.009427793259700001e-01 -2.853448940958282165e+00 4.027536642368541031e-01 -2.852612877488706733e+00 4.035818404857786645e-01 -2.851776814019130857e+00 4.044100167347032260e-01 -2.850940750549555425e+00 4.052381929836277319e-01 -2.850104687079979549e+00 4.060663692325522933e-01 -2.849268623610404116e+00 4.068945454814768548e-01 -2.848432560140828684e+00 4.077227217304014162e-01 -2.847207017448307731e+00 4.089298558614924972e-01 -2.845591995532841700e+00 4.105159478747501534e-01 -2.843976973617375226e+00 4.121020398880078095e-01 -2.842361951701909195e+00 4.136881319012654656e-01 -2.840746929786443165e+00 4.152742239145231218e-01 -2.839131907870977134e+00 4.168603159277807779e-01 -2.837516885955511103e+00 4.184464079410384341e-01 -2.835263594301548729e+00 4.205710591129267484e-01 -2.832513870628756703e+00 4.231145896304167042e-01 -2.829764146955964677e+00 4.256581201479066601e-01 -2.827014423283172651e+00 4.282016506653966159e-01 -2.824264699610380180e+00 4.307451811828866273e-01 -2.821514975937588154e+00 4.332887117003765276e-01 -2.818765252264796128e+00 4.358322422178664834e-01 -2.817586177962072558e+00 4.369147451989834896e-01 -2.817349493281390505e+00 4.371206316582767482e-01 -2.817112808600708007e+00 4.373265181175700067e-01 -2.816876123920025954e+00 4.375324045768632653e-01 -2.816639439239343901e+00 4.377382910361564683e-01 -2.816402754558661403e+00 4.379441774954497268e-01 -2.816166069877979350e+00 4.381500639547429854e-01 -2.814609630395887852e+00 4.394831116683164396e-01 -2.812453302367701191e+00 4.413285054065627655e-01 -2.810296974339514531e+00 4.431738991448090359e-01 -2.808140646311327870e+00 4.450192928830553063e-01 -2.805984318283141210e+00 4.468646866213016322e-01 -2.803827990254954550e+00 4.487100803595479581e-01 -2.801671662226767889e+00 4.505554740977942285e-01 -2.798939412769215540e+00 4.527523004862394340e-01 -2.796015189501875220e+00 4.550662710914176734e-01 -2.793090966234534900e+00 4.573802416965959128e-01 -2.790166742967194136e+00 4.596942123017741522e-01 -2.787242519699853815e+00 4.620081829069523915e-01 -2.784318296432513051e+00 4.643221535121305754e-01 -2.781394073165172731e+00 4.666361241173088148e-01 -2.777562030880579513e+00 4.693646137902219850e-01 -2.773520491899696960e+00 4.721887617095355538e-01 -2.769478952918814851e+00 4.750129096288490671e-01 -2.765437413937932298e+00 4.778370575481625804e-01 -2.761395874957050189e+00 4.806612054674760381e-01 -2.757354335976167636e+00 4.834853533867896069e-01 -2.753312796995285527e+00 4.863095013061031202e-01 -2.752116824038762566e+00 4.871204899992512827e-01 -2.751327360514291165e+00 4.876438845172329506e-01 -2.750537896989819764e+00 4.881672790352146185e-01 -2.749748433465347919e+00 4.886906735531962864e-01 -2.748958969940876518e+00 4.892140680711780099e-01 -2.748169506416405117e+00 4.897374625891596778e-01 -2.747380042891933272e+00 4.902608571071414012e-01 -2.745064375322372463e+00 4.917132726777100338e-01 -2.742646960816472745e+00 4.932276229851177973e-01 -2.740229546310572584e+00 4.947419732925255609e-01 -2.737812131804672422e+00 4.962563235999333244e-01 -2.735394717298772260e+00 4.977706739073410880e-01 -2.732977302792872543e+00 4.992850242147489070e-01 -2.730559888286972381e+00 5.007993745221566151e-01 -2.727682332095474393e+00 5.024768696280459412e-01 -2.724804775903975962e+00 5.041543647339352674e-01 -2.721927219712477974e+00 5.058318598398245935e-01 -2.719049663520979543e+00 5.075093549457139197e-01 -2.716172107329481555e+00 5.091868500516032459e-01 -2.713294551137983568e+00 5.108643451574925720e-01 -2.710562324976676596e+00 5.124550247362874567e-01 -2.710010049268238408e+00 5.127434714086657186e-01 -2.709457773559800220e+00 5.130319180810439805e-01 -2.708905497851362032e+00 5.133203647534222425e-01 -2.708353222142923844e+00 5.136088114258005044e-01 -2.707800946434485656e+00 5.138972580981788774e-01 -2.707248670726047468e+00 5.141857047705571393e-01 -2.706212822233517556e+00 5.147230022244906333e-01 -2.701791964252346023e+00 5.170022551493104190e-01 -2.697371106271175378e+00 5.192815080741300937e-01 -2.692950248290003845e+00 5.215607609989499904e-01 -2.688529390308832756e+00 5.238400139237697761e-01 -2.684108532327661667e+00 5.261192668485895618e-01 -2.679687674346490578e+00 5.283985197734093475e-01 -2.675601977203593052e+00 5.304739510463952756e-01 -2.672968643693213853e+00 5.316661551614344505e-01 -2.670335310182834210e+00 5.328583592764736254e-01 -2.667701976672455011e+00 5.340505633915128003e-01 -2.665068643162075368e+00 5.352427675065519752e-01 -2.662435309651696169e+00 5.364349716215911501e-01 -2.659801976141316970e+00 5.376271757366303250e-01 -2.657169294044826824e+00 5.388037894306570985e-01 -2.654538566190006499e+00 5.399336318616467789e-01 -2.651907838335185730e+00 5.410634742926363483e-01 -2.649277110480364961e+00 5.421933167236260287e-01 -2.646646382625544192e+00 5.433231591546155981e-01 -2.644015654770723422e+00 5.444530015856052785e-01 -2.641384926915902653e+00 5.455828440165949589e-01 -2.638743083576954529e+00 5.466720492784776786e-01 -2.636076786172925512e+00 5.476718527683254178e-01 -2.633410488768896940e+00 5.486716562581731571e-01 -2.630744191364867923e+00 5.496714597480208964e-01 -2.628077893960839351e+00 5.506712632378685246e-01 -2.625411596556810334e+00 5.516710667277162639e-01 -2.622745299152781762e+00 5.526708702175640031e-01 -2.619857809824167827e+00 5.537213307088925118e-01 -2.616601667287912214e+00 5.548562195360227101e-01 -2.613345524751657045e+00 5.559911083631527973e-01 -2.610089382215401432e+00 5.571259971902827735e-01 -2.606833239679146264e+00 5.582608860174129717e-01 -2.603577097142890651e+00 5.593957748445430589e-01 -2.600320954606635482e+00 5.605306636716731461e-01 -2.598252021322631666e+00 5.612466601517900333e-01 -2.597709499934379718e+00 5.614240807571756475e-01 -2.597166978546127769e+00 5.616015013625612617e-01 -2.596624457157875820e+00 5.617789219679469870e-01 -2.596081935769623872e+00 5.619563425733326012e-01 -2.595539414381372367e+00 5.621337631787182154e-01 -2.594996892993120419e+00 5.623111837841038296e-01 -2.592711590823443046e+00 5.630175446056734367e-01 -2.588683507872339806e+00 5.642528456434270367e-01 -2.584655424921236122e+00 5.654881466811806368e-01 -2.580627341970132882e+00 5.667234477189341257e-01 -2.576599259019029198e+00 5.679587487566877257e-01 -2.572571176067926402e+00 5.691940497944413258e-01 -2.568543093116822718e+00 5.704293508321948147e-01 -2.565223891406555268e+00 5.713653379294408863e-01 -2.562456041772493975e+00 5.720685252951811517e-01 -2.559688192138432239e+00 5.727717126609213061e-01 -2.556920342504370502e+00 5.734749000266614605e-01 -2.554152492870308766e+00 5.741780873924017259e-01 -2.551384643236247030e+00 5.748812747581418803e-01 -2.548616793602185293e+00 5.755844621238821457e-01 -2.546507108147246345e+00 5.760971659578416615e-01 -2.544792321199781604e+00 5.764955796727327941e-01 -2.543077534252316418e+00 5.768939933876239268e-01 -2.541362747304851233e+00 5.772924071025150594e-01 -2.539647960357386047e+00 5.776908208174060810e-01 -2.537933173409920862e+00 5.780892345322972137e-01 -2.536218386462456120e+00 5.784876482471883463e-01 -2.534319892261581053e+00 5.789080388578999870e-01 -2.532337894763700969e+00 5.793384189667120099e-01 -2.530355897265821330e+00 5.797687990755239218e-01 -2.528373899767941690e+00 5.801991791843358337e-01 -2.526391902270062051e+00 5.806295592931477456e-01 -2.524409904772181967e+00 5.810599394019597685e-01 -2.522427907274302328e+00 5.814903195107716805e-01 -2.519410744566729310e+00 5.820573828645183578e-01 -2.516048526789258499e+00 5.826700072999101421e-01 -2.512686309011787689e+00 5.832826317353018153e-01 -2.509324091234316878e+00 5.838952561706935995e-01 -2.505961873456846067e+00 5.845078806060852727e-01 -2.502599655679375257e+00 5.851205050414769460e-01 -2.499237437901904446e+00 5.857331294768686192e-01 -2.495425228241952897e+00 5.863161116040023213e-01 -2.491509174301428597e+00 5.868922531984609448e-01 -2.487593120360904742e+00 5.874683947929196792e-01 -2.483677066420380886e+00 5.880445363873783027e-01 -2.479761012479857030e+00 5.886206779818370372e-01 -2.475844958539333174e+00 5.891968195762956606e-01 -2.471928904598808874e+00 5.897729611707543951e-01 -2.468980595035201731e+00 5.900916305249491733e-01 -2.466170534668296721e+00 5.903735181305348467e-01 -2.463360474301391712e+00 5.906554057361206311e-01 -2.460550413934486702e+00 5.909372933417063045e-01 -2.457740353567581693e+00 5.912191809472919779e-01 -2.454930293200676683e+00 5.915010685528776513e-01 -2.452120232833771674e+00 5.917829561584633247e-01 -2.451143395385379176e+00 5.918569561275049962e-01 -2.450288772798220993e+00 5.919170969207769861e-01 -2.449434150211062367e+00 5.919772377140488651e-01 -2.448579527623904184e+00 5.920373785073208550e-01 -2.447724905036746001e+00 5.920975193005928450e-01 -2.446870282449587375e+00 5.921576600938648349e-01 -2.446015659862429192e+00 5.922178008871368249e-01 -2.442609292664417175e+00 5.924342102202658777e-01 -2.439202925466405603e+00 5.926506195533948196e-01 -2.435796558268393586e+00 5.928670288865238724e-01 -2.432390191070381569e+00 5.930834382196529253e-01 -2.428983823872369996e+00 5.932998475527819782e-01 -2.425577456674357979e+00 5.935162568859109200e-01 -2.422205518814354530e+00 5.937233921343927356e-01 -2.419350021024472941e+00 5.937914161131652158e-01 -2.416494523234591796e+00 5.938594400919378069e-01 -2.413639025444710207e+00 5.939274640707103980e-01 -2.410783527654828617e+00 5.939954880494829892e-01 -2.407928029864947472e+00 5.940635120282555803e-01 -2.405072532075065883e+00 5.941315360070280605e-01 -2.402482197733391445e+00 5.941873341405935482e-01 -2.401748007529164841e+00 5.941575513577094236e-01 -2.401013817324937794e+00 5.941277685748251880e-01 -2.400279627120711190e+00 5.940979857919410634e-01 -2.399545436916484142e+00 5.940682030090568277e-01 -2.398811246712257539e+00 5.940384202261727031e-01 -2.398077056508030935e+00 5.940086374432884675e-01 -2.396537716030735510e+00 5.939293778595365891e-01 -2.391509391036811927e+00 5.936357188053577039e-01 -2.386481066042887900e+00 5.933420597511788186e-01 -2.381452741048964317e+00 5.930484006970000443e-01 -2.376424416055040734e+00 5.927547416428211591e-01 -2.371396091061117151e+00 5.924610825886422738e-01 -2.366367766067193568e+00 5.921674235344634996e-01 -2.361363079282978283e+00 5.917495101326867291e-01 -2.356429307127888784e+00 5.909588336881163029e-01 -2.351495534972799728e+00 5.901681572435457657e-01 -2.346561762817710228e+00 5.893774807989753395e-01 -2.341627990662620729e+00 5.885868043544049133e-01 -2.336694218507531229e+00 5.877961279098343761e-01 -2.331760446352442173e+00 5.870054514652639499e-01 -2.326544419509767092e+00 5.858807257358799037e-01 -2.320707432354404354e+00 5.840210915799063374e-01 -2.314870445199041171e+00 5.821614574239327711e-01 -2.309033458043677989e+00 5.803018232679590938e-01 -2.303196470888315250e+00 5.784421891119855275e-01 -2.297359483732952068e+00 5.765825549560118501e-01 -2.291522496577589330e+00 5.747229208000382839e-01 -2.287735570237388050e+00 5.734976464162637733e-01 -2.287365411922456460e+00 5.733296383194877999e-01 -2.286995253607524425e+00 5.731616302227119375e-01 -2.286625095292592835e+00 5.729936221259359641e-01 -2.286254936977661245e+00 5.728256140291599907e-01 -2.285884778662729211e+00 5.726576059323840173e-01 -2.285514620347797621e+00 5.724895978356080439e-01 -2.284208159673194238e+00 5.718366804474895870e-01 -2.281697881679012330e+00 5.705603082562166195e-01 -2.279187603684830865e+00 5.692839360649436520e-01 -2.276677325690649401e+00 5.680075638736706845e-01 -2.274167047696467492e+00 5.667311916823977169e-01 -2.271656769702286027e+00 5.654548194911247494e-01 -2.269146491708104563e+00 5.641784472998516708e-01 -2.267628506276925027e+00 5.633890951358107024e-01 -2.267102813408747419e+00 5.630867629990014001e-01 -2.266577120540569368e+00 5.627844308621920977e-01 -2.266051427672391760e+00 5.624820987253829063e-01 -2.265525734804214153e+00 5.621797665885736039e-01 -2.265000041936036546e+00 5.618774344517643016e-01 -2.264474349067858494e+00 5.615751023149551102e-01 -2.263031812657309683e+00 5.606319051305594936e-01 -2.260876175713804503e+00 5.591902573535967313e-01 -2.258720538770299768e+00 5.577486095766339691e-01 -2.256564901826795033e+00 5.563069617996713179e-01 -2.254409264883290298e+00 5.548653140227085556e-01 -2.252253627939785563e+00 5.534236662457457934e-01 -2.250097990996280828e+00 5.519820184687830311e-01 -2.247649328205746144e+00 5.501495370424639431e-01 -2.245024849906993580e+00 5.480825554265311705e-01 -2.242400371608241461e+00 5.460155738105983980e-01 -2.239775893309488897e+00 5.439485921946656255e-01 -2.237151415010736777e+00 5.418816105787328530e-01 -2.234526936711984213e+00 5.398146289627999694e-01 -2.231902458413231649e+00 5.377476473468671969e-01 -2.229682804882223923e+00 5.357818824936901869e-01 -2.227647162609282194e+00 5.338621252599478062e-01 -2.225611520336340465e+00 5.319423680262053145e-01 -2.223575878063398292e+00 5.300226107924627117e-01 -2.221540235790456563e+00 5.281028535587203310e-01 -2.219504593517514390e+00 5.261830963249777282e-01 -2.217468951244572661e+00 5.242633390912353475e-01 -2.216027484695860306e+00 5.227291009193616445e-01 -2.214784076721891370e+00 5.213233691014442783e-01 -2.213540668747922435e+00 5.199176372835269122e-01 -2.212297260773953500e+00 5.185119054656094351e-01 -2.211053852799984565e+00 5.171061736476920689e-01 -2.209810444826015630e+00 5.157004418297747028e-01 -2.208567036852046694e+00 5.142947100118572257e-01 -2.206509703487057550e+00 5.118233974870650682e-01 -2.204264541185679160e+00 5.091061817222245489e-01 -2.202019378884300771e+00 5.063889659573843627e-01 -2.199774216582922381e+00 5.036717501925440654e-01 -2.197529054281543992e+00 5.009545344277036572e-01 -2.195283891980165603e+00 4.982373186628633599e-01 -2.193038729678787213e+00 4.955201028980229516e-01 -2.190419584388394902e+00 4.919373454103561083e-01 -2.187747012956714698e+00 4.882309391051424252e-01 -2.185074441525034494e+00 4.845245327999289642e-01 -2.182401870093354290e+00 4.808181264947155031e-01 -2.179729298661674086e+00 4.771117201895018201e-01 -2.177056727229993882e+00 4.734053138842883590e-01 -2.174384155798313678e+00 4.696989075790746759e-01 -2.173275113243891443e+00 4.681008310292461005e-01 -2.172270305947953339e+00 4.666433097964430843e-01 -2.171265498652015236e+00 4.651857885636400125e-01 -2.170260691356077132e+00 4.637282673308369962e-01 -2.169255884060139028e+00 4.622707460980339245e-01 -2.168251076764200924e+00 4.608132248652309637e-01 -2.167246269468262820e+00 4.593557036324279474e-01 -2.166559202006701490e+00 4.581878677997378024e-01 -2.165872134545140604e+00 4.570200319670477684e-01 -2.165185067083579273e+00 4.558521961343576234e-01 -2.164497999622017943e+00 4.546843603016675339e-01 -2.163810932160457057e+00 4.535165244689774444e-01 -2.163123864698895726e+00 4.523486886362873549e-01 -2.162356533265288761e+00 4.510430347694353026e-01 -2.160385242251000371e+00 4.476701103901545853e-01 -2.158413951236711981e+00 4.442971860108740345e-01 -2.156442660222423591e+00 4.409242616315934837e-01 -2.154471369208135201e+00 4.375513372523127664e-01 -2.152500078193846811e+00 4.341784128730322712e-01 -2.150528787179557977e+00 4.308054884937515538e-01 -2.148548618256142628e+00 4.273704905892967698e-01 -2.146506303968836793e+00 4.235009780086223530e-01 -2.144463989681531402e+00 4.196314654279477696e-01 -2.142421675394226011e+00 4.157619528472734083e-01 -2.140379361106920175e+00 4.118924402665988249e-01 -2.138337046819614784e+00 4.080229276859244081e-01 -2.136294732532309393e+00 4.041534151052500468e-01 -2.134333023786515238e+00 4.004072058288959401e-01 -2.132720605720605178e+00 3.971953108712641956e-01 -2.131108187654694675e+00 3.939834159136321734e-01 -2.129495769588784615e+00 3.907715209560004288e-01 -2.127883351522874555e+00 3.875596259983684622e-01 -2.126270933456964496e+00 3.843477310407366621e-01 -2.124658515391053992e+00 3.811358360831048619e-01 -2.123043228547520478e+00 3.778099223786478555e-01 -2.121419335371117487e+00 3.741419524337160074e-01 -2.119795442194714052e+00 3.704739824887839372e-01 -2.118171549018310618e+00 3.668060125438520891e-01 -2.116547655841907183e+00 3.631380425989202410e-01 -2.114923762665504192e+00 3.594700726539882263e-01 -2.113299869489100757e+00 3.558021027090563781e-01 -2.111771127615903687e+00 3.522726941886633600e-01 -2.110451718609761329e+00 3.490481208022562787e-01 -2.109132309603618971e+00 3.458235474158491973e-01 -2.107812900597476613e+00 3.425989740294419494e-01 -2.106493491591333811e+00 3.393744006430348681e-01 -2.105174082585191453e+00 3.361498272566276202e-01 -2.103854673579049095e+00 3.329252538702205388e-01 -2.102936334781805972e+00 3.306791270565015428e-01 -2.102686446332727943e+00 3.300637445305961148e-01 -2.102436557883649915e+00 3.294483620046906869e-01 -2.102186669434571886e+00 3.288329794787852034e-01 -2.101936780985493858e+00 3.282175969528797754e-01 -2.101686892536415829e+00 3.276022144269743475e-01 -2.101437004087337801e+00 3.269868319010688640e-01 -2.100665735733006745e+00 3.249106214383991609e-01 -2.099224121786207764e+00 3.209562036284610009e-01 -2.097782507839408783e+00 3.170017858185230075e-01 -2.096340893892609802e+00 3.130473680085848476e-01 -2.094899279945810822e+00 3.090929501986469097e-01 -2.093457665999011397e+00 3.051385323887089718e-01 -2.092016052052212416e+00 3.011841145787708118e-01 -2.091156574668218582e+00 2.987746157920284640e-01 -2.090879233847029450e+00 2.979100360284818727e-01 -2.090601893025840319e+00 2.970454562649352814e-01 -2.090324552204651187e+00 2.961808765013887457e-01 -2.090047211383462056e+00 2.953162967378421544e-01 -2.089769870562273368e+00 2.944517169742954521e-01 -2.089492529741084237e+00 2.935871372107488608e-01 -2.088406688277874235e+00 2.900867888775083281e-01 -2.086692012981981481e+00 2.845363983233950567e-01 -2.084977337686088283e+00 2.789860077692817297e-01 -2.083262662390195530e+00 2.734356172151677922e-01 -2.081547987094302776e+00 2.678852266610544652e-01 -2.079833311798409579e+00 2.623348361069411938e-01 -2.078118636502516825e+00 2.567844455528278669e-01 -2.077015489998933706e+00 2.529610607679748102e-01 -2.076279260770736101e+00 2.501738794446776160e-01 -2.075543031542538497e+00 2.473866981213806715e-01 -2.074806802314340892e+00 2.445995167980837548e-01 -2.074070573086143288e+00 2.418123354747868103e-01 -2.073334343857945683e+00 2.390251541514898936e-01 -2.072598114629748078e+00 2.362379728281926716e-01 -2.071925055561365081e+00 2.336145051956214636e-01 -2.071280710201988562e+00 2.310654528770164640e-01 -2.070636364842612487e+00 2.285164005584114366e-01 -2.069992019483235968e+00 2.259673482398064370e-01 -2.069347674123859449e+00 2.234182959212011599e-01 -2.068703328764482929e+00 2.208692436025961325e-01 -2.068058983405106410e+00 2.183201912839911329e-01 -2.067388079396758283e+00 2.152689316977534628e-01 -2.066708322505419915e+00 2.120502696889715322e-01 -2.066028565614081103e+00 2.088316076801892129e-01 -2.065348808722742291e+00 2.056129456714072823e-01 -2.064669051831403923e+00 2.023942836626253516e-01 -2.063989294940065111e+00 1.991756216538434210e-01 -2.063309538048726743e+00 1.959569596450614903e-01 -2.062657060366204664e+00 1.926490694630653699e-01 -2.062010877885717353e+00 1.893205881641741306e-01 -2.061364695405230041e+00 1.859921068652828635e-01 -2.060718512924743173e+00 1.826636255663916242e-01 -2.060072330444255861e+00 1.793351442675003848e-01 -2.059426147963768550e+00 1.760066629686087847e-01 -2.058779965483281238e+00 1.726781816697175176e-01 -2.058180141362472959e+00 1.689727998496028116e-01 -2.057586939864475717e+00 1.652135750978847850e-01 -2.056993738366478475e+00 1.614543503461667306e-01 -2.056400536868481677e+00 1.576951255944482599e-01 -2.055807335370484434e+00 1.539359008427302333e-01 -2.055214133872487192e+00 1.501766760910121790e-01 -2.054620932374490394e+00 1.464174513392941523e-01 -2.054106855749815441e+00 1.422795256847576850e-01 -2.053598054116695604e+00 1.381163533033671897e-01 -2.053089252483575322e+00 1.339531809219766667e-01 -2.052580450850455485e+00 1.297900085405861714e-01 -2.052071649217335647e+00 1.256268361591956761e-01 -2.051562847584215366e+00 1.214636637778046951e-01 -2.051054045951095528e+00 1.173004913964141860e-01 -2.050991633757895727e+00 1.167861583623588939e-01 -2.050929221564695926e+00 1.162718253283035880e-01 -2.050866809371496124e+00 1.157574922942482959e-01 -2.050804397178296323e+00 1.152431592601929483e-01 -2.050741984985096522e+00 1.147288262261376562e-01 -2.050679572791896721e+00 1.142144931920823503e-01 -2.050603002558743171e+00 1.135236098708165969e-01 -2.050314061726280723e+00 1.101844722413928973e-01 -2.050025120893818276e+00 1.068453346119688230e-01 -2.049736180061355828e+00 1.035061969825451234e-01 -2.049447239228893380e+00 1.001670593531214376e-01 -2.049158298396431377e+00 9.682792172369773798e-02 -2.048869357563968929e+00 9.348878409427403835e-02 -2.048592309413675316e+00 9.021553604189470887e-02 -2.048398510038563547e+00 8.740351502882863499e-02 -2.048204710663452222e+00 8.459149401576254723e-02 -2.048010911288340452e+00 8.177947300269647335e-02 -2.047817111913229127e+00 7.896745198963038559e-02 -2.047623312538117357e+00 7.615543097656399252e-02 -2.047429513163005588e+00 7.334340996349791864e-02 -2.047250887269579600e+00 7.042365737573767770e-02 -2.047138013130122669e+00 6.703706796430293491e-02 -2.047025138990666182e+00 6.365047855286819212e-02 -2.046912264851209251e+00 6.026388914143307463e-02 -2.046799390711752764e+00 5.687729972999833183e-02 -2.046686516572295833e+00 5.349071031856358904e-02 -2.046573642432839346e+00 5.010412090712884625e-02 -2.046477342576608294e+00 4.677368992803292852e-02 -2.046430765570053989e+00 4.361173424595311127e-02 -2.046384188563499684e+00 4.044977856387364790e-02 -2.046337611556945379e+00 3.728782288179419147e-02 -2.046291034550391519e+00 3.412586719971472810e-02 -2.046244457543837214e+00 3.096391151763526473e-02 -2.046197880537282909e+00 2.780195583555545094e-02 -2.046189301744420597e+00 2.451036562137139108e-02 -2.046264319021680489e+00 2.093357943655721476e-02 -2.046339336298939937e+00 1.735679325174304191e-02 -2.046414353576199829e+00 1.378000706692886733e-02 -2.046489370853459722e+00 1.020322088211429550e-02 -2.046564388130719170e+00 6.626434697300120913e-03 -2.046639405407979062e+00 3.049648512485948065e-03 -2.046750859020594504e+00 -6.209438029514408996e-04 -2.046923039858802529e+00 -4.447879669427523899e-03 -2.047095220697010554e+00 -8.274815535904030822e-03 -2.047267401535218578e+00 -1.210175140238011274e-02 -2.047439582373426159e+00 -1.592868726885619465e-02 -2.047611763211634184e+00 -1.975562313533228004e-02 -2.047783944049842209e+00 -2.358255900180836195e-02 -2.047906512573484328e+00 -2.606568297939013124e-02 -2.047965293835542155e+00 -2.682104881410735456e-02 -2.048024075097599983e+00 -2.757641464882457788e-02 -2.048082856359657367e+00 -2.833178048354180120e-02 -2.048141637621715194e+00 -2.908714631825910779e-02 -2.048200418883773022e+00 -2.984251215297633111e-02 -2.048259200145830405e+00 -3.059787798769355444e-02 -2.048407737156000774e+00 -3.243748570980257984e-02 -2.048646029914283684e+00 -3.536133531930317486e-02 -2.048884322672566594e+00 -3.828518492880408908e-02 -2.049122615430849947e+00 -4.120903453830468410e-02 -2.049360908189132857e+00 -4.413288414780527219e-02 -2.049599200947415767e+00 -4.705673375730586028e-02 -2.049837493705698677e+00 -4.998058336680645530e-02 -2.049979625137704264e+00 -5.168466241177851334e-02 -2.050046964427049812e+00 -5.244003101767280572e-02 -2.050114303716394915e+00 -5.319539962356709117e-02 -2.050181643005740462e+00 -5.395076822946138356e-02 -2.050248982295086009e+00 -5.470613683535566901e-02 -2.050316321584431556e+00 -5.546150544125004467e-02 -2.050383660873776659e+00 -5.621687404714433706e-02 -2.050579290371388641e+00 -5.807235376762661522e-02 -2.050851893993960395e+00 -6.058790015686164876e-02 -2.051124497616532150e+00 -6.310344654609667536e-02 -2.051397101239103904e+00 -6.561899293533199340e-02 -2.051669704861675658e+00 -6.813453932456702000e-02 -2.051942308484247413e+00 -7.065008571380206048e-02 -2.052214912106818723e+00 -7.316563210303708709e-02 -2.052401522489560648e+00 -7.481076525646741804e-02 -2.052549045036016651e+00 -7.606025602998663093e-02 -2.052696567582472209e+00 -7.730974680350570505e-02 -2.052844090128927768e+00 -7.855923757702477916e-02 -2.052991612675383770e+00 -7.980872835054386716e-02 -2.053139135221839329e+00 -8.105821912406294127e-02 -2.053286657768294887e+00 -8.230770989758215417e-02 -2.053797038566606670e+00 -8.586645619403798779e-02 -2.054428372115537194e+00 -9.019495433147238506e-02 -2.055059705664467717e+00 -9.452345246890678232e-02 -2.055691039213398241e+00 -9.885195060634119346e-02 -2.056322372762328765e+00 -1.031804487437760764e-01 -2.056953706311258845e+00 -1.075089468812104876e-01 -2.057585039860189369e+00 -1.118374450186448849e-01 -2.058106706451535928e+00 -1.148939900444603257e-01 -2.058603065283440170e+00 -1.176570074291330564e-01 -2.059099424115344412e+00 -1.204200248138060786e-01 -2.059595782947248210e+00 -1.231830421984788093e-01 -2.060092141779152453e+00 -1.259460595831515262e-01 -2.060588500611056695e+00 -1.287090769678242430e-01 -2.061084859442960937e+00 -1.314720943524969876e-01 -2.061749413282501386e+00 -1.348340423881230765e-01 -2.062437994980276024e+00 -1.382815519453135522e-01 -2.063126576678050661e+00 -1.417290615025040279e-01 -2.063815158375825298e+00 -1.451765710596945314e-01 -2.064503740073599936e+00 -1.486240806168850070e-01 -2.065192321771374573e+00 -1.520715901740758713e-01 -2.065880903469149210e+00 -1.555190997312663470e-01 -2.066552482381142752e+00 -1.585783498892336107e-01 -2.067222927774084340e+00 -1.616117160872526937e-01 -2.067893373167025928e+00 -1.646450822852717766e-01 -2.068563818559967515e+00 -1.676784484832911648e-01 -2.069234263952908659e+00 -1.707118146813102477e-01 -2.069904709345850247e+00 -1.737451808793293029e-01 -2.070575154738791834e+00 -1.767785470773483858e-01 -2.071328033373220023e+00 -1.798380188954409042e-01 -2.072080912007648212e+00 -1.828974907135337558e-01 -2.072833790642076401e+00 -1.859569625316262742e-01 -2.073586669276505035e+00 -1.890164343497188204e-01 -2.074339547910933224e+00 -1.920759061678113389e-01 -2.075092426545361413e+00 -1.951353779859038573e-01 -2.075840035658009786e+00 -1.981590499874030797e-01 -2.076508601943964027e+00 -2.006457247399982269e-01 -2.077177168229918269e+00 -2.031323994925933740e-01 -2.077845734515872067e+00 -2.056190742451885212e-01 -2.078514300801826309e+00 -2.081057489977839459e-01 -2.079182867087780107e+00 -2.105924237503790930e-01 -2.079851433373734348e+00 -2.130790985029742401e-01 -2.080577080812974433e+00 -2.157493814671199717e-01 -2.081702296325214974e+00 -2.197049219121189334e-01 -2.082827511837456402e+00 -2.236604623571183392e-01 -2.083952727349696943e+00 -2.276160028021173287e-01 -2.085077942861937927e+00 -2.315715432471162905e-01 -2.086203158374178912e+00 -2.355270836921152522e-01 -2.087328373886419897e+00 -2.394826241371142139e-01 -2.088474820812374233e+00 -2.434185550412905075e-01 -2.089713270531085687e+00 -2.472695112685662222e-01 -2.090951720249797141e+00 -2.511204674958419369e-01 -2.092190169968508595e+00 -2.549714237231175962e-01 -2.093428619687220049e+00 -2.588223799503933109e-01 -2.094667069405931503e+00 -2.626733361776694142e-01 -2.095905519124642957e+00 -2.665242924049451290e-01 -2.097358107456662513e+00 -2.708924278775968197e-01 -2.099453111628606372e+00 -2.768121010863761056e-01 -2.101548115800549787e+00 -2.827317742951554469e-01 -2.103643119972493647e+00 -2.886514475039353989e-01 -2.105738124144437062e+00 -2.945711207127146847e-01 -2.107833128316380922e+00 -3.004907939214940260e-01 -2.109928132488324337e+00 -3.064104671302733118e-01 -2.111617861873733570e+00 -3.111606739145723610e-01 -2.112415986728767514e+00 -3.133380545650152338e-01 -2.113214111583801014e+00 -3.155154352154577735e-01 -2.114012236438834957e+00 -3.176928158659003687e-01 -2.114810361293868457e+00 -3.198701965163429639e-01 -2.115608486148901957e+00 -3.220475771667855036e-01 -2.116406611003935900e+00 -3.242249578172283209e-01 -2.117366913410737350e+00 -3.267893275592917424e-01 -2.118597511737151606e+00 -3.299986791207228931e-01 -2.119828110063565862e+00 -3.332080306821539883e-01 -2.121058708389980119e+00 -3.364173822435851391e-01 -2.122289306716394819e+00 -3.396267338050166229e-01 -2.123519905042809075e+00 -3.428360853664477181e-01 -2.124750503369223331e+00 -3.460454369278788689e-01 -2.132229509738527096e+00 -3.655093029755281386e-01 -2.147742183591547782e+00 -4.058718305054608844e-01 -2.163254857444570245e+00 -4.462343580353980710e-01 -2.178767531297591376e+00 -4.865968855653307612e-01 -2.194280205150612062e+00 -5.269594130952635069e-01 -2.209792879003632748e+00 -5.673219406251962527e-01 -2.225305552856653435e+00 -6.076844681551289984e-01 -2.251260009220911407e+00 -6.222778128952056731e-01 -2.287656248096401335e+00 -6.111019748454232792e-01 -2.324052486971890819e+00 -5.999261367956407742e-01 -2.360448725847380747e+00 -5.887502987458583803e-01 -2.396844964722870230e+00 -5.775744606960758754e-01 -2.433241203598364155e+00 -5.663986226462921492e-01 -2.469637442473853639e+00 -5.552227845965097552e-01 -2.487886398357222362e+00 -5.495893270983568391e-01 -2.492020800802276170e+00 -5.482666100292484801e-01 -2.496155203247330423e+00 -5.469438929601402322e-01 -2.500289605692384676e+00 -5.456211758910317622e-01 -2.504424008137438928e+00 -5.442984588219234032e-01 -2.508558410582492737e+00 -5.429757417528151553e-01 -2.512692813027546990e+00 -5.416530246837067963e-01 -2.516345679000618230e+00 -5.404363097983173603e-01 -2.519709623090499839e+00 -5.392831962231594556e-01 -2.523073567180381005e+00 -5.381300826480015509e-01 -2.526437511270262615e+00 -5.369769690728436462e-01 -2.529801455360143780e+00 -5.358238554976857415e-01 -2.533165399450025390e+00 -5.346707419225276148e-01 -2.536529343539907000e+00 -5.335176283473697101e-01 -2.541368249214576380e+00 -5.317870031585839596e-01 -2.546877591973240484e+00 -5.297938726908767437e-01 -2.552386934731904589e+00 -5.278007422231694168e-01 -2.557896277490569137e+00 -5.258076117554618678e-01 -2.563405620249232797e+00 -5.238144812877545409e-01 -2.568914963007896901e+00 -5.218213508200472139e-01 -2.574424305766561005e+00 -5.198282203523398870e-01 -2.578964679684376371e+00 -5.180784398612547914e-01 -2.583182063988576527e+00 -5.164097760290435879e-01 -2.587399448292775794e+00 -5.147411121968326064e-01 -2.591616832596975506e+00 -5.130724483646215139e-01 -2.595834216901174774e+00 -5.114037845324105325e-01 -2.600051601205374041e+00 -5.097351207001994400e-01 -2.604268985509574197e+00 -5.080664568679882365e-01 -2.606633322889616355e+00 -5.070898130233767453e-01 -2.608570034056391762e+00 -5.062728660989805896e-01 -2.610506745223167613e+00 -5.054559191745843227e-01 -2.612443456389943020e+00 -5.046389722501880559e-01 -2.614380167556718426e+00 -5.038220253257916781e-01 -2.616316878723494277e+00 -5.030050784013955223e-01 -2.618253589890269684e+00 -5.021881314769992555e-01 -2.620027103405255353e+00 -5.014290676736395946e-01 -2.621777302969985346e+00 -5.006782728875709410e-01 -2.623527502534715339e+00 -4.999274781015021762e-01 -2.625277702099445332e+00 -4.991766833154335226e-01 -2.627027901664175324e+00 -4.984258885293648134e-01 -2.628778101228905317e+00 -4.976750937432961597e-01 -2.630528300793635310e+00 -4.969242989572274505e-01 -2.634418396139758922e+00 -4.951232140918984670e-01 -2.638451151204641576e+00 -4.932521098879524279e-01 -2.642483906269524230e+00 -4.913810056840063334e-01 -2.646516661334406884e+00 -4.895099014800602388e-01 -2.650549416399289093e+00 -4.876387972761141443e-01 -2.654582171464172191e+00 -4.857676930721678277e-01 -2.658614926529054845e+00 -4.838965888682217886e-01 -2.661860595742556512e+00 -4.822353660264704911e-01 -2.665106264956058180e+00 -4.805741431847191936e-01 -2.668351934169560291e+00 -4.789129203429679515e-01 -2.671597603383062403e+00 -4.772516975012164875e-01 -2.674843272596564070e+00 -4.755904746594651900e-01 -2.678088941810065737e+00 -4.739292518177139479e-01 -2.681318922028912421e+00 -4.722693754092198160e-01 -2.684313567327935246e+00 -4.706296954995836113e-01 -2.687308212626958071e+00 -4.689900155899471845e-01 -2.690302857925980895e+00 -4.673503356803109798e-01 -2.693297503225003720e+00 -4.657106557706747196e-01 -2.696292148524026100e+00 -4.640709758610385149e-01 -2.699286793823048924e+00 -4.624312959514022547e-01 -2.702125483796797401e+00 -4.608706898179293909e-01 -2.703872486493624550e+00 -4.598636001176010790e-01 -2.705619489190451699e+00 -4.588565104172728226e-01 -2.707366491887278848e+00 -4.578494207169445107e-01 -2.709113494584105997e+00 -4.568423310166161988e-01 -2.710860497280933590e+00 -4.558352413162877759e-01 -2.712607499977760739e+00 -4.548281516159594640e-01 -2.714308041537654592e+00 -4.538417419463422475e-01 -2.715807251504171571e+00 -4.529449457431396486e-01 -2.717306461470688550e+00 -4.520481495399369942e-01 -2.718805671437205529e+00 -4.511513533367342288e-01 -2.720304881403722508e+00 -4.502545571335316299e-01 -2.721804091370239487e+00 -4.493577609303289755e-01 -2.723303301336756910e+00 -4.484609647271263766e-01 -2.725066863944411999e+00 -4.473781484205164305e-01 -2.727623484475481863e+00 -4.457372718036853865e-01 -2.730180105006551283e+00 -4.440963951868543425e-01 -2.732736725537621147e+00 -4.424555185700232984e-01 -2.735293346068690568e+00 -4.408146419531922544e-01 -2.737849966599760432e+00 -4.391737653363609883e-01 -2.740406587130830296e+00 -4.375328887195299443e-01 -2.742852446276343947e+00 -4.359287746702514288e-01 -2.745054630373635174e+00 -4.344055382695883871e-01 -2.747256814470925956e+00 -4.328823018689254010e-01 -2.749458998568217183e+00 -4.313590654682621928e-01 -2.751661182665508409e+00 -4.298358290675991511e-01 -2.753863366762799192e+00 -4.283125926669361649e-01 -2.756065550860090418e+00 -4.267893562662731233e-01 -2.758838086128649003e+00 -4.248204130443059556e-01 -2.762561206682653925e+00 -4.221086251201647821e-01 -2.766284327236658402e+00 -4.193968371960238861e-01 -2.770007447790662880e+00 -4.166850492718830457e-01 -2.773730568344667358e+00 -4.139732613477421497e-01 -2.777453688898671835e+00 -4.112614734236013092e-01 -2.781176809452676757e+00 -4.085496854994601357e-01 -2.784437546783936845e+00 -4.060765029030445339e-01 -2.787103791400239672e+00 -4.039100985851328818e-01 -2.789770036016542498e+00 -4.017436942672211742e-01 -2.792436280632845325e+00 -3.995772899493094665e-01 -2.795102525249148595e+00 -3.974108856313975369e-01 -2.797768769865451421e+00 -3.952444813134858292e-01 -2.800435014481754248e+00 -3.930780769955741771e-01 -2.802795690180729160e+00 -3.911188434924357527e-01 -2.804850796962375714e+00 -3.893667808040705558e-01 -2.806905903744022268e+00 -3.876147181157051369e-01 -2.808961010525668822e+00 -3.858626554273399401e-01 -2.811016117307315376e+00 -3.841105927389747432e-01 -2.813071224088962374e+00 -3.823585300506096019e-01 -2.815126330870608928e+00 -3.806064673622444050e-01 -2.816322198996426440e+00 -3.795715485507836773e-01 -2.816849770389932672e+00 -3.790944083102487094e-01 -2.817377341783438460e+00 -3.786172680697136861e-01 -2.817904913176944692e+00 -3.781401278291787182e-01 -2.818432484570450924e+00 -3.776629875886437504e-01 -2.818960055963957156e+00 -3.771858473481086715e-01 -2.819487627357463388e+00 -3.767087071075737037e-01 -2.820650144814610183e+00 -3.756442593357194326e-01 -2.822193629909941048e+00 -3.742274270450736684e-01 -2.823737115005271914e+00 -3.728105947544279042e-01 -2.825280600100603223e+00 -3.713937624637819179e-01 -2.826824085195934089e+00 -3.699769301731361537e-01 -2.828367570291264954e+00 -3.685600978824903340e-01 -2.829911055386595820e+00 -3.671432655918445698e-01 -2.832242546610962641e+00 -3.648965726180155023e-01 -2.834932222439437322e+00 -3.622726702427392365e-01 -2.837621898267911558e+00 -3.596487678674632482e-01 -2.840311574096385350e+00 -3.570248654921872600e-01 -2.843001249924859586e+00 -3.544009631169113272e-01 -2.845690925753333822e+00 -3.517770607416353390e-01 -2.848380601581808502e+00 -3.491531583663590732e-01 -2.852025725342933971e+00 -3.452001771830894294e-01 -2.855989331748276516e+00 -3.408041697304888262e-01 -2.859952938153619062e+00 -3.364081622778882230e-01 -2.863916544558962496e+00 -3.320121548252871757e-01 -2.867880150964305042e+00 -3.276161473726865725e-01 -2.871843757369647587e+00 -3.232201399200859693e-01 -2.875807363774990577e+00 -3.188241324674853105e-01 -2.878986375584951407e+00 -3.149521922221266701e-01 -2.881984327103671362e+00 -3.112011905630541198e-01 -2.884982278622390428e+00 -3.074501889039820135e-01 -2.887980230141109939e+00 -3.036991872449098517e-01 -2.890978181659829449e+00 -2.999481855858377455e-01 -2.893976133178548960e+00 -2.961971839267656392e-01 -2.896974084697268470e+00 -2.924461822676930889e-01 -2.898906717739702099e+00 -2.897981724103143031e-01 -2.900687162428380983e+00 -2.873077328103201822e-01 -2.902467607117059867e+00 -2.848172932103261168e-01 -2.904248051805738307e+00 -2.823268536103320514e-01 -2.906028496494417634e+00 -2.798364140103376529e-01 -2.907808941183096074e+00 -2.773459744103435876e-01 -2.909589385871774958e+00 -2.748555348103495222e-01 -2.911097838751712796e+00 -2.726646429998128007e-01 -2.912588158844401143e+00 -2.704937210419066096e-01 -2.914078478937089933e+00 -2.683227990840001409e-01 -2.915568799029778724e+00 -2.661518771260938943e-01 -2.917059119122467070e+00 -2.639809551681877031e-01 -2.918549439215155861e+00 -2.618100332102814565e-01 -2.920039759307844207e+00 -2.596391112523752653e-01 -2.921034677773913124e+00 -2.580154365235228231e-01 -2.922029596239982041e+00 -2.563917617946706029e-01 -2.923024514706050514e+00 -2.547680870658183827e-01 -2.924019433172119431e+00 -2.531444123369661070e-01 -2.925014351638188348e+00 -2.515207376081138868e-01 -2.926009270104256821e+00 -2.498970628792614723e-01 -2.927016396967336842e+00 -2.482472174268069431e-01 -2.928206649785583426e+00 -2.462048111203190559e-01 -2.929396902603829567e+00 -2.441624048138311409e-01 -2.930587155422076151e+00 -2.421199985073432259e-01 -2.931777408240322291e+00 -2.400775922008550889e-01 -2.932967661058568876e+00 -2.380351858943671739e-01 -2.934157913876815016e+00 -2.359927795878792867e-01 -2.935344106659096397e+00 -2.339514753084894483e-01 -2.936501879189619579e+00 -2.319178852187860629e-01 -2.937659651720143206e+00 -2.298842951290824832e-01 -2.938817424250666832e+00 -2.278507050393790978e-01 -2.939975196781190458e+00 -2.258171149496757402e-01 -2.941132969311713641e+00 -2.237835248599723825e-01 -2.942290741842237267e+00 -2.217499347702689971e-01 -2.943432045417884613e+00 -2.197099841170023493e-01 -2.944501983522399780e+00 -2.176424710216292857e-01 -2.945571921626914946e+00 -2.155749579262562499e-01 -2.946641859731430113e+00 -2.135074448308832140e-01 -2.947711797835945724e+00 -2.114399317355101504e-01 -2.948781735940460891e+00 -2.093724186401368648e-01 -2.949851674044976058e+00 -2.073049055447638289e-01 -2.950973406675627242e+00 -2.050738340059972131e-01 -2.952250522884685591e+00 -2.023520871370500240e-01 -2.953527639093744384e+00 -1.996303402681028072e-01 -2.954804755302802732e+00 -1.969085933991553128e-01 -2.956081871511861081e+00 -1.941868465302080959e-01 -2.957358987720919430e+00 -1.914650996612609068e-01 -2.958636103929978223e+00 -1.887433527923136900e-01 -2.959659616109339808e+00 -1.865437256773299357e-01 -2.960125199423369047e+00 -1.854927620210656269e-01 -2.960590782737398285e+00 -1.844417983648014292e-01 -2.961056366051427524e+00 -1.833908347085372037e-01 -2.961521949365457207e+00 -1.823398710522730060e-01 -2.961987532679486446e+00 -1.812889073960088082e-01 -2.962453115993515684e+00 -1.802379437397444717e-01 -2.963157178258923885e+00 -1.785747653430327653e-01 -2.964258705443296726e+00 -1.758912290455756089e-01 -2.965360232627669568e+00 -1.732076927481184803e-01 -2.966461759812042409e+00 -1.705241564506610463e-01 -2.967563286996415250e+00 -1.678406201532038899e-01 -2.968664814180788092e+00 -1.651570838557467336e-01 -2.969766341365160933e+00 -1.624735475582896049e-01 -2.970733612943660340e+00 -1.600311301951789500e-01 -2.971528270171750474e+00 -1.578987228905135987e-01 -2.972322927399840609e+00 -1.557663155858484694e-01 -2.973117584627931187e+00 -1.536339082811833678e-01 -2.973912241856021321e+00 -1.515015009765182386e-01 -2.974706899084111456e+00 -1.493690936718531370e-01 -2.975501556312201590e+00 -1.472366863671877857e-01 -2.976402483090551776e+00 -1.446174493929675842e-01 -2.977409679419162014e+00 -1.415113827491923937e-01 -2.978416875747772252e+00 -1.384053161054172310e-01 -2.979424072076382490e+00 -1.352992494616420405e-01 -2.980431268404992728e+00 -1.321931828178665169e-01 -2.981438464733602522e+00 -1.290871161740913542e-01 -2.982445661062212761e+00 -1.259810495303161637e-01 -2.983502658148438513e+00 -1.223798216066266792e-01 -2.984598389157254061e+00 -1.183934682430038549e-01 -2.985694120166069609e+00 -1.144071148793806003e-01 -2.986789851174885158e+00 -1.104207615157577899e-01 -2.987885582183700706e+00 -1.064344081521349794e-01 -2.988981313192516254e+00 -1.024480547885121551e-01 -2.990077044201331802e+00 -9.846170142488934462e-02 -2.990650351569371868e+00 -9.628117028614090189e-02 -2.990910204752946999e+00 -9.518413248231723245e-02 -2.991170057936522575e+00 -9.408709467849354913e-02 -2.991429911120097707e+00 -9.299005687466986581e-02 -2.991689764303672838e+00 -9.189301907084618248e-02 -2.991949617487247970e+00 -9.079598126702238814e-02 -2.992209470670823102e+00 -8.969894346319870482e-02 -2.992808057954299716e+00 -8.688264932450273648e-02 -2.993560615283185733e+00 -8.328487503359247035e-02 -2.994313172612071750e+00 -7.968710074268220422e-02 -2.995065729940957766e+00 -7.608932645177154952e-02 -2.995818287269843783e+00 -7.249155216086128339e-02 -2.996570844598729799e+00 -6.889377786995101727e-02 -2.997323401927615816e+00 -6.529600357904075114e-02 -2.997845140133148956e+00 -6.232842025382950846e-02 -2.998289938630898099e+00 -5.957090058385099834e-02 -2.998734737128647243e+00 -5.681338091387279354e-02 -2.999179535626396387e+00 -5.405586124389458874e-02 -2.999624334124145975e+00 -5.129834157391638394e-02 -3.000069132621895118e+00 -4.854082190393818608e-02 -3.000513931119644262e+00 -4.578330223395967596e-02 -3.000671737712429010e+00 -4.473682605952454538e-02 -3.000763315404068710e+00 -4.408520607636842725e-02 -3.000854893095707965e+00 -4.343358609321230218e-02 -3.000946470787347664e+00 -4.278196611005617711e-02 -3.001038048478987363e+00 -4.213034612689998959e-02 -3.001129626170626619e+00 -4.147872614374386452e-02 -3.001221203862266318e+00 -4.082710616058773945e-02 -3.001545053765985127e+00 -3.794810103272620166e-02 -3.001902085414287491e+00 -3.475089802704971892e-02 -3.002259117062589411e+00 -3.155369502137288923e-02 -3.002616148710891331e+00 -2.835649201569640648e-02 -3.002973180359193250e+00 -2.515928901001992721e-02 -3.003330212007495170e+00 -2.196208600434344793e-02 -3.003687243655797534e+00 -1.876488299866661477e-02 -3.003791386456098333e+00 -1.743493301750537530e-02 -3.003878669999866080e+00 -1.622946657131154116e-02 -3.003965953543633827e+00 -1.502400012511770529e-02 -3.004053237087401573e+00 -1.381853367892386941e-02 -3.004140520631168876e+00 -1.261306723272990343e-02 -3.004227804174936622e+00 -1.140760078653606756e-02 -3.004315087718704369e+00 -1.020213434034223342e-02 diff --git a/tofu/geom/inputs/TFG_Ves_ExpITER_V0.txt b/tofu/geom/inputs/TFG_Ves_ExpITER_V0.txt deleted file mode 100644 index 924641d30..000000000 --- a/tofu/geom/inputs/TFG_Ves_ExpITER_V0.txt +++ /dev/null @@ -1,554 +0,0 @@ -# Cls = Ves -# Exp = ITER -# Name = V0 -5.500000000000000000e+02 0.000000000000000000e+00 -4.099999999999999645e+00 -2.512000000000000011e+00 -3.954200000000000159e+00 -2.545100000000000140e+00 -3.971400000000000041e+00 -2.546200000000000241e+00 -3.988600000000000367e+00 -2.547299999999999898e+00 -4.005799999999999805e+00 -2.548399999999999999e+00 -4.022999999999999687e+00 -2.549500000000000099e+00 -4.040200000000000458e+00 -2.550600000000000200e+00 -4.057400000000000340e+00 -2.551700000000000301e+00 -4.074600000000000222e+00 -2.552799999999999958e+00 -4.091800000000000104e+00 -2.553900000000000059e+00 -4.108999999999999986e+00 -2.555000000000000160e+00 -4.118999999999999773e+00 -2.558100000000000041e+00 -4.129000000000000448e+00 -2.561199999999999921e+00 -4.139000000000000234e+00 -2.564300000000000246e+00 -4.149000000000000021e+00 -2.567400000000000126e+00 -4.159000000000000696e+00 -2.570500000000000007e+00 -4.169000000000000483e+00 -2.573599999999999888e+00 -4.179000000000000270e+00 -2.576699999999999768e+00 -4.189000000000000057e+00 -2.579800000000000093e+00 -4.199000000000000732e+00 -2.582899999999999974e+00 -4.209000000000000519e+00 -2.585999999999999854e+00 -4.218100000000000627e+00 -2.590999999999999748e+00 -4.227200000000000735e+00 -2.596000000000000085e+00 -4.236299999999999955e+00 -2.600999999999999979e+00 -4.245400000000000063e+00 -2.605999999999999872e+00 -4.254500000000000171e+00 -2.610999999999999766e+00 -4.263600000000000279e+00 -2.616000000000000103e+00 -4.272700000000000387e+00 -2.620999999999999996e+00 -4.281799999999999606e+00 -2.625999999999999890e+00 -4.290899999999999714e+00 -2.631000000000000227e+00 -4.299999999999999822e+00 -2.636000000000000121e+00 -4.307900000000000063e+00 -2.642800000000000260e+00 -4.315800000000000303e+00 -2.649599999999999955e+00 -4.323699999999999655e+00 -2.656400000000000095e+00 -4.331599999999999895e+00 -2.663200000000000234e+00 -4.339500000000000135e+00 -2.669999999999999929e+00 -4.347400000000000375e+00 -2.676800000000000068e+00 -4.355300000000000615e+00 -2.683600000000000207e+00 -4.363199999999999967e+00 -2.690400000000000347e+00 -4.371100000000000207e+00 -2.697200000000000042e+00 -4.379000000000000448e+00 -2.704000000000000181e+00 -4.385400000000000631e+00 -2.712200000000000166e+00 -4.391800000000000814e+00 -2.720400000000000151e+00 -4.398200000000000109e+00 -2.728600000000000136e+00 -4.404600000000000293e+00 -2.736800000000000122e+00 -4.411000000000000476e+00 -2.745000000000000107e+00 -4.417400000000000659e+00 -2.753200000000000092e+00 -4.423800000000000843e+00 -2.761400000000000077e+00 -4.430200000000000138e+00 -2.769600000000000062e+00 -4.436600000000000321e+00 -2.777800000000000047e+00 -4.443000000000000504e+00 -2.786000000000000032e+00 -4.447500000000000675e+00 -2.795300000000000118e+00 -4.452000000000000846e+00 -2.804600000000000204e+00 -4.456500000000000128e+00 -2.813899999999999846e+00 -4.461000000000000298e+00 -2.823199999999999932e+00 -4.465500000000000469e+00 -2.832500000000000018e+00 -4.470000000000000639e+00 -2.841800000000000104e+00 -4.474500000000000810e+00 -2.851100000000000190e+00 -4.479000000000000092e+00 -2.860399999999999832e+00 -4.483500000000000263e+00 -2.869699999999999918e+00 -4.488000000000000433e+00 -2.879000000000000004e+00 -4.490700000000000358e+00 -2.889100000000000001e+00 -4.493400000000000283e+00 -2.899199999999999999e+00 -4.496100000000000207e+00 -2.909299999999999997e+00 -4.498800000000000132e+00 -2.919399999999999995e+00 -4.501500000000000057e+00 -2.929499999999999993e+00 -4.504199999999999982e+00 -2.939599999999999991e+00 -4.506899999999999906e+00 -2.949699999999999989e+00 -4.509599999999999831e+00 -2.959799999999999986e+00 -4.512299999999999756e+00 -2.969899999999999984e+00 -4.514999999999999680e+00 -2.979999999999999982e+00 -4.515499999999999403e+00 -2.990400000000000169e+00 -4.516000000000000014e+00 -3.000799999999999912e+00 -4.516499999999999737e+00 -3.011200000000000099e+00 -4.517000000000000348e+00 -3.021599999999999842e+00 -4.517500000000000071e+00 -3.032000000000000028e+00 -4.517999999999999794e+00 -3.042400000000000215e+00 -4.518500000000000405e+00 -3.052799999999999958e+00 -4.519000000000000128e+00 -3.063200000000000145e+00 -4.519500000000000739e+00 -3.073599999999999888e+00 -4.520000000000000462e+00 -3.084000000000000075e+00 -4.518500000000000405e+00 -3.094300000000000050e+00 -4.517000000000000348e+00 -3.104600000000000026e+00 -4.515500000000000291e+00 -3.114900000000000002e+00 -4.514000000000000234e+00 -3.125199999999999978e+00 -4.512500000000000178e+00 -3.135500000000000398e+00 -4.511000000000000121e+00 -3.145800000000000374e+00 -4.509500000000000064e+00 -3.156100000000000350e+00 -4.508000000000000007e+00 -3.166400000000000325e+00 -4.506499999999999950e+00 -3.176700000000000301e+00 -4.504999999999999893e+00 -3.187000000000000277e+00 -4.501400000000000290e+00 -3.196800000000000086e+00 -4.497799999999999798e+00 -3.206600000000000339e+00 -4.494200000000000195e+00 -3.216400000000000148e+00 -4.490599999999999703e+00 -3.226200000000000401e+00 -4.487000000000000099e+00 -3.236000000000000210e+00 -4.483400000000000496e+00 -3.245800000000000018e+00 -4.479800000000000004e+00 -3.255600000000000271e+00 -4.476200000000000401e+00 -3.265400000000000080e+00 -4.472599999999999909e+00 -3.275200000000000333e+00 -4.469000000000000306e+00 -3.285000000000000142e+00 -4.437800000000000189e+00 -3.348899999999999988e+00 -4.406600000000000072e+00 -3.412799999999999834e+00 -4.375399999999999956e+00 -3.476700000000000124e+00 -4.344199999999999839e+00 -3.540599999999999969e+00 -4.313000000000000611e+00 -3.604499999999999815e+00 -4.281800000000000495e+00 -3.668400000000000105e+00 -4.250600000000000378e+00 -3.732299999999999951e+00 -4.219400000000000261e+00 -3.796199999999999797e+00 -4.188200000000000145e+00 -3.860100000000000087e+00 -4.157000000000000028e+00 -3.923999999999999932e+00 -4.159600000000000186e+00 -3.920500000000000096e+00 -4.162200000000000344e+00 -3.916999999999999815e+00 -4.164799999999999613e+00 -3.913499999999999979e+00 -4.167399999999999771e+00 -3.910000000000000142e+00 -4.169999999999999929e+00 -3.906500000000000306e+00 -4.172600000000000087e+00 -3.903000000000000025e+00 -4.175200000000000244e+00 -3.899500000000000188e+00 -4.177799999999999514e+00 -3.896000000000000352e+00 -4.180399999999999672e+00 -3.892500000000000071e+00 -4.182999999999999829e+00 -3.889000000000000234e+00 -4.213300000000000267e+00 -3.891400000000000414e+00 -4.243599999999999817e+00 -3.893800000000000150e+00 -4.273899999999999366e+00 -3.896200000000000330e+00 -4.304199999999999804e+00 -3.898600000000000065e+00 -4.334500000000000242e+00 -3.901000000000000245e+00 -4.364799999999999791e+00 -3.903400000000000425e+00 -4.395099999999999341e+00 -3.905800000000000161e+00 -4.425399999999999778e+00 -3.908200000000000340e+00 -4.455700000000000216e+00 -3.910600000000000076e+00 -4.485999999999999766e+00 -3.913000000000000256e+00 -4.501299999999999635e+00 -3.896700000000000053e+00 -4.516599999999999504e+00 -3.880400000000000293e+00 -4.531900000000000261e+00 -3.864100000000000090e+00 -4.547200000000000131e+00 -3.847800000000000331e+00 -4.562500000000000000e+00 -3.831500000000000128e+00 -4.577799999999999869e+00 -3.815199999999999925e+00 -4.593099999999999739e+00 -3.798900000000000166e+00 -4.608400000000000496e+00 -3.782599999999999962e+00 -4.623700000000000365e+00 -3.766300000000000203e+00 -4.639000000000000234e+00 -3.750000000000000000e+00 -4.647300000000000431e+00 -3.747399999999999842e+00 -4.655600000000000627e+00 -3.744800000000000129e+00 -4.663899999999999935e+00 -3.742199999999999971e+00 -4.672200000000000131e+00 -3.739600000000000257e+00 -4.680500000000000327e+00 -3.737000000000000099e+00 -4.688800000000000523e+00 -3.734399999999999942e+00 -4.697100000000000719e+00 -3.731800000000000228e+00 -4.705400000000000027e+00 -3.729200000000000070e+00 -4.713700000000000223e+00 -3.726600000000000357e+00 -4.722000000000000419e+00 -3.724000000000000199e+00 -4.730600000000000804e+00 -3.722900000000000098e+00 -4.739200000000000301e+00 -3.721799999999999997e+00 -4.747799999999999798e+00 -3.720700000000000340e+00 -4.756400000000000183e+00 -3.719600000000000239e+00 -4.765000000000000568e+00 -3.718500000000000139e+00 -4.773600000000000065e+00 -3.717400000000000038e+00 -4.782199999999999562e+00 -3.716299999999999937e+00 -4.790799999999999947e+00 -3.715200000000000280e+00 -4.799400000000000333e+00 -3.714100000000000179e+00 -4.807999999999999829e+00 -3.713000000000000078e+00 -4.816600000000000215e+00 -3.713600000000000012e+00 -4.825199999999999712e+00 -3.714199999999999946e+00 -4.833800000000000097e+00 -3.714799999999999880e+00 -4.842399999999999594e+00 -3.715399999999999814e+00 -4.850999999999999979e+00 -3.716000000000000192e+00 -4.859600000000000364e+00 -3.716600000000000126e+00 -4.868199999999999861e+00 -3.717200000000000060e+00 -4.876800000000000246e+00 -3.717799999999999994e+00 -4.885399999999999743e+00 -3.718399999999999928e+00 -4.894000000000000128e+00 -3.718999999999999861e+00 -4.902400000000000091e+00 -3.721099999999999852e+00 -4.910800000000000054e+00 -3.723199999999999843e+00 -4.919200000000000017e+00 -3.725299999999999834e+00 -4.927599999999999980e+00 -3.727399999999999824e+00 -4.935999999999999943e+00 -3.729499999999999815e+00 -4.944399999999999906e+00 -3.731600000000000250e+00 -4.952799999999999869e+00 -3.733700000000000241e+00 -4.961199999999999832e+00 -3.735800000000000232e+00 -4.969599999999999795e+00 -3.737900000000000222e+00 -4.977999999999999758e+00 -3.740000000000000213e+00 -4.985799999999999343e+00 -3.743700000000000028e+00 -4.993599999999999817e+00 -3.747400000000000286e+00 -5.001399999999999402e+00 -3.751100000000000101e+00 -5.009199999999999875e+00 -3.754800000000000360e+00 -5.016999999999999460e+00 -3.758500000000000174e+00 -5.024799999999999933e+00 -3.762199999999999989e+00 -5.032599999999999518e+00 -3.765900000000000247e+00 -5.040399999999999991e+00 -3.769600000000000062e+00 -5.048199999999999577e+00 -3.773300000000000320e+00 -5.056000000000000050e+00 -3.777000000000000135e+00 -5.063100000000000378e+00 -3.782000000000000028e+00 -5.070199999999999818e+00 -3.786999999999999922e+00 -5.077300000000000146e+00 -3.792000000000000259e+00 -5.084399999999999586e+00 -3.797000000000000153e+00 -5.091499999999999915e+00 -3.802000000000000046e+00 -5.098600000000000243e+00 -3.806999999999999940e+00 -5.105699999999999683e+00 -3.811999999999999833e+00 -5.112800000000000011e+00 -3.817000000000000171e+00 -5.119899999999999451e+00 -3.822000000000000064e+00 -5.126999999999999780e+00 -3.826999999999999957e+00 -5.132899999999999352e+00 -3.833299999999999930e+00 -5.138799999999999812e+00 -3.839599999999999902e+00 -5.144699999999999385e+00 -3.845899999999999874e+00 -5.150599999999999845e+00 -3.852199999999999847e+00 -5.156499999999999417e+00 -3.858500000000000263e+00 -5.162399999999999878e+00 -3.864800000000000235e+00 -5.168299999999999450e+00 -3.871100000000000207e+00 -5.174199999999999910e+00 -3.877400000000000180e+00 -5.180099999999999483e+00 -3.883700000000000152e+00 -5.185999999999999943e+00 -3.890000000000000124e+00 -5.192000000000000171e+00 -3.899900000000000144e+00 -5.198000000000000398e+00 -3.909800000000000164e+00 -5.203999999999999737e+00 -3.919700000000000184e+00 -5.209999999999999964e+00 -3.929600000000000204e+00 -5.216000000000000192e+00 -3.939499999999999780e+00 -5.222000000000000419e+00 -3.949399999999999800e+00 -5.228000000000000647e+00 -3.959299999999999820e+00 -5.233999999999999986e+00 -3.969199999999999839e+00 -5.240000000000000213e+00 -3.979099999999999859e+00 -5.246000000000000441e+00 -3.988999999999999879e+00 -5.248000000000000220e+00 -4.016799999999999926e+00 -5.250000000000000000e+00 -4.044599999999999973e+00 -5.252000000000000668e+00 -4.072400000000000020e+00 -5.254000000000000448e+00 -4.100200000000000067e+00 -5.256000000000000227e+00 -4.128000000000000114e+00 -5.258000000000000007e+00 -4.155800000000000161e+00 -5.259999999999999787e+00 -4.183600000000000207e+00 -5.262000000000000455e+00 -4.211400000000000254e+00 -5.264000000000000234e+00 -4.239200000000000301e+00 -5.266000000000000014e+00 -4.267000000000000348e+00 -5.294299999999999784e+00 -4.295400000000000773e+00 -5.322600000000000442e+00 -4.323800000000000310e+00 -5.350900000000000212e+00 -4.352199999999999847e+00 -5.379199999999999982e+00 -4.380600000000000271e+00 -5.407500000000000639e+00 -4.409000000000000696e+00 -5.435800000000000409e+00 -4.437400000000000233e+00 -5.464100000000000179e+00 -4.465799999999999770e+00 -5.492399999999999949e+00 -4.494200000000000195e+00 -5.520700000000000607e+00 -4.522600000000000620e+00 -5.549000000000000377e+00 -4.551000000000000156e+00 -5.549800000000000288e+00 -4.553900000000000503e+00 -5.550600000000000200e+00 -4.556799999999999962e+00 -5.551400000000000112e+00 -4.559700000000000308e+00 -5.552200000000000024e+00 -4.562599999999999767e+00 -5.553000000000000824e+00 -4.565500000000000114e+00 -5.553800000000000736e+00 -4.568400000000000460e+00 -5.554600000000000648e+00 -4.571299999999999919e+00 -5.555400000000000560e+00 -4.574200000000000266e+00 -5.556200000000000472e+00 -4.577099999999999724e+00 -5.557000000000000384e+00 -4.580000000000000071e+00 -5.557000000000000384e+00 -4.515000000000000568e+00 -5.557000000000000384e+00 -4.450000000000000178e+00 -5.557000000000000384e+00 -4.384999999999999787e+00 -5.557000000000000384e+00 -4.320000000000000284e+00 -5.557000000000000384e+00 -4.254999999999999893e+00 -5.557000000000000384e+00 -4.190000000000000391e+00 -5.557000000000000384e+00 -4.125000000000000000e+00 -5.557000000000000384e+00 -4.060000000000000497e+00 -5.557000000000000384e+00 -3.995000000000000107e+00 -5.557000000000000384e+00 -3.930000000000000160e+00 -5.557500000000000107e+00 -3.917000000000000259e+00 -5.558000000000000718e+00 -3.904000000000000359e+00 -5.558500000000000441e+00 -3.891000000000000014e+00 -5.559000000000000163e+00 -3.878000000000000114e+00 -5.559499999999999886e+00 -3.865000000000000213e+00 -5.560000000000000497e+00 -3.852000000000000313e+00 -5.560500000000000220e+00 -3.839000000000000412e+00 -5.560999999999999943e+00 -3.826000000000000068e+00 -5.561500000000000554e+00 -3.813000000000000167e+00 -5.562000000000000277e+00 -3.800000000000000266e+00 -5.564000000000000057e+00 -3.790300000000000225e+00 -5.565999999999999837e+00 -3.780600000000000183e+00 -5.568000000000000504e+00 -3.770900000000000141e+00 -5.570000000000000284e+00 -3.761200000000000099e+00 -5.572000000000000064e+00 -3.751500000000000057e+00 -5.573999999999999844e+00 -3.741800000000000459e+00 -5.575999999999999623e+00 -3.732100000000000417e+00 -5.578000000000000291e+00 -3.722400000000000375e+00 -5.580000000000000071e+00 -3.712700000000000333e+00 -5.581999999999999851e+00 -3.703000000000000291e+00 -5.586800000000000210e+00 -3.690900000000000070e+00 -5.591599999999999682e+00 -3.678800000000000292e+00 -5.596400000000000041e+00 -3.666700000000000514e+00 -5.601199999999999513e+00 -3.654600000000000293e+00 -5.605999999999999872e+00 -3.642500000000000071e+00 -5.610800000000000232e+00 -3.630400000000000293e+00 -5.615599999999999703e+00 -3.618300000000000516e+00 -5.620400000000000063e+00 -3.606200000000000294e+00 -5.625199999999999534e+00 -3.594100000000000072e+00 -5.629999999999999893e+00 -3.582000000000000295e+00 -5.637100000000000222e+00 -3.571200000000000152e+00 -5.644199999999999662e+00 -3.560400000000000453e+00 -5.651299999999999990e+00 -3.549600000000000311e+00 -5.658400000000000318e+00 -3.538800000000000168e+00 -5.665499999999999758e+00 -3.528000000000000469e+00 -5.672600000000000087e+00 -3.517200000000000326e+00 -5.679700000000000415e+00 -3.506400000000000183e+00 -5.686800000000000743e+00 -3.495600000000000041e+00 -5.693900000000000183e+00 -3.484800000000000342e+00 -5.701000000000000512e+00 -3.474000000000000199e+00 -5.710100000000000620e+00 -3.464800000000000324e+00 -5.719200000000000728e+00 -3.455600000000000005e+00 -5.728299999999999947e+00 -3.446400000000000130e+00 -5.737400000000000055e+00 -3.437200000000000255e+00 -5.746500000000000163e+00 -3.427999999999999936e+00 -5.755600000000000271e+00 -3.418800000000000061e+00 -5.764700000000000379e+00 -3.409600000000000186e+00 -5.773799999999999599e+00 -3.400400000000000311e+00 -5.782899999999999707e+00 -3.391199999999999992e+00 -5.791999999999999815e+00 -3.382000000000000117e+00 -5.802799999999999514e+00 -3.374800000000000022e+00 -5.813600000000000101e+00 -3.367599999999999927e+00 -5.824399999999999800e+00 -3.360400000000000276e+00 -5.835200000000000387e+00 -3.353200000000000180e+00 -5.846000000000000085e+00 -3.346000000000000085e+00 -5.856799999999999784e+00 -3.338799999999999990e+00 -5.867600000000000371e+00 -3.331599999999999895e+00 -5.878400000000000070e+00 -3.324400000000000244e+00 -5.889200000000000657e+00 -3.317200000000000149e+00 -5.900000000000000355e+00 -3.310000000000000053e+00 -5.912000000000000810e+00 -3.305099999999999927e+00 -5.924000000000000377e+00 -3.300200000000000244e+00 -5.935999999999999943e+00 -3.295300000000000118e+00 -5.948000000000000398e+00 -3.290399999999999991e+00 -5.960000000000000853e+00 -3.285499999999999865e+00 -5.972000000000000419e+00 -3.280600000000000183e+00 -5.983999999999999986e+00 -3.275700000000000056e+00 -5.996000000000000441e+00 -3.270799999999999930e+00 -6.008000000000000895e+00 -3.265900000000000247e+00 -6.020000000000000462e+00 -3.261000000000000121e+00 -6.032700000000000173e+00 -3.258599999999999941e+00 -6.045400000000000773e+00 -3.256200000000000205e+00 -6.058100000000000485e+00 -3.253800000000000026e+00 -6.070800000000000196e+00 -3.251400000000000290e+00 -6.083500000000000796e+00 -3.249000000000000110e+00 -6.096200000000000507e+00 -3.246599999999999930e+00 -6.108900000000000219e+00 -3.244200000000000195e+00 -6.121599999999999930e+00 -3.241800000000000015e+00 -6.134300000000000530e+00 -3.239400000000000279e+00 -6.147000000000000242e+00 -3.237000000000000099e+00 -6.158000000000000362e+00 -3.236900000000000333e+00 -6.169000000000000483e+00 -3.236800000000000122e+00 -6.180000000000000604e+00 -3.236700000000000355e+00 -6.191000000000000725e+00 -3.236600000000000144e+00 -6.201999999999999957e+00 -3.236500000000000377e+00 -6.213000000000000078e+00 -3.236400000000000166e+00 -6.224000000000000199e+00 -3.236300000000000399e+00 -6.235000000000000320e+00 -3.236200000000000188e+00 -6.246000000000000441e+00 -3.236100000000000421e+00 -6.257000000000000561e+00 -3.236000000000000210e+00 -6.266800000000000814e+00 -3.237600000000000033e+00 -6.276600000000000179e+00 -3.239200000000000301e+00 -6.286400000000000432e+00 -3.240800000000000125e+00 -6.296200000000000685e+00 -3.242400000000000393e+00 -6.306000000000000938e+00 -3.244000000000000217e+00 -6.315800000000000303e+00 -3.245600000000000041e+00 -6.325600000000000556e+00 -3.247200000000000308e+00 -6.335400000000000809e+00 -3.248800000000000132e+00 -6.345200000000000173e+00 -3.250400000000000400e+00 -6.355000000000000426e+00 -3.252000000000000224e+00 -6.345299999999999940e+00 -3.231900000000000439e+00 -6.335600000000000342e+00 -3.211800000000000210e+00 -6.325900000000000745e+00 -3.191699999999999982e+00 -6.316200000000000259e+00 -3.171600000000000197e+00 -6.306499999999999773e+00 -3.151500000000000412e+00 -6.296800000000000175e+00 -3.131400000000000183e+00 -6.287100000000000577e+00 -3.111300000000000399e+00 -6.277400000000000091e+00 -3.091200000000000170e+00 -6.267699999999999605e+00 -3.071100000000000385e+00 -6.258000000000000007e+00 -3.051000000000000156e+00 -6.359499999999999709e+00 -2.972199999999999953e+00 -6.461000000000000298e+00 -2.893400000000000194e+00 -6.562500000000000000e+00 -2.814599999999999991e+00 -6.663999999999999702e+00 -2.735800000000000232e+00 -6.765500000000000291e+00 -2.657000000000000028e+00 -6.866999999999999993e+00 -2.578199999999999825e+00 -6.968500000000000583e+00 -2.499400000000000066e+00 -7.070000000000000284e+00 -2.420599999999999863e+00 -7.171500000000000874e+00 -2.341800000000000104e+00 -7.273000000000000576e+00 -2.262999999999999901e+00 -7.334700000000000664e+00 -2.171399999999999775e+00 -7.396400000000000752e+00 -2.079800000000000093e+00 -7.458100000000000840e+00 -1.988199999999999967e+00 -7.519800000000000928e+00 -1.896600000000000064e+00 -7.581500000000000128e+00 -1.804999999999999938e+00 -7.643200000000000216e+00 -1.713400000000000034e+00 -7.704900000000000304e+00 -1.621799999999999908e+00 -7.766600000000000392e+00 -1.530200000000000005e+00 -7.828300000000000480e+00 -1.438599999999999879e+00 -7.890000000000000568e+00 -1.346999999999999975e+00 -7.930500000000000327e+00 -1.255399999999999849e+00 -7.971000000000000085e+00 -1.163799999999999946e+00 -8.011499999999999844e+00 -1.072200000000000042e+00 -8.051999999999999602e+00 -9.806000000000001382e-01 -8.092500000000001137e+00 -8.890000000000000124e-01 -8.133000000000000895e+00 -7.973999999999999977e-01 -8.173500000000000654e+00 -7.057999999999999829e-01 -8.214000000000000412e+00 -6.141999999999999682e-01 -8.254500000000000171e+00 -5.225999999999999535e-01 -8.294999999999999929e+00 -4.309999999999999942e-01 -8.303800000000000736e+00 -3.256000000000001116e-01 -8.312599999999999767e+00 -2.202000000000000624e-01 -8.321400000000000574e+00 -1.148000000000001242e-01 -8.330199999999999605e+00 -9.400000000000074962e-03 -8.339000000000000412e+00 9.599999999999997424e-02 -8.347800000000001219e+00 2.013999999999999679e-01 -8.356600000000000250e+00 3.067999999999999616e-01 -8.365400000000001057e+00 4.122000000000000108e-01 -8.374200000000000088e+00 5.175999999999999490e-01 -8.383000000000000895e+00 6.229999999999999982e-01 -8.370600000000001373e+00 7.278000000000000025e-01 -8.358200000000000074e+00 8.326000000000000068e-01 -8.345800000000000551e+00 9.373999999999999000e-01 -8.333400000000001029e+00 1.042199999999999793e+00 -8.321000000000001506e+00 1.147000000000000020e+00 -8.308600000000000207e+00 1.251800000000000024e+00 -8.296200000000000685e+00 1.356600000000000028e+00 -8.283800000000001162e+00 1.461400000000000032e+00 -8.271399999999999864e+00 1.566200000000000037e+00 -8.259000000000000341e+00 1.671000000000000041e+00 -8.222699999999999676e+00 1.748899999999999899e+00 -8.186400000000000787e+00 1.826799999999999979e+00 -8.150100000000000122e+00 1.904700000000000060e+00 -8.113799999999999457e+00 1.982600000000000140e+00 -8.077500000000000568e+00 2.060500000000000220e+00 -8.041199999999999903e+00 2.138399999999999856e+00 -8.004899999999999238e+00 2.216299999999999937e+00 -7.968600000000000350e+00 2.294200000000000017e+00 -7.932299999999999685e+00 2.372100000000000097e+00 -7.895999999999999908e+00 2.450000000000000178e+00 -7.845600000000000129e+00 2.521400000000000308e+00 -7.795200000000000351e+00 2.592799999999999994e+00 -7.744799999999999685e+00 2.664200000000000124e+00 -7.694399999999999906e+00 2.735600000000000254e+00 -7.644000000000000128e+00 2.807000000000000384e+00 -7.593600000000000350e+00 2.878400000000000070e+00 -7.543200000000000571e+00 2.949800000000000200e+00 -7.492799999999999905e+00 3.021200000000000330e+00 -7.442400000000000126e+00 3.092600000000000016e+00 -7.392000000000000348e+00 3.164000000000000146e+00 -7.307199999999999918e+00 3.238500000000000156e+00 -7.222400000000000375e+00 3.313000000000000167e+00 -7.137600000000000833e+00 3.387500000000000178e+00 -7.052800000000000402e+00 3.462000000000000188e+00 -6.967999999999999972e+00 3.536500000000000199e+00 -6.883200000000000429e+00 3.611000000000000210e+00 -6.798400000000000887e+00 3.685500000000000220e+00 -6.713600000000000456e+00 3.760000000000000231e+00 -6.628800000000000026e+00 3.834500000000000242e+00 -6.544000000000000483e+00 3.909000000000000252e+00 -6.464200000000000834e+00 3.969800000000000217e+00 -6.384400000000000297e+00 4.030600000000000627e+00 -6.304600000000000648e+00 4.091400000000000148e+00 -6.224800000000000111e+00 4.152200000000000557e+00 -6.145000000000000462e+00 4.213000000000000078e+00 -6.065200000000000813e+00 4.273800000000000487e+00 -5.985400000000000276e+00 4.334600000000000009e+00 -5.905600000000000627e+00 4.395400000000000418e+00 -5.825800000000000090e+00 4.456199999999999939e+00 -5.746000000000000441e+00 4.517000000000000348e+00 -5.664300000000000779e+00 4.535500000000000753e+00 -5.582600000000000229e+00 4.554000000000000270e+00 -5.500900000000000567e+00 4.572499999999999787e+00 -5.419200000000000017e+00 4.591000000000000192e+00 -5.337500000000000355e+00 4.609500000000000597e+00 -5.255800000000000693e+00 4.628000000000000114e+00 -5.174100000000000144e+00 4.646499999999999631e+00 -5.092400000000000482e+00 4.665000000000000036e+00 -5.010699999999999932e+00 4.683500000000000441e+00 -4.929000000000000270e+00 4.701999999999999957e+00 -4.868000000000000327e+00 4.663800000000000168e+00 -4.807000000000000384e+00 4.625600000000000378e+00 -4.746000000000000441e+00 4.587399999999999700e+00 -4.685000000000000497e+00 4.549199999999999910e+00 -4.624000000000000554e+00 4.511000000000000121e+00 -4.562999999999999723e+00 4.472800000000000331e+00 -4.501999999999999780e+00 4.434600000000000541e+00 -4.440999999999999837e+00 4.396399999999999864e+00 -4.379999999999999893e+00 4.358200000000000074e+00 -4.318999999999999950e+00 4.320000000000000284e+00 -4.299100000000000144e+00 4.244900000000000340e+00 -4.279200000000000337e+00 4.169800000000000395e+00 -4.259299999999999642e+00 4.094700000000000450e+00 -4.239399999999999835e+00 4.019600000000000506e+00 -4.219500000000000028e+00 3.944500000000000117e+00 -4.199600000000000222e+00 3.869400000000000173e+00 -4.179700000000000415e+00 3.794300000000000228e+00 -4.159799999999999720e+00 3.719199999999999839e+00 -4.139899999999999913e+00 3.644099999999999895e+00 -4.120000000000000107e+00 3.568999999999999950e+00 -4.118000000000000327e+00 3.467799999999999994e+00 -4.115999999999999659e+00 3.366600000000000037e+00 -4.113999999999999879e+00 3.265400000000000080e+00 -4.112000000000000099e+00 3.164200000000000124e+00 -4.109999999999999432e+00 3.062999999999999723e+00 -4.107999999999999652e+00 2.961800000000000210e+00 -4.105999999999999872e+00 2.860599999999999810e+00 -4.104000000000000092e+00 2.759399999999999853e+00 -4.101999999999999424e+00 2.658199999999999896e+00 -4.099999999999999645e+00 2.556999999999999940e+00 -4.099999999999999645e+00 2.455600000000000005e+00 -4.099999999999999645e+00 2.354200000000000070e+00 -4.099999999999999645e+00 2.252800000000000136e+00 -4.099999999999999645e+00 2.151399999999999757e+00 -4.099999999999999645e+00 2.049999999999999822e+00 -4.099999999999999645e+00 1.948599999999999888e+00 -4.099999999999999645e+00 1.847199999999999953e+00 -4.099999999999999645e+00 1.745800000000000018e+00 -4.099999999999999645e+00 1.644399999999999862e+00 -4.099999999999999645e+00 1.542999999999999927e+00 -4.099999999999999645e+00 1.441500000000000004e+00 -4.099999999999999645e+00 1.339999999999999858e+00 -4.099999999999999645e+00 1.238500000000000156e+00 -4.099999999999999645e+00 1.137000000000000011e+00 -4.099999999999999645e+00 1.035499999999999865e+00 -4.099999999999999645e+00 9.339999999999999414e-01 -4.099999999999999645e+00 8.325000000000000178e-01 -4.099999999999999645e+00 7.309999999999999831e-01 -4.099999999999999645e+00 6.295000000000000595e-01 -4.099999999999999645e+00 5.280000000000000249e-01 -4.099999999999999645e+00 4.265000000000001013e-01 -4.099999999999999645e+00 3.250000000000001776e-01 -4.099999999999999645e+00 2.235000000000001430e-01 -4.099999999999999645e+00 1.220000000000002194e-01 -4.099999999999999645e+00 2.050000000000007372e-02 -4.099999999999999645e+00 -8.099999999999990541e-02 -4.099999999999999645e+00 -1.824999999999998845e-01 -4.099999999999999645e+00 -2.839999999999999192e-01 -4.099999999999999645e+00 -3.854999999999999538e-01 -4.099999999999999645e+00 -4.869999999999999885e-01 -4.099999999999999645e+00 -5.883999999999999231e-01 -4.099999999999999645e+00 -6.897999999999998577e-01 -4.099999999999999645e+00 -7.911999999999999034e-01 -4.099999999999999645e+00 -8.925999999999998380e-01 -4.099999999999999645e+00 -9.939999999999999947e-01 -4.099999999999999645e+00 -1.095399999999999929e+00 -4.099999999999999645e+00 -1.196800000000000086e+00 -4.099999999999999645e+00 -1.298200000000000021e+00 -4.099999999999999645e+00 -1.399600000000000177e+00 -4.099999999999999645e+00 -1.501000000000000112e+00 -4.099999999999999645e+00 -1.602100000000000080e+00 -4.099999999999999645e+00 -1.703200000000000047e+00 -4.099999999999999645e+00 -1.804300000000000015e+00 -4.099999999999999645e+00 -1.905399999999999983e+00 -4.099999999999999645e+00 -2.006499999999999950e+00 -4.099999999999999645e+00 -2.107600000000000140e+00 -4.099999999999999645e+00 -2.208699999999999886e+00 -4.099999999999999645e+00 -2.309800000000000075e+00 -4.099999999999999645e+00 -2.410899999999999821e+00 diff --git a/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV0.txt b/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV0.txt deleted file mode 100644 index 495287421..000000000 --- a/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV0.txt +++ /dev/null @@ -1,55 +0,0 @@ -# Cls = Ves -# Exp = WEST -# Name = StandardV0 -5.100000000000000000e+01 0.000000000000000000e+00 -2.766000000000000014e+00 7.491999999999999771e-01 -2.455999999999999961e+00 7.491999999999999771e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.873650437331630725e+00 4.441642303822337379e-01 -1.856259555650231263e+00 3.337978467736253951e-01 -1.843826943346401626e+00 2.228133966765704910e-01 -1.836358204793972160e+00 1.113896333018938728e-01 -1.833876759397041756e+00 -2.779374865840749179e-04 -1.836383298232798778e+00 -1.119509098580846185e-01 -1.843875949550754845e+00 -2.233744240736200981e-01 -1.856339514974657767e+00 -3.343851997842514634e-01 -1.873750141219779675e+00 -4.447155115314402885e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.754964195673874627e+00 -7.979690000000000394e-01 -2.815780670637718419e+00 -7.791760000000000908e-01 -2.872799837484331320e+00 -7.508790000000000742e-01 -2.924399154346239538e+00 -7.173380000000000312e-01 -2.973282640706228275e+00 -6.804609999999999825e-01 -3.019796466972070714e+00 -6.399310000000000276e-01 -3.063636388779354292e+00 -5.958869999999999445e-01 -3.102282764595935216e+00 -5.513109999999999955e-01 -3.138802498916585471e+00 -5.028350000000000319e-01 -3.172972072800200216e+00 -4.502540000000000431e-01 -3.205347944102948876e+00 -3.969119999999999870e-01 -3.227808407117281231e+00 -3.423480000000000412e-01 -3.250594743028573763e+00 -2.829570000000000141e-01 -3.267575361009597668e+00 -2.268390000000000128e-01 -3.281336589126449432e+00 -1.672340000000000215e-01 -3.291042643024395531e+00 -1.059189999999999993e-01 -3.296432626717706871e+00 -4.346300000000000163e-02 -3.297699999999999854e+00 0.000000000000000000e+00 -3.297292388930650908e+00 1.516699999999999993e-02 -3.293871427668360496e+00 8.015500000000000402e-02 -3.287020572218251502e+00 1.339559999999999917e-01 -3.275200353710441270e+00 1.955629999999999868e-01 -3.257820961633404178e+00 2.607860000000000178e-01 -3.238783834350171809e+00 3.151430000000000065e-01 -3.214973539194529994e+00 3.709940000000000460e-01 -3.184016002518988753e+00 4.311770000000000325e-01 -3.156654115103680436e+00 4.760960000000000192e-01 -3.120316606298149331e+00 5.280940000000000634e-01 -3.081809030320016518e+00 5.755069999999999908e-01 -3.037585567353453087e+00 6.227709999999999635e-01 -2.992128319415462201e+00 6.646929999999999783e-01 -2.945089723137989335e+00 7.022970000000000601e-01 -2.895559610014789786e+00 7.365940000000000820e-01 -2.836711857618605226e+00 7.712799999999999656e-01 diff --git a/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV1.txt b/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV1.txt deleted file mode 100644 index 0e2d6855a..000000000 --- a/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV1.txt +++ /dev/null @@ -1,66 +0,0 @@ -# Cls = Ves -# Exp = WEST -# Name = StandardV1 -6.200000000000000000e+01 0.000000000000000000e+00 -2.372098356384068740e+00 7.697690000000000365e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -1.855749421322286263e+00 5.553719999999999768e-01 -1.828361249029851976e+00 4.429759999999999809e-01 -1.795880091900347253e+00 1.557350000000000123e-01 -1.788274403467767559e+00 4.992200000000000110e-02 -1.789764725165014392e+00 0.000000000000000000e+00 -1.788274403467767559e+00 -4.992200000000000110e-02 -1.795880091900347253e+00 -1.557350000000000123e-01 -1.829809748841119355e+00 -4.429759999999999809e-01 -1.855749421322286263e+00 -5.553719999999999768e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.471999999999999975e+00 -7.304000000000001602e-01 -2.462000000000000188e+00 -6.934000000000000163e-01 -2.389499999999999957e+00 -6.934000000000000163e-01 -2.380900000000000016e+00 -6.872000000000000330e-01 -2.380900000000000016e+00 -6.815999999999999837e-01 -2.389499999999999957e+00 -6.754000000000000004e-01 -2.785600000000000076e+00 -6.754000000000000004e-01 -2.785600000000000076e+00 -6.934000000000000163e-01 -2.694999999999999840e+00 -7.304000000000001602e-01 -2.754964195673874627e+00 -7.979690000000000394e-01 -2.815780670637718419e+00 -7.791760000000000908e-01 -2.872799837484331320e+00 -7.508790000000000742e-01 -2.924399154346239538e+00 -7.173380000000000312e-01 -2.973282640706228275e+00 -6.804609999999999825e-01 -3.019796466972070714e+00 -6.399310000000000276e-01 -3.063636388779354292e+00 -5.958869999999999445e-01 -3.102282764595935216e+00 -5.513109999999999955e-01 -3.138802498916585471e+00 -5.028350000000000319e-01 -3.172972072800200216e+00 -4.502540000000000431e-01 -3.205347944102948876e+00 -3.969119999999999870e-01 -3.227808407117281231e+00 -3.423480000000000412e-01 -3.250594743028573763e+00 -2.829570000000000141e-01 -3.267575361009597668e+00 -2.268390000000000128e-01 -3.281336589126449432e+00 -1.672340000000000215e-01 -3.291042643024395531e+00 -1.059189999999999993e-01 -3.296432626717706871e+00 -4.346300000000000163e-02 -3.297699999999999854e+00 0.000000000000000000e+00 -3.297292388930650908e+00 1.516699999999999993e-02 -3.293871427668360496e+00 8.015500000000000402e-02 -3.287020572218251502e+00 1.339559999999999917e-01 -3.275200353710441270e+00 1.955629999999999868e-01 -3.257820961633404178e+00 2.607860000000000178e-01 -3.238783834350171809e+00 3.151430000000000065e-01 -3.214973539194529994e+00 3.709940000000000460e-01 -3.184016002518988753e+00 4.311770000000000325e-01 -3.156654115103680436e+00 4.760960000000000192e-01 -3.120316606298149331e+00 5.280940000000000634e-01 -3.081809030320016518e+00 5.755069999999999908e-01 -3.037585567353453087e+00 6.227709999999999635e-01 -2.992128319415462201e+00 6.646929999999999783e-01 -2.945089723137989335e+00 7.022970000000000601e-01 -2.895559610014789786e+00 7.365940000000000820e-01 -2.836711857618605226e+00 7.712799999999999656e-01 -2.788473474717663603e+00 7.953600000000000669e-01 -2.728441122807124142e+00 8.205249999999999488e-01 -2.671200754855389103e+00 8.394439999999999680e-01 -2.615181078685374860e+00 8.535439999999999694e-01 -2.557634706658673984e+00 8.635620000000000518e-01 -2.498288074568863593e+00 8.694520000000000026e-01 diff --git a/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV2.txt b/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV2.txt deleted file mode 100644 index 2080b09f1..000000000 --- a/tofu/geom/inputs/TFG_Ves_ExpWEST_StandardV2.txt +++ /dev/null @@ -1,63 +0,0 @@ -# Cls = Ves -# Exp = WEST -# Name = StandardV2 -5.900000000000000000e+01 0.000000000000000000e+00 -2.298999745535653894e+00 7.995800000000000685e-01 -1.961200448093463056e+00 6.631000000000000227e-01 -1.936200001407396121e+00 6.611000000000000210e-01 -1.880000085902391760e+00 6.611000000000000210e-01 -1.878248121532935411e+00 6.485100000000000309e-01 -1.855749421322286263e+00 5.553719999999999768e-01 -1.828361249029851976e+00 4.429759999999999809e-01 -1.795880091900347253e+00 1.557350000000000123e-01 -1.788274403467767559e+00 4.992200000000000110e-02 -1.789764725165014392e+00 0.000000000000000000e+00 -1.788274403467767559e+00 -4.992200000000000110e-02 -1.795880091900347253e+00 -1.557350000000000123e-01 -1.829809748841119355e+00 -4.429759999999999809e-01 -1.855749421322286263e+00 -5.553719999999999768e-01 -1.867603531026057917e+00 -6.485180000000000389e-01 -1.879999718666202302e+00 -6.582000000000000073e-01 -1.936200294326235305e+00 -6.582000000000000073e-01 -1.961200067944624648e+00 -6.602000000000000091e-01 -2.297123414295801247e+00 -7.959220000000000184e-01 -2.754964195673874627e+00 -7.979690000000000394e-01 -2.815780670637718419e+00 -7.791760000000000908e-01 -2.872799837484331320e+00 -7.508790000000000742e-01 -2.924399154346239538e+00 -7.173380000000000312e-01 -2.973282640706228275e+00 -6.804609999999999825e-01 -3.019796466972070714e+00 -6.399310000000000276e-01 -3.063636388779354292e+00 -5.958869999999999445e-01 -3.102282764595935216e+00 -5.513109999999999955e-01 -3.138802498916585471e+00 -5.028350000000000319e-01 -3.172972072800200216e+00 -4.502540000000000431e-01 -3.205347944102948876e+00 -3.969119999999999870e-01 -3.227808407117281231e+00 -3.423480000000000412e-01 -3.250594743028573763e+00 -2.829570000000000141e-01 -3.267575361009597668e+00 -2.268390000000000128e-01 -3.281336589126449432e+00 -1.672340000000000215e-01 -3.291042643024395531e+00 -1.059189999999999993e-01 -3.296432626717706871e+00 -4.346300000000000163e-02 -3.297699999999999854e+00 0.000000000000000000e+00 -3.297292388930650908e+00 1.516699999999999993e-02 -3.293871427668360496e+00 8.015500000000000402e-02 -3.287020572218251502e+00 1.339559999999999917e-01 -3.275200353710441270e+00 1.955629999999999868e-01 -3.257820961633404178e+00 2.607860000000000178e-01 -3.238783834350171809e+00 3.151430000000000065e-01 -3.214973539194529994e+00 3.709940000000000460e-01 -3.184016002518988753e+00 4.311770000000000325e-01 -3.156654115103680436e+00 4.760960000000000192e-01 -3.120316606298149331e+00 5.280940000000000634e-01 -3.081809030320016518e+00 5.755069999999999908e-01 -3.037585567353453087e+00 6.227709999999999635e-01 -2.992128319415462201e+00 6.646929999999999783e-01 -2.945089723137989335e+00 7.022970000000000601e-01 -2.895559610014789786e+00 7.365940000000000820e-01 -2.836711857618605226e+00 7.712799999999999656e-01 -2.788473474717663603e+00 7.953600000000000669e-01 -2.728441122807124142e+00 8.205249999999999488e-01 -2.671200754855389103e+00 8.394439999999999680e-01 -2.615181078685374860e+00 8.535439999999999694e-01 -2.557634706658673984e+00 8.635620000000000518e-01 -2.498288074568863593e+00 8.694520000000000026e-01 diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_CoilPF_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_CoilPF_Notes.py deleted file mode 100755 index 723b1b2e7..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_CoilPF_Notes.py +++ /dev/null @@ -1,325 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -#_Cls, _name = os.path.split(__file__)[1].split('_')[1:3] -#assert not any([any([ss in s for ss in ['WEST','Notes','.']]) -# for s in [_Cls,_name]) - - -def get_notes(): - """ By convention : D is a length of the element, d is a gap """ - - # CreoVew coordinates : (-X,Y,Y) - notes = {} - - # Low Divertor coils - notes['DivLow11'] = [[ 544.028, -707.593, -1904.619], - [ 544.028, -739.007, -1904.619], - [ 552.107, -739.007, -1932.902], - [ 552.107, -707.593, -1932.902]] - - notes['DivLow12'] = [[ 506.027, -741.593, -1915.066], - [ 506.027, -773.007, -1915.066], - [ 513.541, -773.007, -1943.504], - [ 513.541, -741.593, -1943.504]] - - notes['DivLow13'] = [[ 591.045, -707.593, -1924.058], - [ 591.045, -739.007, -1924.058], - [ 599.682, -739.007, -1952.176], - [ 599.682, -707.593, -1952.176]] - - notes['DivLow14'] = [[ 629.245, -741.593, -1911.906], - [ 629.245, -773.007, -1911.906], - [ 638.441, -773.007, -1939.846], - [ 638.441, -741.593, -1939.846]] - - notes['DivLow15'] = [[ 719.986, -741.593, -1913.844], - [ 719.986, -773.007, -1913.844], - [ 730.343, -773.007, -1941.374], - [ 730.343, -741.593, -1941.374]] - - notes['DivLow16'] = [[866.309, -775.593, -1852.211], - [866.309, -807.007, -1852.211], - [878.771, -807.007, -1878.855], - [878.771, -775.593, -1878.855]] - - notes['DivLow17'] = [[782.893, -741.593, -1923.577], - [782.893, -773.007, -1923.577], - [793.981, -773.007, -1950.821], - [793.981, -741.593, -1950.821]] - - notes['DivLow18'] = [[832.314, -775.593, -1902.715], - [832.314, -807.007, -1902.715], - [844.102, -807.007, -1929.663], - [844.102, -775.593, -1929.663]] - - notes['DivLow1'] = [notes['DivLow14'][3], - notes['DivLow13'][3], - notes['DivLow11'][0], - notes['DivLow12'][1], - notes['DivLow14'][2], - notes['DivLow15'][1], - notes['DivLow16'][1], - notes['DivLow18'][2], - notes['DivLow17'][3], - notes['DivLow15'][0]] - - # Div Low 2 - - notes['DivLow21'] = [[2070.226, -770.213, -525.144], - [2070.226, -801.627, -525.144], - [2098.737, -801.627, -532.377], - [2098.737, -770.213, -532.377]] - - notes['DivLow22'] = [[2059.565, -804.213, -565.509], - [2059.565, -835.627, -565.509], - [2087.930, -835.627, -573.298], - [2087.930, -804.213, -573.298]] - - notes['DivLow23'] = [[2111.217, -770.213, -492.023], - [2111.217, -801.627, -492.023], - [2139.864, -801.627, -498.699], - [2139.864, -770.213, -498.699]] - - notes['DivLow24'] = [[2036.407, -804.213, 743.216], - [2036.407, -835.627, 743.216], - [2064.039, -835.627, 753.301], - [2064.039, -804.213, 753.301]] - - notes['DivLow25'] = [[2160.173, -804.213, -415.621], - [2160.173, -835.627, -415.621], - [2189.057, -835.627, -421.178], - [2189.057, -804.213, -421.178]] - - notes['DivLow26'] = [[2185.593, -838.213, -249.547], - [2185.593, -869.627, -249.547], - [2214.817, -869.627, -252.884], - [2214.817, -838.213, -252.884]] - - notes['DivLow27'] = [[2221.021, -838.213, -219.014], - [2221.021, -869.627, -219.014], - [2250.293, -869.627, -221.901], - [2250.293, -838.213, -221.901]] - - notes['DivLow28'] = [[2214.719, -804.213, -275.533], - [2214.719, -835.627, -275.533], - [2243.908, -835.627, -279.164], - [2243.908, -804.213, -279.164]] - - notes['DivLow2'] = [notes['DivLow24'][3], - notes['DivLow23'][3], - notes['DivLow21'][0], - notes['DivLow22'][1], - notes['DivLow24'][2], - notes['DivLow25'][1], - notes['DivLow26'][1], - notes['DivLow27'][2], - notes['DivLow28'][3], - notes['DivLow25'][0]] - - # Upper Divertor coils - - notes['DivUp11'] = [[1915.066, 775.907, -506.027], - [1915.066, 744.493, -506.027], - [1943.504, 744.493, -513.541], - [1943.504, 775.907, -513.541]] - - notes['DivUp12'] = [[1904.619, 741.907, -544.028], - [1904.619, 710.493, -544.028], - [1932.902, 710.493, -552.107], - [1932.902, 741.907, -552.107]] - - notes['DivUp13'] = [[1911.907, 775.907, -629.241], - [1911.907, 744.493, -629.241], - [1939.848, 744.493, -638.437], - [1939.848, 775.907, -638.437]] - - notes['DivUp14'] = [[1924.058, 741.907, -591.045], - [1924.058, 710.493, -591.045], - [1952.176, 710.493, -599.682], - [1952.176, 741.907, -599.682]] - - notes['DivUp15'] = [[1852.211, 809.907, -866.309], - [1852.211, 778.493, -866.309], - [1878.855, 778.493, -878.771], - [1878.855, 809.907, -878.771]] - - notes['DivUp16'] = [[1913.844, 775.907, -719.986], - [1913.844, 744.493, -719.986], - [1941.374, 744.493, -730.343], - [1941.374, 775.907, -730.343]] - - notes['DivUp17'] = [[1902.715, 809.907, -832.314], - [1902.715, 778.493, -832.314], - [1929.663, 778.493, -844.102], - [1929.663, 809.907, -844.102]] - - notes['DivUp18'] = [[1923.577, 775.907, -782.893], - [1923.577, 744.493, -782.893], - [1950.821, 744.493, -793.981], - [1950.821, 775.907, -793.981]] - - notes['DivUp1'] = [notes['DivUp13'][3], - notes['DivUp11'][0], - notes['DivUp12'][1], - notes['DivUp14'][2], - notes['DivUp13'][2], - notes['DivUp16'][1], - notes['DivUp18'][2], - notes['DivUp17'][3], - notes['DivUp15'][0], - notes['DivUp16'][0]] - - # Div Up 2 - - notes['DivUp21'] = [[565.509, 838.527, -2059.565], - [565.509, 807.113, -2059.565], - [573.298, 807.113, -2087.930], - [573.298, 838.527, -2087.930]] - - notes['DivUp22'] = [[525.144, 804.527, -2070.226], - [525.144, 773.113, -2070.226], - [532.377, 773.113, -2098.737], - [532.377, 804.527, -2098.737]] - - notes['DivUp23'] = [[492.023, 804.527, -2111.217], - [492.023, 773.113, -2111.217], - [498.699, 773.113, -2139.864], - [498.699, 804.527, -2139.864]] - - notes['DivUp24'] = [[-743.216, 838.527, -2036.407], - [-743.216, 807.113, -2036.407], - [-753.301, 807.113, -2064.039], - [-753.301, 838.527, -2064.039]] - - notes['DivUp25'] = [[249.547, 872.527, -2185.593], - [249.547, 841.113, -2185.593], - [252.884, 841.113, -2214.817], - [252.884, 872.527, -2214.817]] - - notes['DivUp26'] = [[415.621, 838.527, -2160.173], - [415.621, 807.113, -2160.173], - [421.178, 807.113, -2189.057], - [421.178, 838.527, -2189.057]] - - notes['DivUp27'] = [[275.533, 838.527, -2214.719], - [275.533, 807.113, -2214.719], - [279.164, 807.113, -2243.908], - [279.164, 838.527, -2243.908]] - - notes['DivUp28'] = [[219.014, 872.527, -2221.021], - [219.014, 841.113, -2221.021], - [221.901, 841.113, -2250.293], - [221.901, 872.527, -2250.293]] - - notes['DivUp2'] = [notes['DivUp24'][3], - notes['DivUp21'][0], - notes['DivUp22'][1], - notes['DivUp23'][2], - notes['DivUp24'][2], - notes['DivUp26'][1], - notes['DivUp27'][2], - notes['DivUp28'][3], - notes['DivUp25'][0], - notes['DivUp26'][0]] - - # Central Solenoid - - notes['CS'] = [[0., 875., 669.], - [0., -845., 669.], - [0., -845., 812.], - [0., 875., 812.]] - - # External PF coils - - notes['Bu'] = [[0., 2400., 1082.], - [0., 1200., 1082.], - [-577.5, 1200., 1000.259], - [0., 2400., 1155.]] - - notes['Bl'] = [[-1083., -1200., 0.], - [-1083., -2400., 0.], - [-1155., -2400., 0.], - [-816.708, -1200., -816.708]] - - notes['Du'] = [[-1374., 2109., 2379.838], - [-1374., 1746., 2379.838], - [-1507.5, 1746., 2611.067], - [-1507.5, 2109., 2611.067]] - - notes['Dl'] = [[-1374., -1746., 2379.838], - [-1374., -2109., 2379.838], - [-1507.5, -2109., 2611.067], - [-1507.5, -1746., 2611.067]] - - notes['Eu'] = [[-1814., 1736., 3141.94], - [-1814., 1346., 3141.94], - [-1957.5, 1346., 3390.489], - [-1957.5, 1736., 3390.489]] - - notes['El'] = [[-1814., -1346., 3141.94], - [-1814., -1736., 3141.94], - [-1957.5, -1736., 3390.489], - [-1957.5, -1346., 3390.489]] - - notes['Fu'] = [[-2115., 838., 3663.287], - [-2115., 450., 3663.287], - [-2259.5, 450., 3913.569], - [-2259.5, 838., 3913.569]] - - notes['Fl'] = [[-2115., -452., 3663.287], - [-2115., -840., 3663.287], - [-2259.5, -840., 3913.569], - [-2259.5, -452., 3913.569]] - - for k in notes.keys(): - notes[k] = np.array(notes[k])*1.e-3 - - return notes - - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - lPoly = [] - for k in notes.keys(): - if k[-2] in ['1','2']: - continue - Poly = np.array([np.hypot(notes[k][:,0],notes[k][:,2]), notes[k][:,1]]) - lPoly.append(Poly) - if save: - cls = 'CoilPF' - name = '%sV0'%k - savename = 'TFG_%s_ExpWEST_%s'%(cls,name) - pathfilext = os.path.join(path, savename+'.txt') - - npno = np.r_[Poly.shape[1], 0] - savepoly = np.vstack((npno,Poly.T)) - np.savetxt(pathfilext, savepoly, comments='#', - header='Name = %s\nExp = %s\nCLs = %s'%(name,'WEST',cls)) - return lPoly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_Baffle_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_Baffle_Notes.py deleted file mode 100755 index 8488c1063..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_Baffle_Notes.py +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - notes = {'DPhi':{}, 'dPhi':{}} - # Total length - notes['DL'] = 405.107 - - # Toroidal width - notes['DPhi']['In'] = 102.951 - notes['DPhi']['Out'] = 120.538 - - # Toroidal gap - notes['dPhi']['In'] = 1.000 - notes['dPhi']['Out'] = 1.000 - - # Height - notes['DZ'] = 21.000 - - # Number in toroidal direction - notes['nbPhi'] = 12*12 - - # sample (X,Z,Y) - notes['PolyRZ'] = [[2.58000, -8.5940e-01],#0, V1 - [2.58000, -8.3940e-01], # V1 - [2.61500, -8.3940e-01], - [2.61500, -7.3040e-01], - [2.47200, -7.3040e-01], - [2.46200, -7.1340e-01], # V1 - [2.46200, -6.9340e-01], - [2.38950, -6.9340e-01], - [2.38670, -6.9300e-01], # V1 - [2.38420, -6.9170e-01], # V1 - [2.38220, -6.8970e-01],#10, V1 - [2.38090, -6.8720e-01], - [2.38050, -6.8440e-01], # V1 - [2.38090, -6.8160e-01], - [2.38220, -6.7910e-01], # V1 - [2.38420, -6.7710e-01], # V1 - [2.38670, -6.7580e-01], # V1 - [2.38950, -6.7540e-01], - [2.46525, -6.7540e-01], # V1 - [2.61767, -6.7540e-01], # V1 - [2.72657, -6.7540e-01],#20, V1 - [2.78560, -6.7540e-01], - [2.78560, -6.9340e-01], - [2.75000, -6.9340e-01], # V1 - [2.75000, -7.0840e-01], # V1 - [2.69800, -7.0840e-01], # V1 - [2.69500, -7.3040e-01], - [2.63500, -7.3040e-01], - [2.63500, -8.3940e-01], - [2.67000, -8.3940e-01], # V1 - [2.67000, -8.5940e-01]]#30, V1 - - notes['PolyRZ'] = np.asarray(notes['PolyRZ'],dtype=float)*1.e3 - notes['ind_V1'] = np.array([0,1,5,8,9,10,12,14,15,16, - 18,19,20,23,24,25,29,30],dtype=int) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not ('nb' in kk or 'ind' in kk): - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - Poly = notes['PolyRZ'] - ind0 = np.ones((Poly.shape[0],),dtype=bool) - ind0[notes['ind_V1']] = False - Poly0 = Poly[ind0,:] - - if save: - nn = _name+'V0' - savename = 'TFG_%s_Exp%s_%s'%(_Cls,_Exp,nn) - pfe = os.path.join(path, savename+'.txt') - np.savetxt(pfe, Poly0, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - savename = 'TFG_%s_Exp%s_%s'%(_Cls,_Exp,nn) - pfe = os.path.join(path, savename+'.txt') - print(pfe, 'Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - np.savetxt(pfe, Poly, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0.T, Poly.T, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_BumperInner_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_BumperInner_Notes.py deleted file mode 100755 index 87b6803c4..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_BumperInner_Notes.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - notes = {} - # Number of tiles vertically - notes['nbZ'] = 10 - # Number of tiles toroidally - notes['nbPhi'] = 3 - # Vertical average gap - notes['dZ'] = 3.842 - # Toroidal average gap - notes['dPhi'] = 1.500 - - # Total toroidal width in equatorial plane - notes['DPhi'] = 269.000 - # Total height - notes['DZ'] = 1189.530 - - # Radius of holes - notes['r_outer'] = 6.000 - notes['r_inner'] = 4.000 - - # sampleXZY - notes['sampleXZY'] = [[-939.226, 592.992, 1626.787],#0 - [-940.405, 594.553, 1628.830], - [-940.557, 594.491, 1629.092], - [-942.429, 591.177, 1632.335], - [-948.038, 557.622, 1642.051], - [-948.117, 555.038, 1642.187], - [-945.686, 531.169, 1637.977], - [-942.393, 498.833, 1632.273], - [-939.100, 466.497, 1626.569], - [-937.503, 450.819, 1623.803], - [-934.555, 446.918, 1618.696],#10 - [-925.736, 450.510, 1603.421], - [-925.323, 445.938, 1602.706], - [-934.213, 443.137, 1618.105], - [-936.294, 437.419, 1621.708], - [-935.048, 421.614, 1619.551], - [-932.480, 389.017, 1615.103], - [-929.912, 356.419, 1610.655], - [-928.667, 340.614, 1608.498], - [-925.808, 336.453, 1603.547], - [-916.918, 339.255, 1588.148],#20 - [-916.598, 334.511, 1587.595], - [-925.542, 332.506, 1603.086], - [-927.748, 326.981, 1606.907], - [-926.858, 311.080, 1605.365], - [-925.021, 278.286, 1602.183], - [-923.183, 245.491, 1599.000], - [-922.293, 229.590, 1597.458], - [-919.530, 225.178, 1592.672], - [-910.586, 227.182, 1577.181], - [-910.379, 222.555, 1576.822],#30 - [-919.359, 221.351, 1592.376], - [-921.686, 216.028, 1596.407], - [-921.151, 200.064, 1595.480], - [-920.047, 167.138, 1593.569], - [-918.944, 134.211, 1591.658], - [-918.409, 118.247, 1590.731], - [-915.747, 113.593, 1586.121], - [-906.768, 114.797, 1570.567], - [-906.661, 110.014, 1570.383], - [-915.659, 109.615, 1585.967],#40 - [-918.103, 104.505, 1590.200], - [-917.925, 088.509, 1589.892], - [-917.558, 055.517, 1589.258], - [-917.192, 022.525, 1588.623], - [-917.014, 006.529, 1588.315], - [-914.459, 001.641, 1583.890], - [-905.461, 002.041, 1568.305], - [-905.462,-002.605, 1568.306], - [-914.459,-002.201, 1583.890], - [-917.015,-007.087, 1588.316],#50 - [-917.194,-023.083, 1588.627], - [-917.565,-056.075, 1589.268], - [-917.935,-089.067, 1589.910], - [-918.114,-105.063, 1590.221], - [-915.671,-110.174, 1585.989], - [-906.673,-110.578, 1570.404], - [-906.780,-115.360, 1570.590], - [-915.760,-114.152, 1586.143], - [-918.422,-118.805, 1590.754], - [-918.959,-134.769, 1591.684],#60 - [-920.066,-167.695, 1593.601], - [-921.173,-200.620, 1595.519], - [-921.710,-216.584, 1596.448], - [-919.383,-221.908, 1592.419], - [-910.404,-223.116, 1576.865], - [-910.611,-227.744, 1577.225], - [-919.555,-225.735, 1592.716], - [-922.318,-230.146, 1597.502], - [-923.211,-246.046, 1599.048], - [-925.052,-278.840, 1602.236],#70 - [-926.892,-311.634, 1605.425], - [-927.785,-327.534, 1606.971], - [-925.580,-333.061, 1603.151], - [-916.636,-335.069, 1587.660], - [-916.956,-339.813, 1588.214], - [-925.846,-337.007, 1603.612], - [-928.705,-341.167, 1608.564], - [-929.952,-356.971, 1610.724], - [-932.524,-389.568, 1615.178], - [-935.096,-422.165, 1619.633],#80 - [-936.343,-437.969, 1621.793], - [-934.263,-443.687, 1618.191], - [-925.373,-446.493, 1602.793], - [-925.786,-451.065, 1603.508], - [-934.604,-447.468, 1618.782], - [-937.554,-451.369, 1623.890], - [-939.152,-467.046, 1626.659], - [-942.449,-499.381, 1632.369], - [-945.746,-531.715, 1638.079], - [-948.179,-555.583, 1642.294],#90 - [-948.101,-558.166, 1642.159], - [-942.495,-591.724, 1632.449], - [-940.623,-595.039, 1629.207], - [-939.292,-593.541, 1626.902]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def _get_inter(D0,u0,D1,u1): - k = -np.cross(D0-D1,u1)/np.cross(u0,u1) - return D0 + k*u0 - - - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - RMin = 1.775#np.min(Poly[0,:])-0.01 - P0 = np.array([[RMin],[Poly[1,0]]]) - PEnd = np.array([[RMin],[Poly[1,-1]]]) - Poly = np.concatenate((P0,Poly,PEnd),axis=1) - ind0 = [0,4,6,-6,-4,-1] - indt = [10,15,19,24,28,33,37,42,46,51,55,60, - 64,69,73,78,82,87] - p0, p1 = [Poly[:,ind0[:3]]], [Poly[:,ind0[:3]]] - for ii in range(0,len(indt),2): - D0, D1 = Poly[:,indt[ii]], Poly[:,indt[ii+1]] - u0, u1 = D0-Poly[:,indt[ii]-1], D1-Poly[:,indt[ii+1]+1] - p0.append(_get_inter(D0,u0,D1,u1)[:,np.newaxis]) - u0, u1 = Poly[:,indt[ii]+1]-D0, Poly[:,indt[ii+1]-1]-D1 - p1.append(np.vstack((D0,_get_inter(D0,u0,D1,u1),D1)).T) - p0.append(Poly[:,ind0[3:]]) - p1.append(Poly[:,ind0[3:]]) - Poly0 = np.concatenate(tuple(p0),axis=1) - Poly1 = np.concatenate(tuple(p1),axis=1) - - if save: - nn = name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V2' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, Poly, notes - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_BumperOuter_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_BumperOuter_Notes.py deleted file mode 100755 index 577650e08..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_BumperOuter_Notes.py +++ /dev/null @@ -1,221 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - - -def get_notes(): - notes = {'DPhi':{}, 'dPhi':{}} - # Total toiroidal width in equatorial plane - notes['DPhi'] = 346.756 - # Toroidal gap between central tiles in equatorial plane - notes['dPhi'] = 1.500 - # Total vertical height - notes['DZ'] = 1047.517 - # Poloidal gap between central tiles - notes['dl'] = 2.249 - # Radial width - notes['DR'] = 134.678 - - # sampleXZY - notes['sampleXZY'] = [[2159.632, 523.758, 2030.517],#0 - [2149.423, 514.993, 2020.128], - [2148.227, 508.130, 2018.912], - [2154.559, 442.235, 2071.259], # h - [2166.380, 414.998, 2085.893], # h - [2178.412, 385.686, 2095.532], # h - [2206.053, 371.041, 2077.756], # e1 - [2210.863, 369.335, 2082.651], - [2221.072, 378.101, 2093.040], - [2222.233, 374.874, 2094.221], - [2211.288, 368.155, 2083.083],#10 - [2209.454, 361.586, 2081.216], # e2 - [2192.106, 347.606, 2109.467], # h - [2201.248, 317.292, 2118.769], # h - [2210.389, 286.979, 2128.072], # h - [2234.025, 280.107, 2106.220], # e1 - [2230.026, 271.564, 2115.303], # i - [2234.631, 268.948, 2119.988], - [2245.923, 275.667, 2130.785], - [2246.768, 272.245, 2131.645], - [2234.940, 267.696, 2120.303],#20 - [2232.501, 261.541, 2117.821], # i - [2240.819, 252.580, 2113.134], # e2 - [2220.353, 246.610, 2138.212], # h - [2226.542, 214.813, 2144.510], # h - [2232.731, 183.016, 2150.808], # h - [2257.455, 167.114, 2130.063], # e1 - [2261.769, 163.634, 2134.453], - [2273.250, 168.183, 2146.136], - [2273.763, 164.630, 2146.658], - [2261.957, 162.335, 2134.644],#30 - [2258.958, 156.705, 2131.592], # e2 - [2238.784, 141.097, 2156.967], # h - [2241.907, 108.399, 2160.145], # h - [2245.030, 075.701, 2163.323], # h - [2268.232, 059.603, 2141.030], # e1 - [2272.178, 055.324, 2145.045], - [2283.984, 057.619, 2157.059], - [2284.156, 054.000, 2157.234], - [2272.241, 054.000, 2145.109], - [2268.736, 049.000, 2141.543],#40 e2 - [2247.062, 033.000, 2165.391], # h - [2272.659, 011.500, 2137.688], # i - [2247.062, 000.000, 2165.391], # h - [2247.062,-033.000, 2165.391], # h - [2268.736,-049.000, 2141.543], # e1 - [2272.241,-054.000, 2145.109], - [2284.156,-054.000, 2157.234], - [2283.984,-057.619, 2157.059], - [2272.178,-055.324, 2145.045], - [2268.232,-059.603, 2141.030],#50 e2 - [2245.030,-075.701, 2163.323], # h - [2241.907,-108.399, 2160.145], # h - [2238.784,-141.097, 2156.967], # h - [2258.958,-156.705, 2131.592], # e1 - [2261.957,-162.335, 2134.644], - [2273.763,-164.630, 2146.658], - [2273.250,-168.183, 2146.136], - [2261.769,-163.634, 2134.453], - [2257.455,-167.114, 2130.063],#59 e2 - [2232.731,-183.016, 2150.808], # h - [2226.542,-214.813, 2144.510], # h - [2220.353,-246.610, 2138.212], # h - [2240.819,-252.580, 2113.134], # e1 - [2232.501,-261.541, 2117.821], # i - [2234.940,-267.696, 2120.303], - [2246.768,-272.245, 2131.645], - [2245.923,-275.667, 2130.785], - [2234.631,-268.948, 2119.988], - [2230.026,-271.564, 2115.303], # i - [2234.025,-280.107, 2106.220],#70 e2 - [2210.389,-286.979, 2128.072], # h - [2201.248,-317.292, 2118.769], # h - [2192.106,-347.606, 2109.467], # h - [2209.454,-361.586, 2081.216], # e1 - [2211.288,-368.155, 2083.083], - [2222.233,-374.874, 2094.221], - [2221.072,-378.101, 2093.040], - [2210.863,-369.335, 2082.651], - [2206.053,-371.041, 2077.756],#79 e2 - [2178.412,-385.686, 2095.532], # h - [2166.486,-413.961, 2083.395], # h - [2154.559,-442.235, 2071.259], # h - [2148.227,-508.130, 2018.912], - [2149.423,-514.993, 2020.128], - [2159.632,-523.758, 2030.517], - [2152.686,-542.612, 2243.735], # Back - [2452.439,-057.045, 2300.172], - [3550.000,-057.150, 0000.000], - [3550.000, 057.150, 0000.000], - [2452.118, 056.737, 2302.204],#90 - [2151.698, 544.667, 2242.729]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - notes['ind_h'] = [3,4,5,12,13,14,23,24,25,32,33,34,41,43,44,51,52,53, - 60,61,62,71,72,73,80,81,82] - notes['ind_Back'] = [86,87,88,89,90,91] - notes['ind_i'] = [16,21,42,64,69] - notes['ind_e1'] = [6,15,26,35,45,54,63,74] - notes['ind_e2'] = [11,22,31,40,50,59,70,79] - - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk and not 'ind' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - -def _get_intersect(D0,u0,D1,u1): - k = -np.cross(D0-D1,u1)/np.cross(u0,u1) - return D0 + k*u0 - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - # Finish V2 - ind = np.zeros((Poly.shape[1],),dtype=bool) - ind[notes['ind_h']] = True - ind[notes['ind_i']] = True - nind = np.arange(0,Poly.shape[1]) - Polybis = Poly.copy() - for ii in range(0,len(notes['ind_e1'])+1): - i0 = notes['ind_e2'][ii-1] if ii>0 else 2 - i1 = notes['ind_e1'][ii] if iii0) & (nind0 in the direction normal to the divertor's upper surface - notes['sampleXZY'] = [[-440.221, -606.218, 1854.847], - [-440.163, -581.217, 1854.860], - [-440.748, -579.362, 1857.546], - [-506.714, -694.150, 2133.992], - [-506.951, -694.466, 2134.837], - [-510.087, -699.924, 2147.977], - [-510.336, -702.527, 2149.054], - [-508.309, -724.780, 2140.295], - [-508.995, -721.633, 2143.101], - [-510.684, -703.089, 2150.401], - [-511.270, -701.984, 2152.937], - [-514.021, -706.772, 2164.465], - [-514.742, -708.491, 2167.329], - [-565.491, -796.886, 2380.007], - [-565.707, -799.489, 2381.092], - [-563.726, -821.241, 2372.530]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def _get_inter(D0,u0,D1,u1): - k = -np.cross(D0-D1,u1)/np.cross(u0,u1) - return D0 + k*u0 - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - R = np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]) - Z = notes['sampleXZY'][:,1] - - d = np.sqrt(np.diff(R)**2+np.diff(Z)**2) - indup = np.argmax(d) - e1 = np.array([R[indup+1]-R[indup], Z[indup+1]-Z[indup]]) - e1 = e1/np.linalg.norm(e1) - e2 = np.r_[-e1[1], e1[0]] - - P0 = (np.array([R[0],Z[0]])-0.01*e2)[:,np.newaxis] - PEnd = (np.array([R[-1],Z[-1]])-0.01*e2)[:,np.newaxis] - Poly = np.array([R[1:-1],Z[1:-1]]) - Poly = np.concatenate((P0,Poly,PEnd),axis=1) - Poly0 = Poly[:,[0,2,-3,-1]] - - # Making Poly1 - D0 = Poly0[:,1] - u0 = Poly0[:,-2]-D0 - k0 = -np.sum((D0-Poly[:,5])*u0)/np.linalg.norm(u0)**2 - k1 = -np.sum((D0-Poly[:,10])*u0)/np.linalg.norm(u0)**2 - P0 = (D0 + k0*u0)[:,np.newaxis] - P1 = (D0 + k1*u0)[:,np.newaxis] - D0, D1 = Poly[:,5], Poly[:,10] - u0, u1 = Poly[:,6]-D0, Poly[:,9]-D1 - PI = _get_inter(D0,u0,D1,u1)[:,np.newaxis] - Poly1 = np.concatenate((Poly0[:,:2], P0,PI,P1, Poly0[:,2:]),axis=1) - - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V2' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, Poly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_DivLowITER_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_DivLowITER_Notes.py deleted file mode 100755 index a7487abfa..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_DivLowITER_Notes.py +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - """ By convention : D is a length of the element, d is a gap """ - - notes = {'DPhi':{}, 'dPhi':{}} - # Toroidal width (mm, inner outer) - notes['DPhi']['In'] = 26.370 - notes['DPhi']['Out'] = 31.929 - - # Inter tiles distance (mm, uniform) - notes['dl'] = 0.500 - - # Poloidal/Radial total length (mm) - notes['DL'] = 437.000 - - # Number of tiles radially - notes['nb'] = 35 - notes['nbPhi'] = 19*2*12 - - # Radial length of a tile (mm, uniform) - notes['Dl'] = 12.000 - - # Vertical height of tiles (mm, uniform) - notes['DZ'] = 26.000 - - # Toroidal space between needles (mm, inner outer) - notes['dPhi']['In'] = 0.588 - notes['dPhi']['Out'] = 0.612 - - # (X,Z,Y) polygon of one needle (mm) !!!!!! (X,Z,Y) - # 1 mm should be added towards Z>0 in the direction normal to the divertor's upper surface - notes['sampleXZY'] = [[-759.457, -625.500, -1797.591], # Old start point - [-759.603, -624.572, -1797.936], # Only for pattern - [-772.277, -620.864, -1794.112], - [-761.681, -610.036, -1769.498], # Computed,tube/plane - [-761.895, -620.231, -1764.921], - [-751.095, -609.687, -1741.154], - [-755.613, -580.944, -1751.852], - [-766.413, -591.488, -1775.620], # Edge of plane - [-763.902, -596.129, -1774.659], # Computed,tube/plane - [-774.498, -606.956, -1799.274], # Middle top of tube - [-763.246, -601.395, -1806.563], - [-767.575, -605.891, -1816.813], - [-763.932, -629.068, -1808.186], - [-764.112, -629.255, -1808.613], - [-767.755, -606.078, -1817.240], - [-772.084, -610.573, -1827.490], - [-768.441, -633.750, -1818.863], - [-768.622, -633.938, -1819.290], - [-772.265, -610.760, -1827.917], - [-776.594, -615.256, -1838.167], - [-772.950, -638.433, -1829.540], - [-773.131, -638.620, -1829.967], - [-776.774, -615.443, -1838.594], - [-781.103, -619.938, -1848.844], - [-777.460, -643.115, -1840.217], - [-777.640, -643.303, -1840.644], - [-781.283, -620.126, -1849.271], - [-785.612, -624.621, -1859.520], - [-781.969, -647.798, -1850.894], - [-782.149, -647.985, -1851.321], - [-785.793, -624.808, -1859.948], - [-790.122, -629.303, -1870.197], - [-786.478, -652.481, -1861.571], - [-786.659, -652.668, -1861.998], - [-790.302, -629.491, -1870.624], - [-794.631, -633.986, -1880.874], - [-790.988, -657.163, -1872.248], - [-791.168, -657.351, -1872.675], - [-794.811, -634.173, -1881.301]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - R = np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]) - Z = notes['sampleXZY'][:,1] - - d = np.sqrt(np.diff(R)**2+np.diff(Z)**2) - indup = (np.abs(d-notes['Dl'])<1.e-6).nonzero()[0] - e1 = np.array([R[indup+1]-R[indup], Z[indup+1]-Z[indup]]) - e1 = np.mean(e1,axis=1) - e1 = e1/np.linalg.norm(e1) - e2 = np.r_[-e1[1], e1[0]] - - nP = 4 - P0 = np.array([R[[0,2,3,4,5,6,7,8,9]],Z[[0,2,3,4,5,6,7,8,9]]]) - PEnd = P0[:,0:1] + e1[:,np.newaxis]*notes['DL'] - El = np.array([R[[1,10,11,12]],Z[[1,10,11,12]]]) - k = np.arange(0,notes['nb']) - l = np.repeat(k*(notes['Dl']+notes['dl']), nP) - Poly = np.tile(El,notes['nb']) + e1[:,np.newaxis]*l[np.newaxis,:] - Poly = np.concatenate((P0,Poly[:,1:],PEnd),axis=1) - Poly0 = Poly[:,[0,1,2,3,4,5,6,7,8,9,-3,-1]] - - # Poly1 - indI0 = np.arange(10,Poly.shape[1]-6,4) - PI = (Poly[:,indI0] + Poly[:,indI0+3])/2. - Poly1 = np.concatenate((Poly0[:,:9],PI,Poly0[:,-3:]),axis=1) - - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V2' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, Poly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_DivUp_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_DivUp_Notes.py deleted file mode 100755 index ddc249d15..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_DivUp_Notes.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - notes = {'DPhi':{}, 'dPhi':{}} - # Total length - notes['DL'] = 449.000 - - # Toroidal width - notes['DPhi']['In'] = 26.151 - notes['DPhi']['Out'] = 31.887 - - # Toroidal gap - notes['dPhi']['In'] = 0.681 - notes['dPhi']['Out'] = 0.680 - - # Height - notes['DZ'] = 41.562 - - # Number in toroidal direction - notes['nbPhi'] = 12*38 - - # sample (X,Z,Y) - notes['sampleXZY'] = [[-1917.967, 640.060, -293.245], - [-1932.817, 601.230, -299.739], - [-2167.242, 697.010, -335.545], - [-2168.645, 697.479, -335.689], - [-2198.613, 709.727, -340.266], - [-2201.495, 711.408, -340.635], - [-2344.246, 769.769, -362.438], - [-2329.510, 808.258, -356.103]] - notes['sampleXZY'] = np.asarray(notes['sampleXZY'],dtype=float) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - Poly0 = Poly[:,[0,1,-2,-1]] - PM = np.mean(Poly[:,[2,5]],axis=1)[:,np.newaxis] - Poly1 = np.concatenate((Poly0[:,:2], PM,Poly0[:,2:]),axis=1) - - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V2' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, Poly, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC1_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC1_Notes.py deleted file mode 100755 index d94b627fe..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC1_Notes.py +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - notes = {} - # Samples from 3D drawings - # IC1 - notes['sampXYZ'] = [[-2471.450, -494.911, 1590.106], # Back - [-2469.748, -335.000, 1749.276], # Back - [-2515.174, -335.000, 1787.393], # Back - [-2515.174, 335.000, 1787.393], # Back - [-2469.748, 335.000, 1749.276], # Back - [-2471.450, 494.911, 1590.106], # Back - [-2292.115, 504.105, 1578.294], # 1st pt - [-2286.026, 504.799, 1544.321], - [-2287.754, 465.078, 1545.771], - [-2293.653, 468.768, 1579.584], # bottom - [-2293.811, 467.342, 1579.717], # bottom - [-2287.937, 463.423, 1545.925], - [-2294.923, 424.698, 1551.787], - [-2300.025, 432.890, 1584.931], # bottom - [-2300.371, 431.522, 1585.221], # bottom - [-2295.324, 423.110, 1552.123], - [-2307.354, 386.556, 1562.218], - [-2311.074, 399.002, 1594.202], # bottom - [-2310.685, 397.685, 1595.181], # bottom - [-2307.977, 385.107, 1562.740], - [-2319.952, 356.614, 1572.789], - [-2322.660, 369.192, 1605.229], # bottom - [-2323.367, 367.162, 1605.909], # bottom - [-2320.358, 355.596, 1573.129], - [-2331.369, 326.447, 1582.369], - [-2334.481, 338.013, 1615.148], # bottom - [-2335.222, 335.939, 1615.770], # bottom - [-2331.741, 325.407, 1582.681], - [-2341.768, 295.659, 1591.094], - [-2345.249, 306.191, 1624.184], # bottom - [-2345.920, 304.077, 1624.747], # bottom - [-2342.104, 294.599, 1591.377], - [-2351.128, 264.308, 1598.948], - [-2354.943, 273.786, 1632.318], # bottom - [-2355.543, 271.635, 1632.821], # bottom - [-2351.429, 263.230, 1599.201], - [-2359.431, 232.454, 1605.916], - [-2363.545, 240.860, 1639.536], # bottom - [-2364.073, 238.677, 1639.979], # bottom - [-2359.696, 231.360, 1606.138], - [-2366.663, 200.158, 1611.984], - [-2371.039, 207.476, 1645.825], # bottom - [-2371.493, 205.265, 1646.205], # bottom - [-2366.890, 199.049, 1612.174], - [-2372.808, 167.481, 1617.140], - [-2377.411, 173.696, 1651.171], # bottom - [-2377.790, 171.461, 1651.489], # bottom - [-2372.998, 166.360, 1617.300], - [-2377.855, 134.484, 1621.375], - [-2382.647, 139.586, 1655.565], # bottom - [-2382.952, 137.332, 1655.820], # bottom - [-2378.008, 133.354, 1621.503], - [-2381.795, 101.232, 1624.681], - [-2386.739, 105.210, 1658.998], - [-2386.968, 102.941, 1659.190], # bottom - [-2381.910, 100.094, 1624.778], # bottom - [-2384.620, 67.787, 1627.052], - [-2389.678, 70.634, 1661.465], # bottom - [-2389.831, 68.354, 1661.593], # bottom - [-2384.697, 66.644, 1627.116], - [-2386.325, 34.213, 1628.482], - [-2391.459, 35.923, 1662.959], # bottom - [-2391.536, 33.637, 1663.023], # bottom - [-2386.364, 33.066, 1628.515], - [-2386.907, 0.574, 1628.970], - [-2392.079, 1.144, 1663.479], # bottom - [-2392.079, -1.144, 1663.479], # bottom - [-2386.907, -0.574, 1628.970], - [-2386.364, -33.066, 1628.515], - [-2391.536, -33.637, 1663.023], # bottom - [-2391.459, -35.923, 1662.959], # bottom - [-2386.325, -34.213, 1628.482], - [-2384.697, -66.644, 1627.116], - [-2389.831, -68.354, 1661.593], # bottom - [-2389.678, -70.634, 1661.465], # bottom - [-2384.620, -67.787, 1627.052], - [-2381.910, -100.094, 1624.778], - [-2386.968, -102.941, 1659.190], # bottom - [-2386.739, -105.210, 1658.998], # bottom - [-2381.795, -101.232, 1624.681], - [-2378.008, -133.354, 1621.503], - [-2382.952, -137.332, 1655.820], # bottom - [-2382.647, -139.586, 1655.565], # bottom - [-2377.855, -134.484, 1621.375], - [-2372.998, -166.360, 1617.300], - [-2377.790, -171.461, 1651.489], # bottom - [-2377.411, -173.696, 1651.171], # bottom - [-2372.808, -167.481, 1617.140], - [-2366.890, -199.049, 1612.174], - [-2371.493, -205.265, 1646.205], # bottom - [-2371.039, -207.476, 1645.825], # bottom - [-2366.663, -200.158, 1611.984], - [-2359.696, -231.360, 1606.138], - [-2364.073, -238.677, 1639.979], # bottom - [-2363.545, -240.860, 1639.536], # bottom - [-2359.431, -232.454, 1605.916], - [-2351.429, -263.230, 1599.201], - [-2355.543, -271.635, 1632.821], # bottom - [-2354.943, -273.786, 1632.318], # bottom - [-2351.128, -264.308, 1598.948], - [-2342.104, -294.599, 1591.377], - [-2345.920, -304.077, 1624.747], # bottom - [-2345.249, -306.191, 1624.184], # bottom - [-2341.768, -295.659, 1591.094], - [-2331.741, -325.407, 1582.681], - [-2335.222, -335.939, 1615.770], # bottom - [-2334.481, -338.013, 1615.148], # bottom - [-2331.369, -326.447, 1582.369], - [-2320.358, -355.596, 1573.129], - [-2323.469, -367.162, 1605.909], # bottom - [-2322.660, -369.192, 1605.229], # bottom - [-2319.952, -356.614, 1572.789], - [-2307.977, -385.107, 1562.740], - [-2310.685, -397.685, 1595.181], # bottom - [-2311.074, -399.002, 1594.202], # bottom - [-2307.354, -386.556, 1562.218], - [-2295.324, -423.110, 1552.123], - [-2300.371, -431.522, 1585.211], # bottom - [-2300.025, -432.890, 1584.931], # bottom - [-2294.923, -424.698, 1551.787], - [-2287.937, -463.423, 1545.925], - [-2293.811, -467.342, 1579.717], # bottom - [-2293.653, -468.768, 1579.584], # bottom - [-2287.754, -465.078, 1545.771], - [-2286.026, -504.799, 1544.321], - [-2292.115, -504.105, 1578.294]] # Last pt - - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - Rref, Rmax = 3., 3.4 - - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC2_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC2_Notes.py deleted file mode 100755 index 5c96d04aa..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC2_Notes.py +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes(): - notes = {} - # Samples from 3D drawings - # Assumed identical to IC1 - notes['sampXYZ'] = [[-2471.450, -494.911, 1590.106], # Back - [-2469.748, -335.000, 1749.276], # Back - [-2515.174, -335.000, 1787.393], # Back - [-2515.174, 335.000, 1787.393], # Back - [-2469.748, 335.000, 1749.276], # Back - [-2471.450, 494.911, 1590.106], # Back - [-2292.115, 504.105, 1578.294], # 1st pt - [-2286.026, 504.799, 1544.321], - [-2287.754, 465.078, 1545.771], - [-2293.653, 468.768, 1579.584], # bottom - [-2293.811, 467.342, 1579.717], # bottom - [-2287.937, 463.423, 1545.925], - [-2294.923, 424.698, 1551.787], - [-2300.025, 432.890, 1584.931], # bottom - [-2300.371, 431.522, 1585.221], # bottom - [-2295.324, 423.110, 1552.123], - [-2307.354, 386.556, 1562.218], - [-2311.074, 399.002, 1594.202], # bottom - [-2310.685, 397.685, 1595.181], # bottom - [-2307.977, 385.107, 1562.740], - [-2319.952, 356.614, 1572.789], - [-2322.660, 369.192, 1605.229], # bottom - [-2323.367, 367.162, 1605.909], # bottom - [-2320.358, 355.596, 1573.129], - [-2331.369, 326.447, 1582.369], - [-2334.481, 338.013, 1615.148], # bottom - [-2335.222, 335.939, 1615.770], # bottom - [-2331.741, 325.407, 1582.681], - [-2341.768, 295.659, 1591.094], - [-2345.249, 306.191, 1624.184], # bottom - [-2345.920, 304.077, 1624.747], # bottom - [-2342.104, 294.599, 1591.377], - [-2351.128, 264.308, 1598.948], - [-2354.943, 273.786, 1632.318], # bottom - [-2355.543, 271.635, 1632.821], # bottom - [-2351.429, 263.230, 1599.201], - [-2359.431, 232.454, 1605.916], - [-2363.545, 240.860, 1639.536], # bottom - [-2364.073, 238.677, 1639.979], # bottom - [-2359.696, 231.360, 1606.138], - [-2366.663, 200.158, 1611.984], - [-2371.039, 207.476, 1645.825], # bottom - [-2371.493, 205.265, 1646.205], # bottom - [-2366.890, 199.049, 1612.174], - [-2372.808, 167.481, 1617.140], - [-2377.411, 173.696, 1651.171], # bottom - [-2377.790, 171.461, 1651.489], # bottom - [-2372.998, 166.360, 1617.300], - [-2377.855, 134.484, 1621.375], - [-2382.647, 139.586, 1655.565], # bottom - [-2382.952, 137.332, 1655.820], # bottom - [-2378.008, 133.354, 1621.503], - [-2381.795, 101.232, 1624.681], - [-2386.739, 105.210, 1658.998], - [-2386.968, 102.941, 1659.190], # bottom - [-2381.910, 100.094, 1624.778], # bottom - [-2384.620, 67.787, 1627.052], - [-2389.678, 70.634, 1661.465], # bottom - [-2389.831, 68.354, 1661.593], # bottom - [-2384.697, 66.644, 1627.116], - [-2386.325, 34.213, 1628.482], - [-2391.459, 35.923, 1662.959], # bottom - [-2391.536, 33.637, 1663.023], # bottom - [-2386.364, 33.066, 1628.515], - [-2386.907, 0.574, 1628.970], - [-2392.079, 1.144, 1663.479], # bottom - [-2392.079, -1.144, 1663.479], # bottom - [-2386.907, -0.574, 1628.970], - [-2386.364, -33.066, 1628.515], - [-2391.536, -33.637, 1663.023], # bottom - [-2391.459, -35.923, 1662.959], # bottom - [-2386.325, -34.213, 1628.482], - [-2384.697, -66.644, 1627.116], - [-2389.831, -68.354, 1661.593], # bottom - [-2389.678, -70.634, 1661.465], # bottom - [-2384.620, -67.787, 1627.052], - [-2381.910, -100.094, 1624.778], - [-2386.968, -102.941, 1659.190], # bottom - [-2386.739, -105.210, 1658.998], # bottom - [-2381.795, -101.232, 1624.681], - [-2378.008, -133.354, 1621.503], - [-2382.952, -137.332, 1655.820], # bottom - [-2382.647, -139.586, 1655.565], # bottom - [-2377.855, -134.484, 1621.375], - [-2372.998, -166.360, 1617.300], - [-2377.790, -171.461, 1651.489], # bottom - [-2377.411, -173.696, 1651.171], # bottom - [-2372.808, -167.481, 1617.140], - [-2366.890, -199.049, 1612.174], - [-2371.493, -205.265, 1646.205], # bottom - [-2371.039, -207.476, 1645.825], # bottom - [-2366.663, -200.158, 1611.984], - [-2359.696, -231.360, 1606.138], - [-2364.073, -238.677, 1639.979], # bottom - [-2363.545, -240.860, 1639.536], # bottom - [-2359.431, -232.454, 1605.916], - [-2351.429, -263.230, 1599.201], - [-2355.543, -271.635, 1632.821], # bottom - [-2354.943, -273.786, 1632.318], # bottom - [-2351.128, -264.308, 1598.948], - [-2342.104, -294.599, 1591.377], - [-2345.920, -304.077, 1624.747], # bottom - [-2345.249, -306.191, 1624.184], # bottom - [-2341.768, -295.659, 1591.094], - [-2331.741, -325.407, 1582.681], - [-2335.222, -335.939, 1615.770], # bottom - [-2334.481, -338.013, 1615.148], # bottom - [-2331.369, -326.447, 1582.369], - [-2320.358, -355.596, 1573.129], - [-2323.469, -367.162, 1605.909], # bottom - [-2322.660, -369.192, 1605.229], # bottom - [-2319.952, -356.614, 1572.789], - [-2307.977, -385.107, 1562.740], - [-2310.685, -397.685, 1595.181], # bottom - [-2311.074, -399.002, 1594.202], # bottom - [-2307.354, -386.556, 1562.218], - [-2295.324, -423.110, 1552.123], - [-2300.371, -431.522, 1585.211], # bottom - [-2300.025, -432.890, 1584.931], # bottom - [-2294.923, -424.698, 1551.787], - [-2287.937, -463.423, 1545.925], - [-2293.811, -467.342, 1579.717], # bottom - [-2293.653, -468.768, 1579.584], # bottom - [-2287.754, -465.078, 1545.771], - [-2286.026, -504.799, 1544.321], - [-2292.115, -504.105, 1578.294]] # Last pt - - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - Rref, Rmax = 3., 3.4 - - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC3_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC3_Notes.py deleted file mode 100755 index d5c038806..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_IC3_Notes.py +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - notes = {} - # Samples from 3D drawings - # Assumed identical to IC1 - notes['sampXYZ'] = [[-2471.450, -494.911, 1590.106], # Back - [-2469.748, -335.000, 1749.276], # Back - [-2515.174, -335.000, 1787.393], # Back - [-2515.174, 335.000, 1787.393], # Back - [-2469.748, 335.000, 1749.276], # Back - [-2471.450, 494.911, 1590.106], # Back - [-2292.115, 504.105, 1578.294], # 1st pt - [-2286.026, 504.799, 1544.321], - [-2287.754, 465.078, 1545.771], - [-2293.653, 468.768, 1579.584], # bottom - [-2293.811, 467.342, 1579.717], # bottom - [-2287.937, 463.423, 1545.925], - [-2294.923, 424.698, 1551.787], - [-2300.025, 432.890, 1584.931], # bottom - [-2300.371, 431.522, 1585.221], # bottom - [-2295.324, 423.110, 1552.123], - [-2307.354, 386.556, 1562.218], - [-2311.074, 399.002, 1594.202], # bottom - [-2310.685, 397.685, 1595.181], # bottom - [-2307.977, 385.107, 1562.740], - [-2319.952, 356.614, 1572.789], - [-2322.660, 369.192, 1605.229], # bottom - [-2323.367, 367.162, 1605.909], # bottom - [-2320.358, 355.596, 1573.129], - [-2331.369, 326.447, 1582.369], - [-2334.481, 338.013, 1615.148], # bottom - [-2335.222, 335.939, 1615.770], # bottom - [-2331.741, 325.407, 1582.681], - [-2341.768, 295.659, 1591.094], - [-2345.249, 306.191, 1624.184], # bottom - [-2345.920, 304.077, 1624.747], # bottom - [-2342.104, 294.599, 1591.377], - [-2351.128, 264.308, 1598.948], - [-2354.943, 273.786, 1632.318], # bottom - [-2355.543, 271.635, 1632.821], # bottom - [-2351.429, 263.230, 1599.201], - [-2359.431, 232.454, 1605.916], - [-2363.545, 240.860, 1639.536], # bottom - [-2364.073, 238.677, 1639.979], # bottom - [-2359.696, 231.360, 1606.138], - [-2366.663, 200.158, 1611.984], - [-2371.039, 207.476, 1645.825], # bottom - [-2371.493, 205.265, 1646.205], # bottom - [-2366.890, 199.049, 1612.174], - [-2372.808, 167.481, 1617.140], - [-2377.411, 173.696, 1651.171], # bottom - [-2377.790, 171.461, 1651.489], # bottom - [-2372.998, 166.360, 1617.300], - [-2377.855, 134.484, 1621.375], - [-2382.647, 139.586, 1655.565], # bottom - [-2382.952, 137.332, 1655.820], # bottom - [-2378.008, 133.354, 1621.503], - [-2381.795, 101.232, 1624.681], - [-2386.739, 105.210, 1658.998], - [-2386.968, 102.941, 1659.190], # bottom - [-2381.910, 100.094, 1624.778], # bottom - [-2384.620, 67.787, 1627.052], - [-2389.678, 70.634, 1661.465], # bottom - [-2389.831, 68.354, 1661.593], # bottom - [-2384.697, 66.644, 1627.116], - [-2386.325, 34.213, 1628.482], - [-2391.459, 35.923, 1662.959], # bottom - [-2391.536, 33.637, 1663.023], # bottom - [-2386.364, 33.066, 1628.515], - [-2386.907, 0.574, 1628.970], - [-2392.079, 1.144, 1663.479], # bottom - [-2392.079, -1.144, 1663.479], # bottom - [-2386.907, -0.574, 1628.970], - [-2386.364, -33.066, 1628.515], - [-2391.536, -33.637, 1663.023], # bottom - [-2391.459, -35.923, 1662.959], # bottom - [-2386.325, -34.213, 1628.482], - [-2384.697, -66.644, 1627.116], - [-2389.831, -68.354, 1661.593], # bottom - [-2389.678, -70.634, 1661.465], # bottom - [-2384.620, -67.787, 1627.052], - [-2381.910, -100.094, 1624.778], - [-2386.968, -102.941, 1659.190], # bottom - [-2386.739, -105.210, 1658.998], # bottom - [-2381.795, -101.232, 1624.681], - [-2378.008, -133.354, 1621.503], - [-2382.952, -137.332, 1655.820], # bottom - [-2382.647, -139.586, 1655.565], # bottom - [-2377.855, -134.484, 1621.375], - [-2372.998, -166.360, 1617.300], - [-2377.790, -171.461, 1651.489], # bottom - [-2377.411, -173.696, 1651.171], # bottom - [-2372.808, -167.481, 1617.140], - [-2366.890, -199.049, 1612.174], - [-2371.493, -205.265, 1646.205], # bottom - [-2371.039, -207.476, 1645.825], # bottom - [-2366.663, -200.158, 1611.984], - [-2359.696, -231.360, 1606.138], - [-2364.073, -238.677, 1639.979], # bottom - [-2363.545, -240.860, 1639.536], # bottom - [-2359.431, -232.454, 1605.916], - [-2351.429, -263.230, 1599.201], - [-2355.543, -271.635, 1632.821], # bottom - [-2354.943, -273.786, 1632.318], # bottom - [-2351.128, -264.308, 1598.948], - [-2342.104, -294.599, 1591.377], - [-2345.920, -304.077, 1624.747], # bottom - [-2345.249, -306.191, 1624.184], # bottom - [-2341.768, -295.659, 1591.094], - [-2331.741, -325.407, 1582.681], - [-2335.222, -335.939, 1615.770], # bottom - [-2334.481, -338.013, 1615.148], # bottom - [-2331.369, -326.447, 1582.369], - [-2320.358, -355.596, 1573.129], - [-2323.469, -367.162, 1605.909], # bottom - [-2322.660, -369.192, 1605.229], # bottom - [-2319.952, -356.614, 1572.789], - [-2307.977, -385.107, 1562.740], - [-2310.685, -397.685, 1595.181], # bottom - [-2311.074, -399.002, 1594.202], # bottom - [-2307.354, -386.556, 1562.218], - [-2295.324, -423.110, 1552.123], - [-2300.371, -431.522, 1585.211], # bottom - [-2300.025, -432.890, 1584.931], # bottom - [-2294.923, -424.698, 1551.787], - [-2287.937, -463.423, 1545.925], - [-2293.811, -467.342, 1579.717], # bottom - [-2293.653, -468.768, 1579.584], # bottom - [-2287.754, -465.078, 1545.771], - [-2286.026, -504.799, 1544.321], - [-2292.115, -504.105, 1578.294]] # Last pt - - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - Rref, Rmax = 3., 3.4 - - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, notes - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_LH1_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_LH1_Notes.py deleted file mode 100755 index 1714f1c25..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_LH1_Notes.py +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes(): - notes = {} - # Samples from metrology - # C3 - D - notes['sampXYZ-D'] = [[1.53826756, -0.309802392, 0.495340], - [1.55438849, -0.310366326, 0.414159], - [1.58692824, -0.310687258, 0.348138], - [1.61481964, -0.310836715, 0.286890], - [1.63695890, -0.310959610, 0.223451], - [1.65338025, -0.311736673, 0.158320], - [1.66487966, -0.311825521, 0.091980], - [1.67042531, -0.311035384, 0.024930], - [1.66947988, -0.311205048, -0.042300], - [1.66307559, -0.308964918, -0.109200], - [1.65061648, -0.309699531, -0.175280], - [1.63262807, -0.310546907, -0.240020], - [1.60945846, -0.309854818, -0.303073], - [1.58012145, -0.311321117, -0.363462]] - # C3 - G - notes['sampXYZ-G'] = [[1.54096476, 0.309275398, 0.495340], - [1.55528740, 0.311577153, 0.414159], - [1.58731480, 0.310884910, 0.348138], - [1.61505288, 0.310597222, 0.286890], - [1.63812089, 0.310657956, 0.223451], - [1.65434222, 0.310749224, 0.158320], - [1.66508793, 0.310635608, 0.091980], - [1.67065466, 0.310522712, 0.024930], - [1.67017474, 0.310654427, -0.042300], - [1.66378725, 0.311205322, -0.109200], - [1.65120413, 0.311586155, -0.175280], - [1.63299619, 0.309925216, -0.240020], - [1.60829284, 0.311433064, -0.303073], - [1.58020776, 0.312038682, -0.363462]] - notes['sampXYZ-D'] = np.array(notes['sampXYZ-D']) - notes['sampXYZ-G'] = np.array(notes['sampXYZ-G']) - return notes - - -def get_notes2(): - notes = {} - # Samples from 3D drawings - # C3 - D - notes['sampXYZ'] = [[-1991.385,-494.911, -2191.731], # Back - [-2133.133,-318.000, -2143.935], # Back - [-3205.596,-318.000, -3043.838], # Back - [-3205.596, 318.000, -3043.838], # Back - [-2133.133, 318.000, -2143.935], # Back - [-1991.385, 494.911, -2191.731], # Back - [-1952.407, 504.105, -2020.357], # First pt - [-1917.893, 504.799, -2020.259], - [-1919.621, 465.078, -2021.709], - [-1953.944, 468.768, -2021.646], # bottom - [-1954.102, 467.342, -2021.779], # bottom - [-1919.804, 463.423, -2021.863], - [-1926.790, 424.698, -2027.724], - [-1960.317, 432.890, -2026.994], # bottom - [-1960.662, 431.522, -2027.284], # bottom - [-1927.191, 423.110, -2028.061], - [-1939.221, 386.556, -2038.156], - [-1971.365, 399.002, -2036.265], # bottom - [-1972.262, 397.685, -2035.711], # bottom - [-1939.844, 385.107, -2038.678], - [-1951.819, 356.614, -2048.726], - [-1984.237, 369.192, -2045.760], # bottom - [-1985.046, 367.162, -2046.439], # bottom - [-1952.225, 355.596, -2049.067], - [-1963.236, 326.447, -2058.307], - [-1996.058, 338.013, -2055.679], # bottom - [-1996.799, 335.939, -2056.300], # bottom - [-1963.608, 325.407, -2058.618], - [-1973.635, 295.659, -2067.032], - [-2006.826, 306.191, -2064.714], # bottom - [-2007.497, 304.077, -2065.277], # bottom - [-1973.971, 294.599, -2067.314], - [-1982.995, 264.308, -2074.886], - [-2016.520, 273.786, -2072.849], # bottom - [-2017.120, 271.635, -2073.352], # bottom - [-1983.296, 263.230, -2075.138], - [-1991.298, 232.454, -2081.853], - [-2025.123, 240.860, -2080.067], # bottom - [-2025.650, 238.677, -2080.509], # bottom - [-1991.563, 231.360, -2082.075], - [-1998.529, 200.158, -2087.921], - [-2032.617, 207.476, -2086.355], # bottom - [-2033.070, 205.265, -2086.736], # bottom - [-1998.757, 199.049, -2088.112], - [-2004.675, 167.481, -2093.077], - [-2038.988, 173.696, -2091.701], # bottom - [-2039.367, 171.461, -2092.020], # bottom - [-2004.865, 166.360, -2093.237], - [-2009.722, 134.484, -2097.313], - [-2044.224, 139.586, -2096.095], # bottom - [-2044.529, 137.332, -2096.351], # bottom - [-2009.875, 133.354, -2097.441], - [-2013.662, 101.232, -2100.619], - [-2048.316, 105.210, -2099.529], # bottom - [-2048.545, 102.941, -2099.721], # bottom - [-2013.777, 100.094, -2100.715], - [-2016.487, 67.787, -2102.989], - [-2051.255, 70.634, -2101.995], # bottom - [-2051.408, 68.354, -2102.123], # bottom - [-2016.564, 66.644, -2103.054], - [-2018.192, 34.213, -2104.420], - [-2053.037, 35.923, -2103.490], # bottom - [-2053.113, 33.637, -2103.554], # bottom - [-2018.231, 33.066, -2104.452], - [-2018.774, 0.574, -2104.908], - [-2053.656, 1.144, -2104.009], # bottom - [-2053.656, -1.144, -2104.009], # bottom - [-2018.774, -0.574, -2104.908], - [-2018.231, -33.066, -2104.452], - [-2053.113, -33.637, -2103.554], # bottom - [-2053.037, -35.923, -2103.490], # bottom - [-2018.192, -34.213, -2104.420], - [-2016.564, -66.644, -2103.054], - [-2051.408, -68.354, -2102.123], # bottom - [-2051.255, -70.634, -2101.995], # bottom - [-2016.487, -67.787, -2102.989], - [-2013.777,-100.094, -2100.715], - [-2048.545,-102.941, -2099.721], # bottom - [-2048.316,-105.210, -2099.529], # bottom - [-2013.662,-101.232, -2100.619], - [-2009.875,-133.354, -2097.441], - [-2044.529,-137.332, -2096.351], # bottom - [-2044.224,-139.586, -2096.095], # bottom - [-2009.722,-134.484, -2097.131], - [-2004.865,-166.360, -2093.237], - [-2039.367,-171.461, -2092.020], # bottom - [-2038.988,-173.696, -2091.701], # bottom - [-2004.675,-167.481, -2093.077], - [-1998.757,-199.049, -2088.112], - [-2033.070,-205.265, -2086.736], # bottom - [-2032.617,-207.476, -2086.355], # bottom - [-1998.529,-200.158, -2087.921], - [-1991.523,-231.360, -2082.075], - [-2025.650,-238.677, -2080.509], # bottom - [-2025.123,-240.860, -2080.067], # bottom - [-1991.298,-232.454, -2081.853], - [-1983.296,-263.230, -2075.138], - [-2017.120,-271.635, -2073.352], # bottom - [-2016.520,-273.786, -2072.849], # bottom - [-1982.995,-264.308, -2074.886], - [-1973.971,-294.599, -2067.314], - [-2007.497,-304.077, -2065.277], # bottom - [-2006.826,-306.191, -2064.714], # bottom - [-1973.635,-295.659, -2067.032], - [-1963.608,-325.407, -2058.618], - [-1996.799,-335.939, -2056.300], # bottom - [-1996.058,-338.013, -2055.679], # bottom - [-1963.236,-326.447, -2058.307], - [-1952.225,-355.596, -2049.067], - [-1985.046,-367.162, -2046.439], # bottom - [-1984.237,-369.192, -2045.760], # bottom - [-1951.819,-356.614, -2048.726], - [-1939.844,-385.107, -2038.678], - [-1972.262,-397.685, -2035.711], # bottom - [-1971.365,-399.002, -2036.265], # bottom - [-1939.221,-386.556, -2038.156], - [-1927.191,-423.110, -2028.061], - [-1960.662,-431.522, -2027.284], # bottom - [-1960.317,-432.890, -2026.994], # bottom - [-1926.790,-424.698, -2027.724], - [-1919.804,-463.423, -2021.863], - [-1954.102,-467.342, -2021.779], # bottom - [-1953.944,-468.768, -2021.646], # bottom - [-1919.621,-465.078, -2021.709], - [-1917.893,-504.799, -2020.259], - [-1952.407,-504.105, -2020.357]] - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes2() - Rref, Rmax = 3., 3.4 - - #D1, G1 = notes['sampXYZ-D'], notes['sampXYZ-G'] - #R = np.mean(np.vstack((D1[:,0],G1[:,0])),axis=0) - #Z = np.mean(np.vstack((D1[:,2],G1[:,2])),axis=0) - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - #R = R-np.max(R)+Rref - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_LH2_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_LH2_Notes.py deleted file mode 100755 index 4598e712f..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_LH2_Notes.py +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes(): - notes = {} - # Samples from metrology - # C4 - D - notes['sampXYZ-D'] = [[1.53858885, -0.317150161, 0.495340], - [1.55346017, -0.316698552, 0.414281], - [1.58584884, -0.316851465, 0.348142], - [1.61372436, -0.316772548, 0.286890], - [1.63649027, -0.316136243, 0.223451], - [1.65305608, -0.316798816, 0.158320], - [1.66405349, -0.316906099, 0.091980], - [1.66947363, -0.316720751, 0.024930], - [1.66869769, -0.316878256, -0.042300], - [1.66231606, -0.316079895, -0.109200], - [1.64991395, -0.316419198, -0.175280], - [1.63218580, -0.316491420, -0.240020], - [1.60771501, -0.315952021, -0.304940], - [1.57945958, -0.318684815, -0.363551], - [1.54829413, -0.317704783, -0.433810]] - - # C4 - G - notes['sampXYZ-G'] = [[1.53927586, 0.316218900, 0.495340], - [1.55416224, 0.317882549, 0.414281], - [1.58637810, 0.317035251, 0.348142], - [1.61420646, 0.318080523, 0.286890], - [1.63678831, 0.316923505, 0.223451], - [1.65359660, 0.311701203, 0.158320], - [1.66476593, 0.316589819, 0.091980], - [1.67003280, 0.315827173, 0.024930], - [1.66972635, 0.316856021, -0.042300], - [1.66309487, 0.316981217, -0.109200], - [1.65082120, 0.317274875, -0.175280], - [1.63294007, 0.317606267, -0.240020], - [1.60813816, 0.318085317, -0.304940], - [1.58034273, 0.317932644, -0.363551], - [1.54951659, 0.316900258, -0.433810]] - - notes['sampXYZ-D'] = np.array(notes['sampXYZ-D']) - notes['sampXYZ-G'] = np.array(notes['sampXYZ-G']) - return notes - -def get_notes2(): - notes = {} - # Samples from 3D drawings - (assumed identical to LH1) - notes['sampXYZ'] = [[-1991.385,-494.911, -2191.731], # Back - [-2133.133,-318.000, -2143.935], # Back - [-3205.596,-318.000, -3043.838], # Back - [-3205.596, 318.000, -3043.838], # Back - [-2133.133, 318.000, -2143.935], # Back - [-1991.385, 494.911, -2191.731], # Back - [-1952.407, 504.105, -2020.357], # First pt - [-1917.893, 504.799, -2020.259], - [-1919.621, 465.078, -2021.709], - [-1953.944, 468.768, -2021.646], # bottom - [-1954.102, 467.342, -2021.779], # bottom - [-1919.804, 463.423, -2021.863], - [-1926.790, 424.698, -2027.724], - [-1960.317, 432.890, -2026.994], # bottom - [-1960.662, 431.522, -2027.284], # bottom - [-1927.191, 423.110, -2028.061], - [-1939.221, 386.556, -2038.156], - [-1971.365, 399.002, -2036.265], # bottom - [-1972.262, 397.685, -2035.711], # bottom - [-1939.844, 385.107, -2038.678], - [-1951.819, 356.614, -2048.726], - [-1984.237, 369.192, -2045.760], # bottom - [-1985.046, 367.162, -2046.439], # bottom - [-1952.225, 355.596, -2049.067], - [-1963.236, 326.447, -2058.307], - [-1996.058, 338.013, -2055.679], # bottom - [-1996.799, 335.939, -2056.300], # bottom - [-1963.608, 325.407, -2058.618], - [-1973.635, 295.659, -2067.032], - [-2006.826, 306.191, -2064.714], # bottom - [-2007.497, 304.077, -2065.277], # bottom - [-1973.971, 294.599, -2067.314], - [-1982.995, 264.308, -2074.886], - [-2016.520, 273.786, -2072.849], # bottom - [-2017.120, 271.635, -2073.352], # bottom - [-1983.296, 263.230, -2075.138], - [-1991.298, 232.454, -2081.853], - [-2025.123, 240.860, -2080.067], # bottom - [-2025.650, 238.677, -2080.509], # bottom - [-1991.563, 231.360, -2082.075], - [-1998.529, 200.158, -2087.921], - [-2032.617, 207.476, -2086.355], # bottom - [-2033.070, 205.265, -2086.736], # bottom - [-1998.757, 199.049, -2088.112], - [-2004.675, 167.481, -2093.077], - [-2038.988, 173.696, -2091.701], # bottom - [-2039.367, 171.461, -2092.020], # bottom - [-2004.865, 166.360, -2093.237], - [-2009.722, 134.484, -2097.313], - [-2044.224, 139.586, -2096.095], # bottom - [-2044.529, 137.332, -2096.351], # bottom - [-2009.875, 133.354, -2097.441], - [-2013.662, 101.232, -2100.619], - [-2048.316, 105.210, -2099.529], # bottom - [-2048.545, 102.941, -2099.721], # bottom - [-2013.777, 100.094, -2100.715], - [-2016.487, 67.787, -2102.989], - [-2051.255, 70.634, -2101.995], # bottom - [-2051.408, 68.354, -2102.123], # bottom - [-2016.564, 66.644, -2103.054], - [-2018.192, 34.213, -2104.420], - [-2053.037, 35.923, -2103.490], # bottom - [-2053.113, 33.637, -2103.554], # bottom - [-2018.231, 33.066, -2104.452], - [-2018.774, 0.574, -2104.908], - [-2053.656, 1.144, -2104.009], # bottom - [-2053.656, -1.144, -2104.009], # bottom - [-2018.774, -0.574, -2104.908], - [-2018.231, -33.066, -2104.452], - [-2053.113, -33.637, -2103.554], # bottom - [-2053.037, -35.923, -2103.490], # bottom - [-2018.192, -34.213, -2104.420], - [-2016.564, -66.644, -2103.054], - [-2051.408, -68.354, -2102.123], # bottom - [-2051.255, -70.634, -2101.995], # bottom - [-2016.487, -67.787, -2102.989], - [-2013.777,-100.094, -2100.715], - [-2048.545,-102.941, -2099.721], # bottom - [-2048.316,-105.210, -2099.529], # bottom - [-2013.662,-101.232, -2100.619], - [-2009.875,-133.354, -2097.441], - [-2044.529,-137.332, -2096.351], # bottom - [-2044.224,-139.586, -2096.095], # bottom - [-2009.722,-134.484, -2097.131], - [-2004.865,-166.360, -2093.237], - [-2039.367,-171.461, -2092.020], # bottom - [-2038.988,-173.696, -2091.701], # bottom - [-2004.675,-167.481, -2093.077], - [-1998.757,-199.049, -2088.112], - [-2033.070,-205.265, -2086.736], # bottom - [-2032.617,-207.476, -2086.355], # bottom - [-1998.529,-200.158, -2087.921], - [-1991.523,-231.360, -2082.075], - [-2025.650,-238.677, -2080.509], # bottom - [-2025.123,-240.860, -2080.067], # bottom - [-1991.298,-232.454, -2081.853], - [-1983.296,-263.230, -2075.138], - [-2017.120,-271.635, -2073.352], # bottom - [-2016.520,-273.786, -2072.849], # bottom - [-1982.995,-264.308, -2074.886], - [-1973.971,-294.599, -2067.314], - [-2007.497,-304.077, -2065.277], # bottom - [-2006.826,-306.191, -2064.714], # bottom - [-1973.635,-295.659, -2067.032], - [-1963.608,-325.407, -2058.618], - [-1996.799,-335.939, -2056.300], # bottom - [-1996.058,-338.013, -2055.679], # bottom - [-1963.236,-326.447, -2058.307], - [-1952.225,-355.596, -2049.067], - [-1985.046,-367.162, -2046.439], # bottom - [-1984.237,-369.192, -2045.760], # bottom - [-1951.819,-356.614, -2048.726], - [-1939.844,-385.107, -2038.678], - [-1972.262,-397.685, -2035.711], # bottom - [-1971.365,-399.002, -2036.265], # bottom - [-1939.221,-386.556, -2038.156], - [-1927.191,-423.110, -2028.061], - [-1960.662,-431.522, -2027.284], # bottom - [-1960.317,-432.890, -2026.994], # bottom - [-1926.790,-424.698, -2027.724], - [-1919.804,-463.423, -2021.863], - [-1954.102,-467.342, -2021.779], # bottom - [-1953.944,-468.768, -2021.646], # bottom - [-1919.621,-465.078, -2021.709], - [-1917.893,-504.799, -2020.259], - [-1952.407,-504.105, -2020.357]] - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - -def make_Poly(save=_save, path=_here): - notes = get_notes2() - Rref, Rmax = 3., 3.4 - - #D1, G1 = notes['sampXYZ-D'], notes['sampXYZ-G'] - #R = np.mean(np.vstack((D1[:,0],G1[:,0])),axis=0) - #Z = np.mean(np.vstack((D1[:,2],G1[:,2])),axis=0) - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - #R = R-np.max(R)+Rref - #Poly0 = np.array([np.r_[R, Rmax, Rmax], np.r_[Z,np.min(Z),np.max(Z)]]) - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly0, Poly1, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_Ripple_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PFC_Ripple_Notes.py deleted file mode 100755 index f8db5926e..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PFC_Ripple_Notes.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - """ By convention : D is a length of the element, d is a gap """ - - notes = {'DPhi':{}} - # Toroidal width (mm, inner outer) - notes['DPhi']['In'] = 44.000 - notes['DPhi']['Out'] = 44.000 - - notes['nbtor'] = 6 - - notes['DL'] = 284.000 - notes['DZ'] = 30.023 - - # sampleXZY - notes['sampleXZY'] = [[-1218.000, 836.000, 2109.638], - [-1218.000, 805.994, 2109.638], - [-1357.000, 805.994, 2350.393], - [-1358.161, 806.468, 2352.403], - [-1359.121, 807.751, 2354.067], - [-1359.763, 809.674, 2355.180], - [-1360.000, 811.994, 2355.589], - [-1360.000, 827.000, 2355.589]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - Polymin = Poly[:,[0,1,2,6,7]] - - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Polymin.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - nn = _name+'V1' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pathfilext, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return Poly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_PlasmaDomain_Standard_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_PlasmaDomain_Standard_Notes.py deleted file mode 100755 index e321b8a02..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_PlasmaDomain_Standard_Notes.py +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -# tofu_west -from WEST_PFC_BumperInner_Notes import make_Poly as InBump -#from tofu_west.VesStruct.Inputs.WEST_Struct_VDE_Notes import make_Poly as VDE -from WEST_PFC_Ripple_Notes import make_Poly as Ripple -from WEST_PFC_DivLowGC_Notes import make_Poly as LowDiv -from WEST_PFC_DivUp_Notes import make_Poly as UpDiv -#from tofu_west.VesStruct.Inputs.WEST_Struct_Baffle_Notes import make_Poly as Baffle - - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes_UpDivSupport(): - notes = {} - # sampleXZY - notes['sampleXZY'] = [[780.663, 799.580, -2162.398], - [665.129, 663.100, -1844.969], - [662.219, 661.100, -1819.433], - [699.823, 661.100, -1744.892]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def get_notes_PEI(): - - notes = {} - # Number of panles in toroidal direction - notes['nbPhi'] = 30 - # Toroidal width in equatorial plane - notes['DPhi'] = 343.653 - - # sampleXZY - notes['sampleXZY'] = [[1323.509, 648.510, -1332.719], - [1312.213, 555.372, -1312.213], - [1261.223, 442.976, -1323.715], - [1239.370, 155.735, -1299.672], - [1532.443, 049.922, -921.707], - [1311.454, 000.000, -1217.927], - [1532.443,-049.922, -921.707], - [1239.370,-155.735, -1299.672], - [1261.223,-442.976, -1325.715], - [1312.213,-555.372, -1312.213], - [1292.845,-648.518, -1347.774]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - -def get_notes_LowDivSupport(): - notes = {} - # sampleXZY - notes['sampleXZY'] = [[1861.032, -658.200, 266.381], - [1906.785, -658.200, 336.218], - [1931.405, -660.200, 340.559], - [2262.225, -795.922, 398.891]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - -def get_notes_LFS(): - notes = {} - # sampleXZY - notes['sampleXZY'] = [[2415.303, -797.969, -1325.194], - [2467.984, -779.176, -1355.609], - [2517.375, -750.879, -1384.125], - [2562.071, -717.338, -1409.930], - [2604.414, -680.461, -1434.377], - [2644.704, -639.931, -1457.639], - [2682.678, -595.887, -1479.563], - [2716.153, -551.311, -1498.890], - [2747.786, -502.835, -1517.153], - [2777.383, -450.254, -1534.241], - [2802.909, -396.912, -1554.978], - [2824.881, -342.348, -1561.664], - [2844.618, -282.957, -1573.059], - [2859.326, -226.839, -1581.551], - [2871.246, -167.234, -1588.432], - [2879.653, -105.919, -1593.286], - [2884.292, -043.463, -1596.035], - [2885.066, 015.167, -1596.412], - [2882.103, 080.155, -1594.701], - [2876.169, 133.956, -1591.275], - [2864.513, 195.563, -1587.924], - [2850.877, 260.786, -1576.673], - [2834.388, 315.143, -1567.152], - [2813.764, 370.994, -1555.245], - [2786.949, 431.177, -1539.764], - [2763.249, 476.096, -1526.080], - [2731.774, 528.094, -1507.908], - [2698.419, 575.507, -1488.651], - [2660.113, 622.771, -1466.535], - [2620.738, 664.693, -1443.802], - [2579.993, 702.297, -1420.278], - [2537.090, 736.594, -1395.507], - [2486.115, 771.280, -1366.077], - [2444.330, 795.360, -1341.952], - [2392.328, 820.525, -1311.929], - [2342.744, 839.444, -1283.302], - [2294.217, 853.544, -1255.285], - [2244.367, 863.562, -1226.504], - [2192.957, 869.452, -1196.822]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - - nup = get_notes_UpDivSupport() - nin = get_notes_PEI() - nlow = get_notes_LowDivSupport() - nout = get_notes_LFS() - - Rup = np.hypot(nup['sampleXZY'][:,0],nup['sampleXZY'][:,2]) - Zup = nup['sampleXZY'][:,1] - Rin = np.hypot(nin['sampleXZY'][:,0],nin['sampleXZY'][:,2]) - Zin = nin['sampleXZY'][:,1] - Rlow = np.hypot(nlow['sampleXZY'][:,0],nlow['sampleXZY'][:,2]) - Zlow = nlow['sampleXZY'][:,1] - Rout = np.hypot(nout['sampleXZY'][:,0],nout['sampleXZY'][:,2]) - Zout = nout['sampleXZY'][:,1] - - indneg = (Zout>0).nonzero()[0][0] - Rout = np.r_[Rout[:indneg], 3.2977, Rout[indneg:]] - Zout = np.r_[Zout[:indneg], 0., Zout[indneg:]] - - Poly = np.array([np.r_[Rup,Rin,Rlow,Rout], np.r_[Zup,Zin,Zlow,Zout]]) - - # Make V0 (inc. inner bumpers, up/low div, VDE/ripple and baffle) - PIn = InBump()[0] - PRip = Ripple()[0] - PLD = LowDiv()[0] - PUD = UpDiv()[0][:,::-1] - PVDE = np.loadtxt(os.path.join(path,'WEST_PFC_VDE_V0.txt')).T - PBa = np.loadtxt(os.path.join(path,'WEST_PFC_Baffle_V0.txt')).T - ind = (Poly[0,:]>2.75) & (Poly[1,:]<0.78) - Poly0 = [PVDE[:,:2],PUD[:,1:-1],PIn[:,2:-2],PLD[:,1:-1], - PBa[:,6:-7],Poly[:,ind]] - Poly0 = np.concatenate(tuple(Poly0),axis=1) - - # Poly1 - ind0 = (Poly[0,:]<1.9) & (Poly[1,:]>-0.6) & (Poly[1,:]<0.6) - ind = Poly[0,:]>2.47 - Poly1 = [PUD[:,1:-1],Poly[:,ind0],PLD[:,1:-1], - PBa[:,2:-2],Poly[:,ind]] - Poly1 = np.concatenate(tuple(Poly1),axis=1) - - if save: - name = 'V0' - savename = 'TFG_%s_Exp%s_%s'%(_Cls,_Exp,name) - pfe = os.path.join(path, savename+'.txt') - np.savetxt(pfe, Poly0.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,name,_Cls)) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pfe, Poly1.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,name,_Cls)) - pathfilext = os.path.join(path, cstr+'_V2.txt') - np.savetxt(pfe, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,name,_Cls)) - return Poly0, Poly1, Poly, (nup,nin,nlow,nout) - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_Ves_VesIn_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_Ves_VesIn_Notes.py deleted file mode 100755 index 11ca8357e..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_Ves_VesIn_Notes.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - # Notes from creoView/python (R,Z) - notes = {'C': np.r_[2.422, 0.], - 'r_in': 1.882/2., - 'r_out': 1.992/2.} # r_out for later use (thick) - - return notes - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - C = notes['C'] - nP = 100 - theta = np.linspace(0.,2*np.pi, nP, endpoint=False) - Poly = np.array([C[0]+notes['r_in']*np.cos(theta), - C[1]+notes['r_in']*np.sin(theta)]) - - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return P, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/_DEPRECATED_WEST_Ves_VesOut_Notes.py b/tofu/geom/inputs/_DEPRECATED_WEST_Ves_VesOut_Notes.py deleted file mode 100755 index ebc26872a..000000000 --- a/tofu/geom/inputs/_DEPRECATED_WEST_Ves_VesOut_Notes.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - # Notes from creoView (-X,Z,Y) - notes = {'C': np.r_[2.465, 0.], - 'r_in': 3.162/2., # r_out for later use (thick) - 'r_out': 3.292/2.} - return notes - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - C = notes['C'] - nP = 100 - theta = np.linspace(0.,2*np.pi, nP, endpoint=False) - P = np.array([C[0]+notes['r_out']*np.cos(theta), - C[1]+notes['r_out']*np.sin(theta)]) - - if save: - nn = _name+'V0' - pfe = os.path.join(path, nn+'.txt') - np.savetxt(pfe, Poly.T, comments='#', - header='Exp = %s\nName = %s\nCls = %s'%(_Exp,nn,_Cls)) - return P, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/geom/inputs/__init__.py b/tofu/geom/inputs/__init__.py deleted file mode 100755 index e69de29bb..000000000 diff --git a/tofu/imas2tofu/__init__.py b/tofu/imas2tofu/__init__.py deleted file mode 100644 index ea5371cf7..000000000 --- a/tofu/imas2tofu/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# -*- coding: utf-8 -*- -#! /usr/bin/python -""" -The imas-compatibility module of tofu - -""" -import warnings -import traceback - -try: - try: - from tofu.imas2tofu._core import * - except Exception: - from ._core import * - del warnings, traceback -except Exception as err: - if str(err) == 'imas not available': - msg = "" - msg += "\n\nIMAS python API issue\n" - msg += "imas could not be imported into tofu ('import imas' failed):\n" - msg += " - it may not be installed (optional dependency)\n" - msg += " - or you not have loaded the good working environment\n\n" - msg += " => the optional sub-package tofu.imas2tofu is not usable\n" - else: - msg = str(traceback.format_exc()) - msg += "\n\n => the optional sub-package tofu.imas2tofu is not usable\n" - warnings.warn(msg) - del msg, err - -__all__ = ['MultiIDSLoader', 'load_Config', 'load_Plasma2D', - 'load_Cam', 'load_Data'] diff --git a/tofu/mag/.gitignore b/tofu/mag/.gitignore deleted file mode 100644 index 9ce609dce..000000000 --- a/tofu/mag/.gitignore +++ /dev/null @@ -1,63 +0,0 @@ -# Specific to this project # -############################ -.nfs* -*.mat -*.npz -!reference.npz -*.npy -*.ldp -fort.* - -# Compiled source # -################### -*.com -*.class -*.dll -*.exe -*.o -*.so -*.a -*.pyc -*.rtl -*.d - -# Temporary files # -################### -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -.\#* -*.swp -*.swo - -# Packages # -############ -# it's better to unpack these files and commit the raw source -# git has its own built in compression methods -*.7z -*.dmg -*.gz -*.iso -*.jar -*.rar -*.tar -*.zip - -# Logs and databases # -###################### -*.log -*.sql -*.sqlite - -# OS generated files # -###################### -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db diff --git a/tofu/mag/__init__.py b/tofu/mag/__init__.py deleted file mode 100644 index 96b103f5b..000000000 --- a/tofu/mag/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# Also if needed: retab -''' - Magnetic field lines -''' - -import warnings -import traceback - -try: - import imas - try: - from tofu.mag.magFieldLines import * - except Exception: - from .magFieldLines import * - del warnings, traceback, magFieldLines, mag_ripple -except Exception as err: - if str(err) == 'imas not available': - msg = "" - msg += "\n\nIMAS python API issue\n" - msg += "imas could not be imported into tofu ('import imas' failed):\n" - msg += " - it may not be installed (optional dependency)\n" - msg += " - or you not have loaded the good working environment\n\n" - msg += " => the optional sub-package tofu.mag is not usable\n" - else: - msg = str(traceback.format_exc()) - msg += "\n\n => the optional sub-package tofu.mag is not usable\n" - warnings.warn(msg) - del msg, err - -__all__ = ['MagFieldLines'] diff --git a/tofu/mag/equimap.py b/tofu/mag/equimap.py deleted file mode 100644 index 5b063e037..000000000 --- a/tofu/mag/equimap.py +++ /dev/null @@ -1,677 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# Also if needed: retab -''' - EQUIMAP tools module, functions ... -''' -# Standard python modules -from __future__ import (unicode_literals, absolute_import, \ - print_function, division) -import numpy as np -import os -import re -import scipy.interpolate as interpolate -import warnings -#import sys - -# Local modules -import imas -try: - import imas_west -except ImportError as err: - pass -# print(err) -try: - import pywed as pw -except ImportError as err: - pass -# print(err) - -# Project modules -try: - import mag_ripple as mr -except ImportError as err: - pass -# print(err) - -__all__ = ['get'] - -# Parameters -min_Ip = 100000 - -def get(shot, time, R, Phi, Z, quantity, no_ripple=False, \ - run=0, occ=0, user='imas_public', machine='west'): - ''' - - Interpolation of the requested quantity for the list time at - input coodinates R, Phi, Z - - WARNING: Ripple is only taken into account for 'b_field_norm', 'b_field_r', - 'b_field_z' and b_field_tor' quantities for the moment - - Coordinate convention used (COCOS 11, see Sauter, Medvedev, Comp.Phys.Com. 184, 2013) - ------------------------------------------------------------------------------------- - Cylindrical | Poloidal | Phi from top | theta (pol ang) from front | psi - ------------------------------------------------------------------------------------------ - (R, Phi, Z) | (rho, theta, Phi) | cnt-clockwise | clockwise | increasing - - Parameters - ---------- - shot : int - shot number - time : list of floats [s] - times where to perform interpolation (ABSOLUTE TIME, without t_ignitron) - R : list of floats [m] - big radius where to perform interpolation - Phi : list of floats, same length as R [rad] - toroidal angle where to perform interpolation - Z : list of floats, same length as R [m] - vertical coordinate where to perform interpolation - quantity : string - for which quantity perform interpolation. One of - - ``rho_pol_norm`` - poloidal flux coordinate (normalized) - - ``rho_tor_norm`` - toroidal flux coordinate (normalized) - - ``rho_tor`` - toroidal flux coordinate [m] - - ``psi`` - poloidal flux [Wb] - - ``phi`` - toroidal flux [Wb] - - ``theta`` - poloidal angle [rad] in the range [0, 2*pi[ - - ``j_tor`` - toroidal current density [A.m^-2] - - ``j_parallel`` - parallel current density [A.m^-2] - - ``b_field_r`` - big radius (R) component of the poloidal magnetic field [T] - - ``b_field_z`` - vertical (Z) component of the poloidal magnetic field [T] - - ``b_field_tor`` - toroidal component of the magnetic field [T] - - ``b_field_norm`` - total magnetic field norm [T] - - no_ripple : boolean, optional (default=False) - do not calculate magnetic ripple - run : run number, optional (default=0) - occ : occurrence number, optional (default=0) - user : user name, optional (default=imas_public) - machine : machine name, optional (default=west) - - Returns - ------- - out : ndarray, shape (time, points) - interpolated quantity for list time at points with coordinates R, Phi, Z - - ''' - - #print('time =', time) - #print('R =', R) - #print('Phi =', Phi) - #print('Z =', Z) - print('quantity =', quantity) - - # Check if shot exists - run_number = '{:04d}'.format(run) - shot_file = os.path.expanduser('~' + user + '/public/imasdb/' + machine + \ - '/3/0/' + 'ids_' + str(shot) + run_number + \ - '.datafile') - if (not os.path.isfile(shot_file)): - raise FileNotFoundError('IMAS file does not exist') - - # Get equilibrium fast - idd = imas.ids(shot, run) - idd.open_env(user, machine, '3') - idd.equilibrium.get() - equi = idd.equilibrium - - # Check code.output_flag for data validity - if (np.any(np.isnan(equi.code.output_flag))): - mask = np.full(len(equi.time), True, dtype=bool) - else: - mask = np.asarray(equi.code.output_flag) >= 0 - - bool_b_field = False - if isinstance(quantity, list): - ar_bool = np.full(len(quantity), False) - for ii in range(len(quantity)): - if (re.match('b_field_*', quantity[ii])): - ar_bool[ii] = True - if (np.any(ar_bool)): - bool_b_field = True - else: - if (re.match('b_field_*', quantity)): - bool_b_field = True - - if (bool_b_field): - # Get Itor (current of toroidal coils, coils that produce the toroidal field) - itor, t_itor = pw.tsbase(shot, 'gmag_itor', nargout=2) - t_ignitron = pw.tsmat(shot, 'IGNITRON|1') - t_itor += t_ignitron[0] - - ismag, tsmag = pw.tsbase(shot, 'SMAG_IP', nargout=2) - t_smag_filter = tsmag[(abs(ismag[:, 0]*1000) > min_Ip), 0] - - t_mid = 0.5*(t_smag_filter[-1] - t_smag_filter[0]) \ - + t_ignitron[0] - - ind_mid = np.abs(equi.time[mask] - t_mid).argmin() - else: - itor = None - t_itor = None - t_ignitron = None - ind_mid = None - - ar_time = np.atleast_1d(np.squeeze(np.asarray([time]))) - ar_R = np.atleast_1d(np.squeeze(np.asarray([R]))) - ar_Phi = np.atleast_1d(np.squeeze(np.asarray([Phi]))) - ar_Z = np.atleast_1d(np.squeeze(np.asarray([Z]))) - - if (ar_time.size > 1): - mask_time_tmp = (equi.time[mask] >= ar_time.min()) \ - & (equi.time[mask] <= ar_time.max()) - indMin = np.abs(equi.time[mask] \ - - equi.time[mask][mask_time_tmp][0]).argmin() - indMax = np.abs(equi.time[mask] \ - - equi.time[mask][mask_time_tmp][-1]).argmin() - if (indMin == 0): - indMinApply = indMin - else: - indMinApply = indMin - 1 - if (indMax == (equi.time[mask].size-1)): - indMaxApply = indMax - else: - indMaxApply = indMax + 1 - mask_time = (equi.time[mask] >= equi.time[mask][indMinApply]) \ - & (equi.time[mask] <= equi.time[mask][indMaxApply]) - time_points = equi.time[mask][mask_time] - #firstSpaceInterp = True # For test - if (ar_time.size > time_points.size): - print('__________> First perform space interpolation') - firstSpaceInterp = True # In this case is fast to interpolate first spatially - else: - firstSpaceInterp = False - else: - firstSpaceInterp = False - mask_time = None - time_points = None - - equiDict = {} - - # Declaration of arrays 2d plots - equi_grid = idd.equilibrium.grids_ggd[0].grid[0] - NbrPoints = len(equi_grid.space[0].objects_per_dimension[0].object) - equiDict['r'] = np.full(NbrPoints, np.nan) - equiDict['z'] = np.full(NbrPoints, np.nan) - for ii in range(NbrPoints): - equiDict['r'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[0] - equiDict['z'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[1] - - ind_valid = np.argmax(mask) - NbrProf = len(equi.time_slice[ind_valid].profiles_1d.psi) - equiDict['psi'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['phi'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['theta'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['j_tor'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['j_parallel'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['b_field_r'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['b_field_z'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['b_field_tor'] = np.full((len(equi.time), NbrPoints), np.nan) - equiDict['prof_1d_psi'] = np.full((len(equi.time), NbrProf), np.nan) - equiDict['prof_1d_rho_tor'] = np.full((len(equi.time), NbrProf), np.nan) - equiDict['mag_axis_r'] = np.full(len(equi.time), np.nan) - equiDict['mag_axis_z'] = np.full(len(equi.time), np.nan) - for ii in range(len(equi.time)): - equi_slice = equi.time_slice[ii] - equi_space = equi.time_slice[ii].ggd[0] - if (equi_space.psi): - equiDict['psi'][ii] = equi_space.psi[0].values - if (equi_space.phi): - equiDict['phi'][ii] = equi_space.phi[0].values - if (equi_space.theta): - equiDict['theta'][ii] = equi_space.theta[0].values - if (equi_space.j_tor): - equiDict['j_tor'][ii] = equi_space.j_tor[0].values - if (equi_space.j_parallel): - equiDict['j_parallel'][ii] = equi_space.j_parallel[0].values - if (equi_space.b_field_r): - equiDict['b_field_r'][ii] = equi_space.b_field_r[0].values - if (equi_space.b_field_z): - equiDict['b_field_z'][ii] = equi_space.b_field_z[0].values - if (equi_space.b_field_tor): - equiDict['b_field_tor'][ii] = equi_space.b_field_tor[0].values - equiDict['prof_1d_psi'][ii] = equi_slice.profiles_1d.psi - equiDict['prof_1d_rho_tor'][ii] = equi_slice.profiles_1d.rho_tor - equiDict['mag_axis_r'][ii] = equi_slice.global_quantities.magnetic_axis.r - equiDict['mag_axis_z'][ii] = equi_slice.global_quantities.magnetic_axis.z - - points = np.vstack((equiDict['r'], equiDict['z'])).transpose() - interp_points = np.vstack((ar_R, ar_Z)).transpose() - - if isinstance(quantity, list): - out = {} - for iquant in quantity: - out[iquant] = \ - interp_quantity(iquant, interp_points, points, time_points, equi, \ - ar_time, ar_R, ar_Phi, ar_Z, mask, mask_time, \ - firstSpaceInterp, itor, t_itor, t_ignitron, \ - no_ripple, ind_mid, equiDict) - else: - out = interp_quantity(quantity, interp_points, points, time_points, equi, \ - ar_time, ar_R, ar_Phi, ar_Z, mask, mask_time, \ - firstSpaceInterp, itor, t_itor, t_ignitron, \ - no_ripple, ind_mid, equiDict) - return out - - -def interp_quantity(quantity, interp_points, points, time_points, equi, \ - ar_time, ar_R, ar_Phi, ar_Z, mask, mask_time, \ - firstSpaceInterp, itor, t_itor, t_ignitron, \ - no_ripple, ind_mid, equiDict): - - value_interpolated = np.full((ar_time.size, ar_R.size), np.nan) - if (firstSpaceInterp): - value_interpSpace = np.full((time_points.size, ar_R.size), np.nan) - - # Computation of requested quantities - if (quantity == 'b_field_norm'): - if (no_ripple): - b_field_norm = np.sqrt(equiDict['b_field_r']**2. \ - + equiDict['b_field_z']**2. \ - + equiDict['b_field_tor']**2.) - if (firstSpaceInterp): - # Space interpolation - for ii in range(time_points.size): - lin_intp = interpolate.LinearNDInterpolator(points, \ - b_field_norm[mask, :][mask_time][ii, :]) - value_interpSpace[ii, :] = lin_intp.__call__(interp_points) - else: - # Time interpolation - f_intp = interpolate.interp1d(equi.time[mask], \ - b_field_norm[mask, :], axis=0, \ - bounds_error=False) - else: # B_norm with ripple calculation - # Declaration arrays - br_intp = np.full((ar_time.size, ar_R.size), np.nan) - bt_intp = np.full((ar_time.size, ar_R.size), np.nan) - bz_intp = np.full((ar_time.size, ar_R.size), np.nan) - - if (firstSpaceInterp): - br_Sintp = np.full((time_points.size, ar_R.size), np.nan) - bt_Sintp = np.full((time_points.size, ar_R.size), np.nan) - bz_Sintp = np.full((time_points.size, ar_R.size), np.nan) - # Space interpolation - for ii in range(time_points.size): - lin_intp = interpolate.LinearNDInterpolator(points, \ - equiDict['b_field_r'][mask, :][mask_time][ii, :]) - br_Sintp[ii, :] = lin_intp.__call__(interp_points) - lin_intp = interpolate.LinearNDInterpolator(points, \ - equiDict['b_field_tor'][mask, :][mask_time][ii, :]) - bt_Sintp[ii, :] = lin_intp.__call__(interp_points) - lin_intp = interpolate.LinearNDInterpolator(points, \ - equiDict['b_field_z'][mask, :][mask_time][ii, :]) - bz_Sintp[ii, :] = lin_intp.__call__(interp_points) - # Time interpolation - f_intp = interpolate.interp1d(time_points, \ - br_Sintp, axis=0, \ - bounds_error=False) - br_intp = np.atleast_2d(np.squeeze(f_intp(ar_time))) - - f_intp = interpolate.interp1d(time_points, \ - bt_Sintp, axis=0, \ - bounds_error=False) - bt_intp = np.atleast_2d(np.squeeze(f_intp(ar_time))) - - f_intp = interpolate.interp1d(time_points, \ - bz_Sintp, axis=0, \ - bounds_error=False) - bz_intp = np.atleast_2d(np.squeeze(f_intp(ar_time))) - else: - # Time interpolation - f_intp_br = interpolate.interp1d(equi.time[mask], \ - equiDict['b_field_r'][mask, :], axis=0, \ - bounds_error=False) - f_intp_bt = interpolate.interp1d(equi.time[mask], \ - equiDict['b_field_tor'][mask, :], axis=0, \ - bounds_error=False) - f_intp_bz = interpolate.interp1d(equi.time[mask], \ - equiDict['b_field_z'][mask, :], axis=0, \ - bounds_error=False) - - br_intp_t = np.atleast_2d(np.squeeze(f_intp_br(ar_time))) - bt_intp_t = np.atleast_2d(np.squeeze(f_intp_bt(ar_time))) - bz_intp_t = np.atleast_2d(np.squeeze(f_intp_bz(ar_time))) - # Space interpolation - for ii in range(ar_time.size): - lin_intp = interpolate.LinearNDInterpolator(points, br_intp_t[ii]) - br_intp[ii, :] = lin_intp.__call__(interp_points) - - lin_intp = interpolate.LinearNDInterpolator(points, bt_intp_t[ii]) - bt_intp[ii, :] = lin_intp.__call__(interp_points) - - lin_intp = interpolate.LinearNDInterpolator(points, bz_intp_t[ii]) - bz_intp[ii, :] = lin_intp.__call__(interp_points) - - # Interpolate current - itor_intp_t = np.interp(ar_time, t_itor[:, 0], itor[:, 0]) - b0_intp_t = np.interp(ar_time, equi.time[mask], \ - equi.vacuum_toroidal_field.b0[mask]) - - # Compute reference vaccuum magnetic field - bt_vac = equi.vacuum_toroidal_field.r0*b0_intp_t[:, np.newaxis] \ - / ar_R[np.newaxis, :] - - # Compute magnetic field for given Phi - br_ripple, bt_ripple, bz_ripple = mr.mag_ripple(ar_R, ar_Phi, \ - ar_Z, itor_intp_t) - - # Check and correct Br if needed - r_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.r - - z_mid_ax = \ - equi.time_slice[ind_mid].global_quantities.magnetic_axis.z \ - + 0.5*equi.time_slice[ind_mid].boundary.minor_radius - - ind_p = np.abs((equiDict['r'] - r_ax)**2. \ - + (equiDict['z'] - z_mid_ax)**2).argmin() - - if (equiDict['b_field_r'][ind_mid, ind_p] > 0): - br_intp *= -1 - warnings.warn('Correcting b_field_r in b_field_norm, for negative toroidal current COCOS 11') - - # Check and correct Bz if needed - r_mid_ax = \ - equi.time_slice[ind_mid].global_quantities.magnetic_axis.r \ - + 0.5*equi.time_slice[ind_mid].boundary.minor_radius - z_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.z - - ind_p = np.abs((equiDict['r'] - r_mid_ax)**2. \ - + (equiDict['z'] - z_ax)**2).argmin() - - if (equiDict['b_field_z'][ind_mid, ind_p] < 0): - bz_intp *= -1 - warnings.warn('Correcting b_field_z in b_field_norm, for negative toroidal current COCOS 11') - - # Check and correct Btor if needed - ind_p = np.abs((equiDict['r'] - r_ax)**2. \ - + (equiDict['z'] - z_ax)**2).argmin() - - if (equiDict['b_field_tor'][ind_mid, ind_p] > 0): - bt_intp *= -1 - warnings.warn('Correcting b_field_tor in b_field_norm, for negative toroidal field COCOS 11') - - # Value interpolated - value_interpolated = \ - np.sqrt((br_intp - br_ripple)**2. \ - + (np.abs(bt_intp - bt_ripple) - np.abs(bt_vac))**2. \ - + (bz_intp - bz_ripple)**2.) - - return np.squeeze(value_interpolated) - - elif (not no_ripple and re.match('b_field_*', quantity)): - # Declaration arrays - br_ripple = np.full((ar_time.size, ar_R.size), np.nan) - bt_ripple = np.full((ar_time.size, ar_R.size), np.nan) - bz_ripple = np.full((ar_time.size, ar_R.size), np.nan) - - if (firstSpaceInterp): - # Space interpolation - quant_mask = eval('equiDict["'+quantity+'"][mask, :][mask_time]') - for ii in range(time_points.size): - lin_intp = interpolate.LinearNDInterpolator(points, \ - quant_mask[ii, :]) - value_interpSpace[ii, :] = lin_intp.__call__(interp_points) - - # Time interpolation - f_intp = interpolate.interp1d(time_points, \ - value_interpSpace, axis=0, \ - bounds_error=False) - value_interpolated = np.atleast_2d(np.squeeze(f_intp(ar_time))) - else: - # Time interpolation - f_intp = interpolate.interp1d(equi.time[mask], \ - eval('equiDict["'+quantity+'"][mask, :]'), axis=0, \ - bounds_error=False) - b_intp_t = np.atleast_2d(np.squeeze(f_intp(ar_time))) - - # Space interpolation - for ii in range(ar_time.size): - lin_intp = interpolate.LinearNDInterpolator(points, b_intp_t[ii]) - value_interpolated[ii, :] = lin_intp.__call__(interp_points) - - # Interpolate current - itor_intp_t = np.interp(ar_time, t_itor[:, 0], itor[:, 0]) - - # Compute magnetic field for given Phi - br_ripple, bt_ripple, bz_ripple = mr.mag_ripple(ar_R, ar_Phi, \ - ar_Z, itor_intp_t) - - if (quantity == 'b_field_r'): - r_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.r - - z_mid_ax = \ - equi.time_slice[ind_mid].global_quantities.magnetic_axis.z \ - + 0.5*equi.time_slice[ind_mid].boundary.minor_radius - - ind_p = np.abs((equiDict['r'] - r_ax)**2. \ - + (equiDict['z'] - z_mid_ax)**2).argmin() - - if (equiDict['b_field_r'][ind_mid, ind_p] > 0): - value_interpolated *= -1 - value_interpolated -= br_ripple - warnings.warn('Correcting b_field_r, for negative toroidal current COCOS 11') - else: - value_interpolated -= br_ripple - - elif (quantity == 'b_field_z'): - r_mid_ax = \ - equi.time_slice[ind_mid].global_quantities.magnetic_axis.r \ - + 0.5*equi.time_slice[ind_mid].boundary.minor_radius - z_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.z - - ind_p = np.abs((equiDict['r'] - r_mid_ax)**2. \ - + (equiDict['z'] - z_ax)**2).argmin() - - if (equiDict['b_field_z'][ind_mid, ind_p] < 0): - value_interpolated *= -1 - value_interpolated -= bz_ripple - warnings.warn('Correcting b_field_z, for negative toroidal current COCOS 11') - else: - value_interpolated -= bz_ripple - - elif (quantity == 'b_field_tor'): - b0_intp_t = np.interp(ar_time, equi.time[mask], \ - equi.vacuum_toroidal_field.b0[mask]) - # Compute reference vaccuum magnetic field - bt_vac = equi.vacuum_toroidal_field.r0*b0_intp_t[:, np.newaxis] \ - / ar_R[np.newaxis, :] - - r_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.r - z_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.z - - ind_p = np.abs((equiDict['r'] - r_ax)**2. \ - + (equiDict['z'] - z_ax)**2).argmin() - - if (equiDict['b_field_tor'][ind_mid, ind_p] > 0): - value_interpolated *= -1 - value_interpolated -= (bt_ripple - bt_vac) - warnings.warn('Correcting b_field_tor, for negative toroidal field COCOS 11') - else: - value_interpolated -= (bt_ripple - bt_vac) - else: - print() - print('ERROR: not valid quantity input:', quantity) - print() - raise SyntaxError - - return np.squeeze(value_interpolated) - - elif (quantity == 'rho_pol_norm'): - rho_pol_norm = np.sqrt((equiDict['psi'] \ - - equiDict['prof_1d_psi'][:, 0, np.newaxis]) \ - / (equiDict['prof_1d_psi'][:, -1, np.newaxis] \ - - equiDict['prof_1d_psi'][:, 0, np.newaxis])) - if (firstSpaceInterp): - # Space interpolation - for ii in range(time_points.size): - lin_intp = interpolate.LinearNDInterpolator(points, \ - rho_pol_norm[mask, :][mask_time][ii, :]) - value_interpSpace[ii, :] = lin_intp.__call__(interp_points) - else: - # Time interpolation - f_intp = interpolate.interp1d(equi.time[mask], rho_pol_norm[mask, :], \ - axis=0, bounds_error=False) - - elif (quantity == 'rho_tor_norm' or quantity == 'rho_tor'): - if (firstSpaceInterp): - # Space interpolation - for ii in range(time_points.size): - lin_intp = interpolate.LinearNDInterpolator(points, \ - equiDict['psi'][mask, :][mask_time][ii, :]) - value_interpSpace[ii, :] = lin_intp.__call__(interp_points) - else: - # Time interpolation - f_intp = interpolate.interp1d(equi.time[mask], equiDict['psi'][mask, :], \ - axis=0, bounds_error=False) - - elif (quantity == 'theta'): - mag_ax_r = np.atleast_1d(np.squeeze(np.interp(ar_time, \ - equi.time[mask], equiDict['mag_axis_r'][mask]))) - mag_ax_z = np.atleast_1d(np.squeeze(np.interp(ar_time, \ - equi.time[mask], equiDict['mag_axis_z'][mask]))) - - for ii in range(ar_time.size): - delta_R = ar_R - mag_ax_r[ii, np.newaxis] - delta_Z = ar_Z - mag_ax_z[ii, np.newaxis] - - val_arctan = np.arctan(delta_Z/delta_R) - - mask_theta = (delta_R >= 0) & (delta_Z >= 0) - value_interpolated[ii, mask_theta] = val_arctan[mask_theta] - - mask_theta = (delta_R >= 0) & (delta_Z < 0) - value_interpolated[ii, mask_theta] = 2*np.pi + val_arctan[mask_theta] - - mask_theta = (delta_R < 0) - value_interpolated[ii, mask_theta] = np.pi + val_arctan[mask_theta] - - return np.squeeze(2.*np.pi - value_interpolated) - else: - if (firstSpaceInterp): - # Space interpolation - for ii in range(time_points.size): - lin_intp = interpolate.LinearNDInterpolator(points, \ - eval('equiDict["'+quantity+'"][mask, :][mask_time][ii, :]')) - value_interpSpace[ii, :] = lin_intp.__call__(interp_points) - else: - # Time interpolation - f_intp = interpolate.interp1d(equi.time[mask], \ - eval('equiDict["'+quantity+'"][mask, :]'), \ - axis=0, bounds_error=False) - - if (firstSpaceInterp): - # Time interpolation - f_intp = interpolate.interp1d(time_points, \ - value_interpSpace, axis=0, \ - bounds_error=False) - value_interpolated = np.atleast_2d(np.squeeze(f_intp(ar_time))) - else: - # Time interpolation - out_time_interp = np.atleast_2d(np.squeeze(f_intp(ar_time))) - # Space interpolation - for ii in range(ar_time.size): - lin_intp = interpolate.LinearNDInterpolator(points, out_time_interp[ii]) - value_interpolated[ii, :] = lin_intp.__call__(interp_points) - - # Extra calculations for rho_tor, rho_tor_norm, b_field_r and b_field_z - if (quantity == 'rho_tor_norm' or quantity == 'rho_tor'): - - value_interp_rho_tor = np.full(value_interpolated.shape, np.nan) - - if (quantity == 'rho_tor_norm'): - try: - rho_tor_norm = equiDict['prof_1d_rho_tor'] \ - / equiDict['prof_1d_rho_tor'][:, -1, np.newaxis] - except ZeroDivisionError as err: - print('Division by zero for rho_tor_norm interpolation:', err) - raise - f_intp_rho_tor = interpolate.interp1d(equi.time[mask], \ - rho_tor_norm[mask, :], axis=0, bounds_error=False) - elif (quantity == 'rho_tor'): - f_intp_rho_tor = interpolate.interp1d(equi.time[mask], \ - equiDict['prof_1d_rho_tor'][mask, :], \ - axis=0, bounds_error=False) - - rho_tor1D = np.atleast_2d(np.squeeze(f_intp_rho_tor(ar_time))) - - f_intp_psi = interpolate.interp1d(equi.time[mask], \ - equiDict['prof_1d_psi'][mask, :], axis=0, bounds_error=False) - psi1D = np.atleast_2d(np.squeeze(f_intp_psi(ar_time))) - - for ii in range(ar_time.size): - f_intp_psi_rho_tor = interpolate.interp1d(psi1D[ii], rho_tor1D[ii], \ - bounds_error=False) - value_interp_rho_tor[ii] = f_intp_psi_rho_tor(value_interpolated[ii]) - - return np.squeeze(value_interp_rho_tor) - - elif (quantity == 'b_field_r'): - r_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.r - - z_mid_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.z \ - + 0.5*equi.time_slice[ind_mid].boundary.minor_radius - - ind_p = np.abs((equiDict['r'] - r_ax)**2. \ - + (equiDict['z'] - z_mid_ax)**2).argmin() - - if (equiDict['b_field_r'][ind_mid, ind_p] > 0): - value_interpolated *= -1 - warnings.warn('Correcting b_field_r, if Ip negative COCOS 11') - - return np.squeeze(value_interpolated) - - elif (quantity == 'b_field_z'): - r_mid_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.r \ - + 0.5*equi.time_slice[ind_mid].boundary.minor_radius - z_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.z - - ind_p = np.abs((equiDict['r'] - r_mid_ax)**2. \ - + (equiDict['z'] - z_ax)**2).argmin() - - if (equiDict['b_field_z'][ind_mid, ind_p] < 0): - value_interpolated *= -1 - warnings.warn('Correcting b_field_z, if Ip negative COCOS 11') - - return np.squeeze(value_interpolated) - - elif (quantity == 'b_field_tor'): - r_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.r - z_ax = equi.time_slice[ind_mid].global_quantities.magnetic_axis.z - - ind_p = np.abs((equiDict['r'] - r_ax)**2. \ - + (equiDict['z'] - z_ax)**2).argmin() - - if (equiDict['b_field_tor'][ind_mid, ind_p] > 0): - value_interpolated *= -1 - warnings.warn('Correcting b_field_tor, if b_field_tor negative COCOS 11') - - return np.squeeze(value_interpolated) - else: - return np.squeeze(value_interpolated) diff --git a/tofu/mag/magFieldLines.py b/tofu/mag/magFieldLines.py deleted file mode 100644 index a50999e29..000000000 --- a/tofu/mag/magFieldLines.py +++ /dev/null @@ -1,513 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# Also if needed: retab -''' - Magnetic field line tracing -''' -# Standard python modules -from __future__ import (unicode_literals, absolute_import, \ - print_function, division) -import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import axes3d, Axes3D -import numpy as np -import os -#import re -import scipy.integrate as spode -import scipy.interpolate as interpolate -import scipy.spatial -#import warnings -#import sys - -# Local modules -import imas -try: - import pywed as pw -except ImportError as err: - print(err) - -# Project modules -try: - from tofu.mag.mag_ripple.mag_ripple import mag_ripple -except Exception: - from mag.mag_ripple.mag_ripple import mag_ripple -#try: -# from equimap import interp_quantity -#except ImportError as err: -# print(err) - -__all__ = ['MagFieldLines'] - -class MagFieldLines: - ''' - Compute magnetic field lines - - Parameters - ---------- - shot : int - Shot number - run : run number, optional (default=0) - occ : occurrence number, optional (default=0) - user : user name, optional (default=imas_public) - machine : machine name, optional (default=west) - - Methods - ------- - trace_mline(init_points_array, time_array, direction='FWD') - - In other words: - trace_mline([[r_1, r_2, ...], [phi_1, phi_2, ...], [z_1, z_2, ...]], [t1, t2, ...], direction='FWD') - returns list of list of traces with shape (times, init_points) - plot_trace(trace[0][0]) - 2D plots of traced magnetic field line - plot_trace_3D(trace[0][0]) - 3D plot of traced magnetic field line - - Examples - -------- - For shot 54095 - Compute linear interpolation B_r, B_tor, B_z at r=2, phi=0, z=0 - and r, z, phi of magnetic line starting at r=2.7, phi=0, z=0 - >>> test = MagFieldLines(54095) - - Call method with specific time (t=34 seconds in this case) - >>> test.trace_mline([2.7, 0., 0.], 34)[0][0]['r'][10] - 2.700041665466963 - >>> test.trace_mline([2.7, 0., 0.], 34)[0][0]['p'][10] - -0.0037010956581712776 - >>> test.trace_mline([2.7, 0., 0.], 34)[0][0]['z'][10] - 0.000373472578674799 - - Call method for list of points (2 items and t=34 seconds) - >>> test.trace_mline([[2.7, 2.8], [0., 0.], [0., 0.1*np.pi]], 34)[0][0]['r'][10] - 2.700041665466963 - >>> test.trace_mline([[2.7, 2.8], [0., 0.], [0., 0.1*np.pi]], 34)[0][0]['p'][10] - -0.0037010956581712776 - >>> test.trace_mline([[2.7, 2.8], [0., 0.], [0., 0.1*np.pi]], 34)[0][0]['z'][10] - 0.000373472578674799 - - For interpolation of B magnetic field - >>> test.b_field_interp(2, 0, 0) - (0.006836488559673934, -4.547017391384852, -0.14305889263210517) - ''' - def __init__(self, shot, run=0, occ=0, user='imas_public', machine='west'): - - # Check if shot exists - run_number = '{:04d}'.format(run) - shot_file = os.path.expanduser('~' + user + '/public/imasdb/' + machine + \ - '/3/0/' + 'ids_' + str(shot) + run_number + \ - '.datafile') - if (not os.path.isfile(shot_file)): - raise FileNotFoundError('IMAS file does not exist') - - # Parameters - self.wall_ck=False - - # Get equilibrium - idd = imas.ids(shot, run) - idd.open_env(user, machine, '3') - idd.equilibrium.get() - self.equi = idd.equilibrium - - # Check code.output_flag for data validity - if (np.any(np.isnan(self.equi.code.output_flag))): - self.mask = np.full(len(self.equi.time), True, dtype=bool) - else: - self.mask = np.asarray(self.equi.code.output_flag) >= 0 - - # Get Itor (current of toroidal coils, coils that produce the toroidal field) - self.itor, self.t_itor = pw.tsbase(shot, 'gmag_itor', nargout=2) - self.t_ignitron = pw.tsmat(shot, 'IGNITRON|1') - self.t_itor += self.t_ignitron[0] - - self.equiDict = {} - - # Declaration of arrays 2d from equilibrium IDS - equi_grid = idd.equilibrium.grids_ggd[0].grid[0] - NbrPoints = len(equi_grid.space[0].objects_per_dimension[0].object) - self.equiDict['r'] = np.full(NbrPoints, np.nan) - self.equiDict['z'] = np.full(NbrPoints, np.nan) - for ii in range(NbrPoints): - self.equiDict['r'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[0] - self.equiDict['z'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[1] - - self.equiDict['b_field_r'] = np.full((len(self.equi.time), NbrPoints), np.nan) - self.equiDict['b_field_z'] = np.full((len(self.equi.time), NbrPoints), np.nan) - self.equiDict['b_field_tor'] = np.full((len(self.equi.time), NbrPoints), np.nan) - self.equiDict['boundary_r'] = [None]*len(self.equi.time) - self.equiDict['boundary_z'] = [None]*len(self.equi.time) - for ii in range(len(self.equi.time)): - equi_slice = self.equi.time_slice[ii] - self.equiDict['b_field_r'][ii] = equi_slice.ggd[0].b_field_r[0].values - self.equiDict['b_field_z'][ii] = equi_slice.ggd[0].b_field_z[0].values - self.equiDict['b_field_tor'][ii] = equi_slice.ggd[0].b_field_tor[0].values - self.equiDict['boundary_r'][ii] = equi_slice.boundary.outline.r - self.equiDict['boundary_z'][ii] = equi_slice.boundary.outline.z - - self.points = np.vstack((self.equiDict['r'], self.equiDict['z'])).transpose() - self.delaunay = scipy.spatial.Delaunay(self.points) - - # Time interpolation - self.f_intp_br = interpolate.interp1d(self.equi.time[self.mask], \ - self.equiDict['b_field_r'][self.mask, :], axis=0, \ - bounds_error=False) - self.f_intp_bt = interpolate.interp1d(self.equi.time[self.mask], \ - self.equiDict['b_field_tor'][self.mask, :], axis=0, \ - bounds_error=False) - self.f_intp_bz = interpolate.interp1d(self.equi.time[self.mask], \ - self.equiDict['b_field_z'][self.mask, :], axis=0, \ - bounds_error=False) - - def trace_mline(self, init_state, time, direction='FWD', \ - length_line=None, stp=None): - ''' - Traces the field line given a starting point. - Integration step defined by stp and maximum length of the field line - defined by s. - Collision with the wall stops integration. - - input: - - init_state [[r_1, r_2, ...], [phi_1, phi_2, ...], [z_1, z_2, ...]] : - the coordinates of the starting points (list or numpy array) - OR list of lists OR numpy 2D array - - time : array of times requested (list or numpy array) - - direction : direction of integration 'FWD' forward or 'REV' reverse - (string) - - output: - returns a dictionary containing: - - r : radial coordinate (np.array) - - p : toridal coordinate (np.array) - - z : vertical coordinate (np.array) - - x : x coordinate (np.array) - - y : y coordinate (np.array) - - cp : collision point with the wall (list) - - ''' - # Step for the integration - if (stp is None): - stp = 0.001 - - # Length of the field line - if (length_line is None): - s = 100 - else: - s = length_line - - ds = np.linspace(0, s, int(s/stp)) - - init_state = np.squeeze(np.asarray(init_state)) - if (init_state.ndim < 2): - init_state = init_state[:, np.newaxis] - - self.ar_time = np.atleast_1d(np.squeeze(np.asarray([time]))) - - br_intp_t = np.atleast_2d(np.squeeze(self.f_intp_br(self.ar_time))) - bt_intp_t = np.atleast_2d(np.squeeze(self.f_intp_bt(self.ar_time))) - bz_intp_t = np.atleast_2d(np.squeeze(self.f_intp_bz(self.ar_time))) - - # !!!!!!!!!!!!!!!!!!!!! - # HARD CODED CORRECTION - bt_intp_t *= -1 - # !!!!!!!!!!!!!!!!!!!!! - - # Interpolate current - itor_intp_t_vect = np.interp(self.ar_time, self.t_itor[:, 0], \ - self.itor[:, 0]) - b0_intp_t_vect = np.interp(self.ar_time, self.equi.time[self.mask], \ - self.equi.vacuum_toroidal_field.b0[self.mask]) - - outMagLine = [] - - for ii in range(self.ar_time.size): - self.br_lin_intp = \ - interpolate.LinearNDInterpolator(self.delaunay, br_intp_t[ii]) - self.bt_lin_intp = \ - interpolate.LinearNDInterpolator(self.delaunay, bt_intp_t[ii]) - self.bz_lin_intp = \ - interpolate.LinearNDInterpolator(self.delaunay, bz_intp_t[ii]) - - # Interpolated current and b0 - self.itor_intp_t = itor_intp_t_vect[ii] - self.b0_intp_t = b0_intp_t_vect[ii] - - out = [] - - for jj in range(init_state.shape[1]): - out_prime = self.integrate_solve_ivp(init_state[:, jj], \ - direction, s, ds) - out_prime['init_point'] = init_state[:, jj] - out_prime['time'] = self.ar_time[ii] - # Return list of dict - out.append(out_prime) - - outMagLine.append(out) - - return outMagLine - - def integrate_solve_ivp(self, init_state, direction, s, ds): - ''' - Integration step defined by stp and maximum length of the field line - defined by s. - Collision with the wall stops integration. - - input: - - init_state [r, phi, z] : the coordinates of the starting point (list) - - direction : direction of integration 'FWD' forward or 'REV' reverse - (string) - - s : field line maximum length - - ds : vector of steps - - output: - returns a dictionary containing: - - r : radial coordinate (np.array) - - p : toridal coordinate (np.array) - - z : vertical coordinate (np.array) - - x : x coordinate (np.array) - - y : y coordinate (np.array) - - cp : collision point with the wall (list) - ''' - if (direction=='FWD'): - sol = spode.solve_ivp(self.mfld3dcylfwd, [0, s], init_state, - method='RK23', t_eval=ds, - events=self.hit_wall_circ) - elif (direction=='REV'): - sol = spode.solve_ivp(self.mfld3dcylrev, [0, s], init_state, - method='RK23', t_eval=ds, - events=self.hit_wall_circ) - sgf = sol.t - rgf = sol.y[0] - pgf = sol.y[1] - xgf = rgf*np.cos(pgf) - ygf = rgf*np.sin(pgf) - zgf = sol.y[2] - - if len(sgf) The wall is a simple circular torus with minor radius rw - centered at (Rc,Zc), thus with major radius Rc. - - True => check collision with wall boundary given in the Equilibrium - mat file - ''' - R, P, Z = state - #if np.abs(Z)<=0.5 and R>3.01 and np.deg2rad(89.5)<=P<=np.deg2rad(90.5): - # return 0 - #if np.abs(Z)<=0.5 and R>3.01 and np.deg2rad(179.5)<=P<=np.deg2rad(180.5): - # print('Got 2') - # return 0 - #elif np.abs(Z)<=0.5 and R>3.01 and np.deg2rad(269.5)<=P<=np.deg2rad(270.5): - # print('Got 3') - # return 0 - if self.wall_ck==False: - Rc=2.460 - Zc=0.0 - rw=0.950 - return (R-Rc)**2+(Z-Zc)**2-rw**2 - elif self.wall_ck and Z>=0: - zwall=self.fwall_up(R) - return Z-zwall - elif self.wall_ck and Z<0: - zwall=self.fwall_dw(R) - return zwall-Z - - hit_wall_circ.terminal=True - - def b_field_interp(self, R, Phi, Z, no_ripple=False): - ''' Linear interpolation of B vector components at R, Phi, Z positions - ''' - - interp_points = np.vstack((R, Z)).transpose() - - br_intp = self.br_lin_intp.__call__(interp_points) - bt_intp = self.bt_lin_intp.__call__(interp_points) - bz_intp = self.bz_lin_intp.__call__(interp_points) - - # Compute magnetic field for given Phi - br_ripple, bt_ripple, bz_ripple = mag_ripple(R, Phi, \ - Z, self.itor_intp_t) - # Compute reference vaccuum magnetic field - self.bt_vac = self.equi.vacuum_toroidal_field.r0*self.b0_intp_t / R - - br_intp -= br_ripple[0] - bt_intp -= (bt_ripple[0] - np.abs(self.bt_vac)) - bz_intp -= bz_ripple[0] - - return br_intp[0], bt_intp[0], bz_intp[0] - - def plot_trace(self, trace): - ''' - Plots a summary of the magnetic field line trace. - It contains a graph of the radial, vertical and toroidal corrdinates followed by - the vertical projection (w/o and with the wall) and the toroidal projection. - - A black dot represents the starting point of the field line. - The end of the trace is indicated by: - - a red dot in case of collision with the wall - - a black square otherwise - - input: - - trace : the magneticl field line data (dictionary) - ''' - sgf = trace['s'] - rgf = trace['r'] - zgf = trace['z'] - pgf = trace['p'] - xgf = trace['x'] - ygf = trace['y'] - colpt = trace['cp'] - - ind_time = np.argmin(np.abs(self.equi.time - trace['time'])) - - plt.figure(figsize=[12,8]) - - plt.subplot(231) - plt.plot(sgf, rgf) - plt.grid() - plt.ylabel('R [m]'); plt.xlabel('s [m]'); plt.title('Radial coord.') - - plt.subplot(232) - plt.plot(sgf, zgf) - plt.grid() - plt.ylabel('Z [m]'); plt.xlabel('s [m]'); plt.title('Vertical coord.') - - plt.subplot(233) - plt.plot(sgf, np.rad2deg(pgf)) - plt.grid() - plt.ylabel('$\phi$ [deg]'); plt.xlabel('s [m]'); plt.title('Toroidal coord.') - - plt.subplot(234) - plt.plot(rgf, zgf) - plt.plot(rgf[0], zgf[0], marker='o', markersize=3, color="black") - if not colpt: - plt.plot(rgf[-1], zgf[-1], marker='s', markersize=5, color="black") - else: - plt.plot(rgf[-1], zgf[-1], marker='o', markersize=5, color="red") - plt.axis('equal'); plt.xlabel('R [m]'); plt.ylabel('Z [m]') - plt.plot(self.equiDict['boundary_r'][ind_time], \ - self.equiDict['boundary_z'][ind_time]) - plt.title('Vertical projection') - plt.grid() - - plt.subplot(235) - plt.plot(rgf, zgf) - #plt.plot(rwall,zwall) - plt.plot(rgf[0], zgf[0], marker='o', markersize=3, color="black") - if not colpt: - plt.plot(rgf[-1], zgf[-1], marker='s', markersize=5, color="black") - else: - plt.plot(rgf[-1], zgf[-1], marker='o', markersize=5, color="red") - plt.axis('equal'); plt.xlabel('R [m]'); plt.ylabel('Z [m]') - plt.title('Vertical projection') - - plt.subplot(236) - plt.plot(xgf, ygf) - #plt.plot(ra*np.cos(pa),ra*np.sin(pa),'b:') - plt.plot(xgf[0], ygf[0], marker='o', markersize=3, color="black") - if not colpt: - plt.plot(xgf[-1], ygf[-1], marker='s', markersize=5, color="black") - else: - plt.plot(xgf[-1], ygf[-1], marker='o', markersize=5, color="red") - plt.axis('equal'); plt.xlabel('x [m]'); plt.ylabel('y [m]') - plt.title('Toroidal projection') - - plt.tight_layout() - plt.show() - - def plot_trace_3D(self, trace): - ''' - Plots the magnetic field line trace in a 3D projection. - - The outline of the antenna is shown by black solid ines. - A black dot represents the starting point of the field line. - The end of the trace is indicated by: - - a red dot in case of collision with the wall - - a black square otherwise - - input: - - trace : the magneticl field line data (dictionary) - ''' - sgf = trace['s'] - rgf = trace['r'] - zgf = trace['z'] - pgf = trace['p'] - xgf = trace['x'] - ygf = trace['y'] - colpt = trace['cp'] - - fig = plt.figure(figsize=[10, 10]) - ax = Axes3D(fig) - #ax = fig.gca(projection='3d') - #ax.set_aspect('equal') - ax.plot(xgf, ygf, zgf) - #ax.plot(ra[0]*np.cos(pa),ra[0]*np.sin(pa),za[0],'k') - #ax.plot(ra*np.cos(pa[0]),ra*np.sin(pa[0]),za,'k') - #ax.plot(ra[-1]*np.cos(pa),ra[-1]*np.sin(pa),za[-1],'k') - #ax.plot(ra*np.cos(pa[-1]),ra*np.sin(pa[-1]),za,'k') - ax.plot(3.5*np.cos(np.linspace(0, 2*np.pi, 36)), \ - 3.5*np.sin(np.linspace(0, 2*np.pi, 36)), 0, 'k:') - # Used to create the fake bounding box - max_range = np.array([xgf.max()-xgf.min(), ygf.max()-ygf.min(), zgf.max()-zgf.min()]).max() - Xb = 0.5*max_range*np.mgrid[-1:2:2,-1:2:2,-1:2:2][0].flatten() + 0.5*(xgf.max()+xgf.min()) - Yb = 0.5*max_range*np.mgrid[-1:2:2,-1:2:2,-1:2:2][1].flatten() + 0.5*(ygf.max()+ygf.min()) - Zb = 0.5*max_range*np.mgrid[-1:2:2,-1:2:2,-1:2:2][2].flatten() + 0.5*(zgf.max()+zgf.min()) - # Comment or uncomment following both lines to test the fake bounding box: - for xb, yb, zb in zip(Xb, Yb, Zb): - ax.plot([xb], [yb], [zb], 'w') - ax.plot([xgf[0]], [ygf[0]], [zgf[0]], marker='o', markersize=3, color="black") - if not colpt: - ax.plot([xgf[-1]], [ygf[-1]], [zgf[-1]], marker='s', markersize=5, color="black") - else: - ax.plot([xgf[-1]], [ygf[-1]], [zgf[-1]], marker='o', markersize=5, color="red") - ax.set_xlabel('x [m]'); ax.set_ylabel('y [m]'); ax.set_zlabel('z [m]') - plt.title('Magnetic field line trace') - plt.show() diff --git a/tofu/mag/mag_ripple/__init__.py b/tofu/mag/mag_ripple/__init__.py deleted file mode 100644 index bc5c08174..000000000 --- a/tofu/mag/mag_ripple/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# Also if needed: retab -''' - Magnetic ripple -''' diff --git a/tofu/mag/mag_ripple/compile_f2py.sh b/tofu/mag/mag_ripple/compile_f2py.sh deleted file mode 100755 index 903e584cb..000000000 --- a/tofu/mag/mag_ripple/compile_f2py.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -echo " " -echo "Loading modules" -echo "---------------" -source /etc/profile.d/modules.sh -module use /Applications/Modules/compilers -module use /Applications/Modules/soft -module use /work/imas/etc/modulefiles -# Get module list from file -file="modules_INTRA_IRFM.txt" -while IFS= read -r line -do - module load $line - #printf '%s\n' "$line" -done < "$file" -echo " " -echo "Modules list:" -module li - -echo " " -echo "Compile with optimization" -echo "-------------------------" -f2py -c -m mag_ripple mag_ripple.f diff --git a/tofu/mag/mag_ripple/mag_ripple.f b/tofu/mag/mag_ripple/mag_ripple.f deleted file mode 100755 index 4c4d2dd9a..000000000 --- a/tofu/mag/mag_ripple/mag_ripple.f +++ /dev/null @@ -1,169 +0,0 @@ - subroutine mag_ripple(brr, bt, bzz, RP, PHIP, ZP, n_in, - & WITOR, k_in) -c - - IMPLICIT REAL*8 (A-H,O-Z) - IMPLICIT integer (I-N) - - integer ii - integer kk - - integer n_in - integer k_in - double precision brr(k_in, n_in), bt(k_in, n_in), bzz(k_in, n_in) - double precision RP(n_in), PHIP(n_in), ZP(n_in) - double precision WITOR(k_in) - -Cf2py intent(in) RP, PHIP, ZP, WITOR -Cf2py depend(RP) n_in -Cf2py depend(WITOR) k_in -Cf2py intent(out) brr, bt, bzz - -C -C write(*,*) "Magnetic ripple computation" -C - - do kk=1,k_in - do ii=1,n_in - call champs(bt(kk, ii), brr(kk, ii), bzz(kk, ii), - & RP(ii), ZP(ii), PHIP(ii), WITOR(kk)) - enddo - enddo - - return - end - - subroutine champs(bt,brr,bzz,RP,ZP,PHIP,WITOR) - - - double precision bt,RP,ZP - double precision PHIP,WITOR - double precision brr,bzz,BF,BR,BZ,BMOD,BTF - common /bobine/ RB,WIBOB - - PI = 3.14159265359 - DEGRAD = PI/180. -C -C LE CHAMP EST CALCULE POUR UN COURANT DE 1000 A DANS LE SUPRA -C - RB = 2.443 - RB2 = RB*RB -C -C WIBOB EST LE COURANT DANS UNE BOBINE TOROIDALE * MU0/4PI -C - - WIBOB = WITOR*2028*1E-7 - EL = 1.6022E-19 - WMP = 1.6726E-27 - WME = 9.1095E-31 - - - CALL CS(RP,PHIP,ZP,BR,BF,BZ,BMOD,BTF) - bt = BF - brr = BR - bzz = BZ - - return - end - -C -C--------------------------------------------- - SUBROUTINE CS(R,F,Z,BR,BF,BZ,BMOD,BTF) -C--------------------------------------------- -C - -C -C CALCUL DES COMPOSANTES DU CHAMP MAGNETIQUE -C - double precision R,F,Z,BF,BR,BZ,BMOD,BTF - double precision BTR,BTZ,PI,DEGRAD - common /bobine/ RB,WIBOB -C - PI = 3.14159265359 - DEGRAD = PI/180. - BTR = 0 - BTZ = 0 - BTF = 0 -C -C BOUCLE SUR LES SPIRES TOROIDALES (CALCUL COMPLET) -C - DO 11 IS=1,18 -C - FB=(IS*20-10)*DEGRAD - FD=FB+F - SFD=SIN(FD) - CFD=COS(FD) - H=R*SFD - D=R*CFD-RB - RHO=SQRT(Z*Z+D*D) - CALL BRHOBH(RHO,H,BRHO,BH) - BRHOHO=BRHO*D/RHO - BTR=BTR+(BH*SFD+BRHOHO*CFD) - BTZ=BTZ+BRHO*Z/RHO - BTF=BTF+(BH*CFD-BRHOHO*SFD) - - 11 CONTINUE -C - BTR=BTR*WIBOB - BTF=BTF*WIBOB - BTZ=BTZ*WIBOB - - BR=BTR - BF=BTF - BZ=BTZ - BMOD=SQRT(BR*BR+BF*BF+BZ*BZ) - END -C -C----------------------------------------- - SUBROUTINE BRHOBH(RHO,H,BRHO,BH) -C----------------------------------------- -C -C AB= PETIT RAYON DES BOBINES TOROIDALES -C - DATA AB,AB2/1.2668,1.60478224/ -C - H2=H*H - RHO2=RHO*RHO - D=(AB-RHO)*(AB-RHO)+H2 - RHO2PH2=RHO2+H2 - WK=SQRT(4*AB*RHO/((AB+RHO)*(AB+RHO)+H2)) - C=WK/SQRT(AB*RHO) - WI1=ELLIPK(WK) - WI2=ELLIPE(WK) - BRHO=(H/RHO)*C*(-WI1+WI2*(AB2+RHO2PH2)/D) - BH=C*(WI1+WI2*(AB2-RHO2PH2)/D) - - END - -C -C------------------------- - FUNCTION ELLIPK(X) -C------------------------- -C - DATA A0,A1,A2,A3,A4/ - +1.38629436112,0.09666344259,0.03590092383, - +0.03742563713,0.01451196212/ - DATA B0,B1,B2,B3,B4/0.5, - +0.12498593597,0.06880248576, - +0.03328355346,0.00441787012/ - Y=1-X*X - A=(((A4*Y+A3)*Y+A2)*Y+A1)*Y+A0 - B=(((B4*Y+B3)*Y+B2)*Y+B1)*Y+B0 - ELLIPK=A+B*LOG(1./Y) - END -C -C------------------------- - FUNCTION ELLIPE(X) -C------------------------- -C - DATA A1,A2,A3,A4/ - +0.44325141463,0.06260601220, - +0.04757383546,0.01736506451/ - DATA B1,B2,B3,B4/ - +0.24998368310,0.09200180037, - +0.04069697526,0.00526449639/ - Y=1-X*X - A=(((A4*Y+A3)*Y+A2)*Y+A1)*Y+1. - B=(((B4*Y+B3)*Y+B2)*Y+B1)*Y - ELLIPE=A+B*LOG(1./Y) - END diff --git a/tofu/mag/modules_INTRA_IRFM.txt b/tofu/mag/modules_INTRA_IRFM.txt deleted file mode 100644 index b1d217cec..000000000 --- a/tofu/mag/modules_INTRA_IRFM.txt +++ /dev/null @@ -1 +0,0 @@ -tools_dc diff --git a/tofu/mag/reference.npz b/tofu/mag/reference.npz deleted file mode 100644 index cc0528771..000000000 Binary files a/tofu/mag/reference.npz and /dev/null differ diff --git a/tofu/mag/regression_test.py b/tofu/mag/regression_test.py deleted file mode 100644 index 21041fd21..000000000 --- a/tofu/mag/regression_test.py +++ /dev/null @@ -1,283 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# Also if needed: retab -''' - Regression test -''' -from __future__ import (unicode_literals, absolute_import, \ - print_function, division) -import argparse -import matplotlib.pyplot as plt -import numpy as np -import os -import subprocess -import sys -import time - -#print('path 1 =', sys.path) -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -#print('path 2 =', sys.path) - -# Local modules -import equimap -import imas - -# REFERENCE FILE !!! -# ================== -REF_FILE = 'reference.npz' -REF_SHOT = 54178 -REF_RUN = 9 -REF_OCC = 0 -REF_USER = 'imas_public' -REF_MACHINE = 'west' -# ================== - -# Parameters -interp_points = 30 -eps_time = 1.23456789E-2 -lquantities = ('rho_pol_norm', 'rho_tor_norm', 'rho_tor', 'psi', 'phi', \ - 'theta', 'j_tor', 'b_field_r', 'b_field_z', 'b_field_tor', \ - 'b_field_norm') - -def eval_diff(data, data_ref, name, rel_tolerance=1E-10): - ''' - Function - -------- - eval_diff(data, data_ref, name='data', rel_tolerance=1E-10) - - Output - ------ - print the maximum and the maximum index of difference, displays - an error if the maximum is above the given relative tolerance - ''' - - data = np.asarray(data) - data_ref = np.asarray(data_ref) - - if (data.shape != data_ref.shape): - raise ValueError('Shape of input data is not equal') - - rel_diff = np.abs( (data - data_ref) / data_ref ) - max_rel_diff = np.nanmax(rel_diff) - if (rel_diff.ndim != 0): - ind_max_rel_diff = np.unravel_index(np.nanargmax(rel_diff), rel_diff.shape) - else: - ind_max_rel_diff = 0 - - if (max_rel_diff > rel_tolerance): - raise ValueError('ERROR test in: ' + name + ', max relative difference = ' - + '{0} at index = {1}'.format(max_rel_diff, ind_max_rel_diff)) - - print('') - print('In field name: ' + name + ', max relative difference = ' - + '{0} at index = {1}'.format(max_rel_diff, ind_max_rel_diff)) - print('') - - -if __name__ == '__main__': - - print(' ') - # Parse input arguments - parser = argparse.ArgumentParser(description= \ - '''Run regression EQUIMAP test using REF_FILE = {0}; REF_SHOT = {1}; - REF_RUN = {2}; REF_OCC = {3}; REF_USER = {4}; REF_MACHINE = {5} - '''.format(REF_FILE, REF_SHOT, REF_RUN, REF_OCC, REF_USER, REF_MACHINE)) - # To exclude 2 conflict options use: - #group = parser.add_mutually_exclusive_group() - #parser.add_argument('shot', type=int, nargs='?', default=53259, help='shot, default=53259') - - parser.add_argument('--saveFile', action='store_true', \ - help='saves a Python .npz file') - parser.add_argument('--figures', action='store_true', \ - help='plot figures') - parser.add_argument('--no-git-check', action='store_true', \ - help='no check for changes that are not commited') - - args = parser.parse_args() - - print('REF FILE =', REF_FILE) - print(' ') - - if (not args.no_git_check): - try: - subprocess.run(['git', 'diff', '--exit-code', '--quiet'], check=True) - subprocess.run(['git', 'diff', '--cached', '--exit-code', '--quiet'], check=True) - except subprocess.CalledProcessError as err: - print(' ') - print('ERROR: not commited changes, please commit the changes.', err) - print(' ') - raise - - # Initialize dictionary to store results - results = {} - - idd = imas.ids(REF_SHOT, REF_RUN) - idd.open_env(REF_USER, REF_MACHINE, '3') - if (REF_OCC == 0): - idd.equilibrium.get() - else: - idd.equilibrium.get(REF_OCC) - equi = idd.equilibrium - - # Test one time and spatial 3D - # ---------------------------- - time_in = eps_time + 0.5*(np.nanmax(equi.time) + np.nanmin(equi.time)) - - equi_grid = idd.equilibrium.grids_ggd[0].grid[0] - NbrPoints = len(equi_grid.space[0].objects_per_dimension[0].object) - equiDict = {} - equiDict['r'] = np.full(NbrPoints, np.nan) - equiDict['z'] = np.full(NbrPoints, np.nan) - for ii in range(NbrPoints): - equiDict['r'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[0] - equiDict['z'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[1] - - R_in = np.linspace(np.min(equiDict['r']), \ - np.max(equiDict['r']), interp_points) - Z_in = np.linspace(np.min(equiDict['z']), \ - np.max(equiDict['z']), interp_points) - Phi_in = np.linspace(0, 2*np.pi/18, interp_points) - - R_in_tot = np.tile(R_in, int(interp_points**2)) - Z_in_tot = np.tile(np.repeat(Z_in, interp_points), interp_points) - Phi_in_tot = np.repeat(Phi_in, int(interp_points**2)) - - Rr = R_in_tot.reshape((interp_points, interp_points, interp_points)) - Zr = Z_in_tot.reshape((interp_points, interp_points, interp_points)) - - for iquant in lquantities: - start = time.time() - #sys.stdout = open(os.devnull, 'w') - out = equimap.get(REF_SHOT, time=time_in, R=R_in_tot, Phi=Phi_in_tot, \ - Z=Z_in_tot, quantity=iquant, no_ripple=False, \ - run=REF_RUN, occ=REF_OCC, user=REF_USER, \ - machine=REF_MACHINE) - #sys.stdout = sys.__stdout__ - end = time.time() - print() - print('====================================') - print('time for', iquant, ' =', end - start) - print('====================================') - print() - if (args.figures): - outr = out.reshape((interp_points, interp_points, interp_points)) - plt.figure() - plt.contourf(Rr[int(0.2*interp_points), :, :], \ - Zr[int(0.2*interp_points), :, :], \ - outr[int(0.2*interp_points), :, :]) - arg_time = np.argmin(np.abs(equi.time - time_in)) - plt.plot(np.squeeze(equi.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(equi.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') - plt.plot(equi.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - equi.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) - plt.xlabel('R [m]') - plt.ylabel('Z [m]') - plt.title('{0} t={1:.2f}'.format(iquant, time_in)) - plt.colorbar() - - # Save results in dict - results[iquant] = out - # End loop on lquantities - - # Test large time and spatial 2D (R, Phi) - # -------------------------------------- - # Check code.output_flag for data validity - if (np.any(np.isnan(equi.code.output_flag))): - mask = np.full(len(equi.time), True, dtype=bool) - else: - mask = np.asarray(equi.code.output_flag) >= 0 - time1 = 0.495*(np.nanmax(equi.time[mask]) + np.nanmin(equi.time[mask])) - time2 = 0.505*(np.nanmax(equi.time[mask]) + np.nanmin(equi.time[mask])) - mask_time_tmp = (equi.time[mask] >= time1) \ - & (equi.time[mask] <= time2) - indMin = np.abs(equi.time[mask] \ - - equi.time[mask][mask_time_tmp][0]).argmin() - indMax = np.abs(equi.time[mask] \ - - equi.time[mask][mask_time_tmp][-1]).argmin() - if (indMin == 0): - indMinApply = indMin - else: - indMinApply = indMin - 1 - if (indMax == (equi.time[mask].size-1)): - indMaxApply = indMax - else: - indMaxApply = indMax + 1 - mask_time = (equi.time[mask] >= equi.time[mask][indMinApply]) \ - & (equi.time[mask] <= equi.time[mask][indMaxApply]) - time_points = equi.time[mask][mask_time] - time_in = np.linspace(time1, time2, time_points.size + 1) - time_in += eps_time - - R_in = np.linspace(np.min(equiDict['r']), \ - np.max(equiDict['r']), interp_points) - Phi_in = np.linspace(0, 2*np.pi/18, interp_points) - - R_in_tot = np.tile(R_in, interp_points) - Z_in_tot = np.zeros(R_in_tot.shape) - Phi_in_tot = np.repeat(Phi_in, interp_points) - - Rr = R_in_tot.reshape((interp_points, interp_points)) - Phir = Phi_in_tot.reshape((interp_points, interp_points)) - - arg_time = np.argmin(np.abs(equi.time - time_in[int(0.5*time_in.size)])) - if (args.figures): - mask_LFS = (equi.time_slice[arg_time].boundary.outline.r > equi.time_slice[arg_time].global_quantities.magnetic_axis.r) - indZ0_LFS = np.argmin(np.abs(equi.time_slice[arg_time].boundary.outline.z[mask_LFS])) - mask_HFS = (equi.time_slice[arg_time].boundary.outline.r < equi.time_slice[arg_time].global_quantities.magnetic_axis.r) - indZ0_HFS = np.argmin(np.abs(equi.time_slice[arg_time].boundary.outline.z[mask_HFS])) - - for iquant in lquantities: - start = time.time() - #sys.stdout = open(os.devnull, 'w') - out = equimap.get(REF_SHOT, time=time_in, R=R_in_tot, Phi=Phi_in_tot, \ - Z=Z_in_tot, quantity=iquant, no_ripple=False, \ - run=REF_RUN, occ=REF_OCC, user=REF_USER, \ - machine=REF_MACHINE) - #sys.stdout = sys.__stdout__ - end = time.time() - print() - print('====================================') - print('time (large time input) for', iquant, ' =', end - start) - print('Z_axis =', equi.time_slice[arg_time].global_quantities.magnetic_axis.z) - print('====================================') - print() - if (args.figures): - outr = out[int(0.5*out.shape[0])].reshape((interp_points, interp_points)) - plt.figure() - plt.contourf(Rr[:, :], Phir[:, :], outr[:, :]) - plt.axvline(np.squeeze(equi.time_slice[arg_time].boundary.outline.r[mask_LFS][indZ0_LFS]), \ - linewidth=2, color='red') - plt.axvline(np.squeeze(equi.time_slice[arg_time].boundary.outline.r[mask_HFS][indZ0_HFS]), \ - linewidth=2, color='red') - plt.axvline(equi.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - linewidth=2, color='red', linestyle='--') - plt.xlabel('R [m]') - plt.ylabel('Phi [rad]') - plt.title('{0} t={1:.2f}'.format(iquant, time_in[int(0.5*out.shape[0])])) - plt.colorbar() - - # Save results in dict - results[iquant + '_LT'] = out - # End loop on lquantities - - if (args.saveFile): - filename = 'reg_test_{0}_Run{1}_Occ{2}_User_{3}_Machine_{4}.npz'.format( \ - REF_SHOT, REF_RUN, REF_OCC, REF_USER, REF_MACHINE) - np.savez(filename, **results) - - if (args.figures): - plt.show() - - ref = np.load(REF_FILE) - - for iquant in lquantities: - eval_diff(results[iquant], ref[iquant], iquant) - eval_diff(results[iquant + '_LT'], ref[iquant + '_LT'], iquant + '_LT') - - print() - print('End regression test') - print() diff --git a/tofu/mag/test_equimap.py b/tofu/mag/test_equimap.py deleted file mode 100644 index a88b114b5..000000000 --- a/tofu/mag/test_equimap.py +++ /dev/null @@ -1,298 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# Also if needed: retab -''' - TEST equimap -''' -from __future__ import (unicode_literals, absolute_import, \ - print_function, division) -import matplotlib.pyplot as plt -import numpy as np -import os -import sys - -#print('path 1 =', sys.path) -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -#print('path 2 =', sys.path) - -# Local modules -import equimap -import imas - -interp_points = 60 -shot = 53221 - -approx_time_in = 39.9881 -eps_time = 1E-3 -ctr_plot = [0] - -# CALL EQUIMAP -oute = equimap.get(shot, time=[35.9249267578125, 39.98], \ - R=[2., 2.2, 2.4, 2.7, 3.], Phi=[0, 0, 0, 0, 0], Z=[0, 0, 0, 0, 0], \ - quantity='psi') - -print('') -print('oute.shape =', oute.shape) -# oute should be: -# array([[-2.27165658, -3.01387112, -3.98753036, -3.92317787, -2.43752966], -# [ 1.09062263, 0.34659524, -0.63331812, -0.47944498, 1.01023176]]) -print('oute =', oute) -print('') - -idd = imas.ids(shot, 0) -idd.open_env('imas_public', 'west', '3') -idd.equilibrium.get() -out = idd.equilibrium - -equiDict = {} - -# Declaration of arrays 2d plots -equi_grid = idd.equilibrium.grids_ggd[0].grid[0] -NbrPoints = len(equi_grid.space[0].objects_per_dimension[0].object) -equiDict['r'] = np.full(NbrPoints, np.nan) -equiDict['z'] = np.full(NbrPoints, np.nan) -for ii in range(NbrPoints): - equiDict['r'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[0] - equiDict['z'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[1] - -arg_time = np.argmin(np.abs(out.time - approx_time_in)) - -print('\nDistance between requested and calculated time =', \ - np.abs(out.time[arg_time] - approx_time_in), '\n') - -time_in = out.time[arg_time] - eps_time - -print('\nNew distance between requested and calculated time =', \ - np.abs(out.time[arg_time] - time_in), '\n', \ - 'with eps_time =', eps_time, '\n') - -R_all = np.linspace(np.min(equiDict['r']), np.max(equiDict['r']), interp_points) -Z_all = np.linspace(np.min(equiDict['z']), np.max(equiDict['z']), interp_points) - -R_all_tot = np.repeat(R_all, interp_points) -Z_all_tot = np.tile(Z_all, interp_points) - -# CALL EQUIMAP -outa = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='psi') - -outar = outa.reshape((interp_points, interp_points)) -Rr = R_all_tot.reshape((interp_points, interp_points)) -Zr = Z_all_tot.reshape((interp_points, interp_points)) - -print('') -print('outa.shape =', outa.shape) -print('outar.shape =', outar.shape) -#print('oute =', oute) -print('') - -#plt.figure() -#cs_ref = plt.contour(out.interp2D.r, out.interp2D.z, \ -# out.interp2D.psi[np.argmin(np.abs(out.time - time_in))], \ -# ctr_plot, colors='k', linestyle='solid') -#cs_ref_tri = plt.tricontour(equiDict['r'], equiDict['z'], \ -# out.ggd[0].grid.space[0].objects_per_dimension[1].nodes, \ -# out.ggd[0].psi[np.argmin(np.abs(out.time - time_in))], \ -# ctr_plot, colors='red', linestyles='dashdot') -#cs = plt.contour(Rr, Zr, outar, ctr_plot, \ -# colors='orange', linestyles='dashed') -#plt.plot(np.nan, np.nan, color='k', linestyle='solid', label='ref interp2D') -#plt.plot(np.nan, np.nan, color='red', linestyle='dashdot', label='ref ggd') -#plt.plot(np.nan, np.nan, color='orange', linestyle='dashed', label='test interp') -#plt.legend() -#plt.xlabel('R [m]') -#plt.ylabel('Z [m]') -#plt.title('Contour psi, level ' + str(ctr_plot) + ' at time ' + str(time_in) + 's') -#plt.axes().set(aspect=1) -# -#p = cs.collections[0].get_paths()[0] -#v = p.vertices -#x_cs = v[:, 0] -#y_cs = v[:, 1] - -#p = cs_ref.collections[0].get_paths()[0] -#v = p.vertices -#x_cs_ref = v[:, 0] -#y_cs_ref = v[:, 1] - -plt.figure() -plt.contourf(Rr, Zr, outar) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.colorbar() -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('psi interpolated at time ' + str(time_in) + 's') -plt.axes().set(aspect=1) - -#plt.figure() -#plt.plot(x_cs_ref, y_cs_ref, label='Ref') -#plt.plot(x_cs, y_cs, '--', label='Interp') -#plt.xlabel('R [m]') -#plt.ylabel('Z [m]') -#plt.legend() - -#pts_cs_ref = np.linspace(0, 1, x_cs_ref.shape[0]) -#pts_cs = np.linspace(0, 1, x_cs.shape[0]) - -#x_cs_intp = np.interp(pts_cs_ref, pts_cs, x_cs) -#y_cs_intp = np.interp(pts_cs_ref, pts_cs, y_cs) - -#error_x = np.abs((x_cs_intp - x_cs_ref)/x_cs_ref)*100 -#error_y = np.abs((y_cs_intp - y_cs_ref)/y_cs_ref)*100 - -#plt.figure() -#plt.plot(error_x, label='err. x') -#plt.plot(error_y, label='err. y') -#plt.legend() -#plt.ylabel('Error interp psi contour level ' + str(ctr_plot) + ' in [%]' \ -# + '\nwith time difference, eps_time = ' + str(eps_time*100) + '%', \ -# multialignment='center') - -# CALL EQUIMAP -out_rho_pol_norm = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='rho_pol_norm') - -print('') -print('out_rho_pol_norm.shape =', out_rho_pol_norm.shape) -#print('out_rho_pol_norm =', out_rho_pol_norm) -print('') - -plt.figure() -out_rho_pol_norm_r = out_rho_pol_norm.reshape((interp_points, interp_points)) -cs = plt.contourf(Rr, Zr, out_rho_pol_norm_r) -plt.colorbar() -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('rho_pol_norm') - -# CALL EQUIMAP -out_rho_tor_norm = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='rho_tor_norm') -print('') -print('out_rho_tor_norm.shape =', out_rho_tor_norm.shape) -#print('out_rho_tor_norm =', out_rho_tor_norm) -print('') -plt.figure() -out_rho_tor_norm_r = out_rho_tor_norm.reshape((interp_points, interp_points)) -cs = plt.contourf(Rr, Zr, out_rho_tor_norm_r) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in)) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('rho_tor_norm') - -# CALL EQUIMAP -out_rho_tor = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='rho_tor') - -print('') -print('out_rho_tor.shape =', out_rho_tor.shape) -#print('out_rho_tor =', out_rho_tor) -print('') -plt.figure() -out_rho_tor_r = out_rho_tor.reshape((interp_points, interp_points)) -cs = plt.contourf(Rr, Zr, out_rho_tor_r) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in)) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('rho_tor') - -plt.figure() -plt.plot(out.time_slice[arg_time].profiles_1d.psi, out.time_slice[arg_time].profiles_1d.rho_tor) -plt.xlabel('Psi') -plt.ylabel('rho_tor') - -#plt.figure() -#plt.tricontourf(equiDict['r'], equiDict['z'], \ -# out.ggd[0].grid.space[0].objects_per_dimension[1].nodes, \ -# out.ggd[0].psi[arg_time]) -#plt.plot(np.squeeze(out.boundary.outline.r[arg_time]), \ -# np.squeeze(out.boundary.outline.z[arg_time]), \ -# linewidth=2, color='red') -#plt.plot(out.global_quantities.magnetic_axis.r[arg_time], \ -# out.global_quantities.magnetic_axis.z[arg_time], \ -# marker='+', color='red', markersize=20) -#plt.colorbar() -#plt.xlabel('R [m]') -#plt.ylabel('Z [m]') -#plt.title('psi ggd') - -# CALL EQUIMAP -out_b_norm = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='b_field_norm') - -print('') -print('out_b_norm.shape =', out_b_norm.shape) -#print('out_b_norm =', out_b_norm) -print('') -plt.figure() -out_b_norm_r = out_b_norm.reshape((interp_points, interp_points)) -cs = plt.contourf(Rr, Zr, out_b_norm_r) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in)) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('b_norm') - -# CALL EQUIMAP -out_theta = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='theta') - -print('') -print('out_theta.shape =', out_theta.shape) -print('out_theta =', out_theta) -print('') -plt.figure() -out_theta_r = out_theta.reshape((interp_points, interp_points)) -cs = plt.contourf(Rr, Zr, out_theta_r, 100) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in)) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('theta') - -plt.show() diff --git a/tofu/mag/test_ripple.py b/tofu/mag/test_ripple.py deleted file mode 100644 index 8006aeded..000000000 --- a/tofu/mag/test_ripple.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 -# Also if needed: retab -''' - TEST equimap -''' -from __future__ import (unicode_literals, absolute_import, \ - print_function, division) -import matplotlib.pyplot as plt -import numpy as np -import os -import sys -import time -#import warnings - -#print('path 1 =', sys.path) -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) -#print('path 2 =', sys.path) - -# Local modules -import imas -import equimap -#import imas_west -#import pywed as pw - -shot = 53221 -tol_val = 1E-10 - -# For 2D plots -interp_points = 60 - -# FIRST POINT B_NORM -# ------------------ -time_in = np.linspace(36, 37, 10) -Phi_in = np.linspace(0, 2*np.pi/18, 100) -R_in = np.full(Phi_in.shape, 3) -Z_in = np.zeros(R_in.shape) - -# Read equilibrium data -idd = imas.ids(shot, 0) -idd.open_env('imas_public', 'west', '3') -idd.equilibrium.get() -out = idd.equilibrium - -equiDict = {} - -# Declaration of arrays 2d plots -equi_grid = idd.equilibrium.grids_ggd[0].grid[0] -NbrPoints = len(equi_grid.space[0].objects_per_dimension[0].object) -equiDict['r'] = np.full(NbrPoints, np.nan) -equiDict['z'] = np.full(NbrPoints, np.nan) -for ii in range(NbrPoints): - equiDict['r'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[0] - equiDict['z'][ii] = equi_grid.space[0].objects_per_dimension[0]. \ - object[ii].geometry[1] - -# For 2D plots -R_all = np.linspace(np.min(equiDict['r']), np.max(equiDict['r']), interp_points) -Z_all = np.linspace(np.min(equiDict['z']), np.max(equiDict['z']), interp_points) - -R_all_tot = np.repeat(R_all, interp_points) -Z_all_tot = np.tile(Z_all, interp_points) - -Rr = R_all_tot.reshape((interp_points, interp_points)) -Zr = Z_all_tot.reshape((interp_points, interp_points)) - -# CALL EQUIMAP -start = time.time() -oute = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_norm') -end = time.time() -print() -print('time in equimap.get b_norm =', end - start) -print() -print('oute.shape b_norm =', oute.shape) - -# CALL EQUIMAP -start = time.time() -oute_noR = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_norm', no_ripple=True) -end = time.time() -print() -print('time in equimap.get b_norm no Ripple =', end - start) -print() -print('oute.shape b_norm no ripple =', oute_noR.shape) - -print() -print('Mean value B_norm ripple =', np.mean(oute[int(0.5*oute.shape[0]), :])) -print('Mean value B_norm NO ripple =', \ - np.mean(oute_noR[int(0.5*oute_noR.shape[0]), :])) -diff_mean_val = np.mean(oute[int(0.5*oute.shape[0]), :]) \ - - np.mean(oute_noR[int(0.5*oute_noR.shape[0]), :]) -print('Diff mean values =', diff_mean_val) -percent_diff = np.abs(100*diff_mean_val \ - / np.mean(oute[int(0.5*oute.shape[0]), :])) -print('Percent diff mean values =', percent_diff) - -# CHECK -# ----- -if (np.abs(percent_diff - 0.011052598088) > tol_val): - print() - print('ERROR: Higher than tolerance percent difference ' \ - + str(np.abs(percent_diff - 0.011052598088))) - print() - #raise RuntimeError -# FOR: -# shot = 53221 -# time_in = np.linspace(36, 37, 10) -# Phi_in = np.linspace(0, 2*np.pi/18, 100) -# R_in = np.full(Phi_in.shape, 3) -# Z_in = np.zeros(R_in.shape) -# RESULTS: -# Mean value B_norm ripple = 3.05593472975 -# Mean value B_norm NO ripple = 3.05627248994 -# Diff mean values = -0.000337760183512 -# Percent diff mean values = 0.011052598088 -print() - -# PLOTS -plt.figure() -plt.plot(time_in, oute[:, -1], label='B_norm at R={0}, Phi=Z=0'.format(R_in[-1])) -plt.plot(time_in, oute_noR[:, -1], label='B_norm no ripple at R={0}, Phi=Z=0'.format(R_in[-1])) -plt.legend() -plt.xlabel('Time [s]') -plt.ylabel('B_norm [T]') -plt.figure() -plt.plot(Phi_in, oute[int(0.5*oute.shape[0]), :], \ - label='B_norm at t={0:.2f}, R={1}, Z=0'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1])) -plt.plot(Phi_in, oute_noR[int(0.5*oute.shape[0]), :], \ - label='B_norm no ripple at t={0:.2f}, R={1}, Z=0'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1])) -plt.legend() -plt.xlabel('Phi [rad]') -plt.ylabel('B_norm [T]') - -# SECOND POSITION B_NORM -# ---------------------- -t_ignitron = [] -t_ignitron.append(32) -print() -print('t_igni =', t_ignitron[0]) -print() -time_in = np.linspace(t_ignitron[0], 38, 10) -Phi_in = np.linspace(0, 2*np.pi/18, 100) -R_in = np.full(Phi_in.shape, 2.43) -Z_in = np.full(Phi_in.shape, 0.57) - -# CALL EQUIMAP -start = time.time() -oute = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_norm') -end = time.time() -print() -print('time in equimap.get 2 b_norm =', end - start) -print() -print('oute.shape 2 b_norm =', oute.shape) - -# CALL EQUIMAP -start = time.time() -oute_noR = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_norm', no_ripple=True) -end = time.time() -print() -print('time in equimap.get 2 b_norm no ripple =', end - start) -print() -print('oute.shape 2 b_norm no ripple =', oute_noR.shape) - -# PLOTS -plt.figure() -plt.plot(time_in, oute[:, -1], \ - label='B_norm at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.plot(time_in, oute_noR[:, -1], \ - label='B_norm no ripple at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Time [s]') -plt.ylabel('B_norm [T]') -plt.figure() -plt.plot(Phi_in, oute[int(0.5*oute.shape[0]), :], \ - label='B_norm at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.plot(Phi_in, oute_noR[int(0.5*oute.shape[0]), :], \ - label='B_norm no ripple at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Phi [rad]') -plt.ylabel('B_norm [T]') - -# B_NORM 2D -# --------- -# CALL EQUIMAP -start = time.time() -outa = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='b_field_norm') -end = time.time() -print() -print('time in equimap.get b_norm 2D =', end - start) -print() -outar = outa[int(0.5*outa.shape[0])].reshape((interp_points, interp_points)) -plt.figure() -plt.contourf(Rr, Zr, outar) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in[int(0.5*outa.shape[0])])) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('B_norm t={0:.2f}'.format(time_in[int(0.5*outa.shape[0])])) - -# B_R TEST -# -------- -Phi_in = np.linspace(0, 2*np.pi/18, 100) -R_in = np.full(Phi_in.shape, 3) -Z_in = np.full(Phi_in.shape, 0) - -# CALL EQUIMAP -start = time.time() -oute = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_r') -end = time.time() -print() -print('time in equimap.get br =', end - start) -print() -print('oute.shape br =', oute.shape) - -# CALL EQUIMAP -start = time.time() -oute_noR = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_r', no_ripple=True) -end = time.time() -print() -print('time in equimap.get br no ripple =', end - start) -print() -print('oute.shape br no ripple =', oute_noR.shape) - -# PLOTS -plt.figure() -plt.plot(time_in, oute[:, -1], \ - label='B_r at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.plot(time_in, oute_noR[:, -1], \ - label='B_r no ripple at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Time [s]') -plt.ylabel('B_r [T]') - -plt.figure() -plt.plot(Phi_in, oute[int(0.5*oute.shape[0]), :], \ - label='B_r at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.plot(Phi_in, oute_noR[int(0.5*oute.shape[0]), :], \ - label='B_r no ripple at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Phi [rad]') -plt.ylabel('B_r [T]') - -# CALL EQUIMAP -start = time.time() -outa = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='b_field_r') -end = time.time() -print() -print('time in equimap.get br 2D =', end - start) -print() -outar = outa[int(0.5*outa.shape[0])].reshape((interp_points, interp_points)) -plt.figure() -plt.contourf(Rr, Zr, outar) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in[int(0.5*outa.shape[0])])) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('B_r t={0:.2f}'.format(time_in[int(0.5*outa.shape[0])])) - -# B_Z TEST -# -------- -Phi_in = np.linspace(0, 2*np.pi/18, 100) -R_in = np.full(Phi_in.shape, 3) -Z_in = np.full(Phi_in.shape, 0.2) - -# CALL EQUIMAP -start = time.time() -oute = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_z') -end = time.time() -print() -print('time in equimap.get bz =', end - start) -print() -print('oute.shape bz =', oute.shape) - -# CALL EQUIMAP -start = time.time() -oute_noR = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_z', no_ripple=True) -end = time.time() -print() -print('time in equimap.get bz no ripple =', end - start) -print() -print('oute.shape bz no ripple =', oute_noR.shape) - -# PLOTS -plt.figure() -plt.plot(time_in, oute[:, -1], \ - label='B_z at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.plot(time_in, oute_noR[:, -1], \ - label='B_z no ripple at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Time [s]') -plt.ylabel('B_z [T]') - -plt.figure() -plt.plot(Phi_in, oute[int(0.5*oute.shape[0]), :], \ - label='B_z at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.plot(Phi_in, oute_noR[int(0.5*oute.shape[0]), :], \ - label='B_z no ripple at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Phi [rad]') -plt.ylabel('B_z [T]') - -# CALL EQUIMAP -start = time.time() -outa = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='b_field_z') -end = time.time() -print() -print('time in equimap.get bz 2D =', end - start) -print() -outar = outa[int(0.5*outa.shape[0])].reshape((interp_points, interp_points)) -plt.figure() -plt.contourf(Rr, Zr, outar) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in[int(0.5*outa.shape[0])])) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('B_z t={0:.2f}'.format(time_in[int(0.5*outa.shape[0])])) - -# B_TOR TEST -# ---------- -Phi_in = np.linspace(0, 2*np.pi/18, 100) -R_in = np.full(Phi_in.shape, 3) -Z_in = np.full(Phi_in.shape, 0) - -# CALL EQUIMAP -start = time.time() -oute = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_tor') -end = time.time() -print() -print('time in equimap.get btor =', end - start) -print() -print('oute.shape btor =', oute.shape) - -# CALL EQUIMAP -start = time.time() -oute_noR = equimap.get(shot, time=time_in, \ - R=R_in, Phi=Phi_in, Z=Z_in, \ - quantity='b_field_tor', no_ripple=True) -end = time.time() -print() -print('time in equimap.get btor no ripple =', end - start) -print() -print('oute.shape btor no ripple =', oute_noR.shape) - -# PLOTS -plt.figure() -plt.plot(time_in, oute[:, -1], \ - label='B_tor at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.plot(time_in, oute_noR[:, -1], \ - label='B_tor no ripple at R={0}, Phi={1:.2f}, Z={2}'.format( \ - R_in[-1], Phi_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Time [s]') -plt.ylabel('B_tor [T]') - -plt.figure() -plt.plot(Phi_in, oute[int(0.5*oute.shape[0]), :], \ - label='B_tor at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.plot(Phi_in, oute_noR[int(0.5*oute.shape[0]), :], \ - label='B_tor no ripple at t={0:.2f}, R={1}, Z={2}'.format( \ - time_in[int(0.5*oute.shape[0])], R_in[-1], Z_in[-1])) -plt.legend() -plt.xlabel('Phi [rad]') -plt.ylabel('B_tor [T]') - -# CALL EQUIMAP -start = time.time() -outa = equimap.get(shot, time=time_in, \ - R=R_all_tot, Phi=np.zeros(R_all_tot.shape), Z=Z_all_tot, \ - quantity='b_field_tor') -end = time.time() -print() -print('time in equimap.get btor 2D =', end - start) -print() -outar = outa[int(0.5*outa.shape[0])].reshape((interp_points, interp_points)) -plt.figure() -plt.contourf(Rr, Zr, outar) -plt.colorbar() -arg_time = np.argmin(np.abs(out.time - time_in[int(0.5*outa.shape[0])])) -plt.plot(np.squeeze(out.time_slice[arg_time].boundary.outline.r), \ - np.squeeze(out.time_slice[arg_time].boundary.outline.z), \ - linewidth=2, color='red') -plt.plot(out.time_slice[arg_time].global_quantities.magnetic_axis.r, \ - out.time_slice[arg_time].global_quantities.magnetic_axis.z, \ - marker='+', color='red', markersize=20) -plt.xlabel('R [m]') -plt.ylabel('Z [m]') -plt.title('B_tor t={0:.2f}'.format(time_in[int(0.5*outa.shape[0])])) - -plt.show() diff --git a/tofu/tests/tests00_root/__init__.py b/tofu/tests/tests00_root/__init__.py deleted file mode 100644 index 8b1378917..000000000 --- a/tofu/tests/tests00_root/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tofu/tests/tests00_root/tests03_plot.py b/tofu/tests/tests00_root/tests03_plot.py deleted file mode 100644 index 092fcef6d..000000000 --- a/tofu/tests/tests00_root/tests03_plot.py +++ /dev/null @@ -1,158 +0,0 @@ -""" -This module contains tests for tofu.geom in its structured version -""" - - - -# External modules -import os -import numpy as np -import matplotlib.pyplot as plt -import warnings as warn - -# Nose-specific -from nose import with_setup # optional - - -# Importing package tofu.geom -import tofu as tf -from tofu import __version__ - - -_here = os.path.abspath(os.path.dirname(__file__)) -VerbHead = 'tofu.tests03_plot' -keyVers = 'Vers' -_Exp = 'WEST' - - -####################################################### -# -# Setup and Teardown -# -####################################################### - -def setup_module(module): - print("") # this is to get a newline after the dots - lf = os.listdir(_here) - lf = [f for f in lf - if all([s in f for s in ['TFG_',_Exp,'.npz']])] - lF = [] - for f in lf: - ff = f.split('_') - v = [fff[len(keyVers):] for fff in ff - if fff[:len(keyVers)]==keyVers] - msg = f + "\n "+str(ff) + "\n " + str(v) - assert len(v)==1, msg - v = v[0] - if '.npz' in v: - v = v[:v.index('.npz')] - # print(v, __version__) - if v!=__version__: - lF.append(f) - if len(lF)>0: - print("Removing the following previous test files:") - for f in lF: - os.remove(os.path.join(_here,f)) - #print("setup_module before anything in this file") - -def teardown_module(module): - #os.remove(VesTor.Id.SavePath + VesTor.Id.SaveName + '.npz') - #os.remove(VesLin.Id.SavePath + VesLin.Id.SaveName + '.npz') - #print("teardown_module after everything in this file") - #print("") # this is to get a newline - lf = os.listdir(_here) - lf = [f for f in lf - if all([s in f for s in ['TFG_',_Exp,'.npz']])] - lF = [] - for f in lf: - ff = f.split('_') - v = [fff[len(keyVers):] for fff in ff - if fff[:len(keyVers)]==keyVers] - msg = f + "\n "+str(ff) + "\n " + str(v) - assert len(v)==1, msg - v = v[0] - if '.npz' in v: - v = v[:v.index('.npz')] - # print(v, __version__) - if v==__version__: - lF.append(f) - if len(lF)>0: - print("Removing the following test files:") - for f in lF: - os.remove(os.path.join(_here,f)) - - - -####################################################### -# -# Struct subclasses -# -####################################################### - - -class Test01_plot_shotovervew(object): - - @classmethod - def setup_class(cls): - #print("") - #print("---- "+cls.__name__) - - # conf - cls.conf = tf.geom.utils.create_config('B3') - - # time vectors - t0 = np.linspace(0,10,100) - teq0 = t0 + 0.1 - t1 = np.linspace(t0[0],t0[-1]+1, t0.size//2) - t2 = np.linspace(t0[0]-1.,t0[-1]-1., 2*t0.size) - teq2 = t2 - 0.1 - - Ax0 = np.array([2.4+0.1*np.cos(teq0), 0.1*np.sin(teq0)]).T - Ax2 = np.array([2.4+0.1*np.sin(teq2), 0.05*np.cos(teq2)]).T - Sep0 = (Ax0[:,:,np.newaxis] - + 0.4*np.array([[-1,1,1,-1],[-1,-1,1,1]])[None,:,:]) - Sep2 = (Ax2[:,:,np.newaxis] - + 0.4*np.array([[-1,1,1,-1],[-1,-1,1,1]])[None,:,:]) - - - # dextra - dextra0 = {'pouet':{'t':t0, 'c':'k', 'data':np.sin(t0), - 'units':'a.u.', 'label':'pouet0'}, - 'Ax':{'t':teq0, 'data2D':Ax0}, - 'Sep':{'t':teq0,'data2D':Sep0}} - dextra1 = {'pouet':{'t':t1, 'c':'k', 'data':np.cos(t1), - 'units':'a.u.', 'label':'pouet1'}} - dextra2 = {'Ax':{'t':teq2, 'data2D':Ax2}, - 'Sep':{'t':teq2,'data2D':Sep2}} - - cls.dobj = {0:dextra0, 1:dextra1, 2:dextra2} - - @classmethod - def teardown_class(cls): - #print("teardown_class() after any methods in this class") - pass - - def setup(self): - #print("TestUM:setup() before each test method") - pass - - def teardown(self): - #print("TestUM:teardown() after each test method") - pass - - def test01_plot_shotoverview(self): - # One by one, without conf - for shot, dextra in self.dobj.items(): - kh = tf._plot.plot_shotoverview({shot:dextra}) - - # All together, without conf - kh = tf._plot.plot_shotoverview(self.dobj) - plt.close('all') - - # One by one, with conf - for shot, dextra in self.dobj.items(): - kh = tf._plot.plot_shotoverview({shot:dextra}, config=self.conf) - - # All together, with conf - kh = tf._plot.plot_shotoverview(self.dobj, config=self.conf) - plt.close('all') diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilCS_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilCS_V0.txt deleted file mode 100644 index 00afc4561..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilCS_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -6.690000000000000391e-01 8.750000000000000000e-01 -6.690000000000000391e-01 -8.449999999999999734e-01 -8.120000000000000551e-01 -8.449999999999999734e-01 -8.120000000000000551e-01 8.750000000000000000e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Bl_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Bl_V0.txt deleted file mode 100644 index 6d28a9fdd..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Bl_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -1.082999999999999963e+00 -1.199999999999999956e+00 -1.082999999999999963e+00 -2.399999999999999911e+00 -1.155000000000000027e+00 -2.399999999999999911e+00 -1.154999530098605787e+00 -1.199999999999999956e+00 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Bu_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Bu_V0.txt deleted file mode 100644 index 58e4ddbf5..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Bu_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -1.082000000000000073e+00 2.399999999999999911e+00 -1.082000000000000073e+00 1.199999999999999956e+00 -1.154999704364031432e+00 1.199999999999999956e+00 -1.155000000000000027e+00 2.399999999999999911e+00 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivLow1_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivLow1_V0.txt deleted file mode 100644 index a685e30e2..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivLow1_V0.txt +++ /dev/null @@ -1,10 +0,0 @@ -2.042206995923038004e+00 -7.415929999999999467e-01 -2.042207050252251133e+00 -7.075930000000000275e-01 -1.980792770570662276e+00 -7.075930000000000275e-01 -1.980793050544402689e+00 -7.730069999999999997e-01 -2.042206995923038004e+00 -7.730069999999999997e-01 -2.044793069367166982e+00 -7.730069999999999997e-01 -2.044792623226619366e+00 -8.070069999999999188e-01 -2.106206893914508438e+00 -8.070069999999999188e-01 -2.106207112893221378e+00 -7.415929999999999467e-01 -2.044793069367166982e+00 -7.415929999999999467e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivLow2_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivLow2_V0.txt deleted file mode 100644 index 7029bee49..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivLow2_V0.txt +++ /dev/null @@ -1,10 +0,0 @@ -2.197207179608240857e+00 -8.042129999999999557e-01 -2.197207006883284297e+00 -7.702130000000000365e-01 -2.135793040491517747e+00 -7.702130000000000365e-01 -2.135792222643860150e+00 -8.356270000000000087e-01 -2.197207179608240857e+00 -8.356270000000000087e-01 -2.199792764232576303e+00 -8.356270000000000087e-01 -2.199793278210023129e+00 -8.696269999999999278e-01 -2.261207341145433425e+00 -8.696269999999999278e-01 -2.261206680372229716e+00 -8.042129999999999557e-01 -2.199792764232576303e+00 -8.042129999999999557e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivUp1_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivUp1_V0.txt deleted file mode 100644 index 83a60d8ed..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivUp1_V0.txt +++ /dev/null @@ -1,10 +0,0 @@ -2.042207645190126097e+00 7.759070000000000134e-01 -1.980793050544402689e+00 7.759070000000000134e-01 -1.980792770570662276e+00 7.104930000000000412e-01 -2.042207050252251133e+00 7.104930000000000412e-01 -2.042207645190126097e+00 7.444930000000000714e-01 -2.044793069367166982e+00 7.444930000000000714e-01 -2.106207112893221378e+00 7.444930000000000714e-01 -2.106206893914508438e+00 8.099070000000000435e-01 -2.044792623226619366e+00 8.099070000000000435e-01 -2.044793069367166982e+00 7.759070000000000134e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivUp2_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivUp2_V0.txt deleted file mode 100644 index 8e09e4ffe..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_DivUp2_V0.txt +++ /dev/null @@ -1,10 +0,0 @@ -2.197207179608240857e+00 8.385270000000000223e-01 -2.135792222643860150e+00 8.385270000000000223e-01 -2.135793040491517747e+00 7.731130000000000502e-01 -2.197207006883284297e+00 7.731130000000000502e-01 -2.197207179608240857e+00 8.071130000000000804e-01 -2.199792764232576303e+00 8.071130000000000804e-01 -2.261206680372229716e+00 8.071130000000000804e-01 -2.261207341145433425e+00 8.725270000000000525e-01 -2.199793278210023129e+00 8.725270000000000525e-01 -2.199792764232576303e+00 8.385270000000000223e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Dl_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Dl_V0.txt deleted file mode 100644 index 2c0ee2c60..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Dl_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -2.748000164891553077e+00 -1.745999999999999996e+00 -2.748000164891553077e+00 -2.108999999999999986e+00 -3.015000352983229881e+00 -2.108999999999999986e+00 -3.015000352983229881e+00 -1.745999999999999996e+00 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Du_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Du_V0.txt deleted file mode 100644 index 96582dd18..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Du_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -2.748000164891553077e+00 2.108999999999999986e+00 -2.748000164891553077e+00 1.745999999999999996e+00 -3.015000352983229881e+00 1.745999999999999996e+00 -3.015000352983229881e+00 2.108999999999999986e+00 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_El_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_El_V0.txt deleted file mode 100644 index 4cd7f7653..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_El_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -3.627999857166479991e+00 -1.346000000000000085e+00 -3.627999857166479991e+00 -1.735999999999999988e+00 -3.914999605251704207e+00 -1.735999999999999988e+00 -3.914999605251704207e+00 -1.346000000000000085e+00 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Eu_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Eu_V0.txt deleted file mode 100644 index ae65e51e3..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Eu_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -3.627999857166479991e+00 1.735999999999999988e+00 -3.627999857166479991e+00 1.346000000000000085e+00 -3.914999605251704207e+00 1.346000000000000085e+00 -3.914999605251704207e+00 1.735999999999999988e+00 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Fl_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Fl_V0.txt deleted file mode 100644 index 1b024c829..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Fl_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -4.229999603353291171e+00 -4.520000000000000129e-01 -4.229999603353291171e+00 -8.399999999999999689e-01 -4.519000173463263437e+00 -8.399999999999999689e-01 -4.519000173463263437e+00 -4.520000000000000129e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Fu_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Fu_V0.txt deleted file mode 100644 index cc6be2e3f..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Fu_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -4.229999603353291171e+00 8.379999999999999671e-01 -4.229999603353291171e+00 4.500000000000000111e-01 -4.519000173463263437e+00 4.500000000000000111e-01 -4.519000173463263437e+00 8.379999999999999671e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Notes.py deleted file mode 100755 index 82321022d..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_CoilPF_Notes.py +++ /dev/null @@ -1,322 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -#_Cls, _name = os.path.split(__file__)[1].split('_')[1:3] -#assert not any([any([ss in s for ss in ['WEST','Notes','.']]) -# for s in [_Cls,_name]) - - -def get_notes(): - """ By convention : D is a length of the element, d is a gap """ - - # CreoVew coordinates : (-X,Y,Y) - notes = {} - - # Low Divertor coils - notes['DivLow11'] = [[ 544.028, -707.593, -1904.619], - [ 544.028, -739.007, -1904.619], - [ 552.107, -739.007, -1932.902], - [ 552.107, -707.593, -1932.902]] - - notes['DivLow12'] = [[ 506.027, -741.593, -1915.066], - [ 506.027, -773.007, -1915.066], - [ 513.541, -773.007, -1943.504], - [ 513.541, -741.593, -1943.504]] - - notes['DivLow13'] = [[ 591.045, -707.593, -1924.058], - [ 591.045, -739.007, -1924.058], - [ 599.682, -739.007, -1952.176], - [ 599.682, -707.593, -1952.176]] - - notes['DivLow14'] = [[ 629.245, -741.593, -1911.906], - [ 629.245, -773.007, -1911.906], - [ 638.441, -773.007, -1939.846], - [ 638.441, -741.593, -1939.846]] - - notes['DivLow15'] = [[ 719.986, -741.593, -1913.844], - [ 719.986, -773.007, -1913.844], - [ 730.343, -773.007, -1941.374], - [ 730.343, -741.593, -1941.374]] - - notes['DivLow16'] = [[866.309, -775.593, -1852.211], - [866.309, -807.007, -1852.211], - [878.771, -807.007, -1878.855], - [878.771, -775.593, -1878.855]] - - notes['DivLow17'] = [[782.893, -741.593, -1923.577], - [782.893, -773.007, -1923.577], - [793.981, -773.007, -1950.821], - [793.981, -741.593, -1950.821]] - - notes['DivLow18'] = [[832.314, -775.593, -1902.715], - [832.314, -807.007, -1902.715], - [844.102, -807.007, -1929.663], - [844.102, -775.593, -1929.663]] - - notes['DivLow1'] = [notes['DivLow14'][3], - notes['DivLow13'][3], - notes['DivLow11'][0], - notes['DivLow12'][1], - notes['DivLow14'][2], - notes['DivLow15'][1], - notes['DivLow16'][1], - notes['DivLow18'][2], - notes['DivLow17'][3], - notes['DivLow15'][0]] - - # Div Low 2 - - notes['DivLow21'] = [[2070.226, -770.213, -525.144], - [2070.226, -801.627, -525.144], - [2098.737, -801.627, -532.377], - [2098.737, -770.213, -532.377]] - - notes['DivLow22'] = [[2059.565, -804.213, -565.509], - [2059.565, -835.627, -565.509], - [2087.930, -835.627, -573.298], - [2087.930, -804.213, -573.298]] - - notes['DivLow23'] = [[2111.217, -770.213, -492.023], - [2111.217, -801.627, -492.023], - [2139.864, -801.627, -498.699], - [2139.864, -770.213, -498.699]] - - notes['DivLow24'] = [[2036.407, -804.213, 743.216], - [2036.407, -835.627, 743.216], - [2064.039, -835.627, 753.301], - [2064.039, -804.213, 753.301]] - - notes['DivLow25'] = [[2160.173, -804.213, -415.621], - [2160.173, -835.627, -415.621], - [2189.057, -835.627, -421.178], - [2189.057, -804.213, -421.178]] - - notes['DivLow26'] = [[2185.593, -838.213, -249.547], - [2185.593, -869.627, -249.547], - [2214.817, -869.627, -252.884], - [2214.817, -838.213, -252.884]] - - notes['DivLow27'] = [[2221.021, -838.213, -219.014], - [2221.021, -869.627, -219.014], - [2250.293, -869.627, -221.901], - [2250.293, -838.213, -221.901]] - - notes['DivLow28'] = [[2214.719, -804.213, -275.533], - [2214.719, -835.627, -275.533], - [2243.908, -835.627, -279.164], - [2243.908, -804.213, -279.164]] - - notes['DivLow2'] = [notes['DivLow24'][3], - notes['DivLow23'][3], - notes['DivLow21'][0], - notes['DivLow22'][1], - notes['DivLow24'][2], - notes['DivLow25'][1], - notes['DivLow26'][1], - notes['DivLow27'][2], - notes['DivLow28'][3], - notes['DivLow25'][0]] - - # Upper Divertor coils - - notes['DivUp11'] = [[1915.066, 775.907, -506.027], - [1915.066, 744.493, -506.027], - [1943.504, 744.493, -513.541], - [1943.504, 775.907, -513.541]] - - notes['DivUp12'] = [[1904.619, 741.907, -544.028], - [1904.619, 710.493, -544.028], - [1932.902, 710.493, -552.107], - [1932.902, 741.907, -552.107]] - - notes['DivUp13'] = [[1911.907, 775.907, -629.241], - [1911.907, 744.493, -629.241], - [1939.848, 744.493, -638.437], - [1939.848, 775.907, -638.437]] - - notes['DivUp14'] = [[1924.058, 741.907, -591.045], - [1924.058, 710.493, -591.045], - [1952.176, 710.493, -599.682], - [1952.176, 741.907, -599.682]] - - notes['DivUp15'] = [[1852.211, 809.907, -866.309], - [1852.211, 778.493, -866.309], - [1878.855, 778.493, -878.771], - [1878.855, 809.907, -878.771]] - - notes['DivUp16'] = [[1913.844, 775.907, -719.986], - [1913.844, 744.493, -719.986], - [1941.374, 744.493, -730.343], - [1941.374, 775.907, -730.343]] - - notes['DivUp17'] = [[1902.715, 809.907, -832.314], - [1902.715, 778.493, -832.314], - [1929.663, 778.493, -844.102], - [1929.663, 809.907, -844.102]] - - notes['DivUp18'] = [[1923.577, 775.907, -782.893], - [1923.577, 744.493, -782.893], - [1950.821, 744.493, -793.981], - [1950.821, 775.907, -793.981]] - - notes['DivUp1'] = [notes['DivUp13'][3], - notes['DivUp11'][0], - notes['DivUp12'][1], - notes['DivUp14'][2], - notes['DivUp13'][2], - notes['DivUp16'][1], - notes['DivUp18'][2], - notes['DivUp17'][3], - notes['DivUp15'][0], - notes['DivUp16'][0]] - - # Div Up 2 - - notes['DivUp21'] = [[565.509, 838.527, -2059.565], - [565.509, 807.113, -2059.565], - [573.298, 807.113, -2087.930], - [573.298, 838.527, -2087.930]] - - notes['DivUp22'] = [[525.144, 804.527, -2070.226], - [525.144, 773.113, -2070.226], - [532.377, 773.113, -2098.737], - [532.377, 804.527, -2098.737]] - - notes['DivUp23'] = [[492.023, 804.527, -2111.217], - [492.023, 773.113, -2111.217], - [498.699, 773.113, -2139.864], - [498.699, 804.527, -2139.864]] - - notes['DivUp24'] = [[-743.216, 838.527, -2036.407], - [-743.216, 807.113, -2036.407], - [-753.301, 807.113, -2064.039], - [-753.301, 838.527, -2064.039]] - - notes['DivUp25'] = [[249.547, 872.527, -2185.593], - [249.547, 841.113, -2185.593], - [252.884, 841.113, -2214.817], - [252.884, 872.527, -2214.817]] - - notes['DivUp26'] = [[415.621, 838.527, -2160.173], - [415.621, 807.113, -2160.173], - [421.178, 807.113, -2189.057], - [421.178, 838.527, -2189.057]] - - notes['DivUp27'] = [[275.533, 838.527, -2214.719], - [275.533, 807.113, -2214.719], - [279.164, 807.113, -2243.908], - [279.164, 838.527, -2243.908]] - - notes['DivUp28'] = [[219.014, 872.527, -2221.021], - [219.014, 841.113, -2221.021], - [221.901, 841.113, -2250.293], - [221.901, 872.527, -2250.293]] - - notes['DivUp2'] = [notes['DivUp24'][3], - notes['DivUp21'][0], - notes['DivUp22'][1], - notes['DivUp23'][2], - notes['DivUp24'][2], - notes['DivUp26'][1], - notes['DivUp27'][2], - notes['DivUp28'][3], - notes['DivUp25'][0], - notes['DivUp26'][0]] - - # Central Solenoid - - notes['CS'] = [[0., 875., 669.], - [0., -845., 669.], - [0., -845., 812.], - [0., 875., 812.]] - - # External PF coils - - notes['Bu'] = [[0., 2400., 1082.], - [0., 1200., 1082.], - [-577.5, 1200., 1000.259], - [0., 2400., 1155.]] - - notes['Bl'] = [[-1083., -1200., 0.], - [-1083., -2400., 0.], - [-1155., -2400., 0.], - [-816.708, -1200., -816.708]] - - notes['Du'] = [[-1374., 2109., 2379.838], - [-1374., 1746., 2379.838], - [-1507.5, 1746., 2611.067], - [-1507.5, 2109., 2611.067]] - - notes['Dl'] = [[-1374., -1746., 2379.838], - [-1374., -2109., 2379.838], - [-1507.5, -2109., 2611.067], - [-1507.5, -1746., 2611.067]] - - notes['Eu'] = [[-1814., 1736., 3141.94], - [-1814., 1346., 3141.94], - [-1957.5, 1346., 3390.489], - [-1957.5, 1736., 3390.489]] - - notes['El'] = [[-1814., -1346., 3141.94], - [-1814., -1736., 3141.94], - [-1957.5, -1736., 3390.489], - [-1957.5, -1346., 3390.489]] - - notes['Fu'] = [[-2115., 838., 3663.287], - [-2115., 450., 3663.287], - [-2259.5, 450., 3913.569], - [-2259.5, 838., 3913.569]] - - notes['Fl'] = [[-2115., -452., 3663.287], - [-2115., -840., 3663.287], - [-2259.5, -840., 3913.569], - [-2259.5, -452., 3913.569]] - - for k in notes.keys(): - notes[k] = np.array(notes[k])*1.e-3 - - return notes - - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - lPoly = [] - for k in notes.keys(): - if k[-2] in ['1','2']: - continue - Poly = np.array([np.hypot(notes[k][:,0],notes[k][:,2]), notes[k][:,1]]) - lPoly.append(Poly) - if save: - if 'CS' in k: - name = 'WEST_CoilCS_V0.txt' - else: - name = 'WEST_CoilPF_{0}_V0.txt'.format(k) - pathfilext = os.path.join(path,name) - np.savetxt(pathfilext, Poly.T) - return lPoly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_Notes.py deleted file mode 100755 index db7ff45a9..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_Notes.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - notes = {'DPhi':{}, 'dPhi':{}} - # Total length - notes['DL'] = 405.107 - - # Toroidal width - notes['DPhi']['In'] = 102.951 - notes['DPhi']['Out'] = 120.538 - - # Toroidal gap - notes['dPhi']['In'] = 1.000 - notes['dPhi']['Out'] = 1.000 - - # Height - notes['DZ'] = 21.000 - - # Number in toroidal direction - notes['nbPhi'] = 12*12 - - # sample (X,Z,Y) - notes['PolyRZ'] = [[2.58000, -8.5940e-01],#0, V1 - [2.58000, -8.3940e-01], # V1 - [2.61500, -8.3940e-01], - [2.61500, -7.3040e-01], - [2.47200, -7.3040e-01], - [2.46200, -7.1340e-01], # V1 - [2.46200, -6.9340e-01], - [2.38950, -6.9340e-01], - [2.38670, -6.9300e-01], # V1 - [2.38420, -6.9170e-01], # V1 - [2.38220, -6.8970e-01],#10, V1 - [2.38090, -6.8720e-01], - [2.38050, -6.8440e-01], # V1 - [2.38090, -6.8160e-01], - [2.38220, -6.7910e-01], # V1 - [2.38420, -6.7710e-01], # V1 - [2.38670, -6.7580e-01], # V1 - [2.38950, -6.7540e-01], - [2.46525, -6.7540e-01], # V1 - [2.61767, -6.7540e-01], # V1 - [2.72657, -6.7540e-01],#20, V1 - [2.78560, -6.7540e-01], - [2.78560, -6.9340e-01], - [2.75000, -6.9340e-01], # V1 - [2.75000, -7.0840e-01], # V1 - [2.69800, -7.0840e-01], # V1 - [2.69500, -7.3040e-01], - [2.63500, -7.3040e-01], - [2.63500, -8.3940e-01], - [2.67000, -8.3940e-01], # V1 - [2.67000, -8.5940e-01]]#30, V1 - - notes['PolyRZ'] = np.asarray(notes['PolyRZ'],dtype=float)*1.e3 - notes['ind_V1'] = np.array([0,1,5,8,9,10,12,14,15,16, - 18,19,20,23,24,25,29,30],dtype=int) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not ('nb' in kk or 'ind' in kk): - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - Poly = notes['PolyRZ'] - ind0 = np.ones((Poly.shape[0],),dtype=bool) - ind0[notes['ind_V1']] = False - Poly0 = Poly[ind0,:] - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly) - return Poly0.T, Poly.T, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_V0.txt deleted file mode 100644 index e8707025a..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_V0.txt +++ /dev/null @@ -1,13 +0,0 @@ -2.615000000000000213e+00 -8.394000000000001460e-01 -2.615000000000000213e+00 -7.304000000000001602e-01 -2.471999999999999975e+00 -7.304000000000001602e-01 -2.462000000000000188e+00 -6.934000000000000163e-01 -2.389499999999999957e+00 -6.934000000000000163e-01 -2.380900000000000016e+00 -6.872000000000000330e-01 -2.380900000000000016e+00 -6.815999999999999837e-01 -2.389499999999999957e+00 -6.754000000000000004e-01 -2.785600000000000076e+00 -6.754000000000000004e-01 -2.785600000000000076e+00 -6.934000000000000163e-01 -2.694999999999999840e+00 -7.304000000000001602e-01 -2.635000000000000231e+00 -7.304000000000001602e-01 -2.635000000000000231e+00 -8.394000000000001460e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_V1.txt deleted file mode 100644 index c6a248228..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Baffle_V1.txt +++ /dev/null @@ -1,31 +0,0 @@ -2.580000000000000071e+00 -8.594000000000001638e-01 -2.580000000000000071e+00 -8.394000000000001460e-01 -2.615000000000000213e+00 -8.394000000000001460e-01 -2.615000000000000213e+00 -7.304000000000001602e-01 -2.471999999999999975e+00 -7.304000000000001602e-01 -2.462000000000000188e+00 -7.134000000000001451e-01 -2.462000000000000188e+00 -6.934000000000000163e-01 -2.389499999999999957e+00 -6.934000000000000163e-01 -2.386699999999999822e+00 -6.930000000000000604e-01 -2.384199999999999875e+00 -6.916999999999999815e-01 -2.382200000000000539e+00 -6.896999999999999797e-01 -2.380900000000000016e+00 -6.872000000000000330e-01 -2.380500000000000060e+00 -6.844000000000000083e-01 -2.380900000000000016e+00 -6.815999999999999837e-01 -2.382200000000000539e+00 -6.791000000000000369e-01 -2.384199999999999875e+00 -6.771000000000000352e-01 -2.386699999999999822e+00 -6.757999999999999563e-01 -2.389499999999999957e+00 -6.754000000000000004e-01 -2.465250000000000163e+00 -6.754000000000000004e-01 -2.617669999999999941e+00 -6.754000000000000004e-01 -2.726570000000000160e+00 -6.754000000000000004e-01 -2.785600000000000076e+00 -6.754000000000000004e-01 -2.785600000000000076e+00 -6.934000000000000163e-01 -2.750000000000000000e+00 -6.934000000000000163e-01 -2.750000000000000000e+00 -7.084000000000000297e-01 -2.697999999999999954e+00 -7.084000000000000297e-01 -2.694999999999999840e+00 -7.304000000000001602e-01 -2.635000000000000231e+00 -7.304000000000001602e-01 -2.635000000000000231e+00 -8.394000000000001460e-01 -2.669999999999999929e+00 -8.394000000000001460e-01 -2.669999999999999929e+00 -8.594000000000001638e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_Notes.py deleted file mode 100755 index f69902948..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_Notes.py +++ /dev/null @@ -1,197 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - notes = {} - # Number of tiles vertically - notes['nbZ'] = 10 - # Number of tiles toroidally - notes['nbPhi'] = 3 - # Vertical average gap - notes['dZ'] = 3.842 - # Toroidal average gap - notes['dPhi'] = 1.500 - - # Total toroidal width in equatorial plane - notes['DPhi'] = 269.000 - # Total height - notes['DZ'] = 1189.530 - - # Radius of holes - notes['r_outer'] = 6.000 - notes['r_inner'] = 4.000 - - # sampleXZY - notes['sampleXZY'] = [[-939.226, 592.992, 1626.787],#0 - [-940.405, 594.553, 1628.830], - [-940.557, 594.491, 1629.092], - [-942.429, 591.177, 1632.335], - [-948.038, 557.622, 1642.051], - [-948.117, 555.038, 1642.187], - [-945.686, 531.169, 1637.977], - [-942.393, 498.833, 1632.273], - [-939.100, 466.497, 1626.569], - [-937.503, 450.819, 1623.803], - [-934.555, 446.918, 1618.696],#10 - [-925.736, 450.510, 1603.421], - [-925.323, 445.938, 1602.706], - [-934.213, 443.137, 1618.105], - [-936.294, 437.419, 1621.708], - [-935.048, 421.614, 1619.551], - [-932.480, 389.017, 1615.103], - [-929.912, 356.419, 1610.655], - [-928.667, 340.614, 1608.498], - [-925.808, 336.453, 1603.547], - [-916.918, 339.255, 1588.148],#20 - [-916.598, 334.511, 1587.595], - [-925.542, 332.506, 1603.086], - [-927.748, 326.981, 1606.907], - [-926.858, 311.080, 1605.365], - [-925.021, 278.286, 1602.183], - [-923.183, 245.491, 1599.000], - [-922.293, 229.590, 1597.458], - [-919.530, 225.178, 1592.672], - [-910.586, 227.182, 1577.181], - [-910.379, 222.555, 1576.822],#30 - [-919.359, 221.351, 1592.376], - [-921.686, 216.028, 1596.407], - [-921.151, 200.064, 1595.480], - [-920.047, 167.138, 1593.569], - [-918.944, 134.211, 1591.658], - [-918.409, 118.247, 1590.731], - [-915.747, 113.593, 1586.121], - [-906.768, 114.797, 1570.567], - [-906.661, 110.014, 1570.383], - [-915.659, 109.615, 1585.967],#40 - [-918.103, 104.505, 1590.200], - [-917.925, 088.509, 1589.892], - [-917.558, 055.517, 1589.258], - [-917.192, 022.525, 1588.623], - [-917.014, 006.529, 1588.315], - [-914.459, 001.641, 1583.890], - [-905.461, 002.041, 1568.305], - [-905.462,-002.605, 1568.306], - [-914.459,-002.201, 1583.890], - [-917.015,-007.087, 1588.316],#50 - [-917.194,-023.083, 1588.627], - [-917.565,-056.075, 1589.268], - [-917.935,-089.067, 1589.910], - [-918.114,-105.063, 1590.221], - [-915.671,-110.174, 1585.989], - [-906.673,-110.578, 1570.404], - [-906.780,-115.360, 1570.590], - [-915.760,-114.152, 1586.143], - [-918.422,-118.805, 1590.754], - [-918.959,-134.769, 1591.684],#60 - [-920.066,-167.695, 1593.601], - [-921.173,-200.620, 1595.519], - [-921.710,-216.584, 1596.448], - [-919.383,-221.908, 1592.419], - [-910.404,-223.116, 1576.865], - [-910.611,-227.744, 1577.225], - [-919.555,-225.735, 1592.716], - [-922.318,-230.146, 1597.502], - [-923.211,-246.046, 1599.048], - [-925.052,-278.840, 1602.236],#70 - [-926.892,-311.634, 1605.425], - [-927.785,-327.534, 1606.971], - [-925.580,-333.061, 1603.151], - [-916.636,-335.069, 1587.660], - [-916.956,-339.813, 1588.214], - [-925.846,-337.007, 1603.612], - [-928.705,-341.167, 1608.564], - [-929.952,-356.971, 1610.724], - [-932.524,-389.568, 1615.178], - [-935.096,-422.165, 1619.633],#80 - [-936.343,-437.969, 1621.793], - [-934.263,-443.687, 1618.191], - [-925.373,-446.493, 1602.793], - [-925.786,-451.065, 1603.508], - [-934.604,-447.468, 1618.782], - [-937.554,-451.369, 1623.890], - [-939.152,-467.046, 1626.659], - [-942.449,-499.381, 1632.369], - [-945.746,-531.715, 1638.079], - [-948.179,-555.583, 1642.294],#90 - [-948.101,-558.166, 1642.159], - [-942.495,-591.724, 1632.449], - [-940.623,-595.039, 1629.207], - [-939.292,-593.541, 1626.902]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def _get_inter(D0,u0,D1,u1): - k = -np.cross(D0-D1,u1)/np.cross(u0,u1) - return D0 + k*u0 - - - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - RMin = 1.775#np.min(Poly[0,:])-0.01 - P0 = np.array([[RMin],[Poly[1,0]]]) - PEnd = np.array([[RMin],[Poly[1,-1]]]) - Poly = np.concatenate((P0,Poly,PEnd),axis=1) - ind0 = [0,4,6,-6,-4,-1] - indt = [10,15,19,24,28,33,37,42,46,51,55,60, - 64,69,73,78,82,87] - p0, p1 = [Poly[:,ind0[:3]]], [Poly[:,ind0[:3]]] - for ii in range(0,len(indt),2): - D0, D1 = Poly[:,indt[ii]], Poly[:,indt[ii+1]] - u0, u1 = D0-Poly[:,indt[ii]-1], D1-Poly[:,indt[ii+1]+1] - p0.append(_get_inter(D0,u0,D1,u1)[:,np.newaxis]) - u0, u1 = Poly[:,indt[ii]+1]-D0, Poly[:,indt[ii+1]-1]-D1 - p1.append(np.vstack((D0,_get_inter(D0,u0,D1,u1),D1)).T) - p0.append(Poly[:,ind0[3:]]) - p1.append(Poly[:,ind0[3:]]) - Poly0 = np.concatenate(tuple(p0),axis=1) - Poly1 = np.concatenate(tuple(p1),axis=1) - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0.T) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1.T) - pathfilext = os.path.join(path, cstr+'_V2.txt') - np.savetxt(pathfilext, Poly.T) - return Poly0, Poly1, Poly, notes - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V0.txt deleted file mode 100644 index 5b981e78d..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V0.txt +++ /dev/null @@ -1,15 +0,0 @@ -1.774999999999999911e+00 5.929919999999999636e-01 -1.884858077486472272e+00 5.911770000000000636e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.873650437331630725e+00 4.441642303822337379e-01 -1.856259555650231263e+00 3.337978467736253951e-01 -1.843826943346401626e+00 2.228133966765704910e-01 -1.836358204793972160e+00 1.113896333018938728e-01 -1.833876759397041756e+00 -2.779374865840749179e-04 -1.836383298232798778e+00 -1.119509098580846185e-01 -1.843875949550754845e+00 -2.233744240736200981e-01 -1.856339514974657767e+00 -3.343851997842514634e-01 -1.873750141219779675e+00 -4.447155115314402885e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.884989804382506628e+00 -5.917240000000000277e-01 -1.774999999999999911e+00 -5.935410000000000963e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V1.txt deleted file mode 100644 index b6a8e6b2a..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V1.txt +++ /dev/null @@ -1,33 +0,0 @@ -1.774999999999999911e+00 5.929919999999999636e-01 -1.884858077486472272e+00 5.911770000000000636e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.875006148741384937e+00 4.508190000000000253e-01 -1.866791171573341401e+00 4.453844133024648655e-01 -1.872587325520495005e+00 4.374190000000000023e-01 -1.857333629936474440e+00 3.406139999999999723e-01 -1.849286448529055216e+00 3.347572222043389556e-01 -1.855496283519048051e+00 3.269810000000000216e-01 -1.844585709478689495e+00 2.295900000000000163e-01 -1.836887454465587544e+00 2.234439862157564793e-01 -1.843372016779304401e+00 2.160279999999999978e-01 -1.836817956587424083e+00 1.182470000000000049e-01 -1.829325787346844479e+00 1.116969181786534593e-01 -1.836205097098088324e+00 1.045050000000000007e-01 -1.834028139211882458e+00 6.529000000000000081e-03 -1.826909683447074828e+00 -2.806498309795785531e-04 -1.834029505237306790e+00 -7.086999999999999550e-03 -1.836228783631549621e+00 -1.050630000000000036e-01 -1.829351210110599979e+00 -1.122565205010035427e-01 -1.836844375171723831e+00 -1.188050000000000078e-01 -1.843419523820880146e+00 -2.165839999999999987e-01 -1.836937656155643861e+00 -2.240010572285803248e-01 -1.844636314596457272e+00 -2.301459999999999895e-01 -1.855570209144887128e+00 -3.275339999999999918e-01 -1.849362673268954538e+00 -3.353125653571015774e-01 -1.857409787613115926e+00 -3.411669999999999980e-01 -1.872685437679804110e+00 -4.379689999999999972e-01 -1.866890611583081006e+00 -4.459352038706899113e-01 -1.875106992951602214e+00 -4.513690000000000202e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.884989804382506628e+00 -5.917240000000000277e-01 -1.774999999999999911e+00 -5.935410000000000963e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V2.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V2.txt deleted file mode 100644 index db9aa9bf7..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperInner_V2.txt +++ /dev/null @@ -1,97 +0,0 @@ -1.774999999999999911e+00 5.929919999999999636e-01 -1.878451868546276993e+00 5.929919999999999636e-01 -1.880810658446245620e+00 5.945529999999999982e-01 -1.881113557102016332e+00 5.944909999999999917e-01 -1.884858077486472272e+00 5.911770000000000636e-01 -1.896076880309709445e+00 5.576219999999999510e-01 -1.896234159764558003e+00 5.550380000000000313e-01 -1.891372692814665690e+00 5.311690000000000023e-01 -1.884786383911450036e+00 4.988330000000000264e-01 -1.878200075008251035e+00 4.664970000000000505e-01 -1.875006148741384937e+00 4.508190000000000253e-01 -1.869109357004292482e+00 4.469180000000000375e-01 -1.851471318961490198e+00 4.505100000000000215e-01 -1.850645610797756024e+00 4.459380000000000011e-01 -1.868426535990644899e+00 4.431370000000000031e-01 -1.872587325520495005e+00 4.374190000000000023e-01 -1.870096308724499945e+00 4.216139999999999888e-01 -1.864960227728462927e+00 3.890170000000000017e-01 -1.859824146732427019e+00 3.564189999999999858e-01 -1.857333629936474440e+00 3.406139999999999723e-01 -1.851616438162342559e+00 3.364530000000000021e-01 -1.833835512969470116e+00 3.392550000000000288e-01 -1.833196600921188857e+00 3.345110000000000583e-01 -1.851084200451184270e+00 3.325059999999999683e-01 -1.855496283519048051e+00 3.269810000000000216e-01 -1.853715872346406890e+00 3.110799999999999677e-01 -1.850041679511572612e+00 2.782860000000000333e-01 -1.846366120651318665e+00 2.454910000000000148e-01 -1.844585709478689495e+00 2.295900000000000163e-01 -1.839059411896200924e+00 2.251779999999999893e-01 -1.821171812366148002e+00 2.271819999999999951e-01 -1.820757409246217984e+00 2.225550000000000028e-01 -1.838717568376666112e+00 2.213509999999999922e-01 -1.843372016779304401e+00 2.160279999999999978e-01 -1.842301711230003747e+00 2.000639999999999918e-01 -1.840094736683413279e+00 1.671380000000000088e-01 -1.837888262136738282e+00 1.342110000000000247e-01 -1.836817956587424083e+00 1.182470000000000049e-01 -1.831494579476008244e+00 1.135929999999999995e-01 -1.813534920345621471e+00 1.147969999999999963e-01 -1.813322071671218616e+00 1.100140000000000007e-01 -1.831317211563851410e+00 1.096150000000000041e-01 -1.836205097098088324e+00 1.045050000000000007e-01 -1.835849361273685698e+00 8.850900000000000434e-02 -1.835116801167707701e+00 5.551700000000000385e-02 -1.834383875036247780e+00 2.252499999999999988e-02 -1.834028139211882458e+00 6.529000000000000081e-03 -1.828918476800155402e+00 1.641000000000000097e-03 -1.810922470882174506e+00 2.040999999999999846e-03 -1.810923836907560203e+00 -2.605000000000000111e-03 -1.828918476800155402e+00 -2.201000000000000265e-03 -1.834029505237306790e+00 -7.086999999999999550e-03 -1.834388339137871915e+00 -2.308299999999999935e-02 -1.835128961421785387e+00 -5.607500000000000678e-02 -1.835869949730917217e+00 -8.906699999999999340e-02 -1.836228783631549621e+00 -1.050630000000000036e-01 -1.831342264122684638e+00 -1.101740000000000080e-01 -1.813346258204703965e+00 -1.105780000000000096e-01 -1.813560838929866081e+00 -1.153600000000000042e-01 -1.831520132034862414e+00 -1.141520000000000035e-01 -1.836844375171723831e+00 -1.188050000000000078e-01 -1.837918278797237459e+00 -1.347689999999999999e-01 -1.840131949496285557e+00 -1.676949999999999830e-01 -1.842346486220765245e+00 -2.006200000000000205e-01 -1.843419523820880146e+00 -2.165839999999999987e-01 -1.838766807469071285e+00 -2.219079999999999941e-01 -1.820807148338615233e+00 -2.231160000000000088e-01 -1.821222417483927103e+00 -2.277440000000000020e-01 -1.839110017013936060e+00 -2.257350000000000190e-01 -1.844636314596457272e+00 -2.301459999999999895e-01 -1.846421689870707761e+00 -2.460459999999999869e-01 -1.850103078858040373e+00 -2.788399999999999768e-01 -1.853784833870694815e+00 -3.116340000000000221e-01 -1.855570209144887128e+00 -3.275339999999999918e-01 -1.851159492102449899e+00 -3.330609999999999959e-01 -1.833271892572402972e+00 -3.350690000000000057e-01 -1.833911670646108272e+00 -3.398129999999999762e-01 -1.851691729813577769e+00 -3.370070000000000010e-01 -1.857409787613115926e+00 -3.411669999999999980e-01 -1.859903902485287031e+00 -3.569710000000000383e-01 -1.865047179633802399e+00 -3.895679999999999699e-01 -1.870191322807642775e+00 -4.221650000000000125e-01 -1.872685437679804110e+00 -4.379689999999999972e-01 -1.868526014175344807e+00 -4.436869999999999981e-01 -1.850745955007871979e+00 -4.464930000000000287e-01 -1.851571663171587945e+00 -4.510649999999999937e-01 -1.869208335188991210e+00 -4.474680000000000324e-01 -1.875106992951602214e+00 -4.513690000000000202e-01 -1.878304017294591288e+00 -4.670460000000000167e-01 -1.884897522350220456e+00 -4.993809999999999638e-01 -1.891491027405892922e+00 -5.317150000000000487e-01 -1.896357824482763688e+00 -5.555829999999999380e-01 -1.896201911053250866e+00 -5.581660000000000510e-01 -1.884989804382506628e+00 -5.917240000000000277e-01 -1.881246150023436092e+00 -5.950389999999999846e-01 -1.878584461467729616e+00 -5.935410000000000963e-01 -1.774999999999999911e+00 -5.935410000000000963e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperOuter_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperOuter_Notes.py deleted file mode 100755 index 1f280c5b2..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_BumperOuter_Notes.py +++ /dev/null @@ -1,217 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - - -def get_notes(): - notes = {'DPhi':{}, 'dPhi':{}} - # Total toiroidal width in equatorial plane - notes['DPhi'] = 346.756 - # Toroidal gap between central tiles in equatorial plane - notes['dPhi'] = 1.500 - # Total vertical height - notes['DZ'] = 1047.517 - # Poloidal gap between central tiles - notes['dl'] = 2.249 - # Radial width - notes['DR'] = 134.678 - - # sampleXZY - notes['sampleXZY'] = [[2159.632, 523.758, 2030.517],#0 - [2149.423, 514.993, 2020.128], - [2148.227, 508.130, 2018.912], - [2154.559, 442.235, 2071.259], # h - [2166.380, 414.998, 2085.893], # h - [2178.412, 385.686, 2095.532], # h - [2206.053, 371.041, 2077.756], # e1 - [2210.863, 369.335, 2082.651], - [2221.072, 378.101, 2093.040], - [2222.233, 374.874, 2094.221], - [2211.288, 368.155, 2083.083],#10 - [2209.454, 361.586, 2081.216], # e2 - [2192.106, 347.606, 2109.467], # h - [2201.248, 317.292, 2118.769], # h - [2210.389, 286.979, 2128.072], # h - [2234.025, 280.107, 2106.220], # e1 - [2230.026, 271.564, 2115.303], # i - [2234.631, 268.948, 2119.988], - [2245.923, 275.667, 2130.785], - [2246.768, 272.245, 2131.645], - [2234.940, 267.696, 2120.303],#20 - [2232.501, 261.541, 2117.821], # i - [2240.819, 252.580, 2113.134], # e2 - [2220.353, 246.610, 2138.212], # h - [2226.542, 214.813, 2144.510], # h - [2232.731, 183.016, 2150.808], # h - [2257.455, 167.114, 2130.063], # e1 - [2261.769, 163.634, 2134.453], - [2273.250, 168.183, 2146.136], - [2273.763, 164.630, 2146.658], - [2261.957, 162.335, 2134.644],#30 - [2258.958, 156.705, 2131.592], # e2 - [2238.784, 141.097, 2156.967], # h - [2241.907, 108.399, 2160.145], # h - [2245.030, 075.701, 2163.323], # h - [2268.232, 059.603, 2141.030], # e1 - [2272.178, 055.324, 2145.045], - [2283.984, 057.619, 2157.059], - [2284.156, 054.000, 2157.234], - [2272.241, 054.000, 2145.109], - [2268.736, 049.000, 2141.543],#40 e2 - [2247.062, 033.000, 2165.391], # h - [2272.659, 011.500, 2137.688], # i - [2247.062, 000.000, 2165.391], # h - [2247.062,-033.000, 2165.391], # h - [2268.736,-049.000, 2141.543], # e1 - [2272.241,-054.000, 2145.109], - [2284.156,-054.000, 2157.234], - [2283.984,-057.619, 2157.059], - [2272.178,-055.324, 2145.045], - [2268.232,-059.603, 2141.030],#50 e2 - [2245.030,-075.701, 2163.323], # h - [2241.907,-108.399, 2160.145], # h - [2238.784,-141.097, 2156.967], # h - [2258.958,-156.705, 2131.592], # e1 - [2261.957,-162.335, 2134.644], - [2273.763,-164.630, 2146.658], - [2273.250,-168.183, 2146.136], - [2261.769,-163.634, 2134.453], - [2257.455,-167.114, 2130.063],#59 e2 - [2232.731,-183.016, 2150.808], # h - [2226.542,-214.813, 2144.510], # h - [2220.353,-246.610, 2138.212], # h - [2240.819,-252.580, 2113.134], # e1 - [2232.501,-261.541, 2117.821], # i - [2234.940,-267.696, 2120.303], - [2246.768,-272.245, 2131.645], - [2245.923,-275.667, 2130.785], - [2234.631,-268.948, 2119.988], - [2230.026,-271.564, 2115.303], # i - [2234.025,-280.107, 2106.220],#70 e2 - [2210.389,-286.979, 2128.072], # h - [2201.248,-317.292, 2118.769], # h - [2192.106,-347.606, 2109.467], # h - [2209.454,-361.586, 2081.216], # e1 - [2211.288,-368.155, 2083.083], - [2222.233,-374.874, 2094.221], - [2221.072,-378.101, 2093.040], - [2210.863,-369.335, 2082.651], - [2206.053,-371.041, 2077.756],#79 e2 - [2178.412,-385.686, 2095.532], # h - [2166.486,-413.961, 2083.395], # h - [2154.559,-442.235, 2071.259], # h - [2148.227,-508.130, 2018.912], - [2149.423,-514.993, 2020.128], - [2159.632,-523.758, 2030.517], - [2152.686,-542.612, 2243.735], # Back - [2452.439,-057.045, 2300.172], - [3550.000,-057.150, 0000.000], - [3550.000, 057.150, 0000.000], - [2452.118, 056.737, 2302.204],#90 - [2151.698, 544.667, 2242.729]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - notes['ind_h'] = [3,4,5,12,13,14,23,24,25,32,33,34,41,43,44,51,52,53, - 60,61,62,71,72,73,80,81,82] - notes['ind_Back'] = [86,87,88,89,90,91] - notes['ind_i'] = [16,21,42,64,69] - notes['ind_e1'] = [6,15,26,35,45,54,63,74] - notes['ind_e2'] = [11,22,31,40,50,59,70,79] - - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk and not 'ind' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - -def _get_intersect(D0,u0,D1,u1): - k = -np.cross(D0-D1,u1)/np.cross(u0,u1) - return D0 + k*u0 - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - # Finish V2 - ind = np.zeros((Poly.shape[1],),dtype=bool) - ind[notes['ind_h']] = True - ind[notes['ind_i']] = True - nind = np.arange(0,Poly.shape[1]) - Polybis = Poly.copy() - for ii in range(0,len(notes['ind_e1'])+1): - i0 = notes['ind_e2'][ii-1] if ii>0 else 2 - i1 = notes['ind_e1'][ii] if iii0) & (nind0 in the direction normal to the divertor's upper surface - notes['sampleXZY'] = [[-440.221, -606.218, 1854.847], - [-440.163, -581.217, 1854.860], - [-440.748, -579.362, 1857.546], - [-506.714, -694.150, 2133.992], - [-506.951, -694.466, 2134.837], - [-510.087, -699.924, 2147.977], - [-510.336, -702.527, 2149.054], - [-508.309, -724.780, 2140.295], - [-508.995, -721.633, 2143.101], - [-510.684, -703.089, 2150.401], - [-511.270, -701.984, 2152.937], - [-514.021, -706.772, 2164.465], - [-514.742, -708.491, 2167.329], - [-565.491, -796.886, 2380.007], - [-565.707, -799.489, 2381.092], - [-563.726, -821.241, 2372.530]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def _get_inter(D0,u0,D1,u1): - k = -np.cross(D0-D1,u1)/np.cross(u0,u1) - return D0 + k*u0 - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - R = np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]) - Z = notes['sampleXZY'][:,1] - - d = np.sqrt(np.diff(R)**2+np.diff(Z)**2) - indup = np.argmax(d) - e1 = np.array([R[indup+1]-R[indup], Z[indup+1]-Z[indup]]) - e1 = e1/np.linalg.norm(e1) - e2 = np.r_[-e1[1], e1[0]] - - P0 = (np.array([R[0],Z[0]])-0.01*e2)[:,np.newaxis] - PEnd = (np.array([R[-1],Z[-1]])-0.01*e2)[:,np.newaxis] - Poly = np.array([R[1:-1],Z[1:-1]]) - Poly = np.concatenate((P0,Poly,PEnd),axis=1) - Poly0 = Poly[:,[0,2,-3,-1]] - - # Making Poly1 - D0 = Poly0[:,1] - u0 = Poly0[:,-2]-D0 - k0 = -np.sum((D0-Poly[:,5])*u0)/np.linalg.norm(u0)**2 - k1 = -np.sum((D0-Poly[:,10])*u0)/np.linalg.norm(u0)**2 - P0 = (D0 + k0*u0)[:,np.newaxis] - P1 = (D0 + k1*u0)[:,np.newaxis] - D0, D1 = Poly[:,5], Poly[:,10] - u0, u1 = Poly[:,6]-D0, Poly[:,9]-D1 - PI = _get_inter(D0,u0,D1,u1)[:,np.newaxis] - Poly1 = np.concatenate((Poly0[:,:2], P0,PI,P1, Poly0[:,2:]),axis=1) - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0.T) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1.T) - pathfilext = os.path.join(path, cstr+'_V2.txt') - np.savetxt(pathfilext, Poly.T) - return Poly0, Poly1, Poly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V0.txt deleted file mode 100644 index a482a5687..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -1.902626435582053910e+00 -6.154902827152386457e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.434837737556048598e+00 -8.305132827152387209e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V1.txt deleted file mode 100644 index 1ddeea137..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V1.txt +++ /dev/null @@ -1,7 +0,0 @@ -1.902626435582053910e+00 -6.154902827152386457e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 -2.207588154363356203e+00 -7.002307512678921375e-01 -2.209232438638541129e+00 -7.035034792486342115e-01 -2.212685554715615233e+00 -7.022950072313642877e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.434837737556048598e+00 -8.305132827152387209e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V2.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V2.txt deleted file mode 100644 index 022d39d3b..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowGC_V2.txt +++ /dev/null @@ -1,16 +0,0 @@ -1.902626435582053910e+00 -6.154902827152386457e-01 -1.906370658127374718e+00 -5.812169999999999837e-01 -1.909119153332237806e+00 -5.793619999999999326e-01 -2.193326454009981941e+00 -6.941500000000000448e-01 -2.194203348135719267e+00 -6.944660000000000277e-01 -2.207712377122074354e+00 -6.999239999999999906e-01 -2.208817766999351395e+00 -7.025270000000000126e-01 -2.199827431074083073e+00 -7.247799999999999798e-01 -2.202716006712168273e+00 -7.216330000000000799e-01 -2.210208725133669283e+00 -7.030890000000000750e-01 -2.212811500979918744e+00 -7.019840000000000524e-01 -2.224663193534248684e+00 -7.067720000000000669e-01 -2.227616286707609916e+00 -7.084909999999999819e-01 -2.446265192314602821e+00 -7.968859999999999832e-01 -2.447370736589166818e+00 -7.994890000000000052e-01 -2.434837737556048598e+00 -8.305132827152387209e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_Notes.py deleted file mode 100755 index 2dfadc6ed..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_Notes.py +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - """ By convention : D is a length of the element, d is a gap """ - - notes = {'DPhi':{}, 'dPhi':{}} - # Toroidal width (mm, inner outer) - notes['DPhi']['In'] = 26.370 - notes['DPhi']['Out'] = 31.929 - - # Inter tiles distance (mm, uniform) - notes['dl'] = 0.500 - - # Poloidal/Radial total length (mm) - notes['DL'] = 437.000 - - # Number of tiles radially - notes['nb'] = 35 - notes['nbPhi'] = 19*2*12 - - # Radial length of a tile (mm, uniform) - notes['Dl'] = 12.000 - - # Vertical height of tiles (mm, uniform) - notes['DZ'] = 26.000 - - # Toroidal space between needles (mm, inner outer) - notes['dPhi']['In'] = 0.588 - notes['dPhi']['Out'] = 0.612 - - # (X,Z,Y) polygon of one needle (mm) !!!!!! (X,Z,Y) - # 1 mm should be added towards Z>0 in the direction normal to the divertor's upper surface - notes['sampleXZY'] = [[-759.457, -625.500, -1797.591], # Old start point - [-759.603, -624.572, -1797.936], # Only for pattern - [-772.277, -620.864, -1794.112], - [-761.681, -610.036, -1769.498], # Computed,tube/plane - [-761.895, -620.231, -1764.921], - [-751.095, -609.687, -1741.154], - [-755.613, -580.944, -1751.852], - [-766.413, -591.488, -1775.620], # Edge of plane - [-763.902, -596.129, -1774.659], # Computed,tube/plane - [-774.498, -606.956, -1799.274], # Middle top of tube - [-763.246, -601.395, -1806.563], - [-767.575, -605.891, -1816.813], - [-763.932, -629.068, -1808.186], - [-764.112, -629.255, -1808.613], - [-767.755, -606.078, -1817.240], - [-772.084, -610.573, -1827.490], - [-768.441, -633.750, -1818.863], - [-768.622, -633.938, -1819.290], - [-772.265, -610.760, -1827.917], - [-776.594, -615.256, -1838.167], - [-772.950, -638.433, -1829.540], - [-773.131, -638.620, -1829.967], - [-776.774, -615.443, -1838.594], - [-781.103, -619.938, -1848.844], - [-777.460, -643.115, -1840.217], - [-777.640, -643.303, -1840.644], - [-781.283, -620.126, -1849.271], - [-785.612, -624.621, -1859.520], - [-781.969, -647.798, -1850.894], - [-782.149, -647.985, -1851.321], - [-785.793, -624.808, -1859.948], - [-790.122, -629.303, -1870.197], - [-786.478, -652.481, -1861.571], - [-786.659, -652.668, -1861.998], - [-790.302, -629.491, -1870.624], - [-794.631, -633.986, -1880.874], - [-790.988, -657.163, -1872.248], - [-791.168, -657.351, -1872.675], - [-794.811, -634.173, -1881.301]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - R = np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]) - Z = notes['sampleXZY'][:,1] - - d = np.sqrt(np.diff(R)**2+np.diff(Z)**2) - indup = (np.abs(d-notes['Dl'])<1.e-6).nonzero()[0] - e1 = np.array([R[indup+1]-R[indup], Z[indup+1]-Z[indup]]) - e1 = np.mean(e1,axis=1) - e1 = e1/np.linalg.norm(e1) - e2 = np.r_[-e1[1], e1[0]] - - nP = 4 - P0 = np.array([R[[0,2,3,4,5,6,7,8,9]],Z[[0,2,3,4,5,6,7,8,9]]]) - PEnd = P0[:,0:1] + e1[:,np.newaxis]*notes['DL'] - El = np.array([R[[1,10,11,12]],Z[[1,10,11,12]]]) - k = np.arange(0,notes['nb']) - l = np.repeat(k*(notes['Dl']+notes['dl']), nP) - Poly = np.tile(El,notes['nb']) + e1[:,np.newaxis]*l[np.newaxis,:] - Poly = np.concatenate((P0,Poly[:,1:],PEnd),axis=1) - Poly0 = Poly[:,[0,1,2,3,4,5,6,7,8,9,-3,-1]] - - # Poly1 - indI0 = np.arange(10,Poly.shape[1]-6,4) - PI = (Poly[:,indI0] + Poly[:,indI0+3])/2. - Poly1 = np.concatenate((Poly0[:,:9],PI,Poly0[:,-3:]),axis=1) - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0.T) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1.T) - pathfilext = os.path.join(path, cstr+'_V2.txt') - np.savetxt(pathfilext, Poly.T) - return Poly0, Poly1, Poly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V0.txt deleted file mode 100644 index dd811babf..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V0.txt +++ /dev/null @@ -1,12 +0,0 @@ -1.951437505566089081e+00 -6.255000000000000560e-01 -1.953266400999362107e+00 -6.208640000000000825e-01 -1.926468561322763895e+00 -6.100359999999999117e-01 -1.922350157298612583e+00 -6.202309999999999768e-01 -1.896249179496460657e+00 -6.096869999999999790e-01 -1.907861744381128100e+00 -5.809440000000000159e-01 -1.933963616764545090e+00 -5.914880000000000138e-01 -1.932087169846381736e+00 -5.961290000000000200e-01 -1.958885928041752988e+00 -6.069560000000000510e-01 -1.961176771605507296e+00 -6.013950000000000129e-01 -2.366357483076916512e+00 -7.650965613562188405e-01 -2.356617780927638517e+00 -7.892007772062769044e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V1.txt deleted file mode 100644 index af4905d32..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V1.txt +++ /dev/null @@ -1,46 +0,0 @@ -1.951437505566089081e+00 -6.255000000000000560e-01 -1.953266400999362107e+00 -6.208640000000000825e-01 -1.926468561322763895e+00 -6.100359999999999117e-01 -1.922350157298612583e+00 -6.202309999999999768e-01 -1.896249179496460657e+00 -6.096869999999999790e-01 -1.907861744381128100e+00 -5.809440000000000159e-01 -1.933963616764545090e+00 -5.914880000000000138e-01 -1.932087169846381736e+00 -5.961290000000000200e-01 -1.958885928041752988e+00 -6.069560000000000510e-01 -1.972535017974347937e+00 -6.059842582552384949e-01 -1.984124842784460885e+00 -6.106667747657155143e-01 -1.995714667594573832e+00 -6.153492912761925338e-01 -2.007304492404687224e+00 -6.200318077866695532e-01 -2.018894317214799727e+00 -6.247143242971465726e-01 -2.030484142024913119e+00 -6.293968408076235921e-01 -2.042073966835025622e+00 -6.340793573181006115e-01 -2.053663791645139014e+00 -6.387618738285777420e-01 -2.065253616455251517e+00 -6.434443903390547614e-01 -2.076843441265364909e+00 -6.481269068495317809e-01 -2.088433266075477412e+00 -6.528094233600088003e-01 -2.100023090885590804e+00 -6.574919398704858198e-01 -2.111612915695703308e+00 -6.621744563809628392e-01 -2.123202740505816699e+00 -6.668569728914398587e-01 -2.134792565315929203e+00 -6.715394894019168781e-01 -2.146382390126042594e+00 -6.762220059123938976e-01 -2.157972214936155098e+00 -6.809045224228709170e-01 -2.169562039746268489e+00 -6.855870389333479364e-01 -2.181151864556380993e+00 -6.902695554438249559e-01 -2.192741689366494384e+00 -6.949520719543019753e-01 -2.204331514176606888e+00 -6.996345884647789948e-01 -2.215921338986720279e+00 -7.043171049752561252e-01 -2.227511163796833227e+00 -7.089996214857331447e-01 -2.239100988606946174e+00 -7.136821379962101641e-01 -2.250690813417059566e+00 -7.183646545066871836e-01 -2.262280638227172069e+00 -7.230471710171642030e-01 -2.273870463037285461e+00 -7.277296875276412225e-01 -2.285460287847397964e+00 -7.324122040381182419e-01 -2.297050112657511356e+00 -7.370947205485952614e-01 -2.308639937467623859e+00 -7.417772370590722808e-01 -2.320229762277737251e+00 -7.464597535695493002e-01 -2.331819587087849754e+00 -7.511422700800263197e-01 -2.343409411897963146e+00 -7.558247865905033391e-01 -2.354999236708075649e+00 -7.605073031009804696e-01 -1.961176771605507296e+00 -6.013950000000000129e-01 -2.366357483076916512e+00 -7.650965613562188405e-01 -2.356617780927638517e+00 -7.892007772062769044e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V2.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V2.txt deleted file mode 100644 index 41a622385..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivLowITER_V2.txt +++ /dev/null @@ -1,149 +0,0 @@ -1.951437505566089081e+00 -6.255000000000000560e-01 -1.953266400999362107e+00 -6.208640000000000825e-01 -1.926468561322763895e+00 -6.100359999999999117e-01 -1.922350157298612583e+00 -6.202309999999999768e-01 -1.896249179496460657e+00 -6.096869999999999790e-01 -1.907861744381128100e+00 -5.809440000000000159e-01 -1.933963616764545090e+00 -5.914880000000000138e-01 -1.932087169846381736e+00 -5.961290000000000200e-01 -1.958885928041752988e+00 -6.069560000000000510e-01 -1.961176771605507296e+00 -6.013950000000000129e-01 -1.972303439533075631e+00 -6.058909999999999574e-01 -1.962938794567981260e+00 -6.290679999999999605e-01 -1.963401951451660299e+00 -6.292545165104770355e-01 -1.972766596415620244e+00 -6.060775165104770323e-01 -1.983893264343188578e+00 -6.105735165104769768e-01 -1.974528619378094207e+00 -6.337505165104769800e-01 -1.974991776261773246e+00 -6.339370330209540549e-01 -1.984356421225733191e+00 -6.107600330209540518e-01 -1.995483089153301526e+00 -6.152560330209539963e-01 -1.986118444188207155e+00 -6.384330330209539994e-01 -1.986581601071886194e+00 -6.386195495314310744e-01 -1.995946246035846139e+00 -6.154425495314310712e-01 -2.007072913963414695e+00 -6.199385495314310157e-01 -1.997708268998320102e+00 -6.431155495314310189e-01 -1.998171425881999141e+00 -6.433020660419080938e-01 -2.007536070845959308e+00 -6.201250660419080907e-01 -2.018662738773527643e+00 -6.246210660419080352e-01 -2.009298093808433272e+00 -6.477980660419080383e-01 -2.009761250692112089e+00 -6.479845825523851133e-01 -2.019125895656072256e+00 -6.248075825523851101e-01 -2.030252563583640590e+00 -6.293035825523850546e-01 -2.020887918618546220e+00 -6.524805825523850578e-01 -2.021351075502225036e+00 -6.526670990628621327e-01 -2.030715720466185203e+00 -6.294900990628621296e-01 -2.041842388393753538e+00 -6.339860990628620740e-01 -2.032477743428659167e+00 -6.571630990628620772e-01 -2.032940900312337984e+00 -6.573496155733391522e-01 -2.042305545276298151e+00 -6.341726155733391490e-01 -2.053432213203866485e+00 -6.386686155733392045e-01 -2.044067568238772115e+00 -6.618456155733392077e-01 -2.044530725122450932e+00 -6.620321320838162826e-01 -2.053895370086411098e+00 -6.388551320838162795e-01 -2.065022038013979433e+00 -6.433511320838162240e-01 -2.055657393048885062e+00 -6.665281320838162271e-01 -2.056120549932563879e+00 -6.667146485942933021e-01 -2.065485194896524046e+00 -6.435376485942932989e-01 -2.076611862824092380e+00 -6.480336485942932434e-01 -2.067247217858998010e+00 -6.712106485942932466e-01 -2.067710374742676827e+00 -6.713971651047703215e-01 -2.077075019706636994e+00 -6.482201651047703184e-01 -2.088201687634205328e+00 -6.527161651047702629e-01 -2.078837042669110957e+00 -6.758931651047702660e-01 -2.079300199552790218e+00 -6.760796816152473410e-01 -2.088664844516749941e+00 -6.529026816152473378e-01 -2.099791512444318275e+00 -6.573986816152472823e-01 -2.090426867479223905e+00 -6.805756816152472854e-01 -2.090890024362903166e+00 -6.807621981257243604e-01 -2.100254669326862889e+00 -6.575851981257243573e-01 -2.111381337254431223e+00 -6.620811981257243017e-01 -2.102016692289336852e+00 -6.852581981257243049e-01 -2.102479849173016113e+00 -6.854447146362013799e-01 -2.111844494136975836e+00 -6.622677146362013767e-01 -2.122971162064544171e+00 -6.667637146362013212e-01 -2.113606517099449800e+00 -6.899407146362013243e-01 -2.114069673983129061e+00 -6.901272311466783993e-01 -2.123434318947088784e+00 -6.669502311466783961e-01 -2.134560986874657118e+00 -6.714462311466783406e-01 -2.125196341909562747e+00 -6.946232311466783438e-01 -2.125659498793242008e+00 -6.948097476571554187e-01 -2.135024143757201731e+00 -6.716327476571554156e-01 -2.146150811684770066e+00 -6.761287476571553601e-01 -2.136786166719675695e+00 -6.993057476571553632e-01 -2.137249323603354956e+00 -6.994922641676324382e-01 -2.146613968567314679e+00 -6.763152641676324350e-01 -2.157740636494883013e+00 -6.808112641676323795e-01 -2.148375991529788642e+00 -7.039882641676323827e-01 -2.148839148413467903e+00 -7.041747806781094576e-01 -2.158203793377427626e+00 -6.809977806781094545e-01 -2.169330461304995961e+00 -6.854937806781093990e-01 -2.159965816339901590e+00 -7.086707806781094021e-01 -2.160428973223580851e+00 -7.088572971885864771e-01 -2.169793618187540574e+00 -6.856802971885864739e-01 -2.180920286115108908e+00 -6.901762971885864184e-01 -2.171555641150014537e+00 -7.133532971885864216e-01 -2.172018798033693798e+00 -7.135398136990634965e-01 -2.181383442997653521e+00 -6.903628136990634934e-01 -2.192510110925221856e+00 -6.948588136990634379e-01 -2.183145465960127485e+00 -7.180358136990634410e-01 -2.183608622843806746e+00 -7.182223302095405160e-01 -2.192973267807766469e+00 -6.950453302095405128e-01 -2.204099935735334803e+00 -6.995413302095404573e-01 -2.194735290770240432e+00 -7.227183302095404605e-01 -2.195198447653919693e+00 -7.229048467200176464e-01 -2.204563092617879416e+00 -6.997278467200176433e-01 -2.215689760545447751e+00 -7.042238467200174767e-01 -2.206325115580353380e+00 -7.274008467200174799e-01 -2.206788272464032641e+00 -7.275873632304946659e-01 -2.216152917427992364e+00 -7.044103632304946627e-01 -2.227279585355560698e+00 -7.089063632304946072e-01 -2.217914940390466327e+00 -7.320833632304946104e-01 -2.218378097274145588e+00 -7.322698797409716853e-01 -2.227742742238105755e+00 -7.090928797409716822e-01 -2.238869410165674090e+00 -7.135888797409716267e-01 -2.229504765200579719e+00 -7.367658797409716298e-01 -2.229967922084258536e+00 -7.369523962514487048e-01 -2.239332567048218703e+00 -7.137753962514487016e-01 -2.250459234975787037e+00 -7.182713962514486461e-01 -2.241094590010692666e+00 -7.414483962514486493e-01 -2.241557746894371483e+00 -7.416349127619257242e-01 -2.250922391858331650e+00 -7.184579127619257211e-01 -2.262049059785899985e+00 -7.229539127619256655e-01 -2.252684414820805614e+00 -7.461309127619256687e-01 -2.253147571704484431e+00 -7.463174292724027437e-01 -2.262512216668444598e+00 -7.231404292724027405e-01 -2.273638884596012932e+00 -7.276364292724026850e-01 -2.264274239630918562e+00 -7.508134292724026881e-01 -2.264737396514597378e+00 -7.509999457828797631e-01 -2.274102041478557545e+00 -7.278229457828797599e-01 -2.285228709406125880e+00 -7.323189457828797044e-01 -2.275864064441031509e+00 -7.554959457828797076e-01 -2.276327221324710326e+00 -7.556824622933567825e-01 -2.285691866288670493e+00 -7.325054622933567794e-01 -2.296818534216238827e+00 -7.370014622933567239e-01 -2.287453889251144457e+00 -7.601784622933567270e-01 -2.287917046134823273e+00 -7.603649788038338020e-01 -2.297281691098783440e+00 -7.371879788038337988e-01 -2.308408359026351775e+00 -7.416839788038337433e-01 -2.299043714061257404e+00 -7.648609788038337465e-01 -2.299506870944936221e+00 -7.650474953143108214e-01 -2.308871515908896388e+00 -7.418704953143108183e-01 -2.319998183836464722e+00 -7.463664953143107628e-01 -2.310633538871370352e+00 -7.695434953143107659e-01 -2.311096695755049168e+00 -7.697300118247878409e-01 -2.320461340719009335e+00 -7.465530118247878377e-01 -2.331588008646577670e+00 -7.510490118247877822e-01 -2.322223363681483299e+00 -7.742260118247877854e-01 -2.322686520565162560e+00 -7.744125283352648603e-01 -2.332051165529122283e+00 -7.512355283352648572e-01 -2.343177833456690617e+00 -7.557315283352648017e-01 -2.333813188491596247e+00 -7.789085283352648048e-01 -2.334276345375275064e+00 -7.790950448457418798e-01 -2.343640990339235231e+00 -7.559180448457418766e-01 -2.354767658266803565e+00 -7.604140448457419321e-01 -2.345403013301709194e+00 -7.835910448457419353e-01 -2.345866170185388455e+00 -7.837775613562190102e-01 -2.355230815149348178e+00 -7.606005613562190071e-01 -2.366357483076916512e+00 -7.650965613562188405e-01 -2.356992838111822142e+00 -7.882735613562188437e-01 -2.356617780927638517e+00 -7.892007772062769044e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_Notes.py deleted file mode 100755 index 3edd5fdc6..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_Notes.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - notes = {'DPhi':{}, 'dPhi':{}} - # Total length - notes['DL'] = 449.000 - - # Toroidal width - notes['DPhi']['In'] = 26.151 - notes['DPhi']['Out'] = 31.887 - - # Toroidal gap - notes['dPhi']['In'] = 0.681 - notes['dPhi']['Out'] = 0.680 - - # Height - notes['DZ'] = 41.562 - - # Number in toroidal direction - notes['nbPhi'] = 12*38 - - # sample (X,Z,Y) - notes['sampleXZY'] = [[-1917.967, 640.060, -293.245], - [-1932.817, 601.230, -299.739], - [-2167.242, 697.010, -335.545], - [-2168.645, 697.479, -335.689], - [-2198.613, 709.727, -340.266], - [-2201.495, 711.408, -340.635], - [-2344.246, 769.769, -362.438], - [-2329.510, 808.258, -356.103]] - notes['sampleXZY'] = np.asarray(notes['sampleXZY'],dtype=float) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - Poly0 = Poly[:,[0,1,-2,-1]] - PM = np.mean(Poly[:,[2,5]],axis=1)[:,np.newaxis] - Poly1 = np.concatenate((Poly0[:,:2], PM,Poly0[:,2:]),axis=1) - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0.T) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1.T) - pathfilext = os.path.join(path, cstr+'_V2.txt') - np.savetxt(pathfilext, Poly.T) - return Poly0, Poly1, Poly, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V0.txt deleted file mode 100644 index 0a96f6a9e..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V0.txt +++ /dev/null @@ -1,4 +0,0 @@ -1.940255148972423349e+00 6.400599999999999623e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -2.356570853318228131e+00 8.082580000000000320e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V1.txt deleted file mode 100644 index f38bb672b..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V1.txt +++ /dev/null @@ -1,5 +0,0 @@ -1.940255148972423349e+00 6.400599999999999623e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -2.210377932124336198e+00 7.042090000000000849e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -2.356570853318228131e+00 8.082580000000000320e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V2.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V2.txt deleted file mode 100644 index 69ead57d2..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_DivUp_V2.txt +++ /dev/null @@ -1,8 +0,0 @@ -1.940255148972423349e+00 6.400599999999999623e-01 -1.955920505442386270e+00 6.012300000000000422e-01 -2.193063686624034503e+00 6.970100000000000184e-01 -2.194472200950834839e+00 6.974790000000000711e-01 -2.224787647063197760e+00 7.097269999999999968e-01 -2.227692177624637448e+00 7.114080000000000403e-01 -2.372098356384068740e+00 7.697690000000000365e-01 -2.356570853318228131e+00 8.082580000000000320e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_Notes.py deleted file mode 100755 index 8ee5a36bf..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_Notes.py +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - notes = {} - # Samples from 3D drawings - # IC1 - notes['sampXYZ'] = [[-2471.450, -494.911, 1590.106], # Back - [-2469.748, -335.000, 1749.276], # Back - [-2515.174, -335.000, 1787.393], # Back - [-2515.174, 335.000, 1787.393], # Back - [-2469.748, 335.000, 1749.276], # Back - [-2471.450, 494.911, 1590.106], # Back - [-2292.115, 504.105, 1578.294], # 1st pt - [-2286.026, 504.799, 1544.321], - [-2287.754, 465.078, 1545.771], - [-2293.653, 468.768, 1579.584], # bottom - [-2293.811, 467.342, 1579.717], # bottom - [-2287.937, 463.423, 1545.925], - [-2294.923, 424.698, 1551.787], - [-2300.025, 432.890, 1584.931], # bottom - [-2300.371, 431.522, 1585.221], # bottom - [-2295.324, 423.110, 1552.123], - [-2307.354, 386.556, 1562.218], - [-2311.074, 399.002, 1594.202], # bottom - [-2310.685, 397.685, 1595.181], # bottom - [-2307.977, 385.107, 1562.740], - [-2319.952, 356.614, 1572.789], - [-2322.660, 369.192, 1605.229], # bottom - [-2323.367, 367.162, 1605.909], # bottom - [-2320.358, 355.596, 1573.129], - [-2331.369, 326.447, 1582.369], - [-2334.481, 338.013, 1615.148], # bottom - [-2335.222, 335.939, 1615.770], # bottom - [-2331.741, 325.407, 1582.681], - [-2341.768, 295.659, 1591.094], - [-2345.249, 306.191, 1624.184], # bottom - [-2345.920, 304.077, 1624.747], # bottom - [-2342.104, 294.599, 1591.377], - [-2351.128, 264.308, 1598.948], - [-2354.943, 273.786, 1632.318], # bottom - [-2355.543, 271.635, 1632.821], # bottom - [-2351.429, 263.230, 1599.201], - [-2359.431, 232.454, 1605.916], - [-2363.545, 240.860, 1639.536], # bottom - [-2364.073, 238.677, 1639.979], # bottom - [-2359.696, 231.360, 1606.138], - [-2366.663, 200.158, 1611.984], - [-2371.039, 207.476, 1645.825], # bottom - [-2371.493, 205.265, 1646.205], # bottom - [-2366.890, 199.049, 1612.174], - [-2372.808, 167.481, 1617.140], - [-2377.411, 173.696, 1651.171], # bottom - [-2377.790, 171.461, 1651.489], # bottom - [-2372.998, 166.360, 1617.300], - [-2377.855, 134.484, 1621.375], - [-2382.647, 139.586, 1655.565], # bottom - [-2382.952, 137.332, 1655.820], # bottom - [-2378.008, 133.354, 1621.503], - [-2381.795, 101.232, 1624.681], - [-2386.739, 105.210, 1658.998], - [-2386.968, 102.941, 1659.190], # bottom - [-2381.910, 100.094, 1624.778], # bottom - [-2384.620, 67.787, 1627.052], - [-2389.678, 70.634, 1661.465], # bottom - [-2389.831, 68.354, 1661.593], # bottom - [-2384.697, 66.644, 1627.116], - [-2386.325, 34.213, 1628.482], - [-2391.459, 35.923, 1662.959], # bottom - [-2391.536, 33.637, 1663.023], # bottom - [-2386.364, 33.066, 1628.515], - [-2386.907, 0.574, 1628.970], - [-2392.079, 1.144, 1663.479], # bottom - [-2392.079, -1.144, 1663.479], # bottom - [-2386.907, -0.574, 1628.970], - [-2386.364, -33.066, 1628.515], - [-2391.536, -33.637, 1663.023], # bottom - [-2391.459, -35.923, 1662.959], # bottom - [-2386.325, -34.213, 1628.482], - [-2384.697, -66.644, 1627.116], - [-2389.831, -68.354, 1661.593], # bottom - [-2389.678, -70.634, 1661.465], # bottom - [-2384.620, -67.787, 1627.052], - [-2381.910, -100.094, 1624.778], - [-2386.968, -102.941, 1659.190], # bottom - [-2386.739, -105.210, 1658.998], # bottom - [-2381.795, -101.232, 1624.681], - [-2378.008, -133.354, 1621.503], - [-2382.952, -137.332, 1655.820], # bottom - [-2382.647, -139.586, 1655.565], # bottom - [-2377.855, -134.484, 1621.375], - [-2372.998, -166.360, 1617.300], - [-2377.790, -171.461, 1651.489], # bottom - [-2377.411, -173.696, 1651.171], # bottom - [-2372.808, -167.481, 1617.140], - [-2366.890, -199.049, 1612.174], - [-2371.493, -205.265, 1646.205], # bottom - [-2371.039, -207.476, 1645.825], # bottom - [-2366.663, -200.158, 1611.984], - [-2359.696, -231.360, 1606.138], - [-2364.073, -238.677, 1639.979], # bottom - [-2363.545, -240.860, 1639.536], # bottom - [-2359.431, -232.454, 1605.916], - [-2351.429, -263.230, 1599.201], - [-2355.543, -271.635, 1632.821], # bottom - [-2354.943, -273.786, 1632.318], # bottom - [-2351.128, -264.308, 1598.948], - [-2342.104, -294.599, 1591.377], - [-2345.920, -304.077, 1624.747], # bottom - [-2345.249, -306.191, 1624.184], # bottom - [-2341.768, -295.659, 1591.094], - [-2331.741, -325.407, 1582.681], - [-2335.222, -335.939, 1615.770], # bottom - [-2334.481, -338.013, 1615.148], # bottom - [-2331.369, -326.447, 1582.369], - [-2320.358, -355.596, 1573.129], - [-2323.469, -367.162, 1605.909], # bottom - [-2322.660, -369.192, 1605.229], # bottom - [-2319.952, -356.614, 1572.789], - [-2307.977, -385.107, 1562.740], - [-2310.685, -397.685, 1595.181], # bottom - [-2311.074, -399.002, 1594.202], # bottom - [-2307.354, -386.556, 1562.218], - [-2295.324, -423.110, 1552.123], - [-2300.371, -431.522, 1585.211], # bottom - [-2300.025, -432.890, 1584.931], # bottom - [-2294.923, -424.698, 1551.787], - [-2287.937, -463.423, 1545.925], - [-2293.811, -467.342, 1579.717], # bottom - [-2293.653, -468.768, 1579.584], # bottom - [-2287.754, -465.078, 1545.771], - [-2286.026, -504.799, 1544.321], - [-2292.115, -504.105, 1578.294]] # Last pt - - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - Rref, Rmax = 3., 3.4 - - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1) - return Poly0, Poly1, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_V0.txt deleted file mode 100644 index 39a81d54b..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_V0.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.049005749077952299e+00 3.136699800685844863e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.136699800685844863e+00 3.049005749077952299e+00 2.893161745241203509e+00 2.868988600429927427e+00 2.871351109810510671e+00 2.880800806826291804e+00 2.897086029556440678e+00 2.913304122262888374e+00 2.928108437504038264e+00 2.941589917755801586e+00 2.953723233749382615e+00 2.964484053313650946e+00 2.973852348038931837e+00 2.981810080005999453e+00 2.988341430914152053e+00 2.993434791052786537e+00 2.997079661606716794e+00 2.999269602916132094e+00 3.000000000000000000e+00 2.999269602916132094e+00 2.997079661606716794e+00 2.993434791052786537e+00 2.988341430914152053e+00 2.981810080005999453e+00 2.973852348038931837e+00 2.964484053313650946e+00 2.953723233749382615e+00 2.941589917755801586e+00 2.928108437504038264e+00 2.913304122262888374e+00 2.897086029556440678e+00 2.880800806826291804e+00 2.871351109810510671e+00 2.868988600429927427e+00 2.893161745241203509e+00 --4.949109999999999898e-01 -3.350000000000000200e-01 -3.350000000000000200e-01 3.350000000000000200e-01 3.350000000000000200e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.642505000000000104e-01 4.239039999999999475e-01 3.858314999999999939e-01 3.561050000000000049e-01 3.259269999999999667e-01 2.951289999999999747e-01 2.637690000000000312e-01 2.319070000000000020e-01 1.996034999999999893e-01 1.669204999999999994e-01 1.339190000000000103e-01 1.006630000000000025e-01 6.721550000000001135e-02 3.363950000000000273e-02 0.000000000000000000e+00 -3.363950000000000273e-02 -6.721550000000001135e-02 -1.006630000000000025e-01 -1.339190000000000103e-01 -1.669204999999999994e-01 -1.996034999999999893e-01 -2.319070000000000020e-01 -2.637690000000000312e-01 -2.951289999999999747e-01 -3.259269999999999667e-01 -3.561050000000000049e-01 -3.858314999999999939e-01 -4.239039999999999475e-01 -4.642505000000000104e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_V1.txt deleted file mode 100644 index 412655bbe..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC1_V1.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.049005749077952299e+00 3.136699800685844863e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.136699800685844863e+00 3.049005749077952299e+00 2.893161745241203509e+00 2.868988600429927427e+00 2.871232184874885185e+00 2.895160089779413415e+00 2.895365652775027776e+00 2.871470034746136601e+00 2.880540609070497915e+00 2.903440859048059597e+00 2.903890317399827392e+00 2.881061004582085250e+00 2.896681761097305241e+00 2.917799801957522199e+00 2.918035678212157702e+00 2.897490298015576116e+00 2.913040700743232847e+00 2.933599304008877695e+00 2.934567534544293643e+00 2.913567543782543900e+00 2.927866929907000149e+00 2.948963642126518181e+00 2.949926909762506266e+00 2.928349945101076379e+00 2.941371435684154267e+00 2.962960298264976533e+00 2.963832468411404797e+00 2.941808399827448461e+00 2.953527647901719178e+00 2.975561006607239989e+00 2.976340676090472481e+00 2.953918819597046053e+00 2.964312061526618081e+00 2.986742832507685907e+00 2.987429169303660093e+00 2.964656045100683812e+00 2.973705061107083214e+00 2.996485074357254863e+00 2.997074716166638897e+00 2.973999634970780903e+00 2.981686523884328643e+00 3.004768121776298262e+00 3.005260809651117526e+00 2.981933636127670706e+00 2.988242170622883442e+00 3.011575234559607850e+00 3.011971213063827868e+00 2.988440691205420663e+00 2.993359959519476199e+00 3.016894619915909459e+00 3.017192241518522611e+00 2.993509622586097318e+00 2.997029823473389865e+00 3.020715965495475608e+00 3.020914655701153251e+00 2.997129499740043723e+00 2.999244195333032881e+00 3.023031121185379533e+00 3.023130877419521578e+00 2.999295010499231307e+00 3.000000000000000000e+00 3.023837023205159902e+00 3.023837023205159902e+00 3.000000000000000000e+00 2.999295010499231307e+00 3.023130877419521578e+00 3.023031121185379533e+00 2.999244195333032881e+00 2.997129499740043723e+00 3.020914655701153251e+00 3.020715965495475608e+00 2.997029823473389865e+00 2.993509622586097318e+00 3.017192241518522611e+00 3.016894619915909459e+00 2.993359959519476199e+00 2.988440691205420663e+00 3.011971213063827868e+00 3.011575234559607850e+00 2.988242170622883442e+00 2.981933636127670706e+00 3.005260809651117526e+00 3.004768121776298262e+00 2.981686523884328643e+00 2.973999634970780903e+00 2.997074716166638897e+00 2.996485074357254863e+00 2.973705061107083214e+00 2.964656045100683812e+00 2.987429169303660093e+00 2.986742832507685907e+00 2.964312061526618081e+00 2.953918819597046053e+00 2.976340676090472481e+00 2.975561006607239989e+00 2.953527647901719178e+00 2.941808399827448461e+00 2.963832468411404797e+00 2.962960298264976533e+00 2.941371435684154267e+00 2.928349945101076379e+00 2.949926909762506266e+00 2.948963642126518181e+00 2.927866929907000149e+00 2.913567543782543900e+00 2.934651442255531428e+00 2.933599304008877695e+00 2.913040700743232847e+00 2.897490298015576116e+00 2.918035678212157702e+00 2.917799801957522199e+00 2.896681761097305241e+00 2.881061004582085250e+00 2.903884643094994722e+00 2.903440859048059597e+00 2.880540609070497915e+00 2.871470034746136601e+00 2.895365652775027776e+00 2.895160089779413415e+00 2.871232184874885185e+00 2.868988600429927427e+00 2.893161745241203509e+00 --4.949109999999999898e-01 -3.350000000000000200e-01 -3.350000000000000200e-01 3.350000000000000200e-01 3.350000000000000200e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.650779999999999914e-01 4.687679999999999625e-01 4.673419999999999797e-01 4.634230000000000294e-01 4.246979999999999644e-01 4.328899999999999970e-01 4.315220000000000167e-01 4.231099999999999861e-01 3.865560000000000107e-01 3.990020000000000233e-01 3.976850000000000107e-01 3.851070000000000326e-01 3.566139999999999866e-01 3.691920000000000202e-01 3.671619999999999884e-01 3.555960000000000232e-01 3.264469999999999872e-01 3.380129999999999524e-01 3.359390000000000431e-01 3.254070000000000018e-01 2.956590000000000051e-01 3.061909999999999910e-01 3.040769999999999862e-01 2.945989999999999998e-01 2.643079999999999874e-01 2.737859999999999738e-01 2.716350000000000153e-01 2.632300000000000195e-01 2.324539999999999940e-01 2.408600000000000185e-01 2.386770000000000003e-01 2.313600000000000101e-01 2.001579999999999748e-01 2.074759999999999938e-01 2.052649999999999753e-01 1.990490000000000037e-01 1.674809999999999910e-01 1.736959999999999893e-01 1.714610000000000023e-01 1.663600000000000079e-01 1.344840000000000202e-01 1.395860000000000156e-01 1.373319999999999819e-01 1.333540000000000003e-01 1.012320000000000025e-01 1.052099999999999980e-01 1.029410000000000047e-01 1.000939999999999885e-01 6.778700000000000003e-02 7.063400000000000234e-02 6.835399999999999809e-02 6.664400000000000879e-02 3.421300000000000036e-02 3.592300000000000354e-02 3.363700000000000023e-02 3.306600000000000511e-02 5.739999999999999660e-04 1.143999999999999835e-03 -1.143999999999999835e-03 -5.739999999999999660e-04 -3.306600000000000511e-02 -3.363700000000000023e-02 -3.592300000000000354e-02 -3.421300000000000036e-02 -6.664400000000000879e-02 -6.835399999999999809e-02 -7.063400000000000234e-02 -6.778700000000000003e-02 -1.000939999999999885e-01 -1.029410000000000047e-01 -1.052099999999999980e-01 -1.012320000000000025e-01 -1.333540000000000003e-01 -1.373319999999999819e-01 -1.395860000000000156e-01 -1.344840000000000202e-01 -1.663600000000000079e-01 -1.714610000000000023e-01 -1.736959999999999893e-01 -1.674809999999999910e-01 -1.990490000000000037e-01 -2.052649999999999753e-01 -2.074759999999999938e-01 -2.001579999999999748e-01 -2.313600000000000101e-01 -2.386770000000000003e-01 -2.408600000000000185e-01 -2.324539999999999940e-01 -2.632300000000000195e-01 -2.716350000000000153e-01 -2.737859999999999738e-01 -2.643079999999999874e-01 -2.945989999999999998e-01 -3.040769999999999862e-01 -3.061909999999999910e-01 -2.956590000000000051e-01 -3.254070000000000018e-01 -3.359390000000000431e-01 -3.380129999999999524e-01 -3.264469999999999872e-01 -3.555960000000000232e-01 -3.671619999999999884e-01 -3.691920000000000202e-01 -3.566139999999999866e-01 -3.851070000000000326e-01 -3.976850000000000107e-01 -3.990020000000000233e-01 -3.865560000000000107e-01 -4.231099999999999861e-01 -4.315220000000000167e-01 -4.328899999999999970e-01 -4.246979999999999644e-01 -4.634230000000000294e-01 -4.673419999999999797e-01 -4.687679999999999625e-01 -4.650779999999999914e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_Notes.py deleted file mode 100755 index 53d49002a..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_Notes.py +++ /dev/null @@ -1,192 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes(): - notes = {} - # Samples from 3D drawings - # Assumed identical to IC1 - notes['sampXYZ'] = [[-2471.450, -494.911, 1590.106], # Back - [-2469.748, -335.000, 1749.276], # Back - [-2515.174, -335.000, 1787.393], # Back - [-2515.174, 335.000, 1787.393], # Back - [-2469.748, 335.000, 1749.276], # Back - [-2471.450, 494.911, 1590.106], # Back - [-2292.115, 504.105, 1578.294], # 1st pt - [-2286.026, 504.799, 1544.321], - [-2287.754, 465.078, 1545.771], - [-2293.653, 468.768, 1579.584], # bottom - [-2293.811, 467.342, 1579.717], # bottom - [-2287.937, 463.423, 1545.925], - [-2294.923, 424.698, 1551.787], - [-2300.025, 432.890, 1584.931], # bottom - [-2300.371, 431.522, 1585.221], # bottom - [-2295.324, 423.110, 1552.123], - [-2307.354, 386.556, 1562.218], - [-2311.074, 399.002, 1594.202], # bottom - [-2310.685, 397.685, 1595.181], # bottom - [-2307.977, 385.107, 1562.740], - [-2319.952, 356.614, 1572.789], - [-2322.660, 369.192, 1605.229], # bottom - [-2323.367, 367.162, 1605.909], # bottom - [-2320.358, 355.596, 1573.129], - [-2331.369, 326.447, 1582.369], - [-2334.481, 338.013, 1615.148], # bottom - [-2335.222, 335.939, 1615.770], # bottom - [-2331.741, 325.407, 1582.681], - [-2341.768, 295.659, 1591.094], - [-2345.249, 306.191, 1624.184], # bottom - [-2345.920, 304.077, 1624.747], # bottom - [-2342.104, 294.599, 1591.377], - [-2351.128, 264.308, 1598.948], - [-2354.943, 273.786, 1632.318], # bottom - [-2355.543, 271.635, 1632.821], # bottom - [-2351.429, 263.230, 1599.201], - [-2359.431, 232.454, 1605.916], - [-2363.545, 240.860, 1639.536], # bottom - [-2364.073, 238.677, 1639.979], # bottom - [-2359.696, 231.360, 1606.138], - [-2366.663, 200.158, 1611.984], - [-2371.039, 207.476, 1645.825], # bottom - [-2371.493, 205.265, 1646.205], # bottom - [-2366.890, 199.049, 1612.174], - [-2372.808, 167.481, 1617.140], - [-2377.411, 173.696, 1651.171], # bottom - [-2377.790, 171.461, 1651.489], # bottom - [-2372.998, 166.360, 1617.300], - [-2377.855, 134.484, 1621.375], - [-2382.647, 139.586, 1655.565], # bottom - [-2382.952, 137.332, 1655.820], # bottom - [-2378.008, 133.354, 1621.503], - [-2381.795, 101.232, 1624.681], - [-2386.739, 105.210, 1658.998], - [-2386.968, 102.941, 1659.190], # bottom - [-2381.910, 100.094, 1624.778], # bottom - [-2384.620, 67.787, 1627.052], - [-2389.678, 70.634, 1661.465], # bottom - [-2389.831, 68.354, 1661.593], # bottom - [-2384.697, 66.644, 1627.116], - [-2386.325, 34.213, 1628.482], - [-2391.459, 35.923, 1662.959], # bottom - [-2391.536, 33.637, 1663.023], # bottom - [-2386.364, 33.066, 1628.515], - [-2386.907, 0.574, 1628.970], - [-2392.079, 1.144, 1663.479], # bottom - [-2392.079, -1.144, 1663.479], # bottom - [-2386.907, -0.574, 1628.970], - [-2386.364, -33.066, 1628.515], - [-2391.536, -33.637, 1663.023], # bottom - [-2391.459, -35.923, 1662.959], # bottom - [-2386.325, -34.213, 1628.482], - [-2384.697, -66.644, 1627.116], - [-2389.831, -68.354, 1661.593], # bottom - [-2389.678, -70.634, 1661.465], # bottom - [-2384.620, -67.787, 1627.052], - [-2381.910, -100.094, 1624.778], - [-2386.968, -102.941, 1659.190], # bottom - [-2386.739, -105.210, 1658.998], # bottom - [-2381.795, -101.232, 1624.681], - [-2378.008, -133.354, 1621.503], - [-2382.952, -137.332, 1655.820], # bottom - [-2382.647, -139.586, 1655.565], # bottom - [-2377.855, -134.484, 1621.375], - [-2372.998, -166.360, 1617.300], - [-2377.790, -171.461, 1651.489], # bottom - [-2377.411, -173.696, 1651.171], # bottom - [-2372.808, -167.481, 1617.140], - [-2366.890, -199.049, 1612.174], - [-2371.493, -205.265, 1646.205], # bottom - [-2371.039, -207.476, 1645.825], # bottom - [-2366.663, -200.158, 1611.984], - [-2359.696, -231.360, 1606.138], - [-2364.073, -238.677, 1639.979], # bottom - [-2363.545, -240.860, 1639.536], # bottom - [-2359.431, -232.454, 1605.916], - [-2351.429, -263.230, 1599.201], - [-2355.543, -271.635, 1632.821], # bottom - [-2354.943, -273.786, 1632.318], # bottom - [-2351.128, -264.308, 1598.948], - [-2342.104, -294.599, 1591.377], - [-2345.920, -304.077, 1624.747], # bottom - [-2345.249, -306.191, 1624.184], # bottom - [-2341.768, -295.659, 1591.094], - [-2331.741, -325.407, 1582.681], - [-2335.222, -335.939, 1615.770], # bottom - [-2334.481, -338.013, 1615.148], # bottom - [-2331.369, -326.447, 1582.369], - [-2320.358, -355.596, 1573.129], - [-2323.469, -367.162, 1605.909], # bottom - [-2322.660, -369.192, 1605.229], # bottom - [-2319.952, -356.614, 1572.789], - [-2307.977, -385.107, 1562.740], - [-2310.685, -397.685, 1595.181], # bottom - [-2311.074, -399.002, 1594.202], # bottom - [-2307.354, -386.556, 1562.218], - [-2295.324, -423.110, 1552.123], - [-2300.371, -431.522, 1585.211], # bottom - [-2300.025, -432.890, 1584.931], # bottom - [-2294.923, -424.698, 1551.787], - [-2287.937, -463.423, 1545.925], - [-2293.811, -467.342, 1579.717], # bottom - [-2293.653, -468.768, 1579.584], # bottom - [-2287.754, -465.078, 1545.771], - [-2286.026, -504.799, 1544.321], - [-2292.115, -504.105, 1578.294]] # Last pt - - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - Rref, Rmax = 3., 3.4 - - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1) - return Poly0, Poly1, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_V0.txt deleted file mode 100644 index 39a81d54b..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_V0.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.049005749077952299e+00 3.136699800685844863e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.136699800685844863e+00 3.049005749077952299e+00 2.893161745241203509e+00 2.868988600429927427e+00 2.871351109810510671e+00 2.880800806826291804e+00 2.897086029556440678e+00 2.913304122262888374e+00 2.928108437504038264e+00 2.941589917755801586e+00 2.953723233749382615e+00 2.964484053313650946e+00 2.973852348038931837e+00 2.981810080005999453e+00 2.988341430914152053e+00 2.993434791052786537e+00 2.997079661606716794e+00 2.999269602916132094e+00 3.000000000000000000e+00 2.999269602916132094e+00 2.997079661606716794e+00 2.993434791052786537e+00 2.988341430914152053e+00 2.981810080005999453e+00 2.973852348038931837e+00 2.964484053313650946e+00 2.953723233749382615e+00 2.941589917755801586e+00 2.928108437504038264e+00 2.913304122262888374e+00 2.897086029556440678e+00 2.880800806826291804e+00 2.871351109810510671e+00 2.868988600429927427e+00 2.893161745241203509e+00 --4.949109999999999898e-01 -3.350000000000000200e-01 -3.350000000000000200e-01 3.350000000000000200e-01 3.350000000000000200e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.642505000000000104e-01 4.239039999999999475e-01 3.858314999999999939e-01 3.561050000000000049e-01 3.259269999999999667e-01 2.951289999999999747e-01 2.637690000000000312e-01 2.319070000000000020e-01 1.996034999999999893e-01 1.669204999999999994e-01 1.339190000000000103e-01 1.006630000000000025e-01 6.721550000000001135e-02 3.363950000000000273e-02 0.000000000000000000e+00 -3.363950000000000273e-02 -6.721550000000001135e-02 -1.006630000000000025e-01 -1.339190000000000103e-01 -1.669204999999999994e-01 -1.996034999999999893e-01 -2.319070000000000020e-01 -2.637690000000000312e-01 -2.951289999999999747e-01 -3.259269999999999667e-01 -3.561050000000000049e-01 -3.858314999999999939e-01 -4.239039999999999475e-01 -4.642505000000000104e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_V1.txt deleted file mode 100644 index 412655bbe..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC2_V1.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.049005749077952299e+00 3.136699800685844863e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.136699800685844863e+00 3.049005749077952299e+00 2.893161745241203509e+00 2.868988600429927427e+00 2.871232184874885185e+00 2.895160089779413415e+00 2.895365652775027776e+00 2.871470034746136601e+00 2.880540609070497915e+00 2.903440859048059597e+00 2.903890317399827392e+00 2.881061004582085250e+00 2.896681761097305241e+00 2.917799801957522199e+00 2.918035678212157702e+00 2.897490298015576116e+00 2.913040700743232847e+00 2.933599304008877695e+00 2.934567534544293643e+00 2.913567543782543900e+00 2.927866929907000149e+00 2.948963642126518181e+00 2.949926909762506266e+00 2.928349945101076379e+00 2.941371435684154267e+00 2.962960298264976533e+00 2.963832468411404797e+00 2.941808399827448461e+00 2.953527647901719178e+00 2.975561006607239989e+00 2.976340676090472481e+00 2.953918819597046053e+00 2.964312061526618081e+00 2.986742832507685907e+00 2.987429169303660093e+00 2.964656045100683812e+00 2.973705061107083214e+00 2.996485074357254863e+00 2.997074716166638897e+00 2.973999634970780903e+00 2.981686523884328643e+00 3.004768121776298262e+00 3.005260809651117526e+00 2.981933636127670706e+00 2.988242170622883442e+00 3.011575234559607850e+00 3.011971213063827868e+00 2.988440691205420663e+00 2.993359959519476199e+00 3.016894619915909459e+00 3.017192241518522611e+00 2.993509622586097318e+00 2.997029823473389865e+00 3.020715965495475608e+00 3.020914655701153251e+00 2.997129499740043723e+00 2.999244195333032881e+00 3.023031121185379533e+00 3.023130877419521578e+00 2.999295010499231307e+00 3.000000000000000000e+00 3.023837023205159902e+00 3.023837023205159902e+00 3.000000000000000000e+00 2.999295010499231307e+00 3.023130877419521578e+00 3.023031121185379533e+00 2.999244195333032881e+00 2.997129499740043723e+00 3.020914655701153251e+00 3.020715965495475608e+00 2.997029823473389865e+00 2.993509622586097318e+00 3.017192241518522611e+00 3.016894619915909459e+00 2.993359959519476199e+00 2.988440691205420663e+00 3.011971213063827868e+00 3.011575234559607850e+00 2.988242170622883442e+00 2.981933636127670706e+00 3.005260809651117526e+00 3.004768121776298262e+00 2.981686523884328643e+00 2.973999634970780903e+00 2.997074716166638897e+00 2.996485074357254863e+00 2.973705061107083214e+00 2.964656045100683812e+00 2.987429169303660093e+00 2.986742832507685907e+00 2.964312061526618081e+00 2.953918819597046053e+00 2.976340676090472481e+00 2.975561006607239989e+00 2.953527647901719178e+00 2.941808399827448461e+00 2.963832468411404797e+00 2.962960298264976533e+00 2.941371435684154267e+00 2.928349945101076379e+00 2.949926909762506266e+00 2.948963642126518181e+00 2.927866929907000149e+00 2.913567543782543900e+00 2.934651442255531428e+00 2.933599304008877695e+00 2.913040700743232847e+00 2.897490298015576116e+00 2.918035678212157702e+00 2.917799801957522199e+00 2.896681761097305241e+00 2.881061004582085250e+00 2.903884643094994722e+00 2.903440859048059597e+00 2.880540609070497915e+00 2.871470034746136601e+00 2.895365652775027776e+00 2.895160089779413415e+00 2.871232184874885185e+00 2.868988600429927427e+00 2.893161745241203509e+00 --4.949109999999999898e-01 -3.350000000000000200e-01 -3.350000000000000200e-01 3.350000000000000200e-01 3.350000000000000200e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.650779999999999914e-01 4.687679999999999625e-01 4.673419999999999797e-01 4.634230000000000294e-01 4.246979999999999644e-01 4.328899999999999970e-01 4.315220000000000167e-01 4.231099999999999861e-01 3.865560000000000107e-01 3.990020000000000233e-01 3.976850000000000107e-01 3.851070000000000326e-01 3.566139999999999866e-01 3.691920000000000202e-01 3.671619999999999884e-01 3.555960000000000232e-01 3.264469999999999872e-01 3.380129999999999524e-01 3.359390000000000431e-01 3.254070000000000018e-01 2.956590000000000051e-01 3.061909999999999910e-01 3.040769999999999862e-01 2.945989999999999998e-01 2.643079999999999874e-01 2.737859999999999738e-01 2.716350000000000153e-01 2.632300000000000195e-01 2.324539999999999940e-01 2.408600000000000185e-01 2.386770000000000003e-01 2.313600000000000101e-01 2.001579999999999748e-01 2.074759999999999938e-01 2.052649999999999753e-01 1.990490000000000037e-01 1.674809999999999910e-01 1.736959999999999893e-01 1.714610000000000023e-01 1.663600000000000079e-01 1.344840000000000202e-01 1.395860000000000156e-01 1.373319999999999819e-01 1.333540000000000003e-01 1.012320000000000025e-01 1.052099999999999980e-01 1.029410000000000047e-01 1.000939999999999885e-01 6.778700000000000003e-02 7.063400000000000234e-02 6.835399999999999809e-02 6.664400000000000879e-02 3.421300000000000036e-02 3.592300000000000354e-02 3.363700000000000023e-02 3.306600000000000511e-02 5.739999999999999660e-04 1.143999999999999835e-03 -1.143999999999999835e-03 -5.739999999999999660e-04 -3.306600000000000511e-02 -3.363700000000000023e-02 -3.592300000000000354e-02 -3.421300000000000036e-02 -6.664400000000000879e-02 -6.835399999999999809e-02 -7.063400000000000234e-02 -6.778700000000000003e-02 -1.000939999999999885e-01 -1.029410000000000047e-01 -1.052099999999999980e-01 -1.012320000000000025e-01 -1.333540000000000003e-01 -1.373319999999999819e-01 -1.395860000000000156e-01 -1.344840000000000202e-01 -1.663600000000000079e-01 -1.714610000000000023e-01 -1.736959999999999893e-01 -1.674809999999999910e-01 -1.990490000000000037e-01 -2.052649999999999753e-01 -2.074759999999999938e-01 -2.001579999999999748e-01 -2.313600000000000101e-01 -2.386770000000000003e-01 -2.408600000000000185e-01 -2.324539999999999940e-01 -2.632300000000000195e-01 -2.716350000000000153e-01 -2.737859999999999738e-01 -2.643079999999999874e-01 -2.945989999999999998e-01 -3.040769999999999862e-01 -3.061909999999999910e-01 -2.956590000000000051e-01 -3.254070000000000018e-01 -3.359390000000000431e-01 -3.380129999999999524e-01 -3.264469999999999872e-01 -3.555960000000000232e-01 -3.671619999999999884e-01 -3.691920000000000202e-01 -3.566139999999999866e-01 -3.851070000000000326e-01 -3.976850000000000107e-01 -3.990020000000000233e-01 -3.865560000000000107e-01 -4.231099999999999861e-01 -4.315220000000000167e-01 -4.328899999999999970e-01 -4.246979999999999644e-01 -4.634230000000000294e-01 -4.673419999999999797e-01 -4.687679999999999625e-01 -4.650779999999999914e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_Notes.py deleted file mode 100755 index 3fc1fe14a..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_Notes.py +++ /dev/null @@ -1,190 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - notes = {} - # Samples from 3D drawings - # Assumed identical to IC1 - notes['sampXYZ'] = [[-2471.450, -494.911, 1590.106], # Back - [-2469.748, -335.000, 1749.276], # Back - [-2515.174, -335.000, 1787.393], # Back - [-2515.174, 335.000, 1787.393], # Back - [-2469.748, 335.000, 1749.276], # Back - [-2471.450, 494.911, 1590.106], # Back - [-2292.115, 504.105, 1578.294], # 1st pt - [-2286.026, 504.799, 1544.321], - [-2287.754, 465.078, 1545.771], - [-2293.653, 468.768, 1579.584], # bottom - [-2293.811, 467.342, 1579.717], # bottom - [-2287.937, 463.423, 1545.925], - [-2294.923, 424.698, 1551.787], - [-2300.025, 432.890, 1584.931], # bottom - [-2300.371, 431.522, 1585.221], # bottom - [-2295.324, 423.110, 1552.123], - [-2307.354, 386.556, 1562.218], - [-2311.074, 399.002, 1594.202], # bottom - [-2310.685, 397.685, 1595.181], # bottom - [-2307.977, 385.107, 1562.740], - [-2319.952, 356.614, 1572.789], - [-2322.660, 369.192, 1605.229], # bottom - [-2323.367, 367.162, 1605.909], # bottom - [-2320.358, 355.596, 1573.129], - [-2331.369, 326.447, 1582.369], - [-2334.481, 338.013, 1615.148], # bottom - [-2335.222, 335.939, 1615.770], # bottom - [-2331.741, 325.407, 1582.681], - [-2341.768, 295.659, 1591.094], - [-2345.249, 306.191, 1624.184], # bottom - [-2345.920, 304.077, 1624.747], # bottom - [-2342.104, 294.599, 1591.377], - [-2351.128, 264.308, 1598.948], - [-2354.943, 273.786, 1632.318], # bottom - [-2355.543, 271.635, 1632.821], # bottom - [-2351.429, 263.230, 1599.201], - [-2359.431, 232.454, 1605.916], - [-2363.545, 240.860, 1639.536], # bottom - [-2364.073, 238.677, 1639.979], # bottom - [-2359.696, 231.360, 1606.138], - [-2366.663, 200.158, 1611.984], - [-2371.039, 207.476, 1645.825], # bottom - [-2371.493, 205.265, 1646.205], # bottom - [-2366.890, 199.049, 1612.174], - [-2372.808, 167.481, 1617.140], - [-2377.411, 173.696, 1651.171], # bottom - [-2377.790, 171.461, 1651.489], # bottom - [-2372.998, 166.360, 1617.300], - [-2377.855, 134.484, 1621.375], - [-2382.647, 139.586, 1655.565], # bottom - [-2382.952, 137.332, 1655.820], # bottom - [-2378.008, 133.354, 1621.503], - [-2381.795, 101.232, 1624.681], - [-2386.739, 105.210, 1658.998], - [-2386.968, 102.941, 1659.190], # bottom - [-2381.910, 100.094, 1624.778], # bottom - [-2384.620, 67.787, 1627.052], - [-2389.678, 70.634, 1661.465], # bottom - [-2389.831, 68.354, 1661.593], # bottom - [-2384.697, 66.644, 1627.116], - [-2386.325, 34.213, 1628.482], - [-2391.459, 35.923, 1662.959], # bottom - [-2391.536, 33.637, 1663.023], # bottom - [-2386.364, 33.066, 1628.515], - [-2386.907, 0.574, 1628.970], - [-2392.079, 1.144, 1663.479], # bottom - [-2392.079, -1.144, 1663.479], # bottom - [-2386.907, -0.574, 1628.970], - [-2386.364, -33.066, 1628.515], - [-2391.536, -33.637, 1663.023], # bottom - [-2391.459, -35.923, 1662.959], # bottom - [-2386.325, -34.213, 1628.482], - [-2384.697, -66.644, 1627.116], - [-2389.831, -68.354, 1661.593], # bottom - [-2389.678, -70.634, 1661.465], # bottom - [-2384.620, -67.787, 1627.052], - [-2381.910, -100.094, 1624.778], - [-2386.968, -102.941, 1659.190], # bottom - [-2386.739, -105.210, 1658.998], # bottom - [-2381.795, -101.232, 1624.681], - [-2378.008, -133.354, 1621.503], - [-2382.952, -137.332, 1655.820], # bottom - [-2382.647, -139.586, 1655.565], # bottom - [-2377.855, -134.484, 1621.375], - [-2372.998, -166.360, 1617.300], - [-2377.790, -171.461, 1651.489], # bottom - [-2377.411, -173.696, 1651.171], # bottom - [-2372.808, -167.481, 1617.140], - [-2366.890, -199.049, 1612.174], - [-2371.493, -205.265, 1646.205], # bottom - [-2371.039, -207.476, 1645.825], # bottom - [-2366.663, -200.158, 1611.984], - [-2359.696, -231.360, 1606.138], - [-2364.073, -238.677, 1639.979], # bottom - [-2363.545, -240.860, 1639.536], # bottom - [-2359.431, -232.454, 1605.916], - [-2351.429, -263.230, 1599.201], - [-2355.543, -271.635, 1632.821], # bottom - [-2354.943, -273.786, 1632.318], # bottom - [-2351.128, -264.308, 1598.948], - [-2342.104, -294.599, 1591.377], - [-2345.920, -304.077, 1624.747], # bottom - [-2345.249, -306.191, 1624.184], # bottom - [-2341.768, -295.659, 1591.094], - [-2331.741, -325.407, 1582.681], - [-2335.222, -335.939, 1615.770], # bottom - [-2334.481, -338.013, 1615.148], # bottom - [-2331.369, -326.447, 1582.369], - [-2320.358, -355.596, 1573.129], - [-2323.469, -367.162, 1605.909], # bottom - [-2322.660, -369.192, 1605.229], # bottom - [-2319.952, -356.614, 1572.789], - [-2307.977, -385.107, 1562.740], - [-2310.685, -397.685, 1595.181], # bottom - [-2311.074, -399.002, 1594.202], # bottom - [-2307.354, -386.556, 1562.218], - [-2295.324, -423.110, 1552.123], - [-2300.371, -431.522, 1585.211], # bottom - [-2300.025, -432.890, 1584.931], # bottom - [-2294.923, -424.698, 1551.787], - [-2287.937, -463.423, 1545.925], - [-2293.811, -467.342, 1579.717], # bottom - [-2293.653, -468.768, 1579.584], # bottom - [-2287.754, -465.078, 1545.771], - [-2286.026, -504.799, 1544.321], - [-2292.115, -504.105, 1578.294]] # Last pt - - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - Rref, Rmax = 3., 3.4 - - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1) - return Poly0, Poly1, notes - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_V0.txt deleted file mode 100644 index 39a81d54b..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_V0.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.049005749077952299e+00 3.136699800685844863e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.136699800685844863e+00 3.049005749077952299e+00 2.893161745241203509e+00 2.868988600429927427e+00 2.871351109810510671e+00 2.880800806826291804e+00 2.897086029556440678e+00 2.913304122262888374e+00 2.928108437504038264e+00 2.941589917755801586e+00 2.953723233749382615e+00 2.964484053313650946e+00 2.973852348038931837e+00 2.981810080005999453e+00 2.988341430914152053e+00 2.993434791052786537e+00 2.997079661606716794e+00 2.999269602916132094e+00 3.000000000000000000e+00 2.999269602916132094e+00 2.997079661606716794e+00 2.993434791052786537e+00 2.988341430914152053e+00 2.981810080005999453e+00 2.973852348038931837e+00 2.964484053313650946e+00 2.953723233749382615e+00 2.941589917755801586e+00 2.928108437504038264e+00 2.913304122262888374e+00 2.897086029556440678e+00 2.880800806826291804e+00 2.871351109810510671e+00 2.868988600429927427e+00 2.893161745241203509e+00 --4.949109999999999898e-01 -3.350000000000000200e-01 -3.350000000000000200e-01 3.350000000000000200e-01 3.350000000000000200e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.642505000000000104e-01 4.239039999999999475e-01 3.858314999999999939e-01 3.561050000000000049e-01 3.259269999999999667e-01 2.951289999999999747e-01 2.637690000000000312e-01 2.319070000000000020e-01 1.996034999999999893e-01 1.669204999999999994e-01 1.339190000000000103e-01 1.006630000000000025e-01 6.721550000000001135e-02 3.363950000000000273e-02 0.000000000000000000e+00 -3.363950000000000273e-02 -6.721550000000001135e-02 -1.006630000000000025e-01 -1.339190000000000103e-01 -1.669204999999999994e-01 -1.996034999999999893e-01 -2.319070000000000020e-01 -2.637690000000000312e-01 -2.951289999999999747e-01 -3.259269999999999667e-01 -3.561050000000000049e-01 -3.858314999999999939e-01 -4.239039999999999475e-01 -4.642505000000000104e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_V1.txt deleted file mode 100644 index 412655bbe..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_IC3_V1.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.049005749077952299e+00 3.136699800685844863e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.136699800685844863e+00 3.049005749077952299e+00 2.893161745241203509e+00 2.868988600429927427e+00 2.871232184874885185e+00 2.895160089779413415e+00 2.895365652775027776e+00 2.871470034746136601e+00 2.880540609070497915e+00 2.903440859048059597e+00 2.903890317399827392e+00 2.881061004582085250e+00 2.896681761097305241e+00 2.917799801957522199e+00 2.918035678212157702e+00 2.897490298015576116e+00 2.913040700743232847e+00 2.933599304008877695e+00 2.934567534544293643e+00 2.913567543782543900e+00 2.927866929907000149e+00 2.948963642126518181e+00 2.949926909762506266e+00 2.928349945101076379e+00 2.941371435684154267e+00 2.962960298264976533e+00 2.963832468411404797e+00 2.941808399827448461e+00 2.953527647901719178e+00 2.975561006607239989e+00 2.976340676090472481e+00 2.953918819597046053e+00 2.964312061526618081e+00 2.986742832507685907e+00 2.987429169303660093e+00 2.964656045100683812e+00 2.973705061107083214e+00 2.996485074357254863e+00 2.997074716166638897e+00 2.973999634970780903e+00 2.981686523884328643e+00 3.004768121776298262e+00 3.005260809651117526e+00 2.981933636127670706e+00 2.988242170622883442e+00 3.011575234559607850e+00 3.011971213063827868e+00 2.988440691205420663e+00 2.993359959519476199e+00 3.016894619915909459e+00 3.017192241518522611e+00 2.993509622586097318e+00 2.997029823473389865e+00 3.020715965495475608e+00 3.020914655701153251e+00 2.997129499740043723e+00 2.999244195333032881e+00 3.023031121185379533e+00 3.023130877419521578e+00 2.999295010499231307e+00 3.000000000000000000e+00 3.023837023205159902e+00 3.023837023205159902e+00 3.000000000000000000e+00 2.999295010499231307e+00 3.023130877419521578e+00 3.023031121185379533e+00 2.999244195333032881e+00 2.997129499740043723e+00 3.020914655701153251e+00 3.020715965495475608e+00 2.997029823473389865e+00 2.993509622586097318e+00 3.017192241518522611e+00 3.016894619915909459e+00 2.993359959519476199e+00 2.988440691205420663e+00 3.011971213063827868e+00 3.011575234559607850e+00 2.988242170622883442e+00 2.981933636127670706e+00 3.005260809651117526e+00 3.004768121776298262e+00 2.981686523884328643e+00 2.973999634970780903e+00 2.997074716166638897e+00 2.996485074357254863e+00 2.973705061107083214e+00 2.964656045100683812e+00 2.987429169303660093e+00 2.986742832507685907e+00 2.964312061526618081e+00 2.953918819597046053e+00 2.976340676090472481e+00 2.975561006607239989e+00 2.953527647901719178e+00 2.941808399827448461e+00 2.963832468411404797e+00 2.962960298264976533e+00 2.941371435684154267e+00 2.928349945101076379e+00 2.949926909762506266e+00 2.948963642126518181e+00 2.927866929907000149e+00 2.913567543782543900e+00 2.934651442255531428e+00 2.933599304008877695e+00 2.913040700743232847e+00 2.897490298015576116e+00 2.918035678212157702e+00 2.917799801957522199e+00 2.896681761097305241e+00 2.881061004582085250e+00 2.903884643094994722e+00 2.903440859048059597e+00 2.880540609070497915e+00 2.871470034746136601e+00 2.895365652775027776e+00 2.895160089779413415e+00 2.871232184874885185e+00 2.868988600429927427e+00 2.893161745241203509e+00 --4.949109999999999898e-01 -3.350000000000000200e-01 -3.350000000000000200e-01 3.350000000000000200e-01 3.350000000000000200e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.650779999999999914e-01 4.687679999999999625e-01 4.673419999999999797e-01 4.634230000000000294e-01 4.246979999999999644e-01 4.328899999999999970e-01 4.315220000000000167e-01 4.231099999999999861e-01 3.865560000000000107e-01 3.990020000000000233e-01 3.976850000000000107e-01 3.851070000000000326e-01 3.566139999999999866e-01 3.691920000000000202e-01 3.671619999999999884e-01 3.555960000000000232e-01 3.264469999999999872e-01 3.380129999999999524e-01 3.359390000000000431e-01 3.254070000000000018e-01 2.956590000000000051e-01 3.061909999999999910e-01 3.040769999999999862e-01 2.945989999999999998e-01 2.643079999999999874e-01 2.737859999999999738e-01 2.716350000000000153e-01 2.632300000000000195e-01 2.324539999999999940e-01 2.408600000000000185e-01 2.386770000000000003e-01 2.313600000000000101e-01 2.001579999999999748e-01 2.074759999999999938e-01 2.052649999999999753e-01 1.990490000000000037e-01 1.674809999999999910e-01 1.736959999999999893e-01 1.714610000000000023e-01 1.663600000000000079e-01 1.344840000000000202e-01 1.395860000000000156e-01 1.373319999999999819e-01 1.333540000000000003e-01 1.012320000000000025e-01 1.052099999999999980e-01 1.029410000000000047e-01 1.000939999999999885e-01 6.778700000000000003e-02 7.063400000000000234e-02 6.835399999999999809e-02 6.664400000000000879e-02 3.421300000000000036e-02 3.592300000000000354e-02 3.363700000000000023e-02 3.306600000000000511e-02 5.739999999999999660e-04 1.143999999999999835e-03 -1.143999999999999835e-03 -5.739999999999999660e-04 -3.306600000000000511e-02 -3.363700000000000023e-02 -3.592300000000000354e-02 -3.421300000000000036e-02 -6.664400000000000879e-02 -6.835399999999999809e-02 -7.063400000000000234e-02 -6.778700000000000003e-02 -1.000939999999999885e-01 -1.029410000000000047e-01 -1.052099999999999980e-01 -1.012320000000000025e-01 -1.333540000000000003e-01 -1.373319999999999819e-01 -1.395860000000000156e-01 -1.344840000000000202e-01 -1.663600000000000079e-01 -1.714610000000000023e-01 -1.736959999999999893e-01 -1.674809999999999910e-01 -1.990490000000000037e-01 -2.052649999999999753e-01 -2.074759999999999938e-01 -2.001579999999999748e-01 -2.313600000000000101e-01 -2.386770000000000003e-01 -2.408600000000000185e-01 -2.324539999999999940e-01 -2.632300000000000195e-01 -2.716350000000000153e-01 -2.737859999999999738e-01 -2.643079999999999874e-01 -2.945989999999999998e-01 -3.040769999999999862e-01 -3.061909999999999910e-01 -2.956590000000000051e-01 -3.254070000000000018e-01 -3.359390000000000431e-01 -3.380129999999999524e-01 -3.264469999999999872e-01 -3.555960000000000232e-01 -3.671619999999999884e-01 -3.691920000000000202e-01 -3.566139999999999866e-01 -3.851070000000000326e-01 -3.976850000000000107e-01 -3.990020000000000233e-01 -3.865560000000000107e-01 -4.231099999999999861e-01 -4.315220000000000167e-01 -4.328899999999999970e-01 -4.246979999999999644e-01 -4.634230000000000294e-01 -4.673419999999999797e-01 -4.687679999999999625e-01 -4.650779999999999914e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_Notes.py deleted file mode 100755 index f6699f85f..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_Notes.py +++ /dev/null @@ -1,233 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes(): - notes = {} - # Samples from metrology - # C3 - D - notes['sampXYZ-D'] = [[1.53826756, -0.309802392, 0.495340], - [1.55438849, -0.310366326, 0.414159], - [1.58692824, -0.310687258, 0.348138], - [1.61481964, -0.310836715, 0.286890], - [1.63695890, -0.310959610, 0.223451], - [1.65338025, -0.311736673, 0.158320], - [1.66487966, -0.311825521, 0.091980], - [1.67042531, -0.311035384, 0.024930], - [1.66947988, -0.311205048, -0.042300], - [1.66307559, -0.308964918, -0.109200], - [1.65061648, -0.309699531, -0.175280], - [1.63262807, -0.310546907, -0.240020], - [1.60945846, -0.309854818, -0.303073], - [1.58012145, -0.311321117, -0.363462]] - # C3 - G - notes['sampXYZ-G'] = [[1.54096476, 0.309275398, 0.495340], - [1.55528740, 0.311577153, 0.414159], - [1.58731480, 0.310884910, 0.348138], - [1.61505288, 0.310597222, 0.286890], - [1.63812089, 0.310657956, 0.223451], - [1.65434222, 0.310749224, 0.158320], - [1.66508793, 0.310635608, 0.091980], - [1.67065466, 0.310522712, 0.024930], - [1.67017474, 0.310654427, -0.042300], - [1.66378725, 0.311205322, -0.109200], - [1.65120413, 0.311586155, -0.175280], - [1.63299619, 0.309925216, -0.240020], - [1.60829284, 0.311433064, -0.303073], - [1.58020776, 0.312038682, -0.363462]] - notes['sampXYZ-D'] = np.array(notes['sampXYZ-D']) - notes['sampXYZ-G'] = np.array(notes['sampXYZ-G']) - return notes - - -def get_notes2(): - notes = {} - # Samples from 3D drawings - # C3 - D - notes['sampXYZ'] = [[-1991.385,-494.911, -2191.731], # Back - [-2133.133,-318.000, -2143.935], # Back - [-3205.596,-318.000, -3043.838], # Back - [-3205.596, 318.000, -3043.838], # Back - [-2133.133, 318.000, -2143.935], # Back - [-1991.385, 494.911, -2191.731], # Back - [-1952.407, 504.105, -2020.357], # First pt - [-1917.893, 504.799, -2020.259], - [-1919.621, 465.078, -2021.709], - [-1953.944, 468.768, -2021.646], # bottom - [-1954.102, 467.342, -2021.779], # bottom - [-1919.804, 463.423, -2021.863], - [-1926.790, 424.698, -2027.724], - [-1960.317, 432.890, -2026.994], # bottom - [-1960.662, 431.522, -2027.284], # bottom - [-1927.191, 423.110, -2028.061], - [-1939.221, 386.556, -2038.156], - [-1971.365, 399.002, -2036.265], # bottom - [-1972.262, 397.685, -2035.711], # bottom - [-1939.844, 385.107, -2038.678], - [-1951.819, 356.614, -2048.726], - [-1984.237, 369.192, -2045.760], # bottom - [-1985.046, 367.162, -2046.439], # bottom - [-1952.225, 355.596, -2049.067], - [-1963.236, 326.447, -2058.307], - [-1996.058, 338.013, -2055.679], # bottom - [-1996.799, 335.939, -2056.300], # bottom - [-1963.608, 325.407, -2058.618], - [-1973.635, 295.659, -2067.032], - [-2006.826, 306.191, -2064.714], # bottom - [-2007.497, 304.077, -2065.277], # bottom - [-1973.971, 294.599, -2067.314], - [-1982.995, 264.308, -2074.886], - [-2016.520, 273.786, -2072.849], # bottom - [-2017.120, 271.635, -2073.352], # bottom - [-1983.296, 263.230, -2075.138], - [-1991.298, 232.454, -2081.853], - [-2025.123, 240.860, -2080.067], # bottom - [-2025.650, 238.677, -2080.509], # bottom - [-1991.563, 231.360, -2082.075], - [-1998.529, 200.158, -2087.921], - [-2032.617, 207.476, -2086.355], # bottom - [-2033.070, 205.265, -2086.736], # bottom - [-1998.757, 199.049, -2088.112], - [-2004.675, 167.481, -2093.077], - [-2038.988, 173.696, -2091.701], # bottom - [-2039.367, 171.461, -2092.020], # bottom - [-2004.865, 166.360, -2093.237], - [-2009.722, 134.484, -2097.313], - [-2044.224, 139.586, -2096.095], # bottom - [-2044.529, 137.332, -2096.351], # bottom - [-2009.875, 133.354, -2097.441], - [-2013.662, 101.232, -2100.619], - [-2048.316, 105.210, -2099.529], # bottom - [-2048.545, 102.941, -2099.721], # bottom - [-2013.777, 100.094, -2100.715], - [-2016.487, 67.787, -2102.989], - [-2051.255, 70.634, -2101.995], # bottom - [-2051.408, 68.354, -2102.123], # bottom - [-2016.564, 66.644, -2103.054], - [-2018.192, 34.213, -2104.420], - [-2053.037, 35.923, -2103.490], # bottom - [-2053.113, 33.637, -2103.554], # bottom - [-2018.231, 33.066, -2104.452], - [-2018.774, 0.574, -2104.908], - [-2053.656, 1.144, -2104.009], # bottom - [-2053.656, -1.144, -2104.009], # bottom - [-2018.774, -0.574, -2104.908], - [-2018.231, -33.066, -2104.452], - [-2053.113, -33.637, -2103.554], # bottom - [-2053.037, -35.923, -2103.490], # bottom - [-2018.192, -34.213, -2104.420], - [-2016.564, -66.644, -2103.054], - [-2051.408, -68.354, -2102.123], # bottom - [-2051.255, -70.634, -2101.995], # bottom - [-2016.487, -67.787, -2102.989], - [-2013.777,-100.094, -2100.715], - [-2048.545,-102.941, -2099.721], # bottom - [-2048.316,-105.210, -2099.529], # bottom - [-2013.662,-101.232, -2100.619], - [-2009.875,-133.354, -2097.441], - [-2044.529,-137.332, -2096.351], # bottom - [-2044.224,-139.586, -2096.095], # bottom - [-2009.722,-134.484, -2097.131], - [-2004.865,-166.360, -2093.237], - [-2039.367,-171.461, -2092.020], # bottom - [-2038.988,-173.696, -2091.701], # bottom - [-2004.675,-167.481, -2093.077], - [-1998.757,-199.049, -2088.112], - [-2033.070,-205.265, -2086.736], # bottom - [-2032.617,-207.476, -2086.355], # bottom - [-1998.529,-200.158, -2087.921], - [-1991.523,-231.360, -2082.075], - [-2025.650,-238.677, -2080.509], # bottom - [-2025.123,-240.860, -2080.067], # bottom - [-1991.298,-232.454, -2081.853], - [-1983.296,-263.230, -2075.138], - [-2017.120,-271.635, -2073.352], # bottom - [-2016.520,-273.786, -2072.849], # bottom - [-1982.995,-264.308, -2074.886], - [-1973.971,-294.599, -2067.314], - [-2007.497,-304.077, -2065.277], # bottom - [-2006.826,-306.191, -2064.714], # bottom - [-1973.635,-295.659, -2067.032], - [-1963.608,-325.407, -2058.618], - [-1996.799,-335.939, -2056.300], # bottom - [-1996.058,-338.013, -2055.679], # bottom - [-1963.236,-326.447, -2058.307], - [-1952.225,-355.596, -2049.067], - [-1985.046,-367.162, -2046.439], # bottom - [-1984.237,-369.192, -2045.760], # bottom - [-1951.819,-356.614, -2048.726], - [-1939.844,-385.107, -2038.678], - [-1972.262,-397.685, -2035.711], # bottom - [-1971.365,-399.002, -2036.265], # bottom - [-1939.221,-386.556, -2038.156], - [-1927.191,-423.110, -2028.061], - [-1960.662,-431.522, -2027.284], # bottom - [-1960.317,-432.890, -2026.994], # bottom - [-1926.790,-424.698, -2027.724], - [-1919.804,-463.423, -2021.863], - [-1954.102,-467.342, -2021.779], # bottom - [-1953.944,-468.768, -2021.646], # bottom - [-1919.621,-465.078, -2021.709], - [-1917.893,-504.799, -2020.259], - [-1952.407,-504.105, -2020.357]] - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - - -def make_Poly(save=_save, path=_here): - notes = get_notes2() - Rref, Rmax = 3., 3.4 - - #D1, G1 = notes['sampXYZ-D'], notes['sampXYZ-G'] - #R = np.mean(np.vstack((D1[:,0],G1[:,0])),axis=0) - #Z = np.mean(np.vstack((D1[:,2],G1[:,2])),axis=0) - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - #R = R-np.max(R)+Rref - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1) - return Poly0, Poly1, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_V0.txt deleted file mode 100644 index c52c761ba..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_V0.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.044780693243757774e+00 3.107833904684217163e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.107833904684217163e+00 3.044780693243757774e+00 2.893059712127533434e+00 2.869115048167717230e+00 2.871475220568535214e+00 2.880915079803645362e+00 2.897184470647450105e+00 2.913386258869197665e+00 2.928176206214729405e+00 2.941644655680222709e+00 2.953766325423418770e+00 2.964516663994923640e+00 2.973876076688413583e+00 2.981826377056054689e+00 2.988352293009314931e+00 2.993440622120721262e+00 2.997082113834418138e+00 2.999269995011077938e+00 3.000000000000000000e+00 2.999269995011077938e+00 2.997082113834418138e+00 2.993440622120721262e+00 2.988286590271198140e+00 2.981826377056054689e+00 2.973876076688413583e+00 2.964502839567379588e+00 2.953766325423418770e+00 2.941644655680222709e+00 2.928176206214729405e+00 2.913386258869197665e+00 2.897184470647450105e+00 2.880915079803645362e+00 2.871475220568535214e+00 2.869115048167717230e+00 2.893059712127533434e+00 --4.949109999999999898e-01 -3.180000000000000049e-01 -3.180000000000000049e-01 3.180000000000000049e-01 3.180000000000000049e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.642505000000000104e-01 4.239039999999999475e-01 3.858314999999999939e-01 3.561050000000000049e-01 3.259269999999999667e-01 2.951289999999999747e-01 2.637690000000000312e-01 2.319070000000000020e-01 1.996034999999999893e-01 1.669204999999999994e-01 1.339190000000000103e-01 1.006630000000000025e-01 6.721550000000001135e-02 3.363950000000000273e-02 0.000000000000000000e+00 -3.363950000000000273e-02 -6.721550000000001135e-02 -1.006630000000000025e-01 -1.339190000000000103e-01 -1.669204999999999994e-01 -1.996034999999999893e-01 -2.319070000000000020e-01 -2.637690000000000312e-01 -2.951289999999999747e-01 -3.259269999999999667e-01 -3.561050000000000049e-01 -3.858314999999999939e-01 -4.239039999999999475e-01 -4.642505000000000104e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_V1.txt deleted file mode 100644 index a4ea770e1..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH1_V1.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.044780693243757774e+00 3.107833904684217163e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.107833904684217163e+00 3.044780693243757774e+00 2.893059712127533434e+00 2.869115048167717230e+00 2.871356378445165003e+00 2.895054712512507678e+00 2.895260149838732033e+00 2.871594062691905869e+00 2.880654819392295174e+00 2.903329301636539128e+00 2.903777601803601005e+00 2.881175340214995995e+00 2.896780664414922324e+00 2.917674381907263914e+00 2.917900461640007936e+00 2.897588276879977887e+00 2.913122788147675557e+00 2.933450727161458715e+00 2.934501378337782462e+00 2.913649729590719772e+00 2.927935306141395522e+00 2.948801343380880624e+00 2.949763071809159865e+00 2.928417106288062843e+00 2.941426659002225996e+00 2.962784989008413028e+00 2.963656386303281653e+00 2.941862652358219421e+00 2.953571252549659132e+00 2.975375333992480442e+00 2.976154255184515929e+00 2.953961398297178853e+00 2.964344863811784414e+00 2.986548141768861964e+00 2.987232463341812583e+00 2.964688464178063310e+00 2.973728259248752170e+00 2.996281368108780985e+00 2.996870381410558171e+00 2.974023894128074996e+00 2.981702890860188138e+00 3.004556496895482542e+00 3.005049476279062048e+00 2.981949863251920796e+00 2.988253155515101511e+00 3.011357863027227300e+00 3.011754085023580441e+00 2.988451430503528350e+00 2.993366180933850540e+00 3.016673350655395769e+00 3.016970697067113960e+00 2.993515063307591983e+00 2.997032009376604744e+00 3.020490867071005781e+00 3.020689333367970519e+00 2.997132218292231531e+00 2.999244949959060769e+00 3.022805413067019664e+00 3.022904297751372038e+00 2.999295040063095108e+00 3.000000000000000000e+00 3.023609184170302555e+00 3.023609184170302555e+00 3.000000000000000000e+00 2.999295040063095108e+00 3.022904297751372038e+00 3.022805413067019664e+00 2.999244949959060769e+00 2.997132218292231531e+00 3.020689333367970519e+00 3.020490867071005781e+00 2.997032009376604744e+00 2.993515063307591983e+00 3.016970697067113960e+00 3.016673350655395769e+00 2.993366180933850540e+00 2.988451430503528350e+00 3.011754085023580441e+00 3.011357863027227300e+00 2.988121750038867930e+00 2.981949863251920796e+00 3.005049476279062048e+00 3.004556496895482542e+00 2.981702890860188138e+00 2.974023894128074996e+00 2.996870381410558171e+00 2.996281368108780985e+00 2.973728259248752170e+00 2.964660815322974763e+00 2.987232463341812583e+00 2.986548141768861964e+00 2.964344863811784414e+00 2.953961398297178853e+00 2.976154255184515929e+00 2.975375333992480442e+00 2.953571252549659132e+00 2.941862652358219421e+00 2.963656386303281653e+00 2.962784989008413028e+00 2.941426659002225996e+00 2.928417106288062843e+00 2.949763071809159865e+00 2.948801343380880624e+00 2.927935306141395522e+00 2.913649729590719772e+00 2.934501378337782462e+00 2.933450727161458715e+00 2.913122788147675557e+00 2.897588276879977887e+00 2.917900461640007936e+00 2.917674381907263914e+00 2.896780664414922324e+00 2.881175340214995995e+00 2.903777601803601005e+00 2.903329301636539128e+00 2.880654819392295174e+00 2.871594062691905869e+00 2.895260149838732033e+00 2.895054712512507678e+00 2.871356378445165003e+00 2.869115048167717230e+00 2.893059712127533434e+00 --4.949109999999999898e-01 -3.180000000000000049e-01 -3.180000000000000049e-01 3.180000000000000049e-01 3.180000000000000049e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.650779999999999914e-01 4.687679999999999625e-01 4.673419999999999797e-01 4.634230000000000294e-01 4.246979999999999644e-01 4.328899999999999970e-01 4.315220000000000167e-01 4.231099999999999861e-01 3.865560000000000107e-01 3.990020000000000233e-01 3.976850000000000107e-01 3.851070000000000326e-01 3.566139999999999866e-01 3.691920000000000202e-01 3.671619999999999884e-01 3.555960000000000232e-01 3.264469999999999872e-01 3.380129999999999524e-01 3.359390000000000431e-01 3.254070000000000018e-01 2.956590000000000051e-01 3.061909999999999910e-01 3.040769999999999862e-01 2.945989999999999998e-01 2.643079999999999874e-01 2.737859999999999738e-01 2.716350000000000153e-01 2.632300000000000195e-01 2.324539999999999940e-01 2.408600000000000185e-01 2.386770000000000003e-01 2.313600000000000101e-01 2.001579999999999748e-01 2.074759999999999938e-01 2.052649999999999753e-01 1.990490000000000037e-01 1.674809999999999910e-01 1.736959999999999893e-01 1.714610000000000023e-01 1.663600000000000079e-01 1.344840000000000202e-01 1.395860000000000156e-01 1.373319999999999819e-01 1.333540000000000003e-01 1.012320000000000025e-01 1.052099999999999980e-01 1.029410000000000047e-01 1.000939999999999885e-01 6.778700000000000003e-02 7.063400000000000234e-02 6.835399999999999809e-02 6.664400000000000879e-02 3.421300000000000036e-02 3.592300000000000354e-02 3.363700000000000023e-02 3.306600000000000511e-02 5.739999999999999660e-04 1.143999999999999835e-03 -1.143999999999999835e-03 -5.739999999999999660e-04 -3.306600000000000511e-02 -3.363700000000000023e-02 -3.592300000000000354e-02 -3.421300000000000036e-02 -6.664400000000000879e-02 -6.835399999999999809e-02 -7.063400000000000234e-02 -6.778700000000000003e-02 -1.000939999999999885e-01 -1.029410000000000047e-01 -1.052099999999999980e-01 -1.012320000000000025e-01 -1.333540000000000003e-01 -1.373319999999999819e-01 -1.395860000000000156e-01 -1.344840000000000202e-01 -1.663600000000000079e-01 -1.714610000000000023e-01 -1.736959999999999893e-01 -1.674809999999999910e-01 -1.990490000000000037e-01 -2.052649999999999753e-01 -2.074759999999999938e-01 -2.001579999999999748e-01 -2.313600000000000101e-01 -2.386770000000000003e-01 -2.408600000000000185e-01 -2.324539999999999940e-01 -2.632300000000000195e-01 -2.716350000000000153e-01 -2.737859999999999738e-01 -2.643079999999999874e-01 -2.945989999999999998e-01 -3.040769999999999862e-01 -3.061909999999999910e-01 -2.956590000000000051e-01 -3.254070000000000018e-01 -3.359390000000000431e-01 -3.380129999999999524e-01 -3.264469999999999872e-01 -3.555960000000000232e-01 -3.671619999999999884e-01 -3.691920000000000202e-01 -3.566139999999999866e-01 -3.851070000000000326e-01 -3.976850000000000107e-01 -3.990020000000000233e-01 -3.865560000000000107e-01 -4.231099999999999861e-01 -4.315220000000000167e-01 -4.328899999999999970e-01 -4.246979999999999644e-01 -4.634230000000000294e-01 -4.673419999999999797e-01 -4.687679999999999625e-01 -4.650779999999999914e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_Notes.py deleted file mode 100755 index e28531803..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_Notes.py +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes(): - notes = {} - # Samples from metrology - # C4 - D - notes['sampXYZ-D'] = [[1.53858885, -0.317150161, 0.495340], - [1.55346017, -0.316698552, 0.414281], - [1.58584884, -0.316851465, 0.348142], - [1.61372436, -0.316772548, 0.286890], - [1.63649027, -0.316136243, 0.223451], - [1.65305608, -0.316798816, 0.158320], - [1.66405349, -0.316906099, 0.091980], - [1.66947363, -0.316720751, 0.024930], - [1.66869769, -0.316878256, -0.042300], - [1.66231606, -0.316079895, -0.109200], - [1.64991395, -0.316419198, -0.175280], - [1.63218580, -0.316491420, -0.240020], - [1.60771501, -0.315952021, -0.304940], - [1.57945958, -0.318684815, -0.363551], - [1.54829413, -0.317704783, -0.433810]] - - # C4 - G - notes['sampXYZ-G'] = [[1.53927586, 0.316218900, 0.495340], - [1.55416224, 0.317882549, 0.414281], - [1.58637810, 0.317035251, 0.348142], - [1.61420646, 0.318080523, 0.286890], - [1.63678831, 0.316923505, 0.223451], - [1.65359660, 0.311701203, 0.158320], - [1.66476593, 0.316589819, 0.091980], - [1.67003280, 0.315827173, 0.024930], - [1.66972635, 0.316856021, -0.042300], - [1.66309487, 0.316981217, -0.109200], - [1.65082120, 0.317274875, -0.175280], - [1.63294007, 0.317606267, -0.240020], - [1.60813816, 0.318085317, -0.304940], - [1.58034273, 0.317932644, -0.363551], - [1.54951659, 0.316900258, -0.433810]] - - notes['sampXYZ-D'] = np.array(notes['sampXYZ-D']) - notes['sampXYZ-G'] = np.array(notes['sampXYZ-G']) - return notes - -def get_notes2(): - notes = {} - # Samples from 3D drawings - (assumed identical to LH1) - notes['sampXYZ'] = [[-1991.385,-494.911, -2191.731], # Back - [-2133.133,-318.000, -2143.935], # Back - [-3205.596,-318.000, -3043.838], # Back - [-3205.596, 318.000, -3043.838], # Back - [-2133.133, 318.000, -2143.935], # Back - [-1991.385, 494.911, -2191.731], # Back - [-1952.407, 504.105, -2020.357], # First pt - [-1917.893, 504.799, -2020.259], - [-1919.621, 465.078, -2021.709], - [-1953.944, 468.768, -2021.646], # bottom - [-1954.102, 467.342, -2021.779], # bottom - [-1919.804, 463.423, -2021.863], - [-1926.790, 424.698, -2027.724], - [-1960.317, 432.890, -2026.994], # bottom - [-1960.662, 431.522, -2027.284], # bottom - [-1927.191, 423.110, -2028.061], - [-1939.221, 386.556, -2038.156], - [-1971.365, 399.002, -2036.265], # bottom - [-1972.262, 397.685, -2035.711], # bottom - [-1939.844, 385.107, -2038.678], - [-1951.819, 356.614, -2048.726], - [-1984.237, 369.192, -2045.760], # bottom - [-1985.046, 367.162, -2046.439], # bottom - [-1952.225, 355.596, -2049.067], - [-1963.236, 326.447, -2058.307], - [-1996.058, 338.013, -2055.679], # bottom - [-1996.799, 335.939, -2056.300], # bottom - [-1963.608, 325.407, -2058.618], - [-1973.635, 295.659, -2067.032], - [-2006.826, 306.191, -2064.714], # bottom - [-2007.497, 304.077, -2065.277], # bottom - [-1973.971, 294.599, -2067.314], - [-1982.995, 264.308, -2074.886], - [-2016.520, 273.786, -2072.849], # bottom - [-2017.120, 271.635, -2073.352], # bottom - [-1983.296, 263.230, -2075.138], - [-1991.298, 232.454, -2081.853], - [-2025.123, 240.860, -2080.067], # bottom - [-2025.650, 238.677, -2080.509], # bottom - [-1991.563, 231.360, -2082.075], - [-1998.529, 200.158, -2087.921], - [-2032.617, 207.476, -2086.355], # bottom - [-2033.070, 205.265, -2086.736], # bottom - [-1998.757, 199.049, -2088.112], - [-2004.675, 167.481, -2093.077], - [-2038.988, 173.696, -2091.701], # bottom - [-2039.367, 171.461, -2092.020], # bottom - [-2004.865, 166.360, -2093.237], - [-2009.722, 134.484, -2097.313], - [-2044.224, 139.586, -2096.095], # bottom - [-2044.529, 137.332, -2096.351], # bottom - [-2009.875, 133.354, -2097.441], - [-2013.662, 101.232, -2100.619], - [-2048.316, 105.210, -2099.529], # bottom - [-2048.545, 102.941, -2099.721], # bottom - [-2013.777, 100.094, -2100.715], - [-2016.487, 67.787, -2102.989], - [-2051.255, 70.634, -2101.995], # bottom - [-2051.408, 68.354, -2102.123], # bottom - [-2016.564, 66.644, -2103.054], - [-2018.192, 34.213, -2104.420], - [-2053.037, 35.923, -2103.490], # bottom - [-2053.113, 33.637, -2103.554], # bottom - [-2018.231, 33.066, -2104.452], - [-2018.774, 0.574, -2104.908], - [-2053.656, 1.144, -2104.009], # bottom - [-2053.656, -1.144, -2104.009], # bottom - [-2018.774, -0.574, -2104.908], - [-2018.231, -33.066, -2104.452], - [-2053.113, -33.637, -2103.554], # bottom - [-2053.037, -35.923, -2103.490], # bottom - [-2018.192, -34.213, -2104.420], - [-2016.564, -66.644, -2103.054], - [-2051.408, -68.354, -2102.123], # bottom - [-2051.255, -70.634, -2101.995], # bottom - [-2016.487, -67.787, -2102.989], - [-2013.777,-100.094, -2100.715], - [-2048.545,-102.941, -2099.721], # bottom - [-2048.316,-105.210, -2099.529], # bottom - [-2013.662,-101.232, -2100.619], - [-2009.875,-133.354, -2097.441], - [-2044.529,-137.332, -2096.351], # bottom - [-2044.224,-139.586, -2096.095], # bottom - [-2009.722,-134.484, -2097.131], - [-2004.865,-166.360, -2093.237], - [-2039.367,-171.461, -2092.020], # bottom - [-2038.988,-173.696, -2091.701], # bottom - [-2004.675,-167.481, -2093.077], - [-1998.757,-199.049, -2088.112], - [-2033.070,-205.265, -2086.736], # bottom - [-2032.617,-207.476, -2086.355], # bottom - [-1998.529,-200.158, -2087.921], - [-1991.523,-231.360, -2082.075], - [-2025.650,-238.677, -2080.509], # bottom - [-2025.123,-240.860, -2080.067], # bottom - [-1991.298,-232.454, -2081.853], - [-1983.296,-263.230, -2075.138], - [-2017.120,-271.635, -2073.352], # bottom - [-2016.520,-273.786, -2072.849], # bottom - [-1982.995,-264.308, -2074.886], - [-1973.971,-294.599, -2067.314], - [-2007.497,-304.077, -2065.277], # bottom - [-2006.826,-306.191, -2064.714], # bottom - [-1973.635,-295.659, -2067.032], - [-1963.608,-325.407, -2058.618], - [-1996.799,-335.939, -2056.300], # bottom - [-1996.058,-338.013, -2055.679], # bottom - [-1963.236,-326.447, -2058.307], - [-1952.225,-355.596, -2049.067], - [-1985.046,-367.162, -2046.439], # bottom - [-1984.237,-369.192, -2045.760], # bottom - [-1951.819,-356.614, -2048.726], - [-1939.844,-385.107, -2038.678], - [-1972.262,-397.685, -2035.711], # bottom - [-1971.365,-399.002, -2036.265], # bottom - [-1939.221,-386.556, -2038.156], - [-1927.191,-423.110, -2028.061], - [-1960.662,-431.522, -2027.284], # bottom - [-1960.317,-432.890, -2026.994], # bottom - [-1926.790,-424.698, -2027.724], - [-1919.804,-463.423, -2021.863], - [-1954.102,-467.342, -2021.779], # bottom - [-1953.944,-468.768, -2021.646], # bottom - [-1919.621,-465.078, -2021.709], - [-1917.893,-504.799, -2020.259], - [-1952.407,-504.105, -2020.357]] - notes['sampXYZ'] = np.array(notes['sampXYZ']) - nn = notes['sampXYZ'].shape[0] - ind = np.arange(8,nn-4,4) - notes['indedges'] = np.array([ind,ind+3]) - ind = np.arange(9,nn-4,4) - notes['indbottom'] = np.unique(np.array([ind,ind+1]).ravel()) - return notes - -def make_Poly(save=_save, path=_here): - notes = get_notes2() - Rref, Rmax = 3., 3.4 - - #D1, G1 = notes['sampXYZ-D'], notes['sampXYZ-G'] - #R = np.mean(np.vstack((D1[:,0],G1[:,0])),axis=0) - #Z = np.mean(np.vstack((D1[:,2],G1[:,2])),axis=0) - R = np.hypot(notes['sampXYZ'][:,0],notes['sampXYZ'][:,2])/1000. - Z = notes['sampXYZ'][:,1]/1000. - #R = R-np.max(R)+Rref - #Poly0 = np.array([np.r_[R, Rmax, Rmax], np.r_[Z,np.min(Z),np.max(Z)]]) - R = R-np.min(R[np.abs(Z)<0.01])+Rref - R[2:4] = Rmax - - Poly1 = np.array([R,Z]) - ind = notes['indedges'] - Ptemp = 0.5*(Poly1[:,ind[0,:]] + Poly1[:,ind[1,:]]) - Poly0 = np.concatenate((Poly1[:,:ind[0,0]], Ptemp, - Poly1[:,ind[1,-1]+1:]),axis=1) - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1) - return Poly0, Poly1, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_V0.txt deleted file mode 100644 index c52c761ba..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_V0.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.044780693243757774e+00 3.107833904684217163e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.107833904684217163e+00 3.044780693243757774e+00 2.893059712127533434e+00 2.869115048167717230e+00 2.871475220568535214e+00 2.880915079803645362e+00 2.897184470647450105e+00 2.913386258869197665e+00 2.928176206214729405e+00 2.941644655680222709e+00 2.953766325423418770e+00 2.964516663994923640e+00 2.973876076688413583e+00 2.981826377056054689e+00 2.988352293009314931e+00 2.993440622120721262e+00 2.997082113834418138e+00 2.999269995011077938e+00 3.000000000000000000e+00 2.999269995011077938e+00 2.997082113834418138e+00 2.993440622120721262e+00 2.988286590271198140e+00 2.981826377056054689e+00 2.973876076688413583e+00 2.964502839567379588e+00 2.953766325423418770e+00 2.941644655680222709e+00 2.928176206214729405e+00 2.913386258869197665e+00 2.897184470647450105e+00 2.880915079803645362e+00 2.871475220568535214e+00 2.869115048167717230e+00 2.893059712127533434e+00 --4.949109999999999898e-01 -3.180000000000000049e-01 -3.180000000000000049e-01 3.180000000000000049e-01 3.180000000000000049e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.642505000000000104e-01 4.239039999999999475e-01 3.858314999999999939e-01 3.561050000000000049e-01 3.259269999999999667e-01 2.951289999999999747e-01 2.637690000000000312e-01 2.319070000000000020e-01 1.996034999999999893e-01 1.669204999999999994e-01 1.339190000000000103e-01 1.006630000000000025e-01 6.721550000000001135e-02 3.363950000000000273e-02 0.000000000000000000e+00 -3.363950000000000273e-02 -6.721550000000001135e-02 -1.006630000000000025e-01 -1.339190000000000103e-01 -1.669204999999999994e-01 -1.996034999999999893e-01 -2.319070000000000020e-01 -2.637690000000000312e-01 -2.951289999999999747e-01 -3.259269999999999667e-01 -3.561050000000000049e-01 -3.858314999999999939e-01 -4.239039999999999475e-01 -4.642505000000000104e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_V1.txt deleted file mode 100644 index a4ea770e1..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_LH2_V1.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.044780693243757774e+00 3.107833904684217163e+00 3.399999999999999911e+00 3.399999999999999911e+00 3.107833904684217163e+00 3.044780693243757774e+00 2.893059712127533434e+00 2.869115048167717230e+00 2.871356378445165003e+00 2.895054712512507678e+00 2.895260149838732033e+00 2.871594062691905869e+00 2.880654819392295174e+00 2.903329301636539128e+00 2.903777601803601005e+00 2.881175340214995995e+00 2.896780664414922324e+00 2.917674381907263914e+00 2.917900461640007936e+00 2.897588276879977887e+00 2.913122788147675557e+00 2.933450727161458715e+00 2.934501378337782462e+00 2.913649729590719772e+00 2.927935306141395522e+00 2.948801343380880624e+00 2.949763071809159865e+00 2.928417106288062843e+00 2.941426659002225996e+00 2.962784989008413028e+00 2.963656386303281653e+00 2.941862652358219421e+00 2.953571252549659132e+00 2.975375333992480442e+00 2.976154255184515929e+00 2.953961398297178853e+00 2.964344863811784414e+00 2.986548141768861964e+00 2.987232463341812583e+00 2.964688464178063310e+00 2.973728259248752170e+00 2.996281368108780985e+00 2.996870381410558171e+00 2.974023894128074996e+00 2.981702890860188138e+00 3.004556496895482542e+00 3.005049476279062048e+00 2.981949863251920796e+00 2.988253155515101511e+00 3.011357863027227300e+00 3.011754085023580441e+00 2.988451430503528350e+00 2.993366180933850540e+00 3.016673350655395769e+00 3.016970697067113960e+00 2.993515063307591983e+00 2.997032009376604744e+00 3.020490867071005781e+00 3.020689333367970519e+00 2.997132218292231531e+00 2.999244949959060769e+00 3.022805413067019664e+00 3.022904297751372038e+00 2.999295040063095108e+00 3.000000000000000000e+00 3.023609184170302555e+00 3.023609184170302555e+00 3.000000000000000000e+00 2.999295040063095108e+00 3.022904297751372038e+00 3.022805413067019664e+00 2.999244949959060769e+00 2.997132218292231531e+00 3.020689333367970519e+00 3.020490867071005781e+00 2.997032009376604744e+00 2.993515063307591983e+00 3.016970697067113960e+00 3.016673350655395769e+00 2.993366180933850540e+00 2.988451430503528350e+00 3.011754085023580441e+00 3.011357863027227300e+00 2.988121750038867930e+00 2.981949863251920796e+00 3.005049476279062048e+00 3.004556496895482542e+00 2.981702890860188138e+00 2.974023894128074996e+00 2.996870381410558171e+00 2.996281368108780985e+00 2.973728259248752170e+00 2.964660815322974763e+00 2.987232463341812583e+00 2.986548141768861964e+00 2.964344863811784414e+00 2.953961398297178853e+00 2.976154255184515929e+00 2.975375333992480442e+00 2.953571252549659132e+00 2.941862652358219421e+00 2.963656386303281653e+00 2.962784989008413028e+00 2.941426659002225996e+00 2.928417106288062843e+00 2.949763071809159865e+00 2.948801343380880624e+00 2.927935306141395522e+00 2.913649729590719772e+00 2.934501378337782462e+00 2.933450727161458715e+00 2.913122788147675557e+00 2.897588276879977887e+00 2.917900461640007936e+00 2.917674381907263914e+00 2.896780664414922324e+00 2.881175340214995995e+00 2.903777601803601005e+00 2.903329301636539128e+00 2.880654819392295174e+00 2.871594062691905869e+00 2.895260149838732033e+00 2.895054712512507678e+00 2.871356378445165003e+00 2.869115048167717230e+00 2.893059712127533434e+00 --4.949109999999999898e-01 -3.180000000000000049e-01 -3.180000000000000049e-01 3.180000000000000049e-01 3.180000000000000049e-01 4.949109999999999898e-01 5.041050000000000253e-01 5.047989999999999977e-01 4.650779999999999914e-01 4.687679999999999625e-01 4.673419999999999797e-01 4.634230000000000294e-01 4.246979999999999644e-01 4.328899999999999970e-01 4.315220000000000167e-01 4.231099999999999861e-01 3.865560000000000107e-01 3.990020000000000233e-01 3.976850000000000107e-01 3.851070000000000326e-01 3.566139999999999866e-01 3.691920000000000202e-01 3.671619999999999884e-01 3.555960000000000232e-01 3.264469999999999872e-01 3.380129999999999524e-01 3.359390000000000431e-01 3.254070000000000018e-01 2.956590000000000051e-01 3.061909999999999910e-01 3.040769999999999862e-01 2.945989999999999998e-01 2.643079999999999874e-01 2.737859999999999738e-01 2.716350000000000153e-01 2.632300000000000195e-01 2.324539999999999940e-01 2.408600000000000185e-01 2.386770000000000003e-01 2.313600000000000101e-01 2.001579999999999748e-01 2.074759999999999938e-01 2.052649999999999753e-01 1.990490000000000037e-01 1.674809999999999910e-01 1.736959999999999893e-01 1.714610000000000023e-01 1.663600000000000079e-01 1.344840000000000202e-01 1.395860000000000156e-01 1.373319999999999819e-01 1.333540000000000003e-01 1.012320000000000025e-01 1.052099999999999980e-01 1.029410000000000047e-01 1.000939999999999885e-01 6.778700000000000003e-02 7.063400000000000234e-02 6.835399999999999809e-02 6.664400000000000879e-02 3.421300000000000036e-02 3.592300000000000354e-02 3.363700000000000023e-02 3.306600000000000511e-02 5.739999999999999660e-04 1.143999999999999835e-03 -1.143999999999999835e-03 -5.739999999999999660e-04 -3.306600000000000511e-02 -3.363700000000000023e-02 -3.592300000000000354e-02 -3.421300000000000036e-02 -6.664400000000000879e-02 -6.835399999999999809e-02 -7.063400000000000234e-02 -6.778700000000000003e-02 -1.000939999999999885e-01 -1.029410000000000047e-01 -1.052099999999999980e-01 -1.012320000000000025e-01 -1.333540000000000003e-01 -1.373319999999999819e-01 -1.395860000000000156e-01 -1.344840000000000202e-01 -1.663600000000000079e-01 -1.714610000000000023e-01 -1.736959999999999893e-01 -1.674809999999999910e-01 -1.990490000000000037e-01 -2.052649999999999753e-01 -2.074759999999999938e-01 -2.001579999999999748e-01 -2.313600000000000101e-01 -2.386770000000000003e-01 -2.408600000000000185e-01 -2.324539999999999940e-01 -2.632300000000000195e-01 -2.716350000000000153e-01 -2.737859999999999738e-01 -2.643079999999999874e-01 -2.945989999999999998e-01 -3.040769999999999862e-01 -3.061909999999999910e-01 -2.956590000000000051e-01 -3.254070000000000018e-01 -3.359390000000000431e-01 -3.380129999999999524e-01 -3.264469999999999872e-01 -3.555960000000000232e-01 -3.671619999999999884e-01 -3.691920000000000202e-01 -3.566139999999999866e-01 -3.851070000000000326e-01 -3.976850000000000107e-01 -3.990020000000000233e-01 -3.865560000000000107e-01 -4.231099999999999861e-01 -4.315220000000000167e-01 -4.328899999999999970e-01 -4.246979999999999644e-01 -4.634230000000000294e-01 -4.673419999999999797e-01 -4.687679999999999625e-01 -4.650779999999999914e-01 -5.047989999999999977e-01 -5.041050000000000253e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_Notes.py deleted file mode 100755 index cdf982a6f..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_Notes.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - """ By convention : D is a length of the element, d is a gap """ - - notes = {'DPhi':{}} - # Toroidal width (mm, inner outer) - notes['DPhi']['In'] = 44.000 - notes['DPhi']['Out'] = 44.000 - - notes['nbtor'] = 6 - - notes['DL'] = 284.000 - notes['DZ'] = 30.023 - - # sampleXZY - notes['sampleXZY'] = [[-1218.000, 836.000, 2109.638], - [-1218.000, 805.994, 2109.638], - [-1357.000, 805.994, 2350.393], - [-1358.161, 806.468, 2352.403], - [-1359.121, 807.751, 2354.067], - [-1359.763, 809.674, 2355.180], - [-1360.000, 811.994, 2355.589], - [-1360.000, 827.000, 2355.589]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - - -def make_Poly(save=_save, path=_here): - notes = get_notes() - - Poly = np.array([np.hypot(notes['sampleXZY'][:,0],notes['sampleXZY'][:,2]), - notes['sampleXZY'][:,1]]) - Polymin = Poly[:,[0,1,2,6,7]] - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Polymin.T) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly.T) - return Poly, notes - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_V0.txt deleted file mode 100644 index bb2a7fccf..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_V0.txt +++ /dev/null @@ -1,5 +0,0 @@ -2.436000100788996203e+00 8.359999999999999654e-01 -2.436000100788996203e+00 8.059940000000000992e-01 -2.714000046877118155e+00 8.059940000000000992e-01 -2.719999914875182778e+00 8.119939999999999936e-01 -2.719999914875182778e+00 8.270000000000000684e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_V1.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_V1.txt deleted file mode 100644 index 43c0b1aef..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PFC_Ripple_V1.txt +++ /dev/null @@ -1,8 +0,0 @@ -2.436000100788996203e+00 8.359999999999999654e-01 -2.436000100788996203e+00 8.059940000000000992e-01 -2.714000046877118155e+00 8.059940000000000992e-01 -2.716321257938758560e+00 8.064679999999999627e-01 -2.718242324210628613e+00 8.077509999999999968e-01 -2.719527210485123803e+00 8.096740000000000048e-01 -2.719999914875182778e+00 8.119939999999999936e-01 -2.719999914875182778e+00 8.270000000000000684e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_PlasmaDomain_Standard_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_PlasmaDomain_Standard_Notes.py deleted file mode 100755 index 35fc5a7ef..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_PlasmaDomain_Standard_Notes.py +++ /dev/null @@ -1,206 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import os -import argparse - -# Common -import numpy as np - -# tofu_west -from WEST_PFC_BumperInner_Notes import make_Poly as InBump -#from tofu_west.VesStruct.Inputs.WEST_Struct_VDE_Notes import make_Poly as VDE -from WEST_PFC_Ripple_Notes import make_Poly as Ripple -from WEST_PFC_DivLowGC_Notes import make_Poly as LowDiv -from WEST_PFC_DivUp_Notes import make_Poly as UpDiv -#from tofu_west.VesStruct.Inputs.WEST_Struct_Baffle_Notes import make_Poly as Baffle - - - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - - -def get_notes_UpDivSupport(): - notes = {} - # sampleXZY - notes['sampleXZY'] = [[780.663, 799.580, -2162.398], - [665.129, 663.100, -1844.969], - [662.219, 661.100, -1819.433], - [699.823, 661.100, -1744.892]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def get_notes_PEI(): - - notes = {} - # Number of panles in toroidal direction - notes['nbPhi'] = 30 - # Toroidal width in equatorial plane - notes['DPhi'] = 343.653 - - # sampleXZY - notes['sampleXZY'] = [[1323.509, 648.510, -1332.719], - [1312.213, 555.372, -1312.213], - [1261.223, 442.976, -1323.715], - [1239.370, 155.735, -1299.672], - [1532.443, 049.922, -921.707], - [1311.454, 000.000, -1217.927], - [1532.443,-049.922, -921.707], - [1239.370,-155.735, -1299.672], - [1261.223,-442.976, -1325.715], - [1312.213,-555.372, -1312.213], - [1292.845,-648.518, -1347.774]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - -def get_notes_LowDivSupport(): - notes = {} - # sampleXZY - notes['sampleXZY'] = [[1861.032, -658.200, 266.381], - [1906.785, -658.200, 336.218], - [1931.405, -660.200, 340.559], - [2262.225, -795.922, 398.891]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - -def get_notes_LFS(): - notes = {} - # sampleXZY - notes['sampleXZY'] = [[2415.303, -797.969, -1325.194], - [2467.984, -779.176, -1355.609], - [2517.375, -750.879, -1384.125], - [2562.071, -717.338, -1409.930], - [2604.414, -680.461, -1434.377], - [2644.704, -639.931, -1457.639], - [2682.678, -595.887, -1479.563], - [2716.153, -551.311, -1498.890], - [2747.786, -502.835, -1517.153], - [2777.383, -450.254, -1534.241], - [2802.909, -396.912, -1554.978], - [2824.881, -342.348, -1561.664], - [2844.618, -282.957, -1573.059], - [2859.326, -226.839, -1581.551], - [2871.246, -167.234, -1588.432], - [2879.653, -105.919, -1593.286], - [2884.292, -043.463, -1596.035], - [2885.066, 015.167, -1596.412], - [2882.103, 080.155, -1594.701], - [2876.169, 133.956, -1591.275], - [2864.513, 195.563, -1587.924], - [2850.877, 260.786, -1576.673], - [2834.388, 315.143, -1567.152], - [2813.764, 370.994, -1555.245], - [2786.949, 431.177, -1539.764], - [2763.249, 476.096, -1526.080], - [2731.774, 528.094, -1507.908], - [2698.419, 575.507, -1488.651], - [2660.113, 622.771, -1466.535], - [2620.738, 664.693, -1443.802], - [2579.993, 702.297, -1420.278], - [2537.090, 736.594, -1395.507], - [2486.115, 771.280, -1366.077], - [2444.330, 795.360, -1341.952], - [2392.328, 820.525, -1311.929], - [2342.744, 839.444, -1283.302], - [2294.217, 853.544, -1255.285], - [2244.367, 863.562, -1226.504], - [2192.957, 869.452, -1196.822]] - notes['sampleXZY'] = np.array(notes['sampleXZY']) - for kk in notes.keys(): - if type(notes[kk]) is dict: - notes[kk]['In'] = notes[kk]['In']*1.e-3 - notes[kk]['Out'] = notes[kk]['Out']*1.e-3 - elif not 'nb' in kk: - notes[kk] = notes[kk]*1.e-3 - return notes - - -def make_Poly(save=_save, path=_here): - - nup = get_notes_UpDivSupport() - nin = get_notes_PEI() - nlow = get_notes_LowDivSupport() - nout = get_notes_LFS() - - Rup = np.hypot(nup['sampleXZY'][:,0],nup['sampleXZY'][:,2]) - Zup = nup['sampleXZY'][:,1] - Rin = np.hypot(nin['sampleXZY'][:,0],nin['sampleXZY'][:,2]) - Zin = nin['sampleXZY'][:,1] - Rlow = np.hypot(nlow['sampleXZY'][:,0],nlow['sampleXZY'][:,2]) - Zlow = nlow['sampleXZY'][:,1] - Rout = np.hypot(nout['sampleXZY'][:,0],nout['sampleXZY'][:,2]) - Zout = nout['sampleXZY'][:,1] - - indneg = (Zout>0).nonzero()[0][0] - Rout = np.r_[Rout[:indneg], 3.2977, Rout[indneg:]] - Zout = np.r_[Zout[:indneg], 0., Zout[indneg:]] - - Poly = np.array([np.r_[Rup,Rin,Rlow,Rout], np.r_[Zup,Zin,Zlow,Zout]]) - - # Make V0 (inc. inner bumpers, up/low div, VDE/ripple and baffle) - PIn = InBump()[0] - PRip = Ripple()[0] - PLD = LowDiv()[0] - PUD = UpDiv()[0][:,::-1] - PVDE = np.loadtxt(os.path.join(path,'WEST_PFC_VDE_V0.txt')).T - PBa = np.loadtxt(os.path.join(path,'WEST_PFC_Baffle_V0.txt')).T - ind = (Poly[0,:]>2.75) & (Poly[1,:]<0.78) - Poly0 = [PVDE[:,:2],PUD[:,1:-1],PIn[:,2:-2],PLD[:,1:-1], - PBa[:,6:-7],Poly[:,ind]] - Poly0 = np.concatenate(tuple(Poly0),axis=1) - - # Poly1 - ind0 = (Poly[0,:]<1.9) & (Poly[1,:]>-0.6) & (Poly[1,:]<0.6) - ind = Poly[0,:]>2.47 - Poly1 = [PUD[:,1:-1],Poly[:,ind0],PLD[:,1:-1], - PBa[:,2:-2],Poly[:,ind]] - Poly1 = np.concatenate(tuple(Poly1),axis=1) - - if save: - cstr = '%s_%s'%(_Exp,_Cls) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, Poly0.T) - pathfilext = os.path.join(path, cstr+'_V1.txt') - np.savetxt(pathfilext, Poly1.T) - pathfilext = os.path.join(path, cstr+'_V2.txt') - np.savetxt(pathfilext, Poly.T) - return Poly0, Poly1, Poly, (nup,nin,nlow,nout) - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesIn_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesIn_Notes.py deleted file mode 100755 index 2a8eda37b..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesIn_Notes.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - # Notes from creoView/python (R,Z) - notes = {'C': np.r_[2.422, 0.], - 'r_in': 1.882/2., - 'r_out': 1.992/2.} # r_out for later use (thick) - - return notes - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - C = notes['C'] - nP = 100 - theta = np.linspace(0.,2*np.pi, nP, endpoint=False) - P = np.array([C[0]+notes['r_in']*np.cos(theta), - C[1]+notes['r_in']*np.sin(theta)]) - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, P) - return P, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) - - diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesIn_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesIn_V0.txt deleted file mode 100644 index 50c187c8e..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesIn_V0.txt +++ /dev/null @@ -1,2 +0,0 @@ -3.362999999999999989e+00 3.361143151451003508e+00 3.355579933936923887e+00 3.346332302935696390e+00 3.333436754622042031e+00 3.316944181833739513e+00 3.296919673220844782e+00 3.273442256370524550e+00 3.246604585921275543e+00 3.216512577897396419e+00 3.183284991706825551e+00 3.147052961452017961e+00 3.107959478403548470e+00 3.066158826678896165e+00 3.021815974353517120e+00 2.975105922407217385e+00 2.926213014075235819e+00 2.875330207329714227e+00 2.822658313362733651e+00 2.768405204076282100e+00 2.712784991706825632e+00 2.656017183822128480e+00 2.598325817025167073e+00 2.539938572784010251e+00 2.481085878877083761e+00 2.422000000000000153e+00 2.362914121122916100e+00 2.304061427215989610e+00 2.245674182974833233e+00 2.187982816177871825e+00 2.131215008293174673e+00 2.075594795923718205e+00 2.021341686637266655e+00 1.968669792670286078e+00 1.917786985924764043e+00 1.868894077592782921e+00 1.822184025646483185e+00 1.777841173321104140e+00 1.736040521596451836e+00 1.696947038547982345e+00 1.660715008293174755e+00 1.627487422102603887e+00 1.597395414078724540e+00 1.570557743629475755e+00 1.547080326779155524e+00 1.527055818166260570e+00 1.510563245377958275e+00 1.497667697064304138e+00 1.488420066063076419e+00 1.482856848548996798e+00 1.481000000000000316e+00 1.482856848548996798e+00 1.488420066063076419e+00 1.497667697064304360e+00 1.510563245377958275e+00 1.527055818166260792e+00 1.547080326779155746e+00 1.570557743629475755e+00 1.597395414078724762e+00 1.627487422102604109e+00 1.660715008293174755e+00 1.696947038547982789e+00 1.736040521596451836e+00 1.777841173321104140e+00 1.822184025646483185e+00 1.868894077592782921e+00 1.917786985924764487e+00 1.968669792670286078e+00 2.021341686637267099e+00 2.075594795923718205e+00 2.131215008293174673e+00 2.187982816177872269e+00 2.245674182974833233e+00 2.304061427215990498e+00 2.362914121122916544e+00 2.422000000000000153e+00 2.481085878877084205e+00 2.539938572784010251e+00 2.598325817025167517e+00 2.656017183822128480e+00 2.712784991706825632e+00 2.768405204076282544e+00 2.822658313362733651e+00 2.875330207329714671e+00 2.926213014075235819e+00 2.975105922407217829e+00 3.021815974353517120e+00 3.066158826678896165e+00 3.107959478403548914e+00 3.147052961452017961e+00 3.183284991706825995e+00 3.216512577897396419e+00 3.246604585921275543e+00 3.273442256370524550e+00 3.296919673220844782e+00 3.316944181833739513e+00 3.333436754622042031e+00 3.346332302935696390e+00 3.355579933936923887e+00 3.361143151451003508e+00 -0.000000000000000000e+00 5.908587887708387915e-02 1.179385727840103065e-01 1.763258170251668644e-01 2.340171838221283551e-01 2.907849917068254797e-01 3.464052040762819473e-01 4.006583133627333870e-01 4.533302073297140744e-01 5.042130140752357770e-01 5.531059224072172320e-01 5.998159743535169675e-01 6.441588266788960127e-01 6.859594784035482062e-01 7.250529614520176969e-01 7.612849917068255090e-01 7.945125778973961550e-01 8.246045859212757234e-01 8.514422563705243974e-01 8.749196732208445182e-01 8.949441818337394716e-01 9.114367546220417671e-01 9.243323029356960152e-01 9.335799339369236227e-01 9.391431514510034662e-01 9.409999999999999476e-01 9.391431514510034662e-01 9.335799339369235117e-01 9.243323029356959042e-01 9.114367546220417671e-01 8.949441818337394716e-01 8.749196732208445182e-01 8.514422563705242863e-01 8.246045859212755014e-01 7.945125778973960440e-01 7.612849917068255090e-01 7.250529614520176969e-01 6.859594784035480952e-01 6.441588266788959016e-01 5.998159743535168564e-01 5.531059224072173430e-01 5.042130140752357770e-01 4.533302073297139634e-01 4.006583133627332205e-01 3.464052040762817253e-01 2.907849917068252021e-01 2.340171838221283829e-01 1.763258170251668089e-01 1.179385727840101400e-01 5.908587887708365710e-02 -3.026486826691430074e-16 -5.908587887708385833e-02 -1.179385727840103204e-01 -1.763258170251670032e-01 -2.340171838221285494e-01 -2.907849917068258128e-01 -3.464052040762822804e-01 -4.006583133627333315e-01 -4.533302073297141299e-01 -5.042130140752358880e-01 -5.531059224072174541e-01 -5.998159743535171895e-01 -6.441588266788960127e-01 -6.859594784035482062e-01 -7.250529614520176969e-01 -7.612849917068253980e-01 -7.945125778973963770e-01 -8.246045859212756124e-01 -8.514422563705246194e-01 -8.749196732208445182e-01 -8.949441818337394716e-01 -9.114367546220418781e-01 -9.243323029356960152e-01 -9.335799339369236227e-01 -9.391431514510034662e-01 -9.409999999999999476e-01 -9.391431514510034662e-01 -9.335799339369236227e-01 -9.243323029356959042e-01 -9.114367546220417671e-01 -8.949441818337395826e-01 -8.749196732208444072e-01 -8.514422563705243974e-01 -8.246045859212753903e-01 -7.945125778973960440e-01 -7.612849917068250649e-01 -7.250529614520174748e-01 -6.859594784035482062e-01 -6.441588266788956796e-01 -5.998159743535169675e-01 -5.531059224072166769e-01 -5.042130140752355549e-01 -4.533302073297140744e-01 -4.006583133627329429e-01 -3.464052040762818363e-01 -2.907849917068249246e-01 -2.340171838221280498e-01 -1.763258170251669199e-01 -1.179385727840098624e-01 -5.908587887708377506e-02 diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesOut_Notes.py b/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesOut_Notes.py deleted file mode 100755 index 76a648821..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesOut_Notes.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -import os -import argparse - -import numpy as np - -_save = True -_here = os.path.abspath(os.path.dirname(__file__)) -_Exp, _Cls, _name = os.path.split(__file__)[1].split('_')[:3] -assert not any([any([ss in s for ss in ['Notes','.']]) - for s in [_Exp, _Cls, _name]]) - -def get_notes(): - - # Notes from creoView (-X,Z,Y) - notes = {'C': np.r_[2.465, 0.], - 'r_in': 3.162/2., # r_out for later use (thick) - 'r_out': 3.292/2.} - return notes - -def make_Poly(save=_save, path=_here): - - notes = get_notes() - - C = notes['C'] - nP = 100 - theta = np.linspace(0.,2*np.pi, nP, endpoint=False) - P = np.array([C[0]+notes['r_out']*np.cos(theta), - C[1]+notes['r_out']*np.sin(theta)]) - - if save: - cstr = '%s_%s_%s'%(_Exp,_Cls,_name) - pathfilext = os.path.join(path, cstr+'_V0.txt') - np.savetxt(pathfilext, P) - return P, notes - - - -if __name__=='__main__': - - # Parse input arguments - msg = 'Launch creation of polygons txt from bash' - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-save', type=bool, help='save ?', default=_save) - parser.add_argument('-path', type=str, help='saving path ?', default=_here) - - args = parser.parse_args() - - # Call wrapper function - make_Poly(save=args.save, path=args.path) - - diff --git a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesOut_V0.txt b/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesOut_V0.txt deleted file mode 100644 index 7508a24cb..000000000 --- a/tofu/tests/tests01_geom/tests03_core_data/WEST_Ves_VesOut_V0.txt +++ /dev/null @@ -1,2 +0,0 @@ -4.110999999999999766e+00 4.107751994992934641e+00 4.098020798363630313e+00 4.081844814699421065e+00 4.059287883217726822e+00 4.030439025821822341e+00 3.995412095772061356e+00 3.954345328359067935e+00 3.907400795352199196e+00 3.854763765376316265e+00 3.796641972741163329e+00 3.733264797608948804e+00 3.664882360735643108e+00 3.591764536358621029e+00 3.514199887126342681e+00 3.432494525273410257e+00 3.346970904535428115e+00 3.257966547571423011e+00 3.165832713916109320e+00 3.070933013718979865e+00 2.973641972741163375e+00 2.874343554273350865e+00 2.773429643808102529e+00 2.671298502446844747e+00 2.568353195145249401e+00 2.464999999999999414e+00 2.361646804854749870e+00 2.258701497553154969e+00 2.156570356191896742e+00 2.055656445726648851e+00 1.956358027258836341e+00 1.859066986281019851e+00 1.764167286083890174e+00 1.672033452428576261e+00 1.583029095464571157e+00 1.497505474726589458e+00 1.415800112873656591e+00 1.338235463641378242e+00 1.265117639264356386e+00 1.196735202391050690e+00 1.133358027258836609e+00 1.075236234623683229e+00 1.022599204647800519e+00 9.756546716409317810e-01 9.345879042279381377e-01 8.995609741781771529e-01 8.707121167822731156e-01 8.481551853005782071e-01 8.319792016363694032e-01 8.222480050070650748e-01 8.189999999999999503e-01 8.222480050070650748e-01 8.319792016363694032e-01 8.481551853005784292e-01 8.707121167822731156e-01 8.995609741781771529e-01 9.345879042279383597e-01 9.756546716409320030e-01 1.022599204647800741e+00 1.075236234623683229e+00 1.133358027258836831e+00 1.196735202391051134e+00 1.265117639264356608e+00 1.338235463641378464e+00 1.415800112873657035e+00 1.497505474726589014e+00 1.583029095464572045e+00 1.672033452428576705e+00 1.764167286083891284e+00 1.859066986281020295e+00 1.956358027258836341e+00 2.055656445726649295e+00 2.156570356191897186e+00 2.258701497553155857e+00 2.361646804854750314e+00 2.464999999999999414e+00 2.568353195145250289e+00 2.671298502446844747e+00 2.773429643808103418e+00 2.874343554273350865e+00 2.973641972741162931e+00 3.070933013718980309e+00 3.165832713916109320e+00 3.257966547571423899e+00 3.346970904535428559e+00 3.432494525273411590e+00 3.514199887126343569e+00 3.591764536358621029e+00 3.664882360735643552e+00 3.733264797608948804e+00 3.796641972741163773e+00 3.854763765376317153e+00 3.907400795352199196e+00 3.954345328359067935e+00 3.995412095772061356e+00 4.030439025821822341e+00 4.059287883217726822e+00 4.081844814699421065e+00 4.098020798363630313e+00 4.107751994992934641e+00 -0.000000000000000000e+00 1.033531951452498071e-01 2.062985024468448059e-01 3.084296438081027270e-01 4.093435542733509513e-01 5.086419727411634062e-01 6.059330137189798959e-01 7.008327139161096841e-01 7.929665475714233747e-01 8.819709045354284793e-01 9.674945252734107326e-01 1.049199887126343267e+00 1.126764536358621616e+00 1.199882360735643250e+00 1.268264797608948946e+00 1.331641972741163471e+00 1.389763765376316629e+00 1.442400795352199561e+00 1.489345328359068077e+00 1.530412095772061720e+00 1.565439025821822705e+00 1.594287883217726742e+00 1.616844814699421651e+00 1.633020798363630455e+00 1.642751994992934783e+00 1.645999999999999908e+00 1.642751994992934783e+00 1.633020798363630233e+00 1.616844814699421429e+00 1.594287883217726742e+00 1.565439025821822705e+00 1.530412095772061720e+00 1.489345328359067855e+00 1.442400795352199117e+00 1.389763765376316629e+00 1.331641972741163471e+00 1.268264797608948946e+00 1.199882360735643250e+00 1.126764536358621172e+00 1.049199887126342823e+00 9.674945252734109546e-01 8.819709045354284793e-01 7.929665475714231526e-01 7.008327139161092401e-01 6.059330137189795629e-01 5.086419727411629621e-01 4.093435542733510069e-01 3.084296438081026159e-01 2.062985024468445283e-01 1.033531951452494185e-01 -5.293939762735487639e-16 -1.033531951452497655e-01 -2.062985024468448336e-01 -3.084296438081029490e-01 -4.093435542733513399e-01 -5.086419727411639613e-01 -6.059330137189804510e-01 -7.008327139161095731e-01 -7.929665475714234857e-01 -8.819709045354285903e-01 -9.674945252734110657e-01 -1.049199887126343711e+00 -1.126764536358621616e+00 -1.199882360735643250e+00 -1.268264797608949168e+00 -1.331641972741163249e+00 -1.389763765376317073e+00 -1.442400795352199339e+00 -1.489345328359068521e+00 -1.530412095772061720e+00 -1.565439025821822705e+00 -1.594287883217726742e+00 -1.616844814699421651e+00 -1.633020798363630455e+00 -1.642751994992934783e+00 -1.645999999999999908e+00 -1.642751994992934783e+00 -1.633020798363630455e+00 -1.616844814699421429e+00 -1.594287883217726742e+00 -1.565439025821822705e+00 -1.530412095772061498e+00 -1.489345328359068077e+00 -1.442400795352199117e+00 -1.389763765376316629e+00 -1.331641972741162805e+00 -1.268264797608948724e+00 -1.199882360735643250e+00 -1.126764536358620949e+00 -1.049199887126343045e+00 -9.674945252734098444e-01 -8.819709045354279242e-01 -7.929665475714233747e-01 -7.008327139161087960e-01 -6.059330137189797849e-01 -5.086419727411624070e-01 -4.093435542733504517e-01 -3.084296438081028380e-01 -2.062985024468440287e-01 -1.033531951452496267e-01 diff --git a/tofu/tests/tests01_geom/tests03_core_data/__init__.py b/tofu/tests/tests01_geom/tests03_core_data/__init__.py deleted file mode 100755 index e69de29bb..000000000 diff --git a/tofucalc.py b/tofucalc.py deleted file mode 100755 index 94ec39381..000000000 --- a/tofucalc.py +++ /dev/null @@ -1,166 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import sys -import os -import argparse - -# Generic -import matplotlib.pyplot as plt -plt.switch_backend('Qt5Agg') -plt.ioff() - -# tofu -# test if in a tofu git repo -_HERE = os.path.abspath(os.path.dirname(__file__)) -istofugit = False -if '.git' in _HERE and 'tofu' in _HERE: - istofugit = True - -if istofugit: - # Make sure we load the corresponding tofu - sys.path.insert(1,_HERE) - import tofu as tf - from tofu.imas2tofu import MultiIDSLoader - _ = sys.path.pop(1) -else: - import tofu as tf - from tofu.imas2tofu import MultiIDSLoader -tforigin = tf.__file__ -tfversion = tf.__version__ - -# if tf.__version__ < '1.4.1': - # msg = "tofuplot only works with tofu >= 1.4.1" - # raise Exception(msg) - -if 'imas2tofu' not in dir(tf): - msg = "imas does not seem to be available\n" - msg += " => tf.imas2tofu not available\n" - msg += " => tofuplot not available" - raise Exception(msg) - - - -################################################### -################################################### -# default values -################################################### - -_RUN = 0 -_USER = 'imas_public' -_TOKAMAK = 'west' -_VERSION = '3' -_LIDS_DIAG = MultiIDSLoader._lidsdiag -_LIDS = _LIDS_DIAG -_T0 = 'IGNITRON' -_SHAREX = False -_BCK = True - -################################################### -################################################### -# function -################################################### - -def _get_exception(q, ids, qtype='quantity'): - msg = MultiIDSLoader._shortcuts(ids=ids, - verb=False, return_=True) - col = ['ids', 'shortcut', 'long version'] - msg = MultiIDSLoader._getcharray(msg, col) - msg = """\nArgs quantity and quant_X must be valid tofu shortcuts - to quantities in ids %s\n\n""" - msg += "Available shortcuts are:\n"""%ids + msg - msg += "\n\nProvided:\n - %s: %s\n"%(qtype,str(qq)) - raise Exception(msg) - - -def call_tfcalcimas(shot=None, run=_RUN, user=_USER, - tokamak=_TOKAMAK, version=_VERSION, - ids=None, t0=_T0, - plot_compare=True, Brightness=None, - res=None, interp_t=None, - sharex=_SHAREX, indch=None, indch_auto=None, - background=_BCK): - - if t0.lower() == 'none': - t0 = None - - tf.calc_from_imas(shot=shot, run=run, user=user, - tokamak=tokamak, version=version, - ids=ids, indch=indch, indch_auto=indch_auto, - plot_compare=plot_compare, - Brightness=Brightness, res=res, interp_t=interp_t, - t0=t0, plot=True, sharex=sharex, bck=background) - - plt.show(block=True) - - - -################################################### -################################################### -# bash call (main) -################################################### - -def _str2bool(v): - if isinstance(v,bool): - return v - elif v.lower() in ['yes','true','y','t','1']: - return True - elif v.lower() in ['no','false','n','f','0']: - return False - else: - raise argparse.ArgumentTypeError('Boolean value expected !') - - -if __name__ == '__main__': - - # Parse input arguments - msg = """Fast interactive visualization tool for diagnostics data in - imas - - This is merely a wrapper around the function tofu.calc_from_imas() - It calculates synthetic signal (from imas) and displays it from the following - ids: - %s - """%repr(_LIDS) - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-s', '--shot', type=int, - help='shot number', required=True) - msg = 'username of the DB where the datafile is located' - parser.add_argument('-u','--user',help=msg, required=False, default=_USER) - msg = 'tokamak name of the DB where the datafile is located' - parser.add_argument('-t','--tokamak',help=msg, required=False, - default=_TOKAMAK) - parser.add_argument('-r','--run',help='run number', - required=False, type=int, default=_RUN) - parser.add_argument('-v','--version',help='version number', - required=False, type=str, default=_VERSION) - - msg = "ids from which to load diagnostics data, can be:\n%s"%repr(_LIDS) - parser.add_argument('-i', '--ids', type=str, required=True, - help=msg, nargs='+', choices=_LIDS) - parser.add_argument('-B', '--Brightness', type=bool, required=False, - help='Whether to express result as brightness', - default=None) - parser.add_argument('-res', '--res', type=float, required=False, - help='Space resolution for the LOS-discretization', - default=None) - parser.add_argument('-t0', '--t0', type=str, required=False, - help='Reference time event setting t = 0', default=_T0) - parser.add_argument('-ich', '--indch', type=int, required=False, - help='indices of channels to be loaded', - nargs='+', default=None) - parser.add_argument('-ichauto', '--indch_auto', type=bool, required=False, - help='automatically determine indices of channels to be loaded', - default=True) - parser.add_argument('-sx', '--sharex', type=_str2bool, required=False, - help='Should X axis be shared between diagnostics ids ?', - default=_SHAREX, const=True, nargs='?') - parser.add_argument('-bck', '--background', type=_str2bool, required=False, - help='Plot data enveloppe as grey background ?', - default=_BCK, const=True, nargs='?') - - args = parser.parse_args() - - # Call wrapper function - call_tfcalcimas(**dict(args._get_kwargs())) diff --git a/tofuplot.py b/tofuplot.py deleted file mode 100755 index f8e3a2fb6..000000000 --- a/tofuplot.py +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env python - -# Built-in -import sys -import os -import argparse - -# Generic -import matplotlib.pyplot as plt -plt.switch_backend('Qt5Agg') -plt.ioff() - -# tofu -# test if in a tofu git repo -_HERE = os.path.abspath(os.path.dirname(__file__)) -istofugit = False -if '.git' in _HERE and 'tofu' in _HERE: - istofugit = True - -if istofugit: - # Make sure we load the corresponding tofu - sys.path.insert(1,_HERE) - import tofu as tf - from tofu.imas2tofu import MultiIDSLoader - _ = sys.path.pop(1) -else: - import tofu as tf - from tofu.imas2tofu import MultiIDSLoader -tforigin = tf.__file__ -tfversion = tf.__version__ - - -if 'imas2tofu' not in dir(tf): - msg = "imas does not seem to be available\n" - msg += " => tf.imas2tofu not available\n" - msg += " => tofuplot not available" - raise Exception(msg) - - - -################################################### -################################################### -# default values -################################################### - -_RUN = 0 -_USER = 'imas_public' -_TOKAMAK = 'west' -_VERSION = '3' -_LIDS_DIAG = MultiIDSLoader._lidsdiag -_LIDS_PLASMA = tf.imas2tofu.MultiIDSLoader._lidsplasma -_LIDS = _LIDS_DIAG + _LIDS_PLASMA -_T0 = 'IGNITRON' -_SHAREX = False -_BCK = True - -################################################### -################################################### -# function -################################################### - -def _get_exception(q, ids, qtype='quantity'): - msg = MultiIDSLoader._shortcuts(ids=ids, - verb=False, return_=True) - col = ['ids', 'shortcut', 'long version'] - msg = MultiIDSLoader._getcharray(msg, col) - msg = """\nArgs quantity and quant_X must be valid tofu shortcuts - to quantities in ids %s\n\n""" - msg += "Available shortcuts are:\n"""%ids + msg - msg += "\n\nProvided:\n - %s: %s\n"%(qtype,str(qq)) - raise Exception(msg) - - -def call_tfloadimas(shot=None, run=_RUN, user=_USER, - tokamak=_TOKAMAK, version=_VERSION, - ids=None, quantity=None, X=None, t0=_T0, - sharex=_SHAREX, indch=None, indch_auto=None, - background=_BCK): - - lidspla = [ids_ for ids_ in ids if ids_ in _LIDS_PLASMA] - if t0.lower() == 'none': - t0 = None - - tf.load_from_imas(shot=shot, run=run, user=user, - tokamak=tokamak, version=version, - ids=ids, indch=indch, indch_auto=indch_auto, - plot_sig=quantity, plot_X=X, - t0=t0, plot=True, sharex=sharex, bck=background) - - plt.show(block=True) - - - -################################################### -################################################### -# bash call (main) -################################################### - -def _str2bool(v): - if isinstance(v,bool): - return v - elif v.lower() in ['yes','true','y','t','1']: - return True - elif v.lower() in ['no','false','n','f','0']: - return False - else: - raise argparse.ArgumentTypeError('Boolean value expected !') - - -if __name__ == '__main__': - - # Parse input arguments - msg = """Fast interactive visualization tool for diagnostics data in - imas - - This is merely a wrapper around the function tofu.load_from_imas() - It loads (from imas) and displays diagnostics data from the following - ids: - %s - """%repr(_LIDS) - parser = argparse.ArgumentParser(description = msg) - - parser.add_argument('-s', '--shot', type=int, - help='shot number', required=True) - msg = 'username of the DB where the datafile is located' - parser.add_argument('-u','--user',help=msg, required=False, default=_USER) - msg = 'tokamak name of the DB where the datafile is located' - parser.add_argument('-t','--tokamak',help=msg, required=False, - default=_TOKAMAK) - parser.add_argument('-r','--run',help='run number', - required=False, type=int, default=_RUN) - parser.add_argument('-v','--version',help='version number', - required=False, type=str, default=_VERSION) - - msg = "ids from which to load diagnostics data, can be:\n%s"%repr(_LIDS) - parser.add_argument('-i', '--ids', type=str, required=True, - help=msg, nargs='+', choices=_LIDS) - parser.add_argument('-q', '--quantity', type=str, required=False, - help='Desired quantity from the plasma ids', - nargs='+', default=None) - parser.add_argument('-X', '--X', type=str, required=False, - help='Quantity from the plasma ids to use for abscissa', - nargs='+', default=None) - parser.add_argument('-t0', '--t0', type=str, required=False, - help='Reference time event setting t = 0', default=_T0) - parser.add_argument('-ich', '--indch', type=int, required=False, - help='indices of channels to be loaded', - nargs='+', default=None) - parser.add_argument('-ichauto', '--indch_auto', type=bool, required=False, - help='automatically determine indices of channels to be loaded', - default=True) - parser.add_argument('-sx', '--sharex', type=_str2bool, required=False, - help='Should X axis be shared between diagnostics ids ?', - default=_SHAREX, const=True, nargs='?') - parser.add_argument('-bck', '--background', type=_str2bool, required=False, - help='Plot data enveloppe as grey background ?', - default=_BCK, const=True, nargs='?') - - args = parser.parse_args() - - # Call wrapper function - call_tfloadimas(**dict(args._get_kwargs()))