Repository navigation
Fix problems in to_mdtraj and notebook tests - #776
Conversation
|
This is actually happening due to an incompatibility between previous nc files and this netcdf4 version (might be a genuine upstream issue): import openpathsampling as paths
store = paths.Storage('test.nc','w')
frame = paths.engines.openmm.snapshot_from_pdb('resources/AD_initial_frame.pdb') #In the examples dir
traj = paths.Trajectory([frame,frame])
store.save(traj)
store.close()
#update netcdf from 1.3 to 1.4 here to break
import openpathsampling as paths
store = paths.Storage('test.nc','r')
traj = store.trajectories[0]
print(traj.box_vectors)
print(type(traj.box_vectors))
traj.to_mdtraj()and the print statements return [[[2.558 0. 0. ]
[0. 2.558 0. ]
[0. 0. 2.558]]
[[2.558 0. 0. ]
[0. 2.558 0. ]
[0. 0. 2.558]]] nm
<class 'simtk.unit.quantity.Quantity'>however if the storage is saved in version 1.3 and loaded in version 1.4 the code breaks and the print statements are [Quantity(value=masked_array(
data=[[2.558000087738037, 0.0, 0.0],
[0.0, 2.558000087738037, 0.0],
[0.0, 0.0, 2.558000087738037]],
mask=[[False, False, False],
[False, False, False],
[False, False, False]],
fill_value=9.96921e+36,
dtype=float32), unit=nanometer), Quantity(value=masked_array(
data=[[2.558000087738037, 0.0, 0.0],
[0.0, 2.558000087738037, 0.0],
[0.0, 0.0, 2.558000087738037]],
mask=[[False, False, False],
[False, False, False],
[False, False, False]],
fill_value=9.96921e+36,
dtype=float32), unit=nanometer)]
<class 'list'> |
|
Seems like they're aware of the possibility that this could break existing code: Unidata/netcdf4-python#787 (comment). At least the fix for that was easy, although it's yet another time that a minor release of netCDF broke our code. There are still some other errors in these runs. I'll try to track them down before merging this. |
Looks like recent pandas changes were causing problems in Py3
|
This is ready for review. Because the changes are small (no new features; only updates so tests still pass after upstream changes) and because they are important (tests are failing until this is merged, especially affecting users who upgrade netCDF), I will leave this up for review for 24 hours. After that, I'll merge it myself. |
|
Looks fine from my limited quick view. Please go ahead and merge! |
A recent update to netcdf seems to be causing errors when we use
to_mdtraj. This PR aims to fix that.UPDATE: this PR will fix several problems. They are:
np.maskedarrayby default, which doesn't seem to play nicely withsimtk.unit(and was causing problems in ourto_mdtraj); usingset_auto_mask(False)fixes