Konstantin Ladutenko 5 年 前
コミット
0726b09cc6
5 ファイル変更29 行追加18 行削除
  1. 4 5
      Makefile
  2. 1 1
      README.md
  3. 5 0
      debian/changelog
  4. 4 5
      setup.py
  5. 15 7
      tests/python/test04_field.py

+ 4 - 5
Makefile

@@ -1,14 +1,14 @@
 PYTHON=`which python3`
 DESTDIR=/
 PROJECT=python-scattnlay
-VERSION=2.2
+VERSION=2.3
 BUILDIR=$(CURDIR)/debian/$(PROJECT)
 SRCDIR=$(CURDIR)/src
 MULTIPREC=100
 CXX_NMIE_HEADERS=$(SRCDIR)/nmie.hpp $(SRCDIR)/nmie-impl.hpp $(SRCDIR)/nmie-precision.hpp
 
 all:
-	@echo "make src - Create source package for Python extension"
+	@echo "make source - Create source package for Python extension"
 	@echo "make ext - Create Python extension in place"
 	@echo "make install - Install Python extension on local system"
 	@echo "make rpm - Generate a rpm package for Python extension"
@@ -17,7 +17,7 @@ all:
 	@echo "make clean - Delete temporal files"
 #	make standalone
 
-src:
+source:
 	$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../
 
 ext: $(SRCDIR)/nmie.cc $(SRCDIR)/nmie-pybind11.cc $(SRCDIR)/pb11_wrapper.cc
@@ -30,10 +30,9 @@ rpm:
 	#$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
 	$(PYTHON) setup.py bdist_rpm --dist-dir=../
 
-deb:
+deb: source
 	# build the source package in the parent directory
 	# then rename it to project_version.orig.tar.gz
-	$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ --prune
 	rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
 	# build the package
 	dpkg-buildpackage -i -I -rfakeroot

+ 1 - 1
README.md

@@ -51,7 +51,7 @@ And to compile the Debian package you need some tools:
 
 Compilation options
 
- - **make src** - Create source package for Python extension
+ - **make source** - Create source package for Python extension
  - **make ext** - Create Python extension using C++ code
  - **make install** - Install Python extension on local system
  - **make rpm** - Generate a rpm package for Python extension

+ 5 - 0
debian/changelog

@@ -1,3 +1,8 @@
+python-scattnlay (2.3.0-1) bionic; urgency=low
+
+  * Updated for Bionic Beaver (2.3.0-1)
+ -- Ovidio Peña Rodríguez <ovidio@bytesfall.com>  Fri, 04 Oct 2019 10:43:00 +0100
+
 python-scattnlay (2.2.0-1) xenial; urgency=low
 
   * Updated for Xenial Xerus (2.2.0-1)

+ 4 - 5
setup.py

@@ -30,7 +30,7 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-__version__ = '2.2'
+__version__ = '2.3'
 __title__ = 'Calculation of the scattering of EM radiation by a multilayered sphere'
 __mod__ = 'python-scattnlay'
 __author__ = 'Ovidio Peña Rodríguez'
@@ -38,8 +38,8 @@ __email__ = 'ovidio@bytesfall.com'
 __url__ = 'https://github.com/ovidiopr/scattnlay'
 __download_url__ = 'https://github.com/ovidiopr/scattnlay/archive/v2.2.0.tar.gz'
 
-from distutils.core import setup
-from distutils.extension import Extension
+from setuptools import setup
+from setuptools.extension import Extension
 import numpy as np
 import pybind11 as pb
 
@@ -60,8 +60,7 @@ O. Pena, U. Pal, Comput. Phys. Commun. 180 (2009) 2348-2354.""",
       download_url = __download_url__,
       license = 'GPL',
       platforms = 'any',
-      packages = ['scattnlay'#, 'scattnlay_dp', 'scattnlay_mp'
-                  ],
+      packages = ['scattnlay'],#, 'scattnlay_dp', 'scattnlay_mp'],
       ext_modules = [Extension("scattnlay_dp",
                                ["src/nmie.cc", "src/nmie-pybind11.cc", "src/pb11_wrapper.cc"],
                                language = "c++",

+ 15 - 7
tests/python/test04_field.py

@@ -47,7 +47,7 @@
 from scattnlay import fieldnlay
 import numpy as np
 
-nL = 2
+nL = 10
 Xmax = 60.0
 
 x = np.array([np.linspace(Xmax/nL, Xmax, nL)], dtype = np.float64)
@@ -56,7 +56,7 @@ m = np.array((np.sqrt((2.0 - (x[0]/Xmax - 0.5/nL)**2.0))), dtype = np.complex128
 print "x =", x
 print "m =", m
 
-npts = 500
+npts = 100
 
 scan = np.linspace(-3*Xmax, 3*Xmax, npts)
 
@@ -65,12 +65,20 @@ coordX.resize(npts*npts)
 coordY.resize(npts*npts)
 coordZ = np.zeros(npts*npts, dtype = np.float64)
 
+#idx = np.where(np.sqrt(coordX**2 + coordY**2) < 10.)
+#coordX = np.delete(coordX, idx)
+#coordY = np.delete(coordY, idx)
+#coordZ = np.delete(coordZ, idx)
+
 terms, E, H = fieldnlay(x, m, coordX, coordY, coordZ)
+print "E", E
 
 Er = np.absolute(E)
+print "Er", Er
 
 # |E|/|Eo|
 Eh = np.sqrt(Er[0, :, 0]**2 + Er[0, :, 1]**2 + Er[0, :, 2]**2)
+print "Eh", Eh
 
 result = np.vstack((coordX, coordY, coordZ, Eh)).transpose()
 
@@ -112,12 +120,12 @@ try:
     plt.xlabel('X')
     plt.ylabel('Y')
 
-    # This part draws the nanoshell
-#    from matplotlib import patches
+    # This part draws the lens
+    from matplotlib import patches
 
-#    s1 = patches.Arc((0, 0), 2.0*x[0, 0], 2.0*x[0, 0], angle=0.0, zorder=2,
-#                      theta1=0.0, theta2=360.0, linewidth=1, color='#00fa9a')
-#    ax.add_patch(s1)
+    s1 = patches.Arc((0, 0), 2.0*Xmax, 2.0*Xmax, angle=0.0, zorder=2,
+                      theta1=0.0, theta2=360.0, linewidth=1, color='#00fa9a')
+    ax.add_patch(s1)
 
 #    s2 = patches.Arc((0, 0), 2.0*x[0, 1], 2.0*x[0, 1], angle=0.0, zorder=2,
 #                      theta1=0.0, theta2=360.0, linewidth=1, color='#00fa9a')