Esempio n. 1
0
static void Check_for_start_of_volume()
{
  int bytes_read = 0;
  int ignore_bytes = 0;
  char ignore_buf[LDM_HEADER_SIZE];

  /* If this is the beginning of a level-II file, then the 4-bytes
     just read is the beginning of the LDM volume header and not the
     record length. If this is the case, read and ignore the header. */

  if( ! strncmp( (char *)&Control_word, "AR", 2 ) )
  {
    ignore_bytes = LDM_HEADER_SIZE - LDM_CONTROL_WORD_SIZE;
    bytes_read = Read_stdin( (char *)ignore_buf, ignore_bytes );
    if( bytes_read != ignore_bytes )
    {
      P_err( "Missing volume file header (%d bytes read)", bytes_read );
      Print_stats( INVALID_LDM_HEADER );
    }
    memcpy( ICAO_buf, &ignore_buf[16], 4 );
    ICAO_buf[MAX_ICAO_LEN-1] = '\0';
  }
  else
  {
    P_err( "Missing volume file header (%d bytes read)", bytes_read );
    Print_stats( MISSING_LDM_HEADER );
  }
}
Esempio n. 2
0
int getparm(char *varname, char *vartype, int tree,
            void *varaddr, int size)
{
    int ret;
    char mess[MAXSTR];

    if ( (strcmp(vartype,"REAL") == 0) || (strcmp(vartype,"real") == 0) )
    {
        if ((ret = P_getreal(tree,varname,(double *)varaddr,1)) < 0)
        {
           if (dowarn)
           {
             sprintf(mess,"Cannot get parameter: %s\n",varname);
             text_error(mess);
	     if (bgflag)
	         P_err(ret,varname,": ");
           }
           else
           {
              dowarn = 1;
           }
	   return(1);
        }
    }
    else 
    {
	if ( (strcmp(vartype,"STRING") == 0) || 
	     (strcmp(vartype,"string") == 0) )
        {
            if ((ret = P_getstring(tree,varname,(char *)varaddr,1,size)) < 0)
            {
              if (dowarn)
              {
                sprintf(mess,"Cannot get parameter: %s\n",varname);
                text_error(mess);
		if (bgflag)
	     	    P_err(ret,varname,": ");
              }
              else
              {
                 dowarn=1;
              }
              return(1);
            }
	}
	else
	{   sprintf(mess,"Variable '%s' is neither a 'real' or 'string'.\n",
			vartype);
            text_error(mess);
	    return(1);
	}
      }
    return(0);
}
Esempio n. 3
0
static void Read_compressed_record()
{
  int bytes_to_read = 0;
  int bytes_read = 0;
  int error = 0;
  int size_of_record = Control_word;

  /* Byte-swap size flag so we can use it. */

  bytes_to_read = ntohl( size_of_record );

  P_debug( "Read_compressed_record: read %d", bytes_to_read );

  /* Negative size indicates this is the last record of the volume. */

  if( bytes_to_read < 0 )
  {
    P_debug( "Read_compressed_record: EOV" );
    bytes_to_read = -bytes_to_read;
    End_of_volume_flag = YES;
  }

  /* Read in compressed record according to expected size. If fewer
     bytes are read than expected, that's a problem. */

  bytes_read = Read_stdin( (char *)Read_buf, bytes_to_read );

  if( bytes_read != bytes_to_read )
  {
    P_err( "Read_compressed_record: Bytes read (%d) less than (%d)",
               bytes_read, bytes_to_read );
    Print_stats( INSUFFICIENT_STDIN_BYTES_READ );
  }

  /* Decompress the compressed record and put in different buffer. */

  Uncompressed_length = sizeof( Uncompressed_buf );

  error = BZ2_bzBuffToBuffDecompress( Uncompressed_buf, &Uncompressed_length,
                                      Read_buf, bytes_read,
                                      0, 1 );
  if( error )
  {
    P_err( "Read_compressed_record: Decompress error - %d", error );
    Print_stats( DECOMPRESS_ERROR );
  }

  Uncompressed_bytes += Uncompressed_length;
  Compressed_bytes += bytes_read;
  Compression_ratio = (float) Uncompressed_bytes / (float) Compressed_bytes;
  P_debug( "Radial size - Comp: %d Uncomp: %d Ratio: %f", Compressed_bytes, Uncompressed_bytes, Compression_ratio );
}
Esempio n. 4
0
static int get_flashc_parms (double *parraydim, double *pnf, double *pni )
/* 
Purpose:
-------
     Routine get_flashc_parms shall obtain some Vnmr process parameters for 
flashc.

Arguments:
---------
parraydim     :  (  O)  Pointer to value of Vnmr process parameter arraydim.
pnf	      :  (  O)  Pointer to value of Vnmr process parameter nf.
pni	      :  (  O)  Pointer to value of Vnmr process parameter ni.
*/
{ /* Begin function get_flashc_parms */
   /*
   Local Variables:
   ---------------
   r	 :  Return value of a function.
   */
   int r;
   /*
   Begin Executable Code:
   ---------------------
   */
   /* Get existing values */
   if ( ( r = P_getreal ( PROCESSED, "arraydim", parraydim, 1 ) ) != 0 )
   {  P_err ( r, "arraydim", ":" );
      ABORT;
   }
   if ( ( r = P_getreal ( PROCESSED, "nf", pnf, 1 ) ) != 0 )
   {  P_err ( r, "nf", ":" );
      ABORT;
   }
   /* "ni" is allowed to not exist */
   /* Value "-1" codes for "not set" */
   if ( P_getreal ( PROCESSED, "ni", pni, 1 ) != 0 )
      *pni = -1;
   if ( *pni == 0 )
      *pni = -1;

   /* Normal successful return */
   RETURN;

} /* End function get_flashc_parms */
Esempio n. 5
0
static void Read_control_word()
{
  int bytes_read = 0;

  if( ( bytes_read = Read_stdin( (char *)&Control_word, LDM_CONTROL_WORD_SIZE ) ) != LDM_CONTROL_WORD_SIZE )
  {
    P_err( "read stdin failed: read %d bytes and not %d, cw = %d", bytes_read, LDM_CONTROL_WORD_SIZE, Control_word );
    Print_stats( READ_STDIN_FAILED );
  }
}
Esempio n. 6
0
// fwc,fsc,fwc2,fsc2 are always set to wc,sc,wc2,sc2 by Vnmrbg
// they differ only if user explicitly set wc,sc,wc2,sc2 in macro or command line.
// In this case, resize window will not call setFullChart.
int adjustFull() {
  int r;
  double t_sc,t_wc,t_sc2,t_wc2;
  if ( (r=P_getreal(CURRENT,"sc" ,&t_sc, 1)) )
    { P_err(r,"current ","sc:"); return 1; }
  if ( (r=P_getreal(CURRENT,"wc" ,&t_wc, 1)) )
    { P_err(r,"current ","wc:"); return 1; }
  if ( (r=P_getreal(CURRENT,"sc2" ,&t_sc2, 1)) )
    { P_err(r,"current ","sc2:"); return 1; }
  if ( (r=P_getreal(CURRENT,"wc2" ,&t_wc2, 1)) )
    { P_err(r,"current ","wc2:"); return 1; }

  if ( ((int)t_sc==fsc) &&
       ((int)t_wc==fwc) &&
       ((int)t_sc2==fsc2) &&
       ((int)t_wc2==fwc2) )
    return 1;
  else
    return 0;
}
Esempio n. 7
0
static int Read_stdin( char *buf, int bytes_to_read )
{
  char *p = buf;
  int total_bytes_read = 0;
  int bytes_read = 0;
  
  if( !Read_stdin_alarm_init_flag )
  {
    Read_stdin_alarm_init_flag = YES;
    if( Init_read_stdin_alarm() < 0 )
    {
      P_err( "Failed to initialize read stdin alarm" );
      return ALARM_INIT_FAILED;
    }
  } 
  
  while( total_bytes_read < bytes_to_read && !Read_stdin_alarm_timeout_flag )
  {
    alarm( READ_ALARM_TIMEOUT );
    bytes_read = read( STDIN_FILENO, p, bytes_to_read-total_bytes_read );
    if( bytes_read > 0 )
    {
      total_bytes_read += bytes_read;
      p += bytes_read;
    }
    else if( bytes_read == 0 )
    {
      break;
    }
    else
    {
      P_err( "read stdin failed: bytes read < 0 (%d) errno = %d (%s)", bytes_read, errno, strerror( errno ) );
      Print_stats( READ_STDIN_FAILED );
    }
  }
  alarm( 0 );

  Total_size += total_bytes_read;

  return total_bytes_read;
}
Esempio n. 8
0
static int check_int(int *number)
/********************/
{
  vInfo  info;
  char   intmod[9];
  int    res;
  
  *number = ((P_getVarInfo(CURRENT,"liamp",&info)) ? 0 : info.size);
  if ( (res=P_getstring(CURRENT,"intmod",intmod,1,8)) )
  { P_err(res,"intmod",":"); ABORT; }
  return(!(strcmp(intmod,INT_FULL))); 
}
Esempio n. 9
0
/*------------------------------------------------------------------------------
|
|	parmult(tree,name)
|
|	This function returns the multiplier of a real parameter
+----------------------------------------------------------------------------*/
double parmult(int tree, const char *name)
{
   int             ret;
   vInfo           varinfo;	/* variable information structure */

   if ( (ret = P_getVarInfo(tree, name, &varinfo)) )
   {
      text_error("parmult(): cannot find variable %s", name);
      if (bgflag)
	 P_err(ret, name, ": ");
      return (-1.0);
   }
   return( (varinfo.subtype == ST_PULSE) ? 1e-6 : 1.0);
}
Esempio n. 10
0
/*------------------------------------------------------------------------------
|
|	whattype(tree,name)
|
|	This function returns the address of a real value of a variable based on
+----------------------------------------------------------------------------*/
int whattype(int tree, const char *name)
{
   int             ret;
   vInfo           varinfo;	/* variable information structure */
   char            mess[MAXSTR];

   if ( (ret = P_getVarInfo(tree, name, &varinfo)) )
   {
      sprintf(mess, "Cannot find the variable: %s", name);
      text_error(mess);
      if (bgflag)
	 P_err(ret, name, ": ");
      return (-1);
   }
   return (varinfo.basicType);
}
Esempio n. 11
0
static int Init_read_stdin_alarm()
{
  struct sigaction newact;
  struct sigaction oldact;

  newact.sa_handler = Read_stdin_alarm_handler;
  newact.sa_flags = 0;
  sigemptyset( &newact.sa_mask );

  if( ( sigaction( SIGALRM, &newact, &oldact ) ) == -1 )
  {
    P_err( "sigaction for SIGALRM failed" );
    Print_stats( SIGALARM_CALLBACK_FAILED );
  }

  return 0;
}
Esempio n. 12
0
int setFullChart(int d2flag) {
   int r;
  double sc,wc,sc2,wc2,wcmax,wc2max;
  if ( (r=P_getreal(GLOBAL,"wcmax"  ,&wcmax,  1)) )
    { P_err(r,"global ","wcmax:");  wcmax = 500.0; }
  if ( (r=P_getreal(GLOBAL,"wc2max" ,&wc2max, 1)) )
    { P_err(r,"global ","wc2max:"); wc2max = 240.0; }
  if ( (r=P_getreal(CURRENT,"sc" ,&sc, 1)) )
    { P_err(r,"current ","sc:"); return 1; }
  if ( (r=P_getreal(CURRENT,"wc" ,&wc, 1)) )
    { P_err(r,"current ","wc:"); return 1; }
  if ( (r=P_getreal(CURRENT,"sc2" ,&sc2, 1)) )
    { P_err(r,"current ","sc2:"); return 1; }
  if ( (r=P_getreal(CURRENT,"wc2" ,&wc2, 1)) )
    { P_err(r,"current ","wc2:"); return 1; }

      if ( d2flag ) { 
  	  double xband = 9*xcharpixels/((double)(mnumxpnts-right_edge) / wcmax);
	  double yband = 3*ycharpixels/((double)(mnumypnts-ymin) / wc2max); 
	  wc  = wcmax - xband;
	  sc  = 0;
          wc2 = wc2max - yband;
          sc2 = yband/2;
      } else {
	  if(get_drawVscale() > 0) set_vscaleMode(0);
	  double margin = getPlotMargin();
          wc  = wcmax-2*margin;
	  sc  = margin;
          wc2 = wc2max-2*margin;
          sc2 = margin;
      }
      dss_sc = 0;
      dss_wc = wc;
      dss_sc2 = 0;
      dss_wc2 = wc2;
      P_setreal(CURRENT,"dss_sc",dss_sc,0);
      P_setreal(CURRENT,"dss_wc",dss_wc,0);
      P_setreal(CURRENT,"dss_sc2",dss_sc2,0);
      P_setreal(CURRENT,"dss_wc2",dss_wc2,0);

  P_setreal(CURRENT,"sc",sc,0);
  P_setreal(CURRENT,"wc",wc,0);
  P_setreal(CURRENT,"sc2",sc2,0);
  P_setreal(CURRENT,"wc2",wc2,0);
  fwc=(int)wc;
  fsc=(int)sc;
  fwc2=(int)wc2;
  fsc2=(int)sc2;
  RETURN;
}
Esempio n. 13
0
/*------------------------------------------------------------------------------
|
|	maxminlimit(tree,name)
|
|	This function returns the max & min limit of the real variable based
|				Author: Greg Brissey  8-18-95
+----------------------------------------------------------------------------*/
int par_maxminstep(int tree, const char *name, double *maxv, double *minv, double *stepv)
{
   int             ret,pindex;
   vInfo           varinfo;	/* variable information structure */
   char            mess[MAXSTR];

   if ( (ret = P_getVarInfo(tree, name, &varinfo)) )
   {
      sprintf(mess, "Cannot find the variable: %s", name);
      text_error(mess);
      if (bgflag)
	 P_err(ret, name, ": ");
      return (-1);
   }
   if (varinfo.basicType != ST_REAL)
   {
      sprintf(mess, "The variable '%s' is not a type 'REAL'", name);
      text_error(mess);
   }
   if (varinfo.prot & P_MMS)
   {
      pindex = (int) (varinfo.minVal+0.1);
      if (P_getreal( SYSTEMGLOBAL, "parmin", minv, pindex ))
         *minv = -1.0e+30;
      pindex = (int) (varinfo.maxVal+0.1);
      if (P_getreal( SYSTEMGLOBAL, "parmax", maxv, pindex ))
         *maxv = 1.0e+30;
      pindex = (int) (varinfo.step+0.1);
      if (P_getreal( SYSTEMGLOBAL, "parstep", stepv, pindex ))
            *stepv = 0.0;
   }
   else
   {
       *maxv = varinfo.maxVal;
       *minv = varinfo.minVal;
       *stepv = varinfo.step;
   }
   return (0);
}
Esempio n. 14
0
static int setDataFile1D(int fnval, int realOnly)
/**********************/
{ char path[MAXPATH];
  dfilehead datahead;
  dpointers block;
  double rfn;
  int r;
  int stat;

  if ( (r=P_getreal(CURRENT,"fn",&rfn,1)) )
    { P_err(r,"fn",":");
      ABORT;
    }
  if ( realOnly && ((int) rfn != (fnval*2)))
  {
     Werrprintf("fn mismatch for real data (%d)", 2*fnval);
     ABORT;
  }
  else if ( ! realOnly && ((int) rfn != fnval) )
  {
     Werrprintf("fn mismatch for complex data (%d)", fnval);
     ABORT;
  }
  P_setreal(PROCESSED,"fn",rfn,0);
  D_trash(D_DATAFILE);
  D_trash(D_PHASFILE);

  if ( (r = D_getfilepath(D_DATAFILE, path, curexpdir)) )
  {
     D_error(r);
     ABORT;
  }

  datahead.nblocks = 1;
  datahead.ntraces = 1;
  datahead.np      = fnval;
  datahead.vers_id = VERSION;
  datahead.vers_id += DATA_FILE;
  datahead.nbheaders = 1;
  datahead.ebytes  = 4;
  datahead.tbytes  = datahead.ebytes * datahead.np;
  datahead.bbytes  = datahead.tbytes * datahead.ntraces +
                       sizeof(dblockhead);
  if (realOnly)
    stat  = (S_DATA|S_SPEC|S_FLOAT);
  else
    stat  = (S_DATA|S_SPEC|S_FLOAT|S_COMPLEX|NP_CMPLX);
  datahead.status  = (stat|S_NP);

  if ( (r=D_newhead(D_DATAFILE,path,&datahead)) )
    { D_error(r); ABORT;
    }
  if ( (r=D_allocbuf(D_DATAFILE,0,&block)) )
    { D_error(r); ABORT;
    }

  block.head->scale  = 0;
  block.head->status = stat;
  block.head->mode   = 0;
  block.head->rpval  = 0;
  block.head->lpval  = 0;
  block.head->lvl    = 0;
  block.head->tlt    = 0;
  block.head->ctcount= 1;
  data = block.data;

  if ( (r = D_getfilepath(D_PHASFILE, path, curexpdir)) )
  {
     D_error(r);
     ABORT;
  }

  datahead.vers_id += PHAS_FILE - DATA_FILE;
  if ( (r=D_newhead(D_PHASFILE,path,&datahead)) )
    { D_error(r); ABORT;
    }
  RETURN;
}
Esempio n. 15
0
static int getFidFile1D(int npval, int elem)
/**********************/
{ char path[MAXPATH];
  dfilehead datahead;
  dpointers block;
  double rnp;
  int e;

  if ( (e=P_getreal(CURRENT,"np",&rnp,1)) )
  {
      P_err(e,"np",":");
      ABORT;
  }
  if ( (int) rnp != npval)
  {
     Werrprintf("np mismatch currrent np is %d. New element np is %d", (int) rnp, npval);
     ABORT;
  }
  D_trash(D_PHASFILE);

  if ( (e = D_gethead(D_USERFILE, &datahead)) )
  {
     if ( (e = D_getfilepath(D_USERFILE, path, curexpdir)) )
     {
        D_error(e);
        ABORT;
     }

     e = D_open(D_USERFILE, path, &datahead);     /* open the file */
     if (e)
     {
        D_error(e);
        ABORT;
      }
  }

  if (npval != datahead.np)
  {
     if (elem == 1)
        return(setFidFile1D(npval));
     Werrprintf("data block np mismatch (%d)", npval);
     ABORT;
  }
  if (elem > datahead.nblocks+1)
  {
     Werrprintf("Cannot add element %d to data block that only has %d elements",
                 elem, datahead.nblocks);
     ABORT;
  }
  if (elem > datahead.nblocks)
  {
     datahead.nblocks = elem;
      D_updatehead(D_USERFILE, &datahead);
     if ( (e=D_allocbuf(D_USERFILE,elem-1,&block)) )
     { D_error(e); ABORT;
     }
  block.head->index  = elem;
  block.head->scale  = 0;
  block.head->status = datahead.status;
  block.head->mode   = 0;
  block.head->rpval  = 0;
  block.head->lpval  = 0;
  block.head->lvl    = 0;
  block.head->tlt    = 0;
  block.head->ctcount= 1;
  }
  else
  {
     D_getbuf(D_USERFILE, datahead.nblocks, elem-1, &block);
  }
  data = block.data;

  RETURN;
}
Esempio n. 16
0
int full(int argc, char *argv[], int retc, char *retv[])
/***************************/
{ int r,d2flag,dsflag;
  double sc,wc,sc2,wc2,wcmax,wc2max,xband;

   (void) argc;
   (void) retc;
   (void) retv;
   d2flag = get2Dflag();

  dsflag = 0;	/* preliminary */

  if (strcmp(argv[0],"full")==0) 
    {
	setFullChart(d2flag && (!dsflag));
  	appendvarlist("sc,wc,sc2,wc2");
	RETURN;
    }

  if ( (r=P_getreal(GLOBAL,"wcmax"  ,&wcmax,  1)) )
    { P_err(r,"global ","wcmax:");  wcmax = 500.0; }
  if ( (r=P_getreal(GLOBAL,"wc2max" ,&wc2max, 1)) )
    { P_err(r,"global ","wc2max:"); wc2max = 240.0; }
  if ( (r=P_getreal(CURRENT,"sc" ,&sc, 1)) )
    { P_err(r,"current ","sc:"); return 1; }
  if ( (r=P_getreal(CURRENT,"wc" ,&wc, 1)) )
    { P_err(r,"current ","wc:"); return 1; }
  if ( (r=P_getreal(CURRENT,"sc2" ,&sc2, 1)) )
    { P_err(r,"current ","sc2:"); return 1; }
  if ( (r=P_getreal(CURRENT,"wc2" ,&wc2, 1)) )
    { P_err(r,"current ","wc2:"); return 1; }

  xband = wcmax/10;

  if (strcmp(argv[0],"fullt")==0)
    { wc2 = (wc2max - xband) * 0.75;
      sc2 = 0;
      wc  = (wcmax - xband) * 0.80;
      sc  = xband/4;
    }
  else if (strcmp(argv[0],"left")==0)
    { if (d2flag & !dsflag)
	{ wc  = wcmax/2.0 - xband;
	  sc  = wc + xband;
        }
      else
	{ wc  = wcmax / 2.0;
	  sc  = wc;
	}
      wc2 = wc2max - xband;
      sc2 = 0;
    }
  else if (strcmp(argv[0],"center")==0)
    { wc  = wcmax/2.0 - xband;
      sc2 = 0.0;
      if (wc>(wc2max-sc2)) wc = wc2max-sc2;
      sc  = (wcmax-wc-xband)/2 + xband/8;
      wc2 = wc;
    }
  else if (strcmp(argv[0],"right")==0)
    { if (d2flag & !dsflag)
	{ wc  = wcmax/2.0 - xband;
	  sc  = xband/4;
        }
      else
	{ wc  = wcmax / 2.0;
	  sc  = 0.0;
	}
      wc2 = wc2max - xband;
      sc2 = 0;
    }
  else
    { Werrprintf("illegal callname %s in full",argv[0]);
      ABORT;
    }

      dss_sc = 0;
      dss_wc = wc;
      dss_sc2 = 0;
      dss_wc2 = wc2;
      P_setreal(CURRENT,"dss_sc",dss_sc,0);
      P_setreal(CURRENT,"dss_wc",dss_wc,0);
      P_setreal(CURRENT,"dss_sc2",dss_sc2,0);
      P_setreal(CURRENT,"dss_wc2",dss_wc2,0);

  P_setreal(CURRENT,"sc",sc,0);
  P_setreal(CURRENT,"wc",wc,0);
  P_setreal(CURRENT,"sc2",sc2,0);
  P_setreal(CURRENT,"wc2",wc2,0);
  appendvarlist("sc,wc,sc2,wc2");
  RETURN;
}
Esempio n. 17
0
/*-----------------------------------------------
|						|
|	     init2d_getfidparms()/2		|
|						|
|   This function initializes various data	|
|   parameters.					|
|						|
+----------------------------------------------*/
int init2d_getfidparms(int dis_setup)
{
  char		aig[5];
  int		r;
  double	rnp;
  double	hzpp;


  d2flag = FALSE;
  revflag = FALSE;
  ni = 1;


  if ( (r=P_getstring(CURRENT, "aig", aig, 1, 4)) )
  {
     if ( expdir_to_expnum(curexpdir) > 0 )
        P_err(r, "aig", ":");
     return(ERROR);
  }

  normflag = (aig[0] == 'n');

  if (P_getreal(CURRENT, "vpf", &vp, 1))
     C_GETPAR("vp", &vp);
  if (P_getreal(CURRENT, "vpfi", &vpi, 1))
     vpi = vp;
  C_GETPAR("vf", &vs);
  if (P_getreal(CURRENT, "crf", &cr, 1))
     C_GETPAR("cr", &cr);
  if (P_getreal(CURRENT, "deltaf", &delta, 1))
     C_GETPAR("delta", &delta);

  C_GETPAR("sf", &sp);
  C_GETPAR("wf", &wp);
  P_GETPAR("at", &sw);
  P_GETPAR("np", &rnp);

  fn = (int) (rnp + 0.5);

/**************************************
*  Initialize certain 2D parameters.  *
**************************************/

  rflrfp = 0.0;
  sw1 = 0.0;
  rflrfp1 = 0.0;
  fn1 = fn;

  hzpp = sw/(double) (fn/2);
  checkreal(&wp, 4.0*hzpp, sw-hzpp);
  wp = (double) ((int) (wp/hzpp + 0.01)) * hzpp;
  checkreal(&sp, rflrfp, sw-wp-hzpp);
  sp = (double) ((int) (sp/hzpp + 0.01)) * hzpp;
  if (dis_setup)
  {
     P_setreal(CURRENT, "wf", wp, 0);
     P_setreal(CURRENT, "sf", sp, 0);
  }

  set_fid_display();
  get_sfrq(HORIZ,&sfrq);
  get_scale_axis(HORIZ,&axisHoriz);
  axisVert = '\0';

  C_GETPAR("vo", &vo);
  C_GETPAR("ho", &ho);

  DPRINT4("np=%d, at=%g, rflrfp=%g, sfrq=%g\n",
                  fn,sw,rflrfp,sfrq);

  return(COMPLETE); 
}
Esempio n. 18
0
/* frqdimname;	frequency dimension  */
static int getspecparms(int dis_setup, int frqdimname)
{
  char		aig[5],
		dmg[5],
		dmg1[5];
  int		dim0,dim1;
  int		r;
  double	x0;

// min, max sw values
  double minval, maxval;
  if(P_getmin(PROCESSED, "sw", &minval) ) minval = 200.0;
  if(P_getmax(PROCESSED, "sw", &maxval) ) maxval = 200.0;

  dim0 = FN0_DIM;
  dim1 = FN1_DIM;
  if (d2flag)
  {
     if (frqdimname == S_NP)
     {
        if (datahead.status & S_SPEC)
        {
           Werrprintf("Data file must first be re-initialized with FID data\n");
           return(ERROR);
        }

        d2flag = FALSE;
        dim0 = FN0_DIM;
        dim1 = FN0_DIM;
     }
     else
     {
        if (ndflag == FOUR_D)
        {
           if (frqdimname & S_NP)
           {
              dim0 = FN0_DIM;
              if (frqdimname & S_NI)
                 dim1 = FN1_DIM;
              else if (frqdimname & S_NI2)
                 dim1 = FN2_DIM;
              else
                 dim1 = FN3_DIM;
           }
           else if (frqdimname & S_NI)
           {
              dim0 = FN1_DIM;
              if (frqdimname & S_NI2)
                 dim1 = FN2_DIM;
              else
                 dim1 = FN3_DIM;
           }
           else
           {
              dim0 = FN2_DIM;
              dim1 = FN3_DIM;
           }
        }
        else if (frqdimname & S_NP)
        {
           dim0 = FN0_DIM;
           dim1 = ( (frqdimname & S_NI2) ? FN2_DIM : FN1_DIM );
        }
        else if ( (~frqdimname) & S_NF )
        {
           dim0 = FN2_DIM;
           dim1 = FN1_DIM;
        }
        else
        {   
           Werrprintf("Invalid name for 2nd dimension\n");
           return(ERROR);
        }
     }
  }

/************************************************
*  Set the normalization, processing mode, and  *
*  display flags for either 1D or 2D data.      *
************************************************/

  if ( (r = P_getstring(CURRENT, "aig", aig, 1, 4)) )
  {
     if ( expdir_to_expnum(curexpdir) > 0 )
        P_err(r, "aig", ":");
     return(ERROR);
  }

  if ( (r = P_getstring(CURRENT, "dmg", dmg, 1, 4)) )
  {
     P_err(r, "dmg", ":");
     return(ERROR);
  }

  normflag = (aig[0] == 'n');
  dophase = doabsval = dopower = dophaseangle = dodbm = FALSE;
  dof1phase = dof1absval = dof1power = dof1phaseangle = FALSE;

  dophase = ((dmg[0] == 'p') && (dmg[1] == 'h'));
  if (!dophase)
  {
     doabsval = ((dmg[0] == 'a') && (dmg[1] == 'v'));
     if (!doabsval)
     {
        dopower = ((dmg[0] == 'p') && (dmg[1] == 'w'));
        if (!dopower)
        {
           dophaseangle = ((dmg[0] == 'p') && (dmg[1] == 'a'));
           if (!dophaseangle)
           {
        	   dodbm = ((dmg[0] == 'd') && (dmg[1] == 'b'));
        	   if (!dodbm)
        	   {
        	      Werrprintf("Invalid display mode for 1D spectral data");
        	      return(ERROR);
        	   }
           }
        } 
     } 
  }

  if (d2flag)
  {
     r = P_getstring(CURRENT, "dmg1", dmg1, 1, 5);
     if (!r)
     {
        r = ( (strcmp(dmg1, "ph1") != 0) && (strcmp(dmg1, "av1") != 0) &&
		  (strcmp(dmg1, "pwr1") != 0) );
     }

     if (r)
     { /* default to "dmg" */
        if ( (r = P_getstring(CURRENT, "dmg", dmg1, 1, 4)) )
        {
           P_err(r, "dmg", ":");
           disp_status("        ");
           return(ERROR);
        }
     }

     dof1phase = ((dmg1[0] == 'p') && (dmg1[1] == 'h'));
     if (!dof1phase) 
     {
        dof1absval = ((dmg1[0] == 'a') && (dmg1[1] == 'v')); 
        if (!dof1absval)
        { 
           dof1power = ((dmg1[0] == 'p') && (dmg1[1] == 'w')); 
           if (!dof1power)
           {
              dof1phaseangle = ((dmg1[0] == 'p') && (dmg1[1] == 'a')); 
              if (!dof1phaseangle)
              {
                 Werrprintf("Invalid F1 display mode for 2D spectral data");
                 return(ERROR); 
              }
           } 
        } 
     }
  }

  if (dis_setup)
  {
/************************************
*  Get current display parameters.  *
************************************/
     P_getreal(CURRENT,"vs",&vs,1);
     P_getreal(CURRENT,"vsproj",&vsproj,1);
     P_getreal(CURRENT,"vs2d",&vs2d,1);
     C_GETPAR("is", &is);
     C_GETPAR("io", &io);
     C_GETPAR("th", &th);
     C_GETPAR("vp", &vp);
     C_GETPAR("vo", &vo);
     C_GETPAR("ho", &ho);
     C_GETPAR("lvl", &lvl);
     C_GETPAR("tlt", &tlt);
  }

  if (d2flag)
  {

/*******************************************************
*  Check whether the datafile contains FID's, half-    *
*  transformed spectra, or fully transformed spectra.  *
*******************************************************/

     if ( (~datahead.status) & S_SECND)
     { /* not fully transformed 2D spectrum */
        dim1 = ( (datahead.status & S_NI2) ? SW2_DIM : SW1_DIM );
        if ( (~datahead.status) & S_SPEC)
           dim0 = SW0_DIM;
     }
  }
  else
  {
     dim0 = FN0_DIM;
     dim1 = FN1_DIM;
  }

  if (d2flag && revflag)
  {
     set_spec_display(HORIZ,dim1,VERT,dim0);
     set_display_label(HORIZ,revchar,VERT,normchar);
     set_spec_proc(HORIZ,dim1,REVDIR, VERT,dim0,NORMDIR);
  }
  else
  {
     set_spec_display(HORIZ,dim0,VERT,dim1);
     set_display_label(HORIZ,normchar,VERT,revchar);
     set_spec_proc(HORIZ,dim0,NORMDIR, VERT,dim1,REVDIR);
  }
  get_sfrq(HORIZ,&sfrq);
  get_sfrq(VERT,&sfrq1);
  get_cursor_pars(HORIZ,&cr,&delta);
  get_phase_pars(HORIZ,&rp,&lp);
  get_ref_pars(HORIZ,&sw,&rflrfp,&fn);
  if(sw<=0 || sw>maxval) {
	Winfoprintf("Error sw out of bounds %f: 0 to %f",sw,maxval);
	return(ERROR);
  }
  get_scale_axis(HORIZ,&axisHoriz);
  get_scale_axis(VERT,&axisVert);
  {
     double axis_scl;
     int    reversed;

     get_scale_pars(HORIZ,&sp,&wp,&axis_scl,&reversed);
     if (get_axis_freq(HORIZ))
       set_sp_wp(&sp, &wp, sw, fn/2, rflrfp);
     else
       set_sf_wf(&sp, &wp, sw, fn/2);
     UpdateVal(HORIZ,WP_NAME,wp,NOSHOW);
     UpdateVal(HORIZ,SP_NAME,sp,NOSHOW);
  }

  if (d2flag)
  {
     get_phase_pars(VERT,&rp1,&lp1);
     get_ref_pars(VERT,&sw1,&rflrfp1,&fn1);
     if(dim1==FN1_DIM && (sw1<=0 || sw1>maxval)) {
	Winfoprintf("Error sw1 out of bounds %f: 0 to %f",sw1,maxval);
	return(ERROR);
  }
     {
        double axis_scl;
        int    reversed;

        get_scale_pars(VERT,&sp1,&wp1,&axis_scl,&reversed);
        if (get_axis_freq(VERT))
           set_sp_wp(&sp1, &wp1, sw1, fn1/2, rflrfp1);
        else
           set_sf_wf(&sp1, &wp1, sw1, fn1/2);
        UpdateVal(VERT,WP_NAME,wp1,NOSHOW);
        UpdateVal(VERT,SP_NAME,sp1,NOSHOW);
     }
     x0 = 1.0;
     if ( get_axis_freq(HORIZ) && get_axis_freq(VERT) )
     {
        if (((axisHoriz == 'c') || (axisHoriz == 'm') || (axisHoriz == 'u'))
         && ((axisVert == 'c') || (axisVert == 'm') || (axisVert == 'u')))
        {
	   if (axisHoriz == 'c') x0 =  1.0;
	   if (axisHoriz == 'm') x0 = 10.0;
	   if (axisHoriz == 'u') x0 = 1e4;
	   if (axisVert == 'c') x0 /= 1.0;
	   if (axisVert == 'm') x0 /= 10.0;
	   if (axisVert == 'u') x0 /= 1e4;
        }
     }
     aspect_ratio = (wp*sfrq1)/(x0*wp1*sfrq);
  }
  else
  {
     fn1 = fn;
     sw1 = 0.0;
     rflrfp1 = 0.0;
     aspect_ratio = 100.0;
  }
  normInt = 0;
  insval = 1.0;
  if (!P_getreal(CURRENT, "ins", &insval, 1))
  {
     vInfo  info;
     double tmp;

     if (!P_getreal(CURRENT, "insref", &tmp, 1))
     {
        P_getVarInfo(CURRENT,"insref",&info);
        if (!info.active)
           normInt = 1;
        else if (tmp > 0.0)
           insval /= tmp;
     }
  }
  if (insval <= 0.0)
     insval = 1.0;
  if (!normInt)
     insval /= (double) fn;

  normInt2 = 0;
  ins2val = 1.0;
  if (!P_getreal(CURRENT, "ins2", &ins2val, 1))
  {
     vInfo  info;
     double tmp;

     if (!P_getreal(CURRENT, "ins2ref", &tmp, 1))
     {
        P_getVarInfo(CURRENT,"ins2ref",&info);
        if (!info.active)
           normInt2 = 1;
        else if (tmp > 0.0)
           ins2val /= tmp;
     }
  }
  if (ins2val <= 0.0)
     ins2val = 1.0;
  if (!normInt2)
     ins2val /= ((double)fn * (double)fn1);

  return(COMPLETE);
}
Esempio n. 19
0
/*---------------------------------------
|					|
|		   ai()			|
|					|
|   Main entry point for ai() routine.	|
|					|
+--------------------------------------*/
int ai(int argc, char *argv[], int retc, char *retv[])
{
   int e;

   (void) argc;
   (void) retc;
   (void) retv;
   Wturnoff_buttons();
   if ((strcmp(argv[0], "av") == 0) ||
       (strcmp(argv[0], "ph") == 0) ||
       (strcmp(argv[0], "pa") == 0) || 
       (strcmp(argv[0], "db") == 0) ||
       (strcmp(argv[0], "pwr") == 0))
   {
      if ( (e = P_setstring(CURRENT, "dmg", argv[0], 0)) )
         P_err(e, "dmg", ":"); 
      if (strcmp(argv[0], "pa") == 0)
        if ( (e = P_setstring(CURRENT, "dmg", "pa", 0)) )
           P_err(e, "dmg", ":");
      appendvarlist("dmg");
   }
   else if ((strcmp(argv[0], "av1") == 0) ||
            (strcmp(argv[0], "ph1") == 0) ||
            (strcmp(argv[0], "pa1") == 0) ||
            (strcmp(argv[0], "pwr1") == 0))
   {
      if ( (e = P_setstring(CURRENT, "dmg1", argv[0], 0)) )
      {
         if ( (e = P_creatvar(CURRENT,"dmg1",ST_STRING)) )
         {
            P_err(e, "dmg1", ":");
         }
         else
         {
	    P_setgroup(CURRENT,"dmg1",G_DISPLAY);
            P_setlimits(CURRENT,"dmg1",5.0,0.0,0.0);
            if ( (e = P_setstring(CURRENT, "dmg1", argv[0], 0)) )
               P_err(e, "dmg1", ":");
            if (strcmp(argv[0], "pa1") == 0)
               if ( (e = P_setstring(CURRENT, "dmg1", "pa1", 0)) )
                  P_err(e, "dmg1", ":");
         }
      }
      appendvarlist("dmg1");
      if (strcmp(argv[0], "pa1") == 0)
         if ( (e = P_setstring(CURRENT, "dmg1", "pa1", 0)) )
            appendvarlist("dmg1");
   }
   else if ((strcmp(argv[0], "av2") == 0) ||
            (strcmp(argv[0], "ph2") == 0) ||
            (strcmp(argv[0], "pa2mode") == 0) ||
            (strcmp(argv[0], "pwr2") == 0))
   {
      if ( (e = P_setstring(CURRENT, "dmg2", argv[0], 0)) )
      {
         if ( (e = P_creatvar(CURRENT,"dmg2",ST_STRING)) )
         {
            P_err(e, "dmg2", ":");
         }
         else
         {
	    P_setgroup(CURRENT,"dmg2",G_DISPLAY);
            P_setlimits(CURRENT,"dmg2",5.0,0.0,0.0);
            if ( (e = P_setstring(CURRENT, "dmg2", argv[0], 0)) )
               P_err(e, "dmg2", ":");
            if (strcmp(argv[0], "pa2mode") == 0)
               if ( (e = P_setstring(CURRENT, "dmg2", "pa2", 0)) )
                  P_err(e, "dmg2", ":");
         }
      }
      appendvarlist("dmg2");
      if (strcmp(argv[0], "pa2mode") == 0)
         if ( (e = P_setstring(CURRENT, "dmg2", "pa2", 0)) )
            appendvarlist("dmg2");
   }
   else if ((strcmp(argv[0], "ai") == 0) ||
            (strcmp(argv[0], "nm") == 0))
   {
      if ( (e = P_setstring(CURRENT, "aig", argv[0], 0)) )
         P_err(e, "aig", ":"); 
      appendvarlist("aig");
   }
   else if (strcmp(argv[0], "cdc") == 0)
   {
      P_setreal(CURRENT, "lvl", 0.0, 0);
      P_setreal(CURRENT, "tlt", 0.0, 0);
      appendvarlist("lvl");
      appendvarlist("tlt");
      if ( (e = P_setstring(CURRENT, "dcg", "cdc", 0)) )
         P_err(e, "dcg", ":"); 
   }
   else if (strcmp(argv[0], "dc") == 0)
   {
      if (dc())
      {
         Werrprintf("cannot do drift correction");
      }
      else
      {
         if ( (e = P_setstring(CURRENT, "dcg", "", 0)) )
            P_err(e, "dcg", ":"); 
         appendvarlist("lvl");
         appendvarlist("tlt");
      }
   }
   RETURN;
}
Esempio n. 20
0
/*---------------------------------------
|					|
|		check2d()/1		|
|					|
+--------------------------------------*/
int check2d(int get_rev)
{
  char		trace[5],
		ni0name[6];
  int		r;
  double	rni;
  int           dim0,dim1;


/******************************************************
*  Determines whether the experiment contains 1D or   *
*  2D data; sets D2FLAG, REVFLAG, and NI; if get_rev  *
*  is FALSE, REVFLAG is assumed to be set by the      *
*  calling program.                                   *
******************************************************/

  /* Defaults for 1D data */
  ndflag = ONE_D;
  dim1 = dim0 = S_NP;
  dimension_name = S_NP;
  d2flag = FALSE;
  ni = 1;
  normchar = ' ';
  revchar = '1';

  if (datahead.status & S_TRANSF)	/* 2D data */
  {
     ndflag = TWO_D;
     normchar = '2';
     if (datahead.status & S_3D)
        ndflag = THREE_D;
     if (datahead.nbheaders & ~NBMASK)
        ndflag = FOUR_D;

     if (ndflag == TWO_D)
     {
        int niVal=0, ni2Val=0;
        if ( !P_getreal(PROCESSED, "ni", &rni, 1) ) niVal = (int)rni;
        if ( !P_getreal(PROCESSED, "ni2", &rni, 1) ) ni2Val = (int)rni;
        if (datahead.status & S_NF)
        {
           strcpy(ni0name, "nf");
           dimension_name |= S_NF;
        }
        else if (datahead.status & S_NI)
        { 
           strcpy(ni0name, "ni"); 
           dimension_name |= S_NI;
	   if(ni2Val > 0) {
		normchar='3';
	      	revchar='1';
	   } 
        } 
        else if (datahead.status & S_NI2)
        {
           strcpy(ni0name, "ni2");
           dimension_name |= S_NI2;
	   if(niVal > 0) {
		normchar='3';
	      	revchar='2';
	   } 
        }
        else
        {
           Werrprintf("Invalid F1 dimension in first data block header");
           return(ERROR);
        }
     }

     if (ndflag == THREE_D)
     {
        if ((datahead.status & (S_NP|S_NF)) == (S_NP|S_NF) )
        {
           strcpy(ni0name, "nf");
           normchar = '3';
           revchar = '1';
           dimension_name |= S_NF;
        }
        else if ((datahead.status & (S_NP|S_NI)) == (S_NP|S_NI) )
        { 
           strcpy(ni0name, "ni"); 
           normchar = '3';
           revchar = '1';
           dimension_name |= S_NI;
        } 
        else if ((datahead.status & (S_NP|S_NI2)) == (S_NP|S_NI2) )
        {
           strcpy(ni0name, "ni2");
           normchar = '3';
           revchar = '2';
           dimension_name |= S_NI2;
        }
        else if ((datahead.status & (S_NI|S_NI2)) == (S_NI|S_NI2) )
        {
           strcpy(ni0name, "ni");
           normchar = '2';
           revchar = '1';
           dimension_name = S_NI|S_NI2;
        }
        else
        {
           Werrprintf("Invalid dimension in first data block header");
           return(ERROR);
        }
     }
     if (ndflag == FOUR_D)
     {
        if ((datahead.nbheaders & (ND_NP|ND_NI)) == (ND_NP|ND_NI) )
        {
           strcpy(ni0name, "ni"); 
           normchar = '4';
           revchar = '1';
           dimension_name |= S_NI;
        }
        else if ((datahead.nbheaders & (ND_NP|ND_NI2)) == (ND_NP|ND_NI2) )
        { 
           strcpy(ni0name, "ni2"); 
           normchar = '4';
           revchar = '2';
           dimension_name |= S_NI2;
        } 
        else if ((datahead.nbheaders & (ND_NP|ND_NI3)) == (ND_NP|ND_NI3) )
        {
           strcpy(ni0name, "ni3");
           normchar = '4';
           revchar = '3';
           dimension_name |= S_NI3;
        }
        else if ((datahead.nbheaders & (ND_NI|ND_NI2)) == (ND_NI|ND_NI2) )
        {
           strcpy(ni0name, "ni2");
           normchar = '1';
           revchar = '2';
           dimension_name = S_NI|S_NI2;
        }
        else if ((datahead.nbheaders & (ND_NI|ND_NI3)) == (ND_NI|ND_NI3) )
        {
           strcpy(ni0name, "ni3");
           normchar = '1';
           revchar = '3';
           dimension_name = S_NI|S_NI3;
        }
        else if ((datahead.nbheaders & (ND_NI2|ND_NI3)) == (ND_NI2|ND_NI3) )
        {
           strcpy(ni0name, "ni3");
           normchar = '2';
           revchar = '3';
           dimension_name = S_NI|S_NI3;
        }
        else
        {
           Werrprintf("Invalid dimension in first data block header");
           return(ERROR);
        }
     }

     if ( (r = P_getreal(PROCESSED, ni0name, &rni, 1)) )
     {
        Werrprintf("Unable to get %s 2D parameter for 2D data matrix\n",
			ni0name);
        d2flag = FALSE;
        return(ERROR);
     }
     else
     {
        d2flag = TRUE;
        ni = (int) (rni + 0.5);
        if (ni == 0)
           ni = 1;
     }
  }

/************************************
*  Set REVFLAG if get_rev is TRUE.  *
************************************/

  if (get_rev)
  {
     revflag = FALSE;
     if (d2flag)
     {
        if ( (r = P_getstring(CURRENT, "trace", trace, 1, 4)) )
        {
           P_err(r, "trace", ":");
           return(ERROR);
        }

        if(revchar=='2' && normchar=='3') 
	   revflag = (trace[1] == '1');
	else 
	   revflag = (trace[1] == revchar);
     }
  }

  return(COMPLETE);
}
Esempio n. 21
0
static int getDataFile1D(int fnval, int realOnly, int elem)
/**********************/
{ char path[MAXPATH];
  dfilehead datahead;
  dpointers block;
  double rfn;
  int e;

  if ( (e=P_getreal(CURRENT,"fn",&rfn,1)) )
    { P_err(e,"fn",":");
      ABORT;
    }
  if ( realOnly && ((int) rfn != (fnval*2)))
  {
     Werrprintf("fn mismatch for real data (%d)", 2*fnval);
     ABORT;
  }
  else if ( ! realOnly && ((int) rfn != fnval) )
  {
     Werrprintf("fn mismatch for complex data (%d)", fnval);
     ABORT;
  }
  P_setreal(PROCESSED,"fn",rfn,0);
  D_trash(D_PHASFILE);

  if ( (e = D_gethead(D_DATAFILE, &datahead)) )
  {
     if ( (e = D_getfilepath(D_DATAFILE, path, curexpdir)) )
     {
        D_error(e);
        ABORT;
     }

     e = D_open(D_DATAFILE, path, &datahead);     /* open the file */
     if (e)
     {
        D_error(e);
        ABORT;
      }
  }

  if ( (realOnly && (datahead.status & S_COMPLEX) == S_COMPLEX) ||
       ( ! realOnly && ((datahead.status & S_COMPLEX) != S_COMPLEX) ) )
  {
     if (elem == 1)
        return(setDataFile1D(fnval,realOnly));
     Werrprintf("data block real - complex mismatch");
     ABORT;
  }
  if (fnval != datahead.np)
  {
     if (elem == 1)
        return(setDataFile1D(fnval,realOnly));
     Werrprintf("data block fn mismatch for real data (%d)", fnval);
     ABORT;
  }
  if (elem > datahead.nblocks+1)
  {
     Werrprintf("Cannot add element %d to data block that only has %d elements",
                 elem, datahead.nblocks);
     ABORT;
  }
  if (elem > datahead.nblocks)
  {
     datahead.nblocks = elem;
      D_updatehead(D_DATAFILE, &datahead);
     if ( (e=D_allocbuf(D_DATAFILE,elem-1,&block)) )
     { D_error(e); ABORT;
     }
  block.head->scale  = 0;
  block.head->status = datahead.status;
  block.head->status &= (~S_NP);
  block.head->mode   = 0;
  block.head->rpval  = 0;
  block.head->lpval  = 0;
  block.head->lvl    = 0;
  block.head->tlt    = 0;
  block.head->ctcount= 1;
  }
  else
  {
     D_getbuf(D_DATAFILE, datahead.nblocks, elem-1, &block);
  }
  data = block.data;

  if ( (e = D_getfilepath(D_PHASFILE, path, curexpdir)) )
  {
     D_error(e);
     ABORT;
  }

  datahead.vers_id += PHAS_FILE - DATA_FILE;
  if ( (e=D_newhead(D_PHASFILE,path,&datahead)) )
    { D_error(e); ABORT;
    }
  RETURN;
}
Esempio n. 22
0
int flashc (int argc, char *argv[], int retc, char *retv[] )
/* 
Purpose:
-------
     Routine flashc is the main routine for the "flash convert" function.  It
edits the fid file in the current experiment, as well as process parameters nf,
ni, arraydim, arrayelemts, and cf to do the flash data format to standard 
format conversion.

Arguments:
---------
argc  :  (   )  Argument count.
argv  :  (   )  Command line arguments.
retc  :  (   )  Return argument count.  Not used here.
retv  :  (   )  Return arguments.  Not used here.
*/

