Exemple #1
0
def fromPipe(file):
    dic, data = pipe.read(file)
    if dic['FDTRANSPOSED'] == 1.:
        dic, data = pp.tp(dic, data, auto=True)

    u = pipe.guess_udic(dic, data)
    u["original_format"] = 'Pipe'
    u["Name"] = get_name(file)
    
    uc = [make_uc_pipe(dic, data, dim) for dim in range(0, data.ndim)]
    return NMRSpectrum(data, u, uc=uc)
Exemple #2
0
def fromPipe(file):
    dic, data = pipe.read(file)
    if dic['FDTRANSPOSED'] == 1.:
        dic, data = pp.tp(dic, data, auto=True)

    u = pipe.guess_udic(dic, data)
    u["original_format"] = 'Pipe'
    u["Name"] = get_name(file)

    uc = [make_uc_pipe(dic, data, dim) for dim in range(0, data.ndim)]
    return NMRSpectrum(data, u, uc=uc)
Exemple #3
0
#! /usr/bin/env python
""" Create files for cbf unit test """

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d, a = pipe.read("time_complex.fid")
d, a = p.cs(d, a, dir="rs", pts=5.0, neg=True, sw=True)
pipe.write("cs1.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.cs(d, a, dir="rs", pts=-2.0, sw=True)
pipe.write("cs2.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.cs(d, a, dir="ls", pts=3.0, neg=True, sw=True)
pipe.write("cs3.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.cs(d, a, dir="ls", pts=-8.0, neg=True, sw=True)
pipe.write("cs4.glue", d, a, overwrite=True)

# freq domain
d, a = pipe.read("freq_real.ft2")
d, a = p.cs(d, a, dir="ls", pts=7.0, neg=True, sw=True)
pipe.write("cs5.glue", d, a, overwrite=True)

d, a = pipe.read("freq_real.ft2")
d, a = p.cs(d, a, dir="ls", pts=-3.0, sw=True)
pipe.write("cs6.glue", d, a, overwrite=True)
Exemple #4
0
#! /usr/bin/env python
""" Tests which show a differences between NMRPipe's and nmrglue's processing
functions and a fix is desired.  """

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

# FSH
# the first three tests will fail because MIN/MAX values are off a little
d, a = pipe.read("1D_freq_real.dat")
d, a = p.fsh(d, a, dir="ls", pts=1)
pipe.write("fsh1.glue", d, a, overwrite=True)

d, a = pipe.read("1D_freq_real.dat")
d, a = p.fsh(d, a, dir="rs", pts=8)
pipe.write("fsh2.glue", d, a, overwrite=True)

d, a = pipe.read("1D_freq_real.dat")
d, a = p.fsh(d, a, dir="rs", pts=6.7)
pipe.write("fsh3.glue", d, a, overwrite=True)

# this fails because NMRPipe performs a Hilbert transform? If this is true it
# should be moved to the known_fail.py script.
d, a = pipe.read("1D_freq_complex.dat")
d, a = p.fsh(d, a, dir="ls", pts=9.5)
pipe.write("fsh4.glue", d, a, overwrite=True)

# RFT
# these are off by small amounts, mostly min/max values
d, a = pipe.read("1D_freq_complex.dat")
d, a = p.rft(d, a)
Exemple #5
0
#! /usr/bin/env python

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p
import shutil

d, a = pipe.read("1D_time_real.fid")
d, a = p.rft(d, a)
pipe.write("rft1.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time.fid")
d, a = p.rft(d, a)
pipe.write("rft2.glue", d, a, overwrite=True)

d, a = pipe.read("time_real.fid")
d, a = p.rft(d, a)
pipe.write("rft3.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.rft(d, a)
pipe.write("rft4.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time_real.fid")
d, a = p.rft(d, a, inv=True)
pipe.write("rft5.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time.fid")
d, a = p.rft(d, a, inv=True)
pipe.write("rft6.glue", d, a, overwrite=True)

d, a = pipe.read("time_real.fid")
Exemple #6
0
    d = suite[key]
    # run the nmrPipe program
    os.system(d["sh"])
    # run the python program
    os.system(d["py"])
    print key,"...",
    
    if verb1:
        print ""

    # check each file for match
    for f1,f2 in zip(d["f"][::2],d["f"][1::2]):
        
        if verb1:
            print "checking",f1,f2
        dic1,data1 = pipe.read(f1)
        dic2,data2 = pipe.read(f2)
        r1,r2 = util.pair_similar(dic1,data1,dic2,data2,verb2)
        if verb1:
            if r1:
                print "Data: Pass",
            else:
                print "Data: Fail",

            if r2:
                print "Dictionary: Pass"
            else: 
                print "Dictionary: Fail"

        k_test = k_test and r1 and r2
        # remove the files
Exemple #7
0
    d = suite[key]
    # run the nmrPipe program
    os.system(d["sh"])
    # run the python program
    os.system(d["py"])
    print key, "...",

    if verb1:
        print ""

    # check each file for match
    for f1, f2 in zip(d["f"][::2], d["f"][1::2]):

        if verb1:
            print "checking", f1, f2
        dic1, data1 = pipe.read(f1)
        dic2, data2 = pipe.read(f2)
        r1, r2 = util.pair_similar(dic1, data1, dic2, data2, verb2)
        if verb1:
            if r1:
                print "Data: Pass",
            else:
                print "Data: Fail",

            if r2:
                print "Dictionary: Pass"
            else:
                print "Dictionary: Fail"

        k_test = k_test and r1 and r2
        # remove the files
Exemple #8
0
#! /usr/bin/env python
""" Create files for tp unit test """

from subprocess import check_call
import os

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d, a = pipe.read("time_complex.fid")
d, a = p.tp(d, a, auto=True)
pipe.write("tp1.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.tp(d, a, hyper=True)
pipe.write("tp2.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.tp(d, a, nohyper=True)
pipe.write("tp3.glue", d, a, overwrite=True)


pipe_command = """\
/bin/csh -c 'nmrPipe -in ./time_complex.fid                \
| nmrPipe  -fn FT  -auto \
-ov -out time-freq.c.ft1'"""
check_call(pipe_command, shell=True)

d, a = pipe.read("time-freq.c.ft1")
d, a = p.tp(d, a, hyper=True)
pipe.write("tp4.glue", d, a, overwrite=True)
Exemple #9
0
#! /usr/bin/env python
""" Tests which show a differences between NMRPipe's and nmrglue's processing
functions and a fix is desired.  """

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

# FSH
# the first three tests will fail because MIN/MAX values are off a little
d, a = pipe.read("1D_freq_real.dat")
d, a = p.fsh(d, a, dir="ls", pts=1)
pipe.write("fsh1.glue", d, a, overwrite=True)

d, a = pipe.read("1D_freq_real.dat")
d, a = p.fsh(d, a, dir="rs", pts=8)
pipe.write("fsh2.glue", d, a, overwrite=True)

d, a = pipe.read("1D_freq_real.dat")
d, a = p.fsh(d, a, dir="rs", pts=6.7)
pipe.write("fsh3.glue", d, a, overwrite=True)

# this fails because NMRPipe performs a Hilbert transform? If this is true it
# should be moved to the known_fail.py script.
d, a = pipe.read("1D_freq_complex.dat")
d, a = p.fsh(d, a, dir="ls", pts=9.5)
pipe.write("fsh4.glue", d, a, overwrite=True)

# RFT 
# these are off by small amounts, mostly min/max values
d, a = pipe.read("1D_freq_complex.dat")
d, a = p.rft(d, a)
Exemple #10
0
#! /usr/bin/env python

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d,a = pipe.read("1D_time.fid")
d,a = p.ha(d,a)
pipe.write("ha1.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time.fid")
d,a = p.ha(d,a,inv=True)
pipe.write("ha2.glue",d,a,overwrite=True)
Exemple #11
0
#! /usr/bin/env python

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p
import shutil

d,a = pipe.read("1D_time_real.fid")
d,a = p.rft(d,a)
pipe.write("rft1.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time.fid")
d,a = p.rft(d,a)
pipe.write("rft2.glue",d,a,overwrite=True)

d,a = pipe.read("time_real.fid")
d,a = p.rft(d,a)
pipe.write("rft3.glue",d,a,overwrite=True)

d,a = pipe.read("time_complex.fid")
d,a = p.rft(d,a)
pipe.write("rft4.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time_real.fid")
d,a = p.rft(d,a,inv=True)
pipe.write("rft5.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time.fid")
d,a = p.rft(d,a,inv=True)
pipe.write("rft6.glue",d,a,overwrite=True)

d,a = pipe.read("time_real.fid")
Exemple #12
0
 def setUp(self):
     dic, data = pipe.read("./test_files/bmse000281_hsqc.fid")        
     self.dic = dic
     self.data = data
     self.filename = "./test_files/bmse000281_hsqc.fid"
Exemple #13
0
#! /usr/bin/env python

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d,a = pipe.read("1D_time_real.fid")
d,a = p.ht(d,a)
pipe.write("ht1.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time_real.fid")
d,a = p.ht(d,a,td=True)
pipe.write("ht2.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time_real.fid")
d,a = p.ht(d,a,mode="ps0-0")
pipe.write("ht3.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time_real.fid")
d,a = p.ht(d,a,zf=True)
pipe.write("ht5.glue",d,a,overwrite=True)

d,a = pipe.read("1D_time_real.fid")
d,a = p.ht(d,a,auto=True)
pipe.write("ht6.glue",d,a,overwrite=True)

d,a = pipe.read("freq_real.ft2")
d,a = p.ht(d,a)
pipe.write("ht7.glue",d,a,overwrite=True)

d,a = pipe.read("freq_real.ft2")
d,a = p.ht(d,a,zf=True,td=True)
Exemple #14
0
#! /usr/bin/env python
""" tests for MIR function """

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d, a = pipe.read("time_complex.fid")
d, a = p.mir(d, a, mode="left", sw=True)
pipe.write("mir1.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.mir(d, a, mode="right", sw=True)
pipe.write("mir2.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.mir(d, a, mode="right", invr=True, sw=True)
pipe.write("mir3.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.mir(d, a, mode="left", invr=True, sw=True)
pipe.write("mir4.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.mir(d, a, mode="center", sw=True)
pipe.write("mir5.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.mir(d, a, mode="ps90-180", sw=True)
pipe.write("mir6.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
Exemple #15
0
#! /usr/bin/env python
""" Create files for ht unit test """

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d, a = pipe.read("1D_time_real.fid")
d, a = p.ht(d, a)
pipe.write("ht1.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time_real.fid")
d, a = p.ht(d, a, td=True)
pipe.write("ht2.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time_real.fid")
d, a = p.ht(d, a, mode="ps0-0")
pipe.write("ht3.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time_real.fid")
d, a = p.ht(d, a, zf=True)
pipe.write("ht5.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time_real.fid")
d, a = p.ht(d, a, auto=True)
pipe.write("ht6.glue", d, a, overwrite=True)

d, a = pipe.read("freq_real.ft2")
d, a = p.ht(d, a)
pipe.write("ht7.glue", d, a, overwrite=True)

d, a = pipe.read("freq_real.ft2")
Exemple #16
0
#! /usr/bin/env python
""" Create files for ext unit test """

from subprocess import check_output

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d, a = pipe.read("time_complex.fid")
d, a = p.ext(d, a, left=True, sw=True)
pipe.write("ext1.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.ext(d, a, right=True)
pipe.write("ext2.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.ext(d, a, mid=True)
pipe.write("ext3.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.ext(d, a, x1=1, xn=100)
pipe.write("ext4.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.ext(d, a, xn=200, y1=50, yn=75)
pipe.write("ext5.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.ext(d, a, x1=5, xn=200, pow2=True)
pipe.write("ext6.glue", d, a, overwrite=True)
Exemple #17
0
#! /usr/bin/env python

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d, a = pipe.read("1D_time.fid")
d, a = p.ha(d, a)
pipe.write("ha1.glue", d, a, overwrite=True)

d, a = pipe.read("1D_time.fid")
d, a = p.ha(d, a, inv=True)
pipe.write("ha2.glue", d, a, overwrite=True)
Exemple #18
0
#! /usr/bin/env python
""" Create files for smo unit test """

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

d, a = pipe.read("time_complex.fid")
d, a = p.smo(d, a)
pipe.write("smo1.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.smo(d, a, n=5)
pipe.write("smo2.glue", d, a, overwrite=True)

d, a = pipe.read("time_complex.fid")
d, a = p.smo(d, a, center=True)
pipe.write("smo3.glue", d, a, overwrite=True)
#! /usr/bin/env python
""" Create files for mixed_processing unit test """

import nmrglue.fileio.pipe as pipe
import nmrglue.process.pipe_proc as p

# process 2D mixed mode data
d, a = pipe.read("time_real.fid")
d, a = p.gmb(d, a, gb=0.1, lb=-8, c=0.5)
d, a = p.zf(d, a, auto=True)
d, a = p.ft(d, a, alt=True) # BUG glue seems to double the data...?
#d, a = p.ps(d, a, p0=0, p1=0)
#d, a = p.tp(d, a, hyper=True)
#d, a = p.sp(d, a, off=0.5, pow=2, c=0.5)
#d, a = p.zf(d, a, auto=True)
#d, a = p.ft(d, a, auto=True)
#d, a = p.ps(d, a, p0=0, p1=0)
#d, a = p.di(d, a)
pipe.write("2d_mixed_processing1.glue", d, a, overwrite=True)

# process 2D mixed mode data
d, a = pipe.read("time_real.fid")
d, a = p.em(d, a, lb=8)
d, a = p.zf(d, a, auto=True)
d, a = p.ft(d, a, auto=True)
d, a = p.di(d, a)
d, a = p.tp(d, a)
d, a = p.sp(d, a, off=0.5, pow=1, c=0.5)
d, a = p.zf(d, a, auto=True)
d, a = p.ft(d, a, auto=True)
d, a = p.mc(d, a)