mirror of https://github.com/silx-kit/pyFAI.git
Merge remote-tracking branch 'origin/0.18'
This commit is contained in:
commit
9ffa2c19a1
|
@ -41,6 +41,13 @@ import unittest
|
|||
import numpy
|
||||
from pyFAI.utils import ellipse as ellipse_mdl
|
||||
|
||||
def modulo(value, div=numpy.pi):
|
||||
"""hack to calculate the value%div but returns the smallest
|
||||
absolute value, possibly negative"""
|
||||
q = value/div
|
||||
i = round(q)
|
||||
return (i-q) * div
|
||||
|
||||
|
||||
class TestEllipse(unittest.TestCase):
|
||||
|
||||
|
@ -53,7 +60,7 @@ class TestEllipse(unittest.TestCase):
|
|||
self.assertAlmostEqual(ellipse.center_2, 100)
|
||||
self.assertAlmostEqual(ellipse.half_long_axis, 20)
|
||||
self.assertAlmostEqual(ellipse.half_short_axis, 10)
|
||||
self.assertAlmostEqual(ellipse.angle, 0)
|
||||
self.assertAlmostEqual(modulo(ellipse.angle), 0)
|
||||
|
||||
def test_ellipse2(self):
|
||||
angles = numpy.arange(0, numpy.pi * 2, 0.2)
|
||||
|
@ -64,7 +71,7 @@ class TestEllipse(unittest.TestCase):
|
|||
self.assertAlmostEqual(ellipse.center_2, 100)
|
||||
self.assertAlmostEqual(ellipse.half_long_axis, 20)
|
||||
self.assertAlmostEqual(ellipse.half_short_axis, 10)
|
||||
self.assertAlmostEqual(ellipse.angle, numpy.pi)
|
||||
self.assertAlmostEqual(modulo(ellipse.angle), 0)
|
||||
|
||||
def test_half_circle(self):
|
||||
angles = numpy.linspace(0, numpy.pi, 10)
|
||||
|
|
Loading…
Reference in New Issue