Пример #1
0
def HDec(Unit):
    CPD = "None"
    CPD = TopCmds.GETPAR2("CPDPRG 2")

    if CPD == "" or CPD == "None":
        PWname = "PCPD 2"
        PLname = "PL" + Unit + " 12"
        PW = "5.0"
        if Unit == "dB": PL = "1000."
        if Unit == "W": PL = "0.0"

    else:
        PLname, PWname = CPDtools.CPDparse(CPD, "1H")

        PLname = Format(PLname, Unit)
        PWname = Format(PWname, "")

        if PWname == "PCPD":
            PWname = "PCPD 2"

        PW = TopCmds.GETPAR(PWname)
        PL = TopCmds.GETPAR(PLname)
    #TopCmds.MSG(PWname+"  "+PLname+"  "+str(PW)+"  "+str(PL))

    return CPD, PWname, PW, PLname, PL
Пример #2
0
def HDec(units):

    Stuff = []
    p90H = float(TopCmds.GETPAR("P 3"))
    ampH = float(TopCmds.GETPAR("PLdB 2"))
    MaxB1H = 1000000. / 4. / p90H

    CPD = TopCmds.GETPAR2("CPDPRG 2")
    if CPD == "mlev" or CPD == "None":
        TopCmds.XCMD("cpdprg2")
        CPD = (TopCmds.GETPAR2("CPDPRG 2"))

    Stuff = CPDtools.CPDparse(CPD, "1H")
    #TopCmds.MSG(str(Stuff))
    amp0 = CPDtools.Find_old_pl(Stuff[0])
    decpw0 = CPDtools.Find_old_pw(Stuff[1], "1H")

    B1_0 = MaxB1H * (math.pow(10, (ampH - amp0) / 20.)) / 1000.
    if B1_0 > 1.: B1out = '% .1f' % B1_0
    if B1_0 <= 1.: B1out = '75.0'

    index = TopCmds.INPUT_DIALOG("Mr Setup Input", "Decoupling Window", \
    ["Desired 1H Decoupling Amplitude","File"],\
    [B1out,CPD],["kHz",""],["1","1",],\
    ["Accept","Close"], ['a','c'], 10)

    TopCmds.PUTPAR("CPDPRG 2", index[1])

    #print(index[0], MaxB1H)
    adjust = 20 * (math.log10(1000. * float(index[0]) / MaxB1H))
    Hamp = ampH - adjust
    decpwH = (MaxB1H / 1000. / float(index[0])) * (170. / 180.) * 2 * p90H

    if units == "W":
        Hamp = dBtoW(Hamp)

    value = TopCmds.SELECT("Adjusting the H decoupling parameters:",\
    "This will set\n 1H power ("+ Stuff[0] +") to:  "+ str('%.2f' %Hamp)+" "+ units+"\n \
  Pulse width ("                  + Stuff[1] +") to:  " +str('%3.2f' %decpwH) + units,["Update", "Keep Previous"])

    if value != 1:

        if Stuff[0] == 'pl12':
            TopCmds.PUTPAR("PL" + units + " 12", str('%3.2f' % Hamp))
        elif Stuff[0] == 'pl13':
            TopCmds.PUTPAR("PL" + units + " 13", str('%3.2f' % Hamp))
        elif Stuff[0] == 'pl14':
            TopCmds.PUTPAR("PL" + units + " 14", str('%3.2f' % Hamp))

        if Stuff[1] == 'pcpd':
            TopCmds.PUTPAR("PCPD 2", str('%3.2f' % decpwH))
        elif Stuff[1] == 'p31':
            TopCmds.PUTPAR("P 31", str('%3.2f' % decpwH))
            TopCmds.PUTPAR("P 30", str('%3.2f' % decpwH))
        elif Stuff[1] == 'p62':
            TopCmds.PUTPAR("P 61", str('%3.2f' % decpwH))
            TopCmds.PUTPAR("P 62", str('%3.2f' % decpwH))
