seqfil = 'bhXH'

//------------------------------
// axAssgn and bioref
//------------------------------

exists('axAssgn','parameter'):$e
if $e < 0.5 then
   create('axAssgn','flag')
endif 
setvalue('axAssgn','11')

exists('bioref','parameter'):$e
if $e < 0.5 then
   create('bioref','flag')
endif
setvalue('bioref','y') 

exists('BPautonoisecheck','parameter'):$e
if $e < 0.5 then
   create('BPautonoisecheck','real')
   BPautonoisecheck = 0.0
endif 

exists('BPclassic','parameter'):$e
if $e < 0.5 then
   create('BPclassic','string')
   BPclassic='n'
endif 

//-----------------------------
// ND Referencing Parameters
//-----------------------------

exists('refsource1','parameter'):$e
if $e < 0.5 then
   create('refsource1','flag')
   refsource1='sfrq' 
endif

exists('axis','parameter'):$e
if $e < 0.5 then
   create('axis','flag')
   axis='pp' 
endif

//------------------------------
// Spin Rate
//------------------------------

exists('srate','parameter'):$e
if $e < 0.5 then
   create('srate','frequency')
   srate = 5000
endif 

exists('hsrotor','parameter'):$e
if $e < 0.5 then
   create('hsrotor','flag') 
   setvalue('hsrotor','y')
endif

//------------------------------
// Receiver Delays
//------------------------------

exists('rd','parameter'):$e
if $e < 0.5 then
   create('rd','pulse')
   setlimit('rd',8192,0,0.0125)
   rd = 4.0  
endif 

exists('ad','parameter'):$e
if $e < 0.5 then
   create('ad','pulse')
   setlimit('ad',8192,0,0.0125)
   ad = 4.0 
endif

exists('ddrtc','parameter'):$e
if $e < 0.5 then
   create('ddrtc','pulse')
   setlimit('ddrtc',8192,0,0.0125)
   ddrtc = 8.0  
endif

exists('roff','parameter'):$e
if $e < 0.5 then
   create('roff','frequency')
   roff = 0.0
endif

//==================
// 2D acq parameters
//==================

exists('ni','parameter'):$e
if ($e < 0.5) then
   create('ni','integer')
   setlimit('ni',32767,0,1)
   ni = 1
endif

exists('sw1','parameter'):$e
if ($e < 0.5) then
   create('sw1','real')
   setlimit('sw1',5.0e6,1.0,parstep[5])
   sw1 = 50000.0
endif

exists('phase','parameter'):$e
if ($e < 0.5) then
   create('phase','integer')
   phase = 1,2
endif

exists('d2','parameter'):$e
if ($e < 0.5) then 
   create('d2','delay')
   parunits('set','d2','us')
   d2 = 0.0
endif

exists('d2acqret','parameter'):$e
if ($e < 0.5) then 
   create('d2acqret','delay')
   parunits('set','d2acqret','us')
   d2acqret = 0.0
endif

exists('d2dwret','parameter'):$e
if ($e < 0.5) then 
   create('d2dwret','delay')
   parunits('set','d2dwret','us')
   d2dwret = 0.0
endif

//------------------------------
// Basic Transmitter Properties
//------------------------------

exists('aX90','parameter'):$e
if $e < 0.5 then
   create('aX90','real')
   setlimit('aX90',4095,0,0)
   aX90 = 2000.0  
endif 

exists('aH90','parameter'):$e
if $e < 0.5 then
   create('aH90','real')
   setlimit('aH90',4095,0,0)
   aH90 = 2000.0 
endif 

exists('aY90','parameter'):$e
if $e < 0.5 then
   create('aY90','real')
   setlimit('aY90',4095,0,0)
   aY90 = 2000.0  
endif

exists('aZ90','parameter'):$e
if $e < 0.5 then
   create('aZ90','real')
   setlimit('aZ90',4095,0,0)
   aZ90 = 2000.0  
endif

exists('pwX90','parameter'):$e
if $e < 0.5 then
   create('pwX90','pulse')
   setlimit('pwX90',8192,0,0.0125)
   pwX90 = 4.0
endif 

