Changeset 4680
- Timestamp:
- Jul 30, 2005, 9:14:00 AM (21 years ago)
- Location:
- trunk/Ohana/src/delstar
- Files:
-
- 20 edited
-
Makefile (modified) (2 diffs)
-
include/delstar.h (modified) (2 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/RegionOps.c (modified) (3 diffs)
-
src/args.c (modified) (6 diffs)
-
src/convert.c (modified) (1 diff)
-
src/delete_imagename.c (modified) (1 diff)
-
src/delete_missed.c (modified) (1 diff)
-
src/delete_times.c (modified) (2 diffs)
-
src/delstar.c (modified) (2 diffs)
-
src/dimages.c (modified) (1 diff)
-
src/find_images.c (modified) (3 diffs)
-
src/find_matches.c (modified) (4 diffs)
-
src/gimages.c (modified) (5 diffs)
-
src/gtimes.c (modified) (1 diff)
-
src/image-db.c (modified) (3 diffs)
-
src/match_images.c (modified) (1 diff)
-
src/parse_time.c (modified) (5 diffs)
-
src/sort_lists.c (modified) (3 diffs)
-
src/wcatalog.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/delstar/Makefile
r4605 r4680 17 17 INCS = -I$(INC) -I$(LINC) -I$(XINC) 18 18 LIBS = -L$(LLIB) -lFITS -lohana -lm 19 CFLAGS = -o $*.$(ARCH).o $(INCS) 19 CFLAGS = -o $*.$(ARCH).o $(INCS) -O2 20 20 CCFLAGS = $(INCS) $(LIBS) 21 21 22 22 DELSTAR = \ 23 $(SRC)/delstar.$(ARCH).o $(SRC)/gcatalog.$(ARCH).o \ 24 $(SRC)/gregions.$(ARCH).o $(SRC)/gimages.$(ARCH).o \ 25 $(SRC)/dimages.$(ARCH).o $(SRC)/gtimes.$(ARCH).o \ 26 $(SRC)/find_matches.$(ARCH).o $(SRC)/wcatalog.$(ARCH).o \ 27 $(SRC)/ConfigInit.$(ARCH).o $(SRC)/args.$(ARCH).o \ 28 $(SRC)/aregion.$(ARCH).o $(SRC)/delete_missed.$(ARCH).o \ 29 $(SRC)/sort_lists.$(ARCH).o $(SRC)/parse_time.$(ARCH).o \ 30 $(SRC)/gcatstats.$(ARCH).o $(SRC)/find_images.$(ARCH).o \ 31 $(SRC)/match_images.$(ARCH).o $(SRC)/delete_orphans.$(ARCH).o \ 32 $(SRC)/convert.$(ARCH).o 23 $(SRC)/delstar.$(ARCH).o \ 24 $(SRC)/SetSignals.$(ARCH).o \ 25 $(SRC)/ConfigInit.$(ARCH).o \ 26 $(SRC)/args.$(ARCH).o \ 27 $(SRC)/image-db.$(ARCH).o \ 28 $(SRC)/delete_imagename.$(ARCH).o \ 29 $(SRC)/delete_imagefile.$(ARCH).o \ 30 $(SRC)/delete_times.$(ARCH).o \ 31 $(SRC)/gimages.$(ARCH).o \ 32 $(SRC)/gregion_image.$(ARCH).o \ 33 $(SRC)/gregion_patch.$(ARCH).o \ 34 $(SRC)/RegionOps.$(ARCH).o \ 35 $(SRC)/gcatalog.$(ARCH).o \ 36 $(SRC)/wcatalog.$(ARCH).o \ 37 $(SRC)/find_image_db.$(ARCH).o \ 38 $(SRC)/find_matches.$(ARCH).o \ 39 $(SRC)/parse_time.$(ARCH).o \ 40 $(SRC)/convert.$(ARCH).o \ 41 $(SRC)/sort_lists.$(ARCH).o \ 42 $(SRC)/check_permissions.$(ARCH).o \ 43 $(SRC)/dimages.$(ARCH).o 33 44 34 45 OBJ = $(DELSTAR) … … 63 74 .c.$(ARCH).o: 64 75 $(CC) $(CFLAGS) -c $< 65 66 -
trunk/Ohana/src/delstar/include/delstar.h
r4607 r4680 2 2 # include <dvo.h> 3 3 # include <signal.h> 4 5 typedef struct { 6 Coords coords; 7 float *X, *Y; 8 int *N; 9 double RA[2], DEC[2]; 10 double Area, density, spacing; 11 } CatStats; 4 12 5 13 /* global variables set in parameter file */ … … 15 23 int MISSED; 16 24 17 time_t START; 18 time_t END; 25 time_t START; 26 time_t END; 27 PhotCode *PHOTCODE; 19 28 20 29 int MODE; 21 enum {MODE_IMAGENAME, MODE_IMAGEFILE, MODE_T RANGE, MODE_ORPHAN, MODE_MISSED};30 enum {MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED}; 22 31 23 typedef struct { 24 Coords coords; 25 float *X, *Y; 26 int *N; 27 double RA[2], DEC[2]; 28 double Area, density, spacing; 29 } CatStats; 32 enum {TIME_NONE, TIME_JD, TIME_MJD, TIME_DATE, TIME_DAYS, TIME_HOURS, TIME_MINUTES, TIME_SECONDS}; 30 33 31 34 char DateKeyword[64], DateMode[64], UTKeyword[64], MJDKeyword[64], JDKeyword[64]; 32 35 33 /*** values for time formats */34 enum {TIME_NONE, TIME_JD, TIME_MJD, TIME_DATE, TIME_DAYS, TIME_HOURS, TIME_MINUTES, TIME_SECONDS};35 36 36 /*** conversion functions ***/ 37 int chk_time PROTO((char *line)); 38 time_t date_to_sec PROTO((char *date)); 39 time_t jd_to_sec PROTO((double jd)); 40 time_t mjd_to_sec PROTO((double mjd)); 41 char *sec_to_date PROTO((time_t second)); 42 double sec_to_jd PROTO((time_t second)); 43 double sec_to_mjd PROTO((time_t second)); 44 int str_to_dtime PROTO((char *line, double *second)); 45 int str_to_radec PROTO((double *ra, double *dec, char *str1, char *str2)); 46 int str_to_time PROTO((char *line, time_t *second)); 37 FILE *GetDB PROTO((int *state)); 38 Image *GetImages PROTO((int *nimage)); 39 GSCRegion *LoadRegions PROTO((int *nregions)); 40 Image *find_images PROTO((FILE *f, CatStats *catstats, int *Nimages)); 41 int *find_images_data PROTO((Image *timage, int *nlist)); 42 int *find_images_name PROTO((char *filename, int *nlist)); 43 int *find_images_time PROTO((time_t start, time_t end, PhotCode *code, int *nlist)); 44 Image *gimages PROTO((char *filename)); 45 GSCRegion *gregion_image PROTO((Image *image, int *Nregions)); 46 GSCRegion *gregion_patch PROTO((GSCRegion *patch, int *nregions)); 47 Image *gtimes PROTO((int *NIMAGE)); 48 char *sec_to_date PROTO((time_t second)); 49 void ConfigInit PROTO((int *argc, char **argv)); 50 int FindDecBand PROTO((double dec, double *DEC0, double *DEC1)); 51 int FindRegionByPoint PROTO((GSCRegion *region, double ra, double dec, GSCRegion *gsc, int Ngsc)); 52 int FindRegionDecBandStart PROTO((GSCRegion *region, int Nregion, double dec)); 53 int FindRegionDecBandStop PROTO((GSCRegion *region, int Nregion, double dec)); 54 int SetImages PROTO((Image *new, int Nnew)); 55 void SetProtect PROTO((int mode)); 56 int SetSignals PROTO(()); 57 int Shutdown PROTO((char *format, ...)); 58 void TrapSignal PROTO((int sig)); 59 int args PROTO((int *argc, char **argv)); 60 void check_permissions PROTO((char *basefile)); 61 int chk_time PROTO((char *line)); 62 time_t date_to_sec PROTO((char *date)); 63 void delete_imagefile PROTO((char *filename)); 64 void delete_imagename PROTO((char *name)); 65 void delete_times PROTO(()); 66 int dimages PROTO((int *imlist, int Nimlist)); 67 int dms_to_ddd PROTO((double *Value, char *string)); 68 int edge_check PROTO((double *x1, double *y1, double *x2, double *y2)); 69 void find_matches PROTO((Catalog *catalog, int photcode, int start, int end)); 70 int gcatalog PROTO((Catalog *catalog)); 71 void help PROTO(()); 72 int hms_to_deg PROTO((double *h0, double *h1, double *d0, double *d1, char *string)); 73 time_t jd_to_sec PROTO((double jd)); 74 int load_image_db PROTO(()); 75 void lock_image_db PROTO(()); 76 void match_images PROTO((Catalog *catalog, Image *image, int Nimage)); 77 time_t mjd_to_sec PROTO((double mjd)); 78 double opening_angle PROTO((double x1, double y1, double x2, double y2, double x3, double y3)); 79 int parse_time PROTO((Header *header)); 80 int save_image_db PROTO(()); 81 double sec_to_jd PROTO((time_t second)); 82 double sec_to_mjd PROTO((time_t second)); 83 void sort_lists PROTO((float *X, float *Y, int *S, int N)); 84 void sort_regions PROTO((GSCRegion *region, int N)); 85 int str_to_dtime PROTO((char *line, double *second)); 86 int str_to_radec PROTO((double *ra, double *dec, char *str1, char *str2)); 87 int str_to_time PROTO((char *line, time_t *second)); 88 void unlock_image_db PROTO(()); 89 void usage PROTO(()); 90 int wcatalog PROTO((Catalog *catalog)); -
trunk/Ohana/src/delstar/src/ConfigInit.c
r2463 r4680 1 1 # include "delstar.h" 2 2 3 ConfigInit (int *argc, char **argv) {3 void ConfigInit (int *argc, char **argv) { 4 4 5 5 char *config, *file; -
trunk/Ohana/src/delstar/src/RegionOps.c
r4611 r4680 127 127 128 128 /* bracket value of interest */ 129 Nlo = 0; Nhi = Nregion ;129 Nlo = 0; Nhi = Nregion - 1; 130 130 while (Nhi - Nlo > 10) { 131 131 N = 0.5*(Nlo + Nhi); … … 161 161 162 162 /* bracket value of interest */ 163 Nlo = 0; Nhi = Nregion ;163 Nlo = 0; Nhi = Nregion - 1; 164 164 while (Nhi - Nlo > 10) { 165 165 N = 0.5*(Nlo + Nhi); … … 174 174 175 175 /* find the last entry < dec */ 176 for (N = Nlo; N < Nhi; N++) {176 for (N = Nlo; N <= Nhi; N++) { 177 177 if (region[N].DEC[0] > D1) return (N); 178 178 } 179 fprintf (stderr, "fail dec band stop: %f: %f %f, %d - %d, %f %f\n", 180 dec, D0, D1, Nlo, Nhi, region[Nlo].DEC[0], region[Nlo].DEC[1]); 179 181 return (-1); 180 182 /* this will fail if transition value is not in the data range */ -
trunk/Ohana/src/delstar/src/args.c
r4607 r4680 3 3 void help () { 4 4 5 fprintf (stderr, "USAGE: delstar (filename) or (start range) or -orphan (region)\n"); 6 fprintf (stderr, " delstar -trange (start) (range)\n"); 7 fprintf (stderr, " delstar -orphan (region)\n"); 8 fprintf (stderr, " delstar -missed (region)\n"); 5 fprintf (stderr, "USAGE:\n"); 6 fprintf (stderr, " delstar (filename) or (start range) or -orphan (region)\n"); 7 fprintf (stderr, " delstar -time (start) (stop/range)\n"); 8 fprintf (stderr, " delstar -orphan (region)\n"); 9 fprintf (stderr, " delstar -missed (region)\n\n"); 9 10 fprintf (stderr, " optional flags:\n"); 10 fprintf (stderr, " -v (verbose mode)\n"); 11 fprintf (stderr, " -v : verbose mode\n"); 12 fprintf (stderr, " -photcode (code) : restrict by photcode\n"); 11 13 fprintf (stderr, "\n"); 12 14 exit (2); … … 15 17 16 18 void usage () { 17 fprintf (stderr, "USAGE: delstar (filename)\n"); 18 fprintf (stderr, "USAGE: delstar -name (imagename)\n"); 19 fprintf (stderr, "USAGE: delstar -trange (start) (range)\n"); 20 fprintf (stderr, "USAGE: delstar -orphan (region)\n"); 21 fprintf (stderr, "USAGE: delstar -missed (region)\n"); 19 fprintf (stderr, "USAGE: delstar (filename) / [optional mode] : -h for help\n"); 22 20 exit (2); 23 21 } … … 25 23 int args (int *argc, char **argv) { 26 24 27 28 25 int N; 26 double trange; 27 time_t tmp; 29 28 30 29 /* check for help request */ … … 58 57 if ((N = get_argument (*argc, argv, "-time"))) { 59 58 if (MODE != MODE_IMAGEFILE) usage(); 60 MODE = MODE_T RANGE;59 MODE = MODE_TIME; 61 60 remove_argument (N, argc, argv); 62 61 63 /* tstart */64 62 if (!str_to_time (argv[N], &START)) usage (); 65 63 remove_argument (N, argc, argv); … … 73 71 END = START + trange; 74 72 } 75 remove_argument (N a, argc, argv);73 remove_argument (N, argc, argv); 76 74 goto goodtime; 77 75 } … … 82 80 END = START; 83 81 } 84 remove_argument (N a, argc, argv);82 remove_argument (N, argc, argv); 85 83 goto goodtime; 86 84 } 87 85 usage (); 88 89 goodtime:90 fprintf (stderr, "start: %d\n", start);91 fprintf (stderr, "end: %d\n", end);92 86 } 87 goodtime: 93 88 94 89 /* restrict to a single photcode (not compatible with -image) */ 95 90 PHOTCODE = NULL; 96 if ((N = get_argument ( argc, argv, "-photcode"))) {97 remove_argument (N, &argc, argv);91 if ((N = get_argument (*argc, argv, "-photcode"))) { 92 remove_argument (N, argc, argv); 98 93 PHOTCODE = GetPhotcodebyName (argv[N]); 99 remove_argument (N, &argc, argv);94 remove_argument (N, argc, argv); 100 95 } 101 96 -
trunk/Ohana/src/delstar/src/convert.c
r4605 r4680 319 319 } 320 320 321 /**********/ 322 int hms_to_deg (double *h0, double *h1, double *d0, double *d1, char *string) { 323 324 int flag_d0, flag_d1, flag_h0, flag_h1; 325 double tmp; 326 327 *d0 = *h0 = *d1 = *h1 = 0; 328 329 flag_h0 = dparse (h0, 1, string); 330 flag_h1 = dparse (h1, 4, string); 331 flag_d0 = dparse (d0, 7, string); 332 flag_d1 = dparse (d1, 9, string); 333 *h0 *= flag_h0; 334 *h1 *= flag_h1; 335 *d0 *= flag_d0; 336 *d1 *= flag_d1; 337 338 dparse (&tmp, 2, string); 339 *h0 += tmp/60.0; 340 dparse (&tmp, 3, string); 341 *h0 += tmp/3600.0; 342 343 dparse (&tmp, 5, string); 344 *h1 += tmp/60.0; 345 dparse (&tmp, 6, string); 346 *h1 += tmp/3600.0; 347 348 dparse (&tmp, 8, string); 349 *d0 += tmp/60.0; 350 351 dparse (&tmp, 10, string); 352 *d1 += tmp/60.0; 353 354 *h0 *= 15*flag_h0; 355 *h1 *= 15*flag_h1; 356 *d0 *= flag_d0; 357 *d1 *= flag_d1; 358 359 return (TRUE); 360 } -
trunk/Ohana/src/delstar/src/delete_imagename.c
r4607 r4680 3 3 void delete_imagename (char *name) { 4 4 5 int i, Nregions; 5 int i, j, k; 6 int Nregions, Nimlist, Nimage; 7 int *imlist; 8 double trange; 9 time_t start, stop; 6 10 Image *image; 7 11 GSCRegion *region; 8 12 Catalog catalog; 9 13 10 fprintf (stderr, "this function needs to be debugged\n"); 11 exit (2); 14 image = GetImages (&Nimage); 12 15 13 16 /* find image in db by name */ 14 image = find_image (filename); 17 imlist = find_images_name (name, &Nimlist); 18 if (!Nimlist) Shutdown ("image %s not found in db", name); 15 19 16 fprintf (stderr, "deleting %s\n", image[0].name); 17 region = gregions (image, &Nregions); 20 for (k = 0; k < Nimlist; k++) { 18 21 19 for (i = 0; i < Nregions; i++) { 20 fprintf (stderr, "deleting from %s\n", region[i].filename); 21 catalog.filename = region[i].filename; /* don't free region before catalog! */ 22 switch (lock_catalog (&catalog, LCK_SOFT)) { 23 case 0: 24 fprintf (stderr, "ERROR: can't lock file\n"); 25 exit (1); 26 case 1: 27 gcatalog (&catalog); 28 break; 29 case 2: 30 fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 31 catalog.Naverage = 0; 32 catalog.Nmeasure = 0; 33 break; 34 default: 35 fprintf (stderr, "weird lock_catalog exit state\n"); 36 exit (1); 22 j = imlist[k]; 23 if (VERBOSE) fprintf (stderr, "deleting %s\n", image[j].name); 24 region = gregion_image (&image[j], &Nregions); 25 26 for (i = 0; i < Nregions; i++) { 27 if (VERBOSE) fprintf (stderr, "deleting from %s\n", region[i].filename); 28 catalog.filename = region[i].filename; /* don't free region before catalog! */ 29 switch (lock_catalog (&catalog, LCK_XCLD)) { 30 case 0: 31 fprintf (stderr, "ERROR: can't lock file %s\n", catalog.filename); 32 exit (1); 33 case 1: 34 gcatalog (&catalog); 35 break; 36 case 2: 37 if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 38 unlock_catalog (&catalog); 39 continue; 40 default: 41 fprintf (stderr, "weird lock_catalog exit state\n"); 42 exit (1); 43 } 44 45 /* trate is in 0.1 msec / row - stop is the latest exposure end time */ 46 /* pad exposure time by 1 sec to require a valid time */ 47 trange = 1e-4*image[j].NY*image[j].trate + image[j].exptime + 1; 48 start = image[j].tzero; 49 stop = image[j].tzero + trange; 50 find_matches (&catalog, image[j].source, start, stop); 51 wcatalog (&catalog); 52 unlock_catalog (&catalog); 37 53 } 38 find_matches (&catalog, image);39 wcatalog (&catalog);40 54 } 41 55 42 dimages (image, 1); 56 /* delete the identified images */ 57 dimages (imlist, Nimlist); 43 58 44 /* this probably gets moved inside dimages */45 unlock_image_db ( ImageCat, f, LCK_HARD, &dbstate);59 save_image_db (); 60 unlock_image_db (); 46 61 fprintf (stderr, "SUCCESS\n"); 47 62 exit (0); -
trunk/Ohana/src/delstar/src/delete_missed.c
r2463 r4680 1 1 # include "delstar.h" 2 3 /* drop all MISSED values for the given catalog */ 2 4 3 5 delete_missed (Catalog *catalog) { -
trunk/Ohana/src/delstar/src/delete_times.c
r4607 r4680 3 3 void delete_times () { 4 4 5 Nregions = 0; 6 NREGIONS = 10; 7 ALLOCATE (region, GSCRegion, NREGIONS); 5 int i, j, k, n; 6 int Nimage, Nimlist, found, code; 7 int Ntregions, Nregions, NREGIONS; 8 int *imlist; 9 GSCRegion *region, *tregion; 10 Image *image; 11 Catalog catalog; 8 12 9 /* find image for time range, delete each image */ 10 image = gtimes (&Nimage); 11 for (j = 0; j < Nimage; j++) { 12 fprintf (stderr, "finding regions for %s\n", image[j].name); 13 tregion = gregions (&image[j], &Ntregions); 14 for (i = 0; i < Ntregions; i++) { 15 found = FALSE; 16 for (k = 0; (k < Nregions) && !found; k++) { 17 found = !strcmp (region[k].filename, tregion[i].filename); 18 } 19 if (!found) { 20 strcpy (region[Nregions].filename, tregion[i].filename); 21 region[Nregions].RA[0] = tregion[i].RA[0]; 22 region[Nregions].RA[1] = tregion[i].RA[1]; 23 region[Nregions].DEC[0] = tregion[i].DEC[0]; 24 region[Nregions].DEC[1] = tregion[i].DEC[1]; 25 Nregions ++; 26 if (Nregions >= NREGIONS) { 27 NREGIONS += 10; 28 REALLOCATE (region, GSCRegion, NREGIONS); 29 } 13 code = (PHOTCODE == NULL) ? -1 : PHOTCODE[0].code; 14 15 Nregions = 0; 16 NREGIONS = 10; 17 ALLOCATE (region, GSCRegion, NREGIONS); 18 19 image = GetImages (&Nimage); 20 21 /* find images for time range, delete each image */ 22 imlist = find_images_time (START, END, PHOTCODE, &Nimlist); 23 24 /* find all overlapping regions */ 25 for (n = 0; n < Nimlist; n++) { 26 j = imlist[n]; 27 if (VERBOSE) fprintf (stderr, "finding regions for %s\n", image[j].name); 28 29 tregion = gregion_image (&image[j], &Ntregions); 30 for (i = 0; i < Ntregions; i++) { 31 found = FALSE; 32 for (k = 0; (k < Nregions) && !found; k++) { 33 found = !strcmp (region[k].filename, tregion[i].filename); 34 } 35 if (!found) { 36 strcpy (region[Nregions].filename, tregion[i].filename); 37 region[Nregions].RA[0] = tregion[i].RA[0]; 38 region[Nregions].RA[1] = tregion[i].RA[1]; 39 region[Nregions].DEC[0] = tregion[i].DEC[0]; 40 region[Nregions].DEC[1] = tregion[i].DEC[1]; 41 Nregions ++; 42 if (Nregions >= NREGIONS) { 43 NREGIONS += 10; 44 REALLOCATE (region, GSCRegion, NREGIONS); 30 45 } 31 46 } 32 47 } 33 for (i = 0; i < Nregions; i++) { 34 fprintf (stderr, "deleting from %s\n", region[i].filename); 35 catalog.filename = region[i].filename; /* don't free region before catalog! */ 36 switch (lock_catalog (&catalog, LCK_SOFT)) { 48 free (tregion); 49 } 50 51 /* delete from all identified regions */ 52 for (i = 0; i < Nregions; i++) { 53 if (VERBOSE) fprintf (stderr, "deleting from %s\n", region[i].filename); 54 catalog.filename = region[i].filename; /* don't free region before catalog! */ 55 switch (lock_catalog (&catalog, LCK_XCLD)) { 37 56 case 0: 38 57 fprintf (stderr, "ERROR: can't lock file\n"); … … 43 62 case 2: 44 63 fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 45 catalog.Naverage = 0; 46 catalog.Nmeasure = 0; 47 break; 64 unlock_catalog (&catalog); 65 continue; 48 66 default: 49 67 fprintf (stderr, "weird lock_catalog exit state\n"); 50 68 exit (1); 51 }52 find_matches (&catalog, &image[0], start, end);53 wcatalog (&catalog);54 69 } 55 dimages (image, Nimage); 56 fprintf (stderr, "SUCCESS\n"); 57 exit (0); 70 71 find_matches (&catalog, code, START, END); 72 wcatalog (&catalog); 73 unlock_catalog (&catalog); 74 } 75 76 /* delete the identified images */ 77 dimages (imlist, Nimlist); 78 79 save_image_db (); 80 unlock_image_db (); 81 fprintf (stderr, "SUCCESS\n"); 82 exit (0); 58 83 } -
trunk/Ohana/src/delstar/src/delstar.c
r4607 r4680 1 1 # include "delstar.h" 2 2 3 main (int argc, char **argv) {3 int main (int argc, char **argv) { 4 4 5 5 SetSignals (); 6 ConfigInit ( argc, argv);6 ConfigInit (&argc, argv); 7 7 args (&argc, argv); 8 8 9 9 lock_image_db (); 10 load_image_db (); 10 11 11 12 /* delete orphaned measurements (no image) from catalog */ … … 17 18 delete_imagename (argv[1]); 18 19 break; 19 case MODE_ORPHANS: 20 delete_orphans (argv[1]); 20 case MODE_TIME: 21 delete_times (); 22 break; 23 case MODE_ORPHAN: 24 fprintf (stderr, "delete orphans not available\n"); 25 // delete_orphans (argv[1]); 21 26 break; 22 27 case MODE_MISSED: 23 delete_missed (argv[1]); 24 break; 25 case MODE_TIME: 26 delete_time (); 28 fprintf (stderr, "delete missed not available\n"); 29 // delete_missed (argv[1]); 27 30 break; 28 31 default: -
trunk/Ohana/src/delstar/src/dimages.c
r4607 r4680 1 # include " addstar.h"1 # include "delstar.h" 2 2 3 int dimages (Image *image, int Nimages) { 3 /* delete images by sequence number */ 4 5 int dimages (int *imlist, int Nimlist) { 4 6 5 int i, j, Ntimage, ntimage, mode; 6 int start, end, tstart, tend, status; 7 char line[256]; 8 struct stat filestat; 9 Image *timage; 10 Header header; 7 int i, j, Nimage; 8 Image *image; 11 9 12 /* get image db file pointer */ 13 f = GetDB (&dbstate); 14 if (dbstate == LCK_EMPTY) { 15 Shutdown ("database is empty"); 16 } 17 fseek (f, 0, SEEK_SET); 10 image = GetImages (&Nimage); 18 11 19 /* use cp to make backup copy */ 20 sprintf (line, "cp %s %s~\0", ImageCat, ImageCat); 21 status = system (line); 22 if (status) { 23 fprintf (stderr, "ERROR: unable to create %s~, exiting\n", ImageCat); 24 Shutdown (); 25 } 26 mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; 27 sprintf (line, "%s~\0", ImageCat); 28 chmod (line, mode); 29 30 /* check if image datafile exists, get header */ 31 fseek (f, 0, SEEK_SET); 32 if (!fits_fread_header (f, &header)) { 33 fprintf (stderr, "Can't find image catalog\n"); 34 exit (1); 35 } 36 fseek (f, header.size, SEEK_SET); 37 38 fits_scan (&header, "NIMAGES", "%d", 1, &Ntimage); 39 ALLOCATE (timage, Image, Ntimage); 40 ntimage = Fread (timage, sizeof(Image), Ntimage, f, "image"); 41 if (Ntimage != ntimage) { 42 fprintf (stderr, "failed to read in entire image file %s\n", ImageCat); 43 exit (1); 44 } 45 46 /* need to delete on basis of both image time & photcode */ 47 /* first, mark the deleted images with a flag (NX = 0) */ 48 for (i = 0; i < Ntimage; i++) { 49 for (j = 0; j < Nimages; j++) { 50 tstart = timage[i].tzero; 51 tend = timage[i].tzero + timage[i].trate * timage[i].NY; 52 start = image[j].tzero; 53 end = image[j].tzero + image[j].trate * image[j].NY; 54 if ((tstart <= end) && (tend >= start) && (timage[i].source == image[j].source)) { 55 fprintf (stderr, "deleting %s\n", timage[i].name); 56 timage[i].NX = 0; 57 } 58 } 12 /* first, mark the deleted images with a flag (name = 0) */ 13 for (i = 0; i < Nimlist; i++) { 14 j = imlist[i]; 15 image[j].name[0] = 0; 16 /* this puts a restriction on the DB: image name must not be NULL */ 59 17 } 60 18 61 19 /* delete the marked images */ 62 for (i = 0, j = 0; j < Ntimage; j++) { 63 if (timage[j].NX) { 64 if (i != j) { 65 timage[i] = timage[j]; 66 } 67 i++; 20 for (i = 0, j = 0; j < Nimage; j++) { 21 if (!image[j].name[0]) continue; 22 if (i != j) { 23 image[i] = image[j]; 68 24 } 25 i++; 69 26 } 70 Ntimage = i; 71 REALLOCATE (timage, Image, Ntimage); 72 fits_modify (&header, "NIMAGES", "%d", 1, Ntimage); 27 Nimage = i; 28 REALLOCATE (image, Image, Nimage); 73 29 74 /* should make a backup copy of the ImageCat file */ 75 fseek (f, 0, SEEK_SET); 76 Fwrite (header.buffer, 1, header.size, f, "char"); 77 Fwrite (timage, sizeof(Image), Ntimage, f, "image"); 78 30 SetImages (image, Nimage); 79 31 return (TRUE); 80 32 } 81 82 /* this is kind of silly: we match images in both gimages and dimages83 *84 */ -
trunk/Ohana/src/delstar/src/find_images.c
r2463 r4680 1 1 # include "delstar.h" 2 double opening_angle ();3 2 4 3 Image *find_images (FILE *f, CatStats *catstats, int *Nimages) { … … 133 132 } 134 133 135 int edge_check (x1, y1, x2, y2) 136 double *x1, *y1, *x2, *y2; 137 { 134 int edge_check (double *x1, double *y1, double *x2, double *y2) { 138 135 139 136 double theta1, theta2; … … 169 166 } 170 167 171 double opening_angle (x1, y1, x2, y2, x3, y3) 172 double x1, y1, x2, y2, x3, y3; 173 { 168 double opening_angle (double x1, double y1, double x2, double y2, double x3, double y3) { 174 169 175 170 double dx1, dy1, dx2, dy2, ct, st, theta; -
trunk/Ohana/src/delstar/src/find_matches.c
r2463 r4680 1 1 # include "delstar.h" 2 2 3 find_matches (Catalog *catalog, Image *image, int start, int end) {4 5 int i, j, k, n, m, N, M, found;6 int * N1, *N2, *next, *next_miss, *ave_miss, last, last_miss;7 int Nave, N AVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch, photcode;3 void find_matches (Catalog *catalog, int photcode, int start, int end) { 4 5 int i, j, k, n, m, N, M, drop; 6 int *next, *next_miss, *ave_miss, last, last_miss; 7 int Nave, Nmeas, Nmiss; 8 8 int Nmeasfound, Nsecfilt; 9 9 int this, prev; 10 unsigned int flags;11 10 Measure *tmpmeasure; 12 11 Missing *tmpmissing; 13 Coords tcoords;14 12 15 13 /** allocate local arrays **/ … … 43 41 } 44 42 } 45 photcode = -1; 46 if ((start == 0) && (end == 0)) { 47 start = image[0].tzero; 48 end = image[0].tzero + 1e-4*image[0].NY*image[0].trate; /* trate is in 0.1 msec / row */ 49 photcode = image[0].source; 50 } 51 if (VERBOSE) fprintf (stderr, "deleting for range %d to %d (photcode %d)\n", start, end, photcode); 43 44 if (VERBOSE) fprintf (stderr, "deleting for range %d to %d, photcode %d\n", start, end, photcode); 52 45 Nmeasfound = 0; 53 46 Nsecfilt = catalog[0].Nsecfilt; 54 47 55 /* fprintf (stderr, "fixing the measures...\n"); */ 56 /** find measure in time range of image **/ 48 if (VERBOSE) fprintf (stderr, "fixing measure...\n"); 49 50 /** find measure in time range **/ 57 51 this = prev = -1; 58 52 for (i = 0; (i < Nmeas); i++) { 59 if ((i % 10000) == 0) fprintf (stderr, ". "); 60 if ((catalog[0].measure[i].t >= start) && (catalog[0].measure[i].t <= end) && (photcode == catalog[0].measure[i].source)) { 61 Nmeasfound ++; 62 /* this star is in this image */ 63 this = next[i]; 64 next[i] = -2; /* we delete this one */ 65 if (prev != -1) { next[prev] = this; } 53 if (VERBOSE && !(i % 10000)) fprintf (stderr, ". "); 54 drop = TRUE; 55 drop &= (catalog[0].measure[i].t >= start); 56 drop &= (catalog[0].measure[i].t <= end); 57 drop &= ((photcode == -1) || (photcode == catalog[0].measure[i].source)); 58 if (!drop) { 59 prev = i; 60 continue; 61 } 62 Nmeasfound ++; 63 64 /* this star is in this image */ 65 this = next[i]; 66 next[i] = -2; /* we delete this one */ 67 if (prev != -1) { next[prev] = this; } 68 66 69 # if (0) 67 /* why is this section disabled? */ 70 /* why is this section disabled? */ 71 /* fix the list links: connect the previous valid link to the next valid link */ 72 for (j = i; (j >= 0) && (next[j] == -2); j--); /* find previous entry to fix link */ 73 if (j >= 0) { /* if j < 0, there is no previous valid link, ignore this step */ 74 if (next[j] != i) { 75 fprintf (stderr, "error? (1) this link seems to have been lost\n"); 76 fprintf (stderr, "j: %d, next[j]: %d, i: %d\n", j, next[j], i); 77 exit (1); 78 } 79 /* find next valid entry to fix link */ 80 for (k = i; (k < Nmeas) && (next[k] == -2); k++); 81 if (k < Nmeas) 82 next[j] = k; 83 else 84 next[j] = -1; /* last link in list gets a -1 */ 85 } 86 # endif 87 88 /*** fix the corresponding average entry ***/ 89 n = catalog[0].measure[i].averef; 90 if (catalog[0].average[n].Nm == 0) { /* this should never happen */ 91 fprintf (stderr, "error? we deleted one too many objects?\n"); 92 exit (1); 93 } 94 catalog[0].average[n].Nm --; 95 /* this was only entry in list: will be deleted below. meanwhile, delete all missing entries*/ 96 if ((catalog[0].average[n].Nm < 1) && (catalog[0].average[n].Nn > 0)) { 97 m = catalog[0].average[n].missing; 98 for (j = 0; j < catalog[0].average[n].Nn; j++) { 99 M = next_miss[m]; 100 next_miss[m] = -2; 101 m = M; 102 } 103 m = catalog[0].average[n].missing; 68 104 /* fix the list links: connect the previous valid link to the next valid link */ 69 for (j = i; (j >= 0) && (next[j] == -2); j--); /* find previous entry to fix link */105 for (j = m; (j >= 0) && (next_miss[j] == -2); j--); /* find previous entry to fix link */ 70 106 if (j >= 0) { /* if j < 0, there is no previous valid link, ignore this step */ 71 if (next[j] != i) { 72 fprintf (stderr, "error? (1) this link seems to have been lost\n"); 73 fprintf (stderr, "j: %d, next[j]: %d, i: %d\n", j, next[j], i); 74 exit (1); 75 } 76 /* find next valid entry to fix link */ 77 for (k = i; (k < Nmeas) && (next[k] == -2); k++); 78 if (k < Nmeas) 79 next[j] = k; 80 else 81 next[j] = -1; /* last link in list gets a -1 */ 82 } 83 # endif 84 /*** fix the corresponding average entry ***/ 85 n = catalog[0].measure[i].averef; 86 if (catalog[0].average[n].Nm == 0) { /* this should never happen */ 87 fprintf (stderr, "error? we deleted one too many objects?\n"); 88 exit (1); 89 } 90 catalog[0].average[n].Nm --; 91 /* this was only entry in list: will be deleted below. meanwhile, delete all missing entries*/ 92 if ((catalog[0].average[n].Nm < 1) && (catalog[0].average[n].Nn > 0)) { 93 m = catalog[0].average[n].missing; 94 for (j = 0; j < catalog[0].average[n].Nn; j++) { 95 M = next_miss[m]; 96 next_miss[m] = -2; 97 m = M; 98 } 99 m = catalog[0].average[n].missing; 100 /* fix the list links: connect the previous valid link to the next valid link */ 101 for (j = m; (j >= 0) && (next_miss[j] == -2); j--); /* find previous entry to fix link */ 102 if (j >= 0) { /* if j < 0, there is no previous valid link, ignore this step */ 103 if (next_miss[j] != m) { 104 fprintf (stderr, "error? (2) this link seems to have been lost\n"); 105 fprintf (stderr, "j: %d, next_miss[j]: %d, i: %d\n", j, next_miss[j], i); 106 exit (1); 107 } 108 /* find next valid entry to fix link */ 109 for (k = m; (k < Nmiss) && (next_miss[k] == -2); k++); 110 if (k < Nmiss) 111 next_miss[j] = k; 112 else 113 next_miss[j] = -1; /* last link in list gets a -1 */ 114 } 115 } 116 /* this was first entry in list */ 117 if ((catalog[0].average[n].offset == i) && (catalog[0].average[n].Nm > 0)) { 118 m = catalog[0].average[n].offset; 119 /* find next valid entry -- notice lack of error checking... */ 120 for (j = 0; (j < Nmeas) && (next[m+j] == -2); j++); 121 catalog[0].average[n].offset = m + j; 122 } 123 } else { 124 prev = i; 125 } 126 } 127 fprintf (stderr, "found %d meas to remove\n", Nmeasfound); 128 129 /* fprintf (stderr, "fixing the missing...\n"); */ 130 /** find missing in time range of image **/ 131 for (i = 0; (i < Nmiss); i++) { 132 if ((next_miss[i] != -2) && (catalog[0].missing[i].t >= start) && (catalog[0].missing[i].t <= end)) { 133 /* this star is in this image */ 134 135 next_miss[i] = -2; /* we delete this one */ 136 /* fix the list links: connect the previous valid link to the next valid link */ 137 for (j = i; (j >= 0) && (next_miss[j] == -2); j--); /* find previous entry to fix link */ 138 if (j >= 0) { /* if j < 0, there is no previous valid link, ignore this step */ 139 if (next_miss[j] != i) { 140 fprintf (stderr, "error? (3) this link seems to have been lost\n"); 107 if (next_miss[j] != m) { 108 fprintf (stderr, "error? (2) this link seems to have been lost\n"); 141 109 fprintf (stderr, "j: %d, next_miss[j]: %d, i: %d\n", j, next_miss[j], i); 142 110 exit (1); 143 111 } 144 112 /* find next valid entry to fix link */ 145 for (k = i; (k < Nmiss) && (next_miss[k] == -2); k++);113 for (k = m; (k < Nmiss) && (next_miss[k] == -2); k++); 146 114 if (k < Nmiss) 147 115 next_miss[j] = k; … … 149 117 next_miss[j] = -1; /* last link in list gets a -1 */ 150 118 } 119 } 120 /* this was first entry in list */ 121 if ((catalog[0].average[n].offset == i) && (catalog[0].average[n].Nm > 0)) { 122 m = catalog[0].average[n].offset; 123 /* find next valid entry -- notice lack of error checking... */ 124 for (j = 0; (j < Nmeas) && (next[m+j] == -2); j++); 125 catalog[0].average[n].offset = m + j; 126 } 127 } 128 fprintf (stderr, "found %d meas to remove\n", Nmeasfound); 129 130 if (VERBOSE) fprintf (stderr, "fixing missing..."); 131 /** find missing in time range of image **/ 132 for (i = 0; (i < Nmiss); i++) { 133 if (next_miss[i] == -2) continue; 134 if (catalog[0].missing[i].t < start) continue; 135 if (catalog[0].missing[i].t > end) continue; 136 137 next_miss[i] = -2; /* we delete this one */ 138 /* fix the list links: connect the previous valid link to the next valid link */ 139 for (j = i; (j >= 0) && (next_miss[j] == -2); j--); /* find previous entry to fix link */ 140 if (j >= 0) { /* if j < 0, there is no previous valid link, ignore this step */ 141 if (next_miss[j] != i) { 142 fprintf (stderr, "error? (3) this link seems to have been lost\n"); 143 fprintf (stderr, "j: %d, next_miss[j]: %d, i: %d\n", j, next_miss[j], i); 144 exit (1); 145 } 146 /* find next valid entry to fix link */ 147 for (k = i; (k < Nmiss) && (next_miss[k] == -2); k++); 148 if (k < Nmiss) 149 next_miss[j] = k; 150 else 151 next_miss[j] = -1; /* last link in list gets a -1 */ 152 } 151 153 152 /* find the corresponding avearge entry 153 found = FALSE; 154 for (n = 0; !found && (n < Nave); n++) { 155 if ((catalog[0].average[n].missing > 0) && (catalog[0].average[n].missing <= i) && (catalog[0].average[n].missing + catalog[0].average[n].Nn > i)) 156 found = TRUE; 157 } 158 n--; */ 159 /*** fix the corresponding average entry ***/ 160 n = ave_miss[i]; 161 if (catalog[0].average[n].Nn == 0) { /* this should never happen */ 162 fprintf (stderr, "error? we deleted one too many missing?\n"); 163 exit (1); 164 } 165 catalog[0].average[n].Nn --; 166 /* this was first entry in list */ 167 if ((catalog[0].average[n].missing == i) && (catalog[0].average[n].Nn > 0)) { 168 m = catalog[0].average[n].missing; 169 for (j = 0; (j < Nmiss) && (next_miss[m+j] == -2); j++); 170 catalog[0].average[n].missing = m + j; 171 } 172 173 } 174 } 175 176 /* currently not worked out, but we will need to delete the references to blended image and cat stars */ 177 # if 0 178 /*** handle multiple stars */ 179 /* this image star matches more than one catalog star */ 180 if (stars[N].found > -1) { 181 catalog[0].measure[stars[N].found].flags |= BLEND_IMAGE; 182 catalog[0].measure[Nmeas].flags |= BLEND_IMAGE; 183 } 184 if (stars[N].found == -2) { /* this image star matches a catalog star on a neighboring catalog */ 185 catalog[0].measure[Nmeas].flags |= BLEND_IMAGE_NEIGHBOR; 186 } 187 if (stars[N].found == -1) { /* this image star matches only this star */ 188 stars[N].found = Nmeas; /* save first match, in case coincidences are found */ 189 } 190 /* this catalog star matches more than one image star */ 191 if (catalog[0].found[n] > -1) { 192 catalog[0].measure[catalog[0].found[n]].flags |= BLEND_CATALOG; 193 catalog[0].measure[Nmeas].flags |= BLEND_CATALOG; 194 } else { 195 catalog[0].found[n] = Nmeas; 196 } 197 # endif 154 /*** fix the corresponding average entry ***/ 155 n = ave_miss[i]; 156 if (catalog[0].average[n].Nn == 0) { /* this should never happen */ 157 fprintf (stderr, "error? we deleted one too many missing?\n"); 158 exit (1); 159 } 160 catalog[0].average[n].Nn --; 161 /* this was first entry in list */ 162 if ((catalog[0].average[n].missing == i) && (catalog[0].average[n].Nn > 0)) { 163 m = catalog[0].average[n].missing; 164 for (j = 0; (j < Nmiss) && (next_miss[m+j] == -2); j++); 165 catalog[0].average[n].missing = m + j; 166 } 167 } 168 169 /* we should delete the references to blended image and cat stars ?? */ 170 /* or drop since we are changing this concept ?? */ 198 171 199 172 /* fix Average list: delete entries with Nm == 0 */ … … 266 239 free (next_miss); 267 240 free (ave_miss); 268 241 return; 269 242 } 270 243 -
trunk/Ohana/src/delstar/src/gimages.c
r4607 r4680 1 1 # include "delstar.h" 2 2 3 /* load information about image from image header */ 3 /* load information about image from image header 4 * this should be the same as addstar/gstars, but it is not... 5 */ 4 6 5 7 Image *gimages (char *filename) { … … 7 9 FILE *f; 8 10 Header header; 9 char line[64], photcode[64], *c; 10 struct tm timeptr; 11 double tmp, jd; 11 char photcode[64], *c; 12 double tmp; 12 13 Image *image; 13 int N sec, Nc;14 int Nc; 14 15 15 16 ALLOCATE (image, Image, 1); 16 17 /* load header */ 17 18 if (!fits_read_header (filename, &header)) { 18 fprintf (stderr, "ERROR: can't find image file %s\n", filename); 19 Shutdown (); 19 Shutdown ("ERROR: can't find image file %s", filename); 20 20 } 21 21 … … 23 23 f = fopen (filename, "r"); 24 24 if (f == NULL) { 25 fprintf (stderr, "ERROR: can't find data file %s\n", filename); 26 Shutdown (); 25 Shutdown ("ERROR: can't find data file %s", filename); 27 26 } 28 27 fseek (f, header.size, SEEK_SET); … … 38 37 /* get astrometry information */ 39 38 if (!GetCoords (&image[0].coords, &header)) { 40 fprintf (stderr, "ERROR: no astrometric solution in header\n"); 41 Shutdown (); 39 Shutdown ("ERROR: no astrometric solution in header"); 42 40 } 43 41 while (image[0].coords.crval1 < 0) image[0].coords.crval1 += 360.0; … … 56 54 Nc = GetPhotcodeCodebyName (photcode); 57 55 if (!Nc) { 58 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photcode); 59 Shutdown (); 56 Shutdown ("ERROR: photcode %s not found in photcode table", photcode); 60 57 } 61 58 image[0].source = Nc; -
trunk/Ohana/src/delstar/src/gtimes.c
r4607 r4680 55 55 { 56 56 double Ra, Dec; 57 fprintf (stderr, "found the following images:\n");58 for (i = 0; i < npimage; i++) {57 if (VERBOSE) fprintf (stderr, "found the following images:\n"); 58 for (i = 0; VERBOSE && (i < npimage); i++) { 59 59 XY_to_RD (&Ra, &Dec, 0.5*pimage[i].NX, 0.5*pimage[i].NY, &pimage[i].coords); 60 60 fprintf (stderr, "%3d %s %8.4f %8.4f %d %d\n", i, pimage[i].name, Ra, Dec, -
trunk/Ohana/src/delstar/src/image-db.c
r4607 r4680 7 7 static int dbstate = LCK_UNLOCK; 8 8 9 static Header header; 10 static Image *image = NULL; 11 static int Nimage; 12 9 13 FILE *GetDB (int *state) { 10 14 *state = dbstate; 11 15 return (f); 16 } 17 18 Image *GetImages (int *nimage) { 19 *nimage = Nimage; 20 return (image); 21 } 22 23 int SetImages (Image *new, int Nnew) { 24 Nimage = Nnew; 25 image = new; 26 fits_modify (&header, "NIMAGES", "%d", 1, Nimage); 27 return (TRUE); 12 28 } 13 29 … … 23 39 va_start (argp, format); 24 40 vfprintf (stderr, formatplus, argp); 25 free (formatplus);26 41 va_end (argp); 27 42 … … 37 52 f = fsetlockfile (ImageCat, 3600.0, LOCK, &dbstate); 38 53 if (f == NULL) { 39 fprintf (stderr, "ERROR: can't lock image catalog\n"); 40 exit (1); 54 Shutdown ("ERROR: can't lock image catalog"); 55 } 56 if (dbstate == LCK_EMPTY) { 57 Shutdown ("ERROR: database is empty"); 41 58 } 42 59 fseek (f, 0, SEEK_SET); 43 60 } 44 61 45 void unlock_image_db (Image *image) { 62 int load_image_db () { 63 64 int nimage; 65 66 /* read header */ 67 fseek (f, 0, SEEK_SET); 68 if (!fits_fread_header (f, &header)) { 69 Shutdown ("can't read image catalog %s", ImageCat); 70 } 71 fseek (f, header.size, SEEK_SET); 72 73 Nimage = 0; 74 fits_scan (&header, "NIMAGES", "%d", 1, &Nimage); 75 ALLOCATE (image, Image, Nimage); 76 77 nimage = Fread (image, sizeof(Image), Nimage, f, "image"); 78 if (nimage != Nimage) { 79 Shutdown ("error reading images from db file"); 80 } 81 82 return (TRUE); 83 } 84 85 int save_image_db () { 86 87 int status; 88 char line[1024]; 89 mode_t mode; 90 91 /* use cp to make backup copy */ 92 sprintf (line, "cp %s %s~", ImageCat, ImageCat); 93 status = system (line); 94 if (status) { 95 Shutdown ("ERROR: unable to create %s~, exiting", ImageCat); 96 } 97 mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; 98 sprintf (line, "%s~", ImageCat); 99 chmod (line, mode); 100 101 /* update header */ 102 fits_modify (&header, "NIMAGES", "%d", 1, Nimage); 103 104 /* write out data to already opened file */ 105 fseek (f, 0, SEEK_SET); 106 Fwrite (header.buffer, 1, header.size, f, "char"); 107 Fwrite (image, sizeof(Image), Nimage, f, "image"); 108 109 return (TRUE); 110 } 111 112 void unlock_image_db () { 46 113 47 114 mode_t mode; 48 49 /* protect wimage from interrupt signals */50 if (MODE == M_IMAGE) {51 SetProtect (TRUE);52 wimage (image);53 SetProtect (FALSE);54 }55 115 56 116 fclearlockfile (ImageCat, f, LOCK, &dbstate); -
trunk/Ohana/src/delstar/src/match_images.c
r2463 r4680 1 1 # include "delstar.h" 2 2 3 match_images (catalog, image, Nimage) 4 Catalog catalog[]; 5 Image image[]; 6 int Nimage; 7 { 3 void match_images (Catalog *catalog, Image *image, int Nimage) { 8 4 9 5 int j, k, found; -
trunk/Ohana/src/delstar/src/parse_time.c
r3517 r4680 1 1 # include "delstar.h" 2 2 3 parse_time (Header *header) {3 int parse_time (Header *header) { 4 4 5 5 double jd; … … 38 38 for (Ny = 0, c = strchr (DateMode, 'Y'); c != (char ) NULL; c = strchr (c + 1, 'Y'), Ny++); 39 39 if ((Ny != 2) && (Ny != 4)) { 40 fprintf (stderr, "error in DATE-MODE format: %s\n", DateMode); 41 Shutdown (); 40 Shutdown ("error in DATE-MODE format: %s", DateMode); 42 41 } 43 42 py = strchr (DateMode, 'Y'); … … 45 44 pd = strchr (DateMode, 'D'); 46 45 if ((py == (char *) NULL) || (pm == (char *) NULL) || (pd == (char *) NULL)) { 47 fprintf (stderr, "error in DATE-MODE format: %s\n", DateMode); 48 Shutdown (); 46 Shutdown ("error in DATE-MODE format: %s", DateMode); 49 47 } 50 48 if ((py > pm) && (py < pd)) { 51 fprintf (stderr, "error in DATE-MODE format: %s\n", DateMode); 52 Shutdown (); 49 Shutdown ("error in DATE-MODE format: %s", DateMode); 53 50 } 54 51 if ((py > pd) && (py < pm)) { 55 fprintf (stderr, "error in DATE-MODE format: %s\n", DateMode); 56 Shutdown (); 52 Shutdown ("error in DATE-MODE format: %s", DateMode); 57 53 } 58 54 mode = 0; … … 62 58 if ((py > pm) && (pm > pd)) { mode = 4; } /* dd-mm-yyyy */ 63 59 if (!mode) { 64 fprintf (stderr, "error in DATE-MODE format: %s\n", DateMode); 65 Shutdown (); 60 Shutdown ("error in DATE-MODE format: %s", DateMode); 66 61 } 67 62 … … 90 85 } 91 86 if (Nf != 3) { 92 fprintf (stderr, "error in date entry (%s) or DATE-MODE format (%s)\n", line, DateMode); 93 Shutdown (); 87 Shutdown ("error in date entry (%s) or DATE-MODE format (%s)", line, DateMode); 94 88 } 95 89 -
trunk/Ohana/src/delstar/src/sort_lists.c
r2463 r4680 1 # include "delstar.h" 1 2 2 sort_lists (X, Y, S, N) 3 float *X, *Y; 4 int *S, N; 5 { 3 void sort_lists (float *X, float *Y, int *S, int N) { 4 6 5 int l,j,ir,i; 7 6 double tX, tY, tS; … … 15 14 tY = Y[l]; 16 15 tS = S[l]; 17 } 18 else { 16 } else { 19 17 tX = X[ir]; 20 18 X[ir] = X[0]; … … 47 45 } 48 46 } 47 48 void sort_regions (GSCRegion *region, int N) { 49 50 int l,j,ir,i; 51 GSCRegion tmp; 52 53 l = N >> 1; 54 ir = N - 1; 55 for (;;) { 56 if (l > 0) { 57 l--; 58 tmp = region[l]; 59 } else { 60 tmp = region[ir]; 61 region[ir] = region[0]; 62 if (--ir == 0) { 63 region[0] = tmp; 64 return; 65 } 66 } 67 i = l; 68 j = (l << 1) + 1; 69 while (j <= ir) { 70 if (j < ir && region[j].DEC[0] < region[j+1].DEC[0]) j++; 71 if (tmp.DEC[0] < region[j].DEC[0]) { 72 region[i] = region[j]; 73 j += (i=j) + 1; 74 } 75 else j = ir + 1; 76 } 77 region[i] = tmp; 78 } 79 } 80 -
trunk/Ohana/src/delstar/src/wcatalog.c
r2463 r4680 1 1 # include "delstar.h" 2 2 3 wcatalog (Catalog *catalog) {3 int wcatalog (Catalog *catalog) { 4 4 5 int status;6 7 5 /* we'll leave these for now, but they are LONEOS specific */ 8 6 fits_modify (&catalog[0].header, "MARKSTAR", "%t", 1, FALSE); … … 34 32 } 35 33 fits_free_header (&catalog[0].header); 34 35 return (TRUE); 36 36 } 37 37
Note:
See TracChangeset
for help on using the changeset viewer.
