This commit is contained in:
Jerome Kieffer 2015-10-23 10:58:01 +02:00
parent bcf26fe3e5
commit 0d97d2168e
33 changed files with 979 additions and 835 deletions

View File

@ -49,12 +49,37 @@ src/
crc32.pxd
fastcrc.pyx
test/profile_all.py
test/
profile_all.py
test_all.py
test_ocl_sort.py
test_azimuthal_integrator.py
test_bilinear.py
test_bispev.py
test_blob_detection.py
test_bug_regression.py
test_calibrant.py
test_convolution.py
test_csr.py
test_distortion.py
test_dummy.py
test_export.py
test_flat.py
test_geometry.py
test_geometry_refinement.py
test_histogram.py
test_integrate.py
test_io.py
test_marchingsquares.py
test_mask.py
test_multi_geometry.py
test_utils.py
test_ocl_sort.py
test_openCL.py
test_peak_picking.py
test_polarization.py
test_saxs.py
test_sparse.py
test_split_pixel.py
test_utils.py
test_watershed.py

View File

@ -28,7 +28,7 @@ Test module pyFAI.
# )
__authors__ = ["Jérôme Kieffer"]
__contact__ = "jerome.kieffer@esrf.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "20/08/2016"
import os
@ -46,9 +46,9 @@ from .test_all import test_suite_all
def run_tests():
"""Run test complete test_suite"""
mysuite = test_suite_all()
suite() = test_suite_all()
runner = unittest.TextTestRunner()
if not runner.run(mysuite).wasSuccessful():
if not runner.run(suite()).wasSuccessful():
print("Test suite failed")
return 1
else:

View File

@ -32,7 +32,7 @@ __authors__ = ["Jérôme Kieffer"]
__contact__ = "jerome.kieffer@esrf.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "22/10/2015"
__date__ = "23/10/2015"
import sys
import os
@ -45,72 +45,73 @@ from .utilstest import UtilsTest, getLogger
logger = getLogger("test_all")
from .test_dummy import test_suite_all_dummy
from .test_geometry_refinement import test_suite_all_GeometryRefinement
from .test_azimuthal_integrator import test_suite_all_AzimuthalIntegration
from .test_histogram import test_suite_all_Histogram
from .test_peak_picking import test_suite_all_PeakPicking
from .test_geometry import test_suite_all_Geometry
from .test_mask import test_suite_all_Mask
from .test_openCL import test_suite_all_OpenCL
from .test_export import test_suite_all_Export
from .test_saxs import test_suite_all_Saxs
from .test_integrate import test_suite_all_Integrate1d
from .test_bilinear import test_suite_all_bilinear
from .test_distortion import test_suite_all_distortion
from .test_flat import test_suite_all_Flat
from . import test_dummy
from . import test_histogram
from . import test_geometry_refinement
from . import test_azimuthal_integrator
from . import test_peak_picking
from . import test_geometry
from . import test_mask
from . import test_openCL
from . import test_export
from . import test_saxs
from . import test_integrate
from . import test_bilinear
from . import test_distortion
from . import test_flat
from . import test_utils
from .test_polarization import test_suite_all_polarization
from .test_detector import test_suite_all_detectors
from .test_convolution import test_suite_all_convolution
from .test_sparse import test_suite_all_sparse
from .test_csr import test_suite_all_OpenCL_CSR
from .test_blob_detection import test_suite_all_blob_detection
from .test_marchingsquares import test_suite_all_marchingsquares
from .test_io import test_suite_all_io
from .test_calibrant import test_suite_all_calibrant
from . import test_detector
from . import test_convolution
from . import test_sparse
from . import test_csr
from . import test_blob_detection
from . import test_marchingsquares
from . import test_io
from . import test_calibrant
from . import test_polarization
from . import test_split_pixel
from .test_bispev import test_suite_all_bispev
from .test_bug_regression import test_suite_bug_regression
from .test_multi_geometry import test_suite_all_multi_geometry
from . import test_bispev
from . import test_bug_regression
from . import test_watershed
from .test_ocl_sort import test_suite_all_ocl_sort
from . import test_multi_geometry
from . import test_ocl_sort
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(test_suite_all_dummy())
testsuite.addTest(test_suite_all_Histogram())
testsuite.addTest(test_suite_all_GeometryRefinement())
testsuite.addTest(test_suite_all_AzimuthalIntegration())
testsuite.addTest(test_suite_all_PeakPicking())
testsuite.addTest(test_suite_all_Geometry())
testsuite.addTest(test_suite_all_Mask())
testsuite.addTest(test_suite_all_OpenCL())
testsuite.addTest(test_suite_all_Export())
testsuite.addTest(test_suite_all_Saxs())
testsuite.addTest(test_suite_all_Integrate1d())
testsuite.addTest(test_suite_all_bilinear())
testsuite.addTest(test_suite_all_distortion())
testsuite.addTest(test_suite_all_Flat())
testsuite.addTest(test_dummy.suite())
testsuite.addTest(test_histogram.suite())
testsuite.addTest(test_geometry_refinement.suite())
testsuite.addTest(test_azimuthal_integrator.suite())
testsuite.addTest(test_peak_picking.suite())
testsuite.addTest(test_geometry.suite())
testsuite.addTest(test_mask.suite())
testsuite.addTest(test_openCL.suite())
testsuite.addTest(test_export.suite())
testsuite.addTest(test_saxs.suite())
testsuite.addTest(test_integrate.suite())
testsuite.addTest(test_bilinear.suite())
testsuite.addTest(test_distortion.suite())
testsuite.addTest(test_flat.suite())
testsuite.addTest(test_utils.suite())
testsuite.addTest(test_suite_all_detectors())
testsuite.addTest(test_suite_all_convolution())
testsuite.addTest(test_suite_all_sparse())
testsuite.addTest(test_suite_all_OpenCL_CSR())
testsuite.addTest(test_suite_all_blob_detection())
testsuite.addTest(test_suite_all_marchingsquares())
testsuite.addTest(test_suite_all_io())
testsuite.addTest(test_suite_all_calibrant())
testsuite.addTest(test_suite_all_polarization())
testsuite.addTest(test_detector.suite())
testsuite.addTest(test_convolution.suite())
testsuite.addTest(test_sparse.suite())
testsuite.addTest(test_csr.suite())
testsuite.addTest(test_blob_detection.suite())
testsuite.addTest(test_marchingsquares.suite())
testsuite.addTest(test_io.suite())
testsuite.addTest(test_calibrant.suite())
testsuite.addTest(test_polarization.suite())
testsuite.addTest(test_split_pixel.suite())
testsuite.addTest(test_suite_all_bispev())
testsuite.addTest(test_suite_bug_regression())
testsuite.addTest(test_bispev.suite())
testsuite.addTest(test_bug_regression.suite())
testsuite.addTest(test_watershed.suite())
testsuite.addTest(test_suite_all_multi_geometry())
testsuite.addTest(test_suite_all_ocl_sort())
testsuite.addTest(test_multi_geometry.suite())
testsuite.addTest(test_ocl_sort.suite())
return testsuite
if __name__ == '__main__':
runner = unittest.TextTestRunner()
if runner.run(suite()).wasSuccessful():