exists('pwH90','parameter'):$e
if $e < 0.5 then
   create('pwH90','pulse')
   setlimit('pwH90',8192,0,0.0125)
   pwH90 = 4.0
endif 

exists('pwY90','parameter'):$e
if $e < 0.5 then
   create('pwY90','pulse')
   setlimit('pwY90',8192,0,0.0125)
   pwY90 = 4.0
endif

exists('pwZ90','parameter'):$e
if $e < 0.5 then
   create('pwZ90','pulse')
   setlimit('pwZ90',8192,0,0.0125)
   pwZ90 = 4.0
endif

//---------------
// cpXH elements
//---------------

exists('shXH','parameter'):$e
if $e < 0.5 then
    create('shXH','flag')
    setvalue('shXH','c') 
endif

exists('toXH','parameter'):$e
if $e < 0.5 then
   create('toXH','flag')
endif 
setvalue('toXH','obs')

exists('frXH','parameter'):$e
if $e < 0.5 then
   create('frXH','flag')
endif
setvalue('frXH','dec')  

exists('chXH','parameter'):$e
if $e < 0.5 then
   create('chXH','flag')
   setvalue('chXH','fr')  
endif 

exists('aHxh','parameter'):$e
if $e < 0.5 then
   create('aHxh','real')
   setlimit('aHxh',4095,0,0)
   aHxh = 2000.0
endif 

exists('aXxh','parameter'):$e
if $e < 0.5 then
   create('aXxh','real')
   setlimit('aXxh',4095,0,0)
   aXxh = 2000.0
endif 

exists('bXH','parameter'):$e
if $e < 0.5 then
   create('bXH','real')
   setlimit('bXH',1000000,1.0e-6,0.0)
   bXH = 1.0e-6
endif 

exists('dXH','parameter'):$e
if $e < 0.5 then
   create('dXH','real')
   setlimit('dXH',4095,-4095,0)
   dXH = 0.0
endif 

exists('tXH','parameter'):$e
if $e < 0.5 then
   create('tXH','pulse')
   setlimit('tXH',500000,0,0.0125)
   tXH = 1000.0
endif

exists('ofXH','parameter'):$e
if $e < 0.5 then
   create('ofXH','frequency')
   ofXH = 0.0
endif  

//=====================
// decoupling options
//======================

exists('Hseq','parameter'):$e
if $e < 0.5 then
    create('Hseq','flag')
    setvalue('Hseq','spinal')
endif

//-----------
// tppm
//-----------

exists('aHtppm','parameter'):$e
if $e < 0.5 then
   create('aHtppm','real')
   setlimit('aHtppm',4095,0,0)
   aHtppm = 2000.0
endif

exists('pwHtppm','parameter'):$e
if $e < 0.5 then
   create('pwHtppm','pulse')
   setlimit('pwHtppm',8192,0,0.0125)
   pwHtppm = 8.0
endif

exists('phHtppm','parameter'):$e
if $e < 0.5 then
   create('phHtppm','real')
   setlimit('phHtppm',180.0,-180.0,0.0)
   phHtppm = 10.0
endif

exists('chHtppm','parameter'):$e
if $e < 0.5 then
   create('chHtppm','flag')
endif 
setvalue('chHtppm','dec')

//------------------------------
//  spinal 
//------------------------------

exists('aHspinal','parameter'):$e
if $e < 0.5 then
   create('aHspinal','real')
   setlimit('aHspinal',4095,0,0)
   aHspinal = 2000.0
endif

exists('pwHspinal','parameter'):$e
if $e < 0.5 then
   create('pwHspinal','pulse')
   setlimit('pwHspinal',8192,0,0.0125)
   pwHspinal=8.0
endif

exists('phHspinal','parameter'):$e
if $e < 0.5 then
   create('phHspinal','real')
   setlimit('phHspinal',180.0,-180.0,0.0)
   phHspinal = 10.0
endif

exists('alpHspinal','parameter'):$e
if $e < 0.5 then
   create('alpHspinal','real')
   setlimit('alpHspinal',180.0,-180.0,0.0)
   alpHspinal = 5.0
endif

exists('chHspinal','parameter'):$e
if $e < 0.5 then
   create('chHspinal','flag')
