jjhelmus / nmrglue

A module for working with NMR data in Python
BSD 3-Clause "New" or "Revised" License
211 stars 86 forks source link

read function in bruker.py -- floats in shape shows depreciation warning #51

Closed andrewgrapentin closed 8 years ago

andrewgrapentin commented 8 years ago

Hello, Since I am yet to learn git ill post this here. I get the following warning when reading a bruker 1d dataset.

nmrglue/fileio/bruker.py:1170: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  return dic, data.reshape(shape)

This is fixed by converting to ints (like in guess_shape) after division.

bruker.py:360

before

gshape = tuple(t)

after

gshape = tuple([int(flt) for flt in t])
jjhelmus commented 8 years ago

@agrapentin Thanks for finding this bug and reporting it. The issue is actually that the division a few lines earlier is producing floats but should be using interger division. This issue pop up a few times in nmrglue and is causing the VisibleDeprecationWarning with NumPy 1.11. I'll create a fix for these later this week.

andrewgrapentin commented 8 years ago

Thanks @jjhelmus, seems to be in a few locations as after converting to pipe, ng.pipe.read has the issue as well.

Integer division. Why didn't I think of that! =D Nice work.