Browse Source

Added docstring for scattnlay.fieldnlay.

Ovidio Peña Rodríguez 7 years ago
parent
commit
4a855f26da
3 changed files with 34 additions and 8 deletions
  1. 4 0
      src/nmie-impl.hpp
  2. 4 0
      src/nmie.cc
  3. 26 8
      src/scattnlay.pyx

+ 4 - 0
src/nmie-impl.hpp

@@ -40,6 +40,10 @@
 //    [2] O. Pena and U. Pal, "Scattering of electromagnetic radiation by           //
 //        a multilayered sphere," Computer Physics Communications,                  //
 //        vol. 180, Nov. 2009, pp. 2348-2354.                                       //
+//    [3] K. Ladutenko, U. Pal, A. Rivera, and O. Pena-Rodriguez, "Mie              //
+//        calculation of electromagnetic near-field for a multilayered              //
+//        sphere," Computer Physics Communications, vol. 214, May 2017,             //
+//        pp. 225-230.                                                              //
 //                                                                                  //
 // Hereinafter all equations numbers refer to [2]                                   //
 //**********************************************************************************//

+ 4 - 0
src/nmie.cc

@@ -38,6 +38,10 @@
 //    [2] O. Pena and U. Pal, "Scattering of electromagnetic radiation by           //
 //        a multilayered sphere," Computer Physics Communications,                  //
 //        vol. 180, Nov. 2009, pp. 2348-2354.                                       //
+//    [3] K. Ladutenko, U. Pal, A. Rivera, and O. Pena-Rodriguez, "Mie              //
+//        calculation of electromagnetic near-field for a multilayered              //
+//        sphere," Computer Physics Communications, vol. 214, May 2017,             //
+//        pp. 225-230.                                                              //
 //                                                                                  //
 // Hereinafter all equations numbers refer to [2]                                   //
 //**********************************************************************************//

+ 26 - 8
src/scattnlay.pyx

@@ -52,13 +52,13 @@ cdef extern from "py_nmie.h":
 
 def scattcoeffs(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.int_t nmax, np.int_t pl = -1):
     """
-    scattcoeffs(x, m, nmax, pl)
+    scattcoeffs(x, m[, nmax, pl])
 
     Calculate the scattering coefficients required to calculate both the
     near- and far-field parameters.
 
-        x: size parameters (2D ndarray)
-        m: relative refractive indices (2D ndarray)
+        x: Size parameters (2D ndarray)
+        m: Relative refractive indices (2D ndarray)
         nmax: Maximum number of multipolar expansion terms to be used for the
               calculations. Only use it if you know what you are doing, otherwise
               set this parameter to -1 and the function will calculate it.
@@ -67,7 +67,7 @@ def scattcoeffs(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t
     Returns: (terms, an, bn)
     with
         terms: Number of multipolar expansion terms used for the calculations
-        an, bn: complex scattering amplitudes
+        an, bn: complex scattering coefficients
     """
     cdef Py_ssize_t i
 
@@ -96,13 +96,13 @@ def scattcoeffs(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t
 
 def scattnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 1] theta = np.zeros(0, dtype = np.float64), np.int_t nmax = -1, np.int_t pl = -1):
     """
-    scattnlay(x, m, [theta, nmax, pl])
+    scattnlay(x, m[, theta, nmax, pl])
 
     Calculate the actual scattering parameters and amplitudes.
 
-        x: size parameters (2D ndarray)
-        m: relative refractive indices (2D ndarray)
-        theta: scattering angles where the scattering amplitudes will be
+        x: Size parameters (2D ndarray)
+        m: Relative refractive indices (2D ndarray)
+        theta: Scattering angles where the scattering amplitudes will be
                calculated (optional, 1D ndarray)
         nmax: Maximum number of multipolar expansion terms to be used for the
               calculations. Only use it if you know what you are doing.
@@ -154,6 +154,24 @@ def scattnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t,
     return terms, Qext, Qsca, Qabs, Qbk, Qpr, g, Albedo, S1, S2
 
 def fieldnlay(np.ndarray[np.float64_t, ndim = 2] x, np.ndarray[np.complex128_t, ndim = 2] m, np.ndarray[np.float64_t, ndim = 2] coords, np.int_t nmax = -1, np.int_t pl = -1):
+    """
+    fieldnlay(x, m, coords[, theta, nmax, pl])
+
+    Calculate the actual scattering parameters and amplitudes.
+
+        x: Size parameters (2D ndarray)
+        m: Relative refractive indices (2D ndarray)
+        coords: Array containing all coordinates where the complex electric
+                and magnetic fields will be calculated (2D ndarray)
+        nmax: Maximum number of multipolar expansion terms to be used for the
+              calculations. Only use it if you know what you are doing.
+        pl: Index of PEC layer.
+
+    Returns: (terms, E, H)
+    with
+        terms: Number of multipolar expansion terms used for the calculations
+        E, H: Complex electric and magnetic field at the provided coordinates
+    """
     cdef Py_ssize_t i
 
     cdef np.ndarray[np.int_t, ndim = 1] terms = np.zeros(x.shape[0], dtype = np.int)