endif 
setvalue('chHspinal','dec')

//========================================
// SPINAL, TPPM or WALTZ for Y decoupling
//========================================

exists('ddec2','parameter'):$e
if $e < 0.5 then
   create('ddec2','flag')
   setvalue('ddec2','y')
endif

exists('Yseq','parameter'):$e
if $e < 0.5 then
   create('Yseq','flag')
   setvalue('Yseq','spinal')
endif

//--------------
// dec2 Y tppm
//--------------

exists('aYtppm','parameter'):$e
if $e < 0.5 then
   create('aYtppm','real')
   setlimit('aYtppm',4095,0,0)
   aYtppm = 2000.0
endif

exists('pwYtppm','parameter'):$e
if $e < 0.5 then
   create('pwYtppm','pulse')
   setlimit('pwYtppm',10000,0,0.0125)
   pwYtppm = 8.0
endif

exists('phYtppm','parameter'):$e
if $e < 0.5 then
   create('phYtppm','real')
   setlimit('phYtppm',180.0,-180.0,0.0)
   phYtppm = 10.0
endif

exists('chYtppm','parameter'):$e
if $e < 0.5 then
   create('chYtppm','flag')
endif 
setvalue('chYtppm','dec2')

//-----------------
//  dec2 Y spinal 
//-----------------

exists('aYspinal','parameter'):$e
if $e < 0.5 then
   create('aYspinal','real')
   setlimit('aYspinal',4095,0,0)
   aYspinal = 2000.0
endif

exists('pwYspinal','parameter'):$e
if $e < 0.5 then
   create('pwYspinal','pulse')
   setlimit('pwYspinal',10000,0,0.0125)
   pwYspinal = 2000.0 
endif

exists('phYspinal','parameter'):$e
if $e < 0.5 then
   create('phYspinal','real')
   setlimit('phYspinal',180.0,-180.0,0.0)
   phYspinal = 10.0
endif

exists('chYspinal','parameter'):$e
if $e < 0.5 then
   create('chYspinal','flag')
endif 
setvalue('chYspinal','dec2')

exists('alpYspinal','parameter'):$e
if $e < 0.5 then
   create('alpYspinal','real')
   setlimit('alpYspinal',180.0,-180.0,0.0)
   alpYspinal = 5.0
endif

//----------------
//  dec2 Y waltz 
//----------------

exists('aYwaltz','parameter'):$e
if $e < 0.5 then
   create('aYwaltz','real')
   setlimit('aYwaltz',4095,0,0)
   aYwaltz = 2000.0
endif

exists('pwYwaltz','parameter'):$e
if $e < 0.5 then
   create('pwYwaltz','pulse')
   setlimit('pwYwaltz',10000,0,0.0125)
   pwYwaltz = 4.0
endif

exists('chYwaltz','parameter'):$e
if $e < 0.5 then
   create('chYwaltz','flag')
endif 
setvalue('chYwaltz','dec2')

//=====================================
// X SPINAL2, TPPM, or WALTZ ELEMENTS F2
//=====================================

exists('Xseq','parameter'):$e
if $e < 0.5 then
   create('Xseq','flag')
   setvalue('Xseq','spinal')
endif

//---------------
//  dec X tppm
//---------------

exists('aXtppm','parameter'):$e
if $e < 0.5 then
    create('aXtppm','real')
    setlimit('aXtppm',4095,0,0)
    aXtppm = 2000.0
endif

exists('pwXtppm','parameter'):$e
if $e < 0.5 then
    create('pwXtppm','pulse')
    setlimit('pwXtppm',8192,0,0.0125)
    pwXtppm = 8.0
endif

exists('phXtppm','parameter'):$e
if $e < 0.5 then
    create('phXtppm','real')
    setlimit('phXtppm',180,-180,0.0)
    phXtppm = 10.0
endif

exists('chXtppm','parameter'):$e
if $e < 0.5 then
   create('chXtppm','flag')
endif 
setvalue('chXtppm','dec')

//---------------
//  dec X spinal
//---------------

exists('aXspinal','parameter'):$e
if $e < 0.5 then
    create('aXspinal','real')
    setlimit('aXspinal',4095,0,0)
    aXspinal = 2000.0
