Misc updates

pull/10/head
Cees Bassa 2014-09-22 19:33:45 +02:00
parent 6fd8c6ed97
commit e31c1b4b7c
6 changed files with 100 additions and 25 deletions

View File

@ -47,14 +47,11 @@
33320 2241.601 33320 2241.601
32378 2242.503 32378 2242.503
28384 2242.505 28384 2242.505
39232 2242.510
28888 2242.510 28888 2242.510
24680 2242.510 24680 2242.510
26934 2242.510
37348 2242.510 37348 2242.510
90004 2242.518 90004 2242.518
39088 2243.334 39088 2243.334
38782 2243.764
38782 2243.765 38782 2243.765
35937 2244.095 35937 2244.095
29522 2244.301 29522 2244.301
@ -223,3 +220,32 @@
35938 2269.105 35938 2269.105
35938 2271.481 35938 2271.481
39678 2270.517 39678 2270.517
26464 2249.006
35937 2246.473
35937 2248.521
35937 2249.545
31113 2273.522
26934 2242.479
35937 2244.421
39209 2242.493
39232 2242.511
39232 2244.559
26619 2242.408
35931 2250.004
37849 2250.125
24753 2252.507
33434 2249.995
38248 2250.006
35951 2252.505
37849 2255.367
37849 2252.222
29479 2252.224
29479 2255.700
29522 2252.495
36834 2253.841
39634 2254.116
35937 2255.688
35937 2252.616
78405 2252.515
78406 2252.515
78407 2252.515

View File

@ -2,13 +2,19 @@
CFLAGS = -O3 CFLAGS = -O3
# Linking flags # Linking flags
LFLAGS = -lcpgplot -lpgplot -lX11 -lpng -lm LFLAGS = -lcpgplot -lpgplot -lX11 -lpng -lm -lgsl -lgslcblas
# Compiler # Compiler
CC = gcc CC = gcc
all: all:
make rfedit rfplot rffft make rfedit rfplot rffft rfpng
rfpng: rfpng.o rftime.o rfio.o rftrace.o sgdp4.o satutl.o deep.o ferror.o
gfortran -o rfpng rfpng.o rftime.o rfio.o rftrace.o sgdp4.o satutl.o deep.o ferror.o $(LFLAGS)
rffind: rffind.o rfio.o rftime.o
gfortran -o rffind rffind.o rfio.o rftime.o $(LFLAGS)
rfedit: rfedit.o rfio.o rftime.o rfedit: rfedit.o rfio.o rftime.o
$(CC) -o rfedit rfedit.o rfio.o rftime.o -lm $(CC) -o rfedit rfedit.o rfio.o rftime.o -lm

2
rfio.c
View File

