From eeb97a692ec949187d9856e5e6521c072f18c8bb Mon Sep 17 00:00:00 2001
From: caron <j.caron@fz-juelich.de>
Date: Wed, 11 Mar 2020 13:42:16 +0100
Subject: [PATCH] Added stuff to docs, try to make it work correctly

---
 .gitlab-ci.yml                  |  2 +-
 README.rst                      | 13 +++++-----
 docs/api/empyre.fields.rst      | 38 ---------------------------
 docs/api/empyre.io.rst          | 10 -------
 docs/api/empyre.models.rst      | 10 -------
 docs/api/empyre.reconstruct.rst | 10 -------
 docs/api/empyre.rst             | 33 -----------------------
 docs/api/empyre.vis.rst         | 46 ---------------------------------
 docs/api/modules.rst            |  7 -----
 docs/fields.rst                 | 18 +++++++++++++
 src/empyre/fields/field.py      | 26 +++++++++----------
 11 files changed, 38 insertions(+), 175 deletions(-)
 delete mode 100644 docs/api/empyre.fields.rst
 delete mode 100644 docs/api/empyre.io.rst
 delete mode 100644 docs/api/empyre.models.rst
 delete mode 100644 docs/api/empyre.reconstruct.rst
 delete mode 100644 docs/api/empyre.rst
 delete mode 100644 docs/api/empyre.vis.rst
 delete mode 100644 docs/api/modules.rst

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4606f9f..58f8e3e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ test_style:
     image: continuumio/miniconda3:latest
     script:
         # -m: only run tests marked with "flake8"
-        - pyroma . --min=9  # Checks setup.py for cheese! # TODO: Set to maxium cheese (10)!
+        - pyroma . --min=10  # Checks setup.py for cheese! Maxium cheese 10!
         - python setup.py test --addopts "--flake8 -m flake8"
 
 test_function:
diff --git a/README.rst b/README.rst
index 425b097..a5d5429 100644
--- a/README.rst
+++ b/README.rst
@@ -28,16 +28,16 @@ EMPyRe is available on the `Python Package Index <http://pypi.python.org/pypi>`_
 Per default, only the strictly required libraries are installed, but there are a few additional dependencies that will unlock additional capabilites of EMPYRE.
 
 * ``io`` will install the `HyperSpy <https://hyperspy.org/>`_ package that is used for loading and saving additional file formats.
-    
+
     .. warning::
-        Due to this `issue <https://github.com/hyperspy/hyperspy/issues/2315>`_, a pip install of hyperspy is currently not possible. Please use 
+        Due to this `issue <https://github.com/hyperspy/hyperspy/issues/2315>`_, a pip install of hyperspy is currently not possible. Please use
         `conda <https://docs.conda.io/en/latest/>`_ to install HyperSpy, instead.
-            
+
 
 * ``fftw`` will install `PyFFTW <https://github.com/pyFFTW/pyFFTW>`_ to speed up Fourier transforms used in some forward models.
 
 * ``colors`` will install the `cmocean <https://matplotlib.org/cmocean/>`_, whose ``balance`` color map is used as a default for the ``imshow`` commmand, if available.
-    
+
 * ``all`` will install all of the dependencies listed above.
 
 
@@ -53,8 +53,7 @@ Structure
 
 EMPyRe has several dedicated submodules which are fully documented `here <https://empyre.iffgit.fz-juelich.de/empyre/>`_!
 
-
-* The ``fields`` submodule provides the ``Field`` container class for multidimensional scalar or vector fields and is the fundamental data structure used in EMPyRe. 
+* The ``fields`` submodule provides the ``Field`` container class for multidimensional scalar or vector fields and is the fundamental data structure used in EMPyRe.
 
 * The ``vis`` submodule enables the plotting of ``Field`` objects, based on and similar in syntax to the commonly known `matplotlib <https://matplotlib.org/>`_ framework.
 
@@ -68,4 +67,4 @@ EMPyRe has several dedicated submodules which are fully documented `here <https:
 
 License
 -------
-EMPyRe is licensed under `GPLv3 <https://iffgit.fz-juelich.de/empyre/empyre/-/blob/master/LICENSE>`_. 
+EMPyRe is licensed under `GPLv3 <https://iffgit.fz-juelich.de/empyre/empyre/-/blob/master/LICENSE>`_.
diff --git a/docs/api/empyre.fields.rst b/docs/api/empyre.fields.rst
deleted file mode 100644
index 4669873..0000000
--- a/docs/api/empyre.fields.rst
+++ /dev/null
@@ -1,38 +0,0 @@
-empyre.fields package
-=====================
-
-Submodules
-----------
-
-empyre.fields.field module
---------------------------
-
-.. automodule:: empyre.fields.field
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-empyre.fields.shapes module
----------------------------
-
-.. automodule:: empyre.fields.shapes
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-empyre.fields.vectors module
-----------------------------
-
-.. automodule:: empyre.fields.vectors
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-
-Module contents
----------------
-
-.. automodule:: empyre.fields
-   :members:
-   :undoc-members:
-   :show-inheritance:
diff --git a/docs/api/empyre.io.rst b/docs/api/empyre.io.rst
deleted file mode 100644
index b90f22c..0000000
--- a/docs/api/empyre.io.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-empyre.io package
-=================
-
-Module contents
----------------
-
-.. automodule:: empyre.io
-   :members:
-   :undoc-members:
-   :show-inheritance:
diff --git a/docs/api/empyre.models.rst b/docs/api/empyre.models.rst
deleted file mode 100644
index 084117e..0000000
--- a/docs/api/empyre.models.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-empyre.models package
-=====================
-
-Module contents
----------------
-
-.. automodule:: empyre.models
-   :members:
-   :undoc-members:
-   :show-inheritance:
diff --git a/docs/api/empyre.reconstruct.rst b/docs/api/empyre.reconstruct.rst
deleted file mode 100644
index 4824387..0000000
--- a/docs/api/empyre.reconstruct.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-empyre.reconstruct package
-==========================
-
-Module contents
----------------
-
-.. automodule:: empyre.reconstruct
-   :members:
-   :undoc-members:
-   :show-inheritance:
diff --git a/docs/api/empyre.rst b/docs/api/empyre.rst
deleted file mode 100644
index a935d59..0000000
--- a/docs/api/empyre.rst
+++ /dev/null
@@ -1,33 +0,0 @@
-empyre package
-==============
-
-Subpackages
------------
-
-.. toctree::
-
-   empyre.fields
-   empyre.io
-   empyre.models
-   empyre.reconstruct
-   empyre.vis
-
-Submodules
-----------
-
-empyre.version module
----------------------
-
-.. automodule:: empyre.version
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-
-Module contents
----------------
-
-.. automodule:: empyre
-   :members:
-   :undoc-members:
-   :show-inheritance:
diff --git a/docs/api/empyre.vis.rst b/docs/api/empyre.vis.rst
deleted file mode 100644
index 0a08bbc..0000000
--- a/docs/api/empyre.vis.rst
+++ /dev/null
@@ -1,46 +0,0 @@
-empyre.vis package
-==================
-
-Submodules
-----------
-
-empyre.vis.colors module
-------------------------
-
-.. automodule:: empyre.vis.colors
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-empyre.vis.decorators module
-----------------------------
-
-.. automodule:: empyre.vis.decorators
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-empyre.vis.plot2d module
-------------------------
-
-.. automodule:: empyre.vis.plot2d
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-empyre.vis.tools module
------------------------
-
-.. automodule:: empyre.vis.tools
-   :members:
-   :undoc-members:
-   :show-inheritance:
-
-
-Module contents
----------------
-
-.. automodule:: empyre.vis
-   :members:
-   :undoc-members:
-   :show-inheritance:
diff --git a/docs/api/modules.rst b/docs/api/modules.rst
deleted file mode 100644
index aab6102..0000000
--- a/docs/api/modules.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-empyre
-======
-
-.. toctree::
-   :maxdepth: 4
-
-   empyre
diff --git a/docs/fields.rst b/docs/fields.rst
index 68bd3b1..f464c05 100644
--- a/docs/fields.rst
+++ b/docs/fields.rst
@@ -2,3 +2,21 @@ The Field container class
 =========================
 
 Field docu here!
