Updated pyarray conversions from numpy 0.22.0 to 0.25.0 compatible calls

This commit is contained in:
2025-05-28 10:23:14 +01:00
parent e697741d39
commit 4a5456e93a

View File

@@ -37,7 +37,7 @@ where
ArrayBase<OwnedRepr<f64>, Ix2>: ToPyArray<Item = f64, Dim = Ix2>, ArrayBase<OwnedRepr<f64>, Ix2>: ToPyArray<Item = f64, Dim = Ix2>,
{ {
let rs_result = rust_fn::read_layers(folder)?; let rs_result = rust_fn::read_layers(folder)?;
let py_result = rs_result.to_pyarray_bound(_py); let py_result = rs_result.to_pyarray(_py);
Ok(py_result) Ok(py_result)
} }
@@ -51,14 +51,14 @@ fn read_selected_layers(
.map(|x| Path::new(x).to_path_buf()) .map(|x| Path::new(x).to_path_buf())
.collect(); .collect();
let rs_result = rust_fn::read_selected_layers(path_list)?; let rs_result = rust_fn::read_selected_layers(path_list)?;
let py_result = rs_result.to_pyarray_bound(_py); let py_result = rs_result.to_pyarray(_py);
Ok(py_result) Ok(py_result)
} }
#[pyfunction] #[pyfunction]
fn read_layer(_py: Python<'_>, file: String) -> PyResult<Bound<'_, PyArray2<f64>>> { fn read_layer(_py: Python<'_>, file: String) -> PyResult<Bound<'_, PyArray2<f64>>> {
let rs_result = rust_fn::read_layer(&file)?; let rs_result = rust_fn::read_layer(&file)?;
let py_result = rs_result.to_pyarray_bound(_py); let py_result = rs_result.to_pyarray(_py);
Ok(py_result) Ok(py_result)
} }