Changeset 5014 for trunk/Ohana/src/addstar
- Timestamp:
- Sep 12, 2005, 3:04:48 PM (21 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 9 edited
-
include/addstar.h (modified) (1 diff)
-
src/airmass.c (modified) (2 diffs)
-
src/calibrate.c (modified) (3 diffs)
-
src/find_matches.c (modified) (5 diffs)
-
src/gcatalog.c (modified) (1 diff)
-
src/gstars.c (modified) (6 diffs)
-
src/image-db.c (modified) (3 diffs)
-
src/mkcatalog.c (modified) (2 diffs)
-
src/wcatalog.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/include/addstar.h
r4864 r5014 124 124 int Shutdown PROTO((char *message, ...); ) 125 125 void TrapSignal PROTO((int sig)); 126 short airmass PROTO((short secz_image, double ra, double dec, double st, double latitude));126 float airmass PROTO((float secz_image, double ra, double dec, double st, double latitude)); 127 127 void aregion PROTO((GSCRegion *region, FILE *f, double ra, double dec)); 128 128 int args PROTO((int argc, char **argv)); -
trunk/Ohana/src/addstar/src/airmass.c
r3361 r5014 1 1 # include "addstar.h" 2 2 3 short airmass (short secz_image, double ra, double dec, double st, double latitude) {3 float airmass (float secz_image, double ra, double dec, double st, double latitude) { 4 4 5 5 double hour, cosz, secz; … … 13 13 hour = 15.0*st - ra; 14 14 cosz = sin (RAD_DEG*dec) * sin (RAD_DEG*latitude) + cos (RAD_DEG*dec) * cos (RAD_DEG*hour) * cos (RAD_DEG*latitude); 15 16 /* modify to match storage units (millimags) */ 17 secz = 1000.0 / cosz; 15 secz = 1.000 / cosz; 18 16 return (secz); 19 17 } -
trunk/Ohana/src/addstar/src/calibrate.c
r4865 r5014 95 95 if (MaxN == -1) { 96 96 fprintf (stderr, "no clean stars\n"); 97 image[0].Mcal = 10000;98 image[0].dMcal = 10000;97 image[0].Mcal_PS = 10.000; 98 image[0].dMcal_PS = 10.000; 99 99 return; 100 100 } … … 137 137 if (Nkeep < 5) { 138 138 fprintf (stderr, "too few stars\n"); 139 image[0].Mcal = 10000;140 image[0].dMcal = 10000;139 image[0].Mcal_PS = 10.000; 140 image[0].dMcal_PS = 10.000; 141 141 return; 142 142 } … … 169 169 Mw = W1 / W2; 170 170 fprintf (stderr, "N: %.0f, mean: %f, wt mean: %f, stdev: %f, precision: %f\n", N, M1, Mw, M2, M2 / sqrt (N)); 171 image[0].Mcal = 1000 *M1;172 image[0].dMcal = 1000 *M2 / sqrt (N);171 image[0].Mcal_PS = M1; 172 image[0].dMcal_PS = M2 / sqrt (N); 173 173 image[0].Mxxxx = N; 174 174 } else { 175 175 fprintf (stderr, "too few stars\n"); 176 image[0].Mcal = 10000;177 image[0].dMcal = 10000;176 image[0].Mcal_PS = 10.000; 177 image[0].dMcal_PS = 10.000; 178 178 image[0].Mxxxx = 0; 179 179 } 180 180 } 181 182 /*** image.Mcal is still in millimags ***/ -
trunk/Ohana/src/addstar/src/find_matches.c
r4865 r5014 12 12 Missing *tmpmissing; 13 13 Coords tcoords; 14 int Nsecfilt, Nsec , MTIME;15 float Mcat, *Mval ;14 int Nsecfilt, Nsec; 15 float Mcat, *Mval, MTIME; 16 16 17 17 /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */ … … 143 143 144 144 /* calculate accurate per-star airmass */ 145 secz = airmass (image[0].secz , stars[N].R, stars[N].D, SiderealTime, Latitude);145 secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, SiderealTime, Latitude); 146 146 147 147 /** add measurements for this star **/ … … 151 151 catalog[0].measure[Nmeas].M_PS = MIN (stars[N].M + MTIME, NO_MAG); 152 152 catalog[0].measure[Nmeas].dM_PS = MIN (stars[N].dM, NO_ERR); /* error in input files stored in thousandths of mag */ 153 catalog[0].measure[Nmeas].Mcal_PS = 0.001*image[0].Mcal; /* XXX image.Mcal still millimags */153 catalog[0].measure[Nmeas].Mcal_PS = image[0].Mcal_PS; 154 154 catalog[0].measure[Nmeas].t = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */ 155 155 catalog[0].measure[Nmeas].averef = n; … … 252 252 if (!IN_CATALOG (stars[N].R, stars[N].D)) continue; 253 253 254 secz = airmass (image[0].secz , stars[N].R, stars[N].D, SiderealTime, Latitude);254 secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, SiderealTime, Latitude); 255 255 256 256 catalog[0].average[Nave].R_PS = stars[N].R; … … 277 277 catalog[0].measure[Nmeas].M_PS = MIN (stars[N].M + MTIME, NO_MAG); 278 278 catalog[0].measure[Nmeas].dM_PS = MIN (stars[N].dM, NO_ERR); 279 catalog[0].measure[Nmeas].Mcal_PS = 0.001*image[0].Mcal;279 catalog[0].measure[Nmeas].Mcal_PS = image[0].Mcal_PS; 280 280 catalog[0].measure[Nmeas].t = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */ 281 281 catalog[0].measure[Nmeas].averef = Nave; -
trunk/Ohana/src/addstar/src/gcatalog.c
r4865 r5014 6 6 char mode; 7 7 8 /* no autodetect for CATMODE yet */ 9 strcpy (catalog[0].catmode, CATMODE); 8 /* CATMODE and CATFORMAT determined from catalog */ 10 9 11 10 /* read catalog header */ -
trunk/Ohana/src/addstar/src/gstars.c
r4988 r5014 4 4 5 5 FILE *f; 6 int j, N, Nbytes ;6 int j, N, Nbytes, extend; 7 7 int itmp, hour, min; 8 8 char *c, photcode[64], line[80]; … … 76 76 image[0].exptime = tmp; 77 77 78 /*** why are we no longer using APMIFIT?? ***/ 78 79 tmp = 0; 79 80 /* fits_scan (&header, "APMIFIT", "%lf", 1, &tmp); */ 80 image[0].apmifit = tmp * 1000.0;81 image[0].apmifit_PS = tmp; 81 82 82 83 tmp = 0; 83 84 /* fits_scan (&header, "dAPMIFIT", "%lf", 1, &tmp); */ 84 image[0].dapmifit = tmp * 1000.0;85 image[0].dapmifit_PS = tmp; 85 86 86 87 tmp = 0; … … 110 111 tmp = 0; 111 112 fits_scan (&header, AirmassKeyword, "%lf", 1, &tmp); 112 image[0].secz = MIN (NO_MAG, 1000*tmp);113 image[0].secz_PS = MIN (NO_MAG, tmp); 113 114 114 115 if (!fits_scan (&header, CCDNumKeyword, "%d", 1, &itmp)) { … … 122 123 123 124 /* secz is in units milli-airmass */ 124 image[0].Mcal = 0.0;125 image[0].Mcal_PS = 0.0; 125 126 image[0].Xm = NO_MAG; 126 127 image[0].code = 0; … … 162 163 fseek (f, header.size, SEEK_SET); 163 164 165 /* read from FITS table or from text table */ 166 extend = FALSE; 167 fits_scan (&header, "EXTEND", "%t", 1, &extend); 168 if (extend) { 169 Nbytes = fits_matrix_size (&header); 170 fseek (f, Nbytes, SEEK_CUR); 171 rdstars = rfits (f, &image[0].nstar); 172 } else { 173 /* allocate space for stars */ 174 if (!fits_scan (&header, "NSTARS", "%d", 1, &image[0].nstar)) { 175 fprintf (stderr, "ERROR: failed to find NSTARS\n"); 176 exit (1); 177 } 178 rdstars = rtext (f, &image[0].nstar); 179 } 180 fclose (f); 181 182 /* 164 183 if (FITS_INPUT) { 165 184 Nbytes = fits_matrix_size (&header); … … 170 189 } 171 190 fclose (f); 191 */ 172 192 173 193 /* modify resulting star list */ -
trunk/Ohana/src/addstar/src/image-db.c
r4864 r5014 39 39 fits_init_header (&db[0].header); 40 40 41 /* set the recommended mode */ 41 42 if (!strcmp (CATMODE, "RAW")) { 42 43 /* make header a fake image */ … … 46 47 db[0].header.Naxis[1] = 1; 47 48 fits_create_header (&db[0].header); 49 db[0].mode = DVO_MODE_RAW; 48 50 } 49 51 50 52 if (!strcmp (CATMODE, "MEF") || !strcmp (CATMODE, "SPLIT")) { 53 db[0].header.extend = TRUE; 51 54 fits_create_header (&db[0].header); 55 db[0].mode = DVO_MODE_MEF; 56 } 57 58 /* set the recommended format */ 59 db[0].format = DVO_FORMAT_UNDEF; 60 if (!strcmp (CATFORMAT, "INTERNAL")) db[0].format = DVO_FORMAT_INTERNAL; 61 if (!strcmp (CATFORMAT, "LONEOS")) db[0].format = DVO_FORMAT_LONEOS; 62 if (!strcmp (CATFORMAT, "ELIXIR")) db[0].format = DVO_FORMAT_ELIXIR; 63 if (!strcmp (CATFORMAT, "PANSTARRS")) db[0].format = DVO_FORMAT_PANSTARRS; 64 if (db[0].format == DVO_FORMAT_UNDEF) { 65 fprintf (stderr, "invalid output catalog format\n"); 66 exit (1); 52 67 } 53 68 … … 58 73 fits_modify (&db[0].header, "ZERO_PT", "%lf", 1, ZeroPt); 59 74 fits_modify (&db[0].header, "NIMAGES", "%d", 1, 0); 75 76 if (db[0].format == DVO_FORMAT_INTERNAL) fits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL"); 77 if (db[0].format == DVO_FORMAT_LONEOS) fits_modify (&db[0].header, "FORMAT", "%s", 1, "LONEOS"); 78 if (db[0].format == DVO_FORMAT_ELIXIR) fits_modify (&db[0].header, "FORMAT", "%s", 1, "ELIXIR"); 79 if (db[0].format == DVO_FORMAT_PANSTARRS) fits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS"); 60 80 } 61 -
trunk/Ohana/src/addstar/src/mkcatalog.c
r4826 r5014 8 8 if (VERBOSE) fprintf (stderr, "new catalog file: %s\n", region[0].filename); 9 9 10 /* set the recommended CATFORMAT */ 11 catalog[0].catformat = DVO_FORMAT_UNDEF; 12 if (!strcmp (CATFORMAT, "INTERNAL")) catalog[0].catformat = DVO_FORMAT_INTERNAL; 13 if (!strcmp (CATFORMAT, "LONEOS")) catalog[0].catformat = DVO_FORMAT_LONEOS; 14 if (!strcmp (CATFORMAT, "ELIXIR")) catalog[0].catformat = DVO_FORMAT_ELIXIR; 15 if (!strcmp (CATFORMAT, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS; 16 if (catalog[0].catformat == DVO_FORMAT_UNDEF) { 17 fprintf (stderr, "invalid output catalog format\n"); 18 exit (1); 19 } 20 21 /* set the recommended CATMODE */ 22 catalog[0].catmode = DVO_MODE_RAW; 23 if (!strcmp (CATMODE, "RAW")) catalog[0].catmode = DVO_MODE_RAW; 24 if (!strcmp (CATMODE, "MEF")) catalog[0].catmode = DVO_MODE_MEF; 25 10 26 fits_init_header (&catalog[0].header); 27 28 if (catalog[0].catmode == DVO_MODE_RAW) { 29 /* make header a fake image */ 30 catalog[0].header.bitpix = 16; 31 catalog[0].header.Naxes = 2; 32 catalog[0].header.Naxis[0] = 1; 33 catalog[0].header.Naxis[1] = 1; 34 } 35 11 36 fits_create_header (&catalog[0].header); 12 37 … … 34 59 ALLOCATE (catalog[0].secfilt, SecFilt, 1); 35 60 catalog[0].Nsecfilt = GetPhotcodeNsecfilt (); 36 37 /* set catalog mode (raw, mef, etc) - no autodetect for CATMODE yet */38 strcpy (catalog[0].catmode, CATMODE);39 40 /* set catalog format (elixir, loneos, etc) */41 if (!strcmp (CATFORMAT, "INTERNAL")) {42 sprintf (catalog[0].average_format, "DVO_AVERAGE");43 sprintf (catalog[0].measure_format, "DVO_MEASURE");44 } else {45 sprintf (catalog[0].average_format, "DVO_AVERAGE_%s", CATFORMAT);46 sprintf (catalog[0].measure_format, "DVO_MEASURE_%s", CATFORMAT);47 }48 61 } -
trunk/Ohana/src/addstar/src/wcatalog.c
r4826 r5014 3 3 void wcatalog (Catalog *catalog) { 4 4 5 /* set catalog format (elixir, loneos, etc) */ 6 if (!strcmp (CATFORMAT, "INTERNAL")) { 7 sprintf (catalog[0].average_format, "DVO_AVERAGE"); 8 sprintf (catalog[0].measure_format, "DVO_MEASURE"); 9 } else { 10 sprintf (catalog[0].average_format, "DVO_AVERAGE_%s", CATFORMAT); 11 sprintf (catalog[0].measure_format, "DVO_MEASURE_%s", CATFORMAT); 12 } 5 /* output CATMODE and CATFORMAT are set by mkcatalog 6 or by mode and format of existing data */ 13 7 14 8 if (!save_catalog (catalog, VERBOSE)) {
Note:
See TracChangeset
for help on using the changeset viewer.
