From 7ddd2c4cbbe62964847e920a1cdb846995bbb233 Mon Sep 17 00:00:00 2001 From: Cees Bassa Date: Tue, 27 Feb 2018 17:19:34 +0100 Subject: [PATCH] Added help option --- allnight.c | 2 +- data/sites.txt | 11 +++------ makefile | 3 +++ measure.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++- normal.c | 28 ++++++++++++++--------- posmatch.c | 6 ++--- satmap.c | 3 ++- 7 files changed, 90 insertions(+), 25 deletions(-) diff --git a/allnight.c b/allnight.c index 626d76b..da958d9 100644 --- a/allnight.c +++ b/allnight.c @@ -64,7 +64,7 @@ int main(int argc,char *argv[]) m.mjd=nfd2mjd(m.nfd); // Decode options - while ((arg=getopt(argc,argv,"t:s:S:"))!=-1) { + while ((arg=getopt(argc,argv,"t:s:S:h"))!=-1) { switch (arg) { case 't': diff --git a/data/sites.txt b/data/sites.txt index 41d39a9..ebbf98f 100644 --- a/data/sites.txt +++ b/data/sites.txt @@ -5,7 +5,6 @@ 4553 CB 53.3210 -2.2330 86 Cees Bassa 0001 MM 30.3340 -97.7610 160 Mike McCants 0002 MM 30.3138 -97.8661 280 Mike McCants -0011 VA 44.7269 34.0167 580 Crimea Astrophysical Observatory 0030 IA 47.4857 18.9727 400 Ivan Artner 0031 IA 47.5612 18.7366 149 Ivan Artner 0070 BC 53.2233 -0.6003 30 Bob Christy @@ -13,6 +12,7 @@ 0110 LK 32.5408 -96.8906 200 Lyn Kennedy 0433 GR -33.9406 18.5129 10 Greg Roberts 0434 IR -26.1030 27.9288 1646 Ian Roberts +0435 GR -33.9369 18.5101 25 Greg Roberts 0710 LS 52.3261 10.6756 85 Lutz Schindler 0899 FM -34.8961 -56.1227 30 Fernando Mederos 1056 MK 57.0122 23.9833 4 Martins Keruss @@ -41,6 +41,7 @@ 6226 SC 28.4861 -97.8194 110 Scott Campbell 7777 BY 38.1656 -2.3267 1608 Brad Young remote 7778 BY -31.2733 149.0644 1122 Brad Young SSO +7779 BY 32.9204 -105.5283 2225 Brad Young NM 8048 ST 49.4175 -123.6420 1. Scott Tilley 8049 ST 49.4348 -123.6685 40. Scott Tilley 8305 PG 26.2431 -98.2163 30 Paul Gabriel @@ -51,6 +52,7 @@ 8539 SN 39.4707 -79.3388 839 Steve Newcomb 8597 TB -34.9638 138.6333 100 Tony Beresford 8600 PC -32.9770 151.6477 18 Paul Camilleri +0699 PC -14.4733 132.2369 108 Paul Camilleri 8730 EC 30.3086 -97.7279 150 Ed Cannon 8739 DB 37.1133 -121.7028 282 Derek Breit 9461 KO 47.9175 19.89365 938 Konkoly Obs @@ -59,11 +61,4 @@ 6242 JM 42.9453 -2.8284 623 Jon Mikel 6241 JM 42.9565 -2.8203 619 Jon Mikel 4160 BD 51.2793 5.4768 35 Bram Dorreman -9004 WW 51.3521 -1.8017 133 Wilcot Wiltshire -9000 PP 40.0848 21.1581 1433 Pierros Papadeas -9001 AF 44.5700 6.68 1850 Alain Figer -9002 AO 62.2544 26.5962 150 Arto Oksanen -9003 CP -24.6272 -70.4047 2638 Cerro Paranal -9004 LP 28.7622 -17.8775 2396 Isaac Newton 9999 GR 47.348 5.5151 100 Graves -0899 FM -34.8961 -56.1227 30 Fernando Mederos diff --git a/makefile b/makefile index 18fb221..c95ecef 100644 --- a/makefile +++ b/makefile @@ -13,6 +13,9 @@ F77 = gfortran all: make addwcs angular calibrate dec2sex faketle fitsheader fitskey imgstat jpg2fits jpgstack measure pgm2fits plotfits pstrack rde2iod reduce residuals runsched satfit satid satmap satorbit sex2dec skymap tle2ole tleinfo uk2iod viewer wcsfit deproject slewto waitfor pass detect launchtle propagate fakeiod csv2tle normal posmatch posvel xyz2tle mvtle confirm allnight +geolon: geolon.o sgdp4.o satutl.o deep.o ferror.o + $(CC) -o geolon geolon.o sgdp4.o satutl.o deep.o ferror.o -lm + allnight: allnight.o $(CC) -o allnight allnight.o -lm diff --git a/measure.c b/measure.c index 6b8c4ca..44da495 100644 --- a/measure.c +++ b/measure.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "qfits.h" #include "cpgplot.h" #include "cel.h" @@ -54,6 +55,57 @@ struct image read_fits(char *filename,int pnum); int fgetline(FILE *file,char *s,int lim); int select_nearest(struct catalog c,float x,float y); +void plot_defects(void) +{ + FILE *file; + char *env,filename[128]; + float x,y; + char line[LIM]; + + // Environment variables + env=getenv("ST_DATADIR"); + sprintf(filename,"%s/data/defects.txt",env); + + file=fopen(filename,"r"); + if (file==NULL) { + fprintf(stderr,"Defects file not found!\n"); + return; + } + + cpgsci(7); + while (fgetline(file,line,LIM)>0) { + sscanf(line,"%f %f",&x,&y); + + cpgpt1(x,y,19); + + } + fclose(file); + cpgsci(1); + + return; +} + +void log_defects(float x,float y) +{ + FILE *file; + char *env,filename[128]; + + // Environment variables + env=getenv("ST_DATADIR"); + sprintf(filename,"%s/data/defects.txt",env); + + file=fopen(filename,"a"); + if (file==NULL) { + fprintf(stderr,"Defects file not found!\n"); + return; + } + + fprintf(file,"%4.0f %4.0f\n",x,y); + fclose(file); + + return; +} + // Return x modulo y [0,y) double modulo(double x,double y) { @@ -677,12 +729,14 @@ int main(int argc,char *argv[]) cpgsci(1); } + plot_defects(); + redraw=0; } // Get cursor cpgcurs(&x,&y,&c); - + // Quit if (c=='q') break; @@ -707,6 +761,12 @@ int main(int argc,char *argv[]) redraw=1; } + // Mark bad pixel + if (c=='t') { + log_defects(x,y); + redraw=1; + } + // Plot catalog if (c=='l') { if (plotcat==1) diff --git a/normal.c b/normal.c index 31814ed..924edb7 100644 --- a/normal.c +++ b/normal.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "cpgplot.h" #include "sgdp4h.h" #include "satutl.h" @@ -334,10 +335,10 @@ int main(int argc,char *argv[]) int imode,satno=0,arg,usecatalog=0,satnomin,flag=0; FILE *file; orbit_t orb; - xyz_t r,v,n,m,nm; + xyz_t r,v,n,m,nm,r0,v0,mr,mv; char tlefile[LIM],catalog[LIM],nfd[32]; char line1[80],line2[80],desig[20]; - double mjd,ra,de,dr,drmin; + double mjd,ra,de,dr,drmin,dmr,dmv; char *env; // Get environment variable @@ -395,13 +396,10 @@ int main(int argc,char *argv[]) // Propagate imode=init_sgdp4(&orb); - imode=satpos_xyz(mjd+2400000.5,&r,&v); + imode=satpos_xyz(mjd+2400000.5,&r0,&v0); - // Convert - orb=rv2el(orb.satno,mjd,r,v); - // Compute normal - n=cross(r,v); + n=cross(r0,v0); ra=modulo(atan2(n.y,n.x)*R2D,360.0); de=asin(n.z/magnitude(n))*R2D; @@ -422,25 +420,33 @@ int main(int argc,char *argv[]) imode=init_sgdp4(&orb); imode=satpos_xyz(mjd+2400000.5,&r,&v); - // Convert - orb=rv2el(orb.satno,mjd,r,v); // Compute normal m=cross(r,v); - // Difference + // Normal difference nm.x=n.x-m.x; nm.y=n.y-m.y; nm.z=n.z-m.z; dr=magnitude(nm); + // Position/velocity difference + mr.x=r0.x-r.x; + mr.y=r0.y-r.y; + mr.z=r0.z-r.z; + mv.x=v0.x-v.x; + mv.y=v0.y-v.y; + mv.z=v0.z-v.z; + if (flag==0 || dr