Changeset 4844 for trunk/Ohana/src/opihi/dvo/cmatch.c
- Timestamp:
- Aug 20, 2005, 5:40:29 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/cmatch.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/cmatch.c
r4800 r4844 1 1 # include "dvo1.h" 2 # define BYTES_STAR 233 # define BLOCK 10004 # define DNSTARS 10005 2 6 3 int cmatch (int argc, char **argv) { … … 15 12 Vector *rvec, *dvec, *mvec, *drvec, *ddvec, *dmvec; 16 13 14 VarConfig ("GSCDIR", "%s", gscdir); 17 15 VarConfig ("CATDIR", "%s", catdir); 18 VarConfig ("GSCDIR", "%s", gscdir); 16 if (VarConfig ("CATMODE", "%s", catalog.catmode) == NULL) 17 strcpy (catalog.catmode, "RAW"); 19 18 20 19 if (argc != 9) { 21 20 fprintf (stderr, "USAGE: cmatch file radius (RA) (DEC) (Mag) (dRA) (dDEC) (dMag)\n"); 21 fprintf (stderr, " match a set of object coordinates with a DVO db table\n"); 22 22 return (FALSE); 23 23 } 24 25 /*** this function is not well-defined. re-assess it and re-code it ***/ 26 fprintf (stderr, "disabled for now\n"); 27 return (FALSE); 24 28 25 29 radius = atof (argv[2]); … … 34 38 /* load data from the photometry database file */ 35 39 sprintf (filename, "%s/%s", catdir, argv[1]); 36 if (!fits_read_header (filename, &catalog1.header)) { 37 fprintf (stderr, "no stars in %s\n", filename); 40 catalog1.filename = filename; 41 switch (lock_catalog (&catalog, LCK_SOFT)) { 42 case 2: 43 unlock_catalog (&catalog); 44 case 0: 38 45 return (FALSE); 39 46 } 40 f = fopen (filename, "r"); 41 if (f == (FILE *) NULL) { 42 fprintf (stderr, "no stars in %s\n", filename); 47 if (!load_catalog (&catalog, LOAD_AVES | LOAD_MEAS | LOAD_SECF, TRUE)) { 48 unlock_catalog (&catalog); 43 49 return (FALSE); 44 50 } 45 fseek (f, catalog1.header.size, SEEK_SET); 46 47 /** find number of stars, measurements **/ 48 catalog1.Naverage = 0; 49 fits_scan (&catalog1.header, "NSTARS", "%d", 1, &catalog1.Naverage); 50 if (catalog1.Naverage == 0) { 51 fprintf (stderr, "no stars in catalog %s\n", filename); 52 fclose (f); 53 return (TRUE); 54 } 55 ALLOCATE (catalog1.average, Average, catalog1.Naverage); 56 Nitems = catalog1.Naverage; 57 nitems = Fread (catalog1.average, sizeof(Average), Nitems, f, "average"); 58 if (nitems != Nitems) { 59 fprintf (stderr, "ERROR: failed to read data from catalog file %s (1)\n", filename); 60 fclose (f); 61 free (catalog1.average); 62 return (FALSE); 63 } 64 fclose (f); 51 unlock_catalog (&catalog); 65 52 fprintf (stderr, "read %d stars from phot catalog file %s\n", catalog1.Naverage, filename); 66 53 67 /* load data from the GSC file */68 sprintf (filename, "%s/%s", gscdir, argv[1]);69 f = fopen (filename, "r");70 if (f == (FILE *) NULL) {71 fprintf (stderr, "no stars in %s\n", filename);72 free (catalog1.average);73 return (FALSE);74 /* return (FALSE); */75 }76 77 54 nstar = 0; 78 55 NSTARS = DNSTARS;
Note:
See TracChangeset
for help on using the changeset viewer.
