From 1ce2c6aca999c43b7d893d1151c1edaccd1bbd4c Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Tue, 15 Oct 2024 11:22:10 +0200 Subject: [PATCH 1/7] maint: bump pyo3 to 0.22 implicit signatures when there are default options are now deprecated in pyo3 --- Cargo.toml | 4 ++-- src/lib.rs | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ea618825..605bf09d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ rayon = "1.10" num_threads = "0.1" [dependencies.numpy] -version = "0.21" +version = "0.22" [dependencies.ndarray] version = "0.15" @@ -45,7 +45,7 @@ default-features = false # do not include the default features, and optionally features = ["rayon"] [dependencies.pyo3] -version = "0.21" +version = "0.22" features = ["extension-module"] [profile.release] diff --git a/src/lib.rs b/src/lib.rs index 599f972c..57213e48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,6 +172,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// * `delta_depth`: precision parameter /// * `n_threads`: number of threads to use (max number of threads if `n_threads=None`. #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, radius_deg, depth, delta_depth, n_threads=None))] fn from_same_cones( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -248,6 +249,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// * `delta_depth`: precision parameter /// * `n_threads`: number of threads to use (max number of threads if `n_threads=None`. #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, radius_deg, depth, delta_depth, n_threads=None))] fn from_cones( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -328,6 +330,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// * `delta_depth`: precision parameter /// * `n_threads`: number of threads to use (max number of threads if `n_threads=None`. #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, radius_deg, depth, delta_depth, n_threads=None))] fn from_small_cones( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -403,6 +406,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// * `delta_depth`: precision parameter /// * `n_threads`: number of threads to use (max number of threads if `n_threads=None`. #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, radius_deg, depth, delta_depth, n_threads=None))] fn from_large_cones( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -507,6 +511,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// # Output /// - The MOC indices in the storage #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, a, b, angle, depth, n_threads=None))] pub fn from_same_boxes( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -591,6 +596,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// # Output /// - The MOC indices in the storage #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, a, b, pa, depth, n_threads=None))] pub fn from_boxes( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -685,6 +691,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// # Output /// - The MOC index in the storage #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, a, b, pa, depth, n_threads=None))] pub fn from_small_boxes( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -773,6 +780,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// # Output /// - The MOC index in the storage #[pyfn(m)] + #[pyo3(signature = (lon_deg, lat_deg, a, b, pa, depth, n_threads=None))] pub fn from_large_boxes( lon_deg: PyReadonlyArrayDyn, lat_deg: PyReadonlyArrayDyn, @@ -970,6 +978,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// * `depth`: MOC depth /// * `n_threads`: number of threads to use (max number of threads if `n_threads=None`. #[pyfn(m)] + #[pyo3(signature = (lon_lat_deg, complement, depth, n_threads=None))] pub fn from_polygons( lon_lat_deg: Vec>, complement: bool, @@ -2304,6 +2313,7 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { /// Same as `multiorder_probdens_map_sum_in_smoc` but applied on multiple S-MOCs. #[pyfn(m)] + #[pyo3(signature = (indices, uniq, uniq_mask, probdens, probdens_mask, n_threads=None))] fn multi_multiorder_probdens_map_sum_in_smoc<'a>( py: Python<'a>, indices: PyReadonlyArrayDyn<'a, usize>, From dffc32bb34df7bc5e3b19a36cc7429175161d6fb Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Tue, 15 Oct 2024 11:23:19 +0200 Subject: [PATCH 2/7] maint: add support for python 3.13 and relax constraint on numpy --- pyproject.toml | 18 +++++++++++++++--- python/mocpy/fmoc/fmoc.py | 2 +- python/mocpy/moc/moc.py | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index aa47b0a2..27261f6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ requires-python = ">=3.8" dependencies = [ "astropy<5.3; python_version == '3.8'", "astropy; python_version > '3.8'", - "numpy<2.0", + "numpy", "matplotlib", # Used in fill and border "cdshealpix>=0.6.4", # Used in fill and border "networkx>=2.5", # Used in get_boundaries @@ -18,8 +18,17 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Rust", "License :: OSI Approved :: BSD License", - "Topic :: Scientific/Engineering :: Astronomy" + "Topic :: Scientific/Engineering :: Astronomy", + "Intended Audience :: Science/Research", + "Intended Audience :: Education", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] +keywords=["astronomy", "astrophysics", "HEALPix"] [project.optional-dependencies] # optional to load FITS from URLs @@ -58,7 +67,10 @@ notebooks = [ ] [project.urls] -repository = "https://github.com/cds-astro/mocpy" +Documentation = "https://cds-astro.github.io/mocpy/" +Repository = "https://github.com/cds-astro/mocpy" +Issues = "https://github.com/cds-astro/mocpy/issues" +Changelog = "https://github.com/cds-astro/mocpy/blob/master/CHANGELOG.md" # Build a mocpy-x.x.x.tar.gz containing sources (from maturin). [build-system] diff --git a/python/mocpy/fmoc/fmoc.py b/python/mocpy/fmoc/fmoc.py index 2abcdd48..5fa23202 100644 --- a/python/mocpy/fmoc/fmoc.py +++ b/python/mocpy/fmoc/fmoc.py @@ -44,7 +44,7 @@ def max_order(self): -------- >>> from mocpy import FrequencyMOC >>> fmoc = FrequencyMOC.from_json({8: [12, 14, 16], 22: [120, 121, 122]}) - >>> fmoc.max_order + >>> print(fmoc.max_order) 22 """ depth = mocpy.get_fmoc_depth(self.store_index) diff --git a/python/mocpy/moc/moc.py b/python/mocpy/moc/moc.py index c7178695..b9edfdb3 100644 --- a/python/mocpy/moc/moc.py +++ b/python/mocpy/moc/moc.py @@ -2346,7 +2346,7 @@ def wcs( >>> import matplotlib.pyplot as plt >>> moc = MOC.from_str("2/2-25 28 29 4/0 6/") >>> fig = plt.figure() - >>> moc.wcs(fig) # DOCTEST: +IGNORE_RESULT + >>> moc.wcs(fig) # doctest: +SKIP WCS Keywords Number of WCS axes: 2 From 61fc4654bda6909695a50f4d74f8ffc5c087f697 Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Tue, 15 Oct 2024 11:24:41 +0200 Subject: [PATCH 3/7] maint: prepare 0.17.0 --- CHANGELOG.md | 2 ++ Cargo.toml | 2 +- codemeta.json | 4 ++-- python/mocpy/version.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 374cb12b..9cd564e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [0.17.2] + ### Added * Add support of `regions.Regions` [#163] diff --git a/Cargo.toml b/Cargo.toml index 605bf09d..ba1e094c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "MOCPy" -version = "0.16.2" +version = "0.17.0" authors = [ "Matthieu Baumann ", "Thomas Boch ", diff --git a/codemeta.json b/codemeta.json index a76d7ccb..6532c3e0 100644 --- a/codemeta.json +++ b/codemeta.json @@ -9,8 +9,8 @@ "dateModified": "2023-12-04", "issueTracker": "https://github.com/cds-astro/mocpy/issues", "name": "MOCpy", - "version": "0.16.2", - "softwareVersion": "0.16.2", + "version": "0.17.0", + "softwareVersion": "0.17.0", "description": "Python library to easily create and manipulate MOCs (Multi-Order Coverage maps)", "applicationCategory": ["Astronomy", "Science"], "funding": "ESCAPE 824064, ASTERICS 653477", diff --git a/python/mocpy/version.py b/python/mocpy/version.py index 7f33bc09..fd86b3ee 100644 --- a/python/mocpy/version.py +++ b/python/mocpy/version.py @@ -1 +1 @@ -__version__ = "0.16.2" +__version__ = "0.17.0" From c7a13b00329bb5f24405621dfe8a2fb04e49dcfd Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Tue, 15 Oct 2024 12:33:21 +0200 Subject: [PATCH 4/7] fix: switch to Array vendored by numpy crate to avoid versions mismatchs --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 57213e48..7c823ddc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,13 @@ use std::{f64::consts::FRAC_PI_3, ops::Range}; -use ndarray::Array; #[cfg(not(target_arch = "wasm32"))] use num_threads::num_threads; use numpy::{ IntoPyArray, Ix2, Ix3, PyArray1, PyArray2, PyArray3, PyArrayDyn, PyArrayMethods, PyReadonlyArray1, PyReadonlyArray2, PyReadonlyArrayDyn, PyUntypedArrayMethods, }; +use numpy::ndarray::Array; + use pyo3::{ exceptions::{PyIOError, PyValueError}, prelude::{pymodule, Bound, PyModule, PyResult, Python}, From 99dd1f2fed189fb26400f37fb5c7274c9d2f328d Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Tue, 15 Oct 2024 12:40:25 +0200 Subject: [PATCH 5/7] maint: add python 3.13 in ci --- .github/workflows/deploy.yml | 14 +++++++------- .github/workflows/test.yml | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0d982961..7b7f12c6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,7 +26,7 @@ jobs: MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN_FXP }} run: | source $HOME/.cargo/env - for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do + for PYBIN in /opt/python/cp3{8,9,10,11,12,13}-*/bin; do "${PYBIN}/pip" install --upgrade pip "${PYBIN}/pip" install maturin "${PYBIN}/maturin" publish -i "${PYBIN}/python" --skip-existing --compatibility manylinux_2_28 @@ -52,7 +52,7 @@ jobs: MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN_FXP }} run: | source $HOME/.cargo/env - for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do + for PYBIN in /opt/python/cp3{8,9,10,11,12,13}-*/bin; do "${PYBIN}/pip" install --upgrade pip "${PYBIN}/pip" install maturin "${PYBIN}/maturin" publish -i "${PYBIN}/python" --skip-existing --compatibility manylinux2014 @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest # CentOS 7 32 bits Docker Hub image that 'build-linux-wheels' executes in. # See https://github.com/pypa/manylinux for this particular container: - # * CPython 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12 installed in /opt/python/- + # * CPython 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 13 installed in /opt/python/- env: MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN_FXP }} img: quay.io/pypa/manylinux2014_i686 @@ -81,7 +81,7 @@ jobs: ${{ env.img }} \ bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ source $HOME/.cargo/env && \ - for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do + for PYBIN in /opt/python/cp3{8,9,10,11,12,13}-*/bin; do echo "Loop on PYBIN: $PYBIN" "${PYBIN}/pip" install --upgrade pip "${PYBIN}/pip" install maturin @@ -108,7 +108,7 @@ jobs: ${{ env.img }} \ bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-host aarch64-unknown-linux-gnu -y && \ source $HOME/.cargo/env && \ - for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do + for PYBIN in /opt/python/cp3{8,9,10,11,12,13}-*/bin; do echo "Loop on PYBIN: $PYBIN" "${PYBIN}/pip" install maturin "${PYBIN}/maturin" -V @@ -124,7 +124,7 @@ jobs: fail-fast: false matrix: os: [windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11','3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11','3.12', '3.13'] steps: # Checkout the project - uses: actions/checkout@v4 @@ -158,7 +158,7 @@ jobs: fail-fast: false matrix: os: [macOS-latest] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: # Checkout the project - uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15f1efdf..7e6f9e43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: - name: "Build and test wheels" run: | source $HOME/.cargo/env - for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do + for PYBIN in /opt/python/cp3{8,9,10,11,12,13}-*/bin; do echo "Loop on PYBIN: $PYBIN" # With maturin develop, we have to use virtualenv "${PYBIN}/pip" install virtualenv @@ -50,7 +50,7 @@ jobs: runs-on: macOS-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: # Checkout the project - name: "Checkout branch ${{ github.head_ref }}" @@ -87,7 +87,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: # Checkout the project - name: "Checkout branch ${{ github.head_ref }}" From 0f19457df470d2e80a2e6fae066db4e988f5796a Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Tue, 15 Oct 2024 14:23:57 +0200 Subject: [PATCH 6/7] maint: revert supporting python 3.13, this is blocked by pyerfa (astropy mandatory dependency) --- .github/workflows/deploy.yml | 2 +- .github/workflows/test.yml | 6 +++--- CHANGELOG.md | 2 +- pyproject.toml | 6 ++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7b7f12c6..239bedf8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -124,7 +124,7 @@ jobs: fail-fast: false matrix: os: [windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11','3.12', '3.13'] + python-version: ['3.8', '3.9', '3.10', '3.11','3.12'] steps: # Checkout the project - uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7e6f9e43..15f1efdf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: - name: "Build and test wheels" run: | source $HOME/.cargo/env - for PYBIN in /opt/python/cp3{8,9,10,11,12,13}-*/bin; do + for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do echo "Loop on PYBIN: $PYBIN" # With maturin develop, we have to use virtualenv "${PYBIN}/pip" install virtualenv @@ -50,7 +50,7 @@ jobs: runs-on: macOS-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: # Checkout the project - name: "Checkout branch ${{ github.head_ref }}" @@ -87,7 +87,7 @@ jobs: runs-on: windows-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: # Checkout the project - name: "Checkout branch ${{ github.head_ref }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd564e5..6cd55821 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] -## [0.17.2] +## [0.17.0] ### Added diff --git a/pyproject.toml b/pyproject.toml index 27261f6b..5a4e7cbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,6 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", ] keywords=["astronomy", "astrophysics", "HEALPix"] @@ -38,18 +37,17 @@ astropy_regions = ["regions"] # for the documentation docs = [ "astropy-sphinx-theme", - "astropy_healpix", "nbsphinx", "numpydoc", "sphinx-astropy", "sphinx-collections", "sphinx-copybutton", "sphinx-gallery", - "sphinxcontrib-bibtex" + "sphinxcontrib-bibtex", + "ipython" # for syntaxic coloration in docs ] # for developpement dev = [ - "astropy_healpix", "pre-commit >= 2.20", "pytest > 6.0", "pytest-mock", From c8f6fc48a0bb5f545c96a080d2fa330ef1c70be6 Mon Sep 17 00:00:00 2001 From: MARCHAND MANON Date: Thu, 17 Oct 2024 15:21:37 +0200 Subject: [PATCH 7/7] maint: depend on stable moclib-rust and cdshealpix-rust. Also apply modifications for to_vec_raw deprecated in ndarray --- Cargo.toml | 8 ++++---- src/lib.rs | 40 ++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ba1e094c..f75bd21d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,9 +28,9 @@ bench = true crate-type = ["cdylib"] [dependencies] -# moc = { version = "0.15", features = ["storage"] } -moc = { git = 'https://github.com/cds-astro/cds-moc-rust', rev = '361eb278fe782bfc053433495c33e3f16e20cdbd', features = ["storage"] } -healpix = { package = "cdshealpix", version = "0.6" } +moc = { version = "0.17", features = ["storage"] } +#moc = { git = 'https://github.com/cds-astro/cds-moc-rust', rev = '361eb278fe782bfc053433495c33e3f16e20cdbd', features = ["storage"] } +healpix = { package = "cdshealpix", version = "0.7" } # healpix = { package = "cdshealpix", git = 'https://github.com/cds-astro/cds-healpix-rust', branch = 'master' } rayon = "1.10" num_threads = "0.1" @@ -39,7 +39,7 @@ num_threads = "0.1" version = "0.22" [dependencies.ndarray] -version = "0.15" +version = "0.16" default-features = false # do not include the default features, and optionally # cherry-pick individual features features = ["rayon"] diff --git a/src/lib.rs b/src/lib.rs index 7c823ddc..3c0a4551 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1139,9 +1139,9 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { lat: PyReadonlyArrayDyn, d2: u8, ) -> PyResult { - let times = times.as_array().to_owned().into_raw_vec(); - let lon = lon.as_array().to_owned().into_raw_vec(); - let lat = lat.as_array().to_owned().into_raw_vec(); + let times = times.to_vec().map_err(PyValueError::new_err)?; + let lon = lon.to_vec().map_err(PyValueError::new_err)?; + let lat = lat.to_vec().map_err(PyValueError::new_err)?; U64MocStore::get_global_store() .create_from_times_positions_approx(times, lon, lat, d1, d2) @@ -1177,9 +1177,9 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { lat: PyReadonlyArrayDyn, d2: u8, ) -> PyResult { - let times = times.as_array().to_owned().into_raw_vec(); - let lon = lon.as_array().to_owned().into_raw_vec(); - let lat = lat.as_array().to_owned().into_raw_vec(); + let times = times.to_vec().map_err(PyValueError::new_err)?; + let lon = lon.to_vec().map_err(PyValueError::new_err)?; + let lat = lat.to_vec().map_err(PyValueError::new_err)?; U64MocStore::get_global_store() .create_from_times_positions(times, lon, lat, d1, d2) @@ -1224,10 +1224,10 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { lat: PyReadonlyArrayDyn, d2: u8, ) -> PyResult { - let times_min = times_min.as_array().to_owned().into_raw_vec(); - let times_max = times_max.as_array().to_owned().into_raw_vec(); - let lon = lon.as_array().to_owned().into_raw_vec(); - let lat = lat.as_array().to_owned().into_raw_vec(); + let times_min = times_min.to_vec().map_err(PyValueError::new_err)?; + let times_max = times_max.to_vec().map_err(PyValueError::new_err)?; + let lon = lon.to_vec().map_err(PyValueError::new_err)?; + let lat = lat.to_vec().map_err(PyValueError::new_err)?; U64MocStore::get_global_store() .create_from_time_ranges_positions_approx(times_min, times_max, d1, lon, lat, d2) @@ -1266,10 +1266,10 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { lat: PyReadonlyArrayDyn, d2: u8, ) -> PyResult { - let times_min = times_min.as_array().to_owned().into_raw_vec(); - let times_max = times_max.as_array().to_owned().into_raw_vec(); - let lon = lon.as_array().to_owned().into_raw_vec(); - let lat = lat.as_array().to_owned().into_raw_vec(); + let times_min = times_min.to_vec().map_err(PyValueError::new_err)?; + let times_max = times_max.to_vec().map_err(PyValueError::new_err)?; + let lon = lon.to_vec().map_err(PyValueError::new_err)?; + let lat = lat.to_vec().map_err(PyValueError::new_err)?; U64MocStore::get_global_store() .create_from_time_ranges_positions(times_min, times_max, d1, lon, lat, d2) @@ -1313,14 +1313,14 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { d1: u8, spatial_coverages: PyReadonlyArrayDyn, ) -> PyResult { - let times_min = times_min.as_array().to_owned().into_raw_vec(); - let times_max = times_max.as_array().to_owned().into_raw_vec(); + let times_min = times_min.to_vec().map_err(PyValueError::new_err)?; + let times_max = times_max.to_vec().map_err(PyValueError::new_err)?; if times_min.len() != times_max.len() { return Err(PyValueError::new_err( "`times_min` and `times_max` do not have the same size.", )); } - let spatial_coverage_indices = spatial_coverages.as_array().to_owned().into_raw_vec(); + let spatial_coverage_indices = spatial_coverages.to_vec().map_err(PyValueError::new_err)?; if times_min.len() != spatial_coverage_indices.len() { return Err(PyValueError::new_err( "`times` and `spatial indices` do not have the same size.", @@ -1367,14 +1367,14 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> { d1: u8, spatial_coverages: PyReadonlyArrayDyn, ) -> PyResult { - let times_min = times_min.as_array().to_owned().into_raw_vec(); - let times_max = times_max.as_array().to_owned().into_raw_vec(); + let times_min = times_min.to_vec().map_err(PyValueError::new_err)?; + let times_max = times_max.to_vec().map_err(PyValueError::new_err)?; if times_min.len() != times_max.len() { return Err(PyValueError::new_err( "`times_min` and `times_max` do not have the same size.", )); } - let spatial_coverage_indices = spatial_coverages.as_array().to_owned().into_raw_vec(); + let spatial_coverage_indices = spatial_coverages.to_vec().map_err(PyValueError::new_err)?; if times_min.len() != spatial_coverage_indices.len() { return Err(PyValueError::new_err( "`times` and `spatial indices` do not have the same size.",