- Timestamp:
- Dec 18, 2012, 10:04:35 AM (14 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 28 edited
- 2 copied
-
. (modified) (1 prop)
-
src/addstar/src/findskycell.c (modified) (10 diffs)
-
src/addstar/src/sky_tessalation.c (modified) (3 diffs)
-
src/addstar/test/boundarytree.sh (copied) (copied from branches/eam_branches/ipp-20121130/Ohana/src/addstar/test/boundarytree.sh )
-
src/delstar/include/delstar.h (modified) (2 diffs)
-
src/delstar/src/args.c (modified) (3 diffs)
-
src/delstar/src/delete_photcodes.c (modified) (7 diffs)
-
src/delstar/src/delstar.c (modified) (2 diffs)
-
src/delstar/src/delstar_client.c (modified) (1 diff)
-
src/libdvo/include/dvo.h (modified) (3 diffs)
-
src/libdvo/src/BoundaryTree.c (modified) (12 diffs)
-
src/libdvo/src/dbExtractAverages.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog_split.c (modified) (1 diff)
-
src/libdvo/src/dvo_photcode_ops.c (modified) (1 diff)
-
src/libohana/src (modified) (1 prop)
-
src/opihi (modified) (1 prop)
-
src/opihi/cmd.astro (modified) (1 prop)
-
src/opihi/cmd.data (modified) (1 prop)
-
src/opihi/dvo/gimages.c (modified) (1 diff)
-
src/opihi/dvo/gstar.c (modified) (15 diffs)
-
src/opihi/pcontrol/HostOps.c (modified) (1 diff)
-
src/relphot/Makefile (modified) (2 diffs)
-
src/relphot/include/relphot.h (modified) (4 diffs)
-
src/relphot/src/BoundaryTreeOps.c (modified) (1 diff)
-
src/relphot/src/ImageOps.c (modified) (2 diffs)
-
src/relphot/src/StarOps.c (modified) (6 diffs)
-
src/relphot/src/args.c (modified) (1 diff)
-
src/relphot/src/setMrelCatalog.c (copied) (copied from branches/eam_branches/ipp-20121130/Ohana/src/relphot/src/setMrelCatalog.c )
-
src/uniphot/src/initialize_setposangle.c (modified) (1 diff)
-
src/uniphot/src/update_catalog_setposangle.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20121130/Ohana (added) merged: 34818-34822,34825-34827,34830-34831,34835-34837,34841
- Property svn:mergeinfo changed
-
trunk/Ohana/src/addstar/src/findskycell.c
r34291 r34844 15 15 16 16 void usage (void) { 17 fprintf (stderr, "USAGE: findcell -mktree (tree) (catdir) \n");17 fprintf (stderr, "USAGE: findcell -mktree (tree) (catdir) [-nx Nx] [-ny Ny]\n"); 18 18 fprintf (stderr, "USAGE: findcell -tree (tree) (datafile)\n"); 19 19 fprintf (stderr, " (datafile) should contain a list of RA,DEC pairs\n"); … … 24 24 int apply_tree (char *treefile, char *datafile); 25 25 26 float SCALE = 1.0; 27 int NX_SUB = 1; 28 int NY_SUB = 1; 29 26 30 int main (int argc, char **argv) { 27 31 … … 37 41 if (get_argument (argc, argv, "-help")) usage (); 38 42 if (get_argument (argc, argv, "-h")) usage (); 43 44 NX_SUB = NY_SUB = 1; 45 if ((N = get_argument (argc, argv, "-nx"))) { 46 remove_argument (N, &argc, argv); 47 NX_SUB = atof (argv[N]); 48 remove_argument (N, &argc, argv); 49 } 50 if ((N = get_argument (argc, argv, "-ny"))) { 51 remove_argument (N, &argc, argv); 52 NY_SUB = atof (argv[N]); 53 remove_argument (N, &argc, argv); 54 } 55 56 /* pixel scale (arcsec/pixel) */ 57 SCALE = 1.0; 58 if ((N = get_argument (argc, argv, "-scale"))) { 59 remove_argument (N, &argc, argv); 60 SCALE = atof (argv[N]); 61 remove_argument (N, &argc, argv); 62 } 39 63 40 64 /* extra error messages */ … … 109 133 110 134 tree.Nzone = 46; 135 tree.NX_SUB = NX_SUB; 136 tree.NY_SUB = NY_SUB; 137 tree.dPix = SCALE/3600.0; 111 138 112 139 ALLOCATE (tree.Nband, int, tree.Nzone); … … 122 149 ALLOCATE (tree.ra, double *, tree.Nzone); 123 150 ALLOCATE (tree.dec, double *, tree.Nzone); 151 ALLOCATE (tree.Xo, double *, tree.Nzone); 152 ALLOCATE (tree.Yo, double *, tree.Nzone); 153 ALLOCATE (tree.dX, int *, tree.Nzone); 154 ALLOCATE (tree.dY, int *, tree.Nzone); 124 155 ALLOCATE (tree.cell, int *, tree.Nzone); 125 156 ALLOCATE (tree.name, char **, tree.Nzone); … … 152 183 ALLOCATE (tree.ra[zone], double, tree.NBAND[zone]); 153 184 ALLOCATE (tree.dec[zone], double, tree.NBAND[zone]); 185 ALLOCATE (tree.Xo[zone], double, tree.NBAND[zone]); 186 ALLOCATE (tree.Yo[zone], double, tree.NBAND[zone]); 187 ALLOCATE (tree.dX[zone], int, tree.NBAND[zone]); 188 ALLOCATE (tree.dY[zone], int, tree.NBAND[zone]); 154 189 ALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 155 190 ALLOCATE (tree.name[zone], char *, tree.NBAND[zone]); … … 157 192 tree.ra[zone][band] = NAN; 158 193 tree.dec[zone][band] = NAN; 194 tree.Xo[zone][band] = NAN; 195 tree.Yo[zone][band] = NAN; 196 tree.dX[zone][band] = -1; 197 tree.dY[zone][band] = -1; 159 198 tree.cell[zone][band] = -1; 160 199 ALLOCATE (tree.name[zone][band], char, BOUNDARY_TREE_NAME_LENGTH); … … 179 218 REALLOCATE (tree.ra[zone], double, tree.NBAND[zone]); 180 219 REALLOCATE (tree.dec[zone], double, tree.NBAND[zone]); 181 REALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 220 REALLOCATE (tree.Xo[zone], double, tree.NBAND[zone]); 221 REALLOCATE (tree.Yo[zone], double, tree.NBAND[zone]); 222 REALLOCATE (tree.dX[zone], int, tree.NBAND[zone]); 223 REALLOCATE (tree.dY[zone], int, tree.NBAND[zone]); 224 REALLOCATE (tree.cell[zone], int, tree.NBAND[zone]); 182 225 REALLOCATE (tree.name[zone], char *, tree.NBAND[zone]); 183 226 for (j = start; j < tree.NBAND[zone]; j++) { 184 227 tree.ra[zone][j] = NAN; 185 228 tree.dec[zone][j] = NAN; 229 tree.Xo[zone][band] = NAN; 230 tree.Yo[zone][band] = NAN; 231 tree.dX[zone][band] = -1; 232 tree.dY[zone][band] = -1; 186 233 tree.cell[zone][j] = -1; 187 234 ALLOCATE (tree.name[zone][j], char, BOUNDARY_TREE_NAME_LENGTH); … … 190 237 tree.ra[zone][band] = ra; 191 238 tree.dec[zone][band] = dec; 239 tree.Xo[zone][band] = x; 240 tree.Yo[zone][band] = y; 241 tree.dX[zone][band] = image[i].NX / NX_SUB; 242 tree.dY[zone][band] = image[i].NY / NY_SUB; 243 192 244 tree.cell[zone][band] = i; 193 245 … … 325 377 } 326 378 327 fprintf (stdout, "%10.6f %10.6f %3d %3d %s\n", ra, dec, zone, band, tree->name[zone][band]); 379 // I know the projection cell (band,zone), but I need to find the skycell within that projection cell. 380 // the proj cell is divided into Nx, Ny bits. 381 // (ra,dec) for (Ro,Do) -> (x,y). given (Xo,Yo),(dX,dY) I can find ix,iy 382 // I currently track Ro,Do (tree->ra[zone][band], tree->dec[zone][band]) 383 // I need to have the skycell center in pixels (Xo,Yo) and the scale dX,dY 384 385 // convert R,D to X,Y with hard-wired projection and scale, orientation? 386 387 double x = 0.0; 388 double y = 0.0; 389 BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band); 390 391 int xi = x / tree->dX[zone][band]; 392 int yi = y / tree->dY[zone][band]; 393 394 char format[24], skycellname[128]; 395 int Ndigit = (int)(log10(tree->NX_SUB*tree->NY_SUB)) + 1 ; 396 snprintf (format, 24, "%s.%%0%dd", tree->name[zone][band], Ndigit); 397 398 int N = xi + tree->NX_SUB * yi; 399 snprintf (skycellname, 128, format, N); 400 401 fprintf (stdout, "%10.6f %10.6f %8.3f %8.3f %3d %3d %s\n", ra, dec, x, y, zone, band, skycellname); 328 402 } 329 403 330 404 exit (0); 331 405 } 406 -
trunk/Ohana/src/addstar/src/sky_tessalation.c
r34260 r34844 275 275 // convert the SkyRectangles to Images for output 276 276 sky_subdivide_image (&image[j*NX_SUB*NY_SUB], &ring[j], NX_SUB, NY_SUB); 277 printf("%s %8.2f %8.2f\n", ring[j].name, ring[j].coords.crval1, ring[j].coords.crval2);277 // printf("%s %8.2f %8.2f\n", ring[j].name, ring[j].coords.crval1, ring[j].coords.crval2); 278 278 } 279 279 … … 691 691 // fprintf (stdout, "%f %f %f %f %f %f %f %f %f %f %f\n", dec, decUpper, dRA, arg, root1, root2, theta1, theta2, r1, r2, k*r2); 692 692 } 693 fprintf (stdout, "%f %f %f x %f (%d)\n", dec, decUpper, dRA, theta, nRA);693 // fprintf (stdout, "%f %f %f x %f (%d)\n", dec, decUpper, dRA, theta, nRA); 694 694 695 695 // I think we need to return the value of dec for the next ring, but I am not sure... … … 776 776 ring[N].coords.crval2 = (j == 0) ? dec / d2r : -dec / d2r; 777 777 778 printf(" \t %d %25.20f %25.20f\n", i, ring[N].coords.crval2, ring[N].coords.crval1);778 // printf(" \t %d %25.20f %25.20f\n", i, ring[N].coords.crval2, ring[N].coords.crval1); 779 779 780 780 ring[N].coords.pc1_1 = +1.0 * X_PARITY; -
trunk/Ohana/src/delstar/include/delstar.h
r34749 r34844 27 27 double ALPHA; 28 28 int VERBOSE; 29 int VERBOSE2; 29 30 int ORPHAN; 30 31 int MISSED; … … 38 39 int HOST_ID; 39 40 char *HOSTDIR; 41 42 int SKIP_IMAGES; 40 43 41 44 time_t START; -
trunk/Ohana/src/delstar/src/args.c
r34749 r34844 44 44 } 45 45 46 VERBOSE2 = FALSE; 47 if ((N = get_argument (argc, argv, "-vv"))) { 48 VERBOSE = TRUE; 49 VERBOSE2 = TRUE; 50 remove_argument (N, &argc, argv); 51 } 52 46 53 // region of interest 47 54 UserPatch.Rmin = 0; … … 58 65 remove_argument (N, &argc, argv); 59 66 UserPatch.Dmax = atof (argv[N]); 67 remove_argument (N, &argc, argv); 68 } 69 70 SKIP_IMAGES = FALSE; 71 if ((N = get_argument (argc, argv, "-skip-images"))) { 72 SKIP_IMAGES = TRUE; 60 73 remove_argument (N, &argc, argv); 61 74 } … … 205 218 } 206 219 220 VERBOSE2 = FALSE; 221 if ((N = get_argument (argc, argv, "-v"))) { 222 VERBOSE = TRUE; 223 VERBOSE2 = TRUE; 224 remove_argument (N, &argc, argv); 225 } 226 207 227 /* specify portion of the sky */ 208 228 UserPatch.Rmin = 0; -
trunk/Ohana/src/delstar/src/delete_photcodes.c
r34749 r34844 46 46 47 47 // an error exit status here is a significant error 48 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE , "a")) {48 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE2, "a")) { 49 49 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 50 50 exit (2); 51 51 } 52 52 if (!catalog.Naves_disk) { 53 if (VERBOSE ) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);53 if (VERBOSE2) fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 54 54 dvo_catalog_unlock (&catalog); 55 55 dvo_catalog_free (&catalog); … … 58 58 59 59 delete_photcodes_catalog (&catalog, photcodes, Nphotcodes); 60 dvo_catalog_save_complete (&catalog, VERBOSE );60 dvo_catalog_save_complete (&catalog, VERBOSE2); 61 61 dvo_catalog_unlock (&catalog); 62 62 dvo_catalog_free (&catalog); … … 97 97 char tmpline[1024]; 98 98 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 99 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 99 100 100 101 fprintf (stderr, "command: %s\n", command); … … 287 288 FREE(measure); 288 289 FREE(average); 290 FREE(secfilt); 289 291 catalog[0].measure = measureOut; 290 292 catalog[0].average = averageOut; … … 299 301 for (i = 0; i < NaveOut; i++) { 300 302 NmeasureTotal += catalog[0].average[i].Nmeasure; 301 if (VERBOSE && !(NmeasureTotal <= catalog[0].Nmeasure)) {303 if (VERBOSE2 && !(NmeasureTotal <= catalog[0].Nmeasure)) { 302 304 fprintf (stderr, "too few measurements: %d %d %d\n", (int) i, NmeasureTotal, (int) catalog[0].Nmeasure); 303 305 } 304 306 measureOffsetOK &= (catalog[0].average[i].measureOffset < catalog[0].Nmeasure); 305 if (VERBOSE && !(catalog[0].average[i].measureOffset < catalog[0].Nmeasure)) {307 if (VERBOSE2 && !(catalog[0].average[i].measureOffset < catalog[0].Nmeasure)) { 306 308 fprintf (stderr, "offset too large: %d %d %d\n", (int) i, catalog[0].average[i].Nmeasure, (int) catalog[0].Nmeasure); 307 309 } 308 310 measureOffsetOK &= (catalog[0].average[i].measureOffset + catalog[0].average[i].Nmeasure <= catalog[0].Nmeasure); 309 if (VERBOSE && !(catalog[0].average[i].measureOffset + catalog[0].average[i].Nmeasure <= catalog[0].Nmeasure)) {311 if (VERBOSE2 && !(catalog[0].average[i].measureOffset + catalog[0].average[i].Nmeasure <= catalog[0].Nmeasure)) { 310 312 fprintf (stderr, "orrset + Nmeasure too large: %d + %d > %d %d\n", (int) i, catalog[0].average[i].measureOffset, catalog[0].average[i].Nmeasure, (int) catalog[0].Nmeasure); 311 313 } … … 313 315 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) { 314 316 averefOK &= (catalog[0].measure[m+j].averef == i); 315 if (VERBOSE && !(catalog[0].measure[m+j].averef == i)) {317 if (VERBOSE2 && !(catalog[0].measure[m+j].averef == i)) { 316 318 fprintf (stderr, "averef broken: %d vs %d (measure %d)\n", (int) i, catalog[0].measure[m+j].averef, (int) (m+j)); 317 319 } … … 340 342 FREE (measureSeqRaw); 341 343 FREE (measureSeqOut); 344 FREE (measureRefOut); 342 345 FREE (measureAveRaw); 343 346 FREE (averageNmeas); -
trunk/Ohana/src/delstar/src/delstar.c
r34749 r34844 10 10 args (argc, argv); 11 11 12 set_db (&db); 13 status = dvo_image_lock (&db, ImageCat, 60.0, LCK_XCLD); /* XCLD */ 14 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename); 15 if (db.dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db.filename); 16 17 status = dvo_image_load (&db, VERBOSE, FALSE); 18 if (!status) Shutdown ("can't read image catalog %s", db.filename); 12 if (!SKIP_IMAGES) { 13 set_db (&db); 14 status = dvo_image_lock (&db, ImageCat, 60.0, LCK_XCLD); /* XCLD */ 15 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename); 16 if (db.dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db.filename); 17 status = dvo_image_load (&db, VERBOSE, FALSE); 18 if (!status) Shutdown ("can't read image catalog %s", db.filename); 19 } 19 20 20 21 switch (MODE) { … … 29 30 break; 30 31 case MODE_PHOTCODES: { 31 if (!delete_image_photcodes (&db)) exit (1); 32 if (!SKIP_IMAGES) { 33 if (!delete_image_photcodes (&db)) exit (1); 34 } 32 35 33 36 if (!delete_photcodes (0, NULL)) { -
trunk/Ohana/src/delstar/src/delstar_client.c
r34749 r34844 32 32 break; 33 33 case MODE_PHOTCODES: 34 delete_photcodes (HOST_ID, HOSTDIR); 35 break; 34 if (!delete_photcodes (HOST_ID, HOSTDIR)) { 35 fprintf (stderr, "failure deleting measurements from %s\n", HOSTDIR); 36 exit (1); 37 } 38 exit (0); 36 39 case MODE_ORPHAN: 37 40 break; -
trunk/Ohana/src/libdvo/include/dvo.h
r34749 r34844 322 322 int *NBAND; 323 323 324 double **ra; 325 double **dec; 326 int **cell; 327 char ***name; 324 double **ra; // RA of projection cell center 325 double **dec; // DEC of projection cell center 326 int **cell; // zone,band -> proj cell sequence 327 char ***name; // projection cell name 328 329 int NX_SUB; 330 int NY_SUB; 331 double dPix; 332 333 double **Xo; 334 double **Yo; 335 int **dX; 336 int **dY; 328 337 } BoundaryTree; 329 338 … … 496 505 float PhotKronInst (Measure *measure); 497 506 float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt); 507 float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt); 498 508 499 509 float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt); … … 701 711 int BoundaryTreeSave(char *filename, BoundaryTree *tree); 702 712 BoundaryTree *BoundaryTreeLoad(char *filename); 713 int BoundaryTreeProjection (double *x, double *y, double r, double d, BoundaryTree *tree, int zone, int band); 703 714 704 715 void dvo_average_init (Average *average); -
trunk/Ohana/src/libdvo/src/BoundaryTree.c
r34291 r34844 47 47 gfits_scan (&header, "DEC_ORI", "%lf", 1, &tree->DEC_origin); 48 48 gfits_scan (&header, "DEC_OFF", "%lf", 1, &tree->DEC_offset); 49 50 gfits_scan (&header, "NX_SUB", "%d", 1, &tree->NX_SUB); 51 gfits_scan (&header, "NY_SUB", "%d", 1, &tree->NY_SUB); 52 gfits_scan (&header, "PIXSCALE", "%lf", 1, &tree->dPix); 49 53 50 54 ftable.header = &theader; … … 75 79 ALLOCATE (tree->ra, double *, tree->Nzone); 76 80 ALLOCATE (tree->dec, double *, tree->Nzone); 77 ALLOCATE (tree->cell, int *, tree->Nzone); 78 ALLOCATE (tree->name, char **, tree->Nzone); 81 ALLOCATE (tree->Xo, double *, tree->Nzone); 82 ALLOCATE (tree->Yo, double *, tree->Nzone); 83 ALLOCATE (tree->dX, int *, tree->Nzone); 84 ALLOCATE (tree->dY, int *, tree->Nzone); 85 ALLOCATE (tree->cell, int *, tree->Nzone); 86 ALLOCATE (tree->name, char **, tree->Nzone); 79 87 for (i = 0; i < tree->Nzone; i++) { 80 88 ALLOCATE (tree->ra[i], double, tree->Nband[i]); 81 89 ALLOCATE (tree->dec[i], double, tree->Nband[i]); 82 ALLOCATE (tree->cell[i], int, tree->Nband[i]); 90 ALLOCATE (tree->Xo[i], double, tree->Nband[i]); 91 ALLOCATE (tree->Yo[i], double, tree->Nband[i]); 92 ALLOCATE (tree->dX[i], int, tree->Nband[i]); 93 ALLOCATE (tree->dY[i], int, tree->Nband[i]); 94 ALLOCATE (tree->cell[i], int, tree->Nband[i]); 83 95 ALLOCATE (tree->name[i], char *, tree->Nband[i]); 84 96 for (j = 0; j < tree->Nband[i]; j++) { … … 102 114 GET_COLUMN_NEW(band, "BAND", int); 103 115 GET_COLUMN_NEW(index, "INDEX", int); 116 GET_COLUMN_NEW(Xo, "X_CENT", double); 117 GET_COLUMN_NEW(Yo, "Y_CENT", double); 118 GET_COLUMN_NEW(dX, "X_GRID", int); 119 GET_COLUMN_NEW(dY, "Y_GRID", int); 104 120 GET_COLUMN_NEW(name, "NAME", char); // XXX how is this done? 105 121 gfits_free_header (&theader); … … 113 129 tree->ra[nz][nb] = R[i]; 114 130 tree->dec[nz][nb] = D[i]; 131 tree->Xo[nz][nb] = Xo[i]; 132 tree->Yo[nz][nb] = Yo[i]; 133 tree->dX[nz][nb] = dX[i]; 134 tree->dY[nz][nb] = dY[i]; 115 135 tree->cell[nz][nb] = i; // XXX ? 116 136 memcpy(tree->name[nz][nb], &name[i*BOUNDARY_TREE_NAME_LENGTH], BOUNDARY_TREE_NAME_LENGTH); … … 121 141 free (zone ); 122 142 free (band ); 143 free (Xo ); 144 free (Yo ); 145 free (dX ); 146 free (dY ); 123 147 free (index ); 124 148 free (name ); … … 165 189 gfits_modify (&header, "DEC_ORI", "%lf", 1, tree->DEC_origin); 166 190 gfits_modify (&header, "DEC_OFF", "%lf", 1, tree->DEC_offset); 191 192 gfits_modify (&header, "NX_SUB", "%d", 1, tree->NX_SUB); 193 gfits_modify (&header, "NY_SUB", "%d", 1, tree->NY_SUB); 194 gfits_modify (&header, "PIXSCALE", "%lf", 1, tree->dPix); 167 195 168 196 gfits_fwrite_header (f, &header); … … 223 251 gfits_define_bintable_column (&theader, "J", "BAND", "band sequence number", "none", 1.0, 0.0); 224 252 gfits_define_bintable_column (&theader, "J", "INDEX","cell index", "none", 1.0, 0.0); 253 gfits_define_bintable_column (&theader, "D", "X_CENT", "projection cell center pixel", "none", 1.0, 0.0); 254 gfits_define_bintable_column (&theader, "D", "Y_CENT", "projection cell center pixel", "none", 1.0, 0.0); 255 gfits_define_bintable_column (&theader, "J", "X_GRID", "skycell grid spacing", "none", 1.0, 0.0); 256 gfits_define_bintable_column (&theader, "J", "Y_GRID", "skycell grid spacing", "none", 1.0, 0.0); 225 257 gfits_define_bintable_column (&theader, fmt, "NAME", "cell name", "none", 1.0, 0.0); 226 258 … … 240 272 int *band ; ALLOCATE (band, int, Ncell); 241 273 int *index ; ALLOCATE (index, int, Ncell); 274 double *Xo ; ALLOCATE (Xo, double, Ncell); 275 double *Yo ; ALLOCATE (Yo, double, Ncell); 276 int *dX ; ALLOCATE (dX, int, Ncell); 277 int *dY ; ALLOCATE (dY, int, Ncell); 242 278 char *name ; ALLOCATE (name, char, Ncell*BOUNDARY_TREE_NAME_LENGTH); 243 279 … … 251 287 R[i] = tree->ra[nz][nb]; 252 288 D[i] = tree->dec[nz][nb]; 289 Xo[i] = tree->Xo[nz][nb]; 290 Yo[i] = tree->Yo[nz][nb]; 291 dX[i] = tree->dX[nz][nb]; 292 dY[i] = tree->dY[nz][nb]; 253 293 zone[i] = nz; 254 294 band[i] = nb; … … 265 305 gfits_set_bintable_column (&theader, &ftable, "BAND", band, Ncell); 266 306 gfits_set_bintable_column (&theader, &ftable, "INDEX", index, Ncell); 307 gfits_set_bintable_column (&theader, &ftable, "X_CENT", Xo, Ncell); 308 gfits_set_bintable_column (&theader, &ftable, "Y_CENT", Yo, Ncell); 309 gfits_set_bintable_column (&theader, &ftable, "X_GRID", dX, Ncell); 310 gfits_set_bintable_column (&theader, &ftable, "Y_GRID", dY, Ncell); 267 311 gfits_set_bintable_column (&theader, &ftable, "NAME", name, Ncell); 268 312 … … 272 316 free (band ); 273 317 free (index ); 318 free (Xo ); 319 free (Yo ); 320 free (dX ); 321 free (dY ); 274 322 free (name ); 275 323 … … 318 366 } 319 367 368 369 // projection = TAN 370 // need Ro, Do, Xo, Yo, dPix 371 372 int BoundaryTreeProjection (double *x, double *y, double r, double d, BoundaryTree *tree, int zone, int band) { 373 374 double Xo = tree->Xo[zone][band]; 375 double Yo = tree->Yo[zone][band]; 376 double Ro = tree->ra[zone][band]; 377 double Do = tree->dec[zone][band]; 378 double dPix = tree->dPix; 379 380 // this block only depends on Ro, Do 381 382 double sdp = sin(RAD_DEG*Do); 383 double cdp = cos(RAD_DEG*Do); 384 double salp = sin(RAD_DEG*(r - Ro)); 385 double calp = cos(RAD_DEG*(r - Ro)); 386 double sdel = sin(RAD_DEG*d); 387 double cdel = cos(RAD_DEG*d); 388 389 double stht = sdel*sdp + cdel*cdp*calp; /* sin(theta) */ 390 double sphi = cdel*salp; /* = cos(theta)*sin(phi) */ 391 double cphi = cdel*sdp*calp - sdel*cdp; /* = cos(theta)*cos(phi) */ 392 393 // defines the TAN projection (one of zenithal projections available, libdvo/src/coordops.c 394 // R = cot (theta) = cos(theta) / sin(theta) 395 double L, M; 396 if (stht == 0) { 397 double Rc = hypot(sphi, cphi); 398 L = 180.0 * sphi / Rc; 399 M = 180.0 * cphi / Rc; 400 } else { 401 L = +DEG_RAD * sphi / stht; 402 M = -DEG_RAD * cphi / stht; 403 } 404 405 // scale, rotation, parity: 406 // rotation == 0.0 (pc1_1 == pc2_2 == 1.0, pc1_2 = pc2_1 = 0.0) 407 408 // if there were rotation or parity: 409 // Ro = (coords[0].pc1_1*coords[0].pc2_2 - coords[0].pc1_2*coords[0].pc2_1); 410 // Xo = (coords[0].pc2_2*L - coords[0].pc1_2*M) / Ro; 411 // Yo = (coords[0].pc1_1*M - coords[0].pc2_1*L) / Ro; 412 413 double X = L; 414 double Y = M; 415 416 // scale is dPix 417 418 *x = Xo - X / dPix; 419 *y = Yo + Y / dPix; 420 421 return TRUE; 422 } 423 -
trunk/Ohana/src/libdvo/src/dbExtractAverages.c
r34620 r34844 233 233 break; 234 234 235 case MAG_KRON_ERR: 236 value.Flt = PhotKronAveErr (field->photcode, average, secfilt); 237 break; 238 235 239 case MAG_20: 236 240 value.Flt = PhotM20 (field->photcode, average, secfilt); -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r34749 r34844 863 863 first = 0; // first row in memory to write 864 864 start = catalog[0].Nsecf_off; // first disk row to write 865 Nitems = catalog[0].N secf_mem;865 Nitems = catalog[0].Naverage*Nsecfilt; 866 866 Nrows = Nitems - first; 867 867 -
trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c
r34620 r34844 572 572 } 573 573 574 float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt) { 575 576 int Ns; 577 float dMkron; 578 579 if (code == NULL) return NAN; 580 581 Ns = photcodes[0].hashNsec[code[0].code]; 582 dMkron = (Ns == -1) ? NAN : secfilt[Ns].dMkron; 583 return (dMkron); 584 } 585 574 586 float PhotAveFluxPSF (PhotCode *code, Average *average, SecFilt *secfilt) { 575 587 -
trunk/Ohana/src/libohana/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20121130/Ohana/src/libohana/src (added) merged: 34841
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20121130/Ohana/src/opihi (added) merged: 34820,34822,34830,34836,34841
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/cmd.astro
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20121130/Ohana/src/opihi/cmd.astro (added) merged: 34841
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/cmd.data
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20121130/Ohana/src/opihi/cmd.data (added) merged: 34841
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/dvo/gimages.c
r34260 r34844 212 212 status = XY_to_RD (&Rout, &Dout, X, Y, &image[i].coords); 213 213 fprintf (stderr, "r,d = %f,%f\n", Rout, Dout); 214 status = RD_to_XY (&X, &Y, Ra, Dec, &image[i].coords); 215 fprintf (stderr, "x,y = %f,%f\n", X, Y); 214 216 } 215 217 # endif -
trunk/Ohana/src/opihi/dvo/gstar.c
r34405 r34844 1 1 # include "dvoshell.h" 2 3 typedef enum { 4 GSTAR_AVE_MAG, 5 GSTAR_AVE_MAG_ERR, 6 GSTAR_AVE_MAG_CHISQ, 7 GSTAR_FILTER_NAMES, 8 GSTAR_SECF_FLAGS, 9 GSTAR_AVE_AP_MAG, 10 GSTAR_AVE_MAG_20, 11 GSTAR_AVE_MAG_80, 12 GSTAR_AVE_KRON_MAG, 13 GSTAR_AVE_KRON_MAG_ERR, 14 GSTAR_STACK_FLUX_PSF, 15 GSTAR_STACK_FLUX_PSF_ERR, 16 GSTAR_STACK_FLUX_KRON, 17 GSTAR_STACK_FLUX_KRON_ERR, 18 } GSTAR_SECF_CODES; 2 19 3 20 void initPhotcodeSequence (int Nsecfilt); … … 13 30 off_t i, Nstars, *N1; 14 31 off_t j, k, m, N, Nlo, Nhi; 15 int Nsecfilt, NPTS, QUIET, FULL_OUTPUT, INST;32 int Nsecfilt, NPTS, QUIET, FULL_OUTPUT, STACK_OUTPUT, INST; 16 33 int found, GetMeasures; 17 34 int SaveVectors; … … 55 72 if ((N = get_argument (argc, argv, "-full"))) { 56 73 FULL_OUTPUT = TRUE; 74 remove_argument (N, &argc, argv); 75 } 76 77 STACK_OUTPUT = FALSE; 78 if ((N = get_argument (argc, argv, "-stack"))) { 79 STACK_OUTPUT = TRUE; 57 80 remove_argument (N, &argc, argv); 58 81 } … … 216 239 217 240 /* filter names */ 218 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 3);241 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_FILTER_NAMES); 219 242 gprint (GP_LOG, "\n"); 220 243 221 244 /* average mags */ 222 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 0);245 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_MAG); 223 246 gprint (GP_LOG, "\n"); 224 247 225 248 /* average mag errors */ 226 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 1);249 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_MAG_ERR); 227 250 gprint (GP_LOG, "\n"); 228 251 229 252 /* average mag chisq */ 230 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 2);253 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_MAG_CHISQ); 231 254 gprint (GP_LOG, "\n"); 232 255 233 256 if (FULL_OUTPUT) { 234 257 /* Map */ 235 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 5); 258 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_AP_MAG); 259 gprint (GP_LOG, "\n"); 260 261 /* Mkron */ 262 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_KRON_MAG); 263 gprint (GP_LOG, "\n"); 264 265 /* dMkron */ 266 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_KRON_MAG_ERR); 236 267 gprint (GP_LOG, "\n"); 237 268 238 269 /* M_20 */ 239 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 6);270 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_MAG_20); 240 271 gprint (GP_LOG, "\n"); 241 272 242 273 /* M_80 */ 243 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 7);274 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_AVE_MAG_80);; 244 275 gprint (GP_LOG, "\n"); 245 276 246 277 /* secfilt flags */ 247 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, 4); 278 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_SECF_FLAGS); 279 gprint (GP_LOG, "\n"); 280 281 } 282 if (STACK_OUTPUT) { 283 /* FluxPSF */ 284 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_STACK_FLUX_PSF); 285 gprint (GP_LOG, "\n"); 286 287 /* dFluxPSF */ 288 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_STACK_FLUX_PSF_ERR); 289 gprint (GP_LOG, "\n"); 290 291 /* FluxKron */ 292 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_STACK_FLUX_KRON); 293 gprint (GP_LOG, "\n"); 294 295 /* dFluxKron */ 296 for (j = 0; j < Nsecfilt; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsecfilt*k], j, GSTAR_STACK_FLUX_KRON_ERR); 248 297 gprint (GP_LOG, "\n"); 249 298 … … 279 328 gprint (GP_LOG, "%6.3f ", catalog.measure[m].Mcal); 280 329 gprint (GP_LOG, "%6.3f ", catalog.measure[m].Map); 330 gprint (GP_LOG, "%6.3f ", catalog.measure[m].Mkron); 331 gprint (GP_LOG, "%6.3f ", catalog.measure[m].dMkron); 281 332 gprint (GP_LOG, "%5.1f ", pow(10.0, 0.4*catalog.measure[m].dt)); 282 333 gprint (GP_LOG, "%5.3f ", catalog.measure[m].airmass); … … 296 347 gprint (GP_LOG, "%.1f ", catalog.measure[m].extNsigma); 297 348 gprint (GP_LOG, "%.1f ", FromShortDegrees(catalog.measure[m].theta)); 349 } 350 if (STACK_OUTPUT) { 351 gprint (GP_LOG, "%10.3e ", catalog.measure[m].FluxPSF); 352 gprint (GP_LOG, "%10.3e ", catalog.measure[m].dFluxPSF); 353 gprint (GP_LOG, "%10.3e ", catalog.measure[m].FluxKron); 354 gprint (GP_LOG, "%10.3e ", catalog.measure[m].dFluxKron); 298 355 } 299 356 gprint (GP_LOG, "\n"); … … 351 408 } 352 409 410 void print_double_exp (double value) { 411 if (isnan(value)) 412 gprint (GP_LOG, " NaN "); 413 else 414 gprint (GP_LOG, "%10.3e ", value); 415 } 416 353 417 void print_short (double value, short int ival) { 354 418 if (ival == NAN_S_SHORT) … … 386 450 } 387 451 388 389 452 void printPhotcodeSequence (Average *average, SecFilt *secfilt, int entry, int type) { 390 453 … … 395 458 396 459 switch (type) { 397 case 0: /* average mags */460 case GSTAR_AVE_MAG: /* average mags */ 398 461 if (seq == -1) { 399 462 print_double (NAN); … … 403 466 break; 404 467 405 case 1: /* average mags errors */468 case GSTAR_AVE_MAG_ERR: /* average mags errors */ 406 469 if (seq == -1) { 407 470 print_double (NAN); … … 411 474 break; 412 475 413 case 2: /* average mag chisq */476 case GSTAR_AVE_MAG_CHISQ: /* average mag chisq */ 414 477 if (seq == -1) { 415 478 print_short (NAN_S_SHORT, NAN_S_SHORT); … … 419 482 break; 420 483 421 case 3: /* filter names */484 case GSTAR_FILTER_NAMES: /* filter names */ 422 485 code = GetPhotcodebyNsec (seq); 423 486 gprint (GP_LOG, " %-6s ", code[0].name); 424 487 break; 425 488 426 case 4: /* secfilt flags */489 case GSTAR_SECF_FLAGS: /* secfilt flags */ 427 490 if (seq == -1) { 428 491 gprint (GP_LOG, "%08x ", 0); … … 432 495 break; 433 496 434 case 5: /* average ap mags */497 case GSTAR_AVE_AP_MAG: /* average ap mags */ 435 498 if (seq == -1) { 436 499 print_double (NAN); … … 440 503 break; 441 504 442 case 6: /* average ap mags */505 case GSTAR_AVE_MAG_20: /* average ap mags */ 443 506 if (seq == -1) { 444 507 print_double (NAN); … … 448 511 break; 449 512 450 case 7: /* average ap mags */ 451 if (seq == -1) { 452 print_double (NAN); 453 } else { 454 print_short (0.001*secfilt[seq].M_20, secfilt[seq].M_80); 455 } 456 break; 457 458 } 459 } 513 case GSTAR_AVE_MAG_80: /* average ap mags */ 514 if (seq == -1) { 515 print_double (NAN); 516 } else { 517 print_short (0.001*secfilt[seq].M_80, secfilt[seq].M_80); 518 } 519 break; 520 521 case GSTAR_AVE_KRON_MAG: /* average ap mags */ 522 if (seq == -1) { 523 print_double (NAN); 524 } else { 525 print_double (secfilt[seq].Mkron); 526 } 527 break; 528 529 case GSTAR_AVE_KRON_MAG_ERR: /* average ap mags */ 530 if (seq == -1) { 531 print_double (NAN); 532 } else { 533 print_double (secfilt[seq].dMkron); 534 } 535 break; 536 537 case GSTAR_STACK_FLUX_PSF: /* average ap mags */ 538 if (seq == -1) { 539 print_double (NAN); 540 } else { 541 print_double_exp (secfilt[seq].FluxPSF); 542 } 543 break; 544 545 case GSTAR_STACK_FLUX_PSF_ERR: /* average ap mags */ 546 if (seq == -1) { 547 print_double (NAN); 548 } else { 549 print_double_exp (secfilt[seq].dFluxPSF); 550 } 551 break; 552 553 case GSTAR_STACK_FLUX_KRON: /* average ap mags */ 554 if (seq == -1) { 555 print_double (NAN); 556 } else { 557 print_double_exp (secfilt[seq].FluxKron); 558 } 559 break; 560 561 case GSTAR_STACK_FLUX_KRON_ERR: /* average ap mags */ 562 if (seq == -1) { 563 print_double (NAN); 564 } else { 565 print_double_exp (secfilt[seq].dFluxKron); 566 } 567 break; 568 569 } 570 } -
trunk/Ohana/src/opihi/pcontrol/HostOps.c
r26411 r34844 232 232 FreeIOBuffer (&host[0].comms_buffer); 233 233 FREE (host[0].hostname); 234 FREE (host[0].job);235 234 FREE (host); 236 235 } -
trunk/Ohana/src/relphot/Makefile
r34260 r34844 49 49 $(SRC)/setExclusions.$(ARCH).o \ 50 50 $(SRC)/setMrelFinal.$(ARCH).o \ 51 $(SRC)/setMrelCatalog.$(ARCH).o \ 51 52 $(SRC)/BoundaryTreeOps.$(ARCH).o \ 52 53 $(SRC)/write_coords.$(ARCH).o … … 78 79 $(SRC)/setExclusions.$(ARCH).o \ 79 80 $(SRC)/setMrelFinal.$(ARCH).o \ 81 $(SRC)/setMrelCatalog.$(ARCH).o \ 80 82 $(SRC)/BoundaryTreeOps.$(ARCH).o \ 81 83 $(SRC)/write_coords.$(ARCH).o -
trunk/Ohana/src/relphot/include/relphot.h
r34642 r34844 63 63 64 64 typedef struct { 65 int Nfew; 66 int Ncode; 67 int Nsys; 68 int Nbad; 69 int Ncal; 70 int Nmos; 71 int Ngrid; 72 73 // NOTE: the following arrays are (possibly) pre-allocated and carried down to each 74 // thread. The first 3 (list, dlist, wlist) are used in all relphot analyses; the 75 // others are only used on the final output steps. 76 77 double *list; // list of measure.mag values for a given star 78 double *dlist; // mag errors for a star 79 double *wlist; // weights to use for mean mags 80 double *aplist; // ap mags for a star 81 double *kronlist; // kron mags for a star 82 double *dkronlist; // kron mag errors 83 84 double *psfqf_list; // psfqf for all filters 85 double *psfqfperf_list; // psfqfperf for all filters 86 double *stargal_list; // stargal for all filters 87 88 StatType stats; 89 StatType apstats; 90 StatType kronstats; 91 } SetMrelInfo; 92 93 typedef struct { 65 94 AverageTiny *average; // array of (minimal) average data 66 95 MeasureTiny *measure; // array of (minimal) measure data … … 113 142 114 143 char *BOUNDARY_TREE; 144 145 int SET_MREL_VERSION; 115 146 116 147 double MAG_LIM; … … 239 270 Coords *getCoords PROTO((off_t meas, int cat)); 240 271 off_t getImageEntry PROTO((off_t meas, int cat)); 272 273 float getMcal_alt PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, float Xccd, float Yccd)); 241 274 float getMcal PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog)); 242 275 float getMflat PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog)); … … 348 381 int load_tree (char *treefile); 349 382 int BoundaryTreePrimaryCell (char *primaryCellName, double ra, double dec); 383 384 int print_measure_set_alt (Average *average, SecFilt *secfilt, Measure *measure); 385 int setMrel_catalog_alt (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt); 386 int setMrelAverageExposure (off_t meas, int cat, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, AverageTiny *averageT, SecFilt *secfilt, Measure *measure, MeasureTiny *measureT, off_t *found); 387 int setMrelAverageStack (off_t meas, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, char *primaryCell); 388 int setGlobalObjStats (Average *average, Measure *measure); 389 390 void SetMrelInfoInit (SetMrelInfo *results, int allocLists); -
trunk/Ohana/src/relphot/src/BoundaryTreeOps.c
r34260 r34844 21 21 } 22 22 23 # define USE_PROJECTION_CELL 0 24 # if (USE_PROJECTION_CELL) 23 25 snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s", tree->name[zone][band]); 26 # else 27 28 // I have ra, dec, and the primary projection cell. In order to choose the primary skycell, 29 // I just need to project to ra,dec to X,Y based on the center of the cell and then get the subdivision right. 30 31 double x = 0.0; 32 double y = 0.0; 33 BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band); 34 35 int xi = x / tree->dX[zone][band]; 36 int yi = y / tree->dY[zone][band]; 37 int N = xi + tree->NX_SUB * yi; 38 39 // XXX short-circuit this for now (we should use this code if we make tree have more variable NX,NY values 40 // char format[24], skycellname[128]; 41 // int Ndigit = (int)(log10(tree->NX_SUB*tree->NY_SUB)) + 1 ; 42 // snprintf (format, 24, "%s.%%0%dd", tree->name[zone][band], Ndigit); 43 // snprintf (skycellname, 128, format, N); 44 45 snprintf (primaryCellName, DVO_MAX_PATH, "RINGS.V3.%s.%03d", tree->name[zone][band], N); 46 # endif 47 24 48 return TRUE; 25 49 } -
trunk/Ohana/src/relphot/src/ImageOps.c
r34260 r34844 352 352 353 353 // returns image.Mcal - ff(x,y) 354 float getMcal_alt (off_t meas, int cat, FlatCorrectionTable *flatcorr, float Xccd, float Yccd) { 355 356 off_t i; 357 float value, offset; 358 359 i = MeasureToImage[cat][meas]; 360 if (i == -1) return (NAN); 361 362 if (image[i].flags & IMAGE_BAD) return (NAN); 363 value = image[i].Mcal; 364 offset = 0.0; 365 366 // to do this, I need to pass in the catalog and flatcorr pointers 367 int flat_id = image[i].photom_map_id; 368 if (flat_id) { 369 offset = FlatCorrectionOffset (flatcorr, flat_id, Xccd, Yccd); 370 } 371 value -= offset; 372 373 return (value); 374 } 375 376 // returns image.Mcal - ff(x,y) 354 377 short getUbercalDist (off_t meas, int cat) { 355 378 … … 400 423 if (i == -1) return FALSE; 401 424 402 // this is a bit crude: stack image names are of the form 403 // RINGS.V3.skycell.1495.027.sky.191211.stk.988232.cmf 404 // the primaryCell has a name of the form RINGS.V3.skycell.1495 425 // this is a bit crude: stack image names are of the form: 426 // RINGS.V3.skycell.1495.027.sky.191211.stk.988232.cmf. 427 428 // the primaryCell has a name of the form RINGS.V3.skycell.1495 or RINGS.V3.skycell.1495.027 429 // (if we use projection or skycell as the primary) 405 430 406 431 if (!strncmp(image[i].name, name, strlen(name))) return TRUE; -
trunk/Ohana/src/relphot/src/StarOps.c
r34749 r34844 2 2 3 3 static int Nmax; 4 5 typedef struct {6 int Nfew;7 int Ncode;8 int Nsys;9 int Nbad;10 int Ncal;11 int Nmos;12 int Ngrid;13 14 // NOTE: the following arrays are (possibly) pre-allocated and carried down to each15 // thread. The first 3 (list, dlist, wlist) are used in all relphot analyses; the16 // others are only used on the final output steps.17 18 double *list; // list of measure.mag values for a given star19 double *dlist; // mag errors for a star20 double *wlist; // weights to use for mean mags21 double *aplist; // ap mags for a star22 double *kronlist; // kron mags for a star23 double *dkronlist; // kron mag errors24 25 double *psfqf_list; // psfqf for all filters26 double *psfqfperf_list; // psfqfperf for all filters27 double *stargal_list; // stargal for all filters28 } SetMrelInfo;29 4 30 5 enum {THREAD_RUN, THREAD_DONE}; … … 154 129 for (i = 0; i < Ncatalog; i++) { 155 130 // pass == -1 for anything other than the final pass 156 setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt); 131 switch (SET_MREL_VERSION) { 132 case 0: 133 setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt); 134 break; 135 case 1: 136 setMrel_catalog_alt (catalog, i, -1, flatcorr, &results, Nsecfilt); 137 break; 138 default: 139 fprintf (stderr, "invalid setMrel version %d (use 0 or 1)\n", SET_MREL_VERSION); 140 exit (2); 141 } 157 142 SetMrelInfoAccum (&summary, &results); 158 143 } … … 182 167 183 168 for (i = 0; i < Ncatalog; i++) { 184 setMrel_catalog (catalog, i, pass, flatcorr, &results, Nsecfilt); // XXX add arguments as needed for options 169 switch (SET_MREL_VERSION) { 170 case 0: 171 setMrel_catalog (catalog, i, pass, flatcorr, &results, Nsecfilt); 172 break; 173 case 1: 174 setMrel_catalog_alt (catalog, i, pass, flatcorr, &results, Nsecfilt); 175 break; 176 default: 177 fprintf (stderr, "invalid setMrel version %d (use 0 or 1)\n", SET_MREL_VERSION); 178 exit (2); 179 } 185 180 SetMrelInfoAccum (&summary, &results); 186 181 } … … 286 281 287 282 // pass == -1 for anything other than the final pass 288 setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt); 283 switch (SET_MREL_VERSION) { 284 case 0: 285 setMrel_catalog (catalog, i, -1, flatcorr, &results, Nsecfilt); 286 break; 287 case 1: 288 setMrel_catalog_alt (catalog, i, -1, flatcorr, &results, Nsecfilt); 289 break; 290 default: 291 fprintf (stderr, "invalid setMrel version %d (use 0 or 1)\n", SET_MREL_VERSION); 292 exit (2); 293 } 289 294 SetMrelInfoAccum (&threadinfo->summary, &results); 290 295 } … … 332 337 liststats_setmode (&kronstats, STATMODE); 333 338 334 // StatType psfstats;335 // liststats_setmode (&psfstats, "MEAN");336 337 339 double *list = results->list; 338 340 double *dlist = results->dlist; … … 363 365 364 366 if (isSetMrelFinal) { 367 // set the name of the primary skycell (this is used in a strcmp to match the skycells in stack detections) 365 368 BoundaryTreePrimaryCell(primaryCell, catalog[Nc].average[j].R, catalog[Nc].average[j].D); 366 369 } -
trunk/Ohana/src/relphot/src/args.c
r34642 r34844 64 64 } 65 65 66 SET_MREL_VERSION = 1; 67 if ((N = get_argument (argc, argv, "-set-mrel-version"))) { 68 remove_argument (N, &argc, argv); 69 SET_MREL_VERSION = atof(argv[N]); 70 remove_argument (N, &argc, argv); 71 } 72 66 73 VERBOSE = VERBOSE2 = FALSE; 67 74 if ((N = get_argument (argc, argv, "-v"))) { -
trunk/Ohana/src/uniphot/src/initialize_setposangle.c
r34749 r34844 6 6 fprintf (stderr, " -v : verbose mode\n"); 7 7 fprintf (stderr, " -update : actually write results to detections tables\n"); 8 fprintf (stderr, " -parallel : run in parallel mode\n"); 9 fprintf (stderr, " -h : this help list\n"); 10 fprintf (stderr, " -help : this help list\n"); 11 fprintf (stderr, " --h : this help list\n"); 12 fprintf (stderr, " --help : this help list\n"); 8 13 fprintf (stderr, " Note that the dvo db can be specified by -D CATDIR (directory)\n"); 9 14 exit (2); -
trunk/Ohana/src/uniphot/src/update_catalog_setposangle.c
r34749 r34844 25 25 Mosaic *mosaic = getMosaicForImage(seq); 26 26 Coords *coords = &image[seq].coords; 27 Coords *mosaicCoords = mosaic ? &mosaic->coords : NULL; 27 28 28 29 double Xccd = catalog[0].measure[m].Xccd; 29 30 double Yccd = catalog[0].measure[m].Yccd; 30 31 31 setposangle_local_astrometry (&posAngle, &pltScale, Xccd, Yccd, &mosaic->coords, coords);32 setposangle_local_astrometry (&posAngle, &pltScale, Xccd, Yccd, mosaicCoords, coords); 32 33 33 34 catalog[0].measure[m].posangle = ToShortDegrees(posAngle); … … 52 53 // calculate the astrometry for the coordinate of interest 53 54 XY_to_LM (&Lx, &Mx, x, y, coords); 54 XY_to_LM (&Po, &Qo, Lx, Mx, mosaic); 55 if (mosaic) { 56 XY_to_LM (&Po, &Qo, Lx, Mx, mosaic); 57 } else { 58 Po = Lx; 59 Qo = Mx; 60 } 55 61 56 62 XY_to_LM (&Lx, &Mx, x + 1.0, y, coords); 57 XY_to_LM (&Px, &Qx, Lx, Mx, mosaic); 63 if (mosaic) { 64 XY_to_LM (&Px, &Qx, Lx, Mx, mosaic); 65 } else { 66 Px = Lx; 67 Qx = Mx; 68 } 58 69 59 70 XY_to_LM (&Lx, &Mx, x, y + 1.0, coords); 60 XY_to_LM (&Py, &Qy, Lx, Mx, mosaic); 71 if (mosaic) { 72 XY_to_LM (&Py, &Qy, Lx, Mx, mosaic); 73 } else { 74 Py = Lx; 75 Qy = Mx; 76 } 61 77 62 78 // XXX units for the resulting Tangent Plane coordinates??
Note:
See TracChangeset
for help on using the changeset viewer.
