convert example: bruker2pipe_1d

This example shows how to use nmrglue to convert a 1D Bruker data set into a NMRPipe file.

The data used in this example is available for download.

[source code]

#! /usr/bin/env python

import nmrglue as ng

# read in the Bruker data
dic, data = ng.bruker.read("bruker_1d")

# Set the spectral parameters.
udic = ng.bruker.guess_udic(dic, data)
udic[0]['size']     = 2048
udic[0]['complex']  = True
udic[0]['encoding'] = 'direct'
udic[0]['sw']       = 10000.000
udic[0]['obs']      = 600.133
udic[0]['car']      = 4.773 * 600.133
udic[0]['label']    = '1H'

# create the converter object and initilize with Bruker data
C = ng.convert.converter()
C.from_bruker(dic, data, udic)

# create NMRPipe data and then write it out
ng.pipe.write("1d_pipe.fid", *C.to_pipe(), overwrite=True)