Пример #3
0
def HDec(Unit):
    CPD = "None"
    CPD = pul.GetPar('prgHDec', "")

    if CPD == "" or CPD == "None":
        PWname = "PCPD 2"
        PLname = "PL" + Unit + " 12"
        PW = "5.0"
        if Unit == "dB": PL = "1000."
        if Unit == "W": PL = "0.0"

    else:
        PLname, PWname = CPDtools.CPDparse(CPD, "1H")

        PLname = Format(PLname, Unit)
        PWname = Format(PWname, "")

        if PWname == "PCPD":
            PWname = "PCPD 2"

        PW = pul.GetPar('pcpdH', "")
        PL = pul.GetPar('aHdec', Unit)

    return CPD, PWname, PW, PLname, PL
Пример #4
0
def DDec(units):

    Stuff = []
    p90 = float(TopCmds.GETPAR("P 32"))
    amp = float(TopCmds.GETPAR("PLdB 31"))
    MaxB1 = 1000000. / 4. / p90

    CPD = TopCmds.GETPAR2("CPDPRG 5")
    if CPD == "mlev" or CPD == "None":
        TopCmds.XCMD("cpdprg5")
        CPD = (TopCmds.GETPAR2("CPDPRG 5"))

    Stuff = CPDtools.CPDparse(CPD, "2D")
    TopCmds.MSG(str(Stuff))
    amp0 = CPDtools.Find_old_pl(Stuff[0])
    decpw0 = CPDtools.Find_old_pw(Stuff[1], "2D")

    B1_0 = MaxB1 * (math.pow(10, (amp - amp0) / 20.)) / 1000.
    if B1_0 > 1.: B1out = '% .1f' % B1_0
    if B1_0 <= 1.: B1out = '5.0'

    index = TopCmds.INPUT_DIALOG("Mr Setup Input", "Decoupling Window", \
    ["Desired 2H Decoupling Amplitude","File"],\
    [B1out,CPD],["kHz",""],["1","1",],\
    ["Accept","Close"], ['a','c'], 10)

    TopCmds.PUTPAR("CPDPRG 5", index[1])
    adjust = 20 * (math.log10(1000. * float(index[0]) / MaxB1))
    ampli = amp - adjust
    decpw = (MaxB1 / 1000. / float(index[0])) * 2 * p90

    if units == "W":
        ampli = dBtoW(ampli)

    value = TopCmds.SELECT("Adjusting the D decoupling parameters:",\
    "This will set\n 2H power ("+ Stuff[0] +") to:  "+ str('%3.2f' %ampli)+" "+ units+"\n \
  Pulse width ("                  + Stuff[1] +"= 180deg) to:  " +str('%3.2f' %decpw) + " us",["Update", "Keep Previous"])

    if value != 1:

        if Stuff[0] == '':
            TopCmds.PUTPAR("PL" + units + " 25", str('%3.2f' % ampli))
        elif Stuff[0] == 'pl25':
            TopCmds.PUTPAR("PL" + units + " 25", str('%3.2f' % ampli))
        elif Stuff[0] == 'pl12':
            TopCmds.MSG(
                "You are using pl12 for 2H decouling.  It is usually reserved for 1H \n Please verify"
            )
            #TopCmds.PUTPAR("PLdB 12",str('%3.2f' %ampli))
        elif Stuff[0] == 'pl13':
            TopCmds.MSG(
                "You are using pl13 for 2H decouling.  It is usually reserved for 1H \n Please verify"
            )
            #TopCmds.PUTPAR("PLdB 13",str('%3.2f' %ampli))
        elif Stuff[0] == 'pl14':
            TopCmds.MSG(
                "You are using pl14 for 2H decouling.  It is usually reserved for 1H \n Please verify"
            )
            #TopCmds.PUTPAR("PLdB 14",str('%3.2f' %ampli))

        if Stuff[1] == 'pcpd':
            TopCmds.PUTPAR("PCPD 5", str('%3.2f' % decpw))
        elif Stuff[1] == 'p31':
            TopCmds.PUTPAR("P 31", str('%3.2f' % decpw))
            TopCmds.PUTPAR("P 30", str('%3.2f' % decpw))
        elif Stuff[1] == 'p62':
            TopCmds.PUTPAR("P 61", str('%3.2f' % decpw))
            TopCmds.PUTPAR("P 62", str('%3.2f' % decpw))
