#include "getfile.h" #include #include #include #include extern qint16 id[4*60*96000]; void getfile(QString fname, bool xpol, int dbDgrd, int nfast) { int npts=2*52*96000/nfast; if(xpol) npts=2*npts; // Degrade S/N by dbDgrd dB -- for tests only!! float dgrd=0.0; if(dbDgrd<0) dgrd = 23.0*sqrt(pow(10.0,-0.1*(double)dbDgrd) - 1.0); float fac=23.0/sqrt(dgrd*dgrd + 23.0*23.0); memset(id,0,2*npts); char name[80]; strcpy(name,fname.toAscii()); FILE* fp=fopen(name,"rb"); if(fp != NULL) { fread(&datcom_.fcenter,sizeof(datcom_.fcenter),1,fp); fread(id,2,npts,fp); int j=0; if(dbDgrd<0) { for(int i=0; i0) { if(fname.mid(i0-5,1)=="_") { datcom_.nutc=10000*fname.mid(i0-4,2).toInt() + 100*fname.mid(i0-2,2).toInt(); } else { datcom_.nutc=10000*fname.mid(i0-6,2).toInt() + 100*fname.mid(i0-4,2).toInt() + fname.mid(i0-2,2).toInt(); } } } } void savetf2(QString fname, bool xpol, int nfast) { int npts=2*52*96000/nfast; if(xpol) npts=2*npts; qint16* buf=(qint16*)malloc(2*npts); char name[80]; strcpy(name,fname.toAscii()); FILE* fp=fopen(name,"wb"); if(fp != NULL) { fwrite(&datcom_.fcenter,sizeof(datcom_.fcenter),1,fp); int j=0; for(int i=0; i= 1.0 || rsq == 0.0); fac = sqrt(-2.0*log(rsq)/rsq); gset = v1*fac; iset++; return v2*fac; }