endif

exists('pwXspinal','parameter'):$e
if $e < 0.5 then
    create('pwXspinal','pulse')
    setlimit('pwXspinal',8192,0,0.0125)
    pwXspinal = 8.0
endif

exists('alpXspinal','parameter'):$e
if $e < 0.5 then
    create('alpXspinal','pulse')
    setlimit('alpXspinal',8192,0,0.0125)
    alpXspinal = 5.0
endif

exists('phXspinal','parameter'):$e
if $e < 0.5 then
    create('phXspinal','real')
    setlimit('phXspinal',180,-180,0.0)
    phXspinal = 10.0
endif

exists('chXspinal','parameter'):$e
if $e < 0.5 then
   create('chXspinal','flag')
endif 
setvalue('chXspinal','dec')

//---------------
//  dec X waltz
//---------------

exists('aXwaltz','parameter'):$e
if $e < 0.5 then
    create('aXwaltz','real')
    setlimit('aXwaltz',4095,0,0)
    aXwaltz = 2000.0
endif

exists('pwXwaltz','parameter'):$e
if $e < 0.5 then
    create('pwXwaltz','pulse')
    setlimit('pwXwaltz',8192,0,0.0125)
    pwXwaltz = 4.0
endif

exists('chXwaltz','parameter'):$e
if $e < 0.5 then
   create('chXwaltz','flag')
endif 
setvalue('chXwaltz','dec')

//==========================
// Additional parameters
//==========================

exists('CT','parameter'):$e
if ($e < 0.5) then 
   create('CT','string')
   CT = 'y'
endif

exists('tconstd2','parameter'):$e
if $e < 0.5 then
   create('tconstd2','delay')
   tconstd2 = 3000.0e-6
endif

exists('HS','parameter'):$e
if ($e < 0.5) then 
   create('HS','string')
   HS='z'
endif

destroy('hst')
exists('hst','parameter'):$e
if $e < 0.5 then
   create('hst','delay')
   parunits('set','hst','us')  
   hst = 100.0e-6
endif

exists('hstconst','parameter'):$e
if $e < 0.5 then
   create('hstconst','delay')
   parunits('set','hstconst','us')
   hstconst = 100e-6
endif

exists('hst2','parameter'):$e
if $e < 0.5 then
   create('hst2','delay')
   parunits('set','hst2','us')
   hst2 = 100.0e-6
endif

exists('hst2const','parameter'):$e
if $e < 0.5 then
   create('hst2const','delay')
   parunits('set','hst2const','us')
   hst2const = 100.0e-6
endif

exists('gzlvl1','parameter'):$e
if $e < 0.5 then
    create('gzlvl1','real')
    setlimit('gzlvl1',32767,-32767,1)
    gzlvl1 = 1
endif

//==================
// rfdr ELEMENTS
//==================

exists('chHrfdr','parameter'):$e
if $e < 0.5 then
   create('chHrfdr','flag')
endif 
setvalue('chHrfdr','obs')

exists('ofHrfdr','parameter'):$e
if $e < 0.5 then
   create('ofHrfdr','frequency')
   ofHrfdr = 0.0
endif 

exists('qHrfdr','parameter'):$e
if $e < 0.5 then
   create('qHrfdr','real')
   setlimit('qHrfdr',256,0,1)
   qHrfdr = 1
endif 

exists('aHrfdr','parameter'):$e
if $e < 0.5 then
   create('aHrfdr','real')
   setlimit('aHrfdr',4095,0,0)
   aHrfdr = 2000.0
endif 

exists('aHrfdr','parameter'):$e
if $e < 0.5 then
   create('aHrfdr','real')
   setlimit('aHrfdr',4095,0,0)
   aHrfdr = 2000.0
endif 

exists('pwHrfdr','parameter'):$e
if $e < 0.5 then
   create('pwHrfdr','pulse')
   setlimit('pwHrfdr',8192,0,0.0125)
   pwHrfdr = 8.0
endif 

exists('tHrfdrret','parameter'):$e
if $e < 0.5 then
   create('tHrfdrret','pulse')
   setlimit('tHrfdrret',500000.0,0,0.0125)
   tHrfdrret = 0.0
