Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate ci #1906

Merged
merged 8 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ build_deb() {
python3 setup.py debian_src
directory=${project}-${strictversion}
else
python -m build -s
python3 -m build -s
ln -s ${source_project}-${strictversion}.tar.gz dist/${tarname}
directory=${source_project}-${strictversion}
fi
Expand Down
6 changes: 5 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('pyFAI',
'c', 'cython',
'c', 'cpp', 'cython',
license: 'MIT',
meson_version: '>= 0.60',
version: run_command(['version.py', '--wheel'],
Expand All @@ -14,6 +14,10 @@ if meson.backend() != 'ninja'
endif

cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
cy = meson.get_compiler('cython')
# We need -lm for all C code (assuming it uses math functions, which is safe).
# For C++ it isn't needed, because libstdc++/libc++ is guaranteed to depend on it.
m_dep = cc.find_library('m', required : false)
if m_dep.found()
add_project_link_arguments('-lm', language : 'c')
Expand Down
7 changes: 5 additions & 2 deletions pyFAI/ext/sparse_builder.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

__author__ = "Valentin Valls"
__license__ = "MIT"
__date__ = "26/06/2023"
__date__ = "04/07/2023"
__copyright__ = "2018-2021, ESRF"

import logging
Expand Down Expand Up @@ -464,6 +464,9 @@ cdef class SparseBuilder(object):

self._mode = mode

def __repr__(self):
return f"SparseBuilder in mode: {self._mode}, blocksize: {self._block_size}, nbin: {self._nbin}, total size: {self.size()}"

def __dealloc__(self):
"""Release memory."""
cdef:
Expand Down Expand Up @@ -868,7 +871,7 @@ cdef class SparseBuilder(object):
nbins[bin_id + 1] = size

if size == 0:
logger.warning("Sparse matrix is empty. Expect errors or non-sense results!")
logger.warning("Sparse matrix is empty. Expect errors or non-sense results! %s", self)

indexes = numpy.empty(size, dtype=numpy.int32)
coefs = numpy.empty(size, dtype=numpy.float32)
Expand Down
26 changes: 13 additions & 13 deletions pyFAI/test/test_azimuthal_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
__contact__ = "Jerome.Kieffer@ESRF.eu"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "28/06/2023"
__date__ = "04/07/2023"

import unittest
import os
Expand Down Expand Up @@ -353,7 +353,8 @@ def test_guess_rad(self):
def test_guess_polarization(self):
img = fabio.open(UtilsTest.getimage("Eiger4M.edf")).data
ai = AzimuthalIntegrator.sload(UtilsTest.getimage("Eiger4M.poni"))
self.assertLess(abs(ai.guess_polarization(img)-0.5), 0.1)
self.assertLess(abs(ai.guess_polarization(img) - 0.5), 0.1)


class TestSaxs(unittest.TestCase):
saxsPilatus = "bsa_013_01.edf"
Expand Down Expand Up @@ -502,15 +503,14 @@ def test_empty_csr(self):
ai = AzimuthalIntegrator(detector="Pilatus100k", wavelength=1e-10)
with self.assertLogs('pyFAI.ext.sparse_builder', level='WARNING') as cm:
ai.setup_sparse_integrator(shape=ai.detector.shape, npt=100,
pos0_range=(90,100),
pos0_range=(90, 100),
unit="2th_deg",
split='no',
algo='CSR',
empty=None,
scale=True)
self.assertEqual(cm.output, [
'WARNING:pyFAI.ext.sparse_builder:Sparse matrix is empty. Expect errors or non-sense results!'
])
self.assertTrue(cm.output[0].startswith('WARNING:pyFAI.ext.sparse_builder:Sparse matrix is empty. Expect errors or non-sense results!'),
"Actually emits the expected warning")


class TestSetter(unittest.TestCase):
Expand Down Expand Up @@ -601,7 +601,7 @@ def setUpClass(cls):
def tearDownClass(cls):
cls.unit = cls.azim_range = cls.rad_range = cls.ai = cls.img = None

def tearDown(self)->None:
def tearDown(self) -> None:
self.ai.reset()

def test_medfilt(self):
Expand Down Expand Up @@ -661,12 +661,12 @@ def test_variance_2d(self, error_model="poisson"):
# logger.error("psutil missing")
# else:
# logger.warning("Memory consumption: %s",psutil.virtual_memory())
ai = AzimuthalIntegrator.sload(self.ai) #make an empty copy and work on just one module of the detector (much faster)
ai = AzimuthalIntegrator.sload(self.ai) # make an empty copy and work on just one module of the detector (much faster)
ai.detector = detector_factory("Pilatus_100k")
img = self.img[:ai.detector.shape[0],:ai.detector.shape[1]]

methods = { k.method[1:4]:k for k in IntegrationMethod.select_method(dim=2)}
logger.info("methods investigated"+ "\n".join([str(i) for i in methods.values()]))
logger.info("methods investigated" + "\n".join([str(i) for i in methods.values()]))

error_model = ErrorModel.parse(error_model)
if error_model == ErrorModel.VARIANCE:
Expand All @@ -678,17 +678,17 @@ def test_variance_2d(self, error_model="poisson"):
res = ai.integrate2d_ng(img, 11, 13, variance=variance, error_model=error_model, method=m)
# ai.reset()
v = res.sum_variance
if v.min()< 0:
if v.min() < 0:
failed.append(f"min variance is positive or null with {res.method}, error model {error_model.as_str()}")
# print_mem()
if v.max()<= 0:
if v.max() <= 0:
failed.append(f"max variance is strictly positive with {res.method}, error model {error_model.as_str()}")
# print_mem()
s = res.sigma
if s.min()< 0:
if s.min() < 0:
failed.append(f"min sigma is positive or null with {res.method}, error model {error_model.as_str()}")
# print_mem()
if s.max()<= 0:
if s.max() <= 0:
failed.append(f"max sigma is strictly positive with {res.method}, error model {error_model.as_str()}")
# print_mem()
for err_msg in failed:
Expand Down
Empty file modified version.py
100644 → 100755
Empty file.