Пример #5
0
aHmissi="PL 9"
aHhc  ="PL 10";  aHhn  ="PL 11"
aChc  ="PL 20";  aNhn  ="PL 19"
aHdec ="PL 12";  aHdec2="PL 13";  aHdec3="PL 14"
aCc5  ="PL 15"
aCc7  ="PL 17"
aCc7  ="PL 17"
aNhn  ="PL 19";  aChc  ="PL 20"

aCAe  ="PL 26";  aCOe  ="PL 27"
aCAr  ="PL 28";  aCOr  ="PL 29"

#Decoupling
prgHDec=TopCmds.GETPAR2("CPDPRG 2")
if prgHDec != "None" and prgHDec != "" :
  aHdec, pHdec = CPDtools.CPDparse(prgHDec,"1H")

prgNDec=TopCmds.GETPAR2("CPDPRG 3")
if prgNDec != "None" and prgNDec != "" :
  aNdec, pNdec = CPDtools.CPDparse(prgHDec,"15N")

#Loops
lRFDR ="L 3"
lREDOR="L 4"
lC5   ="L 5"
lC7   ="L 7"
lTOBSY="L 9"

#Delays
dT1   ="D 1"
dHC   ="D 4";  dHC2  ="D 5"
Пример #6
0
def DDec(units):

    Stuff = []
    p90 = pul.GetPar('pD90', "")
    amp = pul.GetPar('aD', units)
    CPD = pul.GetPar('prgDDec', "")
    MaxB1 = 1000000. / 4. / p90

    if units == "W":
        amp = WtodB(amp)

    if CPD == "mlev" or CPD == "None":
        TopCmds.XCMD(pul.xcmd_name(pul.pulDict['prgDDec']))
        CPD = pul.GetPar('prgDDec', "")

    Stuff = CPDtools.CPDparse(CPD, "2H")
    amp0 = CPDtools.Find_old_pl(Stuff[0])
    decpw0 = CPDtools.Find_old_pw(Stuff[1], "2H")

    B1_0 = MaxB1 * (math.pow(10, (amp - amp0) / 20.)) / 1000.
    if B1_0 > 1.: B1out = '% .1f' % B1_0
    if B1_0 <= 1.: B1out = '15.0'

    index = TopCmds.INPUT_DIALOG("Mr Setup Input", "Decoupling Window", \
    ["Desired 2H Decoupling Amplitude","File"],\
    [B1out,CPD],["kHz",""],["1","1",],\
    ["Accept","Close"], ['a','c'], 10)

    pul.SetPar('aDdec', index[1], "")
    adjust = 20 * (math.log10(1000. * float(index[0]) / MaxB1))
    ampli = amp - adjust
    decpw = (MaxB1 / 1000. / float(index[0])) * 2 * p90

    if units == "W":
        ampli = dBtoW(ampli)

    value = TopCmds.SELECT("Adjusting the 2H decoupling parameters:",\
    "This will set\n 2H power ("+ Stuff[0] +") to:  "+ str('%3.2f' %ampli)+" "+ units+"\n \
  Pulse width ("                  + Stuff[1] +"= 180deg) to:  " +str('%3.2f' %decpw) + " us",["Update", "Keep Previous"])

    if value != 1:
        pl = ""
        if Stuff[0] != "": pl = pul.pp_2_xcmd(Stuff[0], "")

        if pl == "":
            pul.SetPar('aDdec', ampli, units)
        elif pl == pul.pulDict['aDdec']:
            pul.SetPar('aDdec', ampli, units)
        elif pl == pul.pulDict['aHdec']:
            DecError('aHdec', "13C")
        elif pl == pul.pulDict['aHdec2']:
            DecError('aHdec2', "13C")
        elif pl == pul.pulDict['aHdec3']:
            DecError('aHdec3', "13C")

        if Stuff[1] == 'pcpd':
            pul.SetPar("PCPD 3", decpw, "")
        elif Stuff[1] == 'p31':
            pul.SetPar("P31", decpw, "")
            pul.SetPar("P30", decpw, "")
        elif Stuff[1] == 'p62':
            pul.SetPar("P61", decpw, "")
            pul.SetPar("P62", decpw, "")
