Changeset 34844 for trunk/Ohana/src/libdvo
- Timestamp:
- Dec 18, 2012, 10:04:35 AM (14 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 6 edited
-
. (modified) (1 prop)
-
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)
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/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
Note:
See TracChangeset
for help on using the changeset viewer.
