Example #1
0
int setup_parfile(int suflag)
{
    double tmp;
    char tmpstr[256];
    int t;
    char *ptr;

    ExpInfo.PSGident = 1;	/* identify as 'C' varient PSG, Java == 100 */

    if ((P_getreal(CURRENT,"priority",&tmp,1)) >= 0)
       ExpInfo.Priority = (int) (tmp + 0.0005);
    else
       ExpInfo.Priority = 0;

    if ((P_getreal(CURRENT,"nt",&tmp,1)) >= 0)
       ExpInfo.NumTrans = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set nt.");
	psg_abort(1);
    }

    if ((P_getreal(CURRENT,"bs",&tmp,1)) >= 0)
       ExpInfo.NumInBS = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set bs.");
	psg_abort(1);
    }
    if (!(var_active("bs",CURRENT)))
       ExpInfo.NumInBS = 0;

    if ((P_getreal(CURRENT,"np",&tmp,1)) >= 0)
       ExpInfo.NumDataPts = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set np.");
	psg_abort(1);
    }

    /* --- Number of FIDs per CT --- */

    if ((P_getreal(CURRENT,"nf",&tmp,1)) >= 0)
    {
	DPRINT2(1,"initacqqueue(): nf = %5.0lf, active = %d \n",
				tmp,var_active("nf",CURRENT));
	if ( (tmp < 2.0 ) || (!(var_active("nf",CURRENT))) )
	{
	    tmp = 1.0;
	}
    }
    else  /* no nf, so set it to one.  */
    {
        tmp = 1.0;
    }
    ExpInfo.NumFids = (int) (tmp + 0.0005);
    if(ExpInfo.NumFids>1)
        ExpInfo.NFmod=ExpInfo.NumFids;
    else
        ExpInfo.NFmod=1;

    if (ExpInfo.NumFids>1 && (P_getreal(CURRENT,"nfmod",&tmp,1)) >= 0 && var_active("nfmod",CURRENT))
    {
         if(tmp<=0 || tmp>ExpInfo.NumFids)
             tmp=ExpInfo.NumFids;
         ExpInfo.NFmod=(int) (tmp + 0.0005);
    }

    if (P_getstring(CURRENT,"dp",tmpstr,1,4) < 0)
    {   text_error("initacqqueue(): cannot get dp");
	psg_abort(1);
    }
    ExpInfo.DataPtSize = (tmpstr[0] == 'y') ? 4 : 2;

    /* --- receiver gain --- */

    if ((P_getreal(CURRENT,"gain",&tmp,1)) >= 0)
       ExpInfo.Gain = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set gain.");
	psg_abort(1);
    }

    /* --- sample spin rate --- */

    if ((P_getreal(CURRENT,"spin",&tmp,1)) >= 0)
       ExpInfo.Spin = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set spin.");
	psg_abort(1);
    }

    /* --- completed transients (ct) --- */

    if ((P_getreal(CURRENT,"ct",&tmp,1)) >= 0)
       ExpInfo.CurrentTran = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set ct.");
	psg_abort(1);
    }

    /* --- number of fids --- */

    if ((P_getreal(CURRENT,"arraydim",&tmp,1)) >= 0)
       ExpInfo.ArrayDim = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot read arraydim.");
	psg_abort(1);
    }

    if ((P_getreal(CURRENT,"acqcycles",&tmp,1)) >= 0)
	ExpInfo.NumAcodes = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot read acqcycles.");
	psg_abort(1);
    }

    ExpInfo.FidSize = ExpInfo.DataPtSize * ExpInfo.NumDataPts * ExpInfo.NumFids;
    ExpInfo.DataSize = sizeof(struct datafilehead);
    ExpInfo.DataSize +=  (unsigned long long) (sizeof(struct datablockhead) + ExpInfo.FidSize) *
                         (unsigned long long) ExpInfo.ArrayDim;

    /* --- path to the user's experiment work directory  --- */

    if (P_getstring(GLOBAL,"userdir",tmpstr,1,255) < 0)
    {   text_error("initacqqueue(): cannot get userdir");
	psg_abort(1);
    }
    strcpy(ExpInfo.UsrDirFile,tmpstr);

    if (P_getstring(GLOBAL,"systemdir",tmpstr,1,255) < 0)
    {   text_error("initacqqueue(): cannot get systemdir");
	psg_abort(1);
    }
    strcpy(ExpInfo.SysDirFile,tmpstr);

    if (P_getstring(GLOBAL,"curexp",tmpstr,1,255) < 0)
    {   text_error("initacqqueue(): cannot get curexp");
	psg_abort(1);
    }
    strcpy(ExpInfo.CurExpFile,tmpstr);

    /* multiple reciever mapping for recvproc */
    ExpInfo.RvcrMapping[0] = (char) 0;
    RcvrMapStr("rcvrs",ExpInfo.RvcrMapping);
    if (bgflag) fprintf(stdout," [[[[[[[[[-->>  RcvrMapStr: '%s'\n",ExpInfo.RvcrMapping);

    /* --- suflag					*/
    ExpInfo.GoFlag = suflag;

    /* --------------------------------------------------------------
    |      Unique name to this GO,
    |      vnmrsystem/acqqueue/id is path to acq proccess files
    |
    |      Notice that goid is an array of strings, with each
    |      element having a carefully defined meaning.
    +-----------------------------------------------------------------*/

    if (P_getstring(CURRENT,"goid",infopath,1,255) < 0)
    {   text_error("initacqqueue(): cannot get goid");
	psg_abort(1);
    }
    strcpy(ExpInfo.InitCodefile,infopath);
    strcat(ExpInfo.InitCodefile,".init");
    strcpy(ExpInfo.PreCodefile,infopath);
    strcat(ExpInfo.PreCodefile,".pre");
    strcpy(ExpInfo.PSCodefile,infopath);
    strcat(ExpInfo.PSCodefile,".ps");
    strcpy(ExpInfo.PostCodefile,infopath);
    strcat(ExpInfo.PostCodefile,".post");

    strcpy(ExpInfo.RTParmFile,infopath);
    strcat(ExpInfo.RTParmFile,".RTpars");
    strcpy(ExpInfo.AcqRTTablefile,infopath);
    strcat(ExpInfo.AcqRTTablefile,".init.InitAcqObject");
    strcpy(ExpInfo.WaveFormFile,infopath);
    strcat(ExpInfo.WaveFormFile,".pat");

    /* Beware that infopath gets accessed again
       if acqiflag is set, for the data file path */

    /* --- file path to named acqfile or exp# acqfile  'file' --- */

    strcpy(ExpInfo.VpMsgID,"");
    if (!acqiflag)
    {
      int autoflag;
      char autopar[12];

      if (P_getstring(CURRENT,"exppath",tmpstr,1,255) < 0)
      {   text_error("initacqqueue(): cannot get exppath");
	  psg_abort(1);
      }
      strcpy(ExpInfo.DataFile,tmpstr);
      ExpInfo.InteractiveFlag = 0;
      if (getparm("auto","string",GLOBAL,autopar,12))
          autoflag = 0;
      else
          autoflag = ((autopar[0] == 'y') || (autopar[0] == 'Y'));
      ExpInfo.ExpFlags = 0;
      if (autoflag)
      {
         strcat(ExpInfo.DataFile,".fid");
	 ExpInfo.ExpFlags |= AUTOMODE_BIT;  /* set automode bit */
      }
      if ( ! P_getstring(CURRENT,"vpmode",autopar,1,12) && (autopar[0] == 'y') )
      {
         ExpInfo.ExpFlags |= VPMODE_BIT;  /* set vpmode bit */
         if (P_getstring(CURRENT,"VPaddr",tmpstr,1,255) >= 0)
           strcpy(ExpInfo.VpMsgID,tmpstr);
      }
      if (ra_flag)
         ExpInfo.ExpFlags |=  RESUME_ACQ_BIT;  /* set RA bit */
      if (clr_at_blksize_mode)
	  ExpInfo.ExpFlags |=  CLR_AT_BS_BIT; /* For "Repeat Scan" */
    }
    else
    {
      strcpy(ExpInfo.DataFile,infopath);
      strcat(ExpInfo.DataFile,".Data");
      ExpInfo.InteractiveFlag = 1;
      ExpInfo.ExpFlags = 0;
    }

    if (P_getstring(CURRENT,"goid",tmpstr,2,255) < 0)
    {   text_error("initacqqueue(): cannot get goid: user");
	psg_abort(1);
    }
    strcpy(ExpInfo.UserName,tmpstr);

    if (P_getstring(CURRENT,"goid",tmpstr,3,255) < 0)
    {   text_error("initacqqueue(): cannot get goid: exp number");
	psg_abort(1);
    }
    ExpInfo.ExpNum = atoi(tmpstr);

    if (P_getstring(CURRENT,"goid",tmpstr,4,255) < 0)
    {   text_error("initacqqueue(): cannot get goid: exp");
	psg_abort(1);
    }
    strcpy(ExpInfo.AcqBaseBufName,tmpstr);

    if (P_getstring(GLOBAL,"vnmraddr",tmpstr,1,255) < 0)
    {   text_error("initacqqueue(): cannot get vnmraddr");
	psg_abort(1);
    }
    strcpy(ExpInfo.MachineID,tmpstr);

    /* --- interleave parameter 'il' --- */

    if (P_getstring(CURRENT,"il",tmpstr,1,4) < 0)
    {   text_error("initacqqueue(): cannot get il");
	psg_abort(1);
    }
    ExpInfo.IlFlag = ((tmpstr[0] != 'n') && (tmpstr[0] != 'N')) ? 1 : 0;
    if (ExpInfo.IlFlag)
    {
	if (ExpInfo.NumAcodes <= 1) ExpInfo.IlFlag = 0;
	if (ExpInfo.NumInBS == 0) ExpInfo.IlFlag = 0;
	if (ExpInfo.NumTrans <= ExpInfo.NumInBS) ExpInfo.IlFlag = 0;
    }

    /* --- current element 'celem' --- */

    if ((P_getreal(CURRENT,"celem",&tmp,1)) >= 0)
       ExpInfo.Celem = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set celem.");
	psg_abort(1);
    }

    /* --- Check for valid RA --- */
    ExpInfo.RAFlag = 0;		/* RaFlag */
    if (ra_flag)
    {
    	/* --- Do RA stuff --- */
	ExpInfo.RAFlag = 1;		/* RaFlag */
	if (ExpInfo.IlFlag)
	{
	   if ((ExpInfo.CurrentTran % ExpInfo.NumInBS) != 0)
	   	ExpInfo.Celem = ExpInfo.Celem - 1;
	   else
	   {
		if ((ExpInfo.Celem < ExpInfo.NumAcodes) &&
			(ExpInfo.CurrentTran >= ExpInfo.NumInBS))
		   ExpInfo.CurrentTran = ExpInfo.CurrentTran - ExpInfo.NumInBS;
	   }
	}
	else
	{
    	   if ((ExpInfo.CurrentTran > 0) && (ExpInfo.CurrentTran <
						ExpInfo.NumTrans))
	   	ExpInfo.Celem = ExpInfo.Celem - 1;
    	   if ((ExpInfo.CurrentTran == ExpInfo.NumTrans) &&
				(ExpInfo.Celem < ExpInfo.NumAcodes))
		   ExpInfo.CurrentTran = 0;
	}
    	if ((ExpInfo.Celem < 0) || (ExpInfo.Celem >= ExpInfo.NumAcodes))
	   ExpInfo.Celem = 0;
    	ExpInfo.CurrentElem = ExpInfo.Celem;
    	/* fprintf(stdout,"initacqparms: Celem = %d\n",ExpInfo.Celem); */
    }

    /* --- when_mask parameter  --- */

    if ((P_getreal(CURRENT,"when_mask",&tmp,1)) >= 0)
       ExpInfo.ProcMask = (int) (tmp + 0.0005);
    else
    {   text_error("initacqqueue(): cannot set when_mask.");
	psg_abort(1);
    }

    ExpInfo.ProcWait = (option_check("wait")) ? 1 : 0;
    ExpInfo.DspGainBits = 0;
    ExpInfo.DspOversamp = 0;
    ExpInfo.DspOsCoef = 0;
    ExpInfo.DspSw = 0.0;
    ExpInfo.DspFb = 0.0;
    ExpInfo.DspOsskippts = 0;
    ExpInfo.DspOslsfrq = 0.0;
    ExpInfo.DspFiltFile[0] = '\0';

    ExpInfo.UserUmask = umask(0);
    umask( ExpInfo.UserUmask );		/* make sure the process umask does not change */

    /* fill in the account info */
    strcpy(tmpstr,ExpInfo.SysDirFile);
    strcat(tmpstr,"/adm/accounting/acctLog.xml");
    if ( access(tmpstr,F_OK) != 0)
    {
       ExpInfo.Billing.enabled = 0;
    }
    else
    {
        ExpInfo.Billing.enabled = 1;
    }
        t = time(0);
        ExpInfo.Billing.submitTime = t;
        ExpInfo.Billing.startTime  = t;
        ExpInfo.Billing.doneTime   = t;
        if (P_getstring(GLOBAL, "operator", tmpstr, 1, 255) < 0)
           ExpInfo.Billing.Operator[0]='\000';
        else
           strncpy(ExpInfo.Billing.Operator,tmpstr,200);
        if (P_getstring(CURRENT, "account", tmpstr, 1, 255) < 0)
           ExpInfo.Billing.account[0]='\000';
        else
           strncpy(ExpInfo.Billing.account,tmpstr,200);
        if (P_getstring(CURRENT, "pslabel", tmpstr, 1, 255) < 0)
           ExpInfo.Billing.seqfil[0]='\000';
        else
           strncpy(ExpInfo.Billing.seqfil,tmpstr,200);
        ptr = strrchr(infopath,'/');
        if ( ptr )
        {
           ptr++;
           strncpy(ExpInfo.Billing.goID, ptr ,200);
        }
        else
        {
           ExpInfo.Billing.goID[0]='\000';
        }
    return(0);
}
Example #2
0
File: cps.c Project: timburrow/ovj3
/*-----------------------------------------------------------------
|	initparms()/
|	initializes the main variables used
+------------------------------------------------------------------*/
void initparms()
{
    double tmpval;
    char   tmpstr[36];
    int    tmp, getchan;

    sw = getval("sw");
    np = getval("np");

    if ( P_getreal(CURRENT,"nf",&nf,1) < 0 )
    {
        nf = 0.0;                /* if not found assume 0 */
    }
    if (nf < 2.0)
	nf = 1.0;

    nt = getval("nt");
    sfrq = getval("sfrq");

    filter = getval("filter");		/* pulse Amp filter setting */
    tof = getval("tof");
    bs = getval("bs");
    if (!var_active("bs",CURRENT))
	bs = 0.0;
    pw = getval("pw");
    pw90 = getval("pw90");
    p1 = getval("p1");

    pwx = getvalnwarn("pwx");
    pwxlvl = getvalnwarn("pwxlvl");
    tau = getvalnwarn("tau");
    satdly = getvalnwarn("satdly");
    satfrq = getvalnwarn("satfrq");
    satpwr = getvalnwarn("satpwr");
    getstrnwarn("satmode",satmode);

    /* ddr */
    roff=getvalnwarn("roff");

    /* --- delays --- */
    d1 = getval("d1"); 		/* delay */
    d2 = getval("d2"); 		/* a delay: used in 2D experiments */
    d3 = getvalnwarn("d3");	/* a delay: used in 3D experiments */
    d4 = getvalnwarn("d4");	/* a delay: used in 4D experiments */
    phase1 = (int) sign_add(getvalnwarn("phase"),0.005);
    phase2 = (int) sign_add(getvalnwarn("phase2"),0.005);
    phase3 = (int) sign_add(getvalnwarn("phase3"),0.005);
    rof1 = getval("rof1"); 	/* Time receiver is turned off before pulse */
    rof2 = getval("rof2");	/* Time after pulse before receiver turned on */
    alfa = getval("alfa"); 	/* Time after rec is turned on that acqbegins */
    pad = getval("pad"); 	/* Pre-acquisition delay */
    padactive = var_active("pad",CURRENT);
    hst = getval("hst"); 	/* HomoSpoil delay */


    tpwr = getval("tpwr");
    if ( P_getreal(CURRENT,"tpwrm",&tpwrf,1) < 0 )
       if ( P_getreal(CURRENT,"tpwrf",&tpwrf,1) < 0 )
          tpwrf = 4095.0;

    //getstr("rfband",rfband);	/* RF band, high or low */

    getstr("hs",hs);
    hssize = strlen(hs);
    /* setlockmode(); */		/* set up lockmode variable,h**o bits */
    if (bgflag)
    {
      fprintf(stderr,"sw = %lf, sfrq = %10.8lf\n",sw,sfrq);
      fprintf(stderr,"hs='%s',%d\n",hs,hssize);
    }
    gain = getval("gain");

    gainactive = var_active("gain",CURRENT); /* non arrayable */
    /* InterLocks is set by go.  It will have three chars.
     * char 0 is for lock
     * char 1 is for spin
     * char 2 is for temp
     */
    getstr("interLocks",interLock); /* non arrayable */
    spin = (int) sign_add(getval("spin"),0.005);
    spinactive = var_active("spin",CURRENT); /* non arrayable */
    HSrotor = 0;  /* high speed spinner selected */
    /* spinTresh is created and set by go.c inside Vnmrbg */
    if (spin >= (int) sign_add(getval("spinThresh"),0.005))
    {
       /* Selected Solids spinner */
       HSrotor = 1;
    }
    vttemp = getval("temp");	/* get vt temperature */
    tempactive = var_active("temp",CURRENT); /* non arrayable */
    vtwait = getval("vtwait");	/* get vt timeout setting */
    vtc = getval("vtc");	/* get vt timeout setting */
    if (getparm("traymax","real",GLOBAL,&tmpval,1))
    {
      traymax=0;
    }
    else
    {
      traymax= (int) (tmpval + 0.5);
    }

    if (getparm("loc","real",GLOBAL,&tmpval,1))
	psg_abort(1);
    loc = (int) sign_add(tmpval,0.005);
    if (!var_active("loc",GLOBAL) || (loc<0) )
    {
        locActive = 0;
        loc = 0;
        tmpval = 0.0;
        if (setparm("loc","real",GLOBAL,&tmpval,1))
          psg_abort(1);
    }
    else
      locActive = 1;

    /* if using Gilson Liquid Handler Racks then gilpar is defined
     * and is an array of 4 values */
    if ((traymax == 96) || (traymax == (8*96)))  /* test for Gilson/Hermes */
    {
       int trayloc=1;
       int trayzone=1;

       if ( P_getreal(GLOBAL, "vrack", &tmpval, 1) >= 0 )
          trayloc = (int) (tmpval + 0.5);

       if ( P_getreal(GLOBAL, "vzone", &tmpval, 1) >= 0 )
          trayzone = (int) (tmpval + 0.5);

       /* rrzzllll */
       loc = loc + (10000 * trayzone) + (1000000 * trayloc);
       if (bgflag)
          fprintf(stderr,"GILSON: ----- vrack: %d, vzone: %d, Encoded Loc = %d\n",trayloc,trayzone,loc);
    }

    getstr("alock",alock);
    getstr("wshim",wshim);
    getlockmode(alock,&lockmode);		/* type of autolocking */
    whenshim = setshimflag(wshim,&shimatanyfid); /* when to shim */
    if ( ( tmp=P_getstring(CURRENT, "sampling", tmpstr, 1, 20)) >= 0)
    {
       samplingScale = 1.01;
       samplingAngle = 0.0;
       samplingTransX = 0.0;
       samplingTransY = 0.0;
       if (tmpstr[0] == 'e')
       {
          double rtmp = 0.0;
          sampling = SAMPLING_ELLIPTICAL;
          P_getreal(CURRENT, "ni", &rtmp, 1);
          samplingRows = (int) rtmp;
          rtmp = 0.0;
          P_getreal(CURRENT, "ni2", &rtmp, 1);
          samplingCols = (int) rtmp;
          if ((samplingRows < 2) || (samplingCols < 2))
             sampling = SAMPLING_STANDARD;
          if (sampling == SAMPLING_ELLIPTICAL)
          {
             if ( P_getreal(CURRENT, "samplingEScale", &rtmp, 1) >= 0)
                samplingScale = rtmp;
             if ( P_getreal(CURRENT, "samplingEAngle", &rtmp, 1) >= 0)
                samplingAngle = rtmp;
             if ( P_getreal(CURRENT, "samplingETransX", &rtmp, 1) >= 0)
                samplingTransX = rtmp;
             if ( P_getreal(CURRENT, "samplingETransY", &rtmp, 1) >= 0)
                samplingTransY = rtmp;
          }
       }
       else
          sampling = SAMPLING_STANDARD;
    }
    else
       sampling = SAMPLING_STANDARD;
// this looks REDUNDANT to instantiation...
    // but is not completely dpwrf
    if ( ( tmp=P_getstring(CURRENT, "dn", tmpstr, 1, 9)) >= 0)
       getchan = TRUE;
    else
       getchan = FALSE;
    /* if "dn" does not exist, don't bother with the rest of channel 2 */
    getchan = (NUMch > 1) && getchan && (tmpstr[0]!='\000');
    if (getchan)		/* variables associated with 2nd channel */
    {
       dfrq = getval("dfrq");
       dmf  = getval("dmf");		/* 1st decoupler modulation freq */
       dof  = getval("dof");
       dres = getvalnwarn("dres");	/* prg decoupler digital resolution */
       if (dres < 1.0) dres = 1.0;
       getstrnwarn("dseq",dseq);

          dpwr = getval("dpwr");
          dhp     = 0.0;
          dlp     = 0.0;

       if ( P_getreal(CURRENT,"dpwrm",&dpwrf,1) < 0 )
          if ( P_getreal(CURRENT,"dpwrf",&dpwrf,1) < 0 )
             dpwrf = 4095.0;
       getstr("dm",dm);
       dmsize = strlen(dm);
       getstr("dmm",dmm);
       dmmsize = strlen(dmm);
       getstr("h**o",h**o);
       homosize = strlen(h**o);
    }
    else
    {
       dfrq    = 1.0;
       dmf     = 1000;
       dof     = 0.0;
       dres    = 1.0;
       dseq[0] = '\000';
       dhp     = 0.0;
       dlp     = 0.0;
       dpwr    = 0.0;
       dpwrf   = 0.0;
       strcpy(dm,"n");
       dmsize  = 1;
       strcpy(dmm,"c");
       dmmsize = 1;
       strcpy(h**o,"n");
       homosize= 1;
    }
    if (bgflag)
    {
       if (!getchan)
          fprintf(stderr,"next line are default values for chan 2\n");
       fprintf(stderr,"dm='%s',%d, dmm='%s',%d\n",dm,dmsize,dmm,dmmsize);
       fprintf(stderr,"h**o='%s',%d\n",h**o,homosize);
    }

    if ( (tmp=P_getstring(CURRENT, "dn2", tmpstr, 1, 9)) >= 0)
       getchan = TRUE;
    else
       getchan = FALSE;
    /* if "dn2" does not exist, don't bother with the rest of channel 3 */
    getchan = (NUMch > 2) && getchan && (tmpstr[0]!='\000');
    if (getchan)			/* variables associated with 3rd channel */
    {
      dfrq2 = getval("dfrq2");
      dmf2  = getval("dmf2");		/* 2nd decoupler modulation freq */
      dof2  = getval("dof2");
      dres2 = getvalnwarn("dres2");	/* prg decoupler digital resolution */
      if (dres2 < 1.0) dres2 = 1.0;
      getstrnwarn("dseq2",dseq2);
      dpwr2 = getval("dpwr2");
      if ( P_getreal(CURRENT,"dpwrm2",&dpwrf2,1) < 0 )
         if ( P_getreal(CURRENT,"dpwrf2",&dpwrf2,1) < 0 )
            dpwrf2 = 4095.0;
      getstr("dm2",dm2);
      dm2size = strlen(dm2);
      getstr("dmm2",dmm2);
      dmm2size = strlen(dmm2);
      getstr("homo2",homo2);
      homo2size = strlen(homo2);
    }
    else
    {
       dfrq2    = 1.0;
       dmf2     = 1000;
       dof2     = 0.0;
       dres2    = 1.0;
       dseq2[0] = '\000';
       dpwr2    = 0.0;
       dpwrf2   = 0.0;
       strcpy(dm2,"n");
       dm2size  = 1;
       strcpy(dmm2,"c");
       dmm2size = 1;
       strcpy(homo2,"n");
       homo2size= 1;
    }
    if (bgflag)
    {
       if (!getchan)
          fprintf(stderr,"next two lines are default values for chan 3\n");
       fprintf(stderr,"dfrq2 = %10.8lf, dof2 = %10.8lf, dpwr2 = %lf\n",
	   dfrq2,dof2,dpwr2);
       fprintf(stderr,"dmf2 = %10.8lf, dm2='%s',%d, dmm2='%s',%d\n",
	   dmf2,dm2,dm2size,dmm2,dmm2size);
       fprintf(stderr,"homo2='%s',%d\n",homo2,homo2size);
    }

    if ( (tmp=P_getstring(CURRENT, "dn3", tmpstr, 1, 9)) >= 0)
       getchan = TRUE;
    else
       getchan = FALSE;
    /* if "dn3" does not exist, don't bother with the rest of channel 3 */
    getchan = (NUMch > 3) && getchan && (tmpstr[0]!='\000');
    if (getchan)			/* variables associated with 3rd channel */
    {
      dfrq3 = getval("dfrq3");
      dmf3  = getval("dmf3");		/* 3nd decoupler modulation freq */
      dof3  = getval("dof3");
      dres3 = getvalnwarn("dres3");	/* prg decoupler digital resolution */
      if (dres3 < 1.0) dres3 = 1.0;
      getstrnwarn("dseq3",dseq3);
      dpwr3 = getval("dpwr3");
      if ( P_getreal(CURRENT,"dpwrm3",&dpwrf3,1) < 0 )
         if ( P_getreal(CURRENT,"dpwrf3",&dpwrf3,1) < 0 )
            dpwrf3 = 4095.0;
      getstr("dm3",dm3);
      dm3size = strlen(dm3);
      getstr("dmm3",dmm3);
      dmm3size = strlen(dmm3);
      getstr("homo3",homo3);
      homo3size = strlen(homo3);
    }
    else
    {
       dfrq3    = 1.0;
       dmf3     = 1000;
       dof3     = 0.0;
       dres3    = 1.0;
       dseq3[0] = '\000';
       dpwr3    = 0.0;
       dpwrf3   = 0.0;
       strcpy(dm3,"n");
       dm3size  = 1;
       strcpy(dmm3,"c");
       dmm3size = 1;
       strcpy(homo3,"n");
       homo3size= 1;
    }

    if (bgflag)
    {
       if (!getchan)
          fprintf(stderr,"next two lines are default values for chan 3\n");
       fprintf(stderr,"dfrq3 = %10.8lf, dof3 = %10.8lf, dpwr3 = %lf\n",
	   dfrq3,dof3,dpwr3);
       fprintf(stderr,"dmf3 = %10.8lf, dm3='%s',%d, dmm3='%s',%d\n",
	   dmf3,dm3,dm3size,dmm3,dmm3size);
       fprintf(stderr,"homo3='%s',%d\n",homo3,homo3size);
    }

    if ( (tmp=P_getstring(CURRENT, "dn4", tmpstr, 1, 9)) >= 0)
       getchan = TRUE;
    else
       getchan = FALSE;
    /* if "dn4" does not exist, don't bother with the rest of channel 4 */
    getchan = (NUMch > 4) && getchan && (tmpstr[0]!='\000');
    if (getchan)			/* variables associated with 4th channel */
    {
      dfrq4 = getval("dfrq4");
      dmf4  = getval("dmf4");		/* 4nd decoupler modulation freq */
      dof4  = getval("dof4");
      dres4 = getvalnwarn("dres4");	/* prg decoupler digital resolution */
      if (dres4 < 1.0) dres4 = 1.0;
      getstrnwarn("dseq4",dseq4);
      dpwr4 = getval("dpwr4");
      if ( P_getreal(CURRENT,"dpwrm4",&dpwrf4,1) < 0 )
         if ( P_getreal(CURRENT,"dpwrf4",&dpwrf4,1) < 0 )
            dpwrf4 = 4095.0;
      getstr("dm4",dm4);
      dm4size = strlen(dm4);
      getstr("dmm4",dmm4);
      dmm4size = strlen(dmm4);
      getstr("homo4",homo4);
      homo4size = strlen(homo4);
    }
    else
    {
       dfrq4    = 1.0;
       dmf4     = 1000;
       dof4     = 0.0;
       dres4    = 1.0;
       dseq4[0] = '\000';
       dpwr4    = 0.0;
       dpwrf4   = 0.0;
       strcpy(dm4,"n");
       dm4size  = 1;
       strcpy(dmm4,"c");
       dmm4size = 1;
       strcpy(homo4,"n");
       homo4size= 1;
    }

    if (bgflag)
    {
       if (!getchan)
          fprintf(stderr,"next two lines are default values for chan 4\n");
       fprintf(stderr,"dfrq4 = %10.8lf, dof4 = %10.8lf, dpwr4 = %lf\n",
	   dfrq4,dof4,dpwr4);
       fprintf(stderr,"dmf4 = %10.8lf, dm4='%s',%d, dmm4='%s',%d\n",
	   dmf4,dm4,dm4size,dmm4,dmm4size);
       fprintf(stderr,"homo4='%s',%d\n",homo4,homo4size);
    }
// end of REDUNDANT ???
}
Example #3
0
/*-----------------------------------------------------------------
|
|	initacqparms()
|	initialize acquisition parameters pass in code section
|
|   get experimental parameters and setup data pointers
|				Author Greg Brissey 6/26/86
|   Note: setup_parfile should be executed before this routine.
|   Modified   Author     Purpose
|   --------   ------     -------
|   2/10/89   Greg B.    1. Added Code to set low core element lc->acqelemid
|   5/2/91    Greg B.    1. low core element lc->acqelemid is a int now
+---------------------------------------------------------------*/
void initacqparms(unsigned int fidn)
{
    char dp[MAXSTR];
    char cp[MAXSTR];
    char ok2bumpstr[MAXSTR];
    int np_words;	/* total # of data point words */
    int ss;		/* steady state count */
    int cttime;		/* #CTs between screen updates to Host */
    int dpflag;		/* double precision flag = 2 or 4 */
    int blocks;		/*  data size in blocks  (256words) */
    int asize = 0;		/*  data size in blocks  (256words) */
    int tot_np;		/*  np size */
    int curct = 0;
    int bsct4ra;
    double tmpval;

    /* initialize lc */
    std_lc_init();

    /* --- calc. CTs between updates of CT to Host CPU --- */
    if ( P_getreal(CURRENT,"cttime",&tmpval,1) < 0 )
    {
        tmpval = 0.0;                /* if not found assume 0 */
    }
    cttime = (int) (sign_add(tmpval, 0.0005));
    if (cttime < 1)
	cttime = 5;	/* update every 5 secs */
    cttime = (int) ((double) cttime / (d1+ (np/sw) + 0.1));
    ss2val = 0;
    if (!var_active("ss",CURRENT))
    {
	ss = 0;
    }
    else
    {
        ss = (int) (sign_add(getval("ss"), 0.0005));
        if (ss >= 0)
        {
           if ( P_getreal(CURRENT,"ss2",&tmpval,1) >= 0 )
           {
              if (var_active("ss2",CURRENT))
              {
                 ss2val = sign_add(tmpval, 0.0005);
                 if (ss2val < 1)
                    ss2val = 0;
              }
           }
        }
    }
    if (ss != 0)
        cttime = 0; 		/* no ct display with steady state */
    else if ( cttime > 32767)
        cttime = 32767;		/* max ct between updates */
    else if (cttime < 1)
        cttime = 1;

    /* --- completed transients (ct) --- */

    if ((P_getreal(CURRENT,"ct",&tmpval,1)) >= 0)
    {
       curct = (int) (tmpval + 0.0005);
    }
    else
    {   text_error("initacqparms(): cannot find ct.");
	psg_abort(1);
    }
    bsct4ra = (bs + 0.005);
    if (newacq)               /* test for newacq added at request of DJI, 08/1996 */
    {
        if (bsct4ra > 0)
	  bsct4ra = curct/bsct4ra;

    /* for ra, check nt and ct and interleaving */
    /* for ra, curct handled in  ra_initacqparms or ra_inovaacqparms. */


        if (curct == nt)
        {
	    if (getIlFlag())
	    {
	        if (getStartFidNum() > 1) bsct4ra = bsct4ra - 1;
	    }
	    else
	    {
	        bsct4ra = 0;
	    }
        }
        else
        {
	    if (getIlFlag())
	    {
	        if (getStartFidNum() > 1) bsct4ra = bsct4ra - 1;
	    }
        }
        if (bsct4ra < 0) bsct4ra = 0;
    }


    getstr("dp",dp);

    dpflag = (dp[0] == 'y') ? 4 : 2;	/* single - 2, double - 4  INOVA */


    /* --- setup real time np with total data points to be take --- */
    /*     the STM will expect this many points    */
    /*     data pts * # of fids */
    tot_np = (int) ((int) (np + .0005)) * ((int) (nf + 0.005));

    if (dpflag == 4)
       asize |= 0xC000;
    np_words = tot_np;
    if (dpflag == 4)
        np_words *= 2L; /* double size for double precision data */

    if (bgflag)
	fprintf(stderr,"np: %lf, nf: %lf , asize = %x\n",np,nf,asize);
    blocks = (int) ((np_words + 255L) / 256L);  /* block = 256 words */

    getstr("cp",cp);
    cpflag = (cp[0] == 'y') ? 0 : 1;

    if ( P_getreal(CURRENT,"mxconst",&tmpval,1) < 0 )
    {
        tmpval = 0.0;                /* if not found assume 0 */
    }

    /* Get relaxation delay for acqi and interelement delay */
    if (option_check("qtune"))
    {
        relaxdelay = -1.0;
    }
    else if ( P_getreal(CURRENT,"relaxdelay",&relaxdelay,1) < 0 )
    {
	if (acqiflag)
           relaxdelay  = 0.020;		/* if not found assume 20 millisecs */
	else
           relaxdelay  = 0.0;		/* if not found assume 0 */
    }
    else if (relaxdelay > 2.0)
    {
	text_error("relaxdelay truncated to maximum relaxdelay: 2 sec");
	relaxdelay = 2.0;
    }

    /* Get parser synchronization delay, for testing  */
    if ( P_getreal(CURRENT,"psync",&psync,1) < 0 )
    {
           psync  = 0.020;		/* if not found assume 20 millisecs */
    }

    /* Get parser synchronization delay, for testing  */
    if ( P_getreal(CURRENT,"ldshimdelay",&ldshimdelay,1) < 0 )
    {
      if ( P_getreal(GLOBAL,"ldshimdelay",&ldshimdelay,1) < 0 )
      {
	double tmpshimset;
	ldshimdelay  = 4.5; /* if not found assume 4.5 sec */
	if ( P_getreal(GLOBAL,"shimset",&tmpshimset,1) < 0 )
	{
	   tmpshimset = 1.0;
	}
	if ((int)(tmpshimset) == RRI_SHIMSET)
	   ldshimdelay  = 15.0; /* 15 secs to load RRI shims */
      }
    }
    /* Get parser synchronization delay, for one shim for testing  */
    if ( P_getreal(CURRENT,"oneshimdelay",&oneshimdelay,1) < 0 )
    {
      if ( P_getreal(GLOBAL,"oneshimdelay",&oneshimdelay,1) < 0 )
      {
	double tmpshimset;
	oneshimdelay  = 0.080; /* if not found assume 0.08 for one shim */
	if ( P_getreal(GLOBAL,"shimset",&tmpshimset,1) < 0 )
	{
	   tmpshimset = 1.0;
	}
	if ((int)(tmpshimset) == RRI_SHIMSET)
	   oneshimdelay  = 0.3; /* 0.3 secs to load one RRI shim */
      }
    }

    ok2bumpflag = 0;
    if (P_getstring(CURRENT, "ok2bump", ok2bumpstr, 1, sizeof( ok2bumpstr) - 1 ) >= 0 )
    {
	if (ok2bumpstr[ 0 ] == 'Y' || ok2bumpstr[ 0 ] == 'y')
	  ok2bumpflag = 1;
    }

    xmtrstep = 90.0;
    decstep = 90.0;
    custom_lc_init(
    /* Alc->acqidver    */ (int) ((idc & 0x00ff)),
    /* Alc->acqelemid   */ (int) fidn,
    /* Alc->ctctr    */ (int) cttime,
    /* Alc->acqdsize    */ (int) blocks,
    /* Alc->np       */ (int) tot_np,
    /* Alc->nt       */ (int) (nt + 0.0001),
    /* Alc->dpf      */ (int) dpflag,
    /* Alc->bs       */ (int) (bs + 0.005),
    /* Alc->bsct     */ (int) bsct4ra,
    /* Alc->ss       */ (int) ss,
    /* Alc->asize    */ (int) asize,
    /* Alc->acqcpf      */ (int) cpflag,
    /* Alc->acqmaxconst */ (int) (sign_add(tmpval,0.005)),
    /* arraydim         */ (int) (ExpInfo.NumAcodes),
    /* relaxdelay	*/ (int) (relaxdelay*1e8),
    /* Alc->ct	*/ (int) curct,
    /* Alc->clrbsflag	*/ (int) clr_at_blksize_mode,
    /* lockflag		*/ (int) lockfid_mode
       );
}
Example #4
0
static void WET(codeint phaseA, codeint phaseB)
{
  double finepwr,gzlvlw,gtw,gswet,dmfwet,dpwrwet,dofwet,wetpwr,pwwet,dz,
  ref_pw90 = getval("ref_pw90"),
         ref_pwr = getval("ref_pwr"),
        slp0bw = getval("slp0bw"),
        slpbw = getval("slpbw"),
        slp2bw = getval("slp2bw"),
        slp3bw = getval("slp3bw"),
        slp4bw = getval("slp4bw"),
        slp5bw = getval("slp5bw"),
        slp6bw = getval("slp6bw"),
        slp0,slp,slp2,
        slp3,slp4,slp5,slp6;
  int   slp0w,slpw,slp2w,slp3w,slp4w,slp5w,slp6w,c13wet;
  char  wetshape[MAXSTR];

  c13wet=getflag("c13wet");        /* C13 satellite suppression flag    */
  getstr("wetshape",wetshape);     /* Selective pulse shape (basename)  */
  wetpwr=getval("wetpwr");         /* User enters power for 90 deg.     */
  pwwet=getval("pwwet");           /* User enters power for 90 deg.     */
  dmfwet=getval("dmfwet");         /* dmf for the C13 decoupling        */
  dpwrwet=getval("dpwrwet");       /* Power fot the C13 decoupling      */
  dofwet=getval("dofwet");         /* Offset for the C13 decoupling     */
  dz=getval("dz");                 /* Post WET delay                    */
  slp0w=getflag("slp0w");          /* Flags whether user is requesting  */
  slpw=getflag("slpw");            /* WET suppression on each solvent   */
  slp2w=getflag("slp2w");          /* signal                            */
  slp3w=getflag("slp3w");
  slp4w=getflag("slp4w");
  slp5w=getflag("slp5w");
  slp6w=getflag("slp6w");

/*      On-the fly calculation of the WET shapes.
        d.a. March 2001
        First check if any of the WET related parameters are arrayed,
        in order to avoid extra pulse shaping  */

   if ((getval("arraydim") < 1.5) || (ix==1) || (isarry("ref_pwr")) || (isarry("ref_pw90")) || (isarry("tof")) || (isarry("slp0bw")) || (isarry("slp")) || (isarry("slpbw")) || (isarry("slp2bw")) || (isarry("slp3bw")) || (isarry("slp4bw")) || (isarry("slp5bw")) || (isarry("slp6bw")) || (isarry("slp0")) || (isarry("slp2")) || (isarry("slp3")) || (isarry("slp4")) || (isarry("slp5")) || (isarry("slp6")) || (isarry("slp0w")) || (isarry("slpw")) || (isarry("slp2w")) || (isarry("slp3w")) || (isarry("slp4w")) || (isarry("slp5w")) || (isarry("slp6w")))
{

/*      Set the name of the shape file to wetshape if not arrayed,
        for compatibility reasons with the other sequences of the LC
        and VAST package.
        If something is arrayed then the first elements named with
        wetshape and all subsequent with wetshape_n, where n is
        the array index    */

  if (ix==1)
  sprintf(wetarr, "%s", wetshape);
  else
  sprintf(wetarr, "%s_%d", wetshape, ix);

/* Open Pbox and start pulse shape calculation   */

  opx(wetarr);

/*      Explicitly check whether each one of the seven solvent lines
        is chosen to be suppressed. If the slpN parameter is set to
        'n' or the slpNw flag is set to 'n' then no wave is put into Pbox. 
        Otherwise the proper line with the SEDUCE shape is addded.
        var_active information can be found in /vnmr/psg/active.c    */

  if ((var_active("slp0",1)) && (slp0w))
        { slp0 = getval("slp0");
          putwave("seduce",slp0bw/2,slp0,0.0,0.0,90.0); }
  if ((var_active("slp",1)) && (slpw))
        { slp = getval("slp");
          putwave("seduce",slpbw/2,slp,0.0,0.0,90.0); }
  if ((var_active("slp2",1)) && (slp2w))
        { slp2 = getval("slp2");
          putwave("seduce",slp2bw/2,slp2,0.0,0.0,90.0); }
  if ((var_active("slp3",1)) && (slp3w))
        { slp3 = getval("slp3");
          putwave("seduce",slp3bw/2,slp3,0.0,0.0,90.0); }
  if ((var_active("slp4",1)) && (slp4w))
        { slp4 = getval("slp4");
          putwave("seduce",slp4bw/2,slp4,0.0,0.0,90.0); }
  if ((var_active("slp5",1)) && (slp5w))
        { slp5 = getval("slp5");
          putwave("seduce",slp5bw/2,slp5,0.0,0.0,90.0); }
  if ((var_active("slp6",1)) && (slp6w))
        { slp6 = getval("slp6");
          putwave("seduce",slp6bw/2,slp6,0.0,0.0,90.0); }

/*      Add additional control parameters, close Pbox and retrieve
        the shape parameters into the proper variables   */

  pbox_par("attn","i");
  pbox_par("reps","2");
  cpx(ref_pw90,ref_pwr);
  pbox_get();
  wetpwr = pbox_pwr;
  pwwet = pbox_pw;
}
else
{   /* Read the pbx.RF shape file and retrieve the wetpwr and pwwet values */
    dumshape=getRsh(wetshape);
    wetpwr = dumshape.pwr;
    pwwet = dumshape.pw;
}


finepwr=wetpwr-(int)wetpwr;  /* Adjust power to 152 deg. pulse */
  wetpwr=(double)((int)wetpwr);
  if (finepwr==0.0) {wetpwr=wetpwr+5; finepwr=4095.0; }
  else {wetpwr=wetpwr+6; finepwr=4095.0*(1-((1.0-finepwr)*0.12)); }
  rcvroff();
  if (c13wet)
    {
    decunblank(); decon();
    decoffset(dofwet);
    decpower(dpwrwet);
    if (rfwg[DECch-1]=='y')
         decprgon("garp1",1/dmfwet,1.0);
      else
         setstatus(DECch,FALSE,'g',FALSE,dmfwet);
    }
  obspower(wetpwr);         /* Set to low power level        */
  gzlvlw=getval("gzlvlw");      /* Z-Gradient level              */
  gtw=getval("gtw");            /* Z-Gradient duration           */
  gswet=getval("gswet");        /* Post-gradient stability delay */
  CHESS(finepwr*0.5056,wetarr,pwwet,phaseA,20.0e-6,rof2,gzlvlw,gtw,gswet,c13wet);
  CHESS(finepwr*0.6298,wetarr,pwwet,phaseB,20.0e-6,rof2,gzlvlw/2.0,gtw,gswet,c13wet);
  CHESS(finepwr*0.4304,wetarr,pwwet,phaseB,20.0e-6,rof2,gzlvlw/4.0,gtw,gswet,c13wet);
  CHESS(finepwr*1.00,wetarr,pwwet,phaseB,20.0e-6,rof2,gzlvlw/8.0,gtw,gswet,c13wet);
  if (c13wet)
    {
    if (rfwg[DECch-1]=='y')
         decprgoff();
      else
         setstatus(DECch,FALSE,'c',FALSE,dmf);
    decoffset(dof);
    decpower(dpwr);
    decoff(); decblank();
    }
  obspower(tpwr); obspwrf(tpwrf);    /* Reset to normal power level   */
  rcvron();
  delay(dz);
}