Пример #1
0
"""
import os
import nmrglue as ng
import numpy as np
from sys import argv
from base import dialog

name, curdir, curexpno, curprocno = argv

# Get output directory from user
oexpno = curexpno + "00"
oexpno, overwrite = dialog(
    header="Cleanup SER File",
    info="Removes planes from a 3D that are not completely acquired",
    labels=["Output EXPNO", "Ovewrite"],
    types=["e", "c"],
    values=[oexpno, ""],
    comments=["", ""],
)
indir = os.path.join(curdir, curexpno)
outdir = os.path.join(curdir, oexpno)

# Check if an output directory exists if overwriting is not allowed
if "selected" not in overwrite:
    if os.path.isdir(os.path.join(curdir, str(int(oexpno)))):
        raise ValueError("Expno {} exists!".format(str(int(oexpno) + i)))

# Read the data
dic, data = ng.bruker.read(indir)

# Number of dimensions
Пример #2
0
import numpy as np
from base import dialog

# default imports from xcpy
name, curdir, curexpno, curprocno = argv
oexpno = curexpno + "00"

# get parameters from the user
iexpno, oexpno, split, arrangement, f1coeff, overwrite = dialog(
    header="Split Interleaved",
    info="Split an interleaved dataset",
    labels=[
        "Dataset to split and combine (EXPNO)",
        "EXPNO of combined dataset",
        "Number of experiments to split into",
        "How are multiple datasets arraged",
        "F1-COEFF (comma/whitespace separetd)",
        "Overwrite",
    ],
    types=["e", "e", "e", "d", "e", "c"],
    values=[curexpno, oexpno, "2", ["Interleaved", "Sequential"], "1 1", ""],
    comments=[],
)

# split and f1coeffs
split = int(split)
f1coeffs = [int(i) for i in f1coeff.replace(",", " ").split()]

# Check if an output directory exists if overwriting is not allowed
if "selected" not in overwrite:
    overwrite = False
Пример #3
0
from base import dialog

name, curdir, curexpno, curprocno = argv

Flist = ["None"] + [f"F{i}" for i in range(1, 7)]

# Get output directory from user
oexpno = curexpno + "00"
iexpno, oexpno, nuc1, corr_nuc1, nuc2, corr_nuc2, overwrite = dialog(
    header="Rectify F1/2 dimension parameters",
    info="Correct the parameters for the F1 or F2 dimension",
    labels=[
        "EXPNO of the dataset to correct",
        "EXPNO of the output dataset",
        "Nucleus to correct (Dimension from ACQUPARS tab) I",
        "Correct nucleus (Channel number from 'EDASP') I",
        "Nucleus to correct (Dimension from ACQUPARS tab) II",
        "Correct nucleus (Channel number from 'EDASP') II",
        "Overwrite",
    ],
    types=["e", "e", "d", "d", "d", "d", "c"],
    values=[curexpno, oexpno, Flist, Flist, Flist, Flist, ""],
    comments=["", "", "", "", "", "", ""],
)

corr_nuc_list = []
afiles = []
pfiles = []

# Sanitize
if nuc1 != "None":
    nuc1 = int(nuc1[1])
Пример #4
0
import numpy as np
from base import dialog
import matplotlib.pyplot as plt

# default imports from xcpy
name, curdir, curexpno, curprocno = argv
oexpno = curexpno + "00"

# get parameters from the user
iexpno, oexpno, zf, jcoupling, overwrite = dialog(
    header="Split Interleaved",
    info="Split an interleaved dataset",
    labels=[
        "Dataset to apply the S3E filter to",
        "EXPNO of OUTPUT dataset",
        "Zero filling for calculation",
        "J-Coupling",
        "Overwrite",
    ],
    types=["e", "e", "e", "e", "c"],
    values=[curexpno, oexpno, "32768", "52", ""],
    comments=[],
)

dic, data = ng.bruker.read(os.path.join(curdir, iexpno),
                           read_pulseprogram=False,
                           read_procs=True)

td = data.shape[-1]

data = data.reshape(-1, td)
data = [data[0::2], data[1::2]]
Пример #5
0
import nmrglue as ng
import numpy as np
from sys import argv
from base import dialog

name, curdir, curexpno, curprocno = argv

# Get output directory from user
oexpno = curexpno + "00"
iexpno, oexpno, split, overwrite = dialog(
    header="Split Sequential",
    info="Split a sequentially acquired dataset",
    labels=[
        "Dataset to split (EXPNO)",
        "EXPNO of 1st split dataset",
        "Number of experiments to split into",
        "Overwrite",
    ],
    types=["e", "e", "e", "c"],
    values=[curexpno, oexpno, 2, ""],
    comments=["", "", "", ""],
)

# Decipher variables
indir = os.path.join(curdir, iexpno)
split = int(split)

# Check if an output directory exists if overwriting is not allowed
if "selected" not in overwrite:
    overwrite = False
    for i in range(split):
Пример #6
0
    return rmat


# default imports from xcpy
name, curdir, curexpno, curprocno = argv
oexpno = curexpno + "00"

# get parameters from the user
iexpno, oexpno, rmat, overwrite = dialog(
    header="Split Multicomb",
    info="Split and combine an interleaved dataset in multiple ways",
    labels=[
        "Dataset to split and combine (EXPNO)",
        "1st EXPNO of combined dataset",
        "Recombination Matrix",
        "Overwrite",
    ],
    types=["e", "e", "d", "c"],
    values=[curexpno, oexpno, ["Manual", "Pulseprogam Info", "Hadamard"], ""],
    comments=[],
)


# Generate a Recombination Matrix

# Manual Entry for the Matrix
if rmat == "Manual":
    rmat = text_entry()
    rmat = parse_matrix(rmat)
    rdim = rmat.shape[-1]
Пример #7
0
import nmrglue as ng
import numpy as np
from base import dialog

# default imports from xcpy
name, curdir, curexpno, curprocno = argv

# get the parameters from the user
oexpno = curexpno + "00"
iexpno, oexpno, numexpt, f1coeff, overwrite = dialog(
    header="Combine Experiments",
    info="Combine Mutiple experiments with f1coeffs",
    labels=[
        "EXPNOs or Initial EXPNO to combine",
        "EXPNO for combined dataset",
        "Number of EXPNOs to combine",
        "F1-COEFF (comma/whitespace separetd)",
        "Overwrite",
    ],
    types=["e", "e", "e", "e", "c"],
    values=[curexpno, oexpno, "2", "1 1", ""],
    comments=["", "", "(Optional)", "", ""],
)

# check if a single experiment number is given
iexpno = iexpno.replace(",", " ").split()
iexpno = [int(i) for i in iexpno]

# Check if an output directory exists if overwriting is not allowed
if "selected" not in overwrite:
    overwrite = False
    if os.path.isdir(os.path.join(curdir, oexpno)):