コード例 #1
0
def plot_2D(d, scale, numb2, resdir):
    fiddir = op.dirname(numb2)
    basedir, fidname = op.split(fiddir)
    base, manip = op.split(basedir)
    exptype = bk.read_param(bk.find_acqu(fiddir))['$PULPROG']
    exptype = exptype[1:-1]  # removes the <...>

    d.display(scale=scale)
    plt.savefig(
        op.join(resdir, '2D', exptype + '_' + fidname +
                '.pdf'))  # Creates a PDF of the 2D spectrum without peaks
    d.display_peaks(color="g")
    plt.savefig(
        op.join(resdir, '2D', exptype + '_' + fidname +
                '_pp.pdf'))  # Creates a PDF of the 2D spectrum with peaks
    plt.close()
    return d
コード例 #2
0
def Dprocess_2D(numb2, resdir):
    "Performs DOSY processing of experiment 'numb2' and produces the spectrum with and without peaks"
    fiddir = op.dirname(numb2)
    basedir, fidname = op.split(fiddir)
    base, manip = op.split(basedir)
    exptype = bk.read_param(bk.find_acqu(fiddir))['$PULPROG']
    exptype = exptype[1:-1]  # removes the <...>

    ppm_offset, ph0, ph1 = get_config(base, manip, fidname)

    d = bk.Import_2D(numb2)
    d.unit = 'ppm'
    if 'ste' in exptype or 'led' in exptype:
        print("DOSY")
        d = process_DOSY(numb2, ppm_offset, lazy=DOSY_LAZY)
        scale = 50.0
    else:
        raise Exception("This is not a DOSY: " + numb2)

    dd = analyze_2D(d, name=op.join(resdir, '2D', exptype + '_' + fidname))
    d.save(op.join(fiddir, "processed.gs2"))
    return dd, scale
コード例 #3
0
def process_2D(xarg):
    "Performs all processing of experiment 'numb2' and produces the spectrum with and without peaks"
    numb2, resdir = xarg
    fiddir = op.dirname(numb2)
    basedir, fidname = op.split(fiddir)
    base, manip = op.split(basedir)
    exptype = bk.read_param(bk.find_acqu(fiddir))['$PULPROG']
    exptype = exptype[1:-1]  # removes the <...>

    ppm_offset, ph0, ph1 = get_config(base, manip, fidname)

    d = bk.Import_2D(numb2)
    d.unit = 'ppm'
    scale = 10.0
    sanerank = SANERANK

    #1. If TOCSY
    if 'dipsi' in exptype:
        print("TOCSY")
        #        print exptype
        if 'dipsi2ph' in exptype:
            d.apod_sin(maxi=0.5, axis=2).zf(zf2=2).ft_sim()
            if sanerank != 0:
                d.sane(rank=sanerank, axis=1)
            d.apod_sin(maxi=0.5,
                       axis=1).zf(zf1=4).ft_sh_tppi().modulus().rem_ridge()
        elif 'dipsi2etgpsi' in exptype:
            d.apod_sin(maxi=0.5, axis=2).zf(zf2=2).ft_sim()
            if sanerank != 0:
                d.sane(rank=sanerank, axis=1)
            d.apod_sin(maxi=0.5,
                       axis=1).zf(zf1=4).ft_n_p().modulus().rem_ridge()
        scale = 50.0
        d.axis2.offset += ppm_offset * d.axis2.frequency
        if TMS:
            d = autozero(d)

    #2. If COSY DQF
    elif 'cosy' in exptype:
        print("COSY DQF")
        d.apod_sin(maxi=0.5, axis=2).zf(zf2=2).ft_sim()
        if sanerank != 0:
            d.sane(rank=sanerank, axis=1)
        d.apod_sin(maxi=0.5,
                   axis=1).zf(zf1=4).ft_sh_tppi().modulus().rem_ridge()
        scale = 20.0
        d.axis2.offset += ppm_offset * d.axis2.frequency
        if TMS:
            d = autozero(d)
    #3. If HSQC
    elif 'hsqc' in exptype:
        print("HSQC")
        if 'ml' in exptype:
            print("TOCSY-HSQC")
        d.apod_sin(maxi=0.5, axis=2).zf(zf2=2).ft_sim().conv_n_p()
        if sanerank != 0:
            d.sane(rank=sanerank, axis=1)
        d.apod_sin(maxi=0.5, axis=1).zf(zf1=4).ft_sh().modulus().rem_ridge()
        scale = 10.0
        d.axis2.offset += ppm_offset * d.axis2.frequency
        if TMS:
            d = autozero(d, z1=(5, -5))

    #4. If HMBC
    elif 'hmbc' in exptype:
        print("HMBC")
        if 'hmbc' in exptype:
            print("HMBC")
        d.apod_sin(maxi=0.5, axis=2).zf(zf2=2).ft_sim()
        if 'et' in exptype:
            d.conv_n_p()
        if sanerank != 0:
            d.sane(rank=sanerank, axis=1)
        d.apod_sin(maxi=0.5, axis=1).zf(
            zf1=4).bk_ftF1().modulus().rem_ridge()  # For Pharma MB1-X-X series
        scale = 10.0
        d.axis2.offset += ppm_offset * d.axis2.frequency
        if TMS:
            d = autozero(d, z1=(5, -5))

    #5. If DOSY - Processed in process_DOSY
    elif 'ste' in exptype or 'led' in exptype:
        print("DOSY")
        d = process_DOSY(numb2, ppm_offset, lazy=DOSY_LAZY)
        scale = 50.0

    analyze_2D(d, name=op.join(resdir, '2D', exptype + '_' + fidname))
    d.save(op.join(fiddir, "processed.gs2"))
    return d, scale