示例#1
0
void fft3D(complex *** data, int size, int inverse) {
  int x, y;
  for(x = 0; x < size; x++) {
    for(y = 0; y < size; y++) {
      fft1D(data[x][y], size, inverse);
    }
  }
  transposexz(data, size);
  for(x = 0; x < size; x++) {
    for(y = 0; y < size; y++) {
      fft1D(data[x][y], size, inverse);
    }
  }
  transposeyz(data, size);
  for(x = 0; x < size; x++) {
    for(y = 0; y < size; y++) {
      fft1D(data[x][y], size, inverse);
    }
  }
  transposeyz(data, size);
  transposexz(data, size);
}
示例#2
0
文件: default1D.c 项目: tesch1/Xrecon
void default1D(struct data *d)
{
  struct file fref;
  struct data ref;
  struct datablockhead *dbh;
  int /*dim1,dim2,*/dim3,nr;
  int i,j;
  int wref=FALSE;

#ifdef DEBUG
  char function[20];
  strcpy(function,"default1D"); /* Set function name */
#endif

  /* Open data and phasefile file pointers for writing */
  openfpw(d,DATA_FILE);
  openfpw(d,PHAS_FILE);

  /* Write data and phasefile file headers */
  wdfh(d,DATA_FILE);
  wdfh(d,PHAS_FILE);

  /* Set data dimensions */
  //dim1=d->np/2;
  //dim2=1;
  dim3=d->fh.ntraces;
  nr=d->nr;

  /* Set nuber of "volumes" */
  d->nvols=d->fh.nblocks/nr;

  /* Check if there is a water reference */
  if (spar(d,"ws","y") && spar(d,"wref","y") && spar(d,"wrefstatus","ws")) wref=TRUE;

  /* Prepare water reference */
  if (wref) {
    setreffile(&fref,d,"waterref"); /* Set reference file */
    getpars(fref.procpar[0],&ref);  /* Get pars from reference procpar */
    opendata(fref.fid[0],&ref);     /* Open reference data file fid */
    getvol1D(&ref,0,NDCC);          /* Get volume without applying dbh.lvl and dbh.tlt */
    weightdata1D(&ref,STD,D1);      /* Weight data using standard VnmrJ parameters */
  }

  /* Allocate memory for blocks headers from all receivers */
  if ((dbh = malloc(nr*sizeof(d->bh))) == NULL) nomem();

  /* For spectra we anticipate there is easily sufficient memory for data
     from all receiver blocks */
  for (d->vol=0;d->vol<d->nvols;d->vol++) { /* loop over "volumes" */

    for (i=0;i<nr;i++) { /* loop over receivers */
      getdbh(d,nr*d->vol+i);       /* Get block header */
      copydbh(&d->bh,&dbh[i]);     /* Store the block headers for writing */
    }

    getvol1D(d,d->vol,NDCC); /* Get data block without applying dbh.lvl and dbh.tlt */

    weightdata1D(d,STD,D1);         /* Weight data using standard VnmrJ parameters */

    if (wref) refcorr1D(d,&ref);    /* Phase correct using the reference */

    else combine1D(d);              /* Combine data from multiple receivers */

    zerofill1D(d,STD,D1);           /* Zero fill data using standard VnmrJ parameters */

    fft1D(d,D1);                    /* 1D fft */

    shiftdata1D(d,STD,D1);          /* Shift data to get spectra */

    for (i=0;i<nr;i++) {            /* loop over receivers */
      copydbh(&dbh[i],&d->bh);      /* Copy block header for writing */
      for (j=0;j<dim3;j++) {
        d->bh.index=d->vol*nr*dim3+i*dim3+j; /* Set block index */
        wdbh(d,DATA_FILE);            /* Write block header */
        wdbh(d,PHAS_FILE);            /* Write block header */
        w1Dtrace(d,i,j,DATA_FILE);    /* Write block */
        w1Dtrace(d,i,j,PHAS_FILE);    /* Write block */
      }
    }

    clear1Ddata(d);               /* Clear data "volume" from memory */

  }

  clear1Dall(d);                /* Clear everything from memory */

  closefp(d,DATA_FILE);
  closefp(d,PHAS_FILE);

}