@ -99,7 +99,7 @@ struct spectrogram read_spectrogram(char *prefix,int isub,int nsub,double f0,dou
if (l%nbin==nbin-1) { if (l%nbin==nbin-1) {
// Scale // Scale
s.mjd[i]/=(float) nbin; s.mjd[i]/=(float) nbin;
for (j=0;j<s.nchan;j++) for (j=0;j<s.nchan;j++)
s.z[i+s.nsub*j]/=(float) nbin; s.z[i+s.nsub*j]/=(float) nbin;

View File

@ -39,7 +39,7 @@ int main(int argc,char *argv[])
float width=1500; float width=1500;
float x,y,x0,y0; float x,y,x0,y0;
char c; char c;
char path[128],xlabel[64],ylabel[64]; char path[128],xlabel[64],ylabel[64],filename[32],tlefile[128];
int sec,lsec,ssec; int sec,lsec,ssec;
char stime[16]; char stime[16];
double fmin,fmax,fcen,f; double fmin,fmax,fcen,f;
@ -60,10 +60,12 @@ int main(int argc,char *argv[])
} else { } else {
printf("ST_COSPAR environment variable not found.\n"); printf("ST_COSPAR environment variable not found.\n");
} }
env=getenv("ST_TLEDIR");
sprintf(tlefile,"%s/bulk.tle",env);
// Read arguments // Read arguments
if (argc>1) { if (argc>1) {
while ((arg=getopt(argc,argv,"p:f:w:s:l:b:z:hc:"))!=-1) { while ((arg=getopt(argc,argv,"p:f:w:s:l:b:z:hc:C:"))!=-1) {
switch (arg) { switch (arg) {
case 'p': case 'p':
@ -97,8 +99,12 @@ int main(int argc,char *argv[])
case 'h': case 'h':
usage(); usage();
return 0; return 0;
case 'c': case 'c':
strcpy(tlefile,optarg);
break;
case 'C':
site_id=atoi(optarg); site_id=atoi(optarg);
break; break;
@ -118,7 +124,7 @@ int main(int argc,char *argv[])
printf("Read spectrogram\n%d channels, %d subints\nFrequency: %g MHz\nBandwidth: %g MHz\n",s.nchan,s.nsub,s.freq*1e-6,s.samp_rate*1e-6); printf("Read spectrogram\n%d channels, %d subints\nFrequency: %g MHz\nBandwidth: %g MHz\n",s.nchan,s.nsub,s.freq*1e-6,s.samp_rate*1e-6);
// Compute traces // Compute traces
t=compute_trace(s.mjd,s.nsub,site_id,s.freq*1e-6,s.samp_rate*1e-6,&nsat); t=compute_trace(tlefile,s.mjd,s.nsub,site_id,s.freq*1e-6,s.samp_rate*1e-6,&nsat);
printf("Traces for %d objects for location %d\n",nsat,site_id); printf("Traces for %d objects for location %d\n",nsat,site_id);
cpgopen("/xs"); cpgopen("/xs");
@ -240,7 +246,7 @@ int main(int argc,char *argv[])
// Identify // Identify
if (c=='i') { if (c=='i') {
identify_trace(tf,0); identify_trace(tlefile,tf,0);
redraw=1; redraw=1;
continue; continue;
} }
@ -249,7 +255,7 @@ int main(int argc,char *argv[])
if (c=='I') { if (c=='I') {
printf("Provide satno: "); printf("Provide satno: ");
scanf("%d",&satno); scanf("%d",&satno);
identify_trace(tf,satno); identify_trace(tlefile,tf,satno);
redraw=1; redraw=1;
continue; continue;
} }
@ -377,6 +383,42 @@ int main(int argc,char *argv[])
fclose(file); fclose(file);
} }
// Mark
if (c=='a') {
i0=(int) floor(xmin);
i1=(int) ceil(xmax);
j0=(int) floor(ymin);
j1=(int) ceil(ymax);
if (i0<0)
i0=0;
if (i1>=s.nsub)
i1=s.nsub-1;
if (j0<0)
j0=0;
if (j1>=s.nchan)
j1=s.nchan-1;
printf("Provide filename: ");
scanf("%s",filename);
file=fopen(filename,"a");
// Loop over image
for (i=i0;i<i1;i++) {
zzmax=0.0;
jmax=0;
for (j=j0;j<j1;j++) {
if (s.z[i+s.nsub*j]>zzmax) {
zzmax=s.z[i+s.nsub*j];
jmax=j;
}
}
f=s.freq-0.5*s.samp_rate+(double) jmax*s.samp_rate/(double) s.nchan;
if (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);
}
fclose(file);
}
// Center // Center
if (c=='c') { if (c=='c') {
@ -432,7 +474,7 @@ int main(int argc,char *argv[])
// Recompute traces // Recompute traces
if (c=='R') { if (c=='R') {
t=compute_trace(s.mjd,s.nsub,site_id,s.freq*1e-6,s.samp_rate*1e-6,&nsat); t=compute_trace(tlefile,s.mjd,s.nsub,site_id,s.freq*1e-6,s.samp_rate*1e-6,&nsat);
redraw=1; redraw=1;
continue; continue;
} }
@ -636,6 +678,8 @@ void usage(void)
printf("-z <zmax> Image scaling upper limit [8.0]\n"); printf("-z <zmax> Image scaling upper limit [8.0]\n");
printf("-f <freq> Frequency to zoom into (Hz)\n"); printf("-f <freq> Frequency to zoom into (Hz)\n");
printf("-w <bw> Bandwidth to zoom into (Hz)\n"); printf("-w <bw> Bandwidth to zoom into (Hz)\n");
printf("-C <site> Site ID\n");
printf("-c <catalog> TLE catalog\n");
printf("-h This help\n"); printf("-h This help\n");
return; return;

View File

@ -146,7 +146,7 @@ struct site get_site(int site_id)
} }
// Identify trace // Identify trace
void identify_trace(struct trace t,int satno) void identify_trace(char *tlefile,struct trace t,int satno)
{ {
int i,imode,flag=0; int i,imode,flag=0;
struct point *p; struct point *p;
@ -160,11 +160,10 @@ void identify_trace(struct trace t,int satno)
char nfd[32],nfdmin[32],text[16]; char nfd[32],nfdmin[32],text[16];
int satnomin; int satnomin;
double rmsmin,freqmin; double rmsmin,freqmin;
char *env,freqlist[LIM],tledir[LIM]; char *env,freqlist[LIM];
env=getenv("ST_DATADIR"); env=getenv("ST_DATADIR");
sprintf(freqlist,"%s/data/frequencies.txt",env); sprintf(freqlist,"%s/data/frequencies.txt",env);
sprintf(tledir,"%s/tle/bulk.tle",env);
// Reloop stderr // Reloop stderr
freopen("/tmp/stderr.txt","w",stderr); freopen("/tmp/stderr.txt","w",stderr);
@ -183,9 +182,9 @@ void identify_trace(struct trace t,int satno)
printf("Fitting trace:\n"); printf("Fitting trace:\n");
// Loop over TLEs // Loop over TLEs
file=fopen(tledir,"r"); file=fopen(tlefile,"r");
if (file==NULL) { if (file==NULL) {
fprintf(stderr,"TLE file %s not found\n",tledir); fprintf(stderr,"TLE file %s not found\n",tlefile);
return; return;
} }
while (read_twoline(file,satno,&orb)==0) { while (read_twoline(file,satno,&orb)==0) {
@ -269,7 +268,7 @@ void identify_trace(struct trace t,int satno)
} }
// Compute trace // Compute trace
struct trace *compute_trace(double *mjd,int n,int site_id,float freq,float bw,int *nsat) struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float freq,float bw,int *nsat)
{ {
int i,j,imode,flag,satno,tflag,m; int i,j,imode,flag,satno,tflag,m;
struct point *p; struct point *p;
@ -282,11 +281,11 @@ struct trace *compute_trace(double *mjd,int n,int site_id,float freq,float bw,in
char line[LIM],text[8]; char line[LIM],text[8];
struct trace *t; struct trace *t;
float fmin,fmax; float fmin,fmax;
char *env,freqlist[LIM],tledir[LIM]; char *env,freqlist[LIM];
env=getenv("ST_DATADIR"); env=getenv("ST_DATADIR");
sprintf(freqlist,"%s/data/frequencies.txt",env); sprintf(freqlist,"%s/data/frequencies.txt",env);
sprintf(tledir,"%s/tle/bulk.tle",env);
// Frequency limits // Frequency limits
fmin=freq-0.5*bw; fmin=freq-0.5*bw;
@ -307,7 +306,7 @@ struct trace *compute_trace(double *mjd,int n,int site_id,float freq,float bw,in
} }
fclose(infile); fclose(infile);
*nsat=i; *nsat=i;
printf("bla\n");
// Break out // Break out
if (i==0) if (i==0)
return t; return t;
@ -349,7 +348,7 @@ struct trace *compute_trace(double *mjd,int n,int site_id,float freq,float bw,in
sprintf(text," %d",satno); sprintf(text," %d",satno);
// Loop over TLEs // Loop over TLEs
file=fopen(tledir,"r"); file=fopen(tlefile,"r");
while (read_twoline(file,satno,&orb)==0) { while (read_twoline(file,satno,&orb)==0) {
// Initialize // Initialize
imode=init_sgdp4(&orb); imode=init_sgdp4(&orb);

View File

@ -4,5 +4,5 @@ struct trace {
double *freq; double *freq;
float *za; float *za;
}; };
struct trace *compute_trace(double *mjd,int n,int site_id,float fmin,float fmax,int *nsat); struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float fmin,float fmax,int *nsat);
void identify_trace(struct trace t,int satno); void identify_trace(char *tlefile,struct trace t,int satno);