Changeset 21156 for trunk/magic/remove/src/streaksastrom.c
- Timestamp:
- Jan 23, 2009, 3:05:43 PM (17 years ago)
- Location:
- trunk/magic/remove/src
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
streaksastrom.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src
- Property svn:ignore
-
old new 2 2 streaksreplace 3 3 streakscompare 4 streaksrelease
-
- Property svn:ignore
-
trunk/magic/remove/src/streaksastrom.c
r20842 r21156 17 17 18 18 if (fromCell) { 19 // The metadata is the cell concepts 19 // XXX: I think that this is not needed 20 // We are only asked to get the concepts from the cell when we're reading from a pmfile (skycell) 21 // In that case we (x0,y0) = (0,0) and the parirties are positive 22 // If the x0, y0 are not zero they are probably in the FITS unity based array format 23 // We should probably assert that these are zero 20 24 cell_x0 = psMetadataLookupS32(&mdok, md, "CELL.X0"); 21 25 if (!mdok) { … … 28 32 return NULL; 29 33 } 30 31 34 xParityCell = psMetadataLookupS32(&mdok, md, "CELL.XPARITY"); 32 35 if (!mdok || (xParityCell != 1 && xParityCell != -1)) { … … 65 68 return false; 66 69 } 67 68 70 } else { 69 71 // no metadata regular cell 72 // used by warpedpixels 70 73 cell_x0 = 0; 71 74 cell_y0 = 0; … … 89 92 } 90 93 94 void 95 chipToCell(double *xCell, double *yCell, strkAstrom *astrom, double xChip, double yChip) 96 { 97 // convert from chip to cell 98 if (astrom->xParity > 0) { 99 *xCell = xChip - astrom->cell_x0; 100 } else { 101 *xCell = astrom->cell_x0 - 1 - xChip; 102 } 103 if (astrom->yParity > 0) { 104 *yCell = yChip - astrom->cell_y0; 105 } else { 106 *yCell = astrom->cell_y0 - 1 - yChip; 107 } 108 } 109 110 void 111 cellToChip(double *xChip, double *yChip, strkAstrom *astrom, double xCell, double yCell) 112 { 113 if (astrom->xParity > 0) { 114 *xChip = xCell + astrom->cell_x0; 115 } else { 116 *xChip = astrom->cell_x0 - 1 - xCell; 117 } 118 if (astrom->yParity > 0) { 119 *yChip = yCell + astrom->cell_y0; 120 } else { 121 *yChip = astrom->cell_y0 - 1 - yCell; 122 } 123 } 124 125 void 126 cellToChipInt(int *xChip, int *yChip, strkAstrom *astrom, int xCell, int yCell) 127 { 128 if (astrom->xParity > 0) { 129 *xChip = xCell + astrom->cell_x0; 130 } else { 131 *xChip = astrom->cell_x0 - 1 - xCell; 132 } 133 if (astrom->yParity > 0) { 134 *yChip = yCell + astrom->cell_y0; 135 } else { 136 *yChip = astrom->cell_y0 - 1 - yCell; 137 } 138 } 139 91 140 bool 92 141 skyToCell(strkPt *outPt, strkAstrom *astrom, double ra, double dec) … … 107 156 psPlaneTransformApply(pt->chip, chip->fromFPA, pt->FP); 108 157 109 // convert from chip to cell 110 outPt->x = (pt->chip->x - astrom->cell_x0) * astrom->xParity; 111 outPt->y = (pt->chip->y - astrom->cell_y0) * astrom->yParity; 158 chipToCell(&outPt->x, &outPt->y, astrom, pt->chip->x, pt->chip->y); 112 159 113 160 // printf("cell: %f %f chip: %f %f\n", outPt->x, outPt->y, pt->chip->x, pt->chip->y); … … 115 162 return true; 116 163 } 117 164 118 165 bool 119 166 cellToSky(strkPt *outPt, strkAstrom *astrom, double x, double y) … … 123 170 pmAstromObj *pt = (pmAstromObj *) astrom->pt; 124 171 125 // XXX: TODO: confirm that this cell to chip transformation is correct 126 pt->chip->x = (x * astrom->xParity) + astrom->cell_x0; 127 pt->chip->y = (y * astrom->yParity) + astrom->cell_y0; 172 cellToChip(&pt->chip->x, &pt->chip->y, astrom, x, y); 128 173 129 174 pt->chip->xErr = 0; // Is setting these errors to zero the right thing to do? … … 142 187 } 143 188 144 void145 cellToChip(PixelPos *chip, strkAstrom *astrom, PixelPos *cell)146 {147 // TODO: do I need to worry about going from int to float and back again here?148 chip->x = (cell->x * astrom->xParity) + astrom->cell_x0;149 chip->y = (cell->y * astrom->yParity) + astrom->cell_y0;150 }151 189 152 190 static bool … … 166 204 PS_ASSERT_PTR_NON_NULL(hdu->header, 1) 167 205 if (sf->bilevelAstrometry) { 168 // Do we get here for GPC1 ? I don't necessarily have an fpa for the input image169 206 if (!pmAstromReadBilevelMosaic(sf->inAstrom->fpa, phu->header)) { 170 207 psError(PS_ERR_UNKNOWN, false, "Unable to read bilevel mosaic astrometry for input FPA."); … … 232 269 } 233 270 } 271 272 void 273 linearizeTransforms(strkAstrom *astrom) 274 { 275 if (!pmAstromLinearizeTransforms((pmFPA *) astrom->fpa, (pmChip *) astrom->chip)) { 276 streaksExit("linear fit to astrometry failed\n", PS_EXIT_UNKNOWN_ERROR); 277 } 278 }
Note:
See TracChangeset
for help on using the changeset viewer.
