Sparky to pipe conversion problem

78 views
Skip to first unread message

Alessandro Sicorello

unread,
Nov 26, 2014, 1:58:44 PM11/26/14
to nmrglue...@googlegroups.com
I need to convert a series of 2d ucsf files to pipe ft2 format. I tried and use the following script taken from the nmrglue tutorial:

-----------------------------------------------------------------
import nmrglue as ng

# read in the Sparky file
sdic, sdata = ng.sparky.read_2D('test.ucsf')

# convert to NMRPipe format
C = ng.convert.converter()
C.from_sparky(sdic, sdata)
pdic, pdata = C.to_pipe()

# write results to NMRPipe file
ng.pipe.write('test.ft2', pdic, pdata)
-----------------------------------------------------------------

Once I run the script I get:

----------------------------------------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "sparky2pipe.py", line 4, in <module>
    sdic, sdata = ng.sparky.read_2D('test.ucsf')
  File "/usr/lib/python2.6/site-packages/nmrglue/fileio/sparky.py", line 384, in read_2D
    raise IOError("Bad file size %s vs %s", (seek_pos, dic["seek_pos"]))
IOError: [Errno Bad file size %s vs %s] (1606068L, 0)
----------------------------------------------------------------------------------------------------------------------------

Any suggestion about how to sort this out?

Thanks,
Alessandro.

Jonathan Helmus

unread,
Nov 26, 2014, 4:14:45 PM11/26/14
to nmrglue...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "nmrglue-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nmrglue-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alessandro,

    This error is due to a check that nmrglue is performings to see if the size of the file reported within the Sparky file matches the actual size on disk.  These should match but they do not as the size reported in the file is incorrect (0).  I've seen enough Sparky files of this nature that it does not make sense to raise an error and stop reading the file but rather issue a warning and continue reading the file.  Some utility out there is producing Sparky files with an incorrect header.  I made the necessary changes to nmrglue [1] for this behaviour.  If you update nmrglue to the latest version of GitHub you should be able to convert these files.

Cheers,

    - Jonathan Helmus

[1] https://github.com/jjhelmus/nmrglue/commit/cedf466ea3c63395c7b408a8e2cd514499eb9aba

Alessandro Sicorello

unread,
Nov 27, 2014, 4:44:55 AM11/27/14
to nmrglue...@googlegroups.com
Thanks for your help! I'll update nmrglue to the newest version and try again.

Alessandro.
Reply all
Reply to author
Forward
0 new messages