[pyfai] 01/02: fix installation with python3

Frédéric-Emmanuel Picca picca at moszumanska.debian.org
Mon Sep 14 09:41:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

picca pushed a commit to branch master
in repository pyfai.

commit 94ede31884ab7213414504503f75bc29665e0e34
Author: Picca Frédéric-Emmanuel <picca at synchrotron-soleil.fr>
Date:   Fri Sep 11 14:25:02 2015 +0200

    fix installation with python3
---
 ...02-fix-from-upstream-python3-installation.patch | 468 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 469 insertions(+)

diff --git a/debian/patches/0002-fix-from-upstream-python3-installation.patch b/debian/patches/0002-fix-from-upstream-python3-installation.patch
new file mode 100644
index 0000000..ea6b02a
--- /dev/null
+++ b/debian/patches/0002-fix-from-upstream-python3-installation.patch
@@ -0,0 +1,468 @@
+From: =?utf-8?q?Picca_Fr=C3=A9d=C3=A9ric-Emmanuel?=
+ <picca at synchrotron-soleil.fr>
+Date: Fri, 11 Sep 2015 14:24:40 +0200
+Subject: fix from upstream python3 installation
+
+---
+ test/blob.py                        | 15 ++++++++-------
+ test/debug_ocl_sort.py              |  3 ++-
+ test/profile_lut_pixelsplitFull.py  |  6 ++----
+ test/profile_ocl_lut.py             |  8 +-------
+ test/profile_ocl_lut_pixelsplit.py  | 20 --------------------
+ test/profile_ocl_lut_pixelsplit2.py |  4 +---
+ test/profile_pixelsplitFull.py      |  8 ++------
+ test/profile_pixelsplitFullLUT.py   |  6 +-----
+ test/profile_pixelsplitFullLUT2.py  |  6 +-----
+ test/test_export.py                 |  9 ++-------
+ test/test_geometry_refinement.py    |  7 +++----
+ test/test_mask.py                   |  9 +++++----
+ test/test_peak_picking.py           |  8 +++-----
+ test/test_polarization.py           |  8 +++-----
+ 14 files changed, 34 insertions(+), 83 deletions(-)
+
+diff --git a/test/blob.py b/test/blob.py
+index ee3e355..0a1106c 100644
+--- a/test/blob.py
++++ b/test/blob.py
+@@ -1,5 +1,6 @@
+ #!/usr/bin/python
+ # coding: utf-8
++from __future__ import print_function
+ import sys, scipy
+ import matplotlib
+ matplotlib.use('Qt4Agg')
+@@ -47,7 +48,7 @@ def image_test_rings():
+     modulation = (1 + numpy.sin(5 * r + chi * mod))
+     for radius in numpy.linspace(0, r_max, rings):
+         img += numpy.exp(-(r - radius) ** 2 / (2 * (sigma * sigma)))
+-    
++
+     img *= modulation
+     img = add_noise(img, 0.0)
+     return img
+@@ -55,7 +56,7 @@ def image_test_rings():
+ def add_noise(img,rate):
+     noise = numpy.random.random(img.shape) * rate
+     return img+noise
+-    
++
+ def make_gaussian(im,sigma,xc,yc):
+     "Creating 2D gaussian to be put in a test image"
+     e = 1
+@@ -95,13 +96,13 @@ ax = f.add_subplot(111)
+ ax.imshow(numpy.log1p(data), interpolation = 'nearest')
+ 
+ for i in range(5):
+-    print ('Octave #%i' %i)
++    print('Octave #%i' %i)
+     bd._one_octave(shrink=True, refine = True, n_5 = False)
+     print("Octave #%i Total kp: %i" % (i, bd.keypoints.size))
+-    
++
+ # bd._one_octave(False, True ,False)
+-    
+-print ('Final size of keypoints : %i'% bd.keypoints.size)
++
++print('Final size of keypoints : %i'% bd.keypoints.size)
+ 
+ i = 0
+ # for kp  in bd.keypoints:
+@@ -119,7 +120,7 @@ if sigma.size > 0:
+     h = pylab.figure(2)
+     x, y, o = pylab.hist(sigma, bins=100)
+     h.show()
+-      
++
+     index = numpy.where(x == x.max())
+     kp = bd.keypoints[bd.keypoints.sigma > y[index]]
+ else : kp = bd.keypoints
+diff --git a/test/debug_ocl_sort.py b/test/debug_ocl_sort.py
+index a9998ac..d1516ce 100644
+--- a/test/debug_ocl_sort.py
++++ b/test/debug_ocl_sort.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+ import numpy, time
+ import pyFAI, pyFAI.opencl
+ from pyFAI.opencl import pyopencl, ocl
+@@ -21,7 +22,7 @@ hs_data = numpy.sort(h_data)
+ t1 = time.time()
+ time_sort = 1e3 * (t1 - t0)
+ 
+-print time_sort
++print(time_sort)
+ 
+ evt = prg.bsort_init(queue, (ws,), (ws,), d_data.data, local_mem)
+ evt.wait()
+diff --git a/test/profile_lut_pixelsplitFull.py b/test/profile_lut_pixelsplitFull.py
+index 397c87b..02aa2e2 100644
+--- a/test/profile_lut_pixelsplitFull.py
++++ b/test/profile_lut_pixelsplitFull.py
+@@ -49,7 +49,7 @@ with open("../openCL/ocl_lut_pixelsplit.cl", "r") as kernelFile:
+ 
+ compile_options = "-D BINS=%i  -D NIMAGE=%i -D WORKGROUP_SIZE=%i -D EPS=%e" % \
+                 (bins, size, workgroup_size, numpy.finfo(numpy.float32).eps)
+-            
++
+ print(compile_options)
+ 
+ program = cl.Program(ctx, kernel_src).build(options=compile_options)
+@@ -181,7 +181,7 @@ legend()
+ show()
+ input()
+ 
+-  
++
+ #aaa = 0
+ #bbb = 0
+ #for i in range(bins):
+@@ -197,7 +197,5 @@ input()
+         #aaa += 1
+         #if not numpy.allclose(data_1[j],data_2[j]):
+             #bbb += 1
+-            #print data_1[j],data_2[j],numpy.allclose(data_1[j],data_2[j]), idx_ptr[i]+j
+ 
+ 
+-#print aaa,bbb
+\ No newline at end of file
+diff --git a/test/profile_ocl_lut.py b/test/profile_ocl_lut.py
+index b72755e..ab25c98 100755
+--- a/test/profile_ocl_lut.py
++++ b/test/profile_ocl_lut.py
+@@ -53,7 +53,7 @@ plot(nodummy + 1, label="no_corr")
+ out_cyt = ai._lut_integrator.integrate(data, dummy= -2, delta_dummy=1.5)
+ out_ocl = gpu.integrate(data, dummy= -2, delta_dummy=1.5)[0]
+ print("Dummy  R=", utilstest.Rwp((out_cyt[0], out_ocl), out_cyt[:2], "Dummy"))
+-#print "nodummy/Dummy", utilstest.Rwp((out_cyt[0], out_cyt[1]), (out_cyt[0], nodummy), "nodummy/Dummy")
++#print("nodummy/Dummy", utilstest.Rwp((out_cyt[0], out_cyt[1]), (out_cyt[0], nodummy), "nodummy/Dummy")
+ 
+ dark = numpy.random.random(data.shape)
+ out_cyt = ai._lut_integrator.integrate(data, dark=dark)
+@@ -76,18 +76,12 @@ out_ocl = gpu.integrate(data, polarization=polarization)[0]
+ print("PolarizationR=", utilstest.Rwp((out_cyt[0], out_ocl), out_cyt[:2], "Polarization"))
+ 
+ #pyopencl.enqueue_copy(gpu._queue, img, gpu._cl_mem["image"]).wait()
+-#print "SolidAngle", solidAngle
+-#print img
+ #xx = splitBBox.histoBBox1d(weights=data,
+ #                                                 pos0=ai._ttha,
+ #                                                 delta_pos0=ai._dttha,
+ #                                                 bins=1000,
+ #                                                 polarization=polarization)[1]
+ #plot(xx + 2, label="xrpd")
+-#print "Pol: lut/refR=", utilstest.Rwp((out_cyt[0], xx), out_cyt[:2], "Polarization")
+-#print "Pol: ocl/refR=", utilstest.Rwp((out_cyt[0], out_ocl), (out_cyt[0], xx), "Polarization")
+-#print "Pol: noc/refR=", utilstest.Rwp((out_cyt[0], nodummy), (out_cyt[0], xx), "Polarization")
+-#print out_ocl
+ plot(out_cyt[1], label="ref")
+ plot(out_ocl, label="obt")
+ 
+diff --git a/test/profile_ocl_lut_pixelsplit.py b/test/profile_ocl_lut_pixelsplit.py
+index 9cd76cc..0c2ec03 100644
+--- a/test/profile_ocl_lut_pixelsplit.py
++++ b/test/profile_ocl_lut_pixelsplit.py
+@@ -187,23 +187,3 @@ legend()
+ show()
+ input()
+ 
+-
+-# aaa = 0
+-# bbb = 0
+-# for i in range(bins):
+-    # ind_tmp1 = numpy.copy(indices[idx_ptr[i]:idx_ptr[i+1]])
+-    # ind_tmp2 = numpy.copy(foo.indices[idx_ptr[i]:idx_ptr[i+1]])
+-    # data_tmp1 = numpy.copy(data_lut[idx_ptr[i]:idx_ptr[i+1]])
+-    # data_tmp2 = numpy.copy(foo.data[idx_ptr[i]:idx_ptr[i+1]])
+-    # sort1 = numpy.argsort(ind_tmp1)
+-    # sort2 = numpy.argsort(ind_tmp2)
+-    # data_1 = data_tmp1[sort1]
+-    # data_2 = data_tmp2[sort2]
+-    # for j in range(data_1.size):
+-        # aaa += 1
+-        # if not numpy.allclose(data_1[j],data_2[j]):
+-            # bbb += 1
+-            # print data_1[j],data_2[j],numpy.allclose(data_1[j],data_2[j]), idx_ptr[i]+j
+-
+-
+-# print aaa,bbb
+diff --git a/test/profile_ocl_lut_pixelsplit2.py b/test/profile_ocl_lut_pixelsplit2.py
+index b3199da..c26dac3 100644
+--- a/test/profile_ocl_lut_pixelsplit2.py
++++ b/test/profile_ocl_lut_pixelsplit2.py
+@@ -57,7 +57,7 @@ with open("../openCL/ocl_lut_pixelsplit.cl", "r") as kernelFile:
+ 
+ compile_options = "-D BINS=%i  -D NIMAGE=%i -D WORKGROUP_SIZE=%i -D EPS=%e" % \
+                 (bins, size, workgroup_size, numpy.finfo(numpy.float32).eps)
+-            
++
+ print(compile_options)
+ 
+ program = cl.Program(ctx, kernel_src).build(options=compile_options)
+@@ -110,8 +110,6 @@ d_idx_ptr = cl.array.to_device(queue, idx_ptr)
+ 
+ #cl.enqueue_copy(queue, lutsize, d_lutsize.data)
+ 
+-#print lutsize
+-
+ lut_size = int(idx_ptr[-1])
+ 
+ d_indices  = cl.array.empty(queue, (lut_size,), dtype=numpy.int32)
+diff --git a/test/profile_pixelsplitFull.py b/test/profile_pixelsplitFull.py
+index 53678ad..f75c5b1 100644
+--- a/test/profile_pixelsplitFull.py
++++ b/test/profile_pixelsplitFull.py
+@@ -50,7 +50,7 @@ with open("../openCL/ocl_lut_pixelsplit.cl", "r") as kernelFile:
+ 
+ compile_options = "-D BINS=%i  -D NIMAGE=%i -D WORKGROUP_SIZE=%i -D EPS=%e" % \
+                 (bins, size, workgroup_size, numpy.finfo(numpy.float32).eps)
+-            
++
+ print(compile_options)
+ 
+ program = cl.Program(ctx, kernel_src).build(options=compile_options)
+@@ -185,7 +185,7 @@ legend()
+ show()
+ input()
+ 
+-  
++
+ #aaa = 0
+ #bbb = 0
+ #for i in range(bins):
+@@ -201,7 +201,3 @@ input()
+         #aaa += 1
+         #if not numpy.allclose(data_1[j],data_2[j]):
+             #bbb += 1
+-            #print data_1[j],data_2[j],numpy.allclose(data_1[j],data_2[j]), idx_ptr[i]+j
+-
+-
+-#print aaa,bbb
+\ No newline at end of file
+diff --git a/test/profile_pixelsplitFullLUT.py b/test/profile_pixelsplitFullLUT.py
+index 59ee713..585ed7e 100644
+--- a/test/profile_pixelsplitFullLUT.py
++++ b/test/profile_pixelsplitFullLUT.py
+@@ -102,7 +102,7 @@ pixels_bad.sort()
+ #show()
+ #raw_input()
+ 
+-  
++
+ #aaa = 0
+ #bbb = 0
+ #for i in range(bins):
+@@ -118,7 +118,3 @@ pixels_bad.sort()
+         #aaa += 1
+         #if not numpy.allclose(data_1[j],data_2[j]):
+             #bbb += 1
+-            #print data_1[j],data_2[j],numpy.allclose(data_1[j],data_2[j]), idx_ptr[i]+j
+-
+-
+-#print aaa,bbb
+\ No newline at end of file
+diff --git a/test/profile_pixelsplitFullLUT2.py b/test/profile_pixelsplitFullLUT2.py
+index 64199cf..8d980b8 100644
+--- a/test/profile_pixelsplitFullLUT2.py
++++ b/test/profile_pixelsplitFullLUT2.py
+@@ -104,7 +104,7 @@ legend()
+ show()
+ input()
+ 
+-  
++
+ #aaa = 0
+ #bbb = 0
+ #for i in range(bins):
+@@ -120,7 +120,3 @@ input()
+         #aaa += 1
+         #if not numpy.allclose(data_1[j],data_2[j]):
+             #bbb += 1
+-            #print data_1[j],data_2[j],numpy.allclose(data_1[j],data_2[j]), idx_ptr[i]+j
+-
+-
+-#print aaa,bbb
+\ No newline at end of file
+diff --git a/test/test_export.py b/test/test_export.py
+index ef4f8e4..5f2ab08 100755
+--- a/test/test_export.py
++++ b/test/test_export.py
+@@ -24,6 +24,8 @@
+ 
+ "test suite for masked arrays"
+ 
++from __future__ import print_function
++
+ __author__ = "Jérôme Kieffer"
+ __contact__ = "Jerome.Kieffer at ESRF.eu"
+ __license__ = "GPLv3+"
+@@ -55,7 +57,6 @@ def testExport(direct=100, centerX=900, centerY=1000, tilt=0, tpr=0, pixelX=50,
+     a2 = pyFAI.AzimuthalIntegrator()
+     a3 = pyFAI.AzimuthalIntegrator()
+     a1.setFit2D(direct, centerX, centerY, tilt, tpr, pixelX, pixelY)
+-#    print a1
+     a2.setPyFAI(**a1.getPyFAI())
+     a3.setFit2D(**a2.getFit2D())
+     res = ""
+@@ -110,14 +111,8 @@ class TestSPD(unittest.TestCase):
+ 
+     def test_simple(self):
+         ref = pyFAI.load(self.poniFile)
+-#        ref.rot1 = 0
+-#        ref.rot2 = 0
+-#        ref.rot3 = 0
+         obt = pyFAI.AzimuthalIntegrator()
+-#        print ref.getFit2D()
+-#        print ref.getSPD()
+         obt.setSPD(**ref.getSPD())
+-#        print obt.getSPD()
+         for key in ["dist", "poni1", "poni2", "rot3", "pixel1", "pixel2", "splineFile"]:
+             refv = ref.__getattribute__(key)
+             obtv = obt.__getattribute__(key)
+diff --git a/test/test_geometry_refinement.py b/test/test_geometry_refinement.py
+index bdceacd..ffd75a8 100755
+--- a/test/test_geometry_refinement.py
++++ b/test/test_geometry_refinement.py
+@@ -24,11 +24,13 @@
+ 
+ "test suite for Geometric Refinement class"
+ 
++from __future__ import print_function
++
+ __author__ = "Jérôme Kieffer"
+ __contact__ = "Jerome.Kieffer at ESRF.eu"
+ __license__ = "GPLv3+"
+ __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+-__date__ = "05/03/2015"
++__date__ = "21/08/2015"
+ 
+ 
+ import unittest
+@@ -204,7 +206,6 @@ class TestGeometryRefinement(unittest.TestCase):
+         wl = 2e-10 * numpy.sin(tth / 2.0)
+         ds = [1.0]
+         calibrant = pyFAI.calibrant.Calibrant(dSpacing=ds, wavelength=wl)
+-#        print tth, wl, ds, 2 * ds[0] * numpy.sin(tth / 2)
+         r2 = GeometryRefinement(data, dist=0.1, splineFile=splineFine, wavelength=wl, calibrant=calibrant)
+ #        r2.poni1 = 5e-2
+ #        r2.poni2 = 5e-2
+@@ -216,8 +217,6 @@ class TestGeometryRefinement(unittest.TestCase):
+         r2.rot3_min = -0.0001
+         r2.refine2(10000000)
+         ref2 = numpy.array([0.1, 4.917310e-02, 4.722438e-02, 0 , 0.  , 0.00000])
+-#        print "ref", ref2
+-#        print "obt", r2.param
+         for i, key in enumerate(("dist", "poni1", "poni2", "rot1", "rot2", "rot3")):
+             self.assertAlmostEqual(ref2[i], r2.__getattribute__(key), 3,
+                                    "%s is %s, I expected %s%s%s" % (key, r2.__getattribute__(key) , ref2[i], os.linesep, r2))
+diff --git a/test/test_mask.py b/test/test_mask.py
+index 0c74382..47d825e 100755
+--- a/test/test_mask.py
++++ b/test/test_mask.py
+@@ -23,11 +23,13 @@
+ #
+ "test suite for masked arrays"
+ 
++from __future__ import print_function
++
+ __author__ = "Jérôme Kieffer"
+ __contact__ = "Jerome.Kieffer at ESRF.eu"
+ __license__ = "GPLv3+"
+ __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+-__date__ = "10/03/2015"
++__date__ = "21/08/2015"
+ 
+ 
+ import unittest
+@@ -54,7 +56,6 @@ class TestMask(unittest.TestCase):
+         self.dataFile = UtilsTest.getimage(self.__class__.dataFile)
+         self.poniFile = UtilsTest.getimage(self.__class__.poniFile)
+         self.ai = pyFAI.load(self.poniFile)
+-#        self.ai.mask = None
+         self.data = fabio.open(self.dataFile).data
+         self.mask = self.data < 0
+ 
+@@ -251,7 +252,7 @@ class TestMaskBeamstop(unittest.TestCase):
+ 
+     def setUp(self):
+         """
+-        Download files 
++        Download files
+         Create a mask for tth<3.7 deg
+         """
+         self.dataFile = UtilsTest.getimage(self.__class__.dataFile)
+@@ -328,7 +329,7 @@ def test_suite_all_Mask():
+     testSuite.addTest(TestMask("test_mask_CSR"))
+     testSuite.addTest(TestMask("test_mask_LUT_OCL"))
+     testSuite.addTest(TestMask("test_mask_CSR_OCL"))
+-    
++
+     testSuite.addTest(TestMaskBeamstop("test_nomask"))
+     testSuite.addTest(TestMaskBeamstop("test_mask_splitBBox"))
+     testSuite.addTest(TestMaskBeamstop("test_mask_LUT"))
+diff --git a/test/test_peak_picking.py b/test/test_peak_picking.py
+index acfd8b5..506e493 100755
+--- a/test/test_peak_picking.py
++++ b/test/test_peak_picking.py
+@@ -25,11 +25,13 @@
+ #
+ "test suite for peak picking class"
+ 
++from __future__ import print_function
++
+ __author__ = "Jérôme Kieffer"
+ __contact__ = "Jerome.Kieffer at ESRF.eu"
+ __license__ = "GPLv3+"
+ __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+-__date__ = "20/03/2015"
++__date__ = "21/08/2015"
+ 
+ 
+ import unittest
+@@ -104,8 +106,6 @@ class testPeakPicking(unittest.TestCase):
+ 
+         self.pp.points.save(self.nptfile)
+         lstPeak = self.pp.points.getListRing()
+-#        print self.pp.points
+-#        print lstPeak
+         logger.info("After peak-picking, we have %s points generated from %s groups ", len(lstPeak), len(self.ctrlPt))
+         gr = GeometryRefinement(lstPeak, dist=0.01, pixel1=1e-4, pixel2=1e-4, wavelength=self.wavelength, calibrant=self.calibrant)
+         gr.guess_poni()
+@@ -126,8 +126,6 @@ class testPeakPicking(unittest.TestCase):
+         self.assertAlmostEquals(gr.rot2, 0, 2, "rot2 is OK, got %s, expected 0" % gr.rot2)
+         self.assertAlmostEquals(gr.rot3, 0, 2, "rot3 is OK, got %s, expected 0" % gr.rot3)
+ 
+-#        print self.pp.points
+-
+ 
+ class TestMassif(unittest.TestCase):
+     """test for ring extraction algorithm with image which needs binning (non regression test)"""
+diff --git a/test/test_polarization.py b/test/test_polarization.py
+index a587afd..9a89e63 100755
+--- a/test/test_polarization.py
++++ b/test/test_polarization.py
+@@ -24,11 +24,13 @@
+ #
+ "test suite for polarization corrections"
+ 
++from __future__ import print_function
++
+ __author__ = "Jérôme Kieffer"
+ __contact__ = "Jerome.Kieffer at ESRF.eu"
+ __license__ = "GPLv3+"
+ __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+-__date__ = "15/12/2014"
++__date__ = "21/08/2015"
+ 
+ 
+ import unittest
+@@ -54,10 +56,6 @@ class TestPolarization(unittest.TestCase):
+     rotX = numpy.radians(30.0 * X)
+     tth = numpy.sqrt(rotY ** 2 + rotX ** 2)
+     chi = numpy.arctan2(rotY, rotX)
+-#    print numpy.degrees(tth[6])
+-#    print numpy.degrees(chi[6])
+-#    print numpy.degrees(tth[:, 6])
+-#    print numpy.degrees(chi[:, 6])
+     ai = pyFAI.AzimuthalIntegrator(dist=1, pixel1=0.1, pixel2=0.1)
+     ai._ttha = tth
+     ai._chia = chi
diff --git a/debian/patches/series b/debian/patches/series
index ae710c5..78cdbb5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 0001-fix-pyFAI-when-third_party-is-missing.patch
+0002-fix-from-upstream-python3-installation.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyfai.git



More information about the debian-science-commits mailing list