/*  9-4-92
A single argument is allowed at this time to specify the number
of compressed traces to be left as a compressed nf block.  The use
for this is to allow compressed multislice or multiecho simultaneous
with compressed phase encoding.

    9-10-92
Argument list expanded to allow both compressed multi-slice, and
compressed multi-image formats.  The difference in format is:
(numerical values indicate acquisition order of traces)

  pe    1  2  3  4  5    ns ==>
  ||    6  7  8  9  10
  ||    11 12 13 14 15
  \/    ...
	..........  XX  where XX = phase encode * slices


  pe    1   pe+1  2pe+1  compressed images ==>
  ||    2   pe+2  2pe+2
  ||    3   pe+3  2pe+3
  \/    ...
	pe  pe*2 ... XX  where XX = phase encode * images


"rare" type data acquisition.

  pe    1   ne+1  2ne+1  ns ==>
  ||    2   ne+2  2ne+2
  ||    3   ne+3  2ne+3
  ||    ...
  ||	ne  ne*2 ... XX  where XX = num echoes (ne) * slices (ns)
  ||	
  ||	ne*ns+1  ne*ns+ne+1  ne*ns+2ne+1
  ||	ne*ns+2  ne*ns+ne+2  ne*ns+2ne+2
  ||	...
  ||	ne*ns+ne ne*ns+ne*2  ne*ns+ne*ns
  ||	.
  \/	2(ne*ns)+ne 2(ne*ns)+ne*2  2(ne*ns)+ne*ns
	.	
	... 		XX where XX = nv/ne*(ne * ns)

	


Examples of use from vnmr:
    flashc              simple compressed phase-encode
    flashc('ms',ns)     compressed phase-encode and compressed multi-slice
    flashc('mi',ns)     compressed multi-image and compressed phase-encode
    flashc('rare',ns,ne) compressed echo-train, multi-slice, and phase-encode

 'nf' argument added to reformat the data into the following:
    slice1 image, slice2 image, slice3 image,..., slicen image.

    flashc('nf')         simple compressed phase-encode
    flashc('nf','ms',ns) compressed phase-encode and compressed multi-slice
    flashc('nf','mi',ns) compressed multi-image and compressed phase-encode
    flashc('nf','rare',ns,ne) compressed echo-train, multi-slice, and 
								phase-encode
*/
{ /* Begin function flashc */
   /*
   Local Variables:
   ---------------
   default_fid  :  Complete file path to the fid file in the current experiment.
   temp_fid     :  Complete file path to a temporary version of the fid file in
		   the current experiment.
   nf		:  The Vnmr process parameter of the same name.
   ni		:  Ditto.
   ncomp	:  Number of traces to keep in compressed nf form.
   arraydim     :  Value of Vnmr process parameter arraydim.
   arrayelemts  :  Value of Vnmr process parameter arrayelemts.
   r            :  Return value of a function.
   format       :  image compression format; 0 = multi-slice, 1 = multi-image.
   */
   char   default_fid[MAXPATHL], temp_fid[MAXPATHL];
   int    format, r, nfarg;
   double ncomp, necho, nf, ni, arraydim, arrayelemts;

/* A convenience macro */
#define P_SETPAR(name,value)			\
   if (( r=P_setreal(PROCESSED,name,value,1)))	\
   {  P_err(r,name,":");			\
      ABORT;					\
   }						\
   if ( ( r=P_setreal(CURRENT,name,value,1)) )	\
   {  P_err(r,name,":");			\
      ABORT;					\
   }
   /*
   Begin Executable Code:
   --------------------
   */
   /* Verify that the user has passed correct number of arguments */
   if ( argc > 5 )
   {  Werrprintf ( "Flashc: wrong number of arguments." );
      ABORT;
   }

   nfarg = 0;
   /* Look for 'nf' argument */
   if (argc > 1)
   {
      if ( !strcmp(argv[1],"nf") )
      {
	nfarg = 1;
      }
   }
   /* Look for any arguments */
   if ( argc == 4+nfarg) {
      if ( !strcmp(argv[1+nfarg],"rare") )
      {
	  format = 2;
	  ncomp = atof(argv[2+nfarg]);
	  necho = atof(argv[3+nfarg]); /* necho= echo train of phase encode steps */
      }
      else
      {  Werrprintf ( "Flashc: unrecognized conversion type." );
         ABORT;
      }
   }
   else if ( argc == 3+nfarg ) {
      ncomp = atof(argv[2+nfarg]);
      necho = 1.0;
      if ( !strcmp(argv[1+nfarg],"ms") )
	  if (nfarg)
		format = 1;
	  else
		format = 0;
      else if ( !strcmp(argv[1+nfarg],"mi") )
	  if (nfarg)
		format = 0;
	  else
	  	format = 1;
      else
      {  Werrprintf ( "Flashc: unrecognized conversion type." );
         ABORT;
      }
   }
   else {
      ncomp = 1.0;
      necho = 1.0;
      format = 0;
   }


   /* Do an "interlock" to insure that flashc is called only once */
   if ( flash_interlock() != 0 )
      RETURN;


   /* Generate paths to the fid file and a parallel, temporary file. */
   (void)strcpy ( default_fid, curexpdir );
   (void)strcpy ( temp_fid, curexpdir );
#ifdef UNIX
   (void)strcat ( default_fid, "/acqfil/fid" );
   (void)strcat ( temp_fid, "/acqfil/flashc.temp" );
#else 
   vms_fname_cat ( default_fid, "[.acqfil]fid" );
   vms_fname_cat ( temp_fid, "[.acqfil]flashc.temp" );
#endif 

   /* Obtain the values of the process parameters */
   if ( get_flashc_parms ( &arraydim, &nf, &ni ) != 0 )
   {
      P_deleteVar ( PROCESSED, "flash_converted" );
      P_deleteVar ( CURRENT,   "flash_converted" );
      ABORT;
   }

   if (nfarg && (ncomp == 1.0)) ncomp = nf;

   /* Check nf to make sure it is divisible by ncomp */
   if ( (int)floor(nf+0.5) % (int)floor(ncomp+0.5) > 0 )
   {  Werrprintf ( "Flashc: ncomp is not a factor of nf." );
      P_deleteVar ( PROCESSED, "flash_converted" );
      P_deleteVar ( CURRENT,   "flash_converted" );
      ABORT;
   }
   /* Display status on screen */
   disp_status ( "FLASHC" );

   if (nfarg)
   {
   	/* Edit the fid file, may also revise parameters nf and ni. */
   	if ( nf_flash_convert ( default_fid, temp_fid, arraydim,
     	         format, ncomp, necho, nf, &ni ) != 0 )
        {
           P_deleteVar ( PROCESSED, "flash_converted" );
           P_deleteVar ( CURRENT,   "flash_converted" );
           disp_status ( "      " );
   	   ABORT;
        }
   }
   else
   {
   	/* Edit the fid file, may also revise parameter ni. */
   	if ( flash_convert ( default_fid, temp_fid, arraydim,
   	         format, ncomp, necho, nf, &ni ) != 0 )
        {
           P_deleteVar ( PROCESSED, "flash_converted" );
           P_deleteVar ( CURRENT,   "flash_converted" );
           disp_status ( "      " );
   	   ABORT;
        }
   }

   disp_status ( "      " );
   /* Write out the new parameter values */
   if (nfarg)
   {
   	P_SETPAR ( "nf", floor (ni*(nf / ncomp)+0.5) );
   	P_SETPAR ( "ni", 1.0 );
   }
   else
   {
   	P_SETPAR ( "nf", ncomp );
   	P_SETPAR ( "ni", floor ((nf / ncomp)+0.5) );
   }

   if ( arraydim > 1 )
      arrayelemts = 2;
   else
      arrayelemts = 1;
   P_SETPAR ( "arrayelemts", arrayelemts );

   if (nfarg)
      arraydim = floor(((arraydim/ni)*ncomp)+0.5);
   else
      arraydim *= floor ((nf / ncomp)+0.5);
   P_SETPAR ( "arraydim", arraydim );
   if ( ( r = P_setreal ( CURRENT, "cf", (float)1, 1 ) ) )
   {  P_err ( r, "cf", ":" );
      ABORT;
   }

   /* Display new parameters, and clear status on screen */
   appendvarlist("nf,ni,arrayelemts,arraydim,cf");

   Winfoprintf("Flash Convert reformatting completed.");
   /* Normal, successful return */
   RETURN;

/* Since this item was defined within this routine, get rid of it now */
#undef P_SETPAR

} /* End function flashc */
Esempio n. 23
0
static int getlines(int noneg)
/*******************/
{
  vInfo  info;
  double freq;
  double amp;
  double tmpfrq;
  int    tmppos;
  int    r;
  int    index;
  int    count=0;

  if ( (r=P_getVarInfo(CURRENT,"llfrq",&info)) )
  { P_err(r,"llfrq",":");   return ERROR; }
  if (info.size >= 1)
  {
    if ((linefrq = (double *)
                   allocateWithId(sizeof(double)*(info.size + 1),"dpf"))==0)
    { Werrprintf("cannot allocate buffer space");
      return(0);
    }
    if ((lineamp = (double *)
                   allocateWithId(sizeof(double)*(info.size + 1),"dpf"))==0)
    { Werrprintf("cannot allocate buffer space");
      release(linefrq);
      return(0);
    }
    if ((linepos = (int *)
                   allocateWithId(sizeof(int)*(info.size + 1),"dpf"))==0)
    { Werrprintf("cannot allocate buffer space");
      release(linefrq);
      release(lineamp);
      return(0);
    }
    if (debug1)
      Wscrprintf("line      freq       amp       position\n");
    for (index = 1; index <= info.size; index++)
    {
      if ( (r=P_getreal(CURRENT,"llfrq",&freq,index)) )
      { P_err(r,"llfrq",":");   return ERROR; }
      tmpfrq = freq - rflrfp;
      tmppos = dfpnt  + dnpnt  * (wp  - tmpfrq  + sp ) / wp;
      if ( (r=P_getreal(CURRENT,"llamp",&amp,index)) )
      { P_err(r,"llamp",":");   return ERROR; }
      if (tmppos > dfpnt && tmppos < dfpnt+dnpnt && (amp >= 0 || !noneg))
      {
	count++;
        linefrq[count] = tmpfrq;
        linepos[count] = tmppos;
        if (amp < 0.0)
          amp = 0.0;
        lineamp[count] = amp * scale;
        if (debug1)
          Wscrprintf("%d   %g   %g   %d\n",
                  count,linefrq[count],lineamp[count],linepos[count]);
      }
    }
    return(count);
  }
  else
    return(0); 
}
Esempio n. 24
0
static int getregions(int resets)
/*******************/
{
  double freq;
  double amp;
  int    r;
  int    index,groups;

  double vs1;
  double start;
  double edge;
  double norm;
  
  if ((lineamp = (double *)
              allocateWithId(sizeof(double)*(((resets + 1) / 2)+1),"dpir"))==0)
  { Werrprintf("cannot allocate buffer space");
    return(0);
  }
  if ((gb = (struct int_entry *)
          allocateWithId(sizeof(struct int_entry)*(((resets + 1) / 2)+1),"dpir"))==0)
  { Werrprintf("cannot allocate buffer space");
    release(lineamp);
    return(0);
  }

  start = sp + wp;
  edge = start;
  if (normInt)
  {
    norm = 0.0;
    if (debug1)
      Wscrprintf("integral normalization\n");
    for (index = 1; index <= resets; index++)
    {
      if ( (r=P_getreal(CURRENT,"lifrq",&freq,index)) )
      { P_err(r,"lifrq",":");   return ERROR; }
      if (freq - rflrfp < edge )
        if (index % 2 == 0)
        {
          if ( (r=P_getreal(CURRENT,"liamp",&amp,index)) )
          { P_err(r,"liamp",":");   return ERROR; }
          norm += amp;
        }
    }
    vs1 = (norm == 0.0) ? 1.0 : insval  / norm;
  }
  else
    vs1 =  insval;
  if (vs1 == 0.0)
    vs1 = 1.0;
  if (debug1)
    Wscrprintf("scale factor= %g, liamp size= %d\n",
                vs1,resets);
  groups = 0;
  gb[1].lowlimit = dfpnt;
  for (index = 1; index <= resets; index++)
  {
    if ( (r=P_getreal(CURRENT,"lifrq",&freq,index)) )
    { P_err(r,"lifrq",":");   return ERROR; }
    freq -= rflrfp;
    if (freq < edge )
    {
      if (freq < sp)
        freq = sp;
      if ( (r=P_getreal(CURRENT,"liamp",&amp,index)) )
      { P_err(r,"liamp",":");   return ERROR; }
      if (index % 2)
        gb[groups + 1].lowlimit = dfpnt  + dnpnt  * (wp - freq + sp ) / wp;
      else
      {
        groups++;
        gb[groups].highlimit = dfpnt  + dnpnt  * (wp - freq + sp ) / wp;
        lineamp[groups] = vs1 * amp;
      }
    }
  }
  return(groups);
}
Esempio n. 25
0
int main( int argc, char *argv[] )
{
  char *buf = NULL;
  time_t initial_read_time = 0;

  /* Parse command line. */

  Parse_command_line( argc, argv );

  /* Set up signal handlers */

  Set_signals();

  /* Set input stream (stdin) to be unbuffered. */

  setvbuf( stdin, buf, _IONBF, sizeof( _IONBF ) );

  /* Loop/read data. The format of a level-II file is as follows:
     24 byte volume header -
           bytes 00-08 - file name (AR2V00xx. where xx is LDM version)
           bytes 09-11 - volume number sequence (001-999)
           bytes 12-15 - volume start date
           bytes 16-19 - volume start time (milliseconds after midnight)
           bytes 20-23 - ICAO
      4 byte flag indicating length compressed meta data record
      compressed meta data record
      4 byte flag indicating length of compressed radials record
      compressed radials record
      4 byte flag indicating length of compressed radials record
      compressed radials record
      .
      .
      .
  */

  /* Note initial start time. */

  initial_read_time = time( NULL );

  /* Read the initial control word. */

  Read_control_word();
  P_debug( "control word 1: %d", Control_word );

  /* Ensure this is the start of a new volume file. If not, bail. */

  Check_for_start_of_volume();

  /* Read meta data (first record of new volume file). */

  Read_meta_data();

  /* Loop and read rest of volume file. */

  while( End_of_volume_flag == NO )
  {
    /* Sanity check. If it takes too long, assume something
       bad has happened and bail. */
    if( time( NULL ) - initial_read_time > DATA_READ_TIMEOUT )
    {
      P_err( "Read timeout (>%d). Exiting.", DATA_READ_TIMEOUT );
      Print_stats( READ_STDIN_TIMEOUT );
    }

    /* Read control word that tells us what to do. */
    Read_control_word();
    P_debug( "control word 2: %d", Control_word );

    Read_radial_data();
  }

  Print_stats( EXIT_SUCCESS );

  return 0;
}
Esempio n. 26
0
static int setDataFile2D3D(int fn0, int f2realOnly, int fn1, int f1realOnly,
              int *blockStat, int *blocks2D, int *traces2D, int *np2D,
              int flag3d, int flag4d)