Пример #7
0
def HDec(units):

    Stuff = []
    p90 = pul.GetPar('pH90', "")
    amp = pul.GetPar('aH', units)
    CPD = pul.GetPar('prgHDec', "")
    MaxB1 = 1000000. / 4. / p90

    if CPD == "mlev" or CPD == "None":
        pul.SetPar('prgHDec', "tppm15", "")
        TopCmds.XCMD(pul.xcmd_name(pul.pulDict['prgHDec']))
        CPD = pul.GetPar('prgHDec', "")

    TopCmds.MSG(str(CPD) + " CPD")

    Stuff = CPDtools.CPDparse(CPD, "1H")
    TopCmds.MSG(str(Stuff) + " Stuff")
    amp0 = CPDtools.Find_old_pl(Stuff[0], units)
    TopCmds.MSG(str(amp0) + " amp0")

    if units == "W":
        amp = WtodB(amp)
        amp0 = WtodB(amp0)

    decpw0 = CPDtools.Find_old_pw(Stuff[1], "1H")

    B1_0 = MaxB1 * (math.pow(10, (amp - amp0) / 20.)) / 1000.
    if B1_0 > 1.: B1out = '% .1f' % B1_0
    if B1_0 > MaxB1 / 1000.: B1out = '75.0'
    if B1_0 <= 1.: B1out = '75.0'

    index = TopCmds.INPUT_DIALOG("Mr Setup Input", "Decoupling Window", \
    ["Desired 1H Decoupling Amplitude","File"],\
    [B1out,CPD],["kHz",""],["1","1",],\
    ["Accept","Close"], ['a','c'], 10)

    pul.SetPar('prgHDec', index[1], "")

    adjust = 20 * (math.log10(1000. * float(index[0]) / MaxB1))
    Hamp = amp - adjust
    decpwH = (MaxB1 / 1000. / float(index[0])) * (170. / 180.) * 2 * p90

    if units == "W":
        Hamp = dBtoW(Hamp)

    value = TopCmds.SELECT("Adjusting the H decoupling parameters:",\
    "This will set\n 1H power ("+ Stuff[0] +") to:  "+ str('%.2f' %Hamp)+" "+ units+"\n \
  Pulse width ("                  + Stuff[1] +") to:  " +str('%3.2f' %decpwH)+" us",["Update", "Keep Previous"])

    if value != 1:
        pl = ""
        if Stuff[0] != "": pl = pul.pp_2_xcmd(Stuff[0], "")

        if pl == pul.pulDict['aHdec']:
            pul.SetPar('aHdec', Hamp, units)
        elif pl == pul.pulDict['aHdec2']:
            pul.SetPar('aHdec2', Hamp, units)
        elif pl == pul.pulDict['aHdec3']:
            pul.SetPar('aHdec3', Hamp, units)

        if Stuff[1] == 'pcpd':
            pul.SetPar("PCPD 2", decpwH, "")
        elif Stuff[1] == 'p31':
            pul.SetPar("P31", decpwH, "")
            pul.SetPar("P30", decpwH, "")
        elif Stuff[1] == 'p62':
            pul.SetPar("P61", decpwH, "")
            pul.SetPar("P62", decpwH, "")
