NNPDF / pineappl

PineAPPL is not an extension of APPLgrid
https://nnpdf.github.io/pineappl/
GNU General Public License v3.0
13 stars 3 forks source link

Fix deprecation warning in `pineappl_py` #144

Closed cschwan closed 2 years ago

cschwan commented 2 years ago
warning: use of deprecated associated function `numpy::PyReadonlyArray::<'py, T, D>::iter`: The wrappers of the array iterator API are deprecated, please use ndarray's `ArrayBase::iter` instead.                                                                                     
   --> src/grid.rs:183:17
    |
183 |             x1s.iter().unwrap(),
    |                 ^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated associated function `numpy::PyReadonlyArray::<'py, T, D>::iter`: The wrappers of the array iterator API are deprecated, please use ndarray's `ArrayBase::iter` instead.                                                                                     
   --> src/grid.rs:184:17
    |
184 |             x2s.iter().unwrap(),
    |                 ^^^^

warning: use of deprecated associated function `numpy::PyReadonlyArray::<'py, T, D>::iter`: The wrappers of the array iterator API are deprecated, please use ndarray's `ArrayBase::iter` instead.                                                                                     
   --> src/grid.rs:185:17
    |
185 |             q2s.iter().unwrap(),
    |                 ^^^^

warning: use of deprecated associated function `numpy::PyReadonlyArray::<'py, T, D>::iter`: The wrappers of the array iterator API are deprecated, please use ndarray's `ArrayBase::iter` instead.                                                                                     
   --> src/grid.rs:186:25
    |
186 |             observables.iter().unwrap(),
    |                         ^^^^

warning: use of deprecated associated function `numpy::PyReadonlyArray::<'py, T, D>::iter`: The wrappers of the array iterator API are deprecated, please use ndarray's `ArrayBase::iter` instead.                                                                                     
   --> src/grid.rs:187:21
    |
187 |             weights.iter().unwrap(),
    |                     ^^^^

warning: 5 warnings emitted============> ] 81/82: pineappl_py                                                                                                                                                                                                                          
alecandido commented 2 years ago

I see. Is the proposed solution something like:

ArrayBase::iter(myarray).unwrap()

or should I explicitly recast at ArrayBase before calling .iter()?

cschwan commented 2 years ago

That's the question, I don't understand the warning.

alecandido commented 2 years ago

Me too...

felixhekhorn commented 2 years ago

iter pointing to NpySingleIter (also deprecated) to lanes (I guess)

alecandido commented 2 years ago

Lanes are a more complicated concept, I'm not sure we want that one, but we might have a look.