-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1927 from kif/1909_noisy_test
1909 noisy test
- Loading branch information
Showing
4 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "MIT" | ||
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" | ||
__date__ = "17/03/2023" | ||
__date__ = "30/08/2023" | ||
|
||
import unittest | ||
import random | ||
|
@@ -309,6 +309,7 @@ def calc_geometries(cls): | |
] | ||
|
||
for _ in range(number_of_geometries): | ||
random.seed(0) | ||
geo = {"dist": 0.01 + random.random(), | ||
"poni1": random.random() - 0.5, | ||
"poni2": random.random() - 0.5, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ | |
__contact__ = "[email protected]" | ||
__license__ = "MIT" | ||
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" | ||
__date__ = "17/03/2023" | ||
__date__ = "30/08/2023" | ||
|
||
import unittest | ||
import platform | ||
|
@@ -96,7 +96,7 @@ def test_area(self): | |
buf = numpy.zeros(int(max(pos) + 3), numpy.float32) | ||
for i in range(4): | ||
splitPixel._sp_integrate1d(buf, *b[2 * i:2 * i + 4]) | ||
print(buf, buf.sum(), ref, trp) | ||
# print(buf, buf.sum(), ref, trp) | ||
self.assertAlmostEqual(abs(buf.sum()), ref, 4, "Check integration") | ||
|
||
|
||
|
@@ -209,14 +209,18 @@ class TestSplitBBoxNg(unittest.TestCase): | |
@classmethod | ||
def setUpClass(cls): | ||
super(TestSplitBBoxNg, cls).setUpClass() | ||
|
||
#fix seed, decrease noise while testing: | ||
rng = numpy.random.Generator(numpy.random.PCG64(seed=0)) | ||
|
||
det = Detector.factory("Pilatus 100k") | ||
shape = det.shape | ||
# The randomness of the image is not correlated to bug #1021 | ||
cls.maxi = 65000 | ||
img = numpy.random.randint(0, cls.maxi, numpy.prod(shape)) | ||
img = (rng.random(numpy.prod(shape))*cls.maxi).astype(numpy.uint16) | ||
|
||
if platform.machine() in ("i386", "i686", "x86_64") and (tuple.__itemsize__ == 4): | ||
cls.epsilon = 1e-13 | ||
cls.epsilon = 3e-13 | ||
else: | ||
cls.epsilon = numpy.finfo(numpy.float64).eps | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters