Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-fabio for openSUSE:Factory checked in at 2024-07-11 20:33:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-fabio (Old) and /work/SRC/openSUSE:Factory/.python-fabio.new.17339 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-fabio" Thu Jul 11 20:33:07 2024 rev:7 rq:1186778 version:2024.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-fabio/python-fabio.changes 2024-03-06 23:04:42.781707693 +0100 +++ /work/SRC/openSUSE:Factory/.python-fabio.new.17339/python-fabio.changes 2024-07-11 20:33:47.542208236 +0200 @@ -1,0 +2,9 @@ +Thu Jul 4 07:20:42 UTC 2024 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 2024.4: + * Support for new style GE-files (contribution from Patrick Avery) + * Support sparse frames without background (for XPCS) + * Support for Numpy v2.0 + * Support Python 3.7-3.12 + +------------------------------------------------------------------- Old: ---- fabio-2023.10.tar.gz New: ---- fabio-2024.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-fabio.spec ++++++ --- /var/tmp/diff_new_pack.9k83R9/_old 2024-07-11 20:33:48.730251190 +0200 +++ /var/tmp/diff_new_pack.9k83R9/_new 2024-07-11 20:33:48.738251480 +0200 @@ -16,9 +16,9 @@ # -%define pyversion 2023.10.0 +%define pyversion 2024.4.0 Name: python-fabio -Version: 2023.10 +Version: 2024.4 Release: 0 Summary: Image IO for images produced by 2D X-ray detectors License: BSD-3-Clause AND GPL-2.0-or-later AND LGPL-3.0-or-later AND MIT @@ -59,13 +59,11 @@ find src -name '*.py' -and ! -path src/fabio/_version.py -exec sed -i '1{/^#!/d}' '{}' ';' -exec chmod -x '{}' ';' %build -%{python_expand # _version.py is called during meson build -sed -i '1{s|^#!.*$|#!%{__$python}|}' src/fabio/_version.py -%{$python_pyproject_wheel} -} +%pyproject_wheel %install %pyproject_install +%python_expand sed -i '1{s|^#!.*$|#!%{__$python}|}' %{buildroot}%{$python_sitearch}/fabio/version.py %python_clone -a %{buildroot}%{_bindir}/densify_Bragg %python_clone -a %{buildroot}%{_bindir}/fabio-convert %python_clone -a %{buildroot}%{_bindir}/fabio_viewer ++++++ fabio-2023.10.tar.gz -> fabio-2024.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/.github/workflows/python-package.yml new/fabio-2024.4/.github/workflows/python-package.yml --- old/fabio-2023.10/.github/workflows/python-package.yml 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/.github/workflows/python-package.yml 2024-04-11 16:35:31.000000000 +0200 @@ -15,7 +15,7 @@ runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/.github/workflows/release.yml new/fabio-2024.4/.github/workflows/release.yml --- old/fabio-2023.10/.github/workflows/release.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/fabio-2024.4/.github/workflows/release.yml 2024-04-11 16:35:31.000000000 +0200 @@ -0,0 +1,147 @@ +name: Build and deploy + +on: + workflow_dispatch: + release: + types: + - published + +jobs: + build_sdist: + name: Build source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: "pip" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + - name: Build sdist + run: python -m build --sdist + - name: Check the package + run: python -m twine check dist/* + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + test_sdist: + needs: [build_sdist] + name: Test source distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: "pip" + - uses: actions/download-artifact@v4 + with: + name: cibw-sdist + path: dist + - name: Install from sdist + run: pip install "$(ls dist/fabio-*.tar.gz)" + - name: Run tests + run: python -c "import fabio.test, sys; sys.exit(fabio.test.run_tests())" + + build_doc: + name: Build documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: "pip" + - name: Install pandoc&graphviz + run: sudo apt-get install pandoc graphviz + - name: Install fabio + run: pip install . + - name: Install documentation dependencies + run: pip install -r requirements.txt + - name: Build doc + env: + READTHEDOCS: "True" # To skip checking that fabio is installed locally + run: | + export FABIO_VERSION="$(python -c 'import fabio; print(fabio.strictversion)')" + sphinx-build doc/source/ "fabio-${FABIO_VERSION}_documentation/" + zip -r "fabio-${FABIO_VERSION}_documentation.zip" "fabio-${FABIO_VERSION}_documentation/" + - uses: actions/upload-artifact@v4 + with: + name: documentation + path: fabio-*_documentation.zip + + build_wheels: + name: Build wheels on ${{ matrix.os }}-${{ matrix.cibw_archs }} + runs-on: ${{ matrix.os }} + strategy: + # Ensure that a wheel builder finishes even if another fails + fail-fast: false + matrix: + include: + - os: ubuntu-20.04 + cibw_archs: "auto64" + - os: ubuntu-20.04 + cibw_archs: "aarch64" + - os: ubuntu-20.04 + cibw_archs: "ppc64le" + - os: windows-2019 + cibw_archs: "auto64" + - os: macos-11 + cibw_archs: "x86_64" + macos_target: "10.9" + - os: macos-14 + cibw_archs: "arm64" + macos_target: "11.0" + + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + if: runner.os == 'Linux' + with: + platforms: all + - uses: pypa/cibuildwheel@v2.16.5 + env: + # Use silx wheelhouse: needed for ppc64le + CIBW_ENVIRONMENT_LINUX: "PIP_FIND_LINKS=https://www.silx.org/pub/wheelhouse/ PIP_TRUSTED_HOST=www.silx.org" + + CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* + # Do not build for pypy and muslinux + CIBW_SKIP: pp* *-musllinux_* + CIBW_ARCHS: ${{ matrix.cibw_archs }} + + MACOSX_DEPLOYMENT_TARGET: "${{ matrix.macos_target }}" + + # Install test dependencies + CIBW_TEST_COMMAND: python -c "import fabio.test, sys; sys.exit(fabio.test.run_tests())" + # Skip tests for emulated architectures + # and Python3.8 on macos/arm64 (https://github.com/pypa/cibuildwheel/pull/1169) + CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} cp38-macosx_arm64" + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + pypi-publish: + needs: [build_doc, build_sdist, build_wheels, test_sdist] + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + permissions: + id-token: write + if: github.event_name == 'release' && github.event.action == 'published' + # or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this) + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + steps: + - uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: dist + merge-multiple: true + - uses: pypa/gh-action-pypi-publish@release/v1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/bootstrap.py new/fabio-2024.4/bootstrap.py --- old/fabio-2023.10/bootstrap.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/bootstrap.py 2024-04-11 16:35:31.000000000 +0200 @@ -10,7 +10,7 @@ __authors__ = ["Frédéric-Emmanuel Picca", "Jérôme Kieffer"] __contact__ = "jerome.kief...@esrf.eu" __license__ = "MIT" -__date__ = "03/03/2023" +__date__ = "11/04/2024" import sys import os diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/build-deb.sh new/fabio-2024.4/build-deb.sh --- old/fabio-2023.10/build-deb.sh 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/build-deb.sh 2024-04-11 16:35:31.000000000 +0200 @@ -29,9 +29,9 @@ project=fabio source_project=fabio -version=$(PYTHONPATH=src/fabio python3 -c"import _version; print(_version.version)") -strictversion=$(PYTHONPATH=src/fabio python3 -c"import _version; print(_version.strictversion)") -debianversion=$(PYTHONPATH=src/fabio python3 -c"import _version; print(_version.debianversion)") +version=$(PYTHONPATH=src/fabio python3 -c"import version; print(version.version)") +strictversion=$(PYTHONPATH=src/fabio python3 -c"import version; print(version.strictversion)") +debianversion=$(PYTHONPATH=src/fabio python3 -c"import version; print(version.debianversion)") deb_name=$(echo "$source_project" | tr '[:upper:]' '[:lower:]') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/doc/source/Changelog.rst new/fabio-2024.4/doc/source/Changelog.rst --- old/fabio-2023.10/doc/source/Changelog.rst 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/doc/source/Changelog.rst 2024-04-11 16:35:31.000000000 +0200 @@ -1,6 +1,15 @@ Changelog ========= +FabIO-2024.4.0: +................ +- Support for new style GE-files (contribution from Patrick Avery) +- Support sparse frames without background +- Fix documentation (Thanks Wout) +- Automatize the release (Thanks Thomas) +- Support for Numpy v2.0 +- Support Python 3.7-3.12 + FabIO-2023.10.0: ................ - New tutorial on the ccreation of multiframe Tiff diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/doc/source/conf.py new/fabio-2024.4/doc/source/conf.py --- old/fabio-2023.10/doc/source/conf.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/doc/source/conf.py 2024-04-11 16:35:31.000000000 +0200 @@ -13,10 +13,7 @@ import sys import os -import glob -import subprocess -on_rtd = os.environ.get('READTHEDOCS') == 'True' # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. @@ -26,7 +23,7 @@ import fabio project_dir = os.path.abspath(os.path.join(__file__, "..", "..", "..")) build_dir = os.path.abspath(fabio.__file__) - if on_rtd: + if os.environ.get('READTHEDOCS') == 'True': print("On Read The Docs") print("build_dir", build_dir) print("project_dir", project_dir) @@ -55,19 +52,11 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.mathjax', + 'sphinx_rtd_theme', 'sphinxcontrib.programoutput', - "nbsphinx" + 'nbsphinx' ] -# Set the theme to sphinx_rtd_theme when *not* building on Read The Docs. -# The theme is set to default otherwise as Read The Docs uses its own theme anyway. -if not on_rtd: - try: - import sphinx_rtd_theme - extensions.append('sphinx_rtd_theme') - except: - print("sphinx_rtd_theme is not available") - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -81,7 +70,7 @@ master_doc = 'index' # General information about the project. -from fabio._version import strictversion, version, __date__ as fabio_date +from fabio.version import strictversion, __date__ as fabio_date year = fabio_date.split("/")[-1] copyright = u'2006-%s, Henning Sorensen, Erik Knudsen, Jon Wright, Gael Goret, Brian Pauw and Jerome Kieffer' % (year) @@ -136,7 +125,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' if on_rtd else 'sphinx_rtd_theme' +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/doc/source/coverage.rst new/fabio-2024.4/doc/source/coverage.rst --- old/fabio-2023.10/doc/source/coverage.rst 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/doc/source/coverage.rst 2024-04-11 16:35:31.000000000 +0200 @@ -1,18 +1,17 @@ Test coverage report for fabio ============================== -Measured on *fabio* version 2023.10.0, 25/10/2023 +Measured on *fabio* version 2024.4.0, 11/04/2024 .. csv-table:: Test suite coverage :header: "Name", "Stmts", "Exec", "Cover" :widths: 35, 8, 8, 8 - "GEimage.py", "106", "80", "75.5 %" + "GEimage.py", "116", "90", "77.6 %" "HiPiCimage.py", "61", "54", "88.5 %" "OXDimage.py", "352", "325", "92.3 %" - "TiffIO.py", "781", "648", "83.0 %" - "__init__.py", "35", "29", "82.9 %" - "_version.py", "40", "39", "97.5 %" + "TiffIO.py", "781", "643", "82.3 %" + "__init__.py", "34", "28", "82.4 %" "adscimage.py", "4", "4", "100.0 %" "binaryimage.py", "60", "44", "73.3 %" "bruker100image.py", "286", "243", "85.0 %" @@ -25,14 +24,14 @@ "eigerimage.py", "194", "139", "71.6 %" "esperantoimage.py", "158", "137", "86.7 %" "fabioformats.py", "90", "65", "72.2 %" - "fabioimage.py", "467", "386", "82.7 %" - "fabioutils.py", "392", "316", "80.6 %" + "fabioimage.py", "468", "387", "82.7 %" + "fabioutils.py", "392", "312", "79.6 %" "file_series.py", "370", "280", "75.7 %" "fit2dimage.py", "91", "76", "83.5 %" "fit2dmaskimage.py", "79", "75", "94.9 %" "fit2dspreadsheetimage.py", "47", "40", "85.1 %" "hdf5image.py", "98", "67", "68.4 %" - "jpeg2kimage.py", "82", "56", "68.3 %" + "jpeg2kimage.py", "82", "74", "90.2 %" "jpegimage.py", "47", "45", "95.7 %" "kcdimage.py", "107", "76", "71.0 %" "limaimage.py", "180", "151", "83.9 %" @@ -42,14 +41,15 @@ "mrcimage.py", "85", "65", "76.5 %" "nexus.py", "233", "130", "55.8 %" "numpyimage.py", "77", "53", "68.8 %" - "openimage.py", "122", "105", "86.1 %" + "openimage.py", "130", "112", "86.2 %" "pilatusimage.py", "43", "38", "88.4 %" "pixiimage.py", "107", "91", "85.0 %" "pnmimage.py", "137", "86", "62.8 %" "raxisimage.py", "103", "91", "88.3 %" - "sparseimage.py", "135", "93", "68.9 %" + "sparseimage.py", "146", "97", "66.4 %" "speimage.py", "162", "157", "96.9 %" "tifimage.py", "128", "121", "94.5 %" + "version.py", "40", "35", "87.5 %" "xcaliburimage.py", "586", "462", "78.8 %" "xsdimage.py", "94", "70", "74.5 %" "app/__init__.py", "0", "0", "0.0 %" @@ -58,10 +58,12 @@ "compression/agi_bitfield.py", "171", "148", "86.5 %" "compression/compression.py", "245", "188", "76.7 %" "ext/__init__.py", "0", "0", "0.0 %" - "utils/ExternalResources.py", "180", "133", "73.9 %" + "test/__init__.py", "22", "15", "68.2 %" + "test/codecs/__init__.py", "87", "81", "93.1 %" + "utils/ExternalResources.py", "181", "134", "74.0 %" "utils/__init__.py", "0", "0", "0.0 %" - "utils/cli.py", "60", "52", "86.7 %" + "utils/cli.py", "60", "48", "80.0 %" "utils/deprecation.py", "67", "63", "94.0 %" "utils/pilutils.py", "49", "39", "79.6 %" - "fabio total", "9609", "7542", "78.5 %" + "fabio total", "9748", "7661", "78.6 %" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/meson.build new/fabio-2024.4/meson.build --- old/fabio-2023.10/meson.build 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/meson.build 2024-04-11 16:35:31.000000000 +0200 @@ -2,7 +2,7 @@ 'c', 'cython', license: 'MIT', meson_version: '>= 0.60', - version: run_command('src/fabio/_version.py', + version: run_command(['version.py', '--wheel'], check:true).stdout().strip(), ) @@ -13,6 +13,7 @@ endif cc = meson.get_compiler('c') +cy = meson.get_compiler('cython') m_dep = cc.find_library('m', required : false) if m_dep.found() add_project_link_arguments('-lm', language : 'c') @@ -23,4 +24,11 @@ py = py_mod.find_installation() py_dep = py.dependency() +py.install_sources([ + 'version.py', +], + pure: false, # Will be installed next to binaries + subdir: 'fabio' # Folder relative to site-packages to install to +) + subdir('src/fabio') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/package/debian12/control new/fabio-2024.4/package/debian12/control --- old/fabio-2023.10/package/debian12/control 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/package/debian12/control 2024-04-11 16:35:31.000000000 +0200 @@ -7,6 +7,9 @@ Build-Depends: cython3, debhelper, dh-python, + devscripts, + python3-tomli, + python3-mesonpy, python3-all-dev, python3-pil, python3-lxml, @@ -18,10 +21,7 @@ python3-sphinxcontrib.programoutput, python3-sphinx-rtd-theme, python3-h5py, - python3-tomli, - python3-mesonpy, help2man, - devscripts, python3-pyqt5, python3-matplotlib, bitshuffle, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/package/debian12/rules new/fabio-2024.4/package/debian12/rules --- old/fabio-2023.10/package/debian12/rules 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/package/debian12/rules 2024-04-11 16:35:31.000000000 +0200 @@ -38,3 +38,7 @@ python3 build-doc.py dh_installdocs "build/sphinx" -p fabio-doc dh_installdocs + +override_dh_sphinxdoc: + dh_sphinxdoc -X searchtools.js + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/pyproject.toml new/fabio-2024.4/pyproject.toml --- old/fabio-2023.10/pyproject.toml 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/pyproject.toml 2024-04-11 16:35:31.000000000 +0200 @@ -54,15 +54,13 @@ "meson; platform_system!='Windows'", 'ninja', 'wheel', - 'numpy', - 'Cython>=0.25', - 'numpy', + 'Cython>=0.29', 'pyproject-metadata>=0.5.0', 'tomli>=1.0.0' ] [project.urls] -homepage = 'http://silx.org' +homepage = 'http://www.silx.org' documentation = 'http://www.silx.org/doc/fabio/latest/' source = 'https://github.com/silx-kit/fabio' download = 'https://github.com/silx-kit/fabio/releases' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/requirements.txt new/fabio-2024.4/requirements.txt --- old/fabio-2023.10/requirements.txt 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/requirements.txt 2024-04-11 16:35:31.000000000 +0200 @@ -11,3 +11,4 @@ sphinx sphinxcontrib-programoutput sphinx-rtd-theme +nbsphinx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/GEimage.py new/fabio-2024.4/src/fabio/GEimage.py --- old/fabio-2023.10/src/fabio/GEimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/GEimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -41,8 +41,12 @@ import io import numpy import struct +from .edfimage import EdfImage from .fabioimage import FabioImage from .fabioutils import next_filename, previous_filename +from .openimage import MAGIC_NUMBERS + +EDF_MAGIC_NUMBERS = [(x, y) for x, y in MAGIC_NUMBERS if y == 'edf'] GE_HEADER_INFO = [ # Name, length in bytes, format for struct (None means string) @@ -265,6 +269,20 @@ raise IOError("GE file size is incorrect") nframes = file_size // bytes_per_frames self.header['NumberOfFrames'] = nframes + elif any(self.header["ImageFormat"].startswith(x) for x, _ in EDF_MAGIC_NUMBERS): + # At APS, they started saving some GE headers with an EDF format in ~2022 + + # Use the same metadata as the blank header... + self.header.update(self.BLANKED_HEADER_METADATA) + + # Read the EDF header + cur = infile.tell() + infile.seek(0) + header = EdfImage._read_header_block(infile, 1) + infile.seek(cur, io.SEEK_SET) + + # Extract any needed info from the EDF header + self.header['NumberOfFrames'] = int(header[0]["Num_Images"]) def read(self, fname, frame=None): """Read header into self.header and the data into self.data.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/OXDimage.py new/fabio-2024.4/src/fabio/OXDimage.py --- old/fabio-2023.10/src/fabio/OXDimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/OXDimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -482,7 +482,7 @@ dim2 = self._shape[0] while pos_inp < stream_size and pos_out < array_size: if pos_out % dim2 == 0: - last = 0 + last = numpy.int64(0) else: last = current value = raw[pos_inp] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/__init__.py new/fabio-2024.4/src/fabio/__init__.py --- old/fabio-2023.10/src/fabio/__init__.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/__init__.py 2024-04-11 16:35:31.000000000 +0200 @@ -28,7 +28,7 @@ __contact__ = "jerome.kief...@esrf.eu" __license__ = "GPLv3+" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "21/06/2023" +__date__ = "15/03/2024" __status__ = "stable" import sys @@ -39,8 +39,7 @@ logging.basicConfig() import os -from ._version import __date__ as date # noqa -from ._version import version, version_info, hexversion, strictversion # noqa +from .version import __date__ as date, version, version_info, hexversion, strictversion # noqa from . import fabioformats as _fabioformats # provide a global fabio API diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/_version.py new/fabio-2024.4/src/fabio/_version.py --- old/fabio-2023.10/src/fabio/_version.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/_version.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,124 +0,0 @@ -#!/usr/bin/env python3 -# coding: utf-8 -# -# Project: X-ray image reader -# https://github.com/silx-kit/fabio -# -# Copyright (C) 2015-20230 European Synchrotron Radiation Facility, Grenoble, France -# -# Principal author: Jérôme Kieffer (jerome.kief...@esrf.eu) -# -# 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: -# -# 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. - -"""Unique place where the version number is defined. - -Module for version handling: - -provides: -* version = "1.2.3" or "1.2.3-beta4" -* version_info = named tuple (1,2,3,"beta",4) -* hexversion: 0x010203B4 -* strictversion = "1.2.3b4 -* debianversion = "1.2.3~beta4" -* calc_hexversion: the function to transform a version_tuple into an integer - -This is called hexversion since it only really looks meaningful when viewed as the -result of passing it to the built-in hex() function. -The version_info value may be used for a more human-friendly encoding of the same information. - -The hexversion is a 32-bit number with the following layout: -Bits (big endian order) Meaning -1-8 PY_MAJOR_VERSION (the 2 in 2.1.0a3) -9-16 PY_MINOR_VERSION (the 1 in 2.1.0a3) -17-24 PY_MICRO_VERSION (the 0 in 2.1.0a3) -25-28 PY_RELEASE_LEVEL (0xA for alpha, 0xB for beta, 0xC for release candidate and 0xF for final) -29-32 PY_RELEASE_SERIAL (the 3 in 2.1.0a3, zero for final releases) - -Thus 2.1.0a3 is hexversion 0x020100a3. - -""" - -__author__ = "Jérôme Kieffer" -__contact__ = "jerome.kief...@esrf.eu" -__license__ = "MIT" -__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "07/08/2023" -__status__ = "production" -__docformat__ = 'restructuredtext' -__all__ = ["date", "version_info", "strictversion", "hexversion", "debianversion", - "calc_hexversion"] - -RELEASE_LEVEL_VALUE = {"dev": 0, - "alpha": 10, - "beta": 11, - "candidate": 12, - "final": 15} - -PRERELEASE_NORMALIZED_NAME = {"dev": "a", - "alpha": "a", - "beta": "b", - "candidate": "rc"} - -MAJOR = 2023 -MINOR = 10 -MICRO = 0 -RELEV = "final" # <16 -SERIAL = 0 # <16 -date = __date__ - -from collections import namedtuple -_version_info = namedtuple("version_info", ["major", "minor", "micro", "releaselevel", "serial"]) - -version_info = _version_info(MAJOR, MINOR, MICRO, RELEV, SERIAL) - -strictversion = version = debianversion = "%d.%d.%d" % version_info[:3] -if version_info.releaselevel != "final": - _prerelease = PRERELEASE_NORMALIZED_NAME[version_info[3]] - version += "%s%s" % (_prerelease, version_info[-1]) - debianversion += "~adev%i" % version_info[-1] if RELEV == "dev" else "~%s%i" % (_prerelease, version_info[-1]) - strictversion += _prerelease + str(version_info[-1]) - - -def calc_hexversion(major=0, minor=0, micro=0, releaselevel="dev", serial=0): - """Calculate the hexadecimal version number from the tuple version_info: - - :param major: integer - :param minor: integer - :param micro: integer - :param relev: integer or string - :param serial: integer - :return: integer always increasing with revision numbers - """ - try: - releaselevel = int(releaselevel) - except ValueError: - releaselevel = RELEASE_LEVEL_VALUE.get(releaselevel, 0) - - hex_version = int(serial) - hex_version |= releaselevel * 1 << 4 - hex_version |= int(micro) * 1 << 8 - hex_version |= int(minor) * 1 << 16 - hex_version |= int(major) * 1 << 24 - return hex_version - - -hexversion = calc_hexversion(*version_info) - -if __name__ == "__main__": - print(version) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/app/eiger2crysalis.py new/fabio-2024.4/src/fabio/app/eiger2crysalis.py --- old/fabio-2023.10/src/fabio/app/eiger2crysalis.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/app/eiger2crysalis.py 2024-04-11 16:35:31.000000000 +0200 @@ -38,7 +38,7 @@ __author__ = "Jerome Kieffer" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" __licence__ = "MIT" -__date__ = "23/02/2023" +__date__ = "15/03/2024" __status__ = "production" FOOTER = """To import your files as a project: @@ -401,7 +401,7 @@ ":param full: complete/slow mask analysis" if self.progress: self.progress.update(self.progress.max_value - 1, "Generate mask") - dummy_value = numpy.cast[self.mask.dtype](-1) + dummy_value = numpy.asarray(-numpy.ones(1), dtype=self.mask.dtype)[-1] #-1 in the given datatype mask = (self.mask==dummy_value).astype(numpy.int8) esperantoimage.EsperantoImage.DUMMY = 1 new_mask = self.geometry_transform(esperantoimage.EsperantoImage(data=mask).data) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/cbfimage.py new/fabio-2024.4/src/fabio/cbfimage.py --- old/fabio-2023.10/src/fabio/cbfimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/cbfimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -245,7 +245,7 @@ return binary_data if ("Content-MD5" in self.header) and check_MD5: - ref = numpy.string_(self.header["Content-MD5"]) + ref = numpy.bytes_(self.header["Content-MD5"]) obt = md5sum(binary_data) if ref != obt: logger.error("Checksum of binary data mismatch: expected %s, got %s" % (ref, obt)) @@ -294,14 +294,14 @@ b"Content-Type: application/octet-stream;", b' conversions="x-CBF_BYTE_OFFSET"', b'Content-Transfer-Encoding: BINARY', - numpy.string_("X-Binary-Size: %d" % (len(binary_blob))), + numpy.bytes_("X-Binary-Size: %d" % (len(binary_blob))), b"X-Binary-ID: 1", - numpy.string_('X-Binary-Element-Type: "%s"' % (dtype)), + numpy.bytes_('X-Binary-Element-Type: "%s"' % (dtype)), b"X-Binary-Element-Byte-Order: LITTLE_ENDIAN", b"Content-MD5: " + md5sum(binary_blob), - numpy.string_("X-Binary-Number-of-Elements: %d" % (dim1 * dim2)), - numpy.string_("X-Binary-Size-Fastest-Dimension: %d" % dim1), - numpy.string_("X-Binary-Size-Second-Dimension: %d" % dim2), + numpy.bytes_("X-Binary-Number-of-Elements: %d" % (dim1 * dim2)), + numpy.bytes_("X-Binary-Size-Fastest-Dimension: %d" % dim1), + numpy.bytes_("X-Binary-Size-Second-Dimension: %d" % dim2), b"X-Binary-Size-Padding: 1", b"", self.STARTER + binary_blob, @@ -354,22 +354,22 @@ keys are always unicode (str in python3) values are bytes """ - EOL = [numpy.string_(i) for i in ("\r", "\n", "\r\n", "\n\r")] - BLANK = [numpy.string_(i) for i in (" ", "\t")] + EOL - SINGLE_QUOTE = numpy.string_("'") - DOUBLE_QUOTE = numpy.string_('"') - SEMICOLUMN = numpy.string_(';') - DOT = numpy.string_('.') + EOL = [numpy.bytes_(i) for i in ("\r", "\n", "\r\n", "\n\r")] + BLANK = [numpy.bytes_(i) for i in (" ", "\t")] + EOL + SINGLE_QUOTE = numpy.bytes_("'") + DOUBLE_QUOTE = numpy.bytes_('"') + SEMICOLUMN = numpy.bytes_(';') + DOT = numpy.bytes_('.') START_COMMENT = (SINGLE_QUOTE, DOUBLE_QUOTE) - BINARY_MARKER = numpy.string_("--CIF-BINARY-FORMAT-SECTION--") - HASH = numpy.string_("#") - LOOP = numpy.string_("loop_") + BINARY_MARKER = numpy.bytes_("--CIF-BINARY-FORMAT-SECTION--") + HASH = numpy.bytes_("#") + LOOP = numpy.bytes_("loop_") UNDERSCORE = ord("_") - QUESTIONMARK = numpy.string_("?") - STOP = numpy.string_("stop_") - GLOBAL = numpy.string_("global_") - DATA = numpy.string_("data_") - SAVE = numpy.string_("save_") + QUESTIONMARK = numpy.bytes_("?") + STOP = numpy.bytes_("stop_") + GLOBAL = numpy.bytes_("global_") + DATA = numpy.bytes_("data_") + SAVE = numpy.bytes_("save_") def __init__(self, _strFilename=None): """ @@ -416,7 +416,7 @@ else: raise RuntimeError("CIF.loadCIF: what is %s type %s" % (_strFilename, type(_strFilename))) if _bKeepComment: - self._parseCIF(numpy.string_(infile.read())) + self._parseCIF(numpy.bytes_(infile.read())) else: self._parseCIF(CIF._readCIF(infile)) if own_fd: @@ -454,13 +454,13 @@ if "read" not in dir(instream): raise RuntimeError("CIF._readCIF(instream): I expected instream to be an opened file,\ here I got %s type %s" % (instream, type(instream))) - out_bytes = numpy.string_("") + out_bytes = numpy.bytes_("") for sLine in instream: - nline = numpy.string_(sLine) + nline = numpy.bytes_(sLine) pos = nline.find(cls.HASH) if pos >= 0: if cls.isAscii(nline): - out_bytes += nline[:pos] + numpy.string_(os.linesep) + out_bytes += nline[:pos] + numpy.bytes_(os.linesep) if pos > 80: logger.warning("This line is too long and could cause problems in PreQuest: %s", sLine) else: @@ -535,7 +535,7 @@ idx += 1 + bytes_text[idx + 1:].find(cls.SINGLE_QUOTE) if idx >= len(bytes_text) - 1: fields.append(bytes_text[1:-1].strip()) - bytes_text = numpy.string_("") + bytes_text = numpy.bytes_("") finished = True break @@ -552,7 +552,7 @@ idx += 1 + bytes_text[idx + 1:].find(cls.DOUBLE_QUOTE) if idx >= len(bytes_text) - 1: fields.append(bytes_text[1:-1].strip()) - bytes_text = numpy.string_("") + bytes_text = numpy.bytes_("") finished = True break @@ -594,7 +594,7 @@ bytes_text = bytes_text[end_binary:].strip() else: fields.append(bytes_text) - bytes_text = numpy.string_("") + bytes_text = numpy.bytes_("") break return fields diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/eigerimage.py new/fabio-2024.4/src/fabio/eigerimage.py --- old/fabio-2023.10/src/fabio/eigerimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/eigerimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -2,7 +2,7 @@ # # Project: FabIO X-ray image reader # -# Copyright (C) 2010-2016 European Synchrotron Radiation Facility +# Copyright (C) 2010-2024 European Synchrotron Radiation Facility # Grenoble, France # # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -45,7 +45,7 @@ __contact__ = "jerome.kief...@esrf.fr" __license__ = "MIT" __copyright__ = "ESRF" -__date__ = "05/07/2022" +__date__ = "15/03/2024" import logging logger = logging.getLogger(__name__) @@ -184,7 +184,7 @@ for i, ds in enumerate(self.dataset): if ds is None: # we are in a trouble - data = numpy.atleast_2d(numpy.NaN) + data = numpy.atleast_2d(numpy.nan) elif isinstance(ds, h5py.Dataset): data = numpy.atleat_2d(ds[()]) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/ext/dense.pyx new/fabio-2024.4/src/fabio/ext/dense.pyx --- old/fabio-2023.10/src/fabio/ext/dense.pyx 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/ext/dense.pyx 2024-04-11 16:35:31.000000000 +0200 @@ -8,7 +8,7 @@ # Project: Fable Input/Output # https://github.com/silx-kit/fabio # -# Copyright (C) 2020-2023 European Synchrotron Radiation Facility, Grenoble, France +# Copyright (C) 2020-2024 European Synchrotron Radiation Facility, Grenoble, France # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -31,7 +31,7 @@ """Densification of sparse frame format """ __author__ = "Jérôme Kieffer" -__date__ = "20/10/2023" +__date__ = "19/03/2024" __contact__ = "jerome.kief...@esrf.fr" __license__ = "MIT" @@ -249,12 +249,15 @@ cdef: Py_ssize_t i, j, size, pos, size_over, width, height double value, fres, fpos, idelta, start, std - bint integral, noisy, do_normalization=False + bint integral, noisy, do_normalization=False, do_background=True any_t[:, ::1] dense float[:,::1] c_normalization MT mt - size = radius.shape[0] - assert background.shape[0] == size + if radius is None: + do_background = False + else: + size = radius.shape[0] + assert background.shape[0] == size size_over = index.shape[0] assert intensity.shape[0] == size_over integral = numpy.issubdtype(dtype, numpy.integer) @@ -277,36 +280,37 @@ mt = MT(seed) with nogil: - start = radius[0] - idelta = <double>(size - 1)/(radius[size-1] - start) - - #Linear interpolation - for i in range(height): - for j in range(width): - fpos = (mask[i,j] - start)*idelta - if (fpos<0) or (fpos>=size) or (not isfinite(fpos)): - dense[i,j] = dummy - else: - pos = <uint32_t> fpos - if pos+1 == size: - value = background[pos] - fres = 0.0 + if do_background: + start = radius[0] + idelta = <double>(size - 1)/(radius[size-1] - start) + + #Linear interpolation + for i in range(height): + for j in range(width): + fpos = (mask[i,j] - start)*idelta + if (fpos<0) or (fpos>=size) or (not isfinite(fpos)): + dense[i,j] = dummy else: - fres = fpos - pos - value = (1.0 - fres)*background[pos] + fres*background[pos+1] - if noisy: + pos = <uint32_t> fpos if pos+1 == size: - std = background_std[pos] + value = background[pos] fres = 0.0 else: - std = (1.0 - fres)*background_std[pos] + fres*background_std[pos+1] - value = max(0.0, mt._normal_m(value, std)) - if do_normalization: - value *= c_normalization[i, j] - if integral: - dense[i,j] = <any_t>(value + 0.5) #this is rounding - else: - dense[i,j] = <any_t>(value) + fres = fpos - pos + value = (1.0 - fres)*background[pos] + fres*background[pos+1] + if noisy: + if pos+1 == size: + std = background_std[pos] + fres = 0.0 + else: + std = (1.0 - fres)*background_std[pos] + fres*background_std[pos+1] + value = max(0.0, mt._normal_m(value, std)) + if do_normalization: + value *= c_normalization[i, j] + if integral: + dense[i,j] = <any_t>(value + 0.5) #this is rounding + else: + dense[i,j] = <any_t>(value) # Assignment of outliers for i in range(size_over): j = index[i] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/fabioimage.py new/fabio-2024.4/src/fabio/fabioimage.py --- old/fabio-2023.10/src/fabio/fabioimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/fabioimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -816,6 +816,7 @@ fobj.seek(0) elif self._need_a_seek_to_read and mode[0] == "r": fo = python_uncompress(fname, mode) + print(fname, mode, fo) fobj = fabioutils.BytesIO(fo.read(), fname, mode) else: fobj = python_uncompress(fname, mode) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/meson.build new/fabio-2024.4/src/fabio/meson.build --- old/fabio-2023.10/src/fabio/meson.build 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/meson.build 2024-04-11 16:35:31.000000000 +0200 @@ -6,7 +6,6 @@ subdir('utils') py.install_sources([ - '_version.py', 'adscimage.py', 'binaryimage.py', 'bruker100image.py', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/nexus.py new/fabio-2024.4/src/fabio/nexus.py --- old/fabio-2023.10/src/fabio/nexus.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/nexus.py 2024-04-11 16:35:31.000000000 +0200 @@ -29,11 +29,11 @@ """ -__author__ = "Jerome Kieffer" +__author__ = "Jérôme Kieffer" __contact__ = "jerome.kief...@esrf.eu" __license__ = "MIT" __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" -__date__ = "28/04/2021" +__date__ = "15/03/2024" __status__ = "production" __docformat__ = 'restructuredtext' @@ -44,7 +44,7 @@ import time import numpy from .fabioutils import exists -from ._version import version +from .version import version logger = logging.getLogger(__name__) try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/openimage.py new/fabio-2024.4/src/fabio/openimage.py --- old/fabio-2023.10/src/fabio/openimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/openimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -42,7 +42,9 @@ import os.path import logging +import re from . import fabioutils +from .compression import ExternalCompressors from .fabioutils import FilenameObject, BytesIO from .fabioimage import FabioImage @@ -149,6 +151,18 @@ return "marccd" else: return "tif" + + if format_type == "edf" and isinstance(filename, str): + # Might be GE with an EDF header. Check the extension. + extension = filename.split(".")[-1] + # If it is a compression extension, check the next one up. + if f'.{extension}' in ExternalCompressors.COMMANDS: + extension = filename.split(".")[-2] + + # If the extension is `ge` plus a number, assume it is GE + if re.search(r'^ge\d*$', extension): + return "GE" + return format_type raise Exception("Could not interpret magic string") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/sparseimage.py new/fabio-2024.4/src/fabio/sparseimage.py --- old/fabio-2023.10/src/fabio/sparseimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/sparseimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -3,7 +3,7 @@ # Project: X-ray image reader # https://github.com/silx-kit/fabio # -# Copyright 2020-2021(C) European Synchrotron Radiation Facility, Grenoble, France +# Copyright 2020-2024(C) European Synchrotron Radiation Facility, Grenoble, France # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files @@ -37,7 +37,7 @@ __contact__ = "jerome.kief...@esrf.fr" __license__ = "MIT" __copyright__ = "2020 ESRF" -__date__ = "09/02/2023" +__date__ = "19/03/2024" import logging logger = logging.getLogger(__name__) @@ -82,7 +82,11 @@ :param seed: numerical seed for random number generator :return dense array """ - dense = numpy.interp(mask, radius, background) + dtype = intensity.dtype + if radius is None or background is None: + dense = numpy.zeros(radius.shape, dtype=dtype) + else: + dense = numpy.interp(mask, radius, background) if background_std is not None: if seed is not None: numpy.random.seed(seed) @@ -93,7 +97,7 @@ flat = dense.ravel() flat[index] = intensity - dtype = intensity.dtype + if numpy.issubdtype(dtype, numpy.integer): # Foolded by banker's rounding !!!! dense +=0.5 @@ -173,9 +177,13 @@ raise NotGoodReader("HDF5 file does not contain any default NXdata.") nx_data = entry[default_data] self.mask = nx_data["mask"][()] - self.radius = nx_data["radius"][()] - self.background_avg = nx_data["background_avg"][()] - self.background_std = nx_data["background_std"][()] + try: + self.radius = nx_data["radius"][()] + self.background_avg = nx_data["background_avg"][()] + self.background_std = nx_data["background_std"][()] + except KeyError: + logger.info("No background information found") + self.radius = self.background_avg = self.background_std = None self.frame_ptr = nx_data["frame_ptr"][()] self.index = nx_data["index"][()] self.intensity = nx_data["intensity"][()] @@ -183,7 +191,7 @@ self.dummy = self.intensity.dtype.type(nx_data["dummy"][()]) except KeyError: if self.intensity.dtype.char in numpy.typecodes['AllFloat']: - self.dummy = numpy.NaN + self.dummy = numpy.nan else: self.dummy = 0 @@ -205,19 +213,29 @@ logger.warning("Not data have been read from disk") return start, stop = self.frame_ptr[index:index + 2] - if cython_densify is not None: - return cython_densify.densify(self.mask, - self.radius, - self.index[start:stop], - self.intensity[start:stop], - self.dummy, - self.intensity.dtype, - self.background_avg[index], - self.background_std[index] * self.noisy if self.noisy else None, - self.normalization) + if self.radius is None: + if cython_densify is None: # Numpy implementation + dense = densify(self.mask, + None, + self.index[start:stop], + self.intensity[start:stop], + self.dummy, + None, + None, + self.normalization) + else: # Cython + dense = cython_densify.densify(self.mask, + None, + self.index[start:stop], + self.intensity[start:stop], + self.dummy, + self.intensity.dtype, + None, + None, + self.normalization) else: - # Fall-back on numpy code. - return densify(self.mask, + if cython_densify is None: # Numpy + dense = densify(self.mask, self.radius, self.index[start:stop], self.intensity[start:stop], @@ -225,7 +243,18 @@ self.background_avg[index], self.background_std[index] * self.noisy if self.noisy else None, self.normalization) - + else: + dense = cython_densify.densify(self.mask, + self.radius, + self.index[start:stop], + self.intensity[start:stop], + self.dummy, + self.intensity.dtype, + self.background_avg[index], + self.background_std[index] * self.noisy if self.noisy else None, + self.normalization) + return dense + def getframe(self, num): """ returns the frame numbered 'num' in the stack if applicable""" if self.nframes > 1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/test/codecs/test_esperantoimage.py new/fabio-2024.4/src/fabio/test/codecs/test_esperantoimage.py --- old/fabio-2023.10/src/fabio/test/codecs/test_esperantoimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/test/codecs/test_esperantoimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -134,7 +134,7 @@ def test_values(self): esp = fabio.open(UtilsTest.getimage("reference.esperanto.bz2")[:-4]) npy = fabio.open(UtilsTest.getimage("reference.npy.bz2")[:-4]) - self.assertEqual(numpy.alltrue(esp.data == npy.data), True, "Images are the same") + self.assertTrue(numpy.array_equal(esp.data, npy.data), "Images are the same") def suite(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/test/codecs/test_geimage.py new/fabio-2024.4/src/fabio/test/codecs/test_geimage.py --- old/fabio-2023.10/src/fabio/test/codecs/test_geimage.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/test/codecs/test_geimage.py 2024-04-11 16:35:31.000000000 +0200 @@ -53,6 +53,7 @@ ("GE_aSI_detector_image_1529", (2048, 2048), (1515, 16353, 1833.0311, 56.9124)), ("GE_image_1frame_intact_header.ge", (2048, 2048), (1515, 16353, 2209.1113, 437.6377)), ("GE_image_1frame_blanked_header.ge", (2048, 2048), (1300, 16349, 1886.41111, 117.0603)), + ("dark_before_000428.edf.ge5", (2048, 2048), (1300, 16349, 1833.87892, 84.5265)), ] def setUp(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/utils/ExternalResources.py new/fabio-2024.4/src/fabio/utils/ExternalResources.py --- old/fabio-2023.10/src/fabio/utils/ExternalResources.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/utils/ExternalResources.py 2024-04-11 16:35:31.000000000 +0200 @@ -289,7 +289,8 @@ if not gz_file_exists: try: - gzip.open(fullimagename_gz, "wb").write(decompressed) + with gzip.open(fullimagename_gz, "wb") as g: + g.write(decompressed) except IOError: raise IOError("unable to write gzipped \ data to disk at %s" % self.data_home) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/src/fabio/utils/deprecation.py new/fabio-2024.4/src/fabio/utils/deprecation.py --- old/fabio-2023.10/src/fabio/utils/deprecation.py 2023-10-26 10:30:27.000000000 +0200 +++ new/fabio-2024.4/src/fabio/utils/deprecation.py 2024-04-11 16:35:31.000000000 +0200 @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016-2017 European Synchrotron Radiation Facility +# Copyright (c) 2016-2024 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -24,15 +24,16 @@ # ###########################################################################*/ """Bunch of useful decorators""" -__authors__ = ["Jerome Kieffer", "H. Payno", "P. Knobel"] +__authors__ = ["Jérôme Kieffer", "H. Payno", "P. Knobel"] __license__ = "MIT" -__date__ = "18/12/2020" +__date__ = "15/03/2024" import logging import functools import traceback import re -from .. import _version + +from ..version import calc_hexversion, hexversion as ref_hexversion depreclog = logging.getLogger("fabio.DEPRECATION") @@ -54,7 +55,7 @@ releaselevel = result[3] if releaselevel is None: releaselevel = 0 - return _version.calc_hexversion(major, minor, micro, releaselevel, serial=0) + return calc_hexversion(major, minor, micro, releaselevel, serial=0) def deprecated(func=None, reason=None, replacement=None, since_version=None, @@ -154,7 +155,7 @@ deprecated_since = hexversion else: deprecated_since = _CACHE_VERSIONS[deprecated_since] - log_as_debug = _version.hexversion < deprecated_since + log_as_debug = ref_hexversion < deprecated_since else: log_as_debug = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fabio-2023.10/version.py new/fabio-2024.4/version.py --- old/fabio-2023.10/version.py 1970-01-01 01:00:00.000000000 +0100 +++ new/fabio-2024.4/version.py 2024-04-11 16:35:31.000000000 +0200 @@ -0,0 +1,124 @@ +#!/usr/bin/env python3 +# coding: utf-8 +# +# Project: X-ray image reader +# https://github.com/silx-kit/fabio +# +# Copyright (C) 2015-2024 European Synchrotron Radiation Facility, Grenoble, France +# +# Principal author: Jérôme Kieffer (jerome.kief...@esrf.eu) +# +# 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: +# +# 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. + +"""Unique place where the version number is defined. + +Module for version handling: + +provides: +* version = "1.2.3" or "1.2.3-beta4" +* version_info = named tuple (1,2,3,"beta",4) +* hexversion: 0x010203B4 +* strictversion = "1.2.3b4 +* debianversion = "1.2.3~beta4" +* calc_hexversion: the function to transform a version_tuple into an integer + +This is called hexversion since it only really looks meaningful when viewed as the +result of passing it to the built-in hex() function. +The version_info value may be used for a more human-friendly encoding of the same information. + +The hexversion is a 32-bit number with the following layout: +Bits (big endian order) Meaning +1-8 PY_MAJOR_VERSION (the 2 in 2.1.0a3) +9-16 PY_MINOR_VERSION (the 1 in 2.1.0a3) +17-24 PY_MICRO_VERSION (the 0 in 2.1.0a3) +25-28 PY_RELEASE_LEVEL (0xA for alpha, 0xB for beta, 0xC for release candidate and 0xF for final) +29-32 PY_RELEASE_SERIAL (the 3 in 2.1.0a3, zero for final releases) + +Thus 2.1.0a3 is hexversion 0x020100a3. + +""" + +__author__ = "Jérôme Kieffer" +__contact__ = "jerome.kief...@esrf.eu" +__license__ = "MIT" +__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" +__date__ = "11/04/2024" +__status__ = "production" +__docformat__ = 'restructuredtext' +__all__ = ["date", "version_info", "strictversion", "hexversion", "debianversion", + "calc_hexversion"] + +RELEASE_LEVEL_VALUE = {"dev": 0, + "alpha": 10, + "beta": 11, + "candidate": 12, + "final": 15} + +PRERELEASE_NORMALIZED_NAME = {"dev": "a", + "alpha": "a", + "beta": "b", + "candidate": "rc"} + +MAJOR = 2024 +MINOR = 4 +MICRO = 0 +RELEV = "final" # <16 +SERIAL = 0 # <16 +date = __date__ + +from collections import namedtuple +_version_info = namedtuple("version_info", ["major", "minor", "micro", "releaselevel", "serial"]) + +version_info = _version_info(MAJOR, MINOR, MICRO, RELEV, SERIAL) + +strictversion = version = debianversion = "%d.%d.%d" % version_info[:3] +if version_info.releaselevel != "final": + _prerelease = PRERELEASE_NORMALIZED_NAME[version_info[3]] + version += "%s%s" % (_prerelease, version_info[-1]) + debianversion += "~adev%i" % version_info[-1] if RELEV == "dev" else "~%s%i" % (_prerelease, version_info[-1]) + strictversion += _prerelease + str(version_info[-1]) + + +def calc_hexversion(major=0, minor=0, micro=0, releaselevel="dev", serial=0): + """Calculate the hexadecimal version number from the tuple version_info: + + :param major: integer + :param minor: integer + :param micro: integer + :param relev: integer or string + :param serial: integer + :return: integer always increasing with revision numbers + """ + try: + releaselevel = int(releaselevel) + except ValueError: + releaselevel = RELEASE_LEVEL_VALUE.get(releaselevel, 0) + + hex_version = int(serial) + hex_version |= releaselevel * 1 << 4 + hex_version |= int(micro) * 1 << 8 + hex_version |= int(minor) * 1 << 16 + hex_version |= int(major) * 1 << 24 + return hex_version + + +hexversion = calc_hexversion(*version_info) + +if __name__ == "__main__": + print(version)