Exemple #1
0
def fromBruker(file, remove_filter=True, read_pdata=True):
    dic, data = bruker.read(file)
    if read_pdata:
        pdata_file = find_pdata(file, data.ndim)

        if (pdata_file is not None):
            procs, data = bruker.read_pdata(pdata_file)
        else:
            read_pdata = False

    if remove_filter and not read_pdata:
        if ng_version > 0.5:
            data = bruker.remove_digital_filter(dic, data, True)
        else:
            data = bruker.remove_digital_filter(dic, data)

    u = bruker.guess_udic(dic, data)
    u["original_format"] = 'Bruker'
    u["Name"] = get_name(file)
    if (read_pdata):
        for i in range(0, data.ndim):
            u[i]['complex'] = False
            u[i]['freq'] = True
            u[i]['time'] = False

    uc = [uc_from_udic(u, dim) for dim in range(0, data.ndim)]

    if read_pdata and 'procs' in procs.keys():
        proc_names = ['procs', 'proc2s']
        for i, uc_i in enumerate(uc[::-1]):
            if procs[proc_names[i]] and procs[proc_names[i]]['OFFSET']:
                uc_i._first = procs[proc_names[i]]['OFFSET']

    return NMRSpectrum(data, udic=u, uc=uc)
Exemple #2
0
def fromBruker(file, remove_filter=True, read_pdata=True):
    dic, data = bruker.read(file);
    if read_pdata:
        pdata_file = find_pdata(file, data.ndim)
        
        if(pdata_file is not None):
            procs, data = bruker.read_pdata(pdata_file)
        else: read_pdata = False
    
    if remove_filter and not read_pdata:
        if ng_version > 0.5:
            data = bruker.remove_digital_filter(dic, data, True)
        else:
            data = bruker.remove_digital_filter(dic, data)
    
    u = bruker.guess_udic(dic, data)    
    u["original_format"] = 'Bruker'
    u["Name"] = get_name(file)
    if(read_pdata):
        for i in range(0, data.ndim):
            u[i]['complex'] = False
            u[i]['freq'] = True
            u[i]['time'] = False
    
    uc  = [uc_from_udic(u, dim) for dim in range(0, data.ndim)]
    
    if read_pdata and 'procs' in procs.keys():
        proc_names = ['procs', 'proc2s']
        for i, uc_i in enumerate(uc[::-1]):
            if procs[proc_names[i] ] and procs[proc_names[i] ]['OFFSET']:
                uc_i._first = procs[proc_names[i] ]['OFFSET']
    
    return NMRSpectrum(data, udic=u, uc=uc)
Exemple #3
0
 def setUp(self):
     dic, data = read("./test_files/Bruker_1D/", read_pulseprogram=False)
     self.dic = dic
     self.data = data
     self.filename = "./test_files/Bruker_1D/"