def HC(Unit): CNCT = pul.GetPar('pHC', "") plC = pul.GetPar('aChc', Unit) plH = pul.GetPar('aHhc', Unit) SPC = pul.GetPar('sChc', "") SPH = pul.GetPar('sHhc', "") return CNCT, plH, plC, SPH, SPC
def CC(units): dfltSP = "square.100" Title="CC DREAM Input"; SuTit="Carbon Carbon Adiabatic Mixing" Label=["Carbon B1 Field","C Ramp","Contact Time",\ "H Decoupling"] In =Title,SuTit,Label Title="Adjusting the DREAM parameters:"; Label="1H","13C" Out =Title,Label Match, Delta, Devia = CMatch() #In Hz Ramp=pul.GetPar('sCdrm',"") GoRamp=TopCmds.SELECT("Ramp",\ "Would you like to use the ramp: "+Ramp+\ " \n Or make a new Tangent Ramp?",\ ["Use Current","Make New"]) if GoRamp: SP,Time=MakeRamp(Match,Delta,Devia,"13C") else: SP=Ramp; Time=pul.GetPar('pCdrm',"") CalDREAM('pC90',Match,'aCdrm','aHdrmDC','pCdrm',SP,'sCdrm',dfltSP,units,In,Out)
def HN(Unit): CNCT = pul.GetPar('pHN', "") plH = pul.GetPar('aHhn', Unit) plN = pul.GetPar('aNhn', Unit) SPN = pul.GetPar('sNhn', "") SPH = pul.GetPar('sHhn', "") return CNCT, plH, plN, SPH, SPN
def CA_S90(Unit): CNCT = pul.GetPar('pCAe', "") plX = pul.GetPar('aCAe', Unit) SPX = pul.GetPar('sCAe', "") OFF = pul.GetPar('oCAe', "") if SPX == "" or SPX == "None": SPX = "None" return CNCT, plX, SPX, OFF
def CO_S180(Unit): CNCT = pul.GetPar('pCOr', "") plX = pul.GetPar('aCOr', Unit) SPX = pul.GetPar('sCOr', "") OFF = pul.GetPar('oCOr', "") if SPX == "" or SPX == "None": SPX = "None" return CNCT, plX, SPX, OFF
def HN(MAS0, MAS, units): p90H = pul.GetPar('pH90', "") ampH = pul.GetPar('aH', units) SPH = pul.GetPar('sHhn', "") ampHCP = pul.GetPar('aHhn', units) avgH = 1.0 p90X = pul.GetPar('pN90', "") ampX = pul.GetPar('aN', units) SPX = pul.GetPar('sNhn', "") ampXCP = pul.GetPar('aNhn', units) avgX = 1.0 CNCT = pul.GetPar('pHN', "") params = TopCmds.INPUT_DIALOG("HN CP MAS adjustment", "Proton Nitrogen Cross Polarization", \ ["Old MAS rate","New MAS rate","Old 1H power ("+pul.pulDict['aHhc']+")",\ "Old 15N power ("+pul.pulDict['aNhn']+")","Contact Time ("+pul.pulDict['pHN']+")",\ "H-Ramp ("+pul.pulDict['sHhc']+")","N-Ramp ("+pul.pulDict['sChc']+")"],\ [str(MAS0),str(MAS),str(ampXCP),str(ampHCP),str(CNCT),SPH,SPX],\ ["Hz","Hz",units,units,"us","",""],\ ["1","1","1","1","1","1","1"],\ ["Accept","Close"], [spc,ret], 10) if params == None: TopCmds.EXIT() if units == "W": params[2] = str(Setup.WtodB(float(params[2]))) params[3] = str(Setup.WtodB(float(params[3]))) ampH = Setup.WtodB(ampH) ampX = Setup.WtodB(ampX) if SPH != "None" and SPH != None and SPH != "Unused": avgH = IntShape.Integrate(SPH) / 100. if SPX != "None" and SPX != None and SPX != "Unused": avgX = IntShape.Integrate(SPX) / 100. pulses = p90H, ampH, p90X, ampX, avgH, avgX SelectorText="Adjust the HN CP parameters:","Calculate New Match for:",\ ["Proton","Nitrogen","Maximum for Both"] ampHCP, ampXCP = FindMatch(params, pulses, SelectorText) if units == "W": ampXCP = Setup.dBtoW(ampXCP) ampHCP = Setup.dBtoW(ampHCP) value = TopCmds.SELECT("Adjusting the HN CP parameters:",\ "This will set\n 1H power to: " + str('%3.2f' %ampHCP)+ " "+units+"\n \ 15N power to: " +str('%3.2f' %ampXCP) + " "+units,["Update", "Keep Previous"]) if value != 1: pul.SetPar('aHhn', ampHCP, units) pul.SetPar('aNhn', ampXCP, units) pul.SetPar('pHN', CNCT, "") pul.SetPar('sHhn', SPH, "") pul.SetPar('sNhn', SPX, "")
def NH2(Unit): CNCT = pul.GetPar('pNH2', "") plH = pul.GetPar('aHnh2', Unit) plN = pul.GetPar('aNnh2', Unit) SPX = "None" SPX = pul.GetPar('sHnh2', "") if SPX == "" or SPX == "None": SPX = "None" SPY = "None" SPY = pul.GetPar('sNnh2', "") if SPY == "" or SPY == "None": SPY = "None" return CNCT, plH, plN, SPX, SPY
def CH2(Unit): CNCT = pul.GetPar('pCH2', "") plC = pul.GetPar('aCch2', Unit) plH = pul.GetPar('aHch2', Unit) SPX = "None" SPX = pul.GetPar('sHch2', "") if SPX == "" or SPX == "None": SPX = "None" SPY = "None" SPY = pul.GetPar('sCch2', "") if SPY == "" or SPY == "None": SPY = "None" return CNCT, plH, plC, SPX, SPY
def hhC(Unit): CNCT = pul.GetPar('phhC', "") plH = pul.GetPar('aHhhc', Unit) plC = pul.GetPar('aChhc', Unit) SPX = "None" SPX = pul.GetPar('sHhhC', "") if SPX == "" or SPX == "None": SPX = "None" SPY = "None" SPY = pul.GetPar('sChhC', "") if SPY == "" or SPY == "None": SPY = "None" return CNCT, plH, plC, SPX, SPY
def LoadFromData(units): p90H = pul.GetPar('pH90', "") p90C = pul.GetPar('pC90', "") p90N = pul.GetPar('pN90', "") ampH = pul.GetPar('aH', units) ampC = pul.GetPar('aC', units) ampN = pul.GetPar('aN', units) MAS = pul.GetPar('MAS', "") index = TopCmds.INPUT_DIALOG("Mr Setup Input", "Pulse Widths and Power", \ ["1H 90 pw","1H ampl","13C 90 pw","13C ampl","15N 90 pw","15N ampl","MAS"],\ [str('%.2f' %p90H),str('%.2f' %ampH),str('%.2f' %p90C),str('%.2f' %ampC),str('%.2f' %p90N),str('%.2f' %ampN),str('%.2f' %MAS)],\ ["us",units,"us",units,"us",units," Hz"],\ ["1","1","1","1","1","1","1"],\ ["Accept","Close"], ['a','c'], 10) p90H = float(index[0]) ampH = float(index[1]) p90C = float(index[2]) ampC = float(index[3]) p90N = float(index[4]) ampN = float(index[5]) MAS = float(index[6]) TauR = 1000000. / MAS PutPars(p90H, ampH, p90C, ampC, p90N, ampN, MAS, units)
def SPC5_2(units): p90 = pul.GetPar('pC90', "") amp = pul.GetPar('aC', units) MAS = pul.GetPar('MAS', "") if units == "W": amp = WtodB(amp) MaxB1 = 1000000. / 4. / p90 C5B1 = 5.0 * MAS adjust = 20 * (math.log10(C5B1 / MaxB1)) Condition = amp - adjust if units == "W": Condition = dBtoW(Condition) pul.SetPar('aCc5', Condition, units) pul.SetPar('lC5', "10", "")
def CPdec(amp, units, In, Out): """ amp : dict key for CP decoupling amp units : Watts (W) or decibel (dB) In : Title, Subtitle, and Label for Input Dialog Out : Title and Label for Selection/Confirmation Window """ P90 = pul.GetPar('pH90', "") Amp90 = pul.GetPar('aH', "dB") AmpD0 = pul.GetPar(amp, "dB") MaxB1D = 1000000. / 4. / P90 B1_0 = MaxB1D * (math.pow(10, (Amp90 - AmpD0) / 20.)) if B1_0 > 100.: Dcond = '% .1f' % B1_0 if B1_0 > MaxB1D: Dcond = '85000.0' if B1_0 <= 100.: Dcond = '85000.0' Val = [str('%3.3f' % (float(Dcond) / 1000.))] index=TopCmds.INPUT_DIALOG(In[0],In[1],In[2],\ Val,["kHz"],["1"],\ ["Accept","Close"], [spc,ret], 10) if index == None: TopCmds.EXIT() #Safety Damp = DecSafely(1000. * float(index[0]), amp, MaxB1D, 150000., Amp90, units) if units == "W": Damp = dBtoW(Damp) value = TopCmds.SELECT(Out[0],"This will set\n "+\ Out[1]+" power to: " + str('%3.2f' %Damp)+" "+ units,\ ["Update", "Keep Previous"],[spc,ret]) if value != 1: pul.SetPar(amp, Damp, units) return
def ReadHPFromData(units): p90H = pul.GetPar('pH90', "") p90C = pul.GetPar('pC90', "") p90N = pul.GetPar('pN90', "") ampH = pul.GetPar('aH', units) ampC = pul.GetPar('aC', units) ampN = pul.GetPar('aN', units) MAS = pul.GetPar('MAS', "") return p90H, p90C, p90N, ampH, ampC, ampN, MAS
def NCO(Unit): CNCT = pul.GetPar('pNCO', "") plH = pul.GetPar('aHnco', Unit) plC = pul.GetPar('aCnco', Unit) plN = pul.GetPar('aNnco', Unit) SPC = pul.GetPar('sCnco', "") SPN = pul.GetPar('sNnco', "") return CNCT, plH, plC, plN, SP
def SPC5(MASR, MAS, units): oldC5 = pul.GetPar('aCc5', units) LoopC5 = pul.GetPar('lC5', "") index = TopCmds.INPUT_DIALOG("SPC5 MAS", "SPC5 changes for MAS change", \ ["Old MAS rate","New MAS rate","Old 13C power ("+pul.pulDict['aCc5']+")",\ "Mixing Loop ("+pul.pulDict['lC5']+")"],\ [str(MASR),str(MAS),str(oldC5),str(LoopC5)],\ ["kHz","kHz",units,""],\ ["1","1","1","1"],\ ["Accept","Close"], [spc,ret], 10) if index == None: TopCmds.EXIT() OldMAS = float(index[0]) NewMAS = float(index[1]) oldC = float(index[2]) newL = float(index[3]) if units == "W": oldC = Setup.WtodB(oldC) adjust = 20 * (math.log10(NewMAS / OldMAS)) newC = oldC - adjust if units == "W": newC = Setup.dBtoW(newC) value = TopCmds.SELECT("Adjusting the SPC5 parameters:",\ "This will set\n 13C power "+pul.pulDict['aCc5']+" to: " +\ str('%3.2f' %newC)+ " "+units+"\n"+\ "Loop "+pul.pulDict['lC5']+" to: "+ str(newL)\ ,["Update", "Keep Previous"]) if value != 1: pul.SetPar('aCc5', newC, units) pul.SetPar('lC5', newL, "")
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
def COexc(units): MAS =pul.GetPar('MAS',"") Title="CO 90 excite/purge" Sutit=pul.pulDict['sCOe']+" soft 90" Label=["Duration","Offset","Pulse Name (3pi/2 Sinc)"] Dims =["us","ppm",""] Input=Title, Sutit,Label,Dims Confirm="Adjusting the "+pul.pulDict['sCOe']+" purge pulse:" Names ='pCOe','aCOe','sCOe','oCOe' limits =220.,140.1 #(in ppm) default= 1.5*1000000./MAS,"ESnob",175. CalSP("13C",units,Names,default,limits,Input,Confirm,90.)
def COref(units): MAS =pul.GetPar('MAS',"") Title="CO 180 refocussing" Sutit=pul.pulDict['sCOr']+" soft 180" Label=["Duration","Offset","Pulse Name (rSnob)"] Dims =["us","ppm",""] Input=Title, Sutit,Label,Dims Confirm="Adjusting the "+pul.pulDict['sCOe']+" purge pulse:" Names ='pCOr','aCOr','sCOr','oCOr' limits =220.,140.1 #(in ppm) default= 1.5*1000000./MAS,"RSnob",175. CalSP("13C",units,Names,default,limits,Input,Confirm,180.)
def CAref(units): MAS =pul.GetPar('MAS',"") Title="CA 180 refocussing" Sutit=pul.pulDict['sCAr']+" soft 180" Label=["Duration","Offset","Pulse Name (rSnob)"] Dims =["us","ppm",""] Input=Title, Sutit,Label,Dims Confirm="Adjusting the "+pul.pulDict['sCAr']+" purge pulse:" Names ='pCAr','aCAr','sCAr','oCAr' limits =140.,-10. #(in ppm) default= 1.5*1000000./MAS,"RSnob",55. #TopCmds.MSG("Calling Softpulse calculation") CalSP("13C",units,Names,default,limits,Input,Confirm,180.)
def Find_old_pw(char, Nuc): if char == 'pcpd': if Nuc == "1H": pw = pul.GetPar('pcpdH', "") if Nuc == "2H": pw = pul.GetPar('pcpdD', "") if Nuc == "13C": pw = pul.GetPar('pcpdC', "") if Nuc == "15N": pw = pul.GetPar('pcpdN', "") elif char == 'p31': pw = pul.GetPar("P 31", "") elif char == 'p62': pw = pul.GetPar("P 62", "") else: pw = 0.03 return pw
def Find_old_pl(char, unit): if char == 'pl12': pl = float(pul.GetPar('aHdec', unit)) elif char == 'pl13': pl = float(pul.GetPar('aHdec2', unit)) elif char == 'pl14': pl = float(pul.GetPar('aHdec3', unit)) elif char == 'pl3': pl = float(pul.GetPar('aNdec', unit)) elif char == 'pl4': pl = float(pul.GetPar('aCdec', unit)) elif char == 'pl25': pl = float(pul.GetPar('aDdec', unit)) else: pl = 1000. return pl
def MakeRamp(Scale, Delta, Beta, Nuc): MAS =pul.GetPar('MAS',"") TauR=float(1000000/MAS) if Nuc=="1H" : MaxB1=1000./4./(pul.GetPar('pH90',"")) Amp=pul.GetPar('aH','dB') Time=pul.GetPar('pHdrm',"") TimeKey='pHdrm' key='sHdrm' if Nuc=="13C": MaxB1=1000./4./(pul.GetPar('pC90',"")) Amp=pul.GetPar('aC','dB') Time=pul.GetPar('pCdrm',"") TimeKey='pCdrm' key='sCdrm' PctScal=Scale/MaxB1 PctRamp=2.*Delta/MaxB1 PctAdia=Beta/MaxB1 Index = TopCmds.INPUT_DIALOG("DREAM RAMP", "", \ ["Total Contact","Read-In/Out","Ampl","Ramp","Adiabicity"],\ [str(Time/1000.),str( '%3.2f' % (2*TauR)),str('%3.1f'%(Scale/1000.)),\ str('%3.1f'%(Delta/1000.)),str('%3.1f' % Beta)],\ ["ms" ,"us" ,"kHz" ,"+/- kHz","Hz"],\ ["1" ,"1" ,"1" ,"1" ,"1"],\ ["Accept","Close"], [spc,ret], 10) if Index == None:TopCmds.EXIT() PctAmpl=100.*float(Index[2])/MaxB1 PctDel=PctAmpl*float(Index[3]) PctBet=float(Index[2])*float(Index[4])/MaxB1/10. Name=name_confirm(Index[0],Index[1],str(PctAmpl),str(PctDel),str(PctBet),key) make(Index[0],Index[1],str(PctAmpl),str(PctRamp),PctBet,Name,key) pul.SetPar(TimeKey,1000.*float(Index[0]),"") return Name, Index[0]
def CX(Unit): PL = pul.GetPar('aHdarr', Unit) PW = pul.GetPar('dDarr', "") return PW, PL
def DPul(Unit): PL = pul.GetPar('aD', Unit) PW = pul.GetPar('pD90', "") return PW, PL
def NPul(Unit): PL = pul.GetPar('aN', Unit) PW = pul.GetPar('pN90', "") return PW, PL
def CPul(Unit): PL = pul.GetPar('aC', Unit) PW = pul.GetPar('pC90', "") return PW, PL
def HPul(Unit): PL = pul.GetPar('aH', Unit) PW = pul.GetPar('pH90', "") return PW, PL
def MAS(Unit): MAS = pul.GetPar('MAS', "") return MAS
def CalSP(nuc,units,para,dflt,limits,dia,conf,tip): """ nuc : Nucleus, 13C or 1H units : Watts (W) or Decibels (dB) para : Dict keys for soft pulse wave (time,amp,shape,offs) dflt : Defaults (time,shape,offs(in ppm)) limits : ppm frequency limits (upper, lower) """ if nuc=="13C":p90=pul.GetPar('pC90',""); amp=pul.GetPar('aC',units) if nuc=="1H": p90=pul.GetPar('pH90',""); amp=pul.GetPar('aH',units) MAS =pul.GetPar('MAS',"") if units == "W": amp=Setup.WtodB(amp) MaxB1 = 1000000./4./p90 pSft = pul.GetPar(para[0],"") if pSft == 0: pSft = dflt[0] SP=pul.GetPar(para[2],"") offs0 = pul.GetPar(para[3],"") #Check for existence and default if SP == "gauss" or SP == "None" or SP == "0" or SP == "" : pul.SetPar(para[2],dflt[1],"") TopCmds.XCMD(pul.xcmd_name(pul.pulDict[para[2]])) SP=pul.GetPar(para[2],"") if pul.pulDict['uoffs']=='ppm': ppm=offs0 offs=Cfrq.ppm2offs(offs0) else: #offs0 is in Hz ppm=Cfrq.offs2ppm(offs0) offs=offs0 if ppm > limits[0] : ppm=dflt[2] if ppm < limits[1] : ppm=dflt[2] index = TopCmds.INPUT_DIALOG(dia[0],dia[1],dia[2],\ [str('%3.2f' %pSft),str('%3.2f' %ppm),SP],\ dia[3],["1","1","1"],\ ["Accept","Close"], [spc,ret], 10) if index == None:TopCmds.EXIT() pSft=float(index[0]) ppm=float(index[1]) SP=index[2] offs=Cfrq.ppm2offs(ppm) AvgAmp=IntShape.Integrate(SP)/100. adjust=20*math.log10((tip/90.)*p90/pSft/AvgAmp) Power =amp-adjust if units == "W": Power=Setup.dBtoW(Power) confirm = TopCmds.SELECT(conf,\ "This will set\n "+\ nuc+" amp "+pul.pulDict[para[1]]+" to : " + str('%3.2f' %Power)+ " "+units+"\n \ Pulse offset to : " + str('%8.0f' %offs) + " Hz\n \ Equivalent to : " + str('%3.1f' %ppm ) + " ppm\n "+\ pul.pulDict[para[0]]+" to :" + str('%6.1f' %pSft)+ " us\n "\ ,["Update", "Keep Previous"]) if confirm != 1: pul.SetPar(para[0],pSft,"") pul.SetPar(para[1],Power,units) pul.SetPar(para[2],SP,"") if pul.pulDict['uoffs']=='ppm': pul.SetPar(para[3],ppm,"") elif pul.pulDict['uoffs']=='Hz': pul.SetPar(para[3],offs,"") else : pul.SetPar(para[3],ppm,"")
def Phases(): PH0 = pul.GetPar("PHC0", "") PH1 = pul.GetPar("PHC1", "") #TopCmds.MSG("PH0: "+str(PH0)+"\n PH1: " +str(PH1)) return PH0, PH1