Changeset 1665
- Timestamp:
- Aug 31, 2004, 2:57:48 PM (22 years ago)
- Location:
- trunk/psLib/src/astronomy
- Files:
-
- 2 edited
-
psAstrometry.c (modified) (11 diffs)
-
psAstrometry.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psAstrometry.c
r1543 r1665 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-0 8-14 01:51:11$10 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-09-01 00:57:48 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 50 50 /*****************************************************************************/ 51 51 52 void p_psGrommitFree(psGrommit* grommit)53 {54 psFree(grommit);55 }56 57 52 /***************************************************************************** 58 p_psCheckValidImageCoords(): this is a private function which simply53 checkValidImageCoords(): this is a private function which simply 59 54 determines if the supplied x,y coordinates are in the range for the supplied 60 55 psImage. 61 56 *****************************************************************************/ 62 int p_psCheckValidImageCoords(double x,63 double y,64 psImage* tmpImage)57 static int checkValidImageCoords(double x, 58 double y, 59 psImage* tmpImage) 65 60 { 66 61 if (tmpImage == NULL) { … … 79 74 80 75 /***************************************************************************** 81 p_psIsProjectionLinear(): this is a private function which simply determines76 isProjectionLinear(): this is a private function which simply determines 82 77 if the supplied psPlaneTransform transform is linear: if any of the 83 78 cooefficients of order 2 are higher are non-zero, then it is not linear. 84 79 *****************************************************************************/ 85 int p_psIsProjectionLinear(psPlaneTransform *transform)80 static int isProjectionLinear(psPlaneTransform *transform) 86 81 { 87 82 int i = 0; … … 116 111 117 112 /***************************************************************************** 118 p_psInvertPlaneTransform(transform): : this is a private function which113 invertPlaneTransform(transform): : this is a private function which 119 114 simply inverts the supplied psPlaneTransform transform. It assumes that 120 115 "transform" is linear. … … 134 129 (Y2 * (1.0 / (F - ((C*E)/B)))); 135 130 *****************************************************************************/ 136 psPlaneTransform *p_psInvertPlaneTransform(psPlaneTransform *transform)131 static psPlaneTransform *invertPlaneTransform(psPlaneTransform *transform) 137 132 { 138 133 double A = transform->x->coeff[0][0]; … … 158 153 } 159 154 155 static void FPAFree(psFPA* fpa) 156 { 157 if (fpa != NULL) { 158 psFree(fpa->chips); 159 psFree(fpa->grommit); 160 psFree((psExposure*)fpa->exposure); 161 psFree(fpa->metadata); 162 psFree(fpa->fromTangentPlane); 163 psFree(fpa->toTangentPlane); 164 psFree(fpa->pattern); 165 psFree(fpa->colorPlus); 166 psFree(fpa->colorMinus); 167 psFree(fpa->projection); 168 } 169 } 170 171 static void chipFree(psChip* chip) 172 { 173 if (chip != NULL) { 174 psFree(chip->cells); 175 psFree(chip->parent); 176 psFree(chip->metadata); 177 psFree(chip->toFPA); 178 psFree(chip->fromFPA); 179 } 180 } 181 182 static void cellFree(psCell* cell) 183 { 184 if (cell != NULL) { 185 psFree(cell->readouts); 186 psFree(cell->metadata); 187 psFree(cell->toChip); 188 psFree(cell->fromChip); 189 psFree(cell->toFPA); 190 psFree(cell->toTP); 191 psFree(cell->parent); 192 } 193 } 194 195 static void readoutFree(psReadout* readout) 196 { 197 if (readout != NULL) { 198 psFree(readout->image); 199 psFree(readout->objects); 200 psFree(readout->metadata); 201 } 202 } 203 160 204 /*****************************************************************************/ 161 205 /* FUNCTION IMPLEMENTATION - PUBLIC */ 162 206 /*****************************************************************************/ 207 163 208 psExposure* psExposureAlloc(double ra, double dec, double hourAngle, 164 209 double zenith, double azimuth, double localTime, float date, … … 183 228 return exp; 184 229 } 230 231 /* 232 * psFPA constructor 233 */ 234 psFPA* psFPAAlloc(int nChips, 235 const psExposure* exp) 236 { 237 psFPA* newFPA = psAlloc(sizeof(psFPA)); 238 239 // create array of NULL chips of the size nChips 240 newFPA->chips = psArrayAlloc(nChips); 241 void** chips = newFPA->chips->data; 242 for (int i=0;i<nChips;i++) { 243 chips[i] = NULL; 244 } 245 246 newFPA->metadata = NULL; 247 newFPA->fromTangentPlane = NULL; 248 newFPA->toTangentPlane = NULL; 249 newFPA->pattern = NULL; 250 newFPA->exposure = psMemIncrRefCounter((psExposure*)exp); 251 newFPA->grommit = psGrommitAlloc(exp); 252 253 newFPA->colorPlus = NULL; 254 newFPA->colorMinus = NULL; 255 newFPA->projection = NULL; 256 257 newFPA->rmsX = 0.0f; 258 newFPA->rmsY = 0.0f; 259 newFPA->chi2 = 0.0f; 260 261 p_psMemSetDeallocator(newFPA,(psFreeFcn)FPAFree); 262 263 return newFPA; 264 } 265 266 /* 267 * psChip constructor 268 */ 269 psChip* psChipAlloc(int nCells, 270 psFPA *parentFPA) 271 { 272 psChip* chip = psAlloc(sizeof(psChip)); 273 274 // create array of NULL psCells 275 chip->cells = psArrayAlloc(nCells); 276 void** cells = chip->cells->data; 277 for (int i=0;i<nCells;i++) { 278 cells[i] = NULL; 279 } 280 281 chip->metadata = NULL; 282 283 chip->toFPA = NULL; 284 chip->fromFPA = NULL; 285 286 chip->parent = psMemIncrRefCounter(parentFPA); 287 288 p_psMemSetDeallocator(chip,(psFreeFcn)chipFree); 289 290 return chip; 291 292 } 293 294 /* 295 * psCell constructor 296 */ 297 psCell* psCellAlloc(int nReadouts, 298 psChip* parentChip) 299 { 300 psCell* cell = psAlloc(sizeof(psCell)); 301 302 // create array of NULL psReadouts 303 cell->readouts = psArrayAlloc(nReadouts); 304 void** readouts = cell->readouts->data; 305 for (int i=0;i<nReadouts;i++) { 306 readouts[i] = NULL; 307 } 308 309 cell->metadata = NULL; 310 311 cell->toChip = NULL; 312 cell->fromChip = NULL; 313 cell->toFPA = NULL; 314 cell->toTP = NULL; 315 316 cell->parent = psMemIncrRefCounter(parentChip); 317 318 p_psMemSetDeallocator(cell,(psFreeFcn)cellFree); 319 320 return cell; 321 322 323 } 324 325 psReadout* psReadoutAlloc(int col0, 326 int row0, 327 const psImage* image) 328 { 329 psReadout* readout = psAlloc(sizeof(psReadout)); 330 331 *(unsigned int*)&readout->colBins = 1; 332 *(unsigned int*)&readout->rowBins = 1; 333 *(int*)&readout->col0 = col0; 334 *(int*)&readout->row0 = row0; 335 336 readout->image = psMemIncrRefCounter((psImage*)image); 337 readout->objects = NULL; 338 readout->metadata = NULL; 339 340 p_psMemSetDeallocator(readout,(psFreeFcn)readoutFree); 341 342 return readout; 343 } 344 185 345 #define TBD 0.0 186 346 /***************************************************************************** … … 194 354 } 195 355 196 double date = TBD; // "mjd" in psExposure will become a psTime356 double date = TBD; // XXX: "mjd" in psExposure will become a psTime 197 357 // from which it will be possible to get UTC. 198 358 double dut = 0.0; 199 double elongm = TBD; 200 double phim = TBD; 201 double hm = TBD; 359 double elongm = TBD; // XXX 360 double phim = TBD; // XXX 361 double hm = TBD; // XXX 202 362 double xp = 0.0; 203 363 double yp = 0.0; … … 206 366 double rh = exp->humidity; 207 367 double wl = exp->wavelength; 208 double tlr = TBD; 368 double tlr = TBD; // XXX 209 369 double *AOPRMS = NULL; 210 370 … … 329 489 chipCoord); 330 490 331 if ( p_psCheckValidImageCoords(cellCoord->x,332 cellCoord->y,333 tmpReadout->image)) {491 if (checkValidImageCoords(cellCoord->x, 492 cellCoord->y, 493 tmpReadout->image)) { 334 494 psFree(cellCoord); 335 495 return (tmpCell); … … 651 811 652 812 // generate an error if cell->toTP is not linear. 653 if (0 == p_psIsProjectionLinear(cell->toTP)) {813 if (0 == isProjectionLinear(cell->toTP)) { 654 814 psAbort(__func__, "the cell->toTP transfrom is not linear.\n"); 655 815 } 656 816 657 TPtoCell = p_psInvertPlaneTransform(cell->toTP);817 TPtoCell = invertPlaneTransform(cell->toTP); 658 818 cellCoord = psPlaneTransformApply(cellCoord, TPtoCell, tpCoord); 659 819 -
trunk/psLib/src/astronomy/psAstrometry.h
r1530 r1665 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-0 8-13 22:41:24$10 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-09-01 00:57:48 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 239 239 ); 240 240 241 /** Allocator for psFPA 242 * 243 * This function shall make an empty psFPA, with the nChips allocated 244 * pointers to psChips being set to NULL; all other pointers in the structure 245 * shall be initialized to NULL, apart from the grommit, which shall be 246 * constructed on the basis of the exp parameter. 247 * 248 * @return psFPA* a newly allocated psFPA 249 */ 250 psFPA* psFPAAlloc( 251 int nChips, ///< number of chips in the FPA 252 const psExposure* exp ///< the exposure information 253 ); 254 255 /** Allocates a psChip 256 * 257 * This allocator shall make an empty psChip, with the nCells allocated 258 * pointers to psCells being set to NULL; all other pointers in the structure 259 * shall be initialized to NULL. 260 * 261 * @return psChip* newly allocated psChip 262 */ 263 psChip* psChipAlloc( 264 int nCells, ///< number of cells in Chip 265 psFPA* parentFPA ///< parent FPA 266 ); 267 268 /** Allocates a psCell 269 * 270 * The constructor shall make an empty psCell, with the nReadouts allocated 271 * pointers to psReadouts being set to NULL; all other pointers in the 272 * structure shall be initialized to NULL. 273 * 274 * @return psCell* newly allocated psCell 275 */ 276 psCell* psCellAlloc( 277 int nReadouts, ///< number of readouts in cell 278 psChip* parentChip ///< parent Chip 279 ); 280 281 /** Allocates a psReadout 282 * 283 * All pointers in the structure other than the image shall be initialized 284 * to NULL. 285 * 286 * @return psReadout* newly allocated psReadout 287 */ 288 psReadout* psReadoutAlloc( 289 int col0, ///< offset from the left of the cell 290 int row0, ///< offset from the bottom of the cell 291 const psImage* image ///< image of the readout 292 ); 293 241 294 /** Allocates a Wallace's Grommit structure. 242 295 * … … 246 299 * @return psGrommit* New grommit structure. 247 300 */ 248 psGrommit* psGrommitAlloc(const psExposure* exp ///< the cooresponding exposure structure.249 );250 void p_psGrommitFree(psGrommit *grommit);251 301 psGrommit* psGrommitAlloc( 252 302 const psExposure* exp ///< the cooresponding exposure structure.
Note:
See TracChangeset
for help on using the changeset viewer.