View File

@ -1,35 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for Azimuthal integrator class"
from __future__ import absolute_import, print_function, division
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for Azimuthal integrator class"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
@ -332,26 +336,22 @@ class TestSetter(unittest.TestCase):
self.assert_(abs(self.ai.darkcurrent - 0.5 * (self.rnd1 + self.rnd2)).max() == 0, "Dark array is OK")
def test_suite_all_AzimuthalIntegration():
testSuite = unittest.TestSuite()
testSuite.addTest(TestAzimHalfFrelon("test_cython_vs_fit2d"))
testSuite.addTest(TestAzimHalfFrelon("test_numpy_vs_fit2d"))
testSuite.addTest(TestAzimHalfFrelon("test_cythonSP_vs_fit2d"))
testSuite.addTest(TestAzimHalfFrelon("test_cython_vs_numpy"))
testSuite.addTest(TestAzimHalfFrelon("test_separate"))
testSuite.addTest(TestFlatimage("test_splitPixel"))
testSuite.addTest(TestFlatimage("test_splitBBox"))
testSuite.addTest(TestSetter("test_flat"))
testSuite.addTest(TestSetter("test_dark"))
testSuite.addTest(TestAzimPilatus("test_separate"))
# This test is known to be broken ...
testSuite.addTest(test_saxs("test_mask"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestAzimHalfFrelon("test_cython_vs_fit2d"))
testsuite.addTest(TestAzimHalfFrelon("test_numpy_vs_fit2d"))
testsuite.addTest(TestAzimHalfFrelon("test_cythonSP_vs_fit2d"))
testsuite.addTest(TestAzimHalfFrelon("test_cython_vs_numpy"))
testsuite.addTest(TestAzimHalfFrelon("test_separate"))
testsuite.addTest(TestFlatimage("test_splitPixel"))
testsuite.addTest(TestFlatimage("test_splitBBox"))
testsuite.addTest(TestSetter("test_flat"))
testsuite.addTest(TestSetter("test_dark"))
testsuite.addTest(TestAzimPilatus("test_separate"))
testsuite.addTest(test_saxs("test_mask"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_AzimuthalIntegration()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
UtilsTest.clean_up()

View File

@ -1,34 +1,38 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for bilinear interpolator class"
__doc__ = "test suite for bilinear interpolator class"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "08/05/2015"
__date__ = "23/10/2015"
import unittest
@ -117,15 +121,16 @@ class TestConversion(unittest.TestCase):
self.assert_(numpy.allclose(x.ravel(), x1), "Maximum error on x_center is %s" % (abs(x.ravel() - x1).max()))
self.assertEqual(z1, None, "flat detector")
def test_suite_all_bilinear():
testSuite = unittest.TestSuite()
testSuite.addTest(TestBilinear("test_max_search_round"))
testSuite.addTest(TestBilinear("test_max_search_half"))
testSuite.addTest(TestConversion("test4d"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestBilinear("test_max_search_round"))
testsuite.addTest(TestBilinear("test_max_search_half"))
testsuite.addTest(TestConversion("test4d"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_bilinear()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
UtilsTest.clean_up()

View File

@ -1,34 +1,40 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import absolute_import, division, print_function
"test suite for masked arrays"
__doc__ = "test suite for masked arrays"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
@ -107,14 +113,13 @@ class TestBispev(unittest.TestCase):
self.assert_(abs(dx_loc - dx_ref).max() < 2e-5, "Result are similar")
def test_suite_all_bispev():
testSuite = unittest.TestSuite()
testSuite.addTest(TestBispev("test_bispev"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestBispev("test_bispev"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_bispev()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
UtilsTest.clean_up()

View File

@ -1,41 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for blob detection cython accelerated code"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for blob detection cython accelerated code"
__author__ = "Jérôme Kieffer"
__contact__ = "Jérôme Kieffer"
__license__ = "GPLv3+"
__contact__ = "Jerome.Kieffer@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "03/09/2015"
__date__ = "23/10/2015"
import sys
import unittest
import numpy
import os
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import getLogger # UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
@ -84,17 +89,16 @@ class TestBlobDetection(unittest.TestCase):
local_max(bd.dogs, bd.cur_mask, True)), "max test, 3x5x5")
def test_suite_all_blob_detection():
testSuite = unittest.TestSuite()
testSuite.addTest(TestBlobDetection("test_local_max"))
# testSuite.addTest(TestConvolution("test_vertical_convolution"))
# testSuite.addTest(TestConvolution("test_gaussian"))
# testSuite.addTest(TestConvolution("test_gaussian_filter"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestBlobDetection("test_local_max"))
# testsuite.addTest(TestConvolution("test_vertical_convolution"))
# testsuite.addTest(TestConvolution("test_gaussian"))
# testsuite.addTest(TestConvolution("test_gaussian_filter"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_blob_detection()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,38 +1,43 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""test suite for non regression on some bugs.
from __future__ import absolute_import, division, print_function
__doc__ = """test suite for non regression on some bugs.
Please refer to their respective bug number
https://github.com/kif/pyFAI/issues
"""
__author__ = "Jérôme Kieffer"
__contact__ = "Jérôme Kieffer"
__license__ = "GPLv3+"
__contact__ = "Jerome.Kieffer@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "28/09/2015"
__date__ = "23/10/2015"
import sys
import os
@ -127,15 +132,15 @@ class TestBug211(unittest.TestCase):
"pyFAI-average with quantiles gives good results")
def test_suite_bug_regression():
testSuite = unittest.TestSuite()
testSuite.addTest(TestBug170("test_bug170"))
testSuite.addTest(TestBug211("test_quantile"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestBug170("test_bug170"))
testsuite.addTest(TestBug211("test_quantile"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_bug_regression()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,38 +1,45 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import absolute_import, division, print_function
"""
Test suites for calibrants
"""
__doc__ = """Test suites for calibrants"""
__author__ = "Jérôme Kieffer"
__contact__ = "Jérôme.Kieffer@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "23/10/2015"
import unittest
import sys
import os
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import getLogger, UtilsTest
@ -176,18 +183,18 @@ class TestCell(unittest.TestCase):
h.save("H", "Hydrogen", href, 1.0, UtilsTest.tempdir)
def test_suite_all_calibrant():
testSuite = unittest.TestSuite()
testSuite.addTest(TestCalibrant("test_factory"))
testSuite.addTest(TestCalibrant("test_2th"))
testSuite.addTest(TestCalibrant("test_fake"))
testSuite.addTest(TestCell("test_class"))
testSuite.addTest(TestCell("test_classmethods"))
testSuite.addTest(TestCell("test_dspacing"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestCalibrant("test_factory"))
testsuite.addTest(TestCalibrant("test_2th"))
testsuite.addTest(TestCalibrant("test_fake"))
testsuite.addTest(TestCell("test_class"))
testsuite.addTest(TestCell("test_classmethods"))
testsuite.addTest(TestCell("test_dspacing"))
return testsuite
__call__ = suite
if __name__ == '__main__':
mysuite = test_suite_all_calibrant()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,40 +1,46 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for convolution cython code"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for convolution cython code"
__author__ = "Jérôme Kieffer"
__contact__ = "Jérôme Kieffer"
__license__ = "GPLv3+"
__contact__ = "Jérôme.Kieffer@esrf.fr"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import sys
import unittest
import numpy
import os
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import getLogger # UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
@ -42,6 +48,7 @@ pyFAI = sys.modules["pyFAI"]
from pyFAI import _convolution
import scipy.ndimage, scipy.misc, scipy.signal
class TestConvolution(unittest.TestCase):
def setUp(self):
self.sigma = 1
@ -78,15 +85,14 @@ class TestConvolution(unittest.TestCase):
self.assert_(numpy.allclose(ref, obt), "gaussian filtered images are the same")
def test_suite_all_convolution():
testSuite = unittest.TestSuite()
testSuite.addTest(TestConvolution("test_horizontal_convolution"))
testSuite.addTest(TestConvolution("test_vertical_convolution"))
testSuite.addTest(TestConvolution("test_gaussian"))
testSuite.addTest(TestConvolution("test_gaussian_filter"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestConvolution("test_horizontal_convolution"))
testsuite.addTest(TestConvolution("test_vertical_convolution"))
testsuite.addTest(TestConvolution("test_gaussian"))
testsuite.addTest(TestConvolution("test_gaussian_filter"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_convolution()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,30 +1,35 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""tests for Jon's geometry changes
from __future__ import absolute_import, division, print_function
__doc__ = """tests for Jon's geometry changes
FIXME : make some tests that the functions do what is expected
"""
@ -54,7 +59,6 @@ data = fabio.open(UtilsTest.getimage("1883/Pilatus1M.edf")).data
ai.xrpd_LUT(data, N)
class ParameterisedTestCase(unittest.TestCase):
""" TestCase classes that want to be parameterised should
inherit from this class.
@ -136,19 +140,18 @@ class Test_CSR(unittest.TestCase):
self.assertTrue(numpy.allclose(img, img_csr), " img are the same")
def test_suite_all_OpenCL_CSR():
testSuite = unittest.TestSuite()
def suite():
testsuite = unittest.TestSuite()
if opencl.ocl:
for param in TESTCASES:
testSuite.addTest(ParameterisedTestCase.parameterise(
testsuite.addTest(ParameterisedTestCase.parameterise(
TestOpenclCSR, param))
# if no opencl: no test
# testSuite.addTest(Test_CSR("test_2d_splitbbox"))
# testSuite.addTest(Test_CSR("test_2d_nosplit"))
return testSuite
# testsuite.addTest(Test_CSR("test_2d_splitbbox"))
# testsuite.addTest(Test_CSR("test_2d_nosplit"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_OpenCL_CSR()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# https://github.com/pyFAI/pyFAI
@ -28,7 +28,7 @@ __author__ = "Picca Frédéric-Emmanuel, Jérôme Kieffer",
__contact__ = "picca@synchrotron-soleil.fr"
__license__ = "GPLv3+"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import sys
import os
@ -262,18 +262,18 @@ class TestDetector(unittest.TestCase):
self.assert_(abs(n3 - c3).max() < 1e-6, "cartesian coord3 cython == numpy")
def test_suite_all_detectors():
testSuite = unittest.TestSuite()
testSuite.addTest(TestDetector("test_detector_instanciate"))
testSuite.addTest(TestDetector("test_detector_imxpad_s140"))
testSuite.addTest(TestDetector("test_detector_rayonix_sx165"))
testSuite.addTest(TestDetector("test_nexus_detector"))
testSuite.addTest(TestDetector("test_guess_binning"))
testSuite.addTest(TestDetector("test_Xpad_flat"))
testSuite.addTest(TestDetector("test_non_flat"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestDetector("test_detector_instanciate"))
testsuite.addTest(TestDetector("test_detector_imxpad_s140"))
testsuite.addTest(TestDetector("test_detector_rayonix_sx165"))
testsuite.addTest(TestDetector("test_nexus_detector"))
testsuite.addTest(TestDetector("test_guess_binning"))
testsuite.addTest(TestDetector("test_Xpad_flat"))
testsuite.addTest(TestDetector("test_non_flat"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_detectors()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,44 +1,49 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for Distortion correction class"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for Distortion correction class"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "31/08/2015"
__date__ = "23/10/2015"
import unittest
# import os
import os
import numpy
# import logging, time
import sys
import fabio
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, getLogger
logger = getLogger(__file__)
@ -47,6 +52,7 @@ from pyFAI import _distortion, detectors
# _distortion = sys.modules["pyFAI._distortion"]
# detectors = sys.modules["pyFAI.detectors"]
class test_halfccd(unittest.TestCase):
"""basic test"""
halfFrelon = "1464/LaB6_0020.edf"
@ -92,21 +98,20 @@ class test_halfccd(unittest.TestCase):
logger.info("ratio of good points (less than 1/1000 relative error): %.4f" % good_points_ratio)
self.assert_(good_points_ratio > 0.99, "99% of all points have a relative error below 1/1000")
def test_suite_all_distortion():
testSuite = unittest.TestSuite()
testSuite.addTest(test_halfccd("test_vs_fit2d"))
# testSuite.addTest(test_azim_halfFrelon("test_numpy_vs_fit2d"))
# testSuite.addTest(test_azim_halfFrelon("test_cythonSP_vs_fit2d"))
# testSuite.addTest(test_azim_halfFrelon("test_cython_vs_numpy"))
# testSuite.addTest(test_flatimage("test_splitPixel"))
# testSuite.addTest(test_flatimage("test_splitBBox"))
# This test is known to be broken ...
# testSuite.addTest(test_saxs("test_mask"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(test_halfccd("test_vs_fit2d"))
# testsuite.addTest(test_azim_halfFrelon("test_numpy_vs_fit2d"))
# testsuite.addTest(test_azim_halfFrelon("test_cythonSP_vs_fit2d"))
# testsuite.addTest(test_azim_halfFrelon("test_cython_vs_numpy"))
# testsuite.addTest(test_flatimage("test_splitPixel"))
# testsuite.addTest(test_flatimage("test_splitBBox"))
# This test is known to be broken ...
# testsuite.addTest(test_saxs("test_mask"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_distortion()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,42 +1,48 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"Dummy test to run first to check for relative imports"
from __future__ import absolute_import, division, print_function
__doc__ = "Dummy test to run first to check for relative imports"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "15/12/2014"
__date__ = "23/10/2015"
import unittest
import sys
import os
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
from .utilstest import UtilsTest, getLogger
logger = getLogger(__file__)
pyFAI = sys.modules["pyFAI"]
@ -47,13 +53,13 @@ class TestDummy(unittest.TestCase):
print(pyFAI)
def test_suite_all_dummy():
testSuite = unittest.TestSuite()
testSuite.addTest(TestDummy("test_dummy"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestDummy("test_dummy"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_dummy()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
UtilsTest.clean_up()

View File

@ -1,36 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for masked arrays"
from __future__ import print_function
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for masked arrays"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "15/12/2014"
__date__ = "23/10/2015"
import fabio
@ -40,7 +43,7 @@ import os
import sys
import unittest
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
@ -51,6 +54,7 @@ pyFAI = sys.modules["pyFAI"]
if logger.getEffectiveLevel() <= logging.INFO:
import pylab
def testExport(direct=100, centerX=900, centerY=1000, tilt=0, tpr=0, pixelX=50, pixelY=60):
a1 = pyFAI.AzimuthalIntegrator()
@ -126,17 +130,16 @@ class TestSPD(unittest.TestCase):
self.assertAlmostEqual(refv, obtv , 4, "%s: %s != %s" % (key, refv, obtv))
def test_suite_all_Export():
testSuite = unittest.TestSuite()
testSuite.addTest(TestFIT2D("test_simple"))
testSuite.addTest(TestFIT2D("test_export"))
testSuite.addTest(TestSPD("test_simple"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestFIT2D("test_simple"))
testsuite.addTest(TestFIT2D("test_export"))
testsuite.addTest(TestSPD("test_simple"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_Export()
runner = unittest.TextTestRunner()
if not runner.run(mysuite).wasSuccessful():
if not runner.run(suite()).wasSuccessful():
sys.exit(1)

View File

@ -1,34 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for dark_current / flat_field correction"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for dark_current / flat_field correction"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
@ -39,7 +44,7 @@ import time
import sys
import fabio
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
@ -158,19 +163,16 @@ class TestFlat2D(unittest.TestCase):
self.assert_(I.max() - I.min() < test2d_direct[meth], "deviation should be small with meth %s, got %s" % (meth, I.max() - I.min()))
def test_suite_all_Flat():
testSuite = unittest.TestSuite()
testSuite.addTest(TestFlat1D("test_no_correct"))
testSuite.addTest(TestFlat1D("test_correct"))
testSuite.addTest(TestFlat2D("test_no_correct"))
testSuite.addTest(TestFlat2D("test_correct"))
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestFlat1D("test_no_correct"))
testsuite.addTest(TestFlat1D("test_correct"))
testsuite.addTest(TestFlat2D("test_no_correct"))
testsuite.addTest(TestFlat2D("test_correct"))
return testsuite
return testSuite
if __name__ == '__main__':
mysuite = test_suite_all_Flat()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,36 +1,50 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""tests for Jon's geometry changes
from __future__ import absolute_import, division, print_function
__doc__ = """tests for Jon's geometry changes
FIXME : make some tests that the functions do what is expected
"""
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "23/10/2015"
import unittest, numpy, os, sys, time
import unittest
import os
import sys
import time
import numpy
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, getLogger
logger = getLogger(__file__)
@ -262,22 +276,21 @@ TESTCASES = [
]
def test_suite_all_Geometry():
testSuite = unittest.TestSuite()
testSuite.addTest(TestSolidAngle("testSolidAngle"))
testSuite.addTest(TestBug88SolidAngle("testSolidAngle"))
testSuite.addTest(TestRecprocalSpacingSquarred("test_center"))
testSuite.addTest(TestRecprocalSpacingSquarred("test_corner"))
testSuite.addTest(TestRecprocalSpacingSquarred("test_delta"))
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestSolidAngle("testSolidAngle"))
testsuite.addTest(TestBug88SolidAngle("testSolidAngle"))
testsuite.addTest(TestRecprocalSpacingSquarred("test_center"))
testsuite.addTest(TestRecprocalSpacingSquarred("test_corner"))
testsuite.addTest(TestRecprocalSpacingSquarred("test_delta"))
for param in TESTCASES:
testSuite.addTest(ParameterisedTestCase.parameterise(
testsuite.addTest(ParameterisedTestCase.parameterise(
TestGeometry, param))
return testSuite
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_Geometry()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,37 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for Geometric Refinement class"
from __future__ import print_function
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for Geometric Refinement class"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "03/09/2015"
__date__ = "23/10/2015"
import unittest
import os
@ -221,15 +223,14 @@ class TestGeometryRefinement(unittest.TestCase):
# assert abs(numpy.array(r2.param) - ref2).max() < 1e-3
def test_suite_all_GeometryRefinement():
testSuite = unittest.TestSuite()
testSuite.addTest(TestGeometryRefinement("test_noSpline"))
testSuite.addTest(TestGeometryRefinement("test_Spline"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestGeometryRefinement("test_noSpline"))
testsuite.addTest(TestGeometryRefinement("test_Spline"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_GeometryRefinement()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,44 +1,49 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for histogramming implementations"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for histogramming implementations"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "16/10/2015"
__date__ = "23/10/2015"
import unittest
import time
import numpy
import logging
import sys
import platform
import os
from numpy import cos
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
@ -97,7 +102,6 @@ class TestHistogram1d(unittest.TestCase):
self.data_sum = self.size = self.err_max_cnt = None
self.bins_csr = self.I_csr = self.weight_csr = self.unweight_csr = None
def test_count_numpy(self):
"""
Test that the pixel count and the total intensity is conserved
@ -333,21 +337,19 @@ class TestHistogram2d(unittest.TestCase):
self.assert_(delta_max < 31, "Intensity count difference numpy/csr : max delta=%s" % delta_max)
def test_suite_all_Histogram():
testSuite = unittest.TestSuite()
testSuite.addTest(TestHistogram1d("test_count_numpy"))
testSuite.addTest(TestHistogram1d("test_count_cython"))
testSuite.addTest(TestHistogram1d("test_count_csr"))
testSuite.addTest(TestHistogram1d("test_numpy_vs_cython_vs_csr_1d"))
testSuite.addTest(TestHistogram2d("test_count_numpy"))
testSuite.addTest(TestHistogram2d("test_count_cython"))
testSuite.addTest(TestHistogram2d("test_count_csr"))
testSuite.addTest(TestHistogram2d("test_numpy_vs_cython_vs_csr_2d"))
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestHistogram1d("test_count_numpy"))
testsuite.addTest(TestHistogram1d("test_count_cython"))
testsuite.addTest(TestHistogram1d("test_count_csr"))
testsuite.addTest(TestHistogram1d("test_numpy_vs_cython_vs_csr_1d"))
testsuite.addTest(TestHistogram2d("test_count_numpy"))
testsuite.addTest(TestHistogram2d("test_count_cython"))
testsuite.addTest(TestHistogram2d("test_count_csr"))
testsuite.addTest(TestHistogram2d("test_numpy_vs_cython_vs_csr_2d"))
return testsuite
return testSuite
if __name__ == '__main__':
mysuite = test_suite_all_Histogram()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,44 +1,51 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for masked arrays"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for masked arrays"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
import os
import numpy
import logging, time
import logging
import time
import sys
import fabio
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
@ -47,6 +54,7 @@ pyFAI = sys.modules["pyFAI"]
if logger.getEffectiveLevel() <= logging.INFO:
import pylab
class TestIntegrate1D(unittest.TestCase):
def setUp(self):
@ -103,6 +111,7 @@ class TestIntegrate1D(unittest.TestCase):
logger.info(mesg)
self.assertTrue(R <= self.Rmax, mesg)
class TestIntegrate2D(unittest.TestCase):
npt = 500
img = UtilsTest.getimage("1883/Pilatus1M.edf")
@ -173,21 +182,20 @@ class TestIntegrate2D(unittest.TestCase):
self.assertTrue(R <= self.Rmax, mesg)
def test_suite_all_Integrate1d():
testSuite = unittest.TestSuite()
testSuite.addTest(TestIntegrate1D("testQ"))
testSuite.addTest(TestIntegrate1D("testR"))
testSuite.addTest(TestIntegrate1D("test2th"))
testSuite.addTest(TestIntegrate2D("testQ"))
testSuite.addTest(TestIntegrate2D("testR"))
testSuite.addTest(TestIntegrate2D("test2th"))
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestIntegrate1D("testQ"))
testsuite.addTest(TestIntegrate1D("testR"))
testsuite.addTest(TestIntegrate1D("test2th"))
testsuite.addTest(TestIntegrate2D("testQ"))
testsuite.addTest(TestIntegrate2D("testR"))
testsuite.addTest(TestIntegrate2D("test2th"))
return testSuite
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_Integrate1d()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
# if logger.getEffectiveLevel() == logging.DEBUG:
# pylab.legend()
# pylab.show()

View File

@ -1,34 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for input/output stuff"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for input/output stuff"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
@ -123,7 +128,6 @@ class testHDF5Writer(unittest.TestCase):
self.assert_(statinfo.st_size / 1e6 > nmbytes, "file size (%s) is larger than dataset" % statinfo.st_size)
class testFabIOWriter(unittest.TestCase):
def setUp(self):
@ -132,7 +136,6 @@ class testFabIOWriter(unittest.TestCase):
if not os.path.isdir(self.tmpdir):
os.mkdir(self.tmpdir)
def tearDown(self):
unittest.TestCase.tearDown(self)
shutil.rmtree(self.tmpdir)
@ -157,17 +160,16 @@ class testFabIOWriter(unittest.TestCase):
self.assert_(statinfo.st_size / 1e6 > nmbytes, "file size (%s) is larger than dataset" % statinfo.st_size)
def test_suite_all_io():
testSuite = unittest.TestSuite()
testSuite.addTest(TestIsoTime("test_get"))
testSuite.addTest(TestIsoTime("test_from"))
testSuite.addTest(TestNexus("test_new_detector"))
testSuite.addTest(testHDF5Writer("test_writer"))
# testSuite.addTest(testFabIOWriter("test_writer"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestIsoTime("test_get"))
testsuite.addTest(TestIsoTime("test_from"))
testsuite.addTest(TestNexus("test_new_detector"))
testsuite.addTest(testHDF5Writer("test_writer"))
# testsuite.addTest(testFabIOWriter("test_writer"))
return testsuite
if is_main:
mysuite = test_suite_all_io()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
UtilsTest.clean_up()

View File

@ -1,34 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"test suite for marching_squares / isocontour"
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for marching_squares / isocontour"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "15/12/2014"
__date__ = "23/10/2015"
import unittest
@ -47,6 +52,7 @@ from pyFAI.marchingsquares import isocontour
if logger.getEffectiveLevel() <= logging.INFO:
import pylab
class TestMarchingSquares(unittest.TestCase):
def test_isocontour(self):
ref = 50
@ -62,13 +68,12 @@ class TestMarchingSquares(unittest.TestCase):
pylab.plot(c[:, 1], c[:, 0], ",")
pylab.show()
def test_suite_all_marchingsquares():
testSuite = unittest.TestSuite()
testSuite.addTest(TestMarchingSquares("test_isocontour"))
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestMarchingSquares("test_isocontour"))
return testSuite
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_marchingsquares()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,35 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"test suite for masked arrays"
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import print_function
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for masked arrays"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
@ -37,8 +41,9 @@ import numpy
import logging
import sys
import fabio
import os
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, getLogger
logger = getLogger(__file__)
@ -47,6 +52,7 @@ pyFAI = sys.modules["pyFAI"]
if logger.getEffectiveLevel() <= logging.INFO:
import pylab
class TestMask(unittest.TestCase):
dataFile = "1894/testMask.edf"
poniFile = "1893/Pilatus1M.poni"
@ -186,7 +192,6 @@ class TestMask(unittest.TestCase):
self.assertAlmostEqual(res2, 0, 1, msg="With mask the bad pixels are actually Nan (got %.4f)" % res2)
self.assertAlmostEqual(res3, -20., 4, msg="Without mask but dummy=-20 the dummy pixels are actually at -20 (got % .4f)" % res3)
def test_mask_LUT_OCL(self):
"""
The masked image has a masked ring around 1.5deg with value -10
@ -312,26 +317,25 @@ class TestMaskBeamstop(unittest.TestCase):
self.assertAlmostEqual(tth[0], 1.0, 1, msg="tth range should start at 1.0 (got %.4f)" % tth[0])
def test_suite_all_Mask():
testSuite = unittest.TestSuite()
testSuite.addTest(TestMask("test_mask_hist"))
testSuite.addTest(TestMask("test_mask_splitBBox"))
testSuite.addTest(TestMask("test_mask_splitfull"))
testSuite.addTest(TestMask("test_mask_LUT"))
testSuite.addTest(TestMask("test_mask_CSR"))
testSuite.addTest(TestMask("test_mask_LUT_OCL"))
testSuite.addTest(TestMask("test_mask_CSR_OCL"))
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestMask("test_mask_hist"))
testsuite.addTest(TestMask("test_mask_splitBBox"))
testsuite.addTest(TestMask("test_mask_splitfull"))
testsuite.addTest(TestMask("test_mask_LUT"))
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"))
testsuite.addTest(TestMaskBeamstop("test_mask_LUT_OCL"))
testsuite.addTest(TestMaskBeamstop("test_nomask_LUT"))
testsuite.addTest(TestMaskBeamstop("test_nomask_LUT_OCL"))
return testsuite
testSuite.addTest(TestMaskBeamstop("test_nomask"))
testSuite.addTest(TestMaskBeamstop("test_mask_splitBBox"))
testSuite.addTest(TestMaskBeamstop("test_mask_LUT"))
testSuite.addTest(TestMaskBeamstop("test_mask_LUT_OCL"))
testSuite.addTest(TestMaskBeamstop("test_nomask_LUT"))
testSuite.addTest(TestMaskBeamstop("test_nomask_LUT_OCL"))
return testSuite
if __name__ == '__main__':
mysuite = test_suite_all_Mask()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -29,10 +29,17 @@
from __future__ import absolute_import, print_function, with_statement, division
__doc__ = """Test suites for multi_geometry modules"""
__date__ = "16/10/2015"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "23/10/2015"
import unittest, numpy, os, sys, time, logging
import os
import sys
import time
import unittest
import logging
if sys.version_info[0] > 2:
raw_input = input
if __name__ == '__main__':
@ -142,7 +149,6 @@ def suite():
testsuite.addTest(TestMultiGeometry("test_integrate2d"))
return testsuite
test_suite_all_multi_geometry = suite
if __name__ == '__main__':
runner = unittest.TextTestRunner()

View File

@ -25,14 +25,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""
Test for OpenCL sorting on GPU
"""
from __future__ import absolute_import, print_function, division
__doc__ = """Test for OpenCL sorting on GPU"""
__author__ = "Jérôme Kieffer"
__license__ = "MIT"
__date__ = "23/09/2015"
__date__ = "23/10/2015"
__copyright__ = "2015, ESRF, Grenoble"
__contact__ = "jerome.kieffer@esrf.fr"
@ -124,19 +121,18 @@ class TestOclSort(unittest.TestCase):
s.reset_timer()
def test_suite_all_ocl_sort():
testSuite = unittest.TestSuite()
def suite():
testsuite = unittest.TestSuite()
if skip:
logger.warning("OpenCL module (pyopencl) is not present or no device available: skip test_ocl_sort")
else:
testSuite.addTest(TestOclSort("test_sort_hor"))
testSuite.addTest(TestOclSort("test_sort_vert"))
testSuite.addTest(TestOclSort("test_filter_hor"))
testSuite.addTest(TestOclSort("test_filter_vert"))
return testSuite
testsuite.addTest(TestOclSort("test_sort_hor"))
testsuite.addTest(TestOclSort("test_sort_vert"))
testsuite.addTest(TestOclSort("test_filter_hor"))
testsuite.addTest(TestOclSort("test_filter_vert"))
return testsuite
if is_main:
mysuite = test_suite_all_ocl_sort()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
UtilsTest.clean_up()

View File

@ -1,33 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"test suite for OpenCL code"
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for OpenCL code"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
@ -36,7 +42,6 @@ import time
import sys
import fabio
import gc
import tempfile
import numpy
import platform
if __name__ == '__main__':
@ -289,23 +294,22 @@ class TestSort(unittest.TestCase):
self.assert_(err == 0.0)
def test_suite_all_OpenCL():
testSuite = unittest.TestSuite()
def suite():
testsuite = unittest.TestSuite()
if skip:
logger.warning("OpenCL module (pyopencl) is not present or no device available: skip tests")
else:
testSuite.addTest(TestMask("test_OpenCL"))
testSuite.addTest(TestMask("test_OpenCL_LUT"))
testSuite.addTest(TestMask("test_OpenCL_CSR"))
testSuite.addTest(TestSort("test_reference_book"))
testSuite.addTest(TestSort("test_reference_file"))
testSuite.addTest(TestSort("test_sort_all"))
testSuite.addTest(TestSort("test_sort_horizontal"))
testSuite.addTest(TestSort("test_sort_vertical"))
return testSuite
testsuite.addTest(TestMask("test_OpenCL"))
testsuite.addTest(TestMask("test_OpenCL_LUT"))
testsuite.addTest(TestMask("test_OpenCL_CSR"))
testsuite.addTest(TestSort("test_reference_book"))
testsuite.addTest(TestSort("test_reference_file"))
testsuite.addTest(TestSort("test_sort_all"))
testsuite.addTest(TestSort("test_sort_horizontal"))
testsuite.addTest(TestSort("test_sort_vertical"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_OpenCL()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,37 +1,39 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
"test suite for peak picking class"
from __future__ import print_function
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for peak picking class"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
@ -94,6 +96,7 @@ class testPeakPicking(unittest.TestCase):
os.unlink(self.logfile)
if os.path.isfile(self.nptfile):
os.unlink(self.nptfile)
def tearDown(self):
"""Remove temporary files"""
recursive_delete(self.tmp_dir)
@ -139,13 +142,12 @@ class TestMassif(unittest.TestCase):
#TODO !!!
def test_suite_all_PeakPicking():
testSuite = unittest.TestSuite()
testSuite.addTest(testPeakPicking("test_peakPicking"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(testPeakPicking("test_peakPicking"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_PeakPicking()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,46 +1,50 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal integration
# https://github.com/kif/pyFAI
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"test suite for polarization corrections"
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import print_function
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for polarization corrections"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
import os
import numpy
import logging, time
import logging
import time
import sys
import fabio
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
@ -49,6 +53,7 @@ pyFAI = sys.modules["pyFAI"]
if logger.getEffectiveLevel() <= logging.INFO:
import pylab
class TestPolarization(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
@ -66,7 +71,6 @@ class TestPolarization(unittest.TestCase):
unittest.TestCase.tearDown(self)
self.shape = self.rotY = self.rotX = self.tth = self.ai = None
def testNoPol(self):
"without polarization correction should be 1"
self.assert_(abs(self.ai.polarization(factor=None) - numpy.ones(self.shape)).max() == 0, "without polarization correction should be 1")
@ -93,18 +97,17 @@ class TestPolarization(unittest.TestCase):
self.assert_(abs(self.ai.polarization(factor=1, axis_offset=numpy.pi / 2)[:, 6] - (numpy.cos((2 * self.rotX)) + 1) / 2).max() < 1e-15, "cos(2th)^2 like in the verical plane")
def test_suite_all_polarization():
testSuite = unittest.TestSuite()
testSuite.addTest(TestPolarization("testNoPol"))
testSuite.addTest(TestPolarization("testCircularPol"))
testSuite.addTest(TestPolarization("testHorizPol"))
testSuite.addTest(TestPolarization("testVertPol"))
testSuite.addTest(TestPolarization("testoffsetPol"))
# testSuite.addTest(TestPolarization("test2th"))
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestPolarization("testNoPol"))
testsuite.addTest(TestPolarization("testCircularPol"))
testsuite.addTest(TestPolarization("testHorizPol"))
testsuite.addTest(TestPolarization("testVertPol"))
testsuite.addTest(TestPolarization("testoffsetPol"))
# testsuite.addTest(TestPolarization("test2th"))
return testsuite
return testSuite
if __name__ == '__main__':
mysuite = test_suite_all_polarization()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -1,45 +1,50 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Azimuthal integration
# https://forge.epn-campus.eu/projects/azimuthal
# https://github.com/pyFAI/pyFAI
#
# File: "$Id$"
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"test suite for masked arrays"
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import absolute_import, division, print_function
__doc__ = "test suite for masked arrays"
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "GPLv3+"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "01/09/2015"
__date__ = "23/10/2015"
import unittest
import os
import numpy
import logging, time
import logging
import time
import sys
import fabio
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, Rwp, getLogger
logger = getLogger(__file__)
@ -48,6 +53,7 @@ pyFAI = sys.modules["pyFAI"]
if logger.getEffectiveLevel() <= logging.INFO:
import pylab
class TestSaxs(unittest.TestCase):
def setUp(self):
@ -131,24 +137,24 @@ class TestSaxs(unittest.TestCase):
pylab.yscale("log")
self.assertEqual(R < 20, True, "SplitPixel: Measure R=%s<20" % R)
def test_suite_all_Saxs():
testSuite = unittest.TestSuite()
testSuite.addTest(TestSaxs("testMask"))
testSuite.addTest(TestSaxs("testNumpy"))
# testSuite.addTest(TestSaxs("testCython"))
testSuite.addTest(TestSaxs("testSplitBBox"))
testSuite.addTest(TestSaxs("testSplitPixel"))
# testSuite.addTest(TestSaxs("test_mask_splitBBox"))
# testSuite.addTest(TestSaxs("test_mask_splitBBox"))
# testSuite.addTest(TestSaxs("test_mask_splitBBox"))
# testSuite.addTest(TestSaxs("test_mask_splitBBox"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestSaxs("testMask"))
testsuite.addTest(TestSaxs("testNumpy"))
# testsuite.addTest(TestSaxs("testCython"))
testsuite.addTest(TestSaxs("testSplitBBox"))
testsuite.addTest(TestSaxs("testSplitPixel"))
# testsuite.addTest(TestSaxs("test_mask_splitBBox"))
# testsuite.addTest(TestSaxs("test_mask_splitBBox"))
# testsuite.addTest(TestSaxs("test_mask_splitBBox"))
# testsuite.addTest(TestSaxs("test_mask_splitBBox"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_Saxs()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())
if logger.getEffectiveLevel() == logging.DEBUG:
pylab.legend()
pylab.show()

View File

@ -1,36 +1,48 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!/usr/bin/python
# coding: utf-8
#
# Project: Fast Azimuthal Integration
# Project: Azimuthal integration
# https://github.com/pyFAI/pyFAI
#
# Copyright (C) European Synchrotron Radiation Facility, Grenoble, France
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import absolute_import, division, print_function
__doc__ = """Test suites for sparse matrix multiplication modules"""
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "23/10/2015"
"""
Test suites for sparse matrix multiplication modules
"""
import unittest, numpy, os, sys, time
import unittest
import numpy
import os
import sys
import time
if __name__ == '__main__':
import pkgutil, os
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, getLogger
logger = getLogger(__file__)
@ -82,14 +94,13 @@ class TestSparseBBox(unittest.TestCase):
self.assert_(numpy.allclose(obt, ref))
def test_suite_all_sparse():
testSuite = unittest.TestSuite()
testSuite.addTest(TestSparseBBox("test_LUT"))
testSuite.addTest(TestSparseBBox("test_CSR"))
return testSuite
def suite():
testsuite = unittest.TestSuite()
testsuite.addTest(TestSparseBBox("test_LUT"))
testsuite.addTest(TestSparseBBox("test_CSR"))
return testsuite
if __name__ == '__main__':
mysuite = test_suite_all_sparse()
runner = unittest.TextTestRunner()
runner.run(mysuite)
runner.run(suite())

View File

@ -26,12 +26,17 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
from __future__ import absolute_import, division, print_function
"""
Test suites for pixel splitting scheme validation
__doc__ = """Test suites for pixel splitting scheme validation
see sandbox/debug_split_pixel.py for visual validation
"""
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "23/10/2015"
import unittest, numpy, os, sys, time
if __name__ == '__main__':

View File

@ -27,23 +27,22 @@
# THE SOFTWARE.
from __future__ import division, print_function, absolute_import
__doc__ = "test suite for inverse watershed space segmenting code."
__author__ = "Jérôme Kieffer"
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "22/10/2015"
__date__ = "23/10/2015"
import unittest
import numpy
import sys
import os
import fabio
import tempfile
if __name__ == '__main__':
import pkgutil
__path__ = pkgutil.extend_path([os.path.dirname(__file__)], "pyFAI.test")
from .utilstest import UtilsTest, getLogger, recursive_delete
from .utilstest import UtilsTest, getLogger
logger = getLogger(__file__)
pyFAI = sys.modules["pyFAI"]
import pyFAI.watershed
@ -70,9 +69,9 @@ class TestWatershed(unittest.TestCase):
def suite():
testSuite = unittest.TestSuite()
testSuite.addTest(TestWatershed("test_init"))
return testSuite
testsuite = unittest.TestSuite()
testsuite.addTest(TestWatershed("test_init"))
return testsuite
if __name__ == '__main__':
runner = unittest.TextTestRunner()

View File

@ -26,7 +26,7 @@ from __future__ import print_function, division, absolute_import, with_statement
__author__ = "Jérôme Kieffer"
__contact__ = "jerome.kieffer@esrf.eu"
__license__ = "LGPLv3+"
__license__ = "LMIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "28/09/2015"