+
+
+Submodules
+----------
+
+.. toctree::
+
+   empyre.fields.field
+   empyre.fields.shapes
+   empyre.fields.vectors
+
+Module contents
+---------------
+
+.. automodule:: empyre.fields
+   :members:
+   :undoc-members:
+   :show-inheritance:
diff --git a/src/empyre/fields/field.py b/src/empyre/fields/field.py
index ce74b76..b94f32f 100644
--- a/src/empyre/fields/field.py
+++ b/src/empyre/fields/field.py
@@ -438,7 +438,7 @@ class Field(NDArrayOperatorsMixin):
         The calculation depends on the input:
         3 dimensions, 3 components: Calculates the full 3D rotational vector field!
         2 dimensions, 2 components: Calculates the out-of-plane component of the curl as a 2D scalar field!
-        2 dimensions, scalar: Calculates the planar rotatio as a 2D vector field!
+        2 dimensions, scalar: Calculates the planar rotation as a 2D vector field!
 
         """
         self._log.debug('Calling curl')
@@ -447,12 +447,12 @@ class Field(NDArrayOperatorsMixin):
             if squeezed_field.ncomp == 3:  # 3 component vector field (standard case):
                 self._log.debug('input: 3 dimensions, 3 components!')
                 field_x, field_y, field_z = squeezed_field.comp
-                grad_xx, grad_xy, grad_xz = field_x.gradient().comp
-                grad_yx, grad_yy, grad_yz = field_y.gradient().comp
-                grad_zx, grad_zy, grad_zz = field_z.gradient().comp
-                curl_x = grad_zy - grad_yz
-                curl_y = grad_xz - grad_zx
-                curl_z = grad_yx - grad_xy
+                gradx_x, grady_x, gradz_x = field_x.gradient().comp
+                gradx_y, grady_y, gradz_y = field_y.gradient().comp
+                gradx_z, grady_z, gradz_z = field_z.gradient().comp
+                curl_x = grady_z - gradz_y
+                curl_y = gradz_x - gradx_z
+                curl_z = gradx_y - grady_x
                 return Field.from_scalar_fields([curl_x, curl_y, curl_z])
             else:
                 raise AssertionError('Can only handle 3 component vector fields in 3D!')
@@ -460,14 +460,14 @@ class Field(NDArrayOperatorsMixin):
             if squeezed_field.ncomp == 2:  # 2 component vector field (return perpendicular component as scalar field):
                 self._log.debug('input: 2 dimensions, 2 components!')
                 field_x, field_y = squeezed_field.comp
-                grad_xx, grad_xy = field_x.gradient().comp
-                grad_yx, grad_yy = field_y.gradient().comp
-                return grad_yx - grad_xy
+                gradx_x, grady_x = field_x.gradient().comp
+                gradx_y, grady_y = field_y.gradient().comp
+                return gradx_y - grady_x
             elif not squeezed_field.vector:  # scalar field (return planar components as 2D vector field):
                 self._log.debug('input: 3 dimensions, scalar field!')
-                grad_x, grad_y = squeezed_field.gradient().comp
-                curl_x = grad_y
-                curl_y = -grad_x
+                gradx, grady = squeezed_field.gradient().comp
+                curl_x = grady
+                curl_y = -gradx
                 return Field.from_scalar_fields([curl_x, curl_y])
             else:
                 raise AssertionError('Can only handle 3 component vector or scalar fields in 2D!')
-- 
GitLab