endif 

//============================
// First H PRESAT XY ELEMENTS
//============================

exists('qHpxy','parameter'):$e
if $e < 0.5 then
   create('qHpxy','real')
   setlimit('qHpxy',256,0,1)
   qHpxy = 1.0
endif 

exists('chHpxy','parameter'):$e
if $e < 0.5 then
   create('chHpxy','flag')
endif 
setvalue('chHpxy','obs')

exists('ofHpxy','parameter'):$e
if $e < 0.5 then
   create('ofHpxy','frequency')
   ofHpxy = 0.0
endif 

exists('aHpxy','parameter'):$e
if $e < 0.5 then
   create('aHpxy','real')
   setlimit('aHpxy',4095,0,1)
   aHpxy = 2000.0
endif 

exists('pwHpxy','parameter'):$e
if $e < 0.5 then
   create('pwHpxy','pulse')
   setlimit('pwHpxy',100000,0,0.0125)
   pwHpxy = 100.0
endif 

//=============================
// Second H PRESAT XY ELEMENTS
//=============================

exists('qHpxy2','parameter'):$e
if $e < 0.5 then
   create('qHpxy2','real')
   setlimit('qHpxy2',256,0,1)
   qHpxy = 1.0
endif 

exists('chHpxy2','parameter'):$e
if $e < 0.5 then
   create('chHpxy2','flag')
endif 
setvalue('chHpxy2','obs')

exists('ofHpxy2','parameter'):$e
if $e < 0.5 then
   create('ofHpxy2','frequency')
   ofHpxy2 = 0.0
endif 

exists('aHpxy2','parameter'):$e
if $e < 0.5 then
   create('aHpxy2','real')
   setlimit('aHpxy2',4095,0,1)
   aHpxy2 = 2000.0
endif 

exists('pwHpxy2','parameter'):$e
if $e < 0.5 then
   create('pwHpxy2','pulse')
   setlimit('pwHpxy2',100000,0,0.0125)
   pwHpxy2 = 100.0
endif 

//=================================================
// Set Constant-time Decoupling 
//=================================================

exists('ctd','parameter'):$e
if $e < 0.5 then
   create('ctd','flag')
   setvalue('ctd','y')
endif

exists('tRFmax','parameter'):$e
if $e < 0.5 then
   create('tRFmax','pulse')
   setlimit('tRFmax',500000.0,0,0.0125)
   tRFmax = 5000.0
endif

//-------------------------------------------------
// H Hahn Echo
//-------------------------------------------------

exists('tHecho','parameter'):$e
if $e < 0.5 then
   create('tHecho','pulse')
   setlimit('tHecho',50000,0,0.0125)
   tHecho = 100.0
endif

// --------------------------------------------------
// Set parameters specific to the experiment
// --------------------------------------------------

exists('wrtp','parameter'):$e
if ($e < 0.5) then 
   create('wrtp','string')
endif
wrtp = 'reset_ahXX'
reset_bhXH

//------------------------------------------------
//  Set Bit 14 for new parameters of the .par file 
//------------------------------------------------

$params = 'frHX toHX frXH toXH chHspinal chHtppm chHrfdr chHpxy chHpxy2 '
$params = $params + 'chYtppm chYspinal chYwaltz chXtppm chXspinal chXwaltz '
$params = $params + 'refsource1 axis BPautonoisecheck BPclassic wrtp '
$params = $params + 'roff sw1 ni phase d2 d2acqret d2dwret '
$params = $params + 'shXH chXH aHxh aXxh bXH dXH tXH ofXH '
$params = $params + 'alpHspinal '
$params = $params + 'aYspinal pwYspinal alpYspinal phYspinal Yseq ddec2 '
$params = $params + 'aYtppm pwYtppm phYtppm aYwaltz pwYwaltz '
$params = $params + 'aXtppm pwXtppm phXtppm aXspinal pwXspinal phXspinal '
$params = $params + 'alpXspinal Xseq aXwaltz pwXwaltz '
$params = $params + 'tconstd2 hst hstconst hst2 hst2const CT  HS gzlvl1 '
$params = $params + 'tRFmax ctd tHecho '
$params = $params + 'qHpxy ofHpxy aHpxy pwHpxy qHpxy2 ofHpxy2 aHpxy2 pwHpxy2 '
$params = $params + 'ofHrfdr qHrfdr aHrfdr aHrfdr pwHrfdr tHrfdrret'
setprotect('','clear',16384)
setprotect($params,'on',16384)

