Skip to content

Commit c8f6fc4

Browse files
committed
maint: depend on stable moclib-rust and cdshealpix-rust. Also apply modifications for to_vec_raw deprecated in ndarray
1 parent 0f19457 commit c8f6fc4

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ bench = true
2828
crate-type = ["cdylib"]
2929

3030
[dependencies]
31-
# moc = { version = "0.15", features = ["storage"] }
32-
moc = { git = 'https://github.com/cds-astro/cds-moc-rust', rev = '361eb278fe782bfc053433495c33e3f16e20cdbd', features = ["storage"] }
33-
healpix = { package = "cdshealpix", version = "0.6" }
31+
moc = { version = "0.17", features = ["storage"] }
32+
#moc = { git = 'https://github.com/cds-astro/cds-moc-rust', rev = '361eb278fe782bfc053433495c33e3f16e20cdbd', features = ["storage"] }
33+
healpix = { package = "cdshealpix", version = "0.7" }
3434
# healpix = { package = "cdshealpix", git = 'https://github.com/cds-astro/cds-healpix-rust', branch = 'master' }
3535
rayon = "1.10"
3636
num_threads = "0.1"
@@ -39,7 +39,7 @@ num_threads = "0.1"
3939
version = "0.22"
4040

4141
[dependencies.ndarray]
42-
version = "0.15"
42+
version = "0.16"
4343
default-features = false # do not include the default features, and optionally
4444
# cherry-pick individual features
4545
features = ["rayon"]

src/lib.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -1139,9 +1139,9 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
11391139
lat: PyReadonlyArrayDyn<f64>,
11401140
d2: u8,
11411141
) -> PyResult<usize> {
1142-
let times = times.as_array().to_owned().into_raw_vec();
1143-
let lon = lon.as_array().to_owned().into_raw_vec();
1144-
let lat = lat.as_array().to_owned().into_raw_vec();
1142+
let times = times.to_vec().map_err(PyValueError::new_err)?;
1143+
let lon = lon.to_vec().map_err(PyValueError::new_err)?;
1144+
let lat = lat.to_vec().map_err(PyValueError::new_err)?;
11451145

11461146
U64MocStore::get_global_store()
11471147
.create_from_times_positions_approx(times, lon, lat, d1, d2)
@@ -1177,9 +1177,9 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
11771177
lat: PyReadonlyArrayDyn<f64>,
11781178
d2: u8,
11791179
) -> PyResult<usize> {
1180-
let times = times.as_array().to_owned().into_raw_vec();
1181-
let lon = lon.as_array().to_owned().into_raw_vec();
1182-
let lat = lat.as_array().to_owned().into_raw_vec();
1180+
let times = times.to_vec().map_err(PyValueError::new_err)?;
1181+
let lon = lon.to_vec().map_err(PyValueError::new_err)?;
1182+
let lat = lat.to_vec().map_err(PyValueError::new_err)?;
11831183

11841184
U64MocStore::get_global_store()
11851185
.create_from_times_positions(times, lon, lat, d1, d2)
@@ -1224,10 +1224,10 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
12241224
lat: PyReadonlyArrayDyn<f64>,
12251225
d2: u8,
12261226
) -> PyResult<usize> {
1227-
let times_min = times_min.as_array().to_owned().into_raw_vec();
1228-
let times_max = times_max.as_array().to_owned().into_raw_vec();
1229-
let lon = lon.as_array().to_owned().into_raw_vec();
1230-
let lat = lat.as_array().to_owned().into_raw_vec();
1227+
let times_min = times_min.to_vec().map_err(PyValueError::new_err)?;
1228+
let times_max = times_max.to_vec().map_err(PyValueError::new_err)?;
1229+
let lon = lon.to_vec().map_err(PyValueError::new_err)?;
1230+
let lat = lat.to_vec().map_err(PyValueError::new_err)?;
12311231

12321232
U64MocStore::get_global_store()
12331233
.create_from_time_ranges_positions_approx(times_min, times_max, d1, lon, lat, d2)
@@ -1266,10 +1266,10 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
12661266
lat: PyReadonlyArrayDyn<f64>,
12671267
d2: u8,
12681268
) -> PyResult<usize> {
1269-
let times_min = times_min.as_array().to_owned().into_raw_vec();
1270-
let times_max = times_max.as_array().to_owned().into_raw_vec();
1271-
let lon = lon.as_array().to_owned().into_raw_vec();
1272-
let lat = lat.as_array().to_owned().into_raw_vec();
1269+
let times_min = times_min.to_vec().map_err(PyValueError::new_err)?;
1270+
let times_max = times_max.to_vec().map_err(PyValueError::new_err)?;
1271+
let lon = lon.to_vec().map_err(PyValueError::new_err)?;
1272+
let lat = lat.to_vec().map_err(PyValueError::new_err)?;
12731273

12741274
U64MocStore::get_global_store()
12751275
.create_from_time_ranges_positions(times_min, times_max, d1, lon, lat, d2)
@@ -1313,14 +1313,14 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
13131313
d1: u8,
13141314
spatial_coverages: PyReadonlyArrayDyn<usize>,
13151315
) -> PyResult<usize> {
1316-
let times_min = times_min.as_array().to_owned().into_raw_vec();
1317-
let times_max = times_max.as_array().to_owned().into_raw_vec();
1316+
let times_min = times_min.to_vec().map_err(PyValueError::new_err)?;
1317+
let times_max = times_max.to_vec().map_err(PyValueError::new_err)?;
13181318
if times_min.len() != times_max.len() {
13191319
return Err(PyValueError::new_err(
13201320
"`times_min` and `times_max` do not have the same size.",
13211321
));
13221322
}
1323-
let spatial_coverage_indices = spatial_coverages.as_array().to_owned().into_raw_vec();
1323+
let spatial_coverage_indices = spatial_coverages.to_vec().map_err(PyValueError::new_err)?;
13241324
if times_min.len() != spatial_coverage_indices.len() {
13251325
return Err(PyValueError::new_err(
13261326
"`times` and `spatial indices` do not have the same size.",
@@ -1367,14 +1367,14 @@ fn mocpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
13671367
d1: u8,
13681368
spatial_coverages: PyReadonlyArrayDyn<usize>,
13691369
) -> PyResult<usize> {
1370-
let times_min = times_min.as_array().to_owned().into_raw_vec();
1371-
let times_max = times_max.as_array().to_owned().into_raw_vec();
1370+
let times_min = times_min.to_vec().map_err(PyValueError::new_err)?;
1371+
let times_max = times_max.to_vec().map_err(PyValueError::new_err)?;
13721372
if times_min.len() != times_max.len() {
13731373
return Err(PyValueError::new_err(
13741374
"`times_min` and `times_max` do not have the same size.",
13751375
));
13761376
}
1377-
let spatial_coverage_indices = spatial_coverages.as_array().to_owned().into_raw_vec();
1377+
let spatial_coverage_indices = spatial_coverages.to_vec().map_err(PyValueError::new_err)?;
13781378
if times_min.len() != spatial_coverage_indices.len() {
13791379
return Err(PyValueError::new_err(
13801380
"`times` and `spatial indices` do not have the same size.",

0 commit comments

Comments
 (0)