This example shows how to use nmrglue to coadd a number of collections of 2D NMRPipe files which constitute a pseudo-3D data set. The two (or more) psuedo-3D data sets are assumed to be in directories named run*.dir with subdirectories named *.fid containing a test.fid file. The directory coadded_data.dir is created with the same subdirectory structure containing test.fid files containing data created by coadding each pseudo-3D.

#! /usr/bin/env python

import nmrglue as ng
import numpy as np
import glob
import os.path

# create a list of directories to coadd
dlist = glob.glob("run*.dir")
dlist.sort()

# create a list of 2D files in the first directory
flist = glob.glob(os.path.join(dlist[0], "*.fid", "test.fid"))
flist.sort()

# loop over the files
for base_fname in flist:

# initilize the new data

# loop over the pseudo-3D directories
for d in dlist:

# the file names is found by replace the directory name
f = base_fname.replace(dlist[0], d, 1)