Numpy VisibleDeprecationWarning in MDAnalysis core files in Python 3.8

90 views
Skip to first unread message

Amir Sadeghi

unread,
Apr 14, 2021, 10:09:34 AM4/14/21
to MDnalysis discussion
Hello MDAnalysis community,

I get the following warnings when I use the following code snippet to read and analyze a couple of Lammps data and dump files. Please use  attached a pair of data and dump files.

Thank you in advance for your help.

Amir

def remove_scaling(dimensions):
if len(dimensions) == 3:
dimensions = np.float32(dimensions)
else:
raise ValueError("{} vectors is not 3d.".format(dimensions))
def return_real(ts):
ts.positions /= dimensions
return ts
return return_real

cell = mda.Universe(data, dump, format='LAMMPSDUMP', atom_style="id resid type x y z",  dt=0.02)
# define the transformation
workflow = [remove_scaling([cellAttrs.xlen,cellAttrs.ylen,cellAttrs.zlen]), mdatransform.unwrap(cell.atoms)]
cell.trajectory.add_transformations(*workflow)

#PipeLine.universe_info(cell)
chrm = cell.select_atoms('resid 1') # resid 1 is the atoms creating the chain

gyr_t = np.empty([0]) # radius of gyration
for ts in cell.trajectory:
       gyr = chrm.radius_of_gyration()
       gyr_t = np.append(gyr_t,np.array([gyr]),axis=0) # radius of gyration in each time step

Warnings:

/scratch/amirhsi/dask/daskEnv/lib/python3.8/site-packages/MDAnalysis/core/topologyattrs.py:2011: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. 
 np.array(sorted(unique_bonds)), 4) 

/scratch/amirhsi/dask/daskEnv/lib/python3.8/site-packages/MDAnalysis/core/topologyobjects.py:600: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations 
 guessed = np.asarray(guessed, dtype=np.bool) 

/scratch/amirhsi/dask/daskEnv/lib/python3.8/site-packages/MDAnalysis/core/selection.py:640: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations 
 mask = np.zeros(len(vals), dtype=np.bool)



N2000epsilon5.0r13.0lz431sig2.0nc27780dtbdump1000adump5000ens8.bug.chunked.lammpstrj.txt
N2000epsilon5.0r13.0lz431sig2.0nc27780dtbdump1000adump5000ens8.bug.data.txt

Irfan Alibay

unread,
Apr 14, 2021, 10:27:34 AM4/14/21
to MDnalysis discussion
Hi,

Thanks for the report. We are aware of these and have already fixed them in our development branches.

The upcoming 1.1 (and then the follow up 2.0) release will fix this.

Best regards,

Irfan

Amir Hosein Sadeghi Isfahani

unread,
Apr 14, 2021, 10:46:45 AM4/14/21
to mdnalysis-...@googlegroups.com
Hi Irfan,

Thanks for replying back. When can I access to the new release?
I want to ask our HPC support team to add the new version as a new Python wheel to our cluster. 
I actually use it in combined with Dask to analyze many trajectories in parallel. 


Amir
On Apr 14, 2021, at 10:27, Irfan Alibay <ial...@mdanalysis.org> wrote:

Hi,
--
You received this message because you are subscribed to a topic in the Google Groups "MDnalysis discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mdnalysis-discussion/-gaxbxB8ViQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/a6a940ba-77f4-40cb-849b-0e84f6bbf0afn%40googlegroups.com.

irfan....@googlemail.com

unread,
Apr 14, 2021, 12:03:50 PM4/14/21
to MDnalysis discussion
Hi,

> When can I access to the new release?
We are hoping to release 1.1 in the near future, I can't promise on a specific date, but it should be out within the next couple months.

I should note that these deprecation warnings do not impact on the validity of the MDAnalysis code, they only point out that in a future version of numpy this particular version of MDAnalysis will not be compatible.

Best regards,

Irfan
Reply all
Reply to author
Forward
0 new messages