Add user output filename option
parent
c053a2a0cc
commit
98bcfe5e6e
18
rffft.c
18
rffft.c
|
@ -13,6 +13,7 @@ void usage(void)
|
|||
printf("rffft: FFT RF observations\n\n");
|
||||
printf("-i <file> Input file (can be fifo) [stdin]\n");
|
||||
printf("-p <prefix> Output prefix\n");
|
||||
printf("-o <output> Output filename [default: YYYY-MM-DDTHH:MM:SS.sss_XXXXXX.bin]\n");
|
||||
printf("-f <frequency> Center frequency (Hz)\n");
|
||||
printf("-s <samprate> Sample rate (Hz)\n");
|
||||
printf("-c <chansize> Channel size [100Hz]\n");
|
||||
|
@ -31,11 +32,11 @@ void usage(void)
|
|||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
int i,j,k,l,m,nchan,nint=1,arg=0,nbytes,nsub=60,flag,nuse=1,realtime=1,quiet=0,imin,imax,partial=0;
|
||||
int i,j,k,l,m,nchan,nint=1,arg=0,nbytes,nsub=60,flag,nuse=1,realtime=1,quiet=0,imin,imax,partial=0,useoutput=0;
|
||||
fftwf_complex *c,*d;
|
||||
fftwf_plan fft;
|
||||
FILE *infile,*outfile;
|
||||
char infname[128]="",outfname[128]="",path[64]=".",prefix[32]="";
|
||||
char infname[128]="",outfname[128]="",path[64]=".",prefix[32]="",output[128]="";
|
||||
char informat='i',outformat='f';
|
||||
int16_t *ibuf;
|
||||
char *cbuf;
|
||||
|
@ -48,7 +49,7 @@ int main(int argc,char *argv[])
|
|||
|
||||
// Read arguments
|
||||
if (argc>1) {
|
||||
while ((arg=getopt(argc,argv,"i:f:s:c:t:p:n:hm:F:T:bqR:"))!=-1) {
|
||||
while ((arg=getopt(argc,argv,"i:f:s:c:t:p:n:hm:F:T:bqR:o:"))!=-1) {
|
||||
switch(arg) {
|
||||
|
||||
case 'i':
|
||||
|
@ -59,6 +60,11 @@ int main(int argc,char *argv[])
|
|||
strcpy(path,optarg);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
strcpy(output,optarg);
|
||||
useoutput=1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
freq=(double) atof(optarg);
|
||||
break;
|
||||
|
@ -191,7 +197,11 @@ int main(int argc,char *argv[])
|
|||
// Forever loop
|
||||
for (m=0;;m++) {
|
||||
// File name
|
||||
sprintf(outfname,"%s/%s_%06d.bin",path,prefix,m);
|
||||
if (useoutput==0) {
|
||||
sprintf(outfname,"%s/%s_%06d.bin",path,prefix,m);
|
||||
} else {
|
||||
sprintf(outfname,"%s/%s_%06d.bin",path,output,m);
|
||||
}
|
||||
outfile=fopen(outfname,"w");
|
||||
|
||||
// Loop over subints to dump
|
||||
|
|
Loading…
Reference in New Issue