//--------------------------------------------------------
//  Clear parameters in 'clearparams' in the apptype macro
//--------------------------------------------------------

exists('clearparams','parameter'):$e
if $e < 0.5 then
   create('clearparams','string')
endif
setprotect('clearparams','on',16384)
$clearparams = 'frHX toHX frXH frXH chHspinal chHtppm chHrfdr chHpxy chHpxy2 ' 
$clearparams = $clearparams + 'chYtppm chYspinal chYwaltz chXtppm chXspinal '
$clearparams = $clearparams + 'chXwaltz refsource1 axis '
setvalue('clearparams',$clearparams)

//-------------------------------
//  Set the parameter templates
//-------------------------------

setprotect('dg','clear',4)
$dg = '1:ACQUISITION:sw:1,at:6,np:0,d1:6,nt:0,ct:0,bs:0,'
$dg = $dg + 'ss:0,rd:1,ad:1,ddrtc:1,rof3(rof3):1,gain:0,roff:1,temp:0,srate:1;'
$dg = $dg + '1:cpHX:shHX,chHX,aHhx:0,aXhx:0,bHX:6,dHX:6,tHX:1,ofHX:3;'
$dg = $dg + '1:cpXH:shXH,chXH,aHxh:0,aXxh:0,bXH:6,dXH:6,tXH:1,ofXH:3;'
$dg = $dg + '1(Hseq=\'tppm\'):tppmH:aHtppm:0,pwHtppm:1,phHtppm:2;'
$dg = $dg + '1(Hseq=\'spinal\'):spinalH:aHspinal:0,pwHspinal:1,phHspinal:2;'
$dg = $dg + '1(Xseq=\'tppm\'):tppmX:aXtppm:0,pwXtppm:1,phXtppm:2;'
$dg = $dg + '1(Xseq=\'spinal\'):spinalX:aXspinal:0,pwXspinal:1,phXspinal:2,alpXspinal:2;'
$dg = $dg + '1(Xseq=\'waltz\'):waltzX:aXwaltz:0,pwXwaltz:1;'
$dg = $dg + '1(Yseq=\'tppm\' and ddec2=\'y\'):tppmY:aYtppm:0,pwHtppm:1,phHtppm:2;'
$dg = $dg + '1(Yseq=\'spinal\' and ddec2=\'y\'):spinalY:aYspinal:0,pwYspinal:1,phYspinal:2,alpYspinal:2;'
$dg = $dg + '1(Yseq=\'waltz\' and ddec2=\'y\'):waltzY:aYwaltz:0,pwYwaltz:1;'
$dg = $dg + '1:CONSTANT D2 X:d2:6,tconstd2:6;'
$dg = $dg + '1:STANDARD D2 X:d2:6,tconstd2:6;'
$dg = $dg + '1(ctd=\'y\'):CONSTANT DECOUPLE:tRFmax:1;'
$dg = $dg + '1(ctd<>\'y\'):STANDARD DECOUPLE:;'
dg[1] = $dg
$dg = ''
$dg = $dg + '1:rfdrH:aHrfdr:0,pwHrfdr:1,qHrfdr:0,ofHrfdr:1,dqfHrfd,tHrfdrret:1;'
$dg = $dg + '1:pxyH:aHpxy:0,pwHpxy:1,qHpxy:0,ofHpxy:1;'
$dg = $dg + '1:pxy2H:aHpxy2:0,pwHpxy2:1,qHpxy2:0,ofHpxy2:1;'
$dg = $dg + '1:GRAD:hst:1,hstconst:1,hst2:1,hst2const:1,gzlvl1:0;'
$dg = $dg + '2:echoH:tHecho:1;'
$dg = $dg + '1:FLAGS:ctd,ddec2,CT,HS;'
dg[2] = $dg

setprotect('dg2','clear',4)
$dg2 = '1:OBSERVE:tn,sfrq:6,tof:1,tpwr:0,aX90:0,pwX90:1;'
$dg2=$dg2+'1:1D Acquisition:sw:1,np:0,at:7;'
$dg2=$dg2+'2:DECOUPLE:dn,dfrq:6,dof:1,dpwr:0,aH90:0,pwH90:1;'
$dg2=$dg2+'2:2D Acquisition:sw1:1,ni:0,phase:0,d2:7,d2acqret:7,d3dwret:7;'
$dg2=$dg2+'3:DECOUPLE2:dn2,dfrq2:6,dof2:1,dpwr2:0,aY90:0,pwY90:1;'
$dg2=$dg2+'4:DECOUPLE3:dn3,dfrq3:6,dof3:1,dpwr3:0,aZ90:0,pwZ90:1;'
dg2 = $dg2
setprotect('dg2','on',4)

setprotect('ap','clear',4)
$ap = '1:ACQUISITION:sw:1,at:6,np:0,d1:6,nt:0,ct:0,bs:0,'
$ap = $ap + 'ss:0,rd:1,ad:1,ddrtc:1,rof3(rof3):1,gain:0,roff:1,temp:0,srate:1;'
$ap = $ap + '1:cpHX:shHX,chHX,aHhx:0,aXhx:0,bHX:6,dHX:6,tHX:1,ofHX:3;'
$ap = $ap + '1:cpXH:shXH,chXH,aHxh:0,aXxh:0,bXH:6,dXH:6,tXH:1,ofXH:3;'
$ap = $ap + '1(Hseq=\'tppm\'):tppmH:aHtppm:0,pwHtppm:1,phHtppm:2;'
$ap = $ap + '1(Hseq=\'spinal\'):spinalH:aHspinal:0,pwHspinal:1,phHspinal:2;'
$ap = $ap + '1(Xseq=\'tppm\'):tppmX:aXtppm:0,pwXtppm:1,phXtppm:2;'
$ap = $ap + '1(Xseq=\'spinal\'):spinalX:aXspinal:0,pwXspinal:1,phXspinal:2,alpXspinal:2;'
$ap = $ap + '1(Xseq=\'waltz\'):waltzX:aXwaltz:0,pwXwaltz:1;'
$ap = $ap + '1(Yseq=\'tppm\' and ddec2=\'y\'):tppmY:aYtppm:0,pwHtppm:1,phHtppm:2;'
$ap = $ap + '1(Yseq=\'spinal\' and ddec2=\'y\'):spinalY:aYspinal:0,pwYspinal:1,phYspinal:2,alpYspinal:2;'
$ap = $ap + '1(Yseq=\'waltz\' and ddec2=\'y\'):waltzY:aYwaltz:0,pwYwaltz:1;'
$ap = $ap + '1:CONSTANT D2 X:d2:6,tconstd2:6;'
$ap = $ap + '1:STANDARD D2 X:d2:6,tconstd2:6;'
$ap = $ap + '1(ctd=\'y\'):CONSTANT DECOUPLE:tRFmax:1;'
$ap = $ap + '1(ctd<>\'y\'):STANDARD DECOUPLE:;'
ap[1] = $ap
$ap = ''
$ap = $ap + '1:rfdrH:aHrfdr:0,pwHrfdr:1,qHrfdr:0,ofHrfdr:1,dqfHrfd,tHrfdrret:1;'
$ap = $ap + '1:pxyH:aHpxy:0,pwHpxy:1,qHpxy:0,ofHpxy:1;'
$ap = $ap + '1:pxy2H:aHpxy2:0,pwHpxy2:1,qHpxy2:0,ofHpxy2:1;'
$ap = $ap + '1:GRAD:hst:1,hstconst:1,hst2:1,hst2const:1,gzlvl1:0;'
$ap = $ap + '2:echoH:tHecho:1;'
$ap = $ap + '1:FLAGS:ctd,ddec2,CT HS;'
ap[2] = $ap
setvalue('ap',$ap,'processed')
setprotect('ap','on',4)

