Sparky to NMRPipe example

Introduction

This example is taken from Listing S1 in the 2013 JBNMR nmrglue paper. In this example a 2D Sparky file (data.ucsf) is converted to a NMRPipe file (data.ft2) by the Python script sparky2pipe_convert.py.

Instructions

Execute python sparky2pipe_convert.py to perform the conversion. The file data.ft2 will be created.

The data used in this example is available for download. [29.6 MB]

Listing S1

[sparky2pipe_convert.py]

import nmrglue as ng

# read in the Sparky file
sdic, sdata = ng.sparky.read('data.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('data.ft2', pdic, pdata)