nmrglue.fileio.pipe.iter3D

class nmrglue.fileio.pipe.iter3D(filemask, in_lead='x', out_lead='DEFAULT')[source]

Object which allows for graceful iteration over 3D NMRPipe files.

iter3D.iter() returns a (dic,plane) tuple which can be written using the x.writeplane function.

When processing 3D files with iter3D object(s) the following dictionary parameters may not have the same values as NMRPipe processing scripts return:

  • FDSLICECOUNT

  • FDMAX,FDDISMAX,FDMIN,FDDISPMIN when FDSCALEFLAG == 0

Example:

#3D data processing
xiter = iter3D("data/test%03d.fid","x","x")
for dic,YXplane in xiter:
    # process X and Y axis
    xiter.write("ft/test%03d.ft2",YXplane,dic)
ziter = iter3D("ft/test%03d.ft2","z","z")
for dic,XZplane in ziter:
    # process Z axis
    ziter.write("ft/test%03d.ft3",XZplane,dic)
__init__(filemask, in_lead='x', out_lead='DEFAULT')[source]

Create a iter3D object

Parameters
filemaskstr

String file with single formatter (%) which represents which indicates which NMRPipe file to read.

in_lead(‘x’, ‘y’, ‘z’), optional

Axis name of last (1st) axis in outputted 2D

out_lead(‘x’, ‘y’, ‘z’, ‘DEFAULT’), optional

Axis name of axis to be written, typically this is the same as in_load, which is the used if ‘DEFAULT’ is given.

Notes

In-lead

Iterated Planes

“x”

(‘y’,’x’)

“y”

(‘x’,’y’)

“z”

(‘x’,’z’)

Methods

__init__(filemask[, in_lead, out_lead])

Create a iter3D object

next()

Return the next dic, plane or raise StopIteration

reinitialize()

Restart iterator at first dic,plane.

write(filemask, plane, dic)

Write out current plane.