Changeset 5347
- Timestamp:
- Oct 15, 2005, 1:28:40 PM (21 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 15 edited
-
Makefile (modified) (2 diffs)
-
doc/notes.txt (modified) (2 diffs)
-
include/addstar.h (modified) (2 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/NewImage.c (modified) (1 diff)
-
src/SocketOps.c (modified) (5 diffs)
-
src/addstarc.c (modified) (3 diffs)
-
src/addstard.c (modified) (3 diffs)
-
src/airmass.c (modified) (1 diff)
-
src/args_client.c (modified) (3 diffs)
-
src/args_server.c (modified) (2 diffs)
-
src/find_matches.c (modified) (1 diff)
-
src/gcatalog.c (modified) (1 diff)
-
src/grefstars.c (modified) (1 diff)
-
src/gregion_star.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r5328 r5347 88 88 $(SRC)/args_server.$(ARCH).o \ 89 89 $(SRC)/CheckPassword.$(ARCH).o \ 90 $(SRC)/NewImage.$(ARCH).o 90 $(SRC)/UpdateDatabase_Image.$(ARCH).o \ 91 $(SRC)/UpdateDatabase_Reflist.$(ARCH).o \ 92 $(SRC)/UpdateDatabase_Refcat.$(ARCH).o \ 93 $(SRC)/airmass.$(ARCH).o \ 94 $(SRC)/build_links.$(ARCH).o \ 95 $(SRC)/calibrate.$(ARCH).o \ 96 $(SRC)/find_matches.$(ARCH).o \ 97 $(SRC)/find_matches_closest.$(ARCH).o \ 98 $(SRC)/find_matches_refstars.$(ARCH).o \ 99 $(SRC)/find_subset.$(ARCH).o \ 100 $(SRC)/get2mass.$(ARCH).o \ 101 $(SRC)/get2mass_as.$(ARCH).o \ 102 $(SRC)/get2mass_dr2.$(ARCH).o \ 103 $(SRC)/getgsc.$(ARCH).o \ 104 $(SRC)/getusno.$(ARCH).o \ 105 $(SRC)/greference.$(ARCH).o \ 106 $(SRC)/gcatalog.$(ARCH).o \ 107 $(SRC)/gimages.$(ARCH).o \ 108 $(SRC)/gregion_image.$(ARCH).o \ 109 $(SRC)/gregion_match.$(ARCH).o \ 110 $(SRC)/gregion_patch.$(ARCH).o \ 111 $(SRC)/gregion_star.$(ARCH).o \ 112 $(SRC)/image-db.$(ARCH).o \ 113 $(SRC)/in_image.$(ARCH).o \ 114 $(SRC)/load_pt_catalog.$(ARCH).o \ 115 $(SRC)/load_subpix.$(ARCH).o \ 116 $(SRC)/mkcatalog.$(ARCH).o \ 117 $(SRC)/RegionOps.$(ARCH).o \ 118 $(SRC)/replace_match.$(ARCH).o \ 119 $(SRC)/SetSignals.$(ARCH).o \ 120 $(SRC)/sort_lists.$(ARCH).o \ 121 $(SRC)/update_coords.$(ARCH).o \ 122 $(SRC)/wcatalog.$(ARCH).o \ 123 $(SRC)/Shutdown.$(ARCH).o \ 124 $(SRC)/edge_check.$(ARCH).o \ 125 $(SRC)/check_permissions.$(ARCH).o \ 126 $(SRC)/opening_angle.$(ARCH).o \ 127 $(SRC)/NewImage.$(ARCH).o \ 128 $(SRC)/NewReflist.$(ARCH).o \ 129 $(SRC)/NewRefcat.$(ARCH).o 91 130 92 131 CLIENT = \ … … 94 133 $(SRC)/ConfigInit.$(ARCH).o \ 95 134 $(SRC)/gstars.$(ARCH).o \ 135 $(SRC)/grefstars.$(ARCH).o \ 96 136 $(SRC)/load_subpix.$(ARCH).o \ 97 137 $(SRC)/rfits.$(ARCH).o \ -
trunk/Ohana/src/addstar/doc/notes.txt
r5328 r5347 6 6 o address MOSAIC somehow 7 7 o replace skyprobe mode 8 - address the cat & ref modes in client/server 9 10 * add airmass quality to options 8 o complete server db interactions 9 o address the cat & ref modes in client/server 10 o add airmass quality to options 11 11 12 * deal with Myyyy as sky value 12 13 * better way to interpret flips header info for sky? … … 15 16 with sorted measure tables; add this as a feature 16 17 of the load_catalog API? 18 19 2005.10.14 20 21 the current db interactions are somewhat in efficient wrt the image 22 table. the basic outline is as follows: 23 24 - load image overlaps (needs entire image table) 25 - find detection matches (uses overlap information for missed) 26 - save new image (needs calculated calibration value from detection 27 matches) 28 29 currently, I access the image table twice, and both times I load the 30 entire thing. I really only need to append in the second case. To 31 get to that point, I need to: 32 33 - split image overlaps from image db load 34 - define image partial load (analogous with catalog LOAD_MEAS_META) 35 36 for the moment, I'm being wasteful so I can defer this issue. 17 37 18 38 2005.10.13 -
trunk/Ohana/src/addstar/include/addstar.h
r5328 r5347 99 99 void TrapSignal PROTO((int sig)); 100 100 float airmass PROTO((float secz_image, double ra, double dec, double st, double latitude)); 101 void SetAirmassQuality PROTO((int quality)); 101 102 void aregion PROTO((GSCRegion *region, FILE *f, double ra, double dec)); 102 103 AddstarClientOptions args PROTO((int argc, char **argv, AddstarClientOptions options)); … … 181 182 int CheckPassword (int BindSocket); 182 183 int NewImage (int BindSocket); 184 int NewReflist (int BindSocket); 185 int NewRefcat (int BindSocket); 183 186 184 int InitServerSocket ( char *hostname,SockAddress *Address);187 int InitServerSocket (SockAddress *Address); 185 188 int WaitServerSocket (int InitSocket, SockAddress *Address, int *validIP, int Nvalid); 186 189 int GetClientSocket (char *hostname); 187 190 191 int UpdateDatabase_Image (AddstarClientOptions *options, Image *image, Coords *mosaic, Stars *stars, int Nstars); 192 int UpdateDatabase_Reflist (AddstarClientOptions *options, Stars *stars, int Nstars); 193 int UpdateDatabase_Refcat (AddstarClientOptions *options, GSCRegion *UserPatch, char *refcat); -
trunk/Ohana/src/addstar/src/ConfigInit.c
r5322 r5347 113 113 free (config); 114 114 free (file); 115 115 return (options); 116 116 } 117 117 -
trunk/Ohana/src/addstar/src/NewImage.c
r5322 r5347 3 3 int NewImage (int BindSocket) { 4 4 5 int i, Nstars, Noptions, Nimage;5 int N, Nstars; 6 6 Stars *stars; 7 7 Image *image; 8 Coords *mosaic; 8 9 AddstarClientOptions *options; 9 10 10 11 /* accept incoming data set */ 11 if (!Recv_AddstarClientOptions (BindSocket, &options, &Noptions)) { 12 close (BindSocket); 13 return (FALSE); 12 if (!Recv_AddstarClientOptions (BindSocket, &options, &N)) { 13 fprintf (stderr, "error: problem receiving options\n"); 14 goto reject; 15 } 16 if (N != 1) { 17 fprintf (stderr, "error: too many option sets (%d)\n", N); 18 goto reject; 14 19 } 15 20 16 if (!Recv_Image (BindSocket, &image, &Nimage)) { 17 close (BindSocket); 18 return (FALSE); 21 if (!Recv_Image (BindSocket, &image, &N)) { 22 fprintf (stderr, "error: problem receiving image data\n"); 23 goto reject; 24 } 25 if (N != 1) { 26 fprintf (stderr, "error: invalid number of images (%d)\n", N); 27 goto reject; 19 28 } 20 29 30 if (options[0].mosaic) { 31 if (!Recv_Coords (BindSocket, &mosaic, &N)) { 32 fprintf (stderr, "error: problem receiving mosaic coordinates\n"); 33 goto reject; 34 } 35 if (N != 1) { 36 fprintf (stderr, "error: invalid number of mosaic coords (%d)\n", N); 37 goto reject; 38 } 39 } 40 21 41 if (!Recv_Stars (BindSocket, &stars, &Nstars)) { 22 close (BindSocket);23 return (FALSE);42 fprintf (stderr, "error: problem receiving star data\n"); 43 goto reject; 24 44 } 25 /* XXX EAM : error check : 1 option, 1 image */45 fprintf (stderr, "accepted %s, %d stars\n", image[0].name, Nstars); 26 46 27 47 /* add to db */ 28 29 fprintf (stderr, "options: %d %d %d %d\n", 30 options[0].mode, 31 options[0].photcode, 32 options[0].timeref, 33 options[0].skip_missed); 34 35 // for (i = 0; i < Nstars; i++) { 36 // fprintf (stderr, "R, D: %f, %f\n", stars[i].R, stars[i].D); 37 // } 38 39 for (i = 0; i < Nimage; i++) { 40 fprintf (stderr, "name: %s, %d stars\n", image[i].name, Nstars); 41 } 48 UpdateDatabase_Image (options, image, mosaic, stars, Nstars); 42 49 43 50 close (BindSocket); 44 51 return (TRUE); 52 53 reject: 54 close (BindSocket); 55 return (FALSE); 45 56 } -
trunk/Ohana/src/addstar/src/SocketOps.c
r5322 r5347 4 4 # define MY_WAIT 500 5 5 6 int InitServerSocket (char *hostname, SockAddress *Address) { 7 8 int i, status, InitSocket, length; 6 int InitServerSocket (SockAddress *Address) { 7 8 int status, InitSocket, length; 9 10 # if (0) 9 11 struct hostent *host; 10 12 char tmpline[80], hostip[80]; 11 13 12 14 host = gethostbyname (hostname); 13 fprintf (stderr, "errno: %d\n", h_errno);14 fprintf (stderr, "host: %d\n", host);15 16 15 bzero (hostip, 80); 17 16 for (i = 0; i < host[0].h_length; i++) { … … 20 19 if (i < host[0].h_length - 1) strcat (hostip, "."); 21 20 } 22 23 // use this line to bind any address / port? 24 // Address.sin_addr.s_addr = INADDR_ANY; 21 # endif 22 25 23 Address[0].sin_family = AF_INET; 26 24 Address[0].sin_port = MY_PORT; 25 Address[0].sin_addr.s_addr = INADDR_ANY; // use this line to bind any address / port? 26 27 # if (0) 27 28 status = inet_aton (hostip, &Address[0].sin_addr); 28 29 if (!status) { … … 30 31 exit (2); 31 32 } 33 # endif 32 34 33 35 length = sizeof(Address[0]); … … 52 54 } 53 55 54 if (VERBOSE) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT);56 // if (VERBOSE) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT); 55 57 return (InitSocket); 56 58 } … … 159 161 return (InitSocket); 160 162 } 163 164 int InitServerSocket_Named (char *hostname, SockAddress *Address) { 165 166 int i, status, InitSocket, length; 167 struct hostent *host; 168 char tmpline[80], hostip[80]; 169 170 host = gethostbyname (hostname); 171 bzero (hostip, 80); 172 for (i = 0; i < host[0].h_length; i++) { 173 sprintf (tmpline, "%u", (0xff & host[0].h_addr[i])); 174 strcat (hostip, tmpline); 175 if (i < host[0].h_length - 1) strcat (hostip, "."); 176 } 177 178 Address[0].sin_family = AF_INET; 179 Address[0].sin_port = MY_PORT; 180 status = inet_aton (hostip, &Address[0].sin_addr); 181 if (!status) { 182 fprintf (stderr, "invalid address\n"); 183 exit (2); 184 } 185 186 length = sizeof(Address[0]); 187 188 InitSocket = socket (PF_INET, SOCK_STREAM, 0); 189 if (InitSocket == -1) { 190 perror ("socket: "); 191 exit (2); 192 } 193 194 fprintf (stderr, "init sock: %d, len: %d\n", InitSocket, length); 195 status = bind (InitSocket, (struct sockaddr *) Address, length); 196 if (status == -1) { 197 perror ("bind: "); 198 exit (2); 199 } 200 201 status = listen (InitSocket, 10); 202 if (status == -1) { 203 perror ("listen: "); 204 exit (2); 205 } 206 207 if (VERBOSE) fprintf (stderr, "socket listening on %s (%s:%d)\n", host[0].h_name, hostip, MY_PORT); 208 return (InitSocket); 209 } 210 -
trunk/Ohana/src/addstar/src/addstarc.c
r5328 r5347 3 3 int main (int argc, char **argv) { 4 4 5 int Nstars , Nimage;5 int Nstars; 6 6 int BindSocket; 7 7 AddstarClientOptions options; … … 13 13 options = args_client (argc, argv, options); 14 14 15 /* load data */16 stars = gstars (argv[1], &Nstars, MOSAIC, &image);17 18 15 /* set up server connection */ 19 16 BindSocket = GetClientSocket (HOSTNAME); … … 21 18 22 19 /* send new data to server */ 23 SendCommand (BindSocket, 5, "IMAGE");24 Send_AddstarClientOptions (BindSocket, &options, 1, TRUE);25 Send_Image (BindSocket, &image, 1, FALSE);26 Send_Stars (BindSocket, stars, Nstars, FALSE);20 switch (options.mode) { 21 case M_IMAGE: 22 /* load data */ 23 stars = gstars (argv[1], &Nstars, options.photcode, &image); 27 24 28 exit (0); 25 /* send data to server */ 26 SendCommand (BindSocket, 5, "IMAGE"); 27 Send_AddstarClientOptions (BindSocket, &options, 1, TRUE); 28 Send_Image (BindSocket, &image, 1, FALSE); 29 if (options.mosaic) { 30 Send_Coords (BindSocket, MOSAIC, 1, FALSE); 31 } 32 Send_Stars (BindSocket, stars, Nstars, FALSE); 33 exit (0); 34 35 case M_REFLIST: 36 /* load data */ 37 stars = grefstars (argv[1], options.photcode, &Nstars); 38 39 /* send data to server */ 40 SendCommand (BindSocket, 5, "REFLS"); 41 Send_AddstarClientOptions (BindSocket, &options, 1, TRUE); 42 Send_Stars (BindSocket, stars, Nstars, FALSE); 43 exit (0); 44 45 case M_REFCAT: 46 /* send data to server */ 47 SendCommand (BindSocket, 5, "REFCT"); 48 Send_AddstarClientOptions (BindSocket, &options, 1, TRUE); 49 Send_GSCRegion (BindSocket, &UserPatch, 1, TRUE); 50 SendMessage (BindSocket, argv[1]); 51 52 exit (0); 53 } 54 exit (1); 29 55 } -
trunk/Ohana/src/addstar/src/addstard.c
r5322 r5347 14 14 15 15 VERBOSE = TRUE; 16 InitSocket = InitServerSocket ( argv[1],&Address);16 InitSocket = InitServerSocket (&Address); 17 17 18 18 while (1) { … … 25 25 if (!CheckPassword (BindSocket)) continue; 26 26 27 /* accept command */27 /* accept command : XXX EAM : long-enough timeout? */ 28 28 status = ExpectCommand (BindSocket, 5, 0.1, &message); 29 29 if (status != 0) { … … 36 36 /* message options */ 37 37 if (!strcmp (message.buffer, "IMAGE")) { 38 fprintf (stderr, " NewImage\n");38 fprintf (stderr, "Image\n"); 39 39 NewImage (BindSocket); 40 continue; 41 } 42 if (!strcmp (message.buffer, "REFLS")) { 43 fprintf (stderr, "Reflist\n"); 44 NewReflist (BindSocket); 45 continue; 46 } 47 if (!strcmp (message.buffer, "REFCT")) { 48 fprintf (stderr, "Refcat\n"); 49 NewRefcat (BindSocket); 40 50 continue; 41 51 } -
trunk/Ohana/src/addstar/src/airmass.c
r5328 r5347 1 1 # include "addstar.h" 2 2 3 static AirmassQuality = FALSE;3 static int AirmassQuality = FALSE; 4 4 5 5 void SetAirmassQuality (int quality) { -
trunk/Ohana/src/addstar/src/args_client.c
r5328 r5347 5 5 6 6 int N; 7 int QUALITY_AIRMASS;8 7 9 8 /* check for help request */ … … 148 147 /*** optional situations ***/ 149 148 /* choose high quality airmass vs low quality airmass (per-star vs per-image) */ 150 QUALITY_AIRMASS= FALSE;149 options.quality_airmass = FALSE; 151 150 if ((N = get_argument (argc, argv, "-quality-airmass"))) { 152 151 remove_argument (N, &argc, argv); 153 QUALITY_AIRMASS= TRUE;152 options.quality_airmass = TRUE; 154 153 } 155 154 /* choose high quality airmass vs low quality airmass (per-star vs per-image) */ … … 162 161 if ((N = get_argument (argc, argv, "-skyprobe"))) { 163 162 remove_argument (N, &argc, argv); 164 QUALITY_AIRMASS= TRUE;163 options.quality_airmass = TRUE; 165 164 SUBPIX = TRUE; 166 165 } -
trunk/Ohana/src/addstar/src/args_server.c
r5322 r5347 51 51 } 52 52 53 if (argc != 2) {54 fprintf (stderr, "USAGE: addstard (host)\n");53 if (argc != 1) { 54 fprintf (stderr, "USAGE: addstard\n"); 55 55 exit (2); 56 56 } 57 return (TRUE);58 57 } 59 58 … … 61 60 62 61 fprintf (stderr, "USAGE\n"); 63 fprintf (stderr, " addstard (host)\n");62 fprintf (stderr, " addstard\n"); 64 63 fprintf (stderr, " -force : force read of database with inconsistent info\n"); 65 64 fprintf (stderr, " -v : verbose mode\n"); -
trunk/Ohana/src/addstar/src/find_matches.c
r5328 r5347 18 18 gettimeofday (&start, NULL); 19 19 20 code = GetPhotcodebyCode (options.photcode); 20 /* XXX EAM : options.photcode overridden by image.source.... */ 21 code = GetPhotcodebyCode (image[0].source); 21 22 22 23 /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */ -
trunk/Ohana/src/addstar/src/gcatalog.c
r5322 r5347 4 4 5 5 int Nsecfilt, status; 6 char mode;7 6 8 7 /* CATMODE and CATFORMAT determined from catalog */ -
trunk/Ohana/src/addstar/src/grefstars.c
r5328 r5347 35 35 return (stars); 36 36 } 37 38 /* stars.found is set here to FALSE. 39 gregion_stars uses this value as a boolean to decide if the star 40 has been associated with a region. 41 gregion_stars resets stars.found to -1 42 find_match_refstars uses stars.found to identify the seq number of the 43 star which is found. it requires an initial value of -1 44 */ -
trunk/Ohana/src/addstar/src/gregion_star.c
r3376 r5347 25 25 } 26 26 Nregions ++; 27 CHECK_REALLOCATE (regions, GSCRegion, N regions, NREGIONS, 100);27 CHECK_REALLOCATE (regions, GSCRegion, NREGIONS, Nregions, 100); 28 28 29 29 } 30 31 /* reset to -1 for all stars: required start for find_match_refstars */ 32 for (i = 0; i < Nstars; i++) stars[i].found = -1; 33 30 34 *nregions = Nregions; 31 35 return (regions);
Note:
See TracChangeset
for help on using the changeset viewer.