/**********************/
{ char path[MAXPATH];
  dfilehead datahead;
  double rfn;
  int r;
  int stat;
  int nblocks;
  int sperblock0;
  char *fnx;
  char *fny;
  int  stat2d3d;

/*
  fprintf(stderr,"setDataFile2D3D fn0= %d f2realOnly= %d fn1= %d f1realOnly= %d\n",
                  fn0, f2realOnly, fn1, f1realOnly);
 */
  
  fnx = "fn";
  fny = "fn1";
  stat2d3d = (S_NP|S_NI);
  if (flag4d)
  {
     char plane[STR64];

     if ( (r=P_getstring(CURRENT,"plane",plane,1,STR64-1)) )
     { P_err(r,"plane",":");
       ABORT;
     }
     if ( ! strcmp(plane,"f1f4") )
     {
        fnx = "fn";
        fny = "fn1";
        stat2d3d = ND_NP|ND_NI;
     }
     if ( ! strcmp(plane,"f1f3") )
     {
        fnx = "fn3";
        fny = "fn1";
        stat2d3d = ND_NI3|ND_NI;
     }
     else if ( ! strcmp(plane,"f1f2") )
     {
        fnx = "fn2";
        fny = "fn1";
        stat2d3d = ND_NI2|ND_NI;
     }
     else if ( ! strcmp(plane,"f2f4") )
     {
        fnx = "fn";
        fny = "fn2";
        stat2d3d = ND_NP|ND_NI2;
     }
     else if ( ! strcmp(plane,"f2f3") )
     {
        fnx = "fn3";
        fny = "fn2";
        stat2d3d = ND_NI3|ND_NI2;
     }
     else if ( ! strcmp(plane,"f3f4") )
     {
        fnx = "fn";
        fny = "fn3";
        stat2d3d = ND_NP|ND_NI3;
     }
  }
  else if (flag3d)
  {
     char plane[STR64];

     if ( (r=P_getstring(CURRENT,"plane",plane,1,STR64-1)) )
     { P_err(r,"plane",":");
       ABORT;
     }
     if ( ! strcmp(plane,"f1f3") )
     {
        fnx = "fn";
        fny = "fn1";
        stat2d3d = (S_3D|S_NP|S_NI);
     }
     else if ( ! strcmp(plane,"f1f2") )
     {
        fnx = "fn2";
        fny = "fn1";
        stat2d3d = (S_3D|S_NI2|S_NI);
     }
     else if ( ! strcmp(plane,"f2f3") )
     {
        fnx = "fn";
        fny = "fn2";
        stat2d3d = (S_3D|S_NP|S_NI2);
     }
  }
  if ( (r=P_getreal(CURRENT,fnx,&rfn,1)) )
    { P_err(r,fnx,":");
      ABORT;
    }
  if ( f2realOnly && ((int) rfn != (fn0*2)))
  {
     Werrprintf("%s mismatch for real data (%d)",fnx, 2*fn0);
     ABORT;
  }
  else if ( ! f2realOnly && ((int) rfn != fn0) )
  {
     Werrprintf("%s mismatch for complex data (%d)", fnx, fn0);
     ABORT;
  }
  P_setreal(PROCESSED,fnx,rfn,0);
  D_trash(D_DATAFILE);
  D_trash(D_PHASFILE);
  fn0 = (int) rfn;
  if ( (r=P_getreal(CURRENT,fny,&rfn,1)) )
    { P_err(r,fny,":");
      ABORT;
    }
  if ( f1realOnly && ((int) rfn != (fn1*2)))
  {
     Werrprintf("%s mismatch for real data (%d)", fny, 2*fn1);
     ABORT;
  }
  else if ( ! f1realOnly && ((int) rfn != fn1) )
  {
     Werrprintf("%s mismatch for complex data (%d)", fny, fn1);
     ABORT;
  }

  if ( (r = D_getfilepath(D_DATAFILE, path, curexpdir)) )
  {
     D_error(r);
     ABORT;
  }

  sperblock0 = (BUFWORDS/fn0) * bufferscale;
  if (sperblock0 > fn1/2)
     sperblock0 = fn1/2;
  if (sperblock0 < 4)
     sperblock0 = 4;
  nblocks = fn1/(2 * sperblock0);
  if ( ! f1realOnly && ! f2realOnly)
  {
     sperblock0 /= 2;
     nblocks *= 2;
  }
  if (nblocks == 0)
     nblocks = 1;
  if (nblocks == 2)
  {
     nblocks = 1;
     sperblock0 *= 2;
  }

  datahead.nblocks = nblocks;
  datahead.ntraces = fn0/(2*nblocks);
  datahead.np      = fn1;
  datahead.vers_id = VERSION;
  datahead.vers_id += DATA_FILE;
  datahead.nbheaders = 1;
  datahead.ebytes  = 4;
  datahead.tbytes  = datahead.ebytes * datahead.np;
  datahead.bbytes  = datahead.tbytes * datahead.ntraces +
                       sizeof(dblockhead);
  datahead.status  = S_SECND|S_TRANSF;
  if ( ! f1realOnly && ! f1realOnly)
  {
     datahead.bbytes += sizeof(dblockhead);
     datahead.nbheaders = 2;
     datahead.status  |= S_HYPERCOMPLEX;
  }

  if (f1realOnly)
    stat  = (S_DATA|S_SPEC|S_FLOAT);
  else
    stat  = (S_DATA|S_SPEC|S_FLOAT|S_COMPLEX|NP_CMPLX);
  if (flag4d)
  {
     datahead.nbheaders |= stat2d3d;
     datahead.status  |= stat;
  }
  else
  {
     datahead.status  |= (stat|stat2d3d);
  }

  if ( (r=D_newhead(D_DATAFILE,path,&datahead)) )
    { D_error(r); ABORT;
    }
  *blockStat = stat;
  *blocks2D = datahead.nblocks;
  *traces2D = datahead.ntraces;
  *np2D = datahead.np;

  if ( (r = D_getfilepath(D_PHASFILE, path, curexpdir)) )
  {
     D_error(r);
     ABORT;
  }

  datahead.vers_id += PHAS_FILE - DATA_FILE;
  if ( (r=D_newhead(D_PHASFILE,path,&datahead)) )
    { D_error(r); ABORT;
    }
  RETURN;
}
Esempio n. 27
0
static void Process_radial( char *buf )
{
  Generic_basedata_t* rec = (Generic_basedata_t *) buf;
  Generic_any_t *data_block = NULL;
  int offset = -1;
  int no_of_datum = -1;
  int i = -1;
  char data_block_name[5];
  char moment_name[5];
  static int previous_az_number = 0;
  static float previous_azimuth = -1.0;
  static int previous_elev_number = 0;
  static float previous_elevation = -1.0;

  /* Increment radial counter */
  Number_of_radials++;

  /* Byte swap generic basedata header */
  Byte_swap_generic_basedata_hdr( &(rec->base) );

  /* Set values according to radial status */
  if( rec->base.status == BEG_VOL )
  {
    /* First radial date/time is start of volume date/time */
    Volume_start_epoch = rec->base.date*SECONDS_PER_DAY;
    Volume_start_epoch += rec->base.time/MILLISECONDS_PER_SECOND;
  }

  if( rec->base.status == END_VOL )
  {
    /* Last radial date/time is end of volume date/time */
    Volume_end_epoch = rec->base.date*SECONDS_PER_DAY;
    Volume_end_epoch += rec->base.time/MILLISECONDS_PER_SECOND;
    Volume_duration = Volume_end_epoch - Volume_start_epoch;
  }

  if( rec->base.status == BEG_ELEV || rec->base.status == BEG_VOL )
  {
    /* New elevation, so increment elevation counter */
    Number_of_elevations++;
    /* Check for elevation gaps */
    if( rec->base.elev_num - previous_elev_number != 1 )
    {
      P_err( "ELEV GAP: ELEVNUM1: %02d ELEV1: %6.2f ELEVNUM2: %02d ELEV2: %6.2f", previous_elev_number, previous_elevation, rec->base.elev_num, rec->base.elevation );
    }
    previous_elev_number = rec->base.elev_num;
    previous_elevation = rec->base.elevation;
  }

  /* Check for radial gaps */
  if( rec->base.azi_num - previous_az_number != 1 )
  {
    P_err( "  AZ GAP: ELEV: %6.2f AZNUM1: %03d AZ1: %7.2f AZNUM2: %03d AZ2: %7.2f", rec->base.elevation, previous_az_number, previous_azimuth, rec->base.azi_num, rec->base.azimuth );
  }
  previous_az_number = rec->base.azi_num;
  previous_azimuth = rec->base.azimuth;

  if( rec->base.status == END_ELEV )
  {
    /* If end of elevation, reset azimuth index counter */
    previous_az_number = 0;
    previous_azimuth = -1.0;
  }

  /* Make sure a start of volume flag was received */
  if( Volume_start_epoch == EPOCH_INIT )
  {
    P_err( "No beginning of volume radial found" );
    Print_stats( MISSING_START_OF_VOLUME_RADIAL );
  }

  /******************************************************************/
  /* From this point on, the radial data is parsed for information. */
  /******************************************************************/

  /* Number of data blocks in radial */
  no_of_datum = rec->base.no_of_datum;

  for( i = 0; i < no_of_datum; i++ )
  {
    MISC_swap_longs( 1, (long *) &(rec->base.data[i]) );
    offset = rec->base.data[i];

    data_block = (Generic_any_t *)
                 (buf + sizeof(RDA_RPG_message_header_t) + offset);

    /* Convert the block name to a string so we can do string compares. */
    memset( data_block_name, 0, 5 );
    memcpy( data_block_name, data_block->name, 4 );
    data_block_name[4] = '\0';

    if( data_block_name[0] == 'R' )
    {
      if( strcmp( data_block_name, RRAD_TAG ) == 0 )
      {
        continue;
      }
      else if( strcmp( data_block_name, RELV_TAG ) == 0 )
      {
        continue;
      }
      else if( strcmp( data_block_name, RVOL_TAG ) == 0 )
      {
         Generic_vol_t *vol = (Generic_vol_t *) data_block;
         MISC_swap_shorts( 1, (short *) &(vol->vcp_num) );
         VCP = vol->vcp_num;
      }
      else
      {
        P_err( "Invalid Data Block name %s", data_block_name );
        Print_stats( INVALID_DATA_BLOCK_NAME );
      }
    }
    else if( data_block_name[0] == 'D' )
    {
      Generic_moment_t *moment = (Generic_moment_t *) data_block;

      /* Convert the data name to a string so we can do string compares. */
      memset( moment_name, 0, 5 );
      memcpy( moment_name, moment->name, 4 );
      moment_name[4] = '\0';

      if( strcmp( moment_name, DREF_TAG ) == 0 )
      {
        continue;
      }
      else if( strcmp( moment_name, DVEL_TAG ) == 0 )
      {
        continue;
      }
      else if( strcmp( moment_name, DSW_TAG ) == 0 )
      {
        continue;
      }
      else if( strcmp( moment_name, DZDR_TAG ) == 0 )
      {
        DP_flag = YES;
      }
      else if( strcmp( moment_name, DPHI_TAG ) == 0 )
      {
        DP_flag = YES;
      }
      else if( strcmp( moment_name, DRHO_TAG ) == 0 )
      {
        DP_flag = YES;
      }
      else
      {
         P_err( "Invalid Moment_name: %s", moment_name );
         Print_stats( INVALID_MOMENT_NAME );
      }
    }
    else
    {
       P_err( "Invalid Data Block Type: %c", data_block_name[0] );
       Print_stats( INVALID_DATA_BLOCK_TYPE );
    }
  }
}