#include "dedisperse.h" /* orders incoming blocks of data into dedispersed sub-bands */ void dedisperse_data(FILE *input, FILE *output) /*includefile*/ { char message[80]; float *buff[2], *dedisp, realtime, nextbaseline, *offset, *tmpblk; int readnext=0,isamp,bnum,nsamp,i,j,s,c,b,indx,ns[2],soffset,ddidx; int ic,ixnb,ixnc,*ishift,maxshift,nsblk,nsmax,cpb,d,spb,x,nsout,nxb; int *ignore; /* calculate table of shift values given the filterbank and DM */ ishift=dmshift(fch1,foff,nchans,nbands,userdm,refrf,tsamp); maxshift=ishift[nchans-1]; /* set the buffer size based on the maximum shift */ nsblk=256*nchans; nsout=32*nchans; /*nsblk=256*nchans; nsout=32768*nchans;*/ nsmax=maxshift*nifs*nchans; if (nsmax>nsblk) nsblk=nsmax; nxb=nifs*nbands; /* define the buffers and initialize counters */ dedisp =(float *) malloc(nxb*nsout*sizeof(float)); offset =(float *) malloc(nxb*sizeof(float)); tmpblk =(float *) malloc(nsout*sizeof(float)); buff[0]=(float *) malloc(nsblk*sizeof(float)); buff[1]=(float *) malloc(nsblk*sizeof(float)); for (i=0;iclipthreshold[ixnb+b] && clipping) sample=0.0; /* store the final produce and swap bytes if necessary */ dedisp[sxib+ixnb+b]=sample; if (swapout) swap_float(&dedisp[sxib+ixnb+b]); } } } /* now write out samples and bat on */ fwrite(dedisp,sizeof(float),nsout*nifs*nbands,output); if (first) { first=0; free(temp); } }