- Timestamp:
- Apr 21, 2014, 5:42:34 AM (12 years ago)
- Location:
- branches/eam_branches/ps2-tc3-20130727
- Files:
-
- 5 edited
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/src/getstar/src/GetFileMode.c (modified) (1 diff)
-
Ohana/src/getstar/src/MatchImages.c (modified) (2 diffs)
-
Ohana/src/getstar/src/dvoImagesAtCoords.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ps2-tc3-20130727
- Property svn:mergeinfo changed
-
branches/eam_branches/ps2-tc3-20130727/Ohana
- Property svn:mergeinfo deleted
-
branches/eam_branches/ps2-tc3-20130727/Ohana/src/getstar/src/GetFileMode.c
r34088 r36680 10 10 gfits_scan_alt (header, "SIMPLE", "%t", 1, &simple); 11 11 haveNaxis = gfits_scan (header, "NAXIS", "%d", 1, &Naxis); 12 haveCTYPE = gfits_scan (header, "CTYPE 1", "%s", 1, ctype);12 haveCTYPE = gfits_scan (header, "CTYPE2", "%s", 1, ctype); 13 13 14 14 gfits_scan_alt (header, "EXTEND", "%t", 1, &extend); -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/getstar/src/MatchImages.c
r34430 r36680 36 36 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 37 37 tcoords.Npolyterms = 1; 38 strcpy (tcoords.ctype, " RA---TAN");38 strcpy (tcoords.ctype, "DEC--TAN"); 39 39 /* register so image->sky conversions below have correct mosaic */ 40 40 } else { … … 44 44 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 45 45 tcoords.Npolyterms = 1; 46 strcpy (tcoords.ctype, " RA---TAN");46 strcpy (tcoords.ctype, "DEC--TAN"); 47 47 } 48 48 -
branches/eam_branches/ps2-tc3-20130727/Ohana/src/getstar/src/dvoImagesAtCoords.c
r33658 r36680 9 9 static int makePoint(double ra, double dec, Point **pointsOut); 10 10 static int ListImagesAtCoords (Image *dbImages, Point *points, int Npoints); 11 static int readPointFromFile(FILE *f, Point *pt); 11 12 12 13 int main (int argc, char **argv) { … … 15 16 int status; 16 17 Image *dbImages; 17 int Npoints;18 18 FITS_DB db; 19 19 … … 22 22 args_coords (argc, argv); 23 23 24 Point *points; 24 Point *points = NULL; 25 int readStdin = 0; 26 int Npoints = 0; 25 27 if (coordsFile) { 26 Npoints = readPoints(coordsFile, &points); 28 if (strcmp(coordsFile, "-") == 0) { 29 readStdin = 1; 30 } else { 31 Npoints = readPoints(coordsFile, &points); 32 } 27 33 } else { 28 34 Npoints = makePoint(cmd_line_ra, cmd_line_dec, &points); 29 35 } 30 if (!Npoints ) {36 if (!Npoints && !readStdin) { 31 37 exit(1); 32 38 } … … 61 67 } 62 68 63 if (MatchCoords (dbImages, NdbImages, points, Npoints)) { 64 ListImagesAtCoords(dbImages, points, Npoints); 65 exit(0); 69 if (readStdin) { 70 Point pt; 71 memset(&pt, 0, sizeof(pt)); 72 pt.Nmatches = 0; 73 ALLOCATE(pt.matches, Match, 20); 74 pt.arrayLength = 20; 75 76 int status; 77 while ((status = readPointFromFile(stdin, &pt))) { 78 if (status < 0) { 79 fprintf(stdout, "ERROR malformed input line\n"); 80 exit(1); 81 } 82 if (MatchCoords (dbImages, NdbImages, &pt, 1)) { 83 ListImagesAtCoords(dbImages, &pt, 1); 84 } 85 fprintf(stdout, "DONE\n"); 86 fflush(stdout); 87 pt.Nmatches = 0; 88 } 66 89 } else { 67 exit(PSTAMP_NO_OVERLAP); 68 } 90 if (MatchCoords (dbImages, NdbImages, points, Npoints)) { 91 ListImagesAtCoords(dbImages, points, Npoints); 92 } else { 93 exit(PSTAMP_NO_OVERLAP); 94 } 95 } 96 exit(0); 97 } 98 99 static int readPointFromFile(FILE *f, Point *pt) { 100 char buf[80]; 101 char *good = fgets(buf, 80, f); 102 if (!good) { 103 return 0; 104 } 105 // fprintf(stderr, "READ: %s\n", buf); 106 int Nread = sscanf(buf, "%d %lf %lf\n", &pt->id, &pt->ra, &pt->dec); 107 if (Nread == 3) { 108 // got one 109 return 1; 110 } else if (Nread == -1) { 111 // all done time to go 112 return 0; 113 } else { 114 // fprintf(stderr, "malformed input line: %d\n", Nread); 115 return -1; 116 } 69 117 } 70 118
Note:
See TracChangeset
for help on using the changeset viewer.
