From e1f14031d74e6a412075bd115fd13f85e7930703 Mon Sep 17 00:00:00 2001 From: Bevan Cheeseman Date: Thu, 11 Jul 2024 12:01:43 +0000 Subject: [PATCH 01/15] Convert slider inputs to integer; --- pyapr/utils/filegui.py | 16 +++++++++++----- pyapr/viewer/compressInteractive.py | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pyapr/utils/filegui.py b/pyapr/utils/filegui.py index bd85562..e239cf1 100644 --- a/pyapr/utils/filegui.py +++ b/pyapr/utils/filegui.py @@ -31,13 +31,19 @@ def setValue(self, value): super(DoubleSlider, self).setValue(int(value * self._multi)) def setMinimum(self, value): - return super(DoubleSlider, self).setMinimum(value * self._multi) + # Convert the result to an integer to comply with the expected type + int_value = int(value * self._multi) + return super(DoubleSlider, self).setMinimum(int_value) def setMaximum(self, value): - return super(DoubleSlider, self).setMaximum(value * self._multi) + # Convert the result to an integer to comply with the expected type + int_value = int(value * self._multi) + return super(DoubleSlider, self).setMaximum(int_value) def setSingleStep(self, value): - return super(DoubleSlider, self).setSingleStep(value * self._multi) + # Convert the result to an integer to comply with the expected type + int_value = int(value * self._multi) + return super(DoubleSlider, self).setSingleStep(int_value) def singleStep(self): return float(super(DoubleSlider, self).singleStep()) / self._multi @@ -116,7 +122,7 @@ def __init__(self, slider_decimals=0): self.slider.valueChanged.connect(self.valuechange) - self.setGeometry(300, 300, self.full_size, self.full_size) + self.setGeometry(int(300), int(300), self.full_size, self.full_size) self.layout.addWidget(self.slider, 1, 0) @@ -352,7 +358,7 @@ def set_image(self, img, converter): self.slider.setMinimum(0) self.slider.setMaximum(self.z_num - 1) self.slider.setTickPosition(QtWidgets.QSlider.TicksBothSides) - self.slider.setGeometry(0.05 * self.full_size, 0.97 * self.full_size, 0.95 * self.full_size, 40) + self.slider.setGeometry(int(0.05 * self.full_size), int(0.97 * self.full_size), int(0.95 * self.full_size), int(40)) self.setLUT('viridis') diff --git a/pyapr/viewer/compressInteractive.py b/pyapr/viewer/compressInteractive.py index ab15e10..fa4fae4 100644 --- a/pyapr/viewer/compressInteractive.py +++ b/pyapr/viewer/compressInteractive.py @@ -68,7 +68,7 @@ def __init__(self): self.slider_q.move(200, 70) self.slider_q.connectSlider(self.valuechangeQ) self.slider_q.maxBox.setValue(20) - self.slider_q.slider.setSingleStep(0.1) + self.slider_q.slider.setSingleStep(int(1)) self.slider_B = CustomSlider(self, "background") self.slider_B.move(200, 100) From bd24ca611cdcc1fa60d3cfef295d05ff9f25d657 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 15:16:52 +0200 Subject: [PATCH 02/15] change macos llvm paths --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index c13deca..e649bb8 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/usr/local/opt/llvm/include" LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib" CXX="/usr/local/opt/llvm/bin/clang++" CC="/usr/local/opt/llvm/bin/clang" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" steps: - uses: actions/checkout@v4 From 1c03abfa961fa776524ad22e0b51a08d523a2c9a Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 15:26:31 +0200 Subject: [PATCH 03/15] try brew install libtiff --- .github/workflows/build-deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index e649bb8..69747a0 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -117,6 +117,7 @@ jobs: brew install libomp brew install c-blosc brew install hdf5 + brew install libtiff - name: Run cibuildwheel run: | From 1fd5bced1208ae09ee3fea634c5052953e44c114 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 15:33:50 +0200 Subject: [PATCH 04/15] use libc++ in brew llvm --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 69747a0..5402d1a 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" steps: - uses: actions/checkout@v4 From 64890607f426eda0c99bc1974d99c831961738fa Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 15:46:20 +0200 Subject: [PATCH 05/15] try reinstall libtiff --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 5402d1a..793906d 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -117,7 +117,7 @@ jobs: brew install libomp brew install c-blosc brew install hdf5 - brew install libtiff + brew reinstall libtiff - name: Run cibuildwheel run: | From 9220cee12e30746d777a84696404ca6873262232 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 18:24:57 +0200 Subject: [PATCH 06/15] macos: add brew libtiff path to LDFLAGS --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 793906d..9262729 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/Cellar/libtiff/4.6.0/lib -L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" steps: - uses: actions/checkout@v4 From 54bbb53ee96bf137cd4e2ca8207f8a16d24dc167 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 18:42:30 +0200 Subject: [PATCH 07/15] macos: add brew libtiff include path --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 9262729..9889320 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/Cellar/libtiff/4.6.0/lib -L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/Cellar/libtiff/4.6.0/include -I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/Cellar/libtiff/4.6.0/lib -L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" steps: - uses: actions/checkout@v4 From 8d0dc6d1e7147ea8e93711a92eda0efe15fb2b3f Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 19:59:32 +0200 Subject: [PATCH 08/15] macos: remove brew libtiff paths --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 9889320..793906d 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/Cellar/libtiff/4.6.0/include -I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/Cellar/libtiff/4.6.0/lib -L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" steps: - uses: actions/checkout@v4 From 6fa4954655911f675489ab11112d310add734ed7 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Thu, 11 Jul 2024 20:12:22 +0200 Subject: [PATCH 09/15] macos: try via cmake_prefix_path --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 793906d..0caa934 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0" steps: - uses: actions/checkout@v4 From 318316185480cf68dad27e066feb5bfd9f54fc36 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Fri, 12 Jul 2024 02:09:26 +0200 Subject: [PATCH 10/15] reverting llvm flags to see if it affects openmp --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 0caa934..5c451e1 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0" steps: - uses: actions/checkout@v4 From e01d89285eda8982a6453d34e2a5a3117069587d Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Fri, 12 Jul 2024 10:36:16 +0200 Subject: [PATCH 11/15] macos: specify opemp location --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 5c451e1..ff1a8e9 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include -I/opt/homebrew/opt/libomp/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/libomp/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0" steps: - uses: actions/checkout@v4 From 4ef3b4baa10a638ad574ffaabffff4dd141dd799 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Fri, 12 Jul 2024 10:46:18 +0200 Subject: [PATCH 12/15] macos: try to find omp via cmake_prefix_path --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index ff1a8e9..de142c6 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -55,7 +55,7 @@ jobs: CIBW_TEST_COMMAND: "python3 -m pytest -vv {project}/pyapr/tests" CIBW_TEST_SKIP: "*-win_amd64" # windows tests are run separately CIBW_BEFORE_BUILD_LINUX: "yum makecache && yum install -y libtiff-devel hdf5-devel" - CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include -I/opt/homebrew/opt/libomp/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/libomp/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0" + CIBW_ENVIRONMENT_MACOS: CPPFLAGS="-I/opt/homebrew/opt/llvm/include" LDFLAGS="-L/opt/homebrew/opt/llvm/lib" CXX="/opt/homebrew/opt/llvm/bin/clang++" CC="/opt/homebrew/opt/llvm/bin/clang" EXTRA_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=/opt/homebrew/Cellar/libtiff/4.6.0;/opt/homebrew/opt/libomp" steps: - uses: actions/checkout@v4 From d5f484ba8afd8def5cdb2250d7fae97ca12f93e0 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Mon, 19 Aug 2024 18:03:53 +0200 Subject: [PATCH 13/15] add python 3.12 to CI workflow --- .github/workflows/build-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index de142c6..7aa8770 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -45,7 +45,7 @@ jobs: # Indicates the location of the vcpkg as a Git submodule of the project repository. VCPKG_ROOT: ${{ github.workspace }}/external/LibAPR/vcpkg CIBW_ENVIRONMENT_WINDOWS: EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=D:\\a\\pyapr\\pyapr\\external\\LibAPR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake -DVCPKG_MANIFEST_DIR=D:\\a\\pyapr\\pyapr\\external\\LibAPR\\" - CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-*" + CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" CIBW_SKIP: "*musllinux*" CIBW_ARCHS: "auto64" CIBW_BUILD_VERBOSITY: 1 From f7e00fc9dbbf402747858244a6fdc6c39275c8a5 Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Mon, 19 Aug 2024 18:10:31 +0200 Subject: [PATCH 14/15] bump workflow actions and python versions --- .github/workflows/build-deploy.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 7aa8770..3f4f3d4 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -72,7 +72,7 @@ jobs: - uses: lukka/get-cmake@latest # Restore both vcpkg and its artifacts from the GitHub cache service. - name: Restore vcpkg and its artifacts. - uses: actions/cache@v3 + uses: actions/cache@v4 with: # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. # The second path is the location of vcpkg (it contains the vcpkg executable and data files). @@ -101,10 +101,10 @@ jobs: # On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK. - uses: ilammy/msvc-dev-cmd@v1 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 name: Install Python with: - python-version: '3.9' + python-version: '3.12' - name: Install cibuildwheel run: | @@ -125,7 +125,7 @@ jobs: python3 -m cibuildwheel --output-dir ${{matrix.builddir}} - name: Upload wheels as artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.os }}-wheels path: ${{matrix.builddir}}/ @@ -139,7 +139,7 @@ jobs: fail-fast: false matrix: os: [ windows-latest ] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout @@ -148,12 +148,12 @@ jobs: submodules: false - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Download wheels from artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ matrix.os }}-wheels path: wheelhouse @@ -183,14 +183,14 @@ jobs: if: contains(github.ref, 'tags') steps: - name: Download wheels from artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: path: wheelhouse - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: '3.9' + python-version: '3.12' - name: Install dependencies run: | From adc84c19c7de8aea11fb67f26b063b67910d09ed Mon Sep 17 00:00:00 2001 From: joeljonsson Date: Wed, 21 Aug 2024 21:33:09 +0200 Subject: [PATCH 15/15] expose copies of LinearAccess data vectors to python --- pyapr/data_containers/src/BindAPR.hpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pyapr/data_containers/src/BindAPR.hpp b/pyapr/data_containers/src/BindAPR.hpp index 296f63e..f63d66b 100644 --- a/pyapr/data_containers/src/BindAPR.hpp +++ b/pyapr/data_containers/src/BindAPR.hpp @@ -16,6 +16,21 @@ namespace py = pybind11; PYBIND11_MAKE_OPAQUE(std::vector) + +auto _get_y_vec = [](APR& apr) -> py::array { + return py::array_t(apr.linearAccess.y_vec.size(), apr.linearAccess.y_vec.begin()); +}; + +auto _get_xz_end_vec = [](APR& apr) -> py::array { + return py::array_t(apr.linearAccess.xz_end_vec.size(), apr.linearAccess.xz_end_vec.begin()); +}; + +auto _get_level_xz_vec = [](APR& apr) -> py::array { + return py::array_t(apr.linearAccess.level_xz_vec.size(), apr.linearAccess.level_xz_vec.begin()); +}; + + + void AddAPR(pybind11::module &m, const std::string &modulename) { using namespace py::literals; @@ -38,7 +53,10 @@ void AddAPR(pybind11::module &m, const std::string &modulename) { .def("org_dims", &APR::org_dims, "returns the original image size in a specified dimension (y, x, z)" , "dim"_a) .def("shape", [](APR& self){return py::make_tuple(self.org_dims(2), self.org_dims(1), self.org_dims(0));}, "returns the original pixel image dimensions as a tuple (z, x, y)") .def("get_parameters", &APR::get_apr_parameters, "return the parameters used to create the APR") - .def("computational_ratio", &APR::computational_ratio, "return the computational ratio (number of pixels in original image / number of particles in the APR)"); + .def("computational_ratio", &APR::computational_ratio, "return the computational ratio (number of pixels in original image / number of particles in the APR)") + .def("get_y_vec", _get_y_vec, "return linearAccess y_vec as a numpy array") + .def("get_xz_end_vec", _get_xz_end_vec, "return linearAccess xz_end_vec as a numpy array") + .def("get_level_xz_vec", _get_level_xz_vec, "return linearAccess level_xz_vec as a numpy array"); py::bind_vector>(m, "APRPtrVector", py::module_local(false)); }