diff --git a/ferror.c b/ferror.c index 05090bf..020119a 100644 --- a/ferror.c +++ b/ferror.c @@ -19,11 +19,11 @@ va_list arg_ptr; vfprintf(stderr, format, arg_ptr); va_end(arg_ptr); - fprintf(stderr, "\nNow terminating the program...\n"); - fflush(stderr); - - exit(5); + // fprintf(stderr, "\nNow terminating the program...\n"); + // fflush(stderr); + // exit(5); + return; } /* ===================================================================== */ diff --git a/frequencies.txt b/frequencies.txt index 9c92076..8c6a972 100644 --- a/frequencies.txt +++ b/frequencies.txt @@ -326,3 +326,35 @@ 31797 2273.072 35951 2272.842 19822 2279.984 +39462 2242.505 +35951 2253.531 +35951 2254.555 +05560 2242.534 +39088 2243.334 +26958 2243.013 +40555 2280.006 +35938 2281.725 +35938 2280.701 +39210 2280.006 +27858 2232.711 +37849 2235.445 +39768 2235.006 +37391 2234.069 +24753 2235.450 +33434 2245.995 +38248 2246.006 +33434 2245.995 +33434 2245.995 +29522 2249.423 +39630 2247.384 +35951 2249.436 +35951 2247.388 +39630 2246.361 +39630 2248.409 +39630 2249.433 +40143 2248.555 +40298 2271.604 +25789 2264.989 +25476 2264.857 +40588 2215.993 +23802 2264.978 diff --git a/rffit.c b/rffit.c index 65fcff7..c2a6dab 100644 --- a/rffit.c +++ b/rffit.c @@ -23,8 +23,8 @@ struct site { } site; struct point { char timestamp[24]; - double mjd,freq,v; - float t,f; + double mjd,freq,v,freq0; + float t,f,res; float flux; int flag,site_id,rsite_id; struct site s,r; @@ -464,7 +464,7 @@ int main(int argc,char *argv[]) cpgbox("BCTSN",0.,0,"BTSN",0.,0); // cpgenv(xmin,xmax,ymin,ymax,0,0); cpglab(xlabel,ylabel,""); - + // Plot orbit if (satno>0 && plot_curve==1 && residuals==0) { @@ -512,17 +512,16 @@ int main(int argc,char *argv[]) cpgsci(1); cpgsls(1); } - } - + } // Plot selected points for (i=0;i90.0) + continue; + + // Compute position + y=(t.freq[i]-fmin)*s.nchan/(s.samp_rate*1e-6); + j0=(int) floor(y-w); + j1=(int) floor(y+w); + + // Keep in range + if (j0<0) + j0=0; + if (j1>=s.nchan) + j1=s.nchan; + + // Find maximum and significance + zm=0.0; + jmax=0; + s1=0.0; + s2=0.0; + sn=0; + for (j=j0;jzm) { + zm=z; + jmax=j; + } + } + za=s1/(float) sn; + zs=sqrt(s2/(float) sn-za*za); + sigma=(zm-za)/zs; + + // Store + if (sigma>5.0 && s.mjd[i]>1.0) { + f=s.freq-0.5*s.samp_rate+(double) jmax*s.samp_rate/(double) s.nchan; + fprintf(file,"%lf %lf %f %d\n",s.mjd[i],f,sigma,site_id); + cpgpt1((float) i,(float) jmax,17); + } + } + + // Close file + fclose(file); + + return t; +} + void filter(struct spectrogram s,int site_id) { @@ -82,7 +151,7 @@ void filter(struct spectrogram s,int site_id) else mask[j]=0; } - + /* // Find maximum when points are adjacent for (j=0;jzzmax) { - zzmax=s.z[i+s.nsub*j]; + z=s.z[i+s.nsub*j]; + if (z>zzmax) { + zzmax=z; jmax=j; } + s1+=z; + s2+=z*z; + sn++; } + za=s1/(float) sn; + zs=sqrt(s2/(float) sn-za*za); + sigma=(zzmax-za)/zs; + f=s.freq-0.5*s.samp_rate+(double) jmax*s.samp_rate/(double) s.nchan; - if (s.mjd[i]>1.0) + if (sigma>5.0 && s.mjd[i]>1.0) { fprintf(file,"%lf %lf %f %d\n",s.mjd[i],f,zzmax,site_id); - cpgpt1((float) i,(float) jmax,17); + cpgpt1((float) i,(float) jmax,17); + } } fclose(file); } @@ -822,8 +911,8 @@ void plot_traces(struct trace *t,int nsat) return; } -// Locate trace -struct trace locate_trace(struct spectrogram s,struct select sel,int site_id) +// Fit trace +struct trace fit_trace(struct spectrogram s,struct select sel,int site_id) { int i,j,k,l,sn; int i0,i1,j0,j1,jmax; @@ -895,3 +984,4 @@ struct trace locate_trace(struct spectrogram s,struct select sel,int site_id) return t; } + diff --git a/rftrace.c b/rftrace.c index 0ef3e90..546849d 100644 --- a/rftrace.c +++ b/rftrace.c @@ -192,7 +192,7 @@ void identify_trace(char *tlefile,struct trace t,int satno) // Initialize imode=init_sgdp4(&orb); if (imode==SGDP4_ERROR) - printf("Error\n"); + printf("SGDP4 Error\n"); // Loop over points for (i=0,sum1=0.0,sum2=0.0;i