Пример #8
0
def CalDec(p90, amp, cpd, nuc, units, dfltWave, dfltB0, dfltPH, aOption,
           aFaults):
    """
  p90     : Dict key for Hard Pulse of Decoupled Nucleus
  amp     : Dict key for Hard Pulse Amplitude
  cpd     : Dict key for CPD file
  nuc     : Decoupled Nucleus
  units   : Watts (W) or Decibels (dB)
  dfltWave: Default CPD
  dfltB0  : Default field
  dfltPH  : Default tip angle used in CPD
  aOption : List of accepted amplitude dict keys
  aFaults : List of amplitude dict keys that will cause a PLEASE CONFIRM Message
  """
    Stuff = []

    P90 = pul.GetPar(p90, "")
    Amp = pul.GetPar(amp, units)
    CPD = pul.GetPar(cpd, "")

    MaxB1 = 1000000. / 4. / P90

    if CPD == "mlev" or CPD == "None" or CPD == None or CPD == "":
        pul.SetPar(cpd, dfltWave, "")
        TopCmds.XCMD(pul.xcmd_name(pul.pulDict[cpd]))
        CPD = pul.GetPar(cpd, "")

    Stuff = CPDtools.CPDparse(CPD, nuc)
    Amp0 = CPDtools.Find_old_pl(Stuff[0], units)

    if units == "W":
        Amp = WtodB(Amp)
        Amp0 = WtodB(Amp0)

    decpw0 = CPDtools.Find_old_pw(Stuff[1], nuc)

    B1_0 = MaxB1 * (math.pow(10, (Amp - Amp0) / 20.)) / 1000.
    if B1_0 > 1.: B1out = '% .3f' % B1_0
    if B1_0 > MaxB1 / 1000.: B1out = '% .3f' % dfltB0
    if B1_0 <= 1.: B1out = '% .3f' % dfltB0

    index = TopCmds.INPUT_DIALOG("Mr Setup Input", "Decoupling Window", \
    ["Desired "+nuc+" Decoupling Amplitude","File"],\
    [B1out,CPD],["kHz",""],["1","1"],\
    ["Accept","Close"], [spc,ret], 10)

    if index == None:
        TopCmds.EXIT()

    pul.SetPar(cpd, index[1], "")
    pl = pul.pp_2_xcmd(Stuff[0], "")

    matched = 0

    for a in aOption:
        if pl == pul.pulDict[a]:
            matched = 1
            Hamp = DecSafely(
                float(index[0]) * 1000, a, MaxB1, 2 * 1000. * dfltB0, Amp,
                units)

    if matched == 0:
        Hamp = DecSafely(
            float(index[0]) * 1000, aOption[0], MaxB1, 2 * 1000. * dfltB0, Amp,
            units)

    decpw = (MaxB1 / 1000. / float(index[0])) * (dfltPH / 180.) * 2 * P90

    if units == "W":
        Hamp = dBtoW(Hamp)

    value = TopCmds.SELECT("Adjusting the "+nuc+" decoupling parameters:",\
    "This will set\n "+nuc+" power ("+ Stuff[0] +") to:  "+ str('%.2f' %Hamp)+" "+ units+"\n \
  Pulse width ("                  + Stuff[1] +") to:  " +str('%3.2f' %decpw)+" us",["Update", "Keep Previous"])

    if value != 1:
        if Stuff[0] == "":
            pul.SetPar(aOption[0], Hamp, units)

        for i in aFaults:
            if pl == pul.pulDict[i]:
                DecError(f, nuc)

        for a in aOption:
            if pl == pul.pulDict[a]:
                pul.SetPar(a, Hamp, units)

    return Stuff[1], decpw