Changeset 4613
- Timestamp:
- Jul 26, 2005, 2:36:01 PM (21 years ago)
- Location:
- trunk/psLib/src/astro
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r4581 r4613 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.8 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-07-2 0 01:21:13$12 * @version $Revision: 1.81 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-27 00:36:01 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 212 212 psMemSetDeallocator(s, (psFreeFunc) sphereFree); 213 213 return(s); 214 } 215 216 static void cubeFree(psCube *c) 217 { 218 // There are non dynamic allocated items 219 } 220 221 psCube* psCubeAlloc(void) 222 { 223 psCube *c = psAlloc(sizeof(psCube)); 224 225 psMemSetDeallocator(c, (psFreeFunc) cubeFree); 226 return(c); 214 227 } 215 228 … … 1256 1269 return(NULL); 1257 1270 } 1271 1272 psCube *psSphereToCube(const psSphere *sphere) 1273 { 1274 if(sphere == NULL) { 1275 // psError(); 1276 return NULL; 1277 } 1278 1279 psCube *cube = NULL; 1280 1281 cube = psCubeAlloc(); 1282 cube->x = cos(sphere->d) * cos(sphere->r); 1283 cube->y = cos(sphere->d) * sin(sphere->r); 1284 cube->z = sin(sphere->d); 1285 cube->xErr = cos(sphere->dErr) * cos(sphere->rErr); 1286 cube->yErr = cos(sphere->dErr) * sin(sphere->rErr); 1287 cube->zErr = sin(sphere->dErr); 1288 1289 return(cube); 1290 } 1291 1292 psSphere *psCubeToSphere(const psCube *cube) 1293 { 1294 if(cube == NULL) { 1295 // psError(); 1296 return NULL; 1297 } 1298 1299 psSphere *sphere = NULL; 1300 sphere = psSphereAlloc(); 1301 // sphere->r = arctan(cube->x/cube->y); 1302 // sphere->d = arctan(sqrt(cube->x*cube->x + cube->y*cube->y)/cube->z); 1303 // sphere->rErr = arctan(cube->xErr/cube->yErr); 1304 // sphere->dErr = arctan(sqrt(cube->xErr*cube->xErr + cube->yErr*cube->yErr)/cube->zErr); 1305 sphere->r = 1 / (atan(cube->x/cube->y)); 1306 sphere->d = 1 / (atan(sqrt(cube->x*cube->x + cube->y*cube->y)/cube->z)); 1307 sphere->rErr = 1 / (atan(cube->xErr/cube->yErr)); 1308 sphere->dErr = 1 / (atan(sqrt(cube->xErr*cube->xErr + cube->yErr*cube->yErr)/cube->zErr)); 1309 1310 return(sphere); 1311 } -
trunk/psLib/src/astro/psCoord.h
r4581 r4613 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-07-2 0 01:21:13$12 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-27 00:36:01 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 38 38 typedef struct 39 39 { 40 double x; ///< x position41 double y; ///< y position42 double xErr; ///< Error in x position43 double yErr; ///< Error in y position40 double x; ///< x position 41 double y; ///< y position 42 double xErr; ///< Error in x position 43 double yErr; ///< Error in y position 44 44 } 45 45 psPlane; … … 54 54 typedef struct psSphere 55 55 { 56 double r; ///< RA57 double d; ///< Dec58 double rErr; ///< Error in RA59 double dErr; ///< Error in Dec56 double r; ///< RA 57 double d; ///< Dec 58 double rErr; ///< Error in RA 59 double dErr; ///< Error in Dec 60 60 } 61 61 psSphere; 62 63 /** 3-Dimensional Euclidean Coordinate System 64 * 65 * Both detector and sky positions will be used extensively in the IPP. One 66 * coordinate system to be used is cubic coordinates for which additional 67 * care must often be taken in comparison to an angular coordinate system. 68 * 69 */ 70 typedef struct 71 { 72 double x; ///< cos (DEC) cos (RA) 73 double y; ///< cos (DEC) sin (RA) 74 double z; ///< sin (DEC) 75 double xErr; ///< Error in x 76 double yErr; ///< Error in y 77 double zErr; ///< Error in z 78 } 79 psCube; 62 80 63 81 /** 2D Polynomial Transform … … 71 89 typedef struct 72 90 { 73 psPolynomial2D* x; ///< 2D polynomial transform of X coordinates74 psPolynomial2D* y; ///< 2D polynomial transform of Y coordinates91 psPolynomial2D* x; ///< 2D polynomial transform of X coordinates 92 psPolynomial2D* y; ///< 2D polynomial transform of Y coordinates 75 93 } 76 94 psPlaneTransform; … … 90 108 typedef struct 91 109 { 92 psPolynomial4D* x; ///< 4D polynomial transform of X coordinates93 psPolynomial4D* y; ///< 4D polynomial transform of Y coordinates110 psPolynomial4D* x; ///< 4D polynomial transform of X coordinates 111 psPolynomial4D* y; ///< 4D polynomial transform of Y coordinates 94 112 } 95 113 psPlaneDistort; … … 120 138 */ 121 139 typedef enum { 122 PS_PROJ_TAN, ///< Tangent projection123 PS_PROJ_SIN, ///< Sine projection124 PS_PROJ_AIT, ///< Aitoff projection125 PS_PROJ_PAR, ///< Par projection140 PS_PROJ_TAN, ///< Tangent projection 141 PS_PROJ_SIN, ///< Sine projection 142 PS_PROJ_AIT, ///< Aitoff projection 143 PS_PROJ_PAR, ///< Par projection 126 144 // PS_PROJ_GLS, ///< GLS projection 127 145 // PS_PROJ_CAR, ///< CAR projection 128 146 // PS_PROJ_MER, ///< MER projection 129 PS_PROJ_NTYPE ///< Number of types; must be last.147 PS_PROJ_NTYPE ///< Number of types; must be last. 130 148 } psProjectionType; 131 149 … … 137 155 typedef struct 138 156 { 139 double R; ///< Coordinates of projection center140 double D; ///< Coordinates of projection center141 double Xs; ///< plate-scale in X direction142 double Ys; ///< plate-scale in Y direction143 psProjectionType type; ///< Projection type157 double R; ///< Coordinates of projection center 158 double D; ///< Coordinates of projection center 159 double Xs; ///< plate-scale in X direction 160 double Ys; ///< plate-scale in Y direction 161 psProjectionType type; ///< Projection type 144 162 } 145 163 psProjection; … … 151 169 */ 152 170 typedef enum { 153 PS_SPHERICAL, ///< offset corresponds to an angular offset154 PS_LINEAR ///< offset corresponds to a linear offset171 PS_SPHERICAL, ///< offset corresponds to an angular offset 172 PS_LINEAR ///< offset corresponds to a linear offset 155 173 } psSphereOffsetMode; 156 174 … … 161 179 */ 162 180 typedef enum { 163 PS_ARCSEC, ///< Arcseconds164 PS_ARCMIN, ///< Arcminutes165 PS_DEGREE, ///< Degrees166 PS_RADIAN ///< Radians181 PS_ARCSEC, ///< Arcseconds 182 PS_ARCMIN, ///< Arcminutes 183 PS_DEGREE, ///< Degrees 184 PS_RADIAN ///< Radians 167 185 } psSphereOffsetUnit; 168 186 … … 181 199 psSphere* psSphereAlloc(void); 182 200 201 /** Allocates a psCube 202 * 203 * @return psCube* resulting cube structure. 204 */ 205 psCube* psCubeAlloc(void); 183 206 184 207 /** Allocates a psPlaneTransform transform. … … 233 256 234 257 psSphereTransform* psSphereTransformAlloc( 235 double alphaP, ///< north pole latitude236 double deltaP, ///< north pole longitude?237 double phiP ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).258 double alphaP, ///< north pole latitude 259 double deltaP, ///< north pole longitude? 260 double phiP ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares). 238 261 ); 239 262 … … 254 277 */ 255 278 psSphereTransform* psSphereTransformICRSToEcliptic( 256 psTime *time ///< the time for which the resulting transform will be valid279 psTime *time ///< the time for which the resulting transform will be valid 257 280 ); 258 281 … … 263 286 */ 264 287 psSphereTransform* psSphereTransformEclipticToICRS( 265 psTime *time ///< the time for which the resulting transform will be valid288 psTime *time ///< the time for which the resulting transform will be valid 266 289 ); 267 290 … … 283 306 */ 284 307 psProjection* psProjectionAlloc( 285 double R, ///< Right-ascension of projection center.286 double D, ///< Declination of projection center.287 double Xs, ///< Scale in x-dimension288 double Ys, ///< Scale in y-dimension308 double R, ///< Right-ascension of projection center. 309 double D, ///< Declination of projection center. 310 double Xs, ///< Scale in x-dimension 311 double Ys, ///< Scale in y-dimension 289 312 psProjectionType type 290 313 ); … … 361 384 */ 362 385 psPlaneTransform *p_psPlaneTransformLinearInvert( 363 psPlaneTransform *transform ///< transform to invert386 psPlaneTransform *transform ///< transform to invert 364 387 ); 365 388 … … 371 394 */ 372 395 psS32 p_psIsProjectionLinear( 373 psPlaneTransform *transform ///< transform to test for linearity396 psPlaneTransform *transform ///< transform to test for linearity 374 397 ); 375 398 … … 436 459 */ 437 460 bool psPlaneTransformFit( 438 psPlaneTransform *trans, 439 const psArray *source, 440 const psArray *dest, 441 int nRejIter, 442 float sigmaClip 461 psPlaneTransform *trans, ///< desired order, polynomial type, & polynomial mask terms 462 const psArray *source, ///< coordinates matching those in dest 463 const psArray *dest, ///< coordinates matching those in source 464 int nRejIter, ///< number of rejection iterations to be performed 465 float sigmaClip ///< coordinates above this number of standard deviations will be rejected 443 466 ); 444 467 //XXX: need to add doxygen comments on the parameters above. -rdd 445 468 469 /** Converts from a 3-dimensional coordinate system to an angular coordinate system. 470 * 471 * @return psSphere* The former psCube in terms of a psSphere. 472 */ 473 psSphere *psCubeToSphere( 474 const psCube *cube ///< psCube to convert 475 ); 476 477 /** Converts from an angular coordinate system to a 3-dimensional coordinate system. 478 * 479 * @return psCube* The former psSphere in terms of a psCube. 480 */ 481 psCube *psSphereToCube( 482 const psSphere *sphere ///< psSphere to convert 483 ); 484 485 446 486 /// @} 447 487
Note:
See TracChangeset
for help on using the changeset viewer.
