Changeset 6872 for trunk/psModules/src/astrom
- Timestamp:
- Apr 17, 2006, 8:01:05 AM (20 years ago)
- Location:
- trunk/psModules/src/astrom
- Files:
-
- 42 added
- 5 edited
-
Makefile.am (modified) (1 diff)
-
pmAstrometry.c (modified) (22 diffs)
-
pmAstrometry.h (modified) (14 diffs)
-
pmAstrometryObjects.c (modified) (3 diffs)
-
pmAstrometryObjects.h (modified) (27 diffs)
-
pmChipMosaic.c (added)
-
pmChipMosaic.h (added)
-
pmConcepts.c (added)
-
pmConcepts.h (added)
-
pmConceptsRead.c (added)
-
pmConceptsRead.h (added)
-
pmConceptsStandard.c (added)
-
pmConceptsStandard.h (added)
-
pmConceptsWrite.c (added)
-
pmConceptsWrite.h (added)
-
pmFPA.c (added)
-
pmFPA.h (added)
-
pmFPAAstrometry.c (added)
-
pmFPAAstrometry.h (added)
-
pmFPAConceptsGet.c (added)
-
pmFPAConceptsGet.h (added)
-
pmFPAConceptsSet.c (added)
-
pmFPAConceptsSet.h (added)
-
pmFPAConstruct.c (added)
-
pmFPAConstruct.h (added)
-
pmFPACopy.c (added)
-
pmFPACopy.h (added)
-
pmFPAMaskWeight.c (added)
-
pmFPAMaskWeight.h (added)
-
pmFPARead.c (added)
-
pmFPARead.h (added)
-
pmFPAUtils.c (added)
-
pmFPAUtils.h (added)
-
pmFPAWrite.c (added)
-
pmFPAWrite.h (added)
-
pmFPA_JPEG.c (added)
-
pmFPA_JPEG.h (added)
-
pmFPAfile.c (added)
-
pmFPAfile.h (added)
-
pmFPAview.c (added)
-
pmFPAview.h (added)
-
pmHDU.c (added)
-
pmHDU.h (added)
-
pmHDUUtils.c (added)
-
pmHDUUtils.h (added)
-
pmReadout.c (added)
-
pmReadout.h (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/Makefile.am
r6301 r6872 1 1 noinst_LTLIBRARIES = libpsmoduleastrom.la 2 2 3 libpsmoduleastrom_la_CPPFLAGS = $(SRCINC) $(PSMODULE_CFLAGS) 3 libpsmoduleastrom_la_CPPFLAGS = $(SRCINC) $(PSMODULE_CFLAGS) -I../pslib/ 4 4 libpsmoduleastrom_la_LDFLAGS = -release $(PACKAGE_VERSION) 5 5 libpsmoduleastrom_la_SOURCES = \ 6 pmAstrometry.c \ 7 pmAstrometryObjects.c 6 pmFPA.c \ 7 pmFPAConstruct.c \ 8 pmFPACopy.c \ 9 pmFPAMaskWeight.c \ 10 pmFPARead.c \ 11 pmFPAUtils.c \ 12 pmFPAWrite.c \ 13 pmHDU.c \ 14 pmHDUUtils.c \ 15 pmReadout.c \ 16 pmConcepts.c \ 17 pmConceptsRead.c \ 18 pmConceptsWrite.c \ 19 pmConceptsStandard.c \ 20 pmFPA_JPEG.c \ 21 pmFPAview.c \ 22 pmFPAfile.c 23 24 # pmFPAAstrometry.c 25 # pmAstrometryObjects.c 26 # pmChipMosaic.c 8 27 9 28 psmoduleincludedir = $(includedir) 10 29 psmoduleinclude_HEADERS = \ 11 pmAstrometry.h \ 12 pmAstrometryObjects.h 30 pmFPA.h \ 31 pmFPAConstruct.h \ 32 pmFPACopy.h \ 33 pmFPAMaskWeight.h \ 34 pmFPARead.h \ 35 pmFPAUtils.h \ 36 pmFPAWrite.h \ 37 pmHDU.h \ 38 pmHDUUtils.h \ 39 pmReadout.h \ 40 pmConcepts.h \ 41 pmConceptsRead.h \ 42 pmConceptsWrite.h \ 43 pmConceptsStandard.h \ 44 pmFPA_JPEG.h \ 45 pmFPAview.h \ 46 pmFPAfile.h 47 48 # pmFPAAstrometry.h 49 # pmAstrometryObjects.h 50 # pmChipMosaic.h -
trunk/psModules/src/astrom/pmAstrometry.c
r6205 r6872 10 10 * XXX: We should review the extent of the warning messages on these functions 11 11 * when the transformations are not successful. 12 * 12 * 13 13 * XXX: Should we implement non-linear cell->chip transforms? 14 * 15 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $16 * @date $Date: 2006-0 1-26 21:10:50$14 * 15 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2006-04-17 18:01:04 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include <math.h> 26 26 #include "pslib.h" 27 27 28 #include "pmAstrometry.h" 29 #include "pmConcepts.h" 28 30 29 31 /***************************************************************************** … … 60 62 psFree(readout->mask); 61 63 psFree(readout->weight); 62 //63 // XXX: Not sure if this is the right way to do things. Currently the psListAdd()64 // increase the memory reference counter to the list data. So, we65 // iterate through the list, and decrement the reference counters.66 //67 if (1) {68 if ((readout->bias != NULL) && (readout->bias->head != NULL)) {69 psListElem *tmpElem = (psListElem *) readout->bias->head;70 while (NULL != tmpElem) {71 psMemDecrRefCounter((psImage *) tmpElem->data);72 tmpElem = tmpElem->next;73 }74 }75 }76 psFree(readout->bias);77 64 psFree(readout->analysis); 65 #if 0 66 78 67 psFree(readout->parent); 68 #endif 69 70 readout->parent = NULL; 79 71 } 80 72 } … … 88 80 psFree(cell->concepts); 89 81 psFree(cell->analysis); 82 psFree(cell->camera); 90 83 // 91 84 // Set the parent to NULL in all cell->readouts before psFree(cell->readouts) 92 85 // in order to avoid memory reference counter problems. 93 86 // 87 #if 0 88 94 89 for (psS32 i = 0 ; i < cell->readouts->n ; i++) { 95 90 pmReadout *tmpReadout = (pmReadout *) cell->readouts->data[i]; … … 99 94 } 100 95 } 96 psFree(cell->parent); 97 #endif 98 99 cell->parent = NULL; 100 101 101 psFree(cell->readouts); 102 psFree(cell->parent);103 102 psFree(cell->hdu); 103 104 104 } 105 105 } … … 116 116 // in order to avoid memory reference counter problems. 117 117 // 118 #if 0 119 118 120 for (psS32 i = 0 ; i < chip->cells->n ; i++) { 119 121 pmCell *tmpCell = (pmCell *) chip->cells->data[i]; … … 123 125 } 124 126 } 127 psFree(chip->parent); 128 #endif 129 130 chip->parent = NULL; 125 131 psFree(chip->cells); 126 psFree(chip->parent);127 132 psFree(chip->hdu); 128 133 } … … 143 148 // in order to avoid memory reference counter problems. 144 149 // 150 #if 0 151 145 152 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 146 153 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; … … 150 157 } 151 158 } 159 #endif 152 160 psFree(fpa->chips); 153 161 psFree(fpa->hdu); … … 156 164 } 157 165 166 void p_pmHDUFree(p_pmHDU *hdu) 167 { 168 if (hdu) { 169 psFree(hdu->extname); 170 psFree(hdu->header); 171 psFree(hdu->images); 172 psFree(hdu->masks); 173 psFree(hdu->weights); 174 } 175 } 176 158 177 // XXX: Verify these default values for row0, col0, rowBins, colBins 178 // PAP: These values may disappear in the future in favour of values in parent->concepts? 159 179 pmReadout *pmReadoutAlloc(pmCell *cell) 160 180 { 161 181 pmReadout *tmpReadout = (pmReadout *) psAlloc(sizeof(pmReadout)); 162 182 163 tmpReadout->col0 = -1;164 tmpReadout->row0 = -1;165 tmpReadout->colBins = -1;166 tmpReadout->rowBins = -1;183 tmpReadout->col0 = 0; 184 tmpReadout->row0 = 0; 185 tmpReadout->colBins = 0; 186 tmpReadout->rowBins = 0; 167 187 tmpReadout->image = NULL; 168 188 tmpReadout->mask = NULL; 169 189 tmpReadout->weight = NULL; 170 tmpReadout->bias = NULL;171 190 tmpReadout->analysis = psMetadataAlloc(); 172 191 tmpReadout->parent = cell; … … 179 198 180 199 // XXX: Verify these default values for row0, col0. 200 // PAP: These values may disappear in the future in favour of values in the "concepts"? 181 201 pmCell *pmCellAlloc( 182 202 pmChip *chip, 183 psMetadata *camera data,184 psStringname)203 psMetadata *cameraData, 204 const char *name) 185 205 { 186 206 pmCell *tmpCell = (pmCell *) psAlloc(sizeof(pmCell)); 187 207 188 tmpCell->col0 = -1;189 tmpCell->row0 = -1;208 tmpCell->col0 = 0; 209 tmpCell->row0 = 0; 190 210 tmpCell->toChip = NULL; 191 211 tmpCell->toFPA = NULL; … … 196 216 psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not add CELL.NAME to metadata.\n"); 197 217 } 198 tmpCell->camera = cameradata;199 tmpCell->analysis = NULL;218 tmpCell->camera = psMemIncrRefCounter(cameraData); 219 tmpCell->analysis = psMetadataAlloc(); 200 220 tmpCell->readouts = psArrayAlloc(0); 201 221 tmpCell->parent = chip; … … 203 223 chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell); 204 224 } 205 tmpCell->valid = false; 225 tmpCell->process = true; // All cells are processed by default 226 tmpCell->exists = false; // Not yet read in 206 227 tmpCell->hdu = NULL; 228 229 pmConceptsBlankCell(tmpCell); 207 230 208 231 psMemSetDeallocator(tmpCell, (psFreeFunc) cellFree); … … 211 234 212 235 // XXX: Verify these default values for row0, col0. 236 // PAP: row0, col0 may disappear in the future in favour of storing values in the "concepts". 213 237 pmChip *pmChipAlloc( 214 238 pmFPA *fpa, 215 psStringname)239 const char *name) 216 240 { 217 241 pmChip *tmpChip = (pmChip *) psAlloc(sizeof(pmChip)); 218 242 219 tmpChip->col0 = -1;220 tmpChip->row0 = -1;243 tmpChip->col0 = 0; 244 tmpChip->row0 = 0; 221 245 tmpChip->toFPA = NULL; 222 246 tmpChip->fromFPA = NULL; … … 226 250 psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not add CHIP.NAME to metadata.\n"); 227 251 } 228 tmpChip->analysis = NULL;252 tmpChip->analysis = psMetadataAlloc(); 229 253 tmpChip->cells = psArrayAlloc(0); 230 254 tmpChip->parent = fpa; … … 232 256 fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip); 233 257 } 234 tmpChip->valid = false; 258 tmpChip->process = true; // Work on all chips, by default 259 tmpChip->exists = false; // Not read in yet 235 260 tmpChip->hdu = NULL; 261 262 pmConceptsBlankChip(tmpChip); 236 263 237 264 psMemSetDeallocator(tmpChip, (psFreeFunc) chipFree); … … 248 275 tmpFPA->concepts = psMetadataAlloc(); 249 276 tmpFPA->analysis = NULL; 250 tmpFPA->camera = camera;277 tmpFPA->camera = psMemIncrRefCounter((psPtr)camera); 251 278 tmpFPA->chips = psArrayAlloc(0); 252 279 tmpFPA->hdu = NULL; 253 280 tmpFPA->phu = NULL; 254 281 282 pmConceptsBlankFPA(tmpFPA); 283 255 284 psMemSetDeallocator(tmpFPA, (psFreeFunc) FPAFree); 256 285 return(tmpFPA); 286 } 287 288 p_pmHDU *p_pmHDUAlloc(const char *extname) 289 { 290 p_pmHDU *hdu = psAlloc(sizeof(p_pmHDU)); 291 psMemSetDeallocator(hdu, (psFreeFunc)p_pmHDUFree); 292 293 hdu->extname = psStringCopy(extname); 294 hdu->header = NULL; 295 hdu->images = NULL; 296 hdu->masks = NULL; 297 hdu->weights = NULL; 298 299 return hdu; 257 300 } 258 301 … … 317 360 318 361 319 /*****************************************************************************/320 /* FUNCTION IMPLEMENTATION - PUBLIC */321 /*****************************************************************************/322 323 pmCell* pmCellInFPA(324 const psPlane* fpaCoord,325 const pmFPA* FPA)326 {327 PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);328 PS_ASSERT_PTR_NON_NULL(FPA, NULL);329 330 pmChip* tmpChip = NULL;331 psPlane chipCoord;332 pmCell* outCell = NULL;333 334 // Determine which chip contains the fpaCoords.335 tmpChip = pmChipInFPA(fpaCoord, FPA);336 if (tmpChip == NULL) {337 return(NULL);338 }339 340 // Convert to those chip coordinates.341 psPlane *rc = pmCoordFPAToChip(&chipCoord, fpaCoord, tmpChip);342 if (rc == NULL) {343 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine Chip coords.\n");344 return(NULL);345 }346 347 // Determine which cell contains those chip coordinates.348 outCell = pmCellInChip(&chipCoord, tmpChip);349 if (outCell == NULL) {350 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the cell.\n");351 return(NULL);352 }353 354 return (outCell);355 }356 357 pmChip* pmChipInFPA(358 const psPlane* fpaCoord,359 const pmFPA* FPA)360 {361 PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);362 PS_ASSERT_PTR_NON_NULL(FPA, NULL);363 PS_ASSERT_PTR_NON_NULL(FPA->chips, NULL);364 365 psArray* chips = FPA->chips;366 psS32 nChips = chips->n;367 psPlane chipCoord;368 pmCell *tmpCell = NULL;369 370 //371 // Loop through every chip in this FPA. Convert the original FPA372 // coordinates to chip coordinates for that chip. Then, determine if any373 // cells in that chip contain those chip coordinates.374 // XXX: Depending on the number of chips, and their topology, there may be375 // a much more efficient way of doing this.376 //377 for (psS32 i = 0; i < nChips; i++) {378 pmChip* tmpChip = chips->data[i];379 PS_ASSERT_PTR_NON_NULL(tmpChip, NULL);380 PS_ASSERT_PTR_NON_NULL(tmpChip->fromFPA, NULL);381 382 psPlaneTransformApply(&chipCoord, tmpChip->fromFPA, fpaCoord);383 384 tmpCell = pmCellInChip(&chipCoord, tmpChip);385 if (tmpCell != NULL) {386 return(tmpChip);387 }388 }389 390 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the chip.\n");391 return (NULL);392 }393 394 395 pmCell* pmCellInChip(396 const psPlane* chipCoord,397 const pmChip* chip)398 {399 PS_ASSERT_PTR_NON_NULL(chipCoord, NULL);400 PS_ASSERT_PTR_NON_NULL(chip, NULL);401 402 psPlane cellCoord;403 psArray* cells;404 405 cells = chip->cells;406 if (cells == NULL) {407 return NULL;408 }409 410 //411 // We loop over each cell in the chip. We transform the chipCoord into412 // a cellCoord for that cell and determine if that cellCoord is valid.413 // If so, then we return that cell.414 // XXX: Depending on the number of cells, and their topology, there may be415 // a much more efficient way of doing this.416 //417 for (psS32 i = 0; i < cells->n; i++) {418 pmCell* tmpCell = (pmCell* ) cells->data[i];419 PS_ASSERT_PTR_NON_NULL(tmpCell, NULL);420 421 psPlaneTransform *chipToCell = NULL;422 if (true == p_psIsProjectionLinear(tmpCell->toChip)) {423 chipToCell = p_psPlaneTransformLinearInvert(tmpCell->toChip);424 } else {425 psLogMsg(__func__, PS_LOG_WARN, "WARNING: non-linear cell->chip transforms are not yet implemented.\n");426 //chipToCell = psPlaneTransformInvert(NULL, tmpCell->toChip, NULL, -1);427 chipToCell = NULL;428 }429 if (chipToCell == NULL) {430 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not invert the Cell->toChip transform.\n");431 return(NULL);432 }433 psArray* readouts = tmpCell->readouts;434 435 if (readouts != NULL) {436 for (psS32 j = 0; j < readouts->n; j++) {437 pmReadout* tmpReadout = readouts->data[j];438 PS_ASSERT_READOUT_NON_NULL(tmpReadout, NULL);439 440 psPlaneTransformApply(&cellCoord,441 chipToCell,442 chipCoord);443 444 if (checkValidImageCoords(cellCoord.x,445 cellCoord.y,446 tmpReadout->image)) {447 psFree(chipToCell);448 return (tmpCell);449 }450 }451 }452 psFree(chipToCell);453 }454 455 //psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the cell.\n");456 return (NULL);457 }458 459 460 psPlane* pmCoordCellToFPA(461 psPlane* fpaCoord,462 const psPlane* cellCoord,463 const pmCell* cell)464 {465 PS_ASSERT_PTR_NON_NULL(cellCoord, NULL);466 PS_ASSERT_PTR_NON_NULL(cell, NULL);467 468 psPlane *rc = psPlaneTransformApply(fpaCoord, cell->toFPA, cellCoord);469 if (rc == NULL) {470 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform cell coords to FPA coords.\n");471 }472 return(rc);473 }474 475 476 psPlane* pmCoordChipToFPA(477 psPlane* outCoord,478 const psPlane* inCoord,479 const pmChip* chip)480 {481 PS_ASSERT_PTR_NON_NULL(inCoord, NULL);482 PS_ASSERT_PTR_NON_NULL(chip, NULL);483 484 psPlane *rc = psPlaneTransformApply(outCoord, chip->toFPA, inCoord);485 if (rc == NULL) {486 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform chip coords to FPA coords.\n");487 }488 return(rc);489 }490 491 492 psPlane* pmCoordFPAToChip(493 psPlane* chipCoord,494 const psPlane* fpaCoord,495 const pmChip* chip)496 {497 PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);498 PS_ASSERT_PTR_NON_NULL(chip, NULL);499 PS_ASSERT_PTR_NON_NULL(chip->fromFPA, NULL);500 501 psPlane *rc = psPlaneTransformApply(chipCoord, chip->fromFPA, fpaCoord);502 if (rc == NULL) {503 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform FPA coords to Chip coords.\n");504 }505 return(rc);506 }507 508 psPlane* pmCoordCellToChip(509 psPlane* outCoord,510 const psPlane* inCoord,511 const pmCell* cell)512 {513 PS_ASSERT_PTR_NON_NULL(inCoord, NULL);514 PS_ASSERT_PTR_NON_NULL(cell, NULL);515 516 psPlane *rc = psPlaneTransformApply(outCoord, cell->toChip, inCoord);517 if (rc == NULL) {518 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform Cell coords to Chip coords.\n");519 }520 return(rc);521 }522 523 psPlane* pmCoordChipToCell(524 psPlane* cellCoord,525 const psPlane* chipCoord,526 const pmCell* cell)527 {528 PS_ASSERT_PTR_NON_NULL(chipCoord, NULL);529 PS_ASSERT_PTR_NON_NULL(cell, NULL);530 PS_ASSERT_PTR_NON_NULL(cell->parent, NULL);531 532 pmCell *tmpCell = pmCellInChip(chipCoord, cell->parent);533 if (tmpCell == NULL) {534 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the proper cell.\n");535 return(NULL);536 }537 538 psPlaneTransform *tmpChipToCell = NULL;539 PS_ASSERT_PTR_NON_NULL(tmpCell->toChip, NULL);540 if (true == p_psIsProjectionLinear(tmpCell->toChip)) {541 tmpChipToCell = p_psPlaneTransformLinearInvert(tmpCell->toChip);542 } else {543 psLogMsg(__func__, PS_LOG_WARN, "WARNING: non-linear cell->chip transforms are not yet implemented.\n");544 // XXX: tmpChipToCell = psPlaneTransformInvert(NULL, tmpCell->toChip, NULL, -1);545 tmpChipToCell = NULL;546 }547 if (tmpChipToCell == NULL) {548 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not invert the Cell->toChip transform.\n");549 return(NULL);550 }551 552 psPlane *rc = psPlaneTransformApply(cellCoord, tmpChipToCell, chipCoord);553 if (rc == NULL) {554 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform Chip coords to Cell coords.\n");555 }556 psFree(tmpChipToCell);557 return(rc);558 }559 560 psPlane* pmCoordFPAToTP(561 psPlane* outCoord,562 const psPlane* inCoord,563 double color,564 double magnitude,565 const pmFPA* fpa)566 {567 PS_ASSERT_PTR_NON_NULL(inCoord, NULL);568 PS_ASSERT_PTR_NON_NULL(fpa, NULL);569 570 psPlane *rc = psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord, color, magnitude);571 if (rc == NULL) {572 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform FPA coords to tangent plane coords.\n");573 }574 return(rc);575 }576 577 psPlane* pmCoordTPToFPA(578 psPlane* fpaCoord,579 const psPlane* tpCoord,580 double color,581 double magnitude,582 const pmFPA* fpa)583 {584 PS_ASSERT_PTR_NON_NULL(tpCoord, NULL);585 PS_ASSERT_PTR_NON_NULL(fpa, NULL);586 PS_ASSERT_PTR_NON_NULL(fpa->fromTangentPlane, NULL);587 588 psPlane *rc = psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane, tpCoord, color, magnitude);589 if (rc == NULL) {590 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform tangent plane coords to FPA coords.\n");591 }592 return(rc);593 }594 595 596 /*****************************************************************************597 XXXDeproject(outSphere, coord, projection): This private routine is a wrapper598 for p_psDeproject(). The reason: p_psDeproject() and p_psProject() combined599 do not seem to produce the original coordinates when they even though they600 should. XXXDeproject() simply negates the ->r and ->d members of the output601 psSphere if the input ->y is larger than 0.0. I don't know why it works.602 603 I'm guessing the p_psProject() and p_psDeproject() functions have bugs.604 605 XXX: It appears that p_psProject() and p_psDeproject() have been fixed.606 Remove this.607 *****************************************************************************/608 psSphere* XXXDeproject(609 psSphere *outSphere,610 const psPlane* coord,611 const psProjection* projection)612 {613 psSphere *rc = p_psDeproject(outSphere, coord, projection);614 615 if (coord->y >= 0.0) {616 rc->d = -rc->d;617 rc->r = -rc->r;618 }619 620 return(rc);621 }622 623 /*****************************************************************************624 *****************************************************************************/625 psSphere* pmCoordTPToSky(626 psSphere* outSphere,627 const psPlane* tpCoord,628 const psProjection *projection)629 {630 PS_ASSERT_PTR_NON_NULL(tpCoord, NULL);631 PS_ASSERT_PTR_NON_NULL(projection, NULL);632 633 // psSphere *rc = XXXDeproject(outSphere, tpCoord, projection);634 psSphere *rc = p_psDeproject(outSphere, tpCoord, projection);635 if (rc == NULL) {636 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform tangent plane coords to sky coords.\n");637 }638 return(rc);639 }640 641 362 /***************************************************************************** 642 363 *****************************************************************************/ 643 psPlane* pmCoordSkyToTP( 644 psPlane* tpCoord, 645 const psSphere* in, 646 const psProjection *projection) 647 { 648 PS_ASSERT_PTR_NON_NULL(in, NULL); 649 PS_ASSERT_PTR_NON_NULL(projection, NULL); 650 651 psPlane *rc = p_psProject(tpCoord, in, projection); 652 if (rc == NULL) { 653 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform sky to tangent plane coords.\n"); 654 } 655 return(rc); 656 } 657 658 /***************************************************************************** 659 *****************************************************************************/ 660 psSphere* pmCoordCellToSky( 661 psSphere* skyCoord, 662 const psPlane* cellCoord, 663 double color, 664 double magnitude, 665 const pmCell* cell) 666 { 667 PS_ASSERT_PTR_NON_NULL(cellCoord, NULL); 668 PS_ASSERT_PTR_NON_NULL(cell, NULL); 669 PS_ASSERT_PTR_NON_NULL(cell->toFPA, NULL); 670 PS_ASSERT_PTR_NON_NULL(cell->parent, NULL); 671 PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL); 672 PS_ASSERT_PTR_NON_NULL(cell->parent->parent->toTangentPlane, NULL); 673 PS_ASSERT_PTR_NON_NULL(cell->parent->parent->projection, NULL); 674 psPlane fpaCoord; 675 psPlane tpCoord; 676 psPlane *rc; 677 pmFPA* parFPA = (cell->parent)->parent; 678 679 // Convert the input cell coordinates to FPA coordinates. 680 rc = psPlaneTransformApply(&fpaCoord, cell->toFPA, cellCoord); 681 if (rc == NULL) { 682 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could transform cell coords to FPA coords.\n"); 683 return(NULL); 684 } 685 686 // Convert the FPA coordinates to tangent plane Coordinates. 687 rc = psPlaneDistortApply(&tpCoord, parFPA->toTangentPlane, &fpaCoord, color, magnitude); 688 if (rc == NULL) { 689 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could transform FPA coords to tangent plane coords.\n"); 690 return(NULL); 691 } 692 693 // Convert the tangent plane Coordinates to sky coordinates. 694 psSphere *rc2 = pmCoordTPToSky(skyCoord, &tpCoord, parFPA->projection); 695 if (rc2 == NULL) { 696 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform cell coords to sky coords.\n"); 697 } 698 699 return(rc2); 700 } 701 702 /***************************************************************************** 703 *****************************************************************************/ 704 psPlane* pmCoordSkyToCell( 705 psPlane* cellCoord, 706 const psSphere* skyCoord, 707 float color, 708 float magnitude, 709 const pmCell* cell) 710 { 711 PS_ASSERT_PTR_NON_NULL(skyCoord, NULL); 712 PS_ASSERT_PTR_NON_NULL(cell, NULL); 713 PS_ASSERT_PTR_NON_NULL(cell->parent, NULL); 714 PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL); 715 pmChip *parChip = cell->parent; 716 pmFPA *parFPA = parChip->parent; 717 psPlane tpCoord; 718 psPlane fpaCoord; 719 psPlane chipCoord; 720 psPlane *rc; 721 722 // Convert the skyCoords to tangent plane coords. 723 rc = pmCoordSkyToTP(&tpCoord, skyCoord, parFPA->projection); 724 if (rc == NULL) { 725 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine tangent plane coords.\n"); 726 return(NULL); 727 } 728 729 // Convert the tangent plane coords to FPA coords. 730 rc = pmCoordTPToFPA(&fpaCoord, &tpCoord, color, magnitude, parFPA); 731 if (rc == NULL) { 732 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine FPA coords.\n"); 733 return(NULL); 734 } 735 736 // Convert the FPA coords to chip coords. 737 rc = pmCoordFPAToChip(&chipCoord, &fpaCoord, parChip); 738 if (rc == NULL) { 739 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine chip coords.\n"); 740 return(NULL); 741 } 742 743 // Convert the chip coords to cell coords. 744 rc = pmCoordChipToCell(cellCoord, &chipCoord, cell); 745 if (rc == NULL) { 746 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine cell coords.\n"); 747 return(NULL); 748 } 749 750 return (cellCoord); 751 } 752 753 /***************************************************************************** 754 *****************************************************************************/ 755 psSphere* pmCoordCellToSkyQuick( 756 psSphere* outSphere, 757 const psPlane* cellCoord, 758 const pmCell* cell) 759 { 760 PS_ASSERT_PTR_NON_NULL(cellCoord, NULL); 761 PS_ASSERT_PTR_NON_NULL(cell, NULL); 762 PS_ASSERT_PTR_NON_NULL(cell->toSky, NULL); 763 psPlane outPlane; 764 psPlane *rc; 765 rc = psPlaneTransformApply(&outPlane, cell->toSky, cellCoord); 766 if (rc == NULL) { 767 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could transform cell coords to sky coords.\n"); 768 return(NULL); 769 } 770 771 psSphere *out = outSphere; 772 if (out == NULL) { 773 out = psSphereAlloc(); 774 } 775 out->r = outPlane.y; 776 out->d = outPlane.x; 777 778 return(out); 779 } 780 781 /***************************************************************************** 782 *****************************************************************************/ 783 psPlane* pmCoordSkyToCellQuick( 784 psPlane* cellCoord, 785 const psSphere* skyCoord, 786 const pmCell* cell) 787 { 788 PS_ASSERT_PTR_NON_NULL(skyCoord, NULL); 789 PS_ASSERT_PTR_NON_NULL(cell, NULL); 790 PS_ASSERT_PTR_NON_NULL(cell->toSky, NULL); 791 psPlane skyPlane; 792 skyPlane.y = skyCoord->r; 793 skyPlane.x = skyCoord->d; 794 795 psPlane *rc = psPlaneTransformApply(cellCoord, cell->toSky, &skyPlane); 796 if (rc == NULL) { 797 psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform sky to cell coords.\n"); 798 } 799 return(cellCoord); 364 365 // Set cells within a chip to be processed or not 366 static bool setCellsProcess(const pmChip *chip, // Chip of interest 367 bool process // Process this chip? 368 ) 369 { 370 PS_ASSERT_PTR_NON_NULL(chip, false); 371 372 psArray *cells = chip->cells; // Component cells 373 if (! cells) { 374 return false; 375 } 376 for (int i = 0; i < cells->n; i++) { 377 pmCell *tmpCell = cells->data[i]; // Cell of interest 378 if (tmpCell) { 379 tmpCell->process = process; 380 } 381 } 382 383 return true; 800 384 } 801 385 … … 807 391 { 808 392 PS_ASSERT_PTR_NON_NULL(fpa, false); 809 if ((fpa->chips == NULL) || (chipNum >= fpa->chips->n)) { 393 394 psArray *chips = fpa->chips; // Component chips 395 if ((chips == NULL) || (chipNum >= chips->n)) { 810 396 return(false); 811 397 } 812 psBool rc = true; 813 814 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 815 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; 398 399 for (int i = 0 ; i < chips->n ; i++) { 400 pmChip *tmpChip = (pmChip *) chips->data[i]; 816 401 if (tmpChip == NULL) { 817 rc = false; 402 continue; 403 } 404 if (i == chipNum) { 405 tmpChip->process = true; 406 setCellsProcess(tmpChip, true); 818 407 } else { 819 if (i == chipNum) { 820 tmpChip->valid = true; 821 } else { 822 tmpChip->valid = false; 823 } 824 } 825 } 826 827 return(rc); 408 tmpChip->process = false; 409 setCellsProcess(tmpChip, false); 410 } 411 412 } 413 414 return true; 828 415 } 829 416 … … 831 418 /***************************************************************************** 832 419 XXX: The SDRS is ambiguous on a few things: 833 Whether or not the other chips should be set valid=true.834 Should we return the number of chip valid=true before or after they're set,420 Whether or not the other chips should be set process=true. [PAP: No] 421 Should we return the number of chip process=true before or after they're set, [PAP: After] 835 422 *****************************************************************************/ 836 423 /** 837 * 838 * pmFPAExcludeChip shall set validto false only for the specified chip424 * 425 * pmFPAExcludeChip shall set process to false only for the specified chip 839 426 * number (chipNum). In the event that the specified chip number does not exist 840 427 * within the fpa, the function shall generate a warning, and perform no action. 841 * The function shall return the number of chips within the fpa that have valid428 * The function shall return the number of chips within the fpa that have process 842 429 * set to true. 843 * 430 * 844 431 */ 845 432 int pmFPAExcludeChip( … … 849 436 PS_ASSERT_PTR_NON_NULL(fpa, false); 850 437 851 if (fpa->chips == NULL) { 438 psArray *chips = fpa->chips; // Component chips 439 if (chips == NULL) { 852 440 psLogMsg(__func__, PS_LOG_WARN, "WARNING: fpa->chips == NULL\n"); 853 441 return(0); 854 442 } 855 if ((chipNum >= fpa->chips->n) || (NULL == (pmChip *) fpa->chips->data[chipNum])) {443 if ((chipNum >= chips->n) || (NULL == (pmChip *) chips->data[chipNum])) { 856 444 psLogMsg(__func__, PS_LOG_WARN, "WARNING: the specified chip (%d) does not exist.\n", chipNum); 857 445 return(0); 858 446 } 859 447 860 psS32 numChips = 0;861 for ( psS32 i = 0 ; i < fpa->chips->n ; i++) {862 pmChip *tmpChip = (pmChip *) fpa->chips->data[i];448 int numChips = 0; // Number of chips to be processed 449 for (int i = 0 ; i < chips->n ; i++) { 450 pmChip *tmpChip = (pmChip *) chips->data[i]; // Chip of interest 863 451 if (tmpChip != NULL) { 864 452 if (i == chipNum) { 865 tmpChip-> valid= false;866 } else {867 tmpChip->valid = true;453 tmpChip->process = false; 454 setCellsProcess(tmpChip, false); // Wipe out the cell as well 455 } else if (tmpChip->process) { 868 456 numChips++; 869 457 } … … 874 462 } 875 463 464 465 bool pmCellSetWeights(pmCell *cell // Cell for which to set weights 466 ) 467 { 468 float gain = psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); // Cell gain 469 float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE"); // Cell read noise 470 psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC"); // Trim section 471 472 p_pmHDU *hdu = cell->hdu; // The data unit, containing the weight and mask originals 473 if (!hdu) { 474 pmChip *chip = cell->parent; // The parent chip 475 if (chip->hdu) { 476 hdu = chip->hdu; 477 } else { 478 pmFPA *fpa = chip->parent; // The parent FPA 479 hdu = fpa->hdu; 480 if (!hdu) { 481 psError(PS_ERR_UNKNOWN, true, "Unable to find the HDU in the hierarchy!\n"); 482 return false; 483 } 484 } 485 } 486 487 psArray *pixels = hdu->images; // Array of images 488 psArray *weights = hdu->weights; // Array of weight images 489 psArray *masks = hdu->masks; // Array of mask images 490 // Generate the weights and masks if required 491 if (! weights) { 492 weights = psArrayAlloc(pixels->n); 493 for (int i = 0; i < pixels->n; i++) { 494 psImage *image = pixels->data[i]; 495 weights->data[i] = psImageAlloc(image->numCols, image->numRows, PS_TYPE_F32); 496 psImageInit(weights->data[i], 0.0); 497 } 498 hdu->weights = weights; 499 } 500 if (! masks) { 501 masks = psArrayAlloc(pixels->n); 502 for (int i = 0; i < pixels->n; i++) { 503 psImage *image = pixels->data[i]; 504 masks->data[i] = psImageAlloc(image->numCols, image->numRows, PS_TYPE_U8); 505 psImageInit(masks->data[i], 0); 506 } 507 hdu->masks = masks; 508 } 509 510 // Set the pixels 511 psArray *readouts = cell->readouts; // Array of readouts 512 for (int i = 0; i < readouts->n; i++) { 513 pmReadout *readout = readouts->data[i]; // The readout of interest 514 515 if (! readout->weight) { 516 readout->weight = weights->data[i]; 517 } 518 if (! readout->mask) { 519 readout->mask = masks->data[i]; 520 } 521 522 // Mask is already set to 0 523 524 // Set weight image to the variance = g*f + rn^2 525 psImage *image = psImageSubset(readout->image, *trimsec); // The pixels 526 psImage *weight = psImageSubset(readout->weight, *trimsec); // The weight map 527 psBinaryOp(weight, image, "*", psScalarAlloc(gain, PS_TYPE_F32)); 528 psBinaryOp(weight, weight, "+", psScalarAlloc(readnoise*readnoise, PS_TYPE_F32)); 529 } 530 531 return true; 532 } 533 534 -
trunk/psModules/src/astrom/pmAstrometry.h
r6205 r6872 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-0 1-26 21:10:50$10 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-04-17 18:01:04 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 30 30 { 31 31 const char *extname; // Extension name, if it corresponds to this level 32 psArray *pixels; // The pixel data, if it corresponds to this level33 32 psMetadata *header; // The FITS header, if it corresponds to this level 33 psArray *images; // The pixel data, if it corresponds to this level 34 psArray *masks; // The mask data, if it corresponds to this level 35 psArray *weights; // The weight data, if it corresponds to this level 34 36 } 35 37 p_pmHDU; 36 38 37 p_pmHDU *pmHDUAlloc();38 void *pmHDUFree(p_pmHDU *hdu);39 40 39 /** Focal plane data structure 41 * 40 * 42 41 * A focal plane consists of one or more chips (according to the number of 43 42 * pieces of contiguous silicon). It contains metadata containers for the … … 52 51 * transformation which will be derived from numerically inverting the forward 53 52 * transformation. 54 * 53 * 55 54 */ 56 55 typedef struct … … 71 70 72 71 /** Chip data structure 73 * 72 * 74 73 * A chip consists of one or more cells (according to the number of amplifiers 75 74 * on the device). The chip contains metadata containers for the concepts and … … 82 81 * inverting the forward transformation. A boolean indicates whether the chip is 83 82 * of interest, allowing it to be excluded from analysis. 84 * 83 * 85 84 */ 86 85 typedef struct … … 97 96 psArray *cells; ///< The cells (referred to by name) 98 97 pmFPA *parent; ///< Parent FPA 99 bool valid; ///< Do we bother about reading and working with this chip? 98 bool process; ///< Do we bother about reading and working with this chip? 99 bool exists; ///< Does the chip exist --- has it been read in? 100 100 p_pmHDU *hdu; ///< FITS data 101 101 } … … 126 126 psArray *readouts; ///< The readouts (referred to by number) 127 127 pmChip *parent; ///< Parent chip 128 bool valid; ///< Do we bother about reading and working with this cell? 128 bool process; ///< Do we bother about reading and working with this cell? 129 bool exists; ///< Does the cell exist --- has it been read in? 129 130 p_pmHDU *hdu; ///< FITS data 130 131 } … … 144 145 { 145 146 // Position on the cell 147 // XXX: These may be removed in the future; use parent->concepts instead? 146 148 int col0; ///< Offset from the left of chip. 147 149 int row0; ///< Offset from the bottom of chip. … … 152 154 psImage *mask; ///< Mask of input image 153 155 psImage *weight; ///< Weight of input image 154 psList *bias; ///< List of bias section (sub-)images155 156 psMetadata *analysis; ///< Readout-level analysis metadata 156 157 pmCell *parent; ///< Parent cell … … 183 184 */ 184 185 pmCell *pmCellAlloc( 185 pmChip *chip, ///< Parent chip186 psMetadata *camera data,187 psString name186 pmChip *chip, ///< Parent chip 187 psMetadata *cameraData, ///< Camera data 188 const char *name ///< Name of cell 188 189 ); 189 190 190 191 /** Allocates a pmChip 191 * 192 * 192 193 * The constructor shall make an empty pmChip. If the parent fpa is not NULL, 193 194 * the parent link is made and the chip shall be placed in the parent's array … … 199 200 */ 200 201 pmChip *pmChipAlloc( 201 pmFPA *fpa, 202 psString name 203 202 pmFPA *fpa, ///< FPA to which the chip belongs 203 const char *name ///< Name of chip 204 204 ); 205 205 206 206 /** Allocates a pmFPA 207 * 207 * 208 208 * The constructor shall make an empty pmFPA. The chips array shall be 209 209 * allocated with a zero size, the camera and db pointers set to the values 210 210 * provided, and the concepts metadata constructed. All other pointers in the 211 211 * structure shall be initialized to NULL. 212 * 212 * 213 213 */ 214 214 pmFPA *pmFPAAlloc( … … 216 216 ); 217 217 218 /** Allocates a p_pmHDU 219 * 220 * XXX: More detailed description 221 * 222 * @return p_pmHDU* newly allocated p_pmHDU 223 */ 224 p_pmHDU *p_pmHDUAlloc(const char *extname // Extension name 225 ); 226 218 227 219 228 /** Verify parent links. 220 * 229 * 221 230 * This function checks the validity of the parent links in the FPA hierarchy. 222 231 * If a parent link is not set (or not set correctly), it is corrected, and the 223 232 * function shall return false. If all the parent pointers were correct, the 224 233 * function shall return true. 225 * 234 * 226 235 */ 227 236 bool pmFPACheckParents( … … 232 241 233 242 /** FUNC DESC 234 * 235 * 236 * 237 * 238 */ 239 243 * 244 * 245 * 246 * 247 */ 248 249 250 251 /** 252 * 253 * pmFPASelectChip shall set valid to true for the specified chip number 254 * (chipNum), and all other chips shall have valid set to false. In the event 255 * that the specified chip number does not exist within the fpa, the function 256 * shall return false. 257 * 258 */ 259 bool pmFPASelectChip( 260 pmFPA *fpa, 261 int chipNum 262 ); 263 264 /** 265 * 266 * pmFPAExcludeChip shall set valid to false only for the specified chip 267 * number (chipNum). In the event that the specified chip number does not exist 268 * within the fpa, the function shall generate a warning, and perform no action. 269 * The function shall return the number of chips within the fpa that have valid 270 * set to true. 271 * 272 */ 273 int pmFPAExcludeChip( 274 pmFPA *fpa, 275 int chipNum 276 ); 240 277 241 278 … … 426 463 ); 427 464 428 /**429 *430 * pmFPASelectChip shall set valid to true for the specified chip number431 * (chipNum), and all other chips shall have valid set to false. In the event432 * that the specified chip number does not exist within the fpa, the function433 * shall return false.434 *435 */436 bool pmFPASelectChip(437 pmFPA *fpa,438 int chipNum439 );440 441 442 /**443 *444 * pmFPAExcludeChip shall set valid to false only for the specified chip445 * number (chipNum). In the event that the specified chip number does not exist446 * within the fpa, the function shall generate a warning, and perform no action.447 * The function shall return the number of chips within the fpa that have valid448 * set to true.449 *450 */451 int pmFPAExcludeChip(452 pmFPA *fpa,453 int chipNum454 );455 456 457 /**458 *459 * pmFPAConstruct shall construct a focal plane hierarchy from a camera460 * configuration. A db handle is also provided so that may be set in the pmFPA.461 * The resultant pmFPA and its lower-down components shall be ready for to read a462 * FITS file into it by setting the extname pointers at the appropriate levels to463 * the appropriate FITS extension name.464 *465 */466 pmFPA *pmFPAConstruct(467 const psMetadata *camera,468 psDB *db469 );470 471 465 472 466 #endif // #ifndef PS_ASTROMETRY_H -
trunk/psModules/src/astrom/pmAstrometryObjects.c
r6511 r6872 8 8 * @author EAM, IfA 9 9 * 10 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-0 3-04 01:01:33$10 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-04-17 18:01:04 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include <math.h> 21 21 #include "pslib.h" 22 #include "pm Astrometry.h"22 #include "pmFPA.h" 23 23 #include "pmAstrometryObjects.h" 24 24 … … 540 540 psArray *rot; 541 541 542 pmAstromStats minStat, newStat; 542 pmAstromStats minStat; 543 pmAstromStats newStat = {{0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0}; 543 544 psPlane center; 544 545 -
trunk/psModules/src/astrom/pmAstrometryObjects.h
r6205 r6872 8 8 * @author EAM, IfA 9 9 * 10 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2006-0 1-26 21:10:50$10 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-04-17 18:01:04 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 21 21 # include <unistd.h> // for unlink 22 22 # include <pslib.h> 23 # include <pm Astrometry.h>24 25 /* 26 * 23 # include <pmFPA.h> 24 25 /* 26 * 27 27 * This structure specifies the coordinate of the detection in each of the 28 28 * four necessary coordinate frames: pix defines the position in the psReadout … … 35 35 * coordinates, while the reference detections will be projected to the other 36 36 * frames from the sky coordinates. 37 * 37 * 38 38 * XXX: There are more members here than in the SDRS. 39 * 39 * 40 40 */ 41 41 typedef struct … … 55 55 56 56 /* 57 * 57 * 58 58 * The pmAstromMatch structure defines the cross-correlation between two 59 59 * arrays. A single such data item specifies that item number pmAstromMatch.idx1 60 60 * in the first list corresponds to pmAstromMatch.idx2 in the second list. 61 * 61 * 62 62 */ 63 63 typedef struct … … 70 70 71 71 /* 72 * 72 * 73 73 * XXX: Not in SDRS. 74 * 74 * 75 75 */ 76 76 typedef struct … … 88 88 89 89 /* 90 * 90 * 91 91 * If the two sets of coordinates are expected to agree very well (ie, the 92 92 * current best-guess astrometric solution is quite close to the radius. The … … 97 97 * ASTROM.MATCH.RADIUS). The output consists an array of pmAstromMatch values, 98 98 * defined below. 99 * 99 * 100 100 */ 101 101 psArray *pmAstromRadiusMatch( … … 108 108 109 109 /* 110 * 110 * 111 111 * This function accepts an array of pmAstromObj objects and rotates them by 112 112 * the given angle about the given center coordinate pCenter,qCenter in the Focal 113 113 * Plane Array coordinates. 114 * 114 * 115 115 * XXX: This differs from the SDRS 116 * 116 * 117 117 */ 118 118 /* SDRS … … 132 132 133 133 /* 134 * 134 * 135 135 * If the two sets of coordinates are not known to agree well, but the 136 136 * relative scale and approximate relative rotation is known, then a much faster … … 147 147 * allowing the procedure to scan over a range of rotations. We define the 148 148 * following function to apply this matching algorithm: 149 * 149 * 150 150 * XXX: In the SDRS, this function is a pointer. 151 * 151 * 152 152 */ 153 153 pmAstromStats pmAstromGridMatch( … … 159 159 160 160 /* 161 * 161 * 162 162 * The result of a pmAstromGridMatch may be used to modify the astrometry 163 163 * transformation information for a pmFPA image hierarchy structure. The result … … 167 167 * the linear terms of the pmFPA.toTangentPlane transformation. These two 168 168 * adjustments are made using the function: 169 * 169 * 170 170 * XXX: This function name is different in the SDRS. 171 * 171 * 172 172 */ 173 173 psPlaneTransform *pmAstromGridApply( … … 178 178 179 179 /* 180 * 180 * 181 181 * This function is identical to pmAstromGridMatch, but is valid for only a 182 182 * single relative rotation. The input config information need not contain any of 183 183 * the GRID.*.ANGLE entries (they will be ignored). 184 * 184 * 185 * XXX: This function name is different in the SDRS. 186 * 185 187 */ 186 188 /* in pmAstromGrid.c */ … … 193 195 194 196 /* 195 * 197 * 196 198 * This function accepts the raw and reference source lists and the list of 197 199 * matched entries. It uses the matched list to determine a polynomial … … 207 209 * modifications to pmFPA.toTangentPlane incorporate the rotation component of 208 210 * the linear terms and the higher-order terms of the polynomial fits. 209 * 211 * 210 212 * XXX: No prototype code. 211 * 213 * 212 214 */ 213 215 bool pmAstromFitFPA( … … 233 235 *ASTROM.ORDER). The result of this fit is a set of modifications of the 234 236 *components of the pmChip.toFPA transformation. 235 * 237 * 236 238 * XXX: No prototype code. 237 * 239 * 238 240 */ 239 241 bool pmAstromFitChip( … … 247 249 248 250 /* 249 * 251 * 250 252 * The following function determines the position residual, in the tangent 251 253 * plane, as a function of position in the focal plane, for a collection of raw … … 253 255 * the bin size over which the gradient is measured (keyword: ASTROM.GRAD.BOX). 254 256 * The function returns an array of pmAstromGradient structures, defined below. 255 * 257 * 256 258 * XXX: No prototype code. 257 * 259 * 258 260 */ 259 261 psArray pmAstromMeasureGradients( … … 267 269 268 270 /* 269 * 271 * 270 272 * The following data structure carries the information about the residual 271 273 * gradient of source positions in the tangent plane (pmAstromObj.TP) as a 272 274 * function of position in the focal plane (pmAstromObj.FP). 273 * 275 * 274 276 */ 275 277 typedef struct … … 283 285 284 286 /* 285 * 287 * 286 288 * The gradient set measured above can be fitted with a pair of 2D 287 289 * polynomials. The resulting fits can then be related back to the implied … … 290 292 * supplied pmFPA structure. The configuration variable supplies the polynomial 291 293 * order (keyword: ASTROM.DISTORT.ORDER). 292 * 294 * 293 295 * XXX: No prototype code. 294 * 296 * 295 297 */ 296 298 psArray pmAstromFitDistortion( … … 308 310 ******************************************************************************/ 309 311 /* 310 * 311 * 312 * 313 * 314 */ 315 316 317 /* 318 * 312 * 313 * 314 * 315 * 316 */ 317 318 319 /* 320 * 319 321 * Allocates a pmAstromObj struct. 320 * 322 * 321 323 */ 322 324 pmAstromObj *pmAstromObjAlloc (void); … … 325 327 326 328 /* 327 * 329 * 328 330 * Copies a pmAstromObj struct. 329 * 331 * 330 332 */ 331 333 pmAstromObj *pmAstromObjCopy( … … 336 338 337 339 /* 338 * 339 * 340 * 340 * 341 * 342 * 341 343 */ 342 344 pmAstromMatch *pmAstromMatchAlloc( … … 349 351 350 352 /* 351 * 352 * 353 * 353 * 354 * 355 * 354 356 */ 355 357 psPlaneTransform *pmAstromMatchFit( … … 364 366 365 367 /* 366 * 367 * 368 * 368 * 369 * 370 * 369 371 */ 370 372 int pmAstromObjSortByFPX( … … 376 378 377 379 /* 378 * 379 * 380 * 380 * 381 * 382 * 381 383 */ 382 384 int pmAstromObjSortByMag(
Note:
See TracChangeset
for help on using the changeset viewer.
