void phase_encode3_gradpulse(double stat1, double stat2, double stat3,              \
     double duration, double step1, double step2, double step3,                     \
     int vmult1, int vmult2, int vmult3, double lim1, double lim2, double lim3)
{

     if (duration >= 2.40e-6)
     {
       phase_encode3_gradient(stat1,stat2,stat3,step1,step2,step3,vmult1,vmult2,vmult3,lim1,lim2,lim3);
       delay(duration);
       zero_all_gradients();
     }
}
Esempio n. 2
0
pulsesequence()
{
   double pd, seqtime;
   double mintDELTA,ted1,ted2,gf;
   double restol, resto_local;

   init_mri();              /****needed ****/

   restol=getval("restol");   //local frequency offset
   roff=getval("roff");       //receiver offset

   init_rf(&p1_rf,p1pat,p1,flip1,rof1,rof2);   /* hard pulse */
   calc_rf(&p1_rf,"tpwr1","tpwr1f");
   init_rf(&p2_rf,p2pat,p2,flip2,rof1,rof2);   /* hard pulse */
   calc_rf(&p2_rf,"tpwr2","tpwr2f");

   gf=1.0;
   if(diff[0] == 'n') gf=0;
   int  vph180     = v2;  /* Phase of 180 pulse */

   mintDELTA = tdelta + trise + rof1 + p2 + rof2;
   if(tDELTA <= mintDELTA) {
       abort_message("%s: tDELTA too short. Min tDELTA = %f ms",seqfil,mintDELTA*1e3);
   }
   ted1 = tDELTA - tdelta + trise + p2 + rof1 + rof2;
   te = p1/2 + rof2 + tdelta + trise + ted1 + rof1 + p2/2;   /* first half-te */
   ted2 = te - p2/2 - rof2 - tdelta - trise;
   if((ted1 <= 0)||(ted2 <= 0) ) {
       abort_message("%s: tDELTA too short. Min tDELTA = %f ms",seqfil,mintDELTA*1e3);
   }
   te = te*2.0;
   putvalue("te",te);
   seqtime = at+(p1/2.0)+rof1+te;
   pd = tr - seqtime;  /* predelay based on tr */
   if (pd <= 0.0) {
      abort_message("%s: Requested tr too short.  Min tr = %f ms",seqfil,seqtime*1e3);
   }

   resto_local=resto-restol; 

   status(A);
   rotate();
   delay(pd);
   xgate(ticks);

   /* --- observe period --- */
   obsoffset(resto_local); 
   obspower(p1_rf.powerCoarse);
   obspwrf(p1_rf.powerFine);
   shapedpulse(p1pat,p1,oph,rof1,rof2);

   obl_gradient(0,0,gdiff*gf);   /* x,y,z gradients selected via orient */
   delay(tdelta);
   zero_all_gradients();
   delay(trise);
   delay(ted1);
     
   obspower(p2_rf.powerCoarse);
   obspwrf(p2_rf.powerFine);   
   settable(t2,2,ph180);        /* initialize phase tables and variables */
   getelem(t2,ct,v6);  /* 180 deg pulse phase alternates +/- 90 off the rcvr */
   add(oph,v6,vph180);      /* oph=zero */
   shapedpulse(p2pat,p2,vph180,rof1,rof2);

   obl_gradient(0,0,gdiff);   /* x,y,z gradients selected via orient */
   delay(tdelta);
   zero_all_gradients();
   delay(trise);
   delay(ted2);
   startacq(alfa);
   acquire(np,1.0/sw);
   endacq();
}
Esempio n. 3
0
pulsesequence()
{
    /*******************************************************/
    /* Internal variable declarations                      */
    /*******************************************************/
    double  predelay;
    double  agss,grate,gssint, gssrint;      
    double  t_after, acq_delay, min_tr;
    double  t_rampslice, t_plateau_sr, t_plateau_min, t_ramp_sr;
    double  slice_offset,f_offset;
    double  pss0;

    char     slice_select[MAXSTR];
 
    initparms_sis();                        /* Sets default state of receiver to ON */
                                            /*- will be obsolete on future VNMR versions */
      
    /***************************/
    /* initialize variables    */
    /***************************/  
    gssf      = 1.0;                        /* slice select fractional refocus */
    predelay  = PREDELAY;                   /* define predelay [s] */
    acq_delay = ACQ_DELAY;                  /* time delay between end of refocus and acq */
    slice_offset = 0.0;                     /* force slice offset to 0.0 [cm] */
    t_rampslice = 0.0;			    /* slice select ramp time */
    t_ramp_sr   = 0.0;                      /* slice refocusing ramp time */
    t_plateau_min = 0.0005;                 /* min time slice refocusing plateau */
    t_plateau_sr  =0.0;                     /* slice refocusing plateau time*/
    f_offset=getval("resto");

    agss = fabs(gss);			    /* absolute slice select gradient */
    gssr  = gmax;                           /* maximum slice refocusing gradient */
    grate = trise/gmax;                     /* define gradient slew rate [s*cm/g]
                                              trise = gradient rise time
                                              gmax = maximum gradient strength [G/cm] */
        
    ticks = IGNORE_TRIGGER;                 /* ignore trigger pulses */
                                        
    /***************************/
    /* Get parameter           */
    /***************************/  
    at = getval("at");
    pss0 = getval("pss0");    
					       
    getstr("slice_select",slice_select);      /* slice select flag
                                               [y] = ON, [n] = OFF */
					       
    /*******************************************************/
    /* Slice Select gradient area                          */
    /*******************************************************/
    t_rampslice = grate * agss;
    gssint = (agss*p1/2.0) + (agss*t_rampslice/2.0);
    gssrint=gssint;
    /*******************************************************
     * Calculate slice refocussing gradient                *
     *******************************************************/
    t_plateau_sr = (gssint / gssr) - trise;
    if (t_plateau_sr <= 0.0)            /* traingular gradients */
       {
       t_plateau_sr = 0.0;
       gssr = sqrt(gssint / grate);
       }  
    t_ramp_sr = gssr * grate;           /* ramp time for refocusing gradient*/
    gssrint = (gssr * t_plateau_sr) + (t_ramp_sr * gssr);	    

    /***************************************************************************
     * timing calculation                                                      *
     ***************************************************************************/   
    if (slice_select[0] == 'y')
       {
       t_after = tr - (predelay + p1 + t_plateau_sr + at + acq_delay + 2* (t_rampslice + t_ramp_sr));
       min_tr  = predelay + p1 + t_plateau_sr + at + acq_delay + 2* (t_rampslice + t_ramp_sr);
       }
    else
       {
       t_after = tr - (predelay + p1 +  at + acq_delay );
       min_tr  = predelay + p1 + at + acq_delay ;
       }   


    if (t_after < 0.0)
        {
        abort_message("Requested repetition time (TR) too short.  Min tr = %.f[ms]\n",min_tr*1000);
        }

    /******************************************************/
    /*                                                    */
    /*                  S T A R T                         */
    /*        P U L S E    S E Q U E N C E                */
    /*                                                    */
    /******************************************************/
    obspower(tpwr1);                          /* set tranmitter power */
    /***************************************************************************
     *   Predelay                                                              *
     ***************************************************************************/
    obsoffset(f_offset);                    /* set transmitter offset */ 
    delay(predelay);                    
    xgate(ticks);                           /* set gating */
    if (slice_select[0] == 'y')
         {  
	 /***************************************************************************
	  * Slice select gradient & RF pulse                                        *
	  ***************************************************************************/
	 obl_gradient(0.0,0.0,gss);               /* slice select gradient */
	 delay(t_rampslice);                      /* delay - time to ramp up gradient */
	 shaped_pulse(p1pat,p1,oph,rof1,rof1);
	 zero_all_gradients();                    /* force all gradients back to 0 [G/cm] */
	 delay(t_rampslice);                      /* time to ramp down gradient */

	 /***************************************************************************
	  * Slice refocus gradient                                                  *
	  ***************************************************************************/
	 obl_gradient(0.0,0.0,-gssr);             /* slice refocus gradient */
	 delay(t_ramp_sr+t_plateau_sr);          /* ramp up of refocus gradient */
	 zero_all_gradients();                   /* force refocus gradient back to 0 [G/cm] */
	 delay(t_ramp_sr);                       /* time to ramp down gradient */
	 }
    else
         {
         shaped_pulse(p1pat,p1,oph,rof1,rof1);
         }
    /***************************************************************************
     * Pre-acquire delay                                                       *
     ***************************************************************************/
    delay(acq_delay);

    /***************************************************************************
     * Acquire echo                                                            *
     ***************************************************************************/
    startacq(alfa);
    acquire(np,1.0/sw);                 /* acquire FID */
    endacq();

    delay(t_after);                     /* time padding to fill TR */
    /******************************************************/
    /*                                                    */
    /*                    E N D                           */
    /*        P U L S E    S E Q U E N C E                */
    /*                                                    */
    /******************************************************/

}
Esempio n. 4
0
/*-------------------------------------------------------------------
|
|	test4acquire() 
|	check too see if data has been acquired yet.
|	if it has not then do an implicit acuire.
|	else do not.
|				Author Greg Brissey  7/10/86
+------------------------------------------------------------------*/
void test4acquire()
{
    int	    i;
    int	    chan;
    int     MINch;
    double  acqdelay;	/* delay time between receiver On an data acquired*/
    codeint *tmpptr;	/* temp pointer into codes */
    extern void prg_dec_off();
    double truefrq=0.0, dqdfrq=0.0;
    char osskip[4];

    if (bgflag)
	fprintf(stderr,"test4acquire(): acqtriggers = %d \n",acqtriggers);
    if (acqtriggers == 0)	/* No data acquisition Yet? */
    {
	if (nf > 1.0)
	{
	    text_error("Number of FIDs (nf) Not Equal to One\n");
	    psg_abort(0);
	}
        if (ap_interface < 4)
	   HSgate(rcvr_hs_bit,FALSE);	/* turn receiver On */
	else
           SetRFChanAttr(RF_Channel[OBSch], SET_RCVRGATE, ON, 0);

	if (newacq)
        {
           /* execute osskip delay if osskip parameter set */
           if ((P_getstring(GLOBAL,"qcomp",osskip,1,2)) == 0)
           {
             if (osskip[0] == 'y')
             {
               /* fprintf(stderr,"hwlooping:test4acquire(): executing dsposskipdelay= %g\n", dsposskipdelay); */
               if (dsposskipdelay >= 0.0) G_Delay(DELAY_TIME, dsposskipdelay, 0);
             }
           }

           HSgate(INOVA_RCVRGATE,FALSE);        /* turn receiver On */
        }

	/* txphase(zero);	*/	/* set xmitter phase to zero */
	/* decphase(zero);	*/	/* set decoupler phase to zero */
	/* acqdelay = alfa + (1.0 / (beta * fb) ); */

	for (i = 1; i <= NUMch; i++)  /* zero HS phaseshifts */
	   SetRFChanAttr(RF_Channel[i], SET_RTPHASE90, zero, 0);

	if ((!noiseacquire) && (dsp_params.il_oversamp > 1))
	   find_dqdfrq(&truefrq, &dqdfrq);
	if (fabs(dqdfrq) > 0.1)
	   set_spare_freq(OBSch); 
/*	   obsoffset(truefrq+dqdfrq); */

	acqdelay = alfa + (1.0 / (beta * fb) );
	if (acqdelay > ACQUIRE_START_DELAY)
	   acqdelay = acqdelay - ACQUIRE_START_DELAY;
	if ((fabs(dqdfrq) > 0.1) && (acqdelay > 1.7e-6)) /* more like 40us?? */
	    acqdelay = acqdelay - 1.7e-6;

        if ((acqdelay < 0.0) && (ix == 1))
	   text_error("Acquisition filter delay (fb, alfa) is negative (%f).\n",
             acqdelay);
        else
	   G_Delay(DELAY_TIME,acqdelay,0);	/* alfa delay */
	acquire(np,1.0/sw);	/* acquire data */

	MINch = (ap_interface < 4) ? DODEV : TODEV;
	for (chan = MINch; chan <= NUMch; chan++)
	{
           if ( is_y(rfwg[chan-1]) )
           {
	      if ( (ModInfo[chan].MI_dm[0] == 'n') ||
                   ((ModInfo[chan].MI_dm[0] == 'y') &&
		    (ModInfo[chan].MI_dmm[0] != 'p')) )
              {
                 prg_dec_off(2, chan);
              }
           }
        }

	tmpptr = Aacode + multhwlp_ptr; /* get address into codes */
	*tmpptr = 1;		/* impliicit acquisition */
    }
    if (newacq)
    {
	if (explicitacq)
	{
              codeint *ptr;
	      /* update last acquire with disable overload */;
    	      ptr = Aacode + disovld_ptr;
	      *ptr++ = DISABLEOVRFLOW;
      	      *ptr = adccntrl;
	}
	/* Always set to FALSE for the next array element */
	explicitacq = FALSE;
    }

    if (grad_flag == TRUE) 
    {
      zero_all_gradients();
    }
    if (newacq)
    {
      gatedecoupler(A,15.0e-6);	/* init to status A conditions */
      statusindx = A;
    }
    putcode(STFIFO);	/* start fifo if it already hasn't */
    putcode(HKEEP);		/* do house keeping */
    if (newacq)
    {
      if ( getIlFlag() )
      {
	ifzero(ilflagrt);
    	   putcode(IFZFUNC);	/* brach to start of scan (NSC) if ct<nt */
	   putcode((codeint)ct);
	   putcode((codeint)ntrt);
    	   putcode(nsc_ptr);	/* pointer to nsc */
	elsenz(ilflagrt);
     	   add(strt,one,tmprt);	
   	   putcode(IFZFUNC);	/* brach to start of scan (NSC) if ct<strt+1 */
	   putcode((codeint)ct);
	   putcode((codeint)tmprt);
    	   putcode(nsc_ptr);	/* pointer to nsc */
	   modn(ct, bsval, tmprt);
    	   putcode(IFZFUNC);	/* brach to start of scan (NSC) if ct%bs */
	   putcode((codeint)zero);
	   putcode((codeint)tmprt);
    	   putcode(nsc_ptr);	/* pointer to nsc */
	endif(ilflagrt);
      }
      else
      {
    	   putcode(IFZFUNC);	/* brach to start of scan (NSC) if ct<nt */
	   putcode((codeint)ct);
	   putcode((codeint)ntrt);
    	   putcode(nsc_ptr);	/* pointer to nsc */
      }
    }
    else
    {
    	putcode(BRANCH);	/* brach back to start of scan (NSC) */
    	putcode(nsc_ptr);	/* pointer to nsc */
    }
}
Esempio n. 5
0
pulsesequence()
{

/* menu variables */
double  slice_str,pe_length,read_str,power,angle,TR,TIR,slice_coffset;
double  trim_read,trim_slice,freqir,encode_on,read_on,ir_on,sel_crush;


/* internal variables */
double  pe_length_eff,GPmin,GPstep;
double  aq_time,area_readout,read_rephase_str,GRR,GRead,freqreadout;
double  slice_rephase_str,area_slice,GSR,GSS,GCR2,grad_factor;
double  time[5],cycle_time,start_cycle[20],relaxation,finish_time;
double  powir,powexcite,sel_length,pe_step,pe_min;
double  slice_offset[128],GCR1,ir_str;
double  B1_90,B1_excite,extra_TE;
double  rf_max,ir_len,cur_angle,ramp_lenr,ramp_lens;

int     a;




read_str = getval("Read_Str");
slice_str = getval("Slice_Str");
pe_length = getval("PE_length");
ir_str = getval("IR_Grad_Str");
sel_crush = getval("Sel_Crush");
ramp_lenr = getval("ramp_lenr");
ramp_lens = getval("ramp_lens");
extra_TE = getval("extra_TE");


TIR = getval("TIR");
TR = getval("TR");

power=getval("Power");
angle = getval("angle");

trim_slice = getval("Slice_Trim");
trim_read = getval("Read_Trim");

freqreadout = getval("Read_Offset");
freqir = getval("IR_Offset");

encode_on=getval("encode_on");
read_on=getval("read_on");
ir_on=getval("ir_on");

/* rf_max = getval("rf_max"); */
ir_len = getval("ir_len");
cur_angle = getval("cur_angle");


/* rf length calculation and offset lists #0*/
sel_length = 0.003*(1000.0/(slice_str*thk));

for (a=0;a<ns;a++)
 {
 slice_offset[a] = pss[a]* 10.0 * slice_str;
 
 }





GCR2 = sel_crush * HZ_TO_GAUSS;
GSS = slice_str * HZ_TO_GAUSS;

/* phase encoding */
pe_length_eff = (2.0/3.14159)*pe_length;
pe_step = 1.0/(lpe*10.0*pe_length_eff);
pe_min = pe_step*(nv/2);
GPmin =  pe_min * HZ_TO_GAUSS;
GPstep = -pe_step * HZ_TO_GAUSS;

/* rephase for readout */
aq_time = at;
grad_factor = sw/((double)read_str*lro*10.0);
area_readout = (0.001 + (ramp_lenr*0.001/2.0) + (aq_time/2)) * read_str*grad_factor;
read_rephase_str = -1.0*area_readout/pe_length_eff;
GRR = read_rephase_str * HZ_TO_GAUSS * trim_read;
GRead = read_str * HZ_TO_GAUSS*grad_factor;

/* rephase the slice */
area_slice = ((sel_length/2) + (ramp_lens*0.001/2.0))*slice_str;
slice_rephase_str = -1.0*area_slice/pe_length_eff;
GSR = slice_rephase_str * HZ_TO_GAUSS*trim_slice;

/* calculate the rf levels */
B1_90 = (slice_str*thk/1000.0)* B1_SINC3S;
B1_excite = B1_90*(cur_angle/90.0);
powexcite = (B1_excite/1000.0)*4096.0;
powir = 4096.0;


/* calculate the  timing */
if (ir_on==1)
	time[0] = 0.011 + ir_len*0.001 + 0.0001;
else
	time[0] = 0.0001;
	
/* ir */
time[1] =  sel_length + (2*ramp_lens*0.001) + 0.001;            /* slice select */
time[2] =  extra_TE+ pe_length;                                 /* phase encoding etc. */
time[3] =  aq_time + (2*ramp_lenr*0.001)+0.001;                 /* acquisition window */
time[4] =  pe_length;                                           /* rewind */

cycle_time = time[1]+time[2]+time[3]+time[4];
  

/*  printf("\nCycle Time = %f",cycle_time);  */

create_offset_list(slice_offset,ns,OBSch,0);

/*
   for (a=0;a<ns;a++)
   printf("\nOffset %d = %f",a,slice_offset[a]); 
*/

GCR1 = ir_str * HZ_TO_GAUSS;

if (ir_on==1)
	start_cycle[0] = 0.011 + TIR;
else
	start_cycle[0] = 0.0001;

finish_time = start_cycle[0] + (ns*ne*cycle_time);
/* printf("\n Finish Time = %f",finish_time); */
relaxation = TR - finish_time;




/* START THE PULSE SEQUENCE */
assign(v10,zero);
assign(v11,zero);
initval(ne,v7);
status(A);
obspower(power);

/* begin phase encode loop */
peloop(seqcon[2],nv,v1,v2);

        delay(relaxation);

        /* ir */
        obspwrf(powir);
        obsoffset(freqir);
        if (ir_on==1)
          {
           shaped_pulse("HYPSEC4",ir_len*0.001,v10,rof1,rof2);
           obl_shapedgradient("","CRUSH","",0.011,0,GCR1,0,1,WAIT);
           zero_all_gradients();
           delay(TIR-0.011);
          }
          
        delay(0.0001);

        

        loop(v7,v8); /* loop over T1 times measured */
                
                msloop(seqcon[1],ns,v5,v6);   /* loop over slices */

                        /* slice selection readout */
                        obspwrf(powexcite);
                        voffset(0,v6);
                        obl_shapedgradient("","","RAMPUP",ramp_lens*0.001,0,0,GSS,1,WAIT);
                        obl_shapedgradient("","","CONST",sel_length+0.001,0,0,GSS,1,NOWAIT);
                        delay(0.001);
                        shaped_pulse("SINC3S",sel_length,v11,rof1,rof2);
                        obl_shapedgradient("","","RAMPDN",ramp_lens*0.001,0,0,GSS,1,WAIT);
                        zero_all_gradients();
                        
                        delay(extra_TE);

                        /* encode and rephasing */
                        if ((read_on==1)&&(encode_on==1))
                                pe3_shapedgradient("SINUSOID",pe_length,GRR,GPmin,GSR,0,GPstep,0,zero,v2,zero);
                        if ((read_on!=1)&&(encode_on==1))
                                pe3_shapedgradient("SINUSOID",pe_length,0,GPmin,GSR,0,GPstep,0,zero,v2,zero);
                        if ((read_on!=1)&&(encode_on!=1))
                                pe3_shapedgradient("SINUSOID",pe_length,0,0,GSR,0,0,0,zero,zero,zero);
                        if ((read_on==1)&&(encode_on!=1))
                                pe3_shapedgradient("SINUSOID",pe_length,GRR,0,GSR,0,0,0,zero,zero,zero);
                                
                                
                                        
                        zero_all_gradients();
        
                        /* readout */
                        obsoffset(freqreadout);
                        if (read_on==1)
                        {
                          obl_shapedgradient("RAMPUP","","",ramp_lenr*0.001,GRead,0,0,1,WAIT);
                          obl_shapedgradient("CONST","","",at+0.001,GRead,0,0,1,NOWAIT);
                          delay(0.001);
                          acquire(np,1.0/(sw));
                          obl_shapedgradient("RAMPDN","","",ramp_lenr*0.001,GRead,0,0,1,WAIT);
                          zero_all_gradients();
                         }
                         else
                         {
                          delay(0.001);
                          acquire(np,1.0/(sw));
                          } 

                        /* rewind and crush */
                        if (encode_on==1)
                        {
                         pe3_shapedgradient("SINUSOID",pe_length,0,-GPmin,GCR2,0,-GPstep,0,zero,v2,zero);
                         zero_all_gradients();
                         }
                         else delay(pe_length);
                                                
                endmsloop(seqcon[1],v6);
                
        endloop(v8);
                
endpeloop(seqcon[2],v2);

}
Esempio n. 6
0
pulsesequence()
{
	double  predelay,seqtime,glimit,gshimlim;
	double  gbasex,gbasey,gbasez,del;
	double  shimno;
	double  gdaclim,shimscale;
	double  delx,dely,delz;

    	del = getval("del");
    	gbasex = getval("gbasex");
    	gbasey = getval("gbasey");
    	gbasez = getval("gbasez");
	shimno = getval("shimno");
	shimscale = getval("shimscale");
    	gshimlim = getval("gshimlim");  /* shim dac limit */
	gdaclim = gshimlim*shimscale;  /* gradient dac limit */

//	initparms_sis();

	initval(1, v1);   /* no of complex point segments to acquire */

        seqtime = at+pw+rof1+rof2+te+(2*trise);
        predelay = tr - seqtime;  /* predelay based on tr */
        if (predelay <= 0.0) {
          abort_message("%s: TR too short.  Min TR = %f ms",seqfil,seqtime*1e3);
        }

	/* check if shim limit is exceeded */
	if(shimno > 0) {	
	  glimit = abs(del)+abs(gbasex);
	  if((glimit > gshimlim) || (glimit >= 1600))
	  abort_message("X shim limit exceeded, %5.0f %5.0f %5.0f %5.3f", glimit,gshimlim,del,shimscale);
	  glimit = abs(del)+abs(gbasey);
	  if((glimit > gshimlim)  || (glimit >= 1600))
	    abort_message("Y shim limit exceeded, %5.0f", glimit);
	  glimit = abs(del)+abs(gbasez);
	  if((glimit > gshimlim) || (glimit >= 1600))
	    abort_message("Z shim limit exceeded, %5.0f", glimit);
	}

	delx = 0; dely = 0; delz = 0;
	if(shimno == 1) delx = del;
	if(shimno == 2) dely = del;
	if(shimno == 3) delz = del;

    	settable(t1,4,ph1);    /* initialize phase tables and variables */
    	getelem(t1,ct,v7);     /* 90 deg pulse phase */
	settable(t4,4,phr);
    	getelem(t4,ct,oph);    /* receiver phase */
	initval(1,v3);   
	initval(1,v4);
	initval(1,v5);
	initval(ssc,v6);
	assign(zero,v2);

	status(A);
        rotate();
        
	obspower(tpwr);
	delay(4e-6);
	loop(v6,v8);		/* steady state dummy scans */
	  delay(2*trise);
	  delay(predelay); 
	  pulse(pw,v7);
	  delay(te);
	  delay(at); 
	endloop(v8);

        loop(v1,v2);	        /* compressed acqn not used */
          sub(v2,v3,v9);	/* v9-v11 not used */
	  assign(zero,v10);
	  assign(zero,v11);
          gradient('x',gbasex+delx);
          gradient('y',gbasey+dely);
          gradient('z',gbasez+delz);
          delay(trise);
          delay(predelay);
          pulse(pw,v7);
          delay(te);

          startacq(alfa);
          acquire(np,1.0/sw);
          endacq();
        endloop(v2); 
	delay(trise);           
	zero_all_gradients();
}