dimchris / mdanalysis

Automatically exported from code.google.com/p/mdanalysis
0 stars 0 forks source link

DCDReader.dcd_header() and DCDReader._dcd_header() broken #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. import MDAnalysis
2. from MDAnalysis.tests.datafiles import PSF,DCD
3. u = MDAnalysis.Universe(PSF,DCD)
4. u.trajectory.dcd_header()

What is the expected output? What do you see instead?
Should produce a sensible dict of values.

In [27]: u.trajectory.dcd_header()
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)

/Volumes/Data/oliver/Biop/Projects/FABP/I-FABP/1IFC/GMX/WT/analysis/<ipython 
console>
in <module>()

/Volumes/Data/oliver/Biop/Library/python/mdanalysis/MDAnalysis/coordinates/DCD.p
y
in dcd_header(self)
    161         import warnings
    162         warnings.warn('dcd_header is not part of the trajectory API
and will be renamed to _dcd_header',
--> 163                       DeprecationWarning)
    164         self._dcd_header()
    165     def _dcd_header(self):

error: unpack requires a string argument of length 80

Original issue reported on code.google.com by orbeckst on 5 May 2010 at 11:54

GoogleCodeExporter commented 9 years ago
oops, should have submitted the correct trace (against 0.6.2-dev, already 
includes
the deprecation warning)

In [6]: u.trajectory.dcd_header()
/Volumes/Data/oliver/Biop/Library/python/mdanalysis/MDAnalysis/coordinates/DCD.p
y:163: DeprecationWarning:
dcd_header is not part of the trajectory API and will be renamed to _dcd_header
  DeprecationWarning)
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)

/Volumes/Data/oliver/Biop/Projects/FABP/I-FABP/1IFC/GMX/WT/<ipython console> in
<module>()

/Volumes/Data/oliver/Biop/Library/python/mdanalysis/MDAnalysis/coordinates/DCD.p
y in
dcd_header(self)
    162         warnings.warn('dcd_header is not part of the trajectory API and will
be renamed to _dcd_header',
    163                       DeprecationWarning)
--> 164         self._dcd_header()
    165     def _dcd_header(self):
    166         import struct

/Volumes/Data/oliver/Biop/Library/python/mdanalysis/MDAnalysis/coordinates/DCD.p
y in
_dcd_header(self)
    166         import struct
    167         desc = ['file_desc', 'header_size', 'natoms', 'nsets', 'setsread',
'istart', 'nsavc', 'delta', 'nfixed', 'freeind_ptr', 'fixedcoords_ptr', 
'reverse',
'charmm', 'first', 'with_unitcell']
--> 168         return dict(zip(desc, 
struct.unpack("iiiiiiidiPPiiii",self._dcd_C_str)))
    169     def __len__(self):
    170         return self.numframes

error: unpack requires a string argument of length 80

Original comment by orbeckst on 5 May 2010 at 11:56

GoogleCodeExporter commented 9 years ago
oops, should have added a return... but doesn't matter because since 0.7.0 the 
function is removed as deprecated

Original comment by orbeckst on 12 Oct 2010 at 12:11

GoogleCodeExporter commented 9 years ago
Er... actually, still a bug:

u.trajectory._dcd_header()

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)

/Users/oliver/<ipython console> in <module>()

/Volumes/Data/oliver/Biop/Library/python/mdanalysis/MDAnalysis/coordinates/DCD.p
yc in _dcd_header(self)
    121         import struct
    122         desc = ['file_desc', 'header_size', 'natoms', 'nsets', 'setsread', 'istart', 'nsavc', 'delta', 'nfixed', 'freeind_ptr', 'fixedcoords_ptr', 'reverse', 'charmm', 'first', 'with_unitcell']
--> 123         return dict(zip(desc, 
struct.unpack("iiiiiiidiPPiiii",self._dcd_C_str)))
    124     def __iter__(self):
    125         # Reset the trajectory file, read from the start

error: unpack requires a string argument of length 80

Original comment by orbeckst on 12 Oct 2010 at 7:32

GoogleCodeExporter commented 9 years ago

Original comment by orbeckst on 12 Oct 2010 at 7:33

GoogleCodeExporter commented 9 years ago
Fixed in r486 (at least on Mac OS X 10.6).

The function only exists for debugging purposes and might be removed without 
notice in the future.

Original comment by orbeckst on 12 Oct 2010 at 8:21