Changeset 1374
- Timestamp:
- Aug 3, 2004, 2:55:17 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 16 edited
-
Doxyfile (modified) (1 diff)
-
astro/psCoord.c (modified) (9 diffs)
-
astro/psCoord.h (modified) (3 diffs)
-
astronomy/psCoord.c (modified) (9 diffs)
-
astronomy/psCoord.h (modified) (3 diffs)
-
astronomy/psCoord2.c (modified) (6 diffs)
-
astronomy/psCoord2.h (modified) (2 diffs)
-
astronomy/psMetadata.h (modified) (16 diffs)
-
astronomy/psPhotometry.h (modified) (2 diffs)
-
collections/psMetadata.h (modified) (16 diffs)
-
image/psImageExtraction.c (modified) (2 diffs)
-
image/psImageExtraction.h (modified) (3 diffs)
-
image/psImageStats.h (modified) (2 diffs)
-
imageops/psImageStats.h (modified) (2 diffs)
-
pslib.h (modified) (4 diffs)
-
types/psMetadata.h (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/Doxyfile
r1269 r1374 377 377 # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc 378 378 379 FILE_PATTERNS = *. h *.dox379 FILE_PATTERNS = *.c *.h *.dox 380 380 381 381 # The RECURSIVE tag can be used to turn specify whether or not subdirectories -
trunk/psLib/src/astro/psCoord.c
r1325 r1374 1 1 /** @file psCoord.c 2 *3 * @brief Contains basic coordinate transformation definitions and operations4 *5 * This file defines the basic types for astronomical coordinate6 * transformation7 *8 * @ingroup AstroImage 9 *10 * @author George Gusciora, MHPCC11 *12 * @version $Revision: 1.7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-29 02:08:02$14 *15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii16 */2 * 3 * @brief Contains basic coordinate transformation definitions and operations 4 * 5 * This file defines the basic types for astronomical coordinate 6 * transformation 7 * 8 * @ingroup CoordinateTransform 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 17 17 18 18 #include "psType.h" … … 28 28 29 29 // This is the only function in this file which I understand. 30 psPlane *psPlaneTransformApply( psPlane *out,31 const psPlaneTransform *transform,32 const psPlane *coords)33 { 34 if ( out == NULL) {35 out = (psPlane *) psAlloc(sizeof(psPlane));36 }37 out->x = transform->x->coeff[ 0][0] +38 ( transform->x->coeff[1][0] * coords->x) +39 ( transform->x->coeff[0][1] * coords->y);40 41 out->y = transform->y->coeff[ 0][0] +42 ( transform->y->coeff[1][0] * coords->x) +43 ( transform->y->coeff[0][1] * coords->y);44 45 return (out);30 psPlane *psPlaneTransformApply( psPlane *out, 31 const psPlaneTransform *transform, 32 const psPlane *coords ) 33 { 34 if ( out == NULL ) { 35 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 36 } 37 out->x = transform->x->coeff[ 0 ][ 0 ] + 38 ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) + 39 ( transform->x->coeff[ 0 ][ 1 ] * coords->y ); 40 41 out->y = transform->y->coeff[ 0 ][ 0 ] + 42 ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) + 43 ( transform->y->coeff[ 0 ][ 1 ] * coords->y ); 44 45 return ( out ); 46 46 } 47 47 … … 49 49 // This transformation takes into account parameters beyond an objects 50 50 // spatial coordinates: term3 and term4. 51 psPlane *psPlaneDistortApply( psPlane *out,52 const psPlaneDistort *transform,53 const psPlane *coords,54 float term3,55 float term4)56 { 57 if ( out == NULL) {58 out = (psPlane *) psAlloc(sizeof(psPlane));59 }60 61 out->x = transform->x->coeff[ 0][0][0][0] +62 ( transform->x->coeff[1][0][0][0] * coords->x) +63 ( transform->x->coeff[0][1][0][0] * coords->y) +64 ( transform->x->coeff[0][0][1][0] * term3) +65 ( transform->x->coeff[0][0][0][1] * term4);66 67 out->y = transform->y->coeff[ 0][0][0][0] +68 ( transform->y->coeff[1][0][0][0] * coords->x) +69 ( transform->y->coeff[0][1][0][0] * coords->y) +70 ( transform->y->coeff[0][0][1][0] * term3) +71 ( transform->y->coeff[0][0][0][1] * term4);72 73 return (out);51 psPlane *psPlaneDistortApply( psPlane *out, 52 const psPlaneDistort *transform, 53 const psPlane *coords, 54 float term3, 55 float term4 ) 56 { 57 if ( out == NULL ) { 58 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 59 } 60 61 out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] + 62 ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) + 63 ( transform->x->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) + 64 ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) + 65 ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 ); 66 67 out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] + 68 ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) + 69 ( transform->y->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) + 70 ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) + 71 ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 ); 72 73 return ( out ); 74 74 } 75 75 76 76 77 77 // This function prototype has been modified since the SDRS. 78 psSphereTransform *psSphereTransformAlloc( double NPlat,78 psSphereTransform *psSphereTransformAlloc( double NPlat, 79 79 double Xo, 80 double xo )81 { 82 psSphereTransform * tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));83 84 tmp->sinPhi = sin( NPlat);85 tmp->cosPhi = cos( NPlat);80 double xo ) 81 { 82 psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) ); 83 84 tmp->sinPhi = sin( NPlat ); 85 tmp->cosPhi = cos( NPlat ); 86 86 tmp->Xo = Xo; 87 87 tmp->xo = xo; 88 89 return (tmp);88 89 return ( tmp ); 90 90 } 91 91 92 92 // I understand this one too. 93 void p_psSphereTransformFree( psSphereTransform *trans)94 { 95 psFree( trans);93 void p_psSphereTransformFree( psSphereTransform *trans ) 94 { 95 psFree( trans ); 96 96 } 97 97 … … 103 103 // there are no typo's. 104 104 105 psSphere *psSphereTransformApply( psSphere *out,106 const psSphereTransform *transform,107 const psSphere *coord)105 psSphere *psSphereTransformApply( psSphere *out, 106 const psSphereTransform *transform, 107 const psSphere *coord ) 108 108 { 109 109 double sinY = 0.0; … … 114 114 double y = 0.0; 115 115 double dx = 0.0; 116 117 if ( out == NULL) {118 out = (psSphere *) psAlloc(sizeof(psSphere));119 }120 116 117 if ( out == NULL ) { 118 out = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 119 } 120 121 121 x = coord->r; 122 122 y = coord->d; 123 dx = x - transform->xo;124 sinY = cos( y)*sin(dx)*transform->sinPhi + sin(y)*transform->cosPhi;125 cosY = sqrt( 1.0 - sinY*sinY);126 sinX = ( cos(y)*sin(dx)*transform->cosPhi - sin(y)*transform->sinPhi) /127 cos( y);128 cosX = cos( y)*cos(dx) / cos(y);129 130 out->r = atan2( sinX, cosX) + transform->Xo;131 out->d = atan2( sinY, cosY);132 133 return (out);134 } 135 136 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time)137 { 138 struct tm * tmTime = psTimeToTM(time);139 double year = ( double) (1900 + tmTime->tm_year);123 dx = x - transform->xo; 124 sinY = cos( y ) * sin( dx ) * transform->sinPhi + sin( y ) * transform->cosPhi; 125 cosY = sqrt( 1.0 - sinY * sinY ); 126 sinX = ( cos( y ) * sin( dx ) * transform->cosPhi - sin( y ) * transform->sinPhi ) / 127 cos( y ); 128 cosX = cos( y ) * cos( dx ) / cos( y ); 129 130 out->r = atan2( sinX, cosX ) + transform->Xo; 131 out->d = atan2( sinY, cosY ); 132 133 return ( out ); 134 } 135 136 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time ) 137 { 138 struct tm * tmTime = psTimeToTM( time ); 139 double year = ( double ) ( 1900 + tmTime->tm_year ); 140 140 double T = year / 100.0; 141 double phi = -23.452294 + 0.013013 *T + 0.000001639*T*T - 0.000000503*T*T*T;141 double phi = -23.452294 + 0.013013 * T + 0.000001639 * T * T - 0.000000503 * T * T * T; 142 142 double Xo = 0.0; 143 143 double xo = 0.0; 144 145 return (psSphereTransformAlloc(phi, Xo, xo));146 } 147 148 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time)149 { 150 struct tm * tmTime = psTimeToTM(time);151 double year = ( double) (1900 + tmTime->tm_year);144 145 return ( psSphereTransformAlloc( phi, Xo, xo ) ); 146 } 147 148 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time ) 149 { 150 struct tm * tmTime = psTimeToTM( time ); 151 double year = ( double ) ( 1900 + tmTime->tm_year ); 152 152 double T = year / 100.0; 153 double phi = + 23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T;153 double phi = + 23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T; 154 154 double Xo = 0.0; 155 155 double xo = 0.0; 156 157 return (psSphereTransformAlloc(phi, Xo, xo));158 } 159 160 psSphereTransform *psSphereTransformICRStoGalatic( void)161 { 162 return (psSphereTransformAlloc(62.6, 282.25, 33.0));163 } 164 165 psSphereTransform *psSphereTransformGalatictoICRS( void)166 { 167 return (psSphereTransformAlloc(-62.6, 33.0, 282.25));156 157 return ( psSphereTransformAlloc( phi, Xo, xo ) ); 158 } 159 160 psSphereTransform *psSphereTransformICRStoGalatic( void ) 161 { 162 return ( psSphereTransformAlloc( 62.6, 282.25, 33.0 ) ); 163 } 164 165 psSphereTransform *psSphereTransformGalatictoICRS( void ) 166 { 167 return ( psSphereTransformAlloc( -62.6, 33.0, 282.25 ) ); 168 168 } 169 169 170 170 // XXX: Is this the correct way to calculate this? 171 float cot( float x)172 { 173 return (1.0 / atan(x));171 float cot( float x ) 172 { 173 return ( 1.0 / atan( x ) ); 174 174 } 175 175 176 176 // This is some kind of arc tan function. 177 float arg( float x, float y)178 { 179 if ( x > 0) {180 return(atan(y/x));181 } else if ((x==0) && (y==0)) {182 return(0.5 * M_PI);183 } else if ((x==0) && (y==0)) {184 return(-0.5 * M_PI);185 } else if ((x==0) && (y==0)) {186 return(M_PI + atan(y/x));187 } else if ((x==0) && (y==0)) {188 return(-M_PI + atan(y/x));189 }190 191 psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y);192 return (0.0);177 float arg( float x, float y ) 178 { 179 if ( x > 0 ) { 180 return ( atan( y / x ) ); 181 } else if ( ( x == 0 ) && ( y == 0 ) ) { 182 return ( 0.5 * M_PI ); 183 } else if ( ( x == 0 ) && ( y == 0 ) ) { 184 return ( -0.5 * M_PI ); 185 } else if ( ( x == 0 ) && ( y == 0 ) ) { 186 return ( M_PI + atan( y / x ) ); 187 } else if ( ( x == 0 ) && ( y == 0 ) ) { 188 return ( -M_PI + atan( y / x ) ); 189 } 190 191 psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y ); 192 return ( 0.0 ); 193 193 } 194 194 195 195 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 196 196 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 197 psPlane *psProject( const psSphere *coord,198 const psProjection *projection)197 psPlane *psProject( const psSphere *coord, 198 const psProjection *projection ) 199 199 { 200 200 float R = 0.0; 201 201 float alpha = 0.0; 202 psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));203 204 if ( projection->type == PS_PROJ_TAN) {205 R = cot(coord->r) * (180.0 / M_PI);206 tmp->x = R * sin(coord->d);207 tmp->y = R * cos(coord->d);208 209 } else if (projection->type == PS_PROJ_SIN) {210 R = cos(coord->r) * (180.0 / M_PI);211 tmp->x = R * sin(coord->d);212 tmp->y = R * cos(coord->d);213 214 } else if (projection->type == PS_PROJ_CAR) {215 tmp->x = coord->d;216 tmp->y = coord->r;217 218 } else if (projection->type == PS_PROJ_MER) {219 tmp->x = coord->d;220 tmp->y = log(tan(45.0 + (0.5 * coord->r))) * 180.0/M_PI;221 222 } else if (projection->type == PS_PROJ_AIT) {223 alpha = 1.0 / ((180.0 / M_PI) *224 sqrt(1.0 + (cos(coord->r) * cos(0.5 * coord->d) * 0.5)));225 226 tmp->x = 2.0 * alpha * cos(coord->r) * sin(0.5 * coord->d);227 tmp->y = alpha * sin(coord->d);228 229 } else if (projection->type == PS_PROJ_PAR) {230 psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");231 232 } else if (projection->type == PS_PROJ_GLS) {233 psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");234 }235 236 return (tmp);202 psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 203 204 if ( projection->type == PS_PROJ_TAN ) { 205 R = cot( coord->r ) * ( 180.0 / M_PI ); 206 tmp->x = R * sin( coord->d ); 207 tmp->y = R * cos( coord->d ); 208 209 } else if ( projection->type == PS_PROJ_SIN ) { 210 R = cos( coord->r ) * ( 180.0 / M_PI ); 211 tmp->x = R * sin( coord->d ); 212 tmp->y = R * cos( coord->d ); 213 214 } else if ( projection->type == PS_PROJ_CAR ) { 215 tmp->x = coord->d; 216 tmp->y = coord->r; 217 218 } else if ( projection->type == PS_PROJ_MER ) { 219 tmp->x = coord->d; 220 tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI; 221 222 } else if ( projection->type == PS_PROJ_AIT ) { 223 alpha = 1.0 / ( ( 180.0 / M_PI ) * 224 sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) ); 225 226 tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d ); 227 tmp->y = alpha * sin( coord->d ); 228 229 } else if ( projection->type == PS_PROJ_PAR ) { 230 psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" ); 231 232 } else if ( projection->type == PS_PROJ_GLS ) { 233 psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" ); 234 } 235 236 return ( tmp ); 237 237 } 238 238 239 239 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 240 240 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 241 psSphere *psDeproject( const psPlane *coord,242 const psProjection *projection)241 psSphere *psDeproject( const psPlane *coord, 242 const psProjection *projection ) 243 243 { 244 244 float R = 0.0; … … 246 246 float chu1 = 0.0; 247 247 float chu2 = 0.0; 248 psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));249 250 if ( projection->type == PS_PROJ_TAN) {251 R = sqrt((coord->x * coord->x) + (coord->y * coord->y));252 tmp->d = arg(-coord->y, coord->x);253 tmp->r = atan(180.0 / (R * M_PI));254 255 } else if (projection->type == PS_PROJ_SIN) {256 R = sqrt((coord->x * coord->x) + (coord->y * coord->y));257 tmp->d = arg(-coord->y, coord->x);258 tmp->r = acos((R * M_PI) / 180.0);259 260 } else if (projection->type == PS_PROJ_CAR) {261 tmp->d = coord->x;262 tmp->r = coord->y;263 264 } else if (projection->type == PS_PROJ_MER) {265 tmp->d = coord->x;266 tmp->r = (2.0 * atan(exp((coord->y * M_PI/180.0)))) - 180.0;267 268 } else if (projection->type == PS_PROJ_AIT) {269 chu1 = (coord->x * M_PI) / 720.0;270 chu1*= chu1;271 chu2 = (coord->y * M_PI) / 360.0;272 chu2*= chu2;273 chu = sqrt(1.0 - chu1 - chu2);274 tmp->d = 2.0 * arg((2.0 * chu * chu) - 1.0,275 (coord->x * chu * M_PI)/360.0);276 tmp->r = asin((coord->y * chu * M_PI) / 180.0);277 278 } else if (projection->type == PS_PROJ_PAR) {279 psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");280 281 } else if (projection->type == PS_PROJ_GLS) {282 psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");283 }284 285 return (tmp);248 psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 249 250 if ( projection->type == PS_PROJ_TAN ) { 251 R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) ); 252 tmp->d = arg( -coord->y, coord->x ); 253 tmp->r = atan( 180.0 / ( R * M_PI ) ); 254 255 } else if ( projection->type == PS_PROJ_SIN ) { 256 R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) ); 257 tmp->d = arg( -coord->y, coord->x ); 258 tmp->r = acos( ( R * M_PI ) / 180.0 ); 259 260 } else if ( projection->type == PS_PROJ_CAR ) { 261 tmp->d = coord->x; 262 tmp->r = coord->y; 263 264 } else if ( projection->type == PS_PROJ_MER ) { 265 tmp->d = coord->x; 266 tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0; 267 268 } else if ( projection->type == PS_PROJ_AIT ) { 269 chu1 = ( coord->x * M_PI ) / 720.0; 270 chu1 *= chu1; 271 chu2 = ( coord->y * M_PI ) / 360.0; 272 chu2 *= chu2; 273 chu = sqrt( 1.0 - chu1 - chu2 ); 274 tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0, 275 ( coord->x * chu * M_PI ) / 360.0 ); 276 tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 ); 277 278 } else if ( projection->type == PS_PROJ_PAR ) { 279 psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" ); 280 281 } else if ( projection->type == PS_PROJ_GLS ) { 282 psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" ); 283 } 284 285 return ( tmp ); 286 286 } 287 287 288 288 // XXX: Do I need to check for unacceptable transformation parameters? 289 289 // Maybe, if the points are on the North/South Pole, etc? 290 psSphere *psSphereGetOffset( const psSphere *restrict position1,291 const psSphere *restrict position2,292 psSphereOffsetMode mode,293 psSphereOffsetUnit unit)290 psSphere *psSphereGetOffset( const psSphere *restrict position1, 291 const psSphere *restrict position2, 292 psSphereOffsetMode mode, 293 psSphereOffsetUnit unit ) 294 294 { 295 295 // psPlane *lin; … … 298 298 double tmpR = 0.0; 299 299 double tmpD = 0.0; 300 301 if ( mode == PS_LINEAR) {302 // XXX: I have no idea how to construct this. Maybe project both303 // sperical positions onto the plane, set the origin at one of the304 // points on the plane, then deproject?305 306 // XXX: Do I need to somehow scale this projection?307 // project position1? Will it project to (0.0, 0.0)?308 proj.R = position1->r;309 proj.D = position1->d;310 proj.Xs = 1.0;311 proj.Ys = 1.0;312 proj.type = PS_PROJ_TAN;313 314 // lin = psProject(position2, proj);315 // tmp = psDeproject(lin, proj);316 317 // XXX: Do we need to convert units in tmp?318 return(tmp);319 } else if (mode == PS_SPHERICAL) {320 tmpR = position2->r - position1->r;321 tmpD = position2->d - position1->d;322 323 if (unit == PS_ARCSEC) {324 tmpR = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;325 tmpD = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;326 } else if (unit == PS_ARCMIN) {327 tmpR = (tmpR * 180.0 * 60.0) / M_PI;328 tmpD = (tmpR * 180.0 * 60.0) / M_PI;329 } else if (unit == PS_DEGREE) {330 tmpR = (tmpR * 180.0) / M_PI;331 tmpD = (tmpR * 180.0) / M_PI;332 } else if (unit == PS_RADIAN) {}333 else {334 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);335 }336 337 tmp = (psSphere *) psAlloc(sizeof(psSphere));338 tmp->r = tmpR;339 tmp->d = tmpD;340 tmp->rErr = 0.0;341 tmp->dErr = 0.0;342 // XXX: Do we need to wrap these to an acceptable range?343 return(tmp);344 }345 psAbort( __func__, "Unrecognized offset mode\n");346 return (NULL);300 301 if ( mode == PS_LINEAR ) { 302 // XXX: I have no idea how to construct this. Maybe project both 303 // sperical positions onto the plane, set the origin at one of the 304 // points on the plane, then deproject? 305 306 // XXX: Do I need to somehow scale this projection? 307 // project position1? Will it project to (0.0, 0.0)? 308 proj.R = position1->r; 309 proj.D = position1->d; 310 proj.Xs = 1.0; 311 proj.Ys = 1.0; 312 proj.type = PS_PROJ_TAN; 313 314 // lin = psProject(position2, proj); 315 // tmp = psDeproject(lin, proj); 316 317 // XXX: Do we need to convert units in tmp? 318 return ( tmp ); 319 } else if ( mode == PS_SPHERICAL ) { 320 tmpR = position2->r - position1->r; 321 tmpD = position2->d - position1->d; 322 323 if ( unit == PS_ARCSEC ) { 324 tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI; 325 tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI; 326 } else if ( unit == PS_ARCMIN ) { 327 tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI; 328 tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI; 329 } else if ( unit == PS_DEGREE ) { 330 tmpR = ( tmpR * 180.0 ) / M_PI; 331 tmpD = ( tmpR * 180.0 ) / M_PI; 332 } else if ( unit == PS_RADIAN ) {} 333 else { 334 psAbort( __func__, "Unknown offset unit: 0x%x\n", unit ); 335 } 336 337 tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 338 tmp->r = tmpR; 339 tmp->d = tmpD; 340 tmp->rErr = 0.0; 341 tmp->dErr = 0.0; 342 // XXX: Do we need to wrap these to an acceptable range? 343 return ( tmp ); 344 } 345 psAbort( __func__, "Unrecognized offset mode\n" ); 346 return ( NULL ); 347 347 } 348 348 … … 351 351 // Maybe, if the points are on the North/South Pole, etc? 352 352 // XXX: I copied the algorithm from the ADD exactly. 353 psSphere *psSphereSetOffset( const psSphere *restrict position,354 const psSphere *restrict offset,355 psSphereOffsetMode mode,356 psSphereOffsetUnit unit)353 psSphere *psSphereSetOffset( const psSphere *restrict position, 354 const psSphere *restrict offset, 355 psSphereOffsetMode mode, 356 psSphereOffsetUnit unit ) 357 357 { 358 358 psPlane lin; … … 361 361 double tmpR = 0.0; 362 362 double tmpD = 0.0; 363 364 if ( mode == PS_LINEAR) {365 proj.R = position->r;366 proj.D = position->d;367 proj.Xs = 1.0;368 proj.Ys = 1.0;369 proj.type = PS_PROJ_TAN;370 371 lin.x = offset->r;372 lin.y = offset->d;373 374 tmp = psDeproject(&lin, &proj);375 return(tmp);376 377 } else if (mode == PS_SPHERICAL) {378 if (unit == PS_ARCSEC) {379 tmpR = (M_PI * offset->r) / (180.0 * 60.0 * 60.0);380 tmpD = (M_PI * offset->d) / (180.0 * 60.0 * 60.0);381 } else if (unit == PS_ARCMIN) {382 tmpR = (M_PI * offset->r) / (180.0 * 60.0);383 tmpD = (M_PI * offset->d) / (180.0 * 60.0);384 } else if (unit == PS_DEGREE) {385 tmpR = (M_PI * offset->r) / (180.0);386 tmpD = (M_PI * offset->d) / (180.0);387 } else if (unit == PS_RADIAN) {388 tmpR = offset->r;389 tmpD = offset->d;390 } else {391 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);392 }393 394 tmp = (psSphere *) psAlloc(sizeof(psSphere));395 tmp->r = position->r + tmpR;396 tmp->r = position->d + tmpD;397 tmp->rErr = 0.0;398 tmp->dErr = 0.0;399 400 // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)401 // and (0 to 2*PI).402 return(tmp);403 }404 psAbort( __func__, "Unrecognized offset mode\n");405 return (NULL);406 } 363 364 if ( mode == PS_LINEAR ) { 365 proj.R = position->r; 366 proj.D = position->d; 367 proj.Xs = 1.0; 368 proj.Ys = 1.0; 369 proj.type = PS_PROJ_TAN; 370 371 lin.x = offset->r; 372 lin.y = offset->d; 373 374 tmp = psDeproject( &lin, &proj ); 375 return ( tmp ); 376 377 } else if ( mode == PS_SPHERICAL ) { 378 if ( unit == PS_ARCSEC ) { 379 tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 ); 380 tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 ); 381 } else if ( unit == PS_ARCMIN ) { 382 tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 ); 383 tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 ); 384 } else if ( unit == PS_DEGREE ) { 385 tmpR = ( M_PI * offset->r ) / ( 180.0 ); 386 tmpD = ( M_PI * offset->d ) / ( 180.0 ); 387 } else if ( unit == PS_RADIAN ) { 388 tmpR = offset->r; 389 tmpD = offset->d; 390 } else { 391 psAbort( __func__, "Unknown offset unit: 0x%x\n", unit ); 392 } 393 394 tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 395 tmp->r = position->r + tmpR; 396 tmp->r = position->d + tmpD; 397 tmp->rErr = 0.0; 398 tmp->dErr = 0.0; 399 400 // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI) 401 // and (0 to 2*PI). 402 return ( tmp ); 403 } 404 psAbort( __func__, "Unrecognized offset mode\n" ); 405 return ( NULL ); 406 } -
trunk/psLib/src/astro/psCoord.h
r1325 r1374 1 1 /** @file psCoord.h 2 *3 * @brief Contains basic coordinate transformation definitions and operations4 *5 * This file defines the basic types for astronomical coordinate6 * transformation7 *8 * @ingroup AstroImage 9 *10 * @author George Gusciora, MHPCC11 *12 * @version $Revision: 1.6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-29 02:08:02$14 *15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii16 */2 * 3 * @brief Contains basic coordinate transformation definitions and operations 4 * 5 * This file defines the basic types for astronomical coordinate 6 * transformation 7 * 8 * @ingroup CoordinateTransform 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 17 17 18 18 # ifndef PS_COORD_H … … 26 26 #include "psTime.h" 27 27 28 /// @addtogroup CoordinateTransform 29 /// @{ 30 28 31 typedef struct 29 {30 double x; ///< x position31 double y; ///< y position32 double xErr; ///< Error in x position33 double yErr; ///< Error in y position34 }32 { 33 double x; ///< x position 34 double y; ///< y position 35 double xErr; ///< Error in x position 36 double yErr; ///< Error in y position 37 } 35 38 psPlane; 36 39 37 40 typedef struct 38 {39 double r; ///< RA40 double d; ///< Dec41 double rErr; ///< Error in RA42 double dErr; ///< Error in Dec43 }41 { 42 double r; ///< RA 43 double d; ///< Dec 44 double rErr; ///< Error in RA 45 double dErr; ///< Error in Dec 46 } 44 47 psSphere; 45 48 46 49 typedef struct 47 {48 psDPolynomial2D *x;49 psDPolynomial2D *y;50 }50 { 51 psDPolynomial2D *x; 52 psDPolynomial2D *y; 53 } 51 54 psPlaneTransform; 52 55 53 56 typedef struct 54 {55 psDPolynomial4D *x;56 psDPolynomial4D *y;57 }57 { 58 psDPolynomial4D *x; 59 psDPolynomial4D *y; 60 } 58 61 psPlaneDistort; 59 62 60 63 typedef struct 61 {62 double sinPhi; ///< sin of North Pole lattitude63 double cosPhi; ///< cos of North Pole lattitude64 double Xo; ///< First PT of Ares lon65 double xo; ///< First PT of Ares equiv lon66 }64 { 65 double sinPhi; ///< sin of North Pole lattitude 66 double cosPhi; ///< cos of North Pole lattitude 67 double Xo; ///< First PT of Ares lon 68 double xo; ///< First PT of Ares equiv lon 69 } 67 70 psSphereTransform; 68 71 69 72 typedef enum { 70 PS_PROJ_TAN, ///< Tangent projection71 PS_PROJ_SIN, ///< Sine projection72 PS_PROJ_AIT, ///< Aitoff projection73 PS_PROJ_PAR, ///< Par projection74 PS_PROJ_GLS, ///< GLS projection75 PS_PROJ_CAR, ///< CAR projection76 PS_PROJ_MER, ///< MER projection73 PS_PROJ_TAN, ///< Tangent projection 74 PS_PROJ_SIN, ///< Sine projection 75 PS_PROJ_AIT, ///< Aitoff projection 76 PS_PROJ_PAR, ///< Par projection 77 PS_PROJ_GLS, ///< GLS projection 78 PS_PROJ_CAR, ///< CAR projection 79 PS_PROJ_MER, ///< MER projection 77 80 PS_PROJ_NTYPE ///< Number of types; must be last. 78 81 } psProjectionType; 79 82 80 83 typedef struct 81 {82 double R; ///< Coordinates of projection center83 double D; ///< Coordinates of projection center84 double Xs; ///< plate-scale in X direction85 double Ys; ///< plate-scale in Y direction86 psProjectionType type; ///< Projection type87 }84 { 85 double R; ///< Coordinates of projection center 86 double D; ///< Coordinates of projection center 87 double Xs; ///< plate-scale in X direction 88 double Ys; ///< plate-scale in Y direction 89 psProjectionType type; ///< Projection type 90 } 88 91 psProjection; 89 92 … … 100 103 } psSphereOffsetUnit; 101 104 102 psPlane *psPlaneTransformApply(psPlane *out, 103 const psPlaneTransform *transform, 104 const psPlane *coords); 105 psPlane *psPlaneTransformApply( psPlane *out, 106 const psPlaneTransform *transform, 107 const psPlane *coords ); 108 109 psPlane *psPlaneDistortApply( psPlane *out, 110 const psPlaneDistort *transform, 111 const psPlane *coords, 112 float term3, 113 float term4 ); 114 115 116 // New function prototype. 117 psSphereTransform *psSphereTransformAlloc( double NPlat, 118 double Xo, 119 double xo ); 120 121 void p_psSphereTransformFree( psSphereTransform *trans ); 105 122 106 psPlane *psPlaneDistortApply(psPlane *out, 107 const psPlaneDistort *transform, 108 const psPlane *coords, 109 float term3, 110 float term4); 123 psSphere *psSphereTransformApply( psSphere *out, 124 const psSphereTransform *transform, 125 const psSphere *coord ); 126 127 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time ); 128 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time ); 129 psSphereTransform *psSphereTransformICRStoGalatic( void ); 130 psSphereTransform *psSphereTransformGalatictoICRS( void ); 111 131 112 113 // New function prototype. 114 psSphereTransform *psSphereTransformAlloc(double NPlat, 115 double Xo, 116 double xo); 117 118 void p_psSphereTransformFree(psSphereTransform *trans); 119 120 psSphere *psSphereTransformApply(psSphere *out, 121 const psSphereTransform *transform, 122 const psSphere *coord); 123 124 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time); 125 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time); 126 psSphereTransform *psSphereTransformICRStoGalatic(void); 127 psSphereTransform *psSphereTransformGalatictoICRS(void); 128 129 psPlane *psProject(const psSphere *coord, 130 const psProjection *projection); 131 132 psSphere *psDeproject(const psPlane *coord, 133 const psProjection *projection); 134 135 psSphere *psSphereGetOffset(const psSphere *restrict position1, 136 const psSphere *restrict position2, 137 psSphereOffsetMode mode, 138 psSphereOffsetUnit unit); 139 140 psSphere *psSphereSetOffset(const psSphere *restrict position, 141 const psSphere *restrict offset, 142 psSphereOffsetMode mode, 143 psSphereOffsetUnit unit); 144 132 psPlane *psProject( const psSphere *coord, 133 const psProjection *projection ); 134 135 psSphere *psDeproject( const psPlane *coord, 136 const psProjection *projection ); 137 138 psSphere *psSphereGetOffset( const psSphere *restrict position1, 139 const psSphere *restrict position2, 140 psSphereOffsetMode mode, 141 psSphereOffsetUnit unit ); 142 143 psSphere *psSphereSetOffset( const psSphere *restrict position, 144 const psSphere *restrict offset, 145 psSphereOffsetMode mode, 146 psSphereOffsetUnit unit ); 147 148 /// @} 145 149 146 150 #endif -
trunk/psLib/src/astronomy/psCoord.c
r1325 r1374 1 1 /** @file psCoord.c 2 *3 * @brief Contains basic coordinate transformation definitions and operations4 *5 * This file defines the basic types for astronomical coordinate6 * transformation7 *8 * @ingroup AstroImage 9 *10 * @author George Gusciora, MHPCC11 *12 * @version $Revision: 1.7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-29 02:08:02$14 *15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii16 */2 * 3 * @brief Contains basic coordinate transformation definitions and operations 4 * 5 * This file defines the basic types for astronomical coordinate 6 * transformation 7 * 8 * @ingroup CoordinateTransform 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 17 17 18 18 #include "psType.h" … … 28 28 29 29 // This is the only function in this file which I understand. 30 psPlane *psPlaneTransformApply( psPlane *out,31 const psPlaneTransform *transform,32 const psPlane *coords)33 { 34 if ( out == NULL) {35 out = (psPlane *) psAlloc(sizeof(psPlane));36 }37 out->x = transform->x->coeff[ 0][0] +38 ( transform->x->coeff[1][0] * coords->x) +39 ( transform->x->coeff[0][1] * coords->y);40 41 out->y = transform->y->coeff[ 0][0] +42 ( transform->y->coeff[1][0] * coords->x) +43 ( transform->y->coeff[0][1] * coords->y);44 45 return (out);30 psPlane *psPlaneTransformApply( psPlane *out, 31 const psPlaneTransform *transform, 32 const psPlane *coords ) 33 { 34 if ( out == NULL ) { 35 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 36 } 37 out->x = transform->x->coeff[ 0 ][ 0 ] + 38 ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) + 39 ( transform->x->coeff[ 0 ][ 1 ] * coords->y ); 40 41 out->y = transform->y->coeff[ 0 ][ 0 ] + 42 ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) + 43 ( transform->y->coeff[ 0 ][ 1 ] * coords->y ); 44 45 return ( out ); 46 46 } 47 47 … … 49 49 // This transformation takes into account parameters beyond an objects 50 50 // spatial coordinates: term3 and term4. 51 psPlane *psPlaneDistortApply( psPlane *out,52 const psPlaneDistort *transform,53 const psPlane *coords,54 float term3,55 float term4)56 { 57 if ( out == NULL) {58 out = (psPlane *) psAlloc(sizeof(psPlane));59 }60 61 out->x = transform->x->coeff[ 0][0][0][0] +62 ( transform->x->coeff[1][0][0][0] * coords->x) +63 ( transform->x->coeff[0][1][0][0] * coords->y) +64 ( transform->x->coeff[0][0][1][0] * term3) +65 ( transform->x->coeff[0][0][0][1] * term4);66 67 out->y = transform->y->coeff[ 0][0][0][0] +68 ( transform->y->coeff[1][0][0][0] * coords->x) +69 ( transform->y->coeff[0][1][0][0] * coords->y) +70 ( transform->y->coeff[0][0][1][0] * term3) +71 ( transform->y->coeff[0][0][0][1] * term4);72 73 return (out);51 psPlane *psPlaneDistortApply( psPlane *out, 52 const psPlaneDistort *transform, 53 const psPlane *coords, 54 float term3, 55 float term4 ) 56 { 57 if ( out == NULL ) { 58 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 59 } 60 61 out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] + 62 ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) + 63 ( transform->x->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) + 64 ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) + 65 ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 ); 66 67 out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] + 68 ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) + 69 ( transform->y->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) + 70 ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) + 71 ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 ); 72 73 return ( out ); 74 74 } 75 75 76 76 77 77 // This function prototype has been modified since the SDRS. 78 psSphereTransform *psSphereTransformAlloc( double NPlat,78 psSphereTransform *psSphereTransformAlloc( double NPlat, 79 79 double Xo, 80 double xo )81 { 82 psSphereTransform * tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));83 84 tmp->sinPhi = sin( NPlat);85 tmp->cosPhi = cos( NPlat);80 double xo ) 81 { 82 psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) ); 83 84 tmp->sinPhi = sin( NPlat ); 85 tmp->cosPhi = cos( NPlat ); 86 86 tmp->Xo = Xo; 87 87 tmp->xo = xo; 88 89 return (tmp);88 89 return ( tmp ); 90 90 } 91 91 92 92 // I understand this one too. 93 void p_psSphereTransformFree( psSphereTransform *trans)94 { 95 psFree( trans);93 void p_psSphereTransformFree( psSphereTransform *trans ) 94 { 95 psFree( trans ); 96 96 } 97 97 … … 103 103 // there are no typo's. 104 104 105 psSphere *psSphereTransformApply( psSphere *out,106 const psSphereTransform *transform,107 const psSphere *coord)105 psSphere *psSphereTransformApply( psSphere *out, 106 const psSphereTransform *transform, 107 const psSphere *coord ) 108 108 { 109 109 double sinY = 0.0; … … 114 114 double y = 0.0; 115 115 double dx = 0.0; 116 117 if ( out == NULL) {118 out = (psSphere *) psAlloc(sizeof(psSphere));119 }120 116 117 if ( out == NULL ) { 118 out = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 119 } 120 121 121 x = coord->r; 122 122 y = coord->d; 123 dx = x - transform->xo;124 sinY = cos( y)*sin(dx)*transform->sinPhi + sin(y)*transform->cosPhi;125 cosY = sqrt( 1.0 - sinY*sinY);126 sinX = ( cos(y)*sin(dx)*transform->cosPhi - sin(y)*transform->sinPhi) /127 cos( y);128 cosX = cos( y)*cos(dx) / cos(y);129 130 out->r = atan2( sinX, cosX) + transform->Xo;131 out->d = atan2( sinY, cosY);132 133 return (out);134 } 135 136 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time)137 { 138 struct tm * tmTime = psTimeToTM(time);139 double year = ( double) (1900 + tmTime->tm_year);123 dx = x - transform->xo; 124 sinY = cos( y ) * sin( dx ) * transform->sinPhi + sin( y ) * transform->cosPhi; 125 cosY = sqrt( 1.0 - sinY * sinY ); 126 sinX = ( cos( y ) * sin( dx ) * transform->cosPhi - sin( y ) * transform->sinPhi ) / 127 cos( y ); 128 cosX = cos( y ) * cos( dx ) / cos( y ); 129 130 out->r = atan2( sinX, cosX ) + transform->Xo; 131 out->d = atan2( sinY, cosY ); 132 133 return ( out ); 134 } 135 136 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time ) 137 { 138 struct tm * tmTime = psTimeToTM( time ); 139 double year = ( double ) ( 1900 + tmTime->tm_year ); 140 140 double T = year / 100.0; 141 double phi = -23.452294 + 0.013013 *T + 0.000001639*T*T - 0.000000503*T*T*T;141 double phi = -23.452294 + 0.013013 * T + 0.000001639 * T * T - 0.000000503 * T * T * T; 142 142 double Xo = 0.0; 143 143 double xo = 0.0; 144 145 return (psSphereTransformAlloc(phi, Xo, xo));146 } 147 148 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time)149 { 150 struct tm * tmTime = psTimeToTM(time);151 double year = ( double) (1900 + tmTime->tm_year);144 145 return ( psSphereTransformAlloc( phi, Xo, xo ) ); 146 } 147 148 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time ) 149 { 150 struct tm * tmTime = psTimeToTM( time ); 151 double year = ( double ) ( 1900 + tmTime->tm_year ); 152 152 double T = year / 100.0; 153 double phi = + 23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T;153 double phi = + 23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T; 154 154 double Xo = 0.0; 155 155 double xo = 0.0; 156 157 return (psSphereTransformAlloc(phi, Xo, xo));158 } 159 160 psSphereTransform *psSphereTransformICRStoGalatic( void)161 { 162 return (psSphereTransformAlloc(62.6, 282.25, 33.0));163 } 164 165 psSphereTransform *psSphereTransformGalatictoICRS( void)166 { 167 return (psSphereTransformAlloc(-62.6, 33.0, 282.25));156 157 return ( psSphereTransformAlloc( phi, Xo, xo ) ); 158 } 159 160 psSphereTransform *psSphereTransformICRStoGalatic( void ) 161 { 162 return ( psSphereTransformAlloc( 62.6, 282.25, 33.0 ) ); 163 } 164 165 psSphereTransform *psSphereTransformGalatictoICRS( void ) 166 { 167 return ( psSphereTransformAlloc( -62.6, 33.0, 282.25 ) ); 168 168 } 169 169 170 170 // XXX: Is this the correct way to calculate this? 171 float cot( float x)172 { 173 return (1.0 / atan(x));171 float cot( float x ) 172 { 173 return ( 1.0 / atan( x ) ); 174 174 } 175 175 176 176 // This is some kind of arc tan function. 177 float arg( float x, float y)178 { 179 if ( x > 0) {180 return(atan(y/x));181 } else if ((x==0) && (y==0)) {182 return(0.5 * M_PI);183 } else if ((x==0) && (y==0)) {184 return(-0.5 * M_PI);185 } else if ((x==0) && (y==0)) {186 return(M_PI + atan(y/x));187 } else if ((x==0) && (y==0)) {188 return(-M_PI + atan(y/x));189 }190 191 psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y);192 return (0.0);177 float arg( float x, float y ) 178 { 179 if ( x > 0 ) { 180 return ( atan( y / x ) ); 181 } else if ( ( x == 0 ) && ( y == 0 ) ) { 182 return ( 0.5 * M_PI ); 183 } else if ( ( x == 0 ) && ( y == 0 ) ) { 184 return ( -0.5 * M_PI ); 185 } else if ( ( x == 0 ) && ( y == 0 ) ) { 186 return ( M_PI + atan( y / x ) ); 187 } else if ( ( x == 0 ) && ( y == 0 ) ) { 188 return ( -M_PI + atan( y / x ) ); 189 } 190 191 psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y ); 192 return ( 0.0 ); 193 193 } 194 194 195 195 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 196 196 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 197 psPlane *psProject( const psSphere *coord,198 const psProjection *projection)197 psPlane *psProject( const psSphere *coord, 198 const psProjection *projection ) 199 199 { 200 200 float R = 0.0; 201 201 float alpha = 0.0; 202 psPlane *tmp = (psPlane *) psAlloc(sizeof(psPlane));203 204 if ( projection->type == PS_PROJ_TAN) {205 R = cot(coord->r) * (180.0 / M_PI);206 tmp->x = R * sin(coord->d);207 tmp->y = R * cos(coord->d);208 209 } else if (projection->type == PS_PROJ_SIN) {210 R = cos(coord->r) * (180.0 / M_PI);211 tmp->x = R * sin(coord->d);212 tmp->y = R * cos(coord->d);213 214 } else if (projection->type == PS_PROJ_CAR) {215 tmp->x = coord->d;216 tmp->y = coord->r;217 218 } else if (projection->type == PS_PROJ_MER) {219 tmp->x = coord->d;220 tmp->y = log(tan(45.0 + (0.5 * coord->r))) * 180.0/M_PI;221 222 } else if (projection->type == PS_PROJ_AIT) {223 alpha = 1.0 / ((180.0 / M_PI) *224 sqrt(1.0 + (cos(coord->r) * cos(0.5 * coord->d) * 0.5)));225 226 tmp->x = 2.0 * alpha * cos(coord->r) * sin(0.5 * coord->d);227 tmp->y = alpha * sin(coord->d);228 229 } else if (projection->type == PS_PROJ_PAR) {230 psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");231 232 } else if (projection->type == PS_PROJ_GLS) {233 psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");234 }235 236 return (tmp);202 psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 203 204 if ( projection->type == PS_PROJ_TAN ) { 205 R = cot( coord->r ) * ( 180.0 / M_PI ); 206 tmp->x = R * sin( coord->d ); 207 tmp->y = R * cos( coord->d ); 208 209 } else if ( projection->type == PS_PROJ_SIN ) { 210 R = cos( coord->r ) * ( 180.0 / M_PI ); 211 tmp->x = R * sin( coord->d ); 212 tmp->y = R * cos( coord->d ); 213 214 } else if ( projection->type == PS_PROJ_CAR ) { 215 tmp->x = coord->d; 216 tmp->y = coord->r; 217 218 } else if ( projection->type == PS_PROJ_MER ) { 219 tmp->x = coord->d; 220 tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI; 221 222 } else if ( projection->type == PS_PROJ_AIT ) { 223 alpha = 1.0 / ( ( 180.0 / M_PI ) * 224 sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) ); 225 226 tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d ); 227 tmp->y = alpha * sin( coord->d ); 228 229 } else if ( projection->type == PS_PROJ_PAR ) { 230 psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" ); 231 232 } else if ( projection->type == PS_PROJ_GLS ) { 233 psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" ); 234 } 235 236 return ( tmp ); 237 237 } 238 238 239 239 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 240 240 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 241 psSphere *psDeproject( const psPlane *coord,242 const psProjection *projection)241 psSphere *psDeproject( const psPlane *coord, 242 const psProjection *projection ) 243 243 { 244 244 float R = 0.0; … … 246 246 float chu1 = 0.0; 247 247 float chu2 = 0.0; 248 psSphere *tmp = (psSphere *) psAlloc(sizeof(psSphere));249 250 if ( projection->type == PS_PROJ_TAN) {251 R = sqrt((coord->x * coord->x) + (coord->y * coord->y));252 tmp->d = arg(-coord->y, coord->x);253 tmp->r = atan(180.0 / (R * M_PI));254 255 } else if (projection->type == PS_PROJ_SIN) {256 R = sqrt((coord->x * coord->x) + (coord->y * coord->y));257 tmp->d = arg(-coord->y, coord->x);258 tmp->r = acos((R * M_PI) / 180.0);259 260 } else if (projection->type == PS_PROJ_CAR) {261 tmp->d = coord->x;262 tmp->r = coord->y;263 264 } else if (projection->type == PS_PROJ_MER) {265 tmp->d = coord->x;266 tmp->r = (2.0 * atan(exp((coord->y * M_PI/180.0)))) - 180.0;267 268 } else if (projection->type == PS_PROJ_AIT) {269 chu1 = (coord->x * M_PI) / 720.0;270 chu1*= chu1;271 chu2 = (coord->y * M_PI) / 360.0;272 chu2*= chu2;273 chu = sqrt(1.0 - chu1 - chu2);274 tmp->d = 2.0 * arg((2.0 * chu * chu) - 1.0,275 (coord->x * chu * M_PI)/360.0);276 tmp->r = asin((coord->y * chu * M_PI) / 180.0);277 278 } else if (projection->type == PS_PROJ_PAR) {279 psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");280 281 } else if (projection->type == PS_PROJ_GLS) {282 psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");283 }284 285 return (tmp);248 psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 249 250 if ( projection->type == PS_PROJ_TAN ) { 251 R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) ); 252 tmp->d = arg( -coord->y, coord->x ); 253 tmp->r = atan( 180.0 / ( R * M_PI ) ); 254 255 } else if ( projection->type == PS_PROJ_SIN ) { 256 R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) ); 257 tmp->d = arg( -coord->y, coord->x ); 258 tmp->r = acos( ( R * M_PI ) / 180.0 ); 259 260 } else if ( projection->type == PS_PROJ_CAR ) { 261 tmp->d = coord->x; 262 tmp->r = coord->y; 263 264 } else if ( projection->type == PS_PROJ_MER ) { 265 tmp->d = coord->x; 266 tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0; 267 268 } else if ( projection->type == PS_PROJ_AIT ) { 269 chu1 = ( coord->x * M_PI ) / 720.0; 270 chu1 *= chu1; 271 chu2 = ( coord->y * M_PI ) / 360.0; 272 chu2 *= chu2; 273 chu = sqrt( 1.0 - chu1 - chu2 ); 274 tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0, 275 ( coord->x * chu * M_PI ) / 360.0 ); 276 tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 ); 277 278 } else if ( projection->type == PS_PROJ_PAR ) { 279 psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" ); 280 281 } else if ( projection->type == PS_PROJ_GLS ) { 282 psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" ); 283 } 284 285 return ( tmp ); 286 286 } 287 287 288 288 // XXX: Do I need to check for unacceptable transformation parameters? 289 289 // Maybe, if the points are on the North/South Pole, etc? 290 psSphere *psSphereGetOffset( const psSphere *restrict position1,291 const psSphere *restrict position2,292 psSphereOffsetMode mode,293 psSphereOffsetUnit unit)290 psSphere *psSphereGetOffset( const psSphere *restrict position1, 291 const psSphere *restrict position2, 292 psSphereOffsetMode mode, 293 psSphereOffsetUnit unit ) 294 294 { 295 295 // psPlane *lin; … … 298 298 double tmpR = 0.0; 299 299 double tmpD = 0.0; 300 301 if ( mode == PS_LINEAR) {302 // XXX: I have no idea how to construct this. Maybe project both303 // sperical positions onto the plane, set the origin at one of the304 // points on the plane, then deproject?305 306 // XXX: Do I need to somehow scale this projection?307 // project position1? Will it project to (0.0, 0.0)?308 proj.R = position1->r;309 proj.D = position1->d;310 proj.Xs = 1.0;311 proj.Ys = 1.0;312 proj.type = PS_PROJ_TAN;313 314 // lin = psProject(position2, proj);315 // tmp = psDeproject(lin, proj);316 317 // XXX: Do we need to convert units in tmp?318 return(tmp);319 } else if (mode == PS_SPHERICAL) {320 tmpR = position2->r - position1->r;321 tmpD = position2->d - position1->d;322 323 if (unit == PS_ARCSEC) {324 tmpR = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;325 tmpD = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;326 } else if (unit == PS_ARCMIN) {327 tmpR = (tmpR * 180.0 * 60.0) / M_PI;328 tmpD = (tmpR * 180.0 * 60.0) / M_PI;329 } else if (unit == PS_DEGREE) {330 tmpR = (tmpR * 180.0) / M_PI;331 tmpD = (tmpR * 180.0) / M_PI;332 } else if (unit == PS_RADIAN) {}333 else {334 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);335 }336 337 tmp = (psSphere *) psAlloc(sizeof(psSphere));338 tmp->r = tmpR;339 tmp->d = tmpD;340 tmp->rErr = 0.0;341 tmp->dErr = 0.0;342 // XXX: Do we need to wrap these to an acceptable range?343 return(tmp);344 }345 psAbort( __func__, "Unrecognized offset mode\n");346 return (NULL);300 301 if ( mode == PS_LINEAR ) { 302 // XXX: I have no idea how to construct this. Maybe project both 303 // sperical positions onto the plane, set the origin at one of the 304 // points on the plane, then deproject? 305 306 // XXX: Do I need to somehow scale this projection? 307 // project position1? Will it project to (0.0, 0.0)? 308 proj.R = position1->r; 309 proj.D = position1->d; 310 proj.Xs = 1.0; 311 proj.Ys = 1.0; 312 proj.type = PS_PROJ_TAN; 313 314 // lin = psProject(position2, proj); 315 // tmp = psDeproject(lin, proj); 316 317 // XXX: Do we need to convert units in tmp? 318 return ( tmp ); 319 } else if ( mode == PS_SPHERICAL ) { 320 tmpR = position2->r - position1->r; 321 tmpD = position2->d - position1->d; 322 323 if ( unit == PS_ARCSEC ) { 324 tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI; 325 tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI; 326 } else if ( unit == PS_ARCMIN ) { 327 tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI; 328 tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI; 329 } else if ( unit == PS_DEGREE ) { 330 tmpR = ( tmpR * 180.0 ) / M_PI; 331 tmpD = ( tmpR * 180.0 ) / M_PI; 332 } else if ( unit == PS_RADIAN ) {} 333 else { 334 psAbort( __func__, "Unknown offset unit: 0x%x\n", unit ); 335 } 336 337 tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 338 tmp->r = tmpR; 339 tmp->d = tmpD; 340 tmp->rErr = 0.0; 341 tmp->dErr = 0.0; 342 // XXX: Do we need to wrap these to an acceptable range? 343 return ( tmp ); 344 } 345 psAbort( __func__, "Unrecognized offset mode\n" ); 346 return ( NULL ); 347 347 } 348 348 … … 351 351 // Maybe, if the points are on the North/South Pole, etc? 352 352 // XXX: I copied the algorithm from the ADD exactly. 353 psSphere *psSphereSetOffset( const psSphere *restrict position,354 const psSphere *restrict offset,355 psSphereOffsetMode mode,356 psSphereOffsetUnit unit)353 psSphere *psSphereSetOffset( const psSphere *restrict position, 354 const psSphere *restrict offset, 355 psSphereOffsetMode mode, 356 psSphereOffsetUnit unit ) 357 357 { 358 358 psPlane lin; … … 361 361 double tmpR = 0.0; 362 362 double tmpD = 0.0; 363 364 if ( mode == PS_LINEAR) {365 proj.R = position->r;366 proj.D = position->d;367 proj.Xs = 1.0;368 proj.Ys = 1.0;369 proj.type = PS_PROJ_TAN;370 371 lin.x = offset->r;372 lin.y = offset->d;373 374 tmp = psDeproject(&lin, &proj);375 return(tmp);376 377 } else if (mode == PS_SPHERICAL) {378 if (unit == PS_ARCSEC) {379 tmpR = (M_PI * offset->r) / (180.0 * 60.0 * 60.0);380 tmpD = (M_PI * offset->d) / (180.0 * 60.0 * 60.0);381 } else if (unit == PS_ARCMIN) {382 tmpR = (M_PI * offset->r) / (180.0 * 60.0);383 tmpD = (M_PI * offset->d) / (180.0 * 60.0);384 } else if (unit == PS_DEGREE) {385 tmpR = (M_PI * offset->r) / (180.0);386 tmpD = (M_PI * offset->d) / (180.0);387 } else if (unit == PS_RADIAN) {388 tmpR = offset->r;389 tmpD = offset->d;390 } else {391 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);392 }393 394 tmp = (psSphere *) psAlloc(sizeof(psSphere));395 tmp->r = position->r + tmpR;396 tmp->r = position->d + tmpD;397 tmp->rErr = 0.0;398 tmp->dErr = 0.0;399 400 // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)401 // and (0 to 2*PI).402 return(tmp);403 }404 psAbort( __func__, "Unrecognized offset mode\n");405 return (NULL);406 } 363 364 if ( mode == PS_LINEAR ) { 365 proj.R = position->r; 366 proj.D = position->d; 367 proj.Xs = 1.0; 368 proj.Ys = 1.0; 369 proj.type = PS_PROJ_TAN; 370 371 lin.x = offset->r; 372 lin.y = offset->d; 373 374 tmp = psDeproject( &lin, &proj ); 375 return ( tmp ); 376 377 } else if ( mode == PS_SPHERICAL ) { 378 if ( unit == PS_ARCSEC ) { 379 tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 ); 380 tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 ); 381 } else if ( unit == PS_ARCMIN ) { 382 tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 ); 383 tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 ); 384 } else if ( unit == PS_DEGREE ) { 385 tmpR = ( M_PI * offset->r ) / ( 180.0 ); 386 tmpD = ( M_PI * offset->d ) / ( 180.0 ); 387 } else if ( unit == PS_RADIAN ) { 388 tmpR = offset->r; 389 tmpD = offset->d; 390 } else { 391 psAbort( __func__, "Unknown offset unit: 0x%x\n", unit ); 392 } 393 394 tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) ); 395 tmp->r = position->r + tmpR; 396 tmp->r = position->d + tmpD; 397 tmp->rErr = 0.0; 398 tmp->dErr = 0.0; 399 400 // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI) 401 // and (0 to 2*PI). 402 return ( tmp ); 403 } 404 psAbort( __func__, "Unrecognized offset mode\n" ); 405 return ( NULL ); 406 } -
trunk/psLib/src/astronomy/psCoord.h
r1325 r1374 1 1 /** @file psCoord.h 2 *3 * @brief Contains basic coordinate transformation definitions and operations4 *5 * This file defines the basic types for astronomical coordinate6 * transformation7 *8 * @ingroup AstroImage 9 *10 * @author George Gusciora, MHPCC11 *12 * @version $Revision: 1.6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-29 02:08:02$14 *15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii16 */2 * 3 * @brief Contains basic coordinate transformation definitions and operations 4 * 5 * This file defines the basic types for astronomical coordinate 6 * transformation 7 * 8 * @ingroup CoordinateTransform 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 17 17 18 18 # ifndef PS_COORD_H … … 26 26 #include "psTime.h" 27 27 28 /// @addtogroup CoordinateTransform 29 /// @{ 30 28 31 typedef struct 29 {30 double x; ///< x position31 double y; ///< y position32 double xErr; ///< Error in x position33 double yErr; ///< Error in y position34 }32 { 33 double x; ///< x position 34 double y; ///< y position 35 double xErr; ///< Error in x position 36 double yErr; ///< Error in y position 37 } 35 38 psPlane; 36 39 37 40 typedef struct 38 {39 double r; ///< RA40 double d; ///< Dec41 double rErr; ///< Error in RA42 double dErr; ///< Error in Dec43 }41 { 42 double r; ///< RA 43 double d; ///< Dec 44 double rErr; ///< Error in RA 45 double dErr; ///< Error in Dec 46 } 44 47 psSphere; 45 48 46 49 typedef struct 47 {48 psDPolynomial2D *x;49 psDPolynomial2D *y;50 }50 { 51 psDPolynomial2D *x; 52 psDPolynomial2D *y; 53 } 51 54 psPlaneTransform; 52 55 53 56 typedef struct 54 {55 psDPolynomial4D *x;56 psDPolynomial4D *y;57 }57 { 58 psDPolynomial4D *x; 59 psDPolynomial4D *y; 60 } 58 61 psPlaneDistort; 59 62 60 63 typedef struct 61 {62 double sinPhi; ///< sin of North Pole lattitude63 double cosPhi; ///< cos of North Pole lattitude64 double Xo; ///< First PT of Ares lon65 double xo; ///< First PT of Ares equiv lon66 }64 { 65 double sinPhi; ///< sin of North Pole lattitude 66 double cosPhi; ///< cos of North Pole lattitude 67 double Xo; ///< First PT of Ares lon 68 double xo; ///< First PT of Ares equiv lon 69 } 67 70 psSphereTransform; 68 71 69 72 typedef enum { 70 PS_PROJ_TAN, ///< Tangent projection71 PS_PROJ_SIN, ///< Sine projection72 PS_PROJ_AIT, ///< Aitoff projection73 PS_PROJ_PAR, ///< Par projection74 PS_PROJ_GLS, ///< GLS projection75 PS_PROJ_CAR, ///< CAR projection76 PS_PROJ_MER, ///< MER projection73 PS_PROJ_TAN, ///< Tangent projection 74 PS_PROJ_SIN, ///< Sine projection 75 PS_PROJ_AIT, ///< Aitoff projection 76 PS_PROJ_PAR, ///< Par projection 77 PS_PROJ_GLS, ///< GLS projection 78 PS_PROJ_CAR, ///< CAR projection 79 PS_PROJ_MER, ///< MER projection 77 80 PS_PROJ_NTYPE ///< Number of types; must be last. 78 81 } psProjectionType; 79 82 80 83 typedef struct 81 {82 double R; ///< Coordinates of projection center83 double D; ///< Coordinates of projection center84 double Xs; ///< plate-scale in X direction85 double Ys; ///< plate-scale in Y direction86 psProjectionType type; ///< Projection type87 }84 { 85 double R; ///< Coordinates of projection center 86 double D; ///< Coordinates of projection center 87 double Xs; ///< plate-scale in X direction 88 double Ys; ///< plate-scale in Y direction 89 psProjectionType type; ///< Projection type 90 } 88 91 psProjection; 89 92 … … 100 103 } psSphereOffsetUnit; 101 104 102 psPlane *psPlaneTransformApply(psPlane *out, 103 const psPlaneTransform *transform, 104 const psPlane *coords); 105 psPlane *psPlaneTransformApply( psPlane *out, 106 const psPlaneTransform *transform, 107 const psPlane *coords ); 108 109 psPlane *psPlaneDistortApply( psPlane *out, 110 const psPlaneDistort *transform, 111 const psPlane *coords, 112 float term3, 113 float term4 ); 114 115 116 // New function prototype. 117 psSphereTransform *psSphereTransformAlloc( double NPlat, 118 double Xo, 119 double xo ); 120 121 void p_psSphereTransformFree( psSphereTransform *trans ); 105 122 106 psPlane *psPlaneDistortApply(psPlane *out, 107 const psPlaneDistort *transform, 108 const psPlane *coords, 109 float term3, 110 float term4); 123 psSphere *psSphereTransformApply( psSphere *out, 124 const psSphereTransform *transform, 125 const psSphere *coord ); 126 127 psSphereTransform *psSphereTransformICRStoEcliptic( psTime time ); 128 psSphereTransform *psSphereTransformEcliptictoICRS( psTime time ); 129 psSphereTransform *psSphereTransformICRStoGalatic( void ); 130 psSphereTransform *psSphereTransformGalatictoICRS( void ); 111 131 112 113 // New function prototype. 114 psSphereTransform *psSphereTransformAlloc(double NPlat, 115 double Xo, 116 double xo); 117 118 void p_psSphereTransformFree(psSphereTransform *trans); 119 120 psSphere *psSphereTransformApply(psSphere *out, 121 const psSphereTransform *transform, 122 const psSphere *coord); 123 124 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time); 125 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time); 126 psSphereTransform *psSphereTransformICRStoGalatic(void); 127 psSphereTransform *psSphereTransformGalatictoICRS(void); 128 129 psPlane *psProject(const psSphere *coord, 130 const psProjection *projection); 131 132 psSphere *psDeproject(const psPlane *coord, 133 const psProjection *projection); 134 135 psSphere *psSphereGetOffset(const psSphere *restrict position1, 136 const psSphere *restrict position2, 137 psSphereOffsetMode mode, 138 psSphereOffsetUnit unit); 139 140 psSphere *psSphereSetOffset(const psSphere *restrict position, 141 const psSphere *restrict offset, 142 psSphereOffsetMode mode, 143 psSphereOffsetUnit unit); 144 132 psPlane *psProject( const psSphere *coord, 133 const psProjection *projection ); 134 135 psSphere *psDeproject( const psPlane *coord, 136 const psProjection *projection ); 137 138 psSphere *psSphereGetOffset( const psSphere *restrict position1, 139 const psSphere *restrict position2, 140 psSphereOffsetMode mode, 141 psSphereOffsetUnit unit ); 142 143 psSphere *psSphereSetOffset( const psSphere *restrict position, 144 const psSphere *restrict offset, 145 psSphereOffsetMode mode, 146 psSphereOffsetUnit unit ); 147 148 /// @} 145 149 146 150 #endif -
trunk/psLib/src/astronomy/psCoord2.c
r1325 r1374 1 // This file contains 1 /** @file psCoord2.c 2 * 3 * @brief Contains basic coordinate transformation definitions and operations 4 * 5 * This file defines the basic types for astronomical coordinate 6 * transformation 7 * 8 * @ingroup CoordinateTransform 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 2 17 3 18 #include "psType.h" … … 7 22 #include "psFunctions.h" 8 23 9 psGrommit *psGrommitAlloc( const psExposure *exp)10 { 11 psGrommit * grommit = (psGrommit *) psAlloc(sizeof(psGrommit));12 24 psGrommit *psGrommitAlloc( const psExposure *exp ) 25 { 26 psGrommit * grommit = ( psGrommit * ) psAlloc( sizeof( psGrommit ) ); 27 13 28 grommit->latitude = exp->dec; // XXX Is this correct? 14 grommit->sinLat = sin( grommit->latitude);15 grommit->cosLat = cos( grommit->latitude);29 grommit->sinLat = sin( grommit->latitude ); 30 grommit->cosLat = cos( grommit->latitude ); 16 31 grommit->abberationMag = 0.0; 17 32 grommit->height = 0.0; … … 25 40 grommit->longitudeOffset = ra; // XXX Is this correct? 26 41 grommit->siderealTime = 0.0; 27 28 return (grommit);29 } 30 31 void p_psGrommitFree( psGrommit *grommit)32 { 33 psFree( grommit);34 } 35 36 psCell *psCellinFPA( psCell *out,37 const psPlane *coord,38 const psFPA *FPA)39 { 40 psChip * tmpChip = NULL;42 43 return ( grommit ); 44 } 45 46 void p_psGrommitFree( psGrommit *grommit ) 47 { 48 psFree( grommit ); 49 } 50 51 psCell *psCellinFPA( psCell *out, 52 const psPlane *coord, 53 const psFPA *FPA ) 54 { 55 psChip * tmpChip = NULL; 41 56 psCell *tmpCell = NULL; 42 43 tmpChip = psChipinFPA( tmpChip, coord, FPA);44 tmpCell = psCellinChip( tmpCell, coord, tmpChip);45 return (tmpCell);46 } 47 48 49 psChip *psChipinFPA( psChip *out,50 const psPlane *coord,51 const psFPA *FPA)52 { 53 psFPA * tmpChip = NULL;54 55 for ( tmpChip = FPA->chips; tmpChip != NULL; tmpChip++) {56 tmpCoord = psPlaneTransformApply(out, tmpChip->fromFPA, coord);57 58 59 //XXX if (this is the correct chip)60 return(tmpChip);61 }57 58 tmpChip = psChipinFPA( tmpChip, coord, FPA ); 59 tmpCell = psCellinChip( tmpCell, coord, tmpChip ); 60 return ( tmpCell ); 61 } 62 63 64 psChip *psChipinFPA( psChip *out, 65 const psPlane *coord, 66 const psFPA *FPA ) 67 { 68 psFPA * tmpChip = NULL; 69 70 for ( tmpChip = FPA->chips; tmpChip != NULL; tmpChip++ ) { 71 tmpCoord = psPlaneTransformApply( out, tmpChip->fromFPA, coord ); 72 73 74 //XXX if (this is the correct chip) 75 return ( tmpChip ); 76 } 62 77 } 63 78 … … 66 81 p_psCheckValidImageCoords(double x, double y, tmpImage) 67 82 { 68 if ( (x < 0.0) ||69 ( x > (double) tmpImage->numCols) ||70 ( y < 0.0) ||71 ( y > (double) tmpImage->numRows)) {72 return(0);73 }74 return (1);83 if ( ( x < 0.0 ) || 84 ( x > ( double ) tmpImage->numCols ) || 85 ( y < 0.0 ) || 86 ( y > ( double ) tmpImage->numRows ) ) { 87 return ( 0 ); 88 } 89 return ( 1 ); 75 90 } 76 91 … … 88 103 XXX: must deallocate memory. 89 104 *****************************************************************************/ 90 psCell *psCellinChip( psCell *out,91 const psPlane *coord,92 const psChip *chip)93 { 94 psCell * tmpCell = NULL;105 psCell *psCellinChip( psCell *out, 106 const psPlane *coord, 107 const psChip *chip ) 108 { 109 psCell * tmpCell = NULL; 95 110 psReadout *tmpReadout = NULL; 96 111 psPlane *tmpCoord = NULL; 97 98 for (tmpCell = chip->cells; tmpCell != NULL; tmpCell++) { 99 if (tmpCell->readouts != NULL) { 100 tmpReadout = tmpCell->readouts; 101 tmpCoord = psPlaneTransformApply(out, tmpCell->fromChip, coord); 102 if (p_psCheckValidImageCoords(tmpCoord->x, tmpCoord->y, 103 tmpReadout->image)) { 104 return(tmpCell); 105 } 112 113 for ( tmpCell = chip->cells; tmpCell != NULL; tmpCell++ ) { 114 if ( tmpCell->readouts != NULL ) { 115 tmpReadout = tmpCell->readouts; 116 tmpCoord = psPlaneTransformApply( out, tmpCell->fromChip, coord ); 117 if ( p_psCheckValidImageCoords( tmpCoord->x, tmpCoord->y, 118 tmpReadout->image ) ) { 119 return ( tmpCell ); 120 } 121 } 106 122 } 107 } 108 return(NULL); 109 } 110 111 psPlane *psCoordCelltoChip(psPlane *out, 123 return ( NULL ); 124 } 125 126 psPlane *psCoordCelltoChip( psPlane *out, 127 const psPlane *in, 128 const psCell *cell ) 129 { 130 return ( psPlaneTransformApply( out, cell->toChip, in ) ); 131 } 132 133 psPlane *psCoordChipToFPA( psPlane *out, 112 134 const psPlane *in, 113 const psCell *cell) 114 { 115 return(psPlaneTransformApply(out, cell->toChip, in)); 116 } 117 118 psPlane *psCoordChipToFPA(psPlane *out, 135 const psChip *chip ) 136 { 137 return ( psPlaneTransformApply( out, chip->toFPA, in ) ); 138 } 139 140 psPlane *psCoordFPAtoTP( psPlane *out, 141 const psPlane *in, 142 const psFPA *fpa ) 143 { 144 return ( psPlaneTransformApply( out, fpa->toTangentPlane, in ) ); 145 } 146 147 psSphere *psCoordTPtoSky( psSphere *out, 119 148 const psPlane *in, 120 const psChip *chip) 121 { 122 return(psPlaneTransformApply(out, chip->toFPA, in)); 123 } 124 125 psPlane *psCoordFPAtoTP(psPlane *out, 126 const psPlane *in, 127 const psFPA *fpa) 128 { 129 return(psPlaneTransformApply(out, fpa->toTangentPlane, in)); 130 } 131 132 psSphere *psCoordTPtoSky(psSphere *out, 133 const psPlane *in, 134 const psGrommit *grommit) 149 const psGrommit *grommit ) 135 150 {} 136 151 137 152 138 psPlane *psCoordCellToFPA( psPlane *out,139 const psPlane *in,140 const psCell *cell)141 { 142 return (psPlaneTransformApply(out, cell->toFPA, in));153 psPlane *psCoordCellToFPA( psPlane *out, 154 const psPlane *in, 155 const psCell *cell ) 156 { 157 return ( psPlaneTransformApply( out, cell->toFPA, in ) ); 143 158 } 144 159 … … 147 162 // transformation, as well as a few psPlane structs. Can this be implemented 148 163 // better? 149 psSphere *psCoordCelltoSky( psSphere *out,150 const psPlane *in,151 const psCell *cell)152 { 153 psPlane * tmp1 = NULL;164 psSphere *psCoordCelltoSky( psSphere *out, 165 const psPlane *in, 166 const psCell *cell ) 167 { 168 psPlane * tmp1 = NULL; 154 169 psPlane *tmp2 = NULL; 155 psFPA *parFPA = ( cell->parent)->parent;170 psFPA *parFPA = ( cell->parent ) ->parent; 156 171 psGrommit *tmpGrommit = NULL; 157 158 tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in) 159 tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1) 160 tmpGrommit = psGrommitAlloc(parFPA->exposure) 161 tmp3 = psCoordTPtoSky(out, tmp2, psGrommit); 162 163 psFree(tmp1); 164 psFree(tmp2); 165 psFree(tmpGrommit); 166 167 return(psCoordTPtoSky(out, tmp2, psGrommit); 168 } 169 170 psSphere *psCoordCelltoSkyQuick(psSphere *out, 171 const psPlane *in, 172 const psCell *cell) 173 { 174 psPlane *tmp1 = NULL; 175 176 tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in); 177 178 //XXX: Do something to convert the linear coords in tmp1 to spherical 179 // coords in out. 180 181 free(tmp1) 182 183 return(out); 184 } 185 186 psPlane *psCoordSkytoTP(psPlane *out, 187 const psSphere *in, 188 const psGrommit *grommit) 189 { 190 if (out == NULL) { 191 out = (psPlane *) psAlloc(sizeof(psPlane)); 192 } 193 194 return(out); 195 } 196 197 psPlane *psCoordTPtoFPA(psPlane *out, 198 const psPlane *in, 199 const psFPA *fpa) 200 { 201 return(psPlaneTransformApply(out, fpa->fromTangentPlane, in)); 202 } 203 204 psPlane *psCoordFPAtoChip(psPlane *out, 205 const psPlane *in, 206 const psChip *chip) 207 { 208 return(psPlaneTransformApply(out, chip->fromFPA, in)); 209 } 210 211 212 psPlane *psCoordChiptoCell(psPlane *out, 172 173 tmp1 = psPlaneTransformApply( tmp1, cell->toFPA, in ) 174 tmp2 = psPlaneTransformApply( tmp2, parFPA->toTangentPlane, tmp1 ) 175 tmpGrommit = psGrommitAlloc( parFPA->exposure ) 176 tmp3 = psCoordTPtoSky( out, tmp2, psGrommit ); 177 178 psFree( tmp1 ); 179 psFree( tmp2 ); 180 psFree( tmpGrommit ); 181 182 return ( psCoordTPtoSky( out, tmp2, psGrommit ); 183 } 184 185 psSphere *psCoordCelltoSkyQuick( psSphere *out, 186 const psPlane *in, 187 const psCell *cell ) 188 { 189 psPlane * tmp1 = NULL; 190 191 tmp1 = psPlaneTransformApply( tmp1, cell->toSky, in ); 192 193 //XXX: Do something to convert the linear coords in tmp1 to spherical 194 // coords in out. 195 196 free( tmp1 ) 197 198 return ( out ); 199 } 200 201 psPlane *psCoordSkytoTP( psPlane *out, 202 const psSphere *in, 203 const psGrommit *grommit ) 204 { 205 if ( out == NULL ) { 206 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 207 } 208 209 return ( out ); 210 } 211 212 psPlane *psCoordTPtoFPA( psPlane *out, 213 213 const psPlane *in, 214 const psCell *cell) 215 { 216 return(psPlaneTransformApply(out, cell->fromChip, in)); 217 } 218 219 psPlane *psCoordSkytoCell(psPlane *out, 220 const psSphere *in, 221 const psCell *cell) 222 { 223 out = psCoordSkytoTP(out, in, tmpGrommit); 224 out = psCoordTPtoFPA(out, out, whichFPA); 225 out = psCoordFPAtoChip(out, out, whichChip); 226 out = psCoordChiptoCell(out, out, whichCell); 227 228 return(out); 229 } 230 231 psPlane *psCoordSkytoCellQuick(psPlane *out, 232 const psSphere *in, 233 const psCell *cell) 234 { 235 if (out == NULL) { 236 out = (psPlane *) psAlloc(sizeof(psPlane)); 237 } 238 239 return(out); 240 } 241 242 214 const psFPA *fpa ) 215 { 216 return ( psPlaneTransformApply( out, fpa->fromTangentPlane, in ) ); 217 } 218 219 psPlane *psCoordFPAtoChip( psPlane *out, 220 const psPlane *in, 221 const psChip *chip ) 222 { 223 return ( psPlaneTransformApply( out, chip->fromFPA, in ) ); 224 } 225 226 227 psPlane *psCoordChiptoCell( psPlane *out, 228 const psPlane *in, 229 const psCell *cell ) 230 { 231 return ( psPlaneTransformApply( out, cell->fromChip, in ) ); 232 } 233 234 psPlane *psCoordSkytoCell( psPlane *out, 235 const psSphere *in, 236 const psCell *cell ) 237 { 238 out = psCoordSkytoTP( out, in, tmpGrommit ); 239 out = psCoordTPtoFPA( out, out, whichFPA ); 240 out = psCoordFPAtoChip( out, out, whichChip ); 241 out = psCoordChiptoCell( out, out, whichCell ); 242 243 return ( out ); 244 } 245 246 psPlane *psCoordSkytoCellQuick( psPlane *out, 247 const psSphere *in, 248 const psCell *cell ) 249 { 250 if ( out == NULL ) { 251 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 252 } 253 254 return ( out ); 255 } 256 257 258 -
trunk/psLib/src/astronomy/psCoord2.h
r1312 r1374 1 1 /** @file psCoord2.h 2 *3 * @brief Contains basic coordinate transformation definitions and operations4 *5 * This file defines the basic types for astronomical coordinate6 * transformation7 *8 * @ingroup AstroImage 9 *10 * @author George Gusciora, MHPCC11 *12 * @version $Revision: 1.1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-28 22:31:19$14 *15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii16 */2 * 3 * @brief Contains basic coordinate transformation definitions and operations 4 * 5 * This file defines the basic types for astronomical coordinate 6 * transformation 7 * 8 * @ingroup CoordinateTransform 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 17 17 18 18 # ifndef PS_COORD2_H … … 25 25 #include "psFunctions.h" 26 26 27 /// @addtogroup CoordinateTransform 28 /// @{ 29 27 30 typedef struct 28 {29 const double latitude; ///<30 const double sinLat, cosLat; ///<31 const double abberationMag; ///<32 const double height; ///<33 const double temperature; ///<34 const double pressure; ///<35 const double humidity; ///<36 const double wavelength; ///<37 const double lapseRate; ///<38 const double refractA, refractB; ///<39 const double longitudeOffset; ///<40 const double siderealTime; ///<41 }31 { 32 const double latitude; ///< 33 const double sinLat, cosLat; ///< 34 const double abberationMag; ///< 35 const double height; ///< 36 const double temperature; ///< 37 const double pressure; ///< 38 const double humidity; ///< 39 const double wavelength; ///< 40 const double lapseRate; ///< 41 const double refractA, refractB; ///< 42 const double longitudeOffset; ///< 43 const double siderealTime; ///< 44 } 42 45 psGrommit; 43 46 44 47 typedef struct 45 {46 int nX, nY; ///<47 double x0, y0; ///<48 double xScale, yScale; ///<49 double **x, **y; ///<50 }48 { 49 int nX, nY; ///< 50 double x0, y0; ///< 51 double xScale, yScale; ///< 52 double **x, **y; ///< 53 } 51 54 psFixedPattern; 52 55 53 psGrommit *psGrommitAlloc( const psExposure *exp);56 psGrommit *psGrommitAlloc( const psExposure *exp ); 54 57 55 void p_psGrommitFree( psGrommit *grommit);58 void p_psGrommitFree( psGrommit *grommit ); 56 59 57 psCell *psCellinFPA(psCell *out, 58 const psPlane *coord, 59 const psFPA *FPA); 60 61 psChip *psChipinFPA(psChip *out, 62 const psPlane *coord, 63 const psFPA *FPA); 64 65 psCell *psCellinChip(psCell *out, 60 psCell *psCellinFPA( psCell *out, 66 61 const psPlane *coord, 67 const psChip *chip); 68 69 70 71 72 psPlane *psCoordCelltoChip(psPlane *out, 62 const psFPA *FPA ); 63 64 psChip *psChipinFPA( psChip *out, 65 const psPlane *coord, 66 const psFPA *FPA ); 67 68 psCell *psCellinChip( psCell *out, 69 const psPlane *coord, 70 const psChip *chip ); 71 72 73 74 75 psPlane *psCoordCelltoChip( psPlane *out, 76 const psPlane *in, 77 const psCell *cell ); 78 79 psPlane *psCoordChipToFPA( psPlane *out, 73 80 const psPlane *in, 74 const psCell *cell); 75 76 psPlane *psCoordChipToFPA(psPlane *out, 81 const psChip *chip ); 82 83 psPlane *psCoordFPAtoTP( psPlane *out, 84 const psPlane *in, 85 const psFPA *fpa ); 86 87 psSphere *psCoordTPtoSky( psSphere *out, 77 88 const psPlane *in, 78 const psChip *chip); 79 80 psPlane *psCoordFPAtoTP(psPlane *out, 81 const psPlane *in, 82 const psFPA *fpa); 83 84 psSphere *psCoordTPtoSky(psSphere *out, 89 const psGrommit *grommit ); 90 91 psPlane *psCoordCellToFPA( psPlane *out, 92 const psPlane *in, 93 const psCell *cell ); 94 95 psSphere *psCoordCelltoSky( psSphere *out, 96 const psPlane *in, 97 const psCell *cell ); 98 99 psSphere *psCoordCelltoSkyQuick( psSphere *out, 100 const psPlane *in, 101 const psCell *cell ); 102 103 psPlane *psCoordSkytoTP( psPlane *out, 104 const psSphere *in, 105 const psGrommit *grommit ); 106 107 psPlane *psCoordTPtoFPA( psPlane *out, 85 108 const psPlane *in, 86 const psGrommit *grommit); 87 88 psPlane *psCoordCellToFPA(psPlane *out, 89 const psPlane *in, 90 const psCell *cell); 91 92 psSphere *psCoordCelltoSky(psSphere *out, 109 const psFPA *fpa ); 110 111 psPlane *psCoordFPAtoChip( psPlane *out, 93 112 const psPlane *in, 94 const psCell *cell); 95 96 psSphere *psCoordCelltoSkyQuick(psSphere *out, 97 const psPlane *in, 98 const psCell *cell); 99 100 psPlane *psCoordSkytoTP(psPlane *out, 101 const psSphere *in, 102 const psGrommit *grommit); 103 104 psPlane *psCoordTPtoFPA(psPlane *out, 105 const psPlane *in, 106 const psFPA *fpa); 107 108 psPlane *psCoordFPAtoChip(psPlane *out, 109 const psPlane *in, 110 const psChip *chip); 111 112 psPlane *psCoordChiptoCell(psPlane *out, 113 const psPlane *in, 114 const psCell *cell); 115 116 psPlane *psCoordSkytoCell(psPlane *out, 117 const psSphere *in, 118 const psCell *cell); 119 120 psPlane *psCoordSkytoCellQuick(psPlane *out, 121 const psSphere *in, 122 const psCell *cell); 113 const psChip *chip ); 114 115 psPlane *psCoordChiptoCell( psPlane *out, 116 const psPlane *in, 117 const psCell *cell ); 118 119 psPlane *psCoordSkytoCell( psPlane *out, 120 const psSphere *in, 121 const psCell *cell ); 122 123 psPlane *psCoordSkytoCellQuick( psPlane *out, 124 const psSphere *in, 125 const psCell *cell ); 126 127 128 /// @} 123 129 124 130 #endif -
trunk/psLib/src/astronomy/psMetadata.h
r1351 r1374 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 7-30 19:37:07 $12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #define PS_METADATA_H 19 19 20 21 20 /// @addtogroup Metadata 22 21 /// @{ … … 30 29 */ 31 30 typedef enum { 32 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items33 PS_META_S32, ///< Signed 32-bit integer data.34 PS_META_F32, ///< Single-precision float data.35 PS_META_F64, ///< Double-precision float data.36 PS_META_STR, ///< String data (Stored in as void *).37 PS_META_IMG, ///< Image data (Stored in as void *).38 PS_META_JPEG, ///< JPEG data (Stored in as void .39 PS_META_PNG, ///< PNG data (Stored in as void *).40 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).41 PS_META_UNKNOWN, ///< Other data (Stored in as void *).31 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 32 PS_META_S32, ///< Signed 32-bit integer data. 33 PS_META_F32, ///< Single-precision float data. 34 PS_META_F64, ///< Double-precision float data. 35 PS_META_STR, ///< String data (Stored in as void *). 36 PS_META_IMG, ///< Image data (Stored in as void *). 37 PS_META_JPEG, ///< JPEG data (Stored in as void . 38 PS_META_PNG, ///< PNG data (Stored in as void *). 39 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 40 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 42 41 PS_META_NTYPE ///< Number of types. Must be last. 43 42 } psMetadataType; … … 97 96 */ 98 97 psMetadataItem *psMetadataItemAlloc( 99 const char *name, ///< Name of metadata item.100 psMetadataType type, ///< Type of metadata item.101 const char *comment, ///< Comment for metadata item.98 const char *name, ///< Name of metadata item. 99 psMetadataType type, ///< Type of metadata item. 100 const char *comment, ///< Comment for metadata item. 102 101 ... ///< Arguments for name formatting and metadata item data. 103 102 ); … … 117 116 */ 118 117 psMetadataItem *psMetadataItemAllocV( 119 const char *name, ///< Name of metadata item.120 psMetadataType type, ///< Type of metadata item.121 const char *comment, ///< Comment for metadata item.118 const char *name, ///< Name of metadata item. 119 psMetadataType type, ///< Type of metadata item. 120 const char *comment, ///< Comment for metadata item. 122 121 va_list list ///< Arguments for name formatting and metadata item data. 123 122 ); … … 140 139 */ 141 140 bool psMetadataAddItem( 142 psMetadata *restrict md, ///< Metadata collection to insert metadat item.143 int where, ///< Location to be added.141 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 142 int where, ///< Location to be added. 144 143 psMetadataItem *restrict item ///< Metadata item to be added. 145 144 ); … … 152 151 */ 153 152 bool psMetadataAdd( 154 psMetadata *restrict md, ///< Metadata collection to insert metadat item.155 int where, ///< Location to be added.156 const char *name, ///< Name of metadata item.157 psMetadataType type, ///< Type of metadata item.158 const char *comment, ///< Comment for metadata item.153 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 155 const char *name, ///< Name of metadata item. 156 psMetadataType type, ///< Type of metadata item. 157 const char *comment, ///< Comment for metadata item. 159 158 ... ///< Arguments for name formatting and metadata item data. 160 159 ); … … 170 169 */ 171 170 bool psMetadataRemove( 172 psMetadata *restrict md, ///< Metadata collection to insert metadat item.173 int where, ///< Location to be removed.171 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 172 int where, ///< Location to be removed. 174 173 const char *restrict key ///< Name of metadata key. 175 174 ); … … 183 182 */ 184 183 psMetadataItem *psMetadataLookup( 185 psMetadata *restrict md, ///< Metadata collection to insert metadat item.184 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 186 185 const char *restrict key ///< Name of metadata key. 187 186 ); … … 194 193 */ 195 194 psMetadataItem *psMetadataGet( 196 psMetadata *restrict md, ///< Metadata collection to insert metadat item.195 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 197 196 int where ///< Location to be retrieved. 198 197 ); … … 205 204 */ 206 205 bool psMetadataSetIterator( 207 psMetadata *restrict md, ///< Metadata collection to iterate.206 psMetadata *restrict md, ///< Metadata collection to iterate. 208 207 int where ///< Location of iterator. 209 208 ); … … 216 215 */ 217 216 psMetadataItem *psMetadataGetNext( 218 psMetadata *restrict md, ///< Metadata collection to iterate.219 const char *restrict match, ///< Beginning of key name.217 psMetadata *restrict md, ///< Metadata collection to iterate. 218 const char *restrict match, ///< Beginning of key name. 220 219 int which ///< Iterator to be used. 221 220 ); … … 228 227 */ 229 228 psMetadataItem *psMetadataGetPrevious( 230 psMetadata *restrict md, ///< Metadata collection to iterate.231 const char *restrict match, ///< Beginning of key name.229 psMetadata *restrict md, ///< Metadata collection to iterate. 230 const char *restrict match, ///< Beginning of key name. 232 231 int which ///< Iterator to be used. 233 232 ); … … 244 243 */ 245 244 void psMetadataItemPrint( 246 FILE *fd, ///< Pointer to file to write metadata item.247 const char *format, ///< Format to print metadata item.245 FILE *fd, ///< Pointer to file to write metadata item. 246 const char *format, ///< Format to print metadata item. 248 247 const psMetadataItem *restrict metadataItem ///< Metadata item to print. 249 248 ); … … 256 255 */ 257 256 psMetadata *psMetadataReadHeader( 258 psMetadata *output, ///< Resulting metadata from read.259 const char *extname, ///< File name extension string.260 int extnum, ///< File name extension number.257 psMetadata *output, ///< Resulting metadata from read. 258 const char *extname, ///< File name extension string. 259 int extnum, ///< File name extension number. 261 260 const char *filename ///< Name of file to read. 262 261 ); … … 269 268 */ 270 269 psMetadata *psMetadataFReadHeader( 271 psMetadata *output, ///< Resulting metadata from read.272 const char *extname, ///< File name extension string.273 int extnum, ///< File name extension number.270 psMetadata *output, ///< Resulting metadata from read. 271 const char *extname, ///< File name extension string. 272 int extnum, ///< File name extension number. 274 273 fitsfile *fd ///< Pointer to file to read. 275 274 ); -
trunk/psLib/src/astronomy/psPhotometry.h
r1312 r1374 1 1 /** @file psPhotometry.h 2 *3 * @brief Contains basic photometric structures.4 *5 * This file defines the basic photometric structures.6 *7 * @ingroup AstroImage 8 *9 * @author George Gusciora, MHPCC10 *11 * @version $Revision: 1.1$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-07-28 22:31:01$13 *14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii15 */2 * 3 * @brief Contains basic photometric structures. 4 * 5 * This file defines the basic photometric structures. 6 * 7 * @ingroup Photometry 8 * 9 * @author George Gusciora, MHPCC 10 * 11 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-04 00:55:17 $ 13 * 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 */ 16 16 17 17 # ifndef PS_PHOTOMETRIC_H … … 24 24 #include "psFunctions.h" 25 25 26 /// @addtogroup Photometry 27 /// @{ 28 26 29 typedef struct 27 {28 const int ID;29 const char *name;30 const char *camera;31 const char *filter;32 const char *detector;33 }30 { 31 const int ID; 32 const char *name; 33 const char *camera; 34 const char *filter; 35 const char *detector; 36 } 34 37 psPhotSystem; 35 38 36 39 typedef struct 37 {38 psPhotSystem src;39 psPhotSystem dst;40 psPhotSystem pP, pM;41 psPhotSystem sP, sM;42 float pA, sA;43 psPolynomial3D transform;44 }40 { 41 psPhotSystem src; 42 psPhotSystem dst; 43 psPhotSystem pP, pM; 44 psPhotSystem sP, sM; 45 float pA, sA; 46 psPolynomial3D transform; 47 } 45 48 psPhotTransform; 46 49 50 /// @} 51 47 52 #endif -
trunk/psLib/src/collections/psMetadata.h
r1351 r1374 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 7-30 19:37:07 $12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #define PS_METADATA_H 19 19 20 21 20 /// @addtogroup Metadata 22 21 /// @{ … … 30 29 */ 31 30 typedef enum { 32 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items33 PS_META_S32, ///< Signed 32-bit integer data.34 PS_META_F32, ///< Single-precision float data.35 PS_META_F64, ///< Double-precision float data.36 PS_META_STR, ///< String data (Stored in as void *).37 PS_META_IMG, ///< Image data (Stored in as void *).38 PS_META_JPEG, ///< JPEG data (Stored in as void .39 PS_META_PNG, ///< PNG data (Stored in as void *).40 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).41 PS_META_UNKNOWN, ///< Other data (Stored in as void *).31 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 32 PS_META_S32, ///< Signed 32-bit integer data. 33 PS_META_F32, ///< Single-precision float data. 34 PS_META_F64, ///< Double-precision float data. 35 PS_META_STR, ///< String data (Stored in as void *). 36 PS_META_IMG, ///< Image data (Stored in as void *). 37 PS_META_JPEG, ///< JPEG data (Stored in as void . 38 PS_META_PNG, ///< PNG data (Stored in as void *). 39 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 40 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 42 41 PS_META_NTYPE ///< Number of types. Must be last. 43 42 } psMetadataType; … … 97 96 */ 98 97 psMetadataItem *psMetadataItemAlloc( 99 const char *name, ///< Name of metadata item.100 psMetadataType type, ///< Type of metadata item.101 const char *comment, ///< Comment for metadata item.98 const char *name, ///< Name of metadata item. 99 psMetadataType type, ///< Type of metadata item. 100 const char *comment, ///< Comment for metadata item. 102 101 ... ///< Arguments for name formatting and metadata item data. 103 102 ); … … 117 116 */ 118 117 psMetadataItem *psMetadataItemAllocV( 119 const char *name, ///< Name of metadata item.120 psMetadataType type, ///< Type of metadata item.121 const char *comment, ///< Comment for metadata item.118 const char *name, ///< Name of metadata item. 119 psMetadataType type, ///< Type of metadata item. 120 const char *comment, ///< Comment for metadata item. 122 121 va_list list ///< Arguments for name formatting and metadata item data. 123 122 ); … … 140 139 */ 141 140 bool psMetadataAddItem( 142 psMetadata *restrict md, ///< Metadata collection to insert metadat item.143 int where, ///< Location to be added.141 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 142 int where, ///< Location to be added. 144 143 psMetadataItem *restrict item ///< Metadata item to be added. 145 144 ); … … 152 151 */ 153 152 bool psMetadataAdd( 154 psMetadata *restrict md, ///< Metadata collection to insert metadat item.155 int where, ///< Location to be added.156 const char *name, ///< Name of metadata item.157 psMetadataType type, ///< Type of metadata item.158 const char *comment, ///< Comment for metadata item.153 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 155 const char *name, ///< Name of metadata item. 156 psMetadataType type, ///< Type of metadata item. 157 const char *comment, ///< Comment for metadata item. 159 158 ... ///< Arguments for name formatting and metadata item data. 160 159 ); … … 170 169 */ 171 170 bool psMetadataRemove( 172 psMetadata *restrict md, ///< Metadata collection to insert metadat item.173 int where, ///< Location to be removed.171 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 172 int where, ///< Location to be removed. 174 173 const char *restrict key ///< Name of metadata key. 175 174 ); … … 183 182 */ 184 183 psMetadataItem *psMetadataLookup( 185 psMetadata *restrict md, ///< Metadata collection to insert metadat item.184 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 186 185 const char *restrict key ///< Name of metadata key. 187 186 ); … … 194 193 */ 195 194 psMetadataItem *psMetadataGet( 196 psMetadata *restrict md, ///< Metadata collection to insert metadat item.195 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 197 196 int where ///< Location to be retrieved. 198 197 ); … … 205 204 */ 206 205 bool psMetadataSetIterator( 207 psMetadata *restrict md, ///< Metadata collection to iterate.206 psMetadata *restrict md, ///< Metadata collection to iterate. 208 207 int where ///< Location of iterator. 209 208 ); … … 216 215 */ 217 216 psMetadataItem *psMetadataGetNext( 218 psMetadata *restrict md, ///< Metadata collection to iterate.219 const char *restrict match, ///< Beginning of key name.217 psMetadata *restrict md, ///< Metadata collection to iterate. 218 const char *restrict match, ///< Beginning of key name. 220 219 int which ///< Iterator to be used. 221 220 ); … … 228 227 */ 229 228 psMetadataItem *psMetadataGetPrevious( 230 psMetadata *restrict md, ///< Metadata collection to iterate.231 const char *restrict match, ///< Beginning of key name.229 psMetadata *restrict md, ///< Metadata collection to iterate. 230 const char *restrict match, ///< Beginning of key name. 232 231 int which ///< Iterator to be used. 233 232 ); … … 244 243 */ 245 244 void psMetadataItemPrint( 246 FILE *fd, ///< Pointer to file to write metadata item.247 const char *format, ///< Format to print metadata item.245 FILE *fd, ///< Pointer to file to write metadata item. 246 const char *format, ///< Format to print metadata item. 248 247 const psMetadataItem *restrict metadataItem ///< Metadata item to print. 249 248 ); … … 256 255 */ 257 256 psMetadata *psMetadataReadHeader( 258 psMetadata *output, ///< Resulting metadata from read.259 const char *extname, ///< File name extension string.260 int extnum, ///< File name extension number.257 psMetadata *output, ///< Resulting metadata from read. 258 const char *extname, ///< File name extension string. 259 int extnum, ///< File name extension number. 261 260 const char *filename ///< Name of file to read. 262 261 ); … … 269 268 */ 270 269 psMetadata *psMetadataFReadHeader( 271 psMetadata *output, ///< Resulting metadata from read.272 const char *extname, ///< File name extension string.273 int extnum, ///< File name extension number.270 psMetadata *output, ///< Resulting metadata from read. 271 const char *extname, ///< File name extension string. 272 int extnum, ///< File name extension number. 274 273 fitsfile *fd ///< Pointer to file to read. 275 274 ); -
trunk/psLib/src/image/psImageExtraction.c
r1359 r1374 1 /** @file psImage Manip.h1 /** @file psImageExtraction.c 2 2 * 3 3 * @brief Contains basic image extraction operations, as specified in the … … 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-0 7-31 02:27:43$11 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-04 00:55:17 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii -
trunk/psLib/src/image/psImageExtraction.h
r1359 r1374 1 /** @file psImage Manip.h1 /** @file psImageExtraction.h 2 2 * 3 3 * @brief Contains basic image extraction operations, as specified in the … … 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-0 7-31 02:27:43$11 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-04 00:55:17 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 */ 42 42 psImage *psImageSubset( 43 psImage *out, ///< Subimage to return, or NULL.44 psImage *image, ///< Parent image.45 unsigned int numCols, ///< Subimage width (<= image.nCols - col0).46 unsigned int numRows, ///< Subimage height (<= image.nRows - row0).47 unsigned int col0, ///< Subimage col-offset (0 <= col0 < nCol).43 psImage *out, ///< Subimage to return, or NULL. 44 psImage *image, ///< Parent image. 45 unsigned int numCols, ///< Subimage width (<= image.nCols - col0). 46 unsigned int numRows, ///< Subimage height (<= image.nRows - row0). 47 unsigned int col0, ///< Subimage col-offset (0 <= col0 < nCol). 48 48 unsigned int row0 ///< Subimage row-offset (0 <= row0 < nCol). 49 49 ); -
trunk/psLib/src/image/psImageStats.h
r1323 r1374 1 1 /** @file psImageStats.h 2 * \brief Routines for calculating statistics on images. 3 * \ingroup Stats 4 * @ingroup Stats 5 * 6 * This file will hold the prototypes for procedures which calculate 7 * statistic on images, histograms on images, and fit/evaluate Chebyshev 8 * polynomials to images. 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-07-29 02:00:27 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 2 * \brief Routines for calculating statistics on images. 3 * @ingroup ImageStats 4 * 5 * This file will hold the prototypes for procedures which calculate 6 * statistic on images, histograms on images, and fit/evaluate Chebyshev 7 * polynomials to images. 8 * 9 * @author George Gusciora, MHPCC 10 * 11 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-04 00:55:17 $ 13 * 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 */ 17 16 #if !defined(PS_IMAGE_STATS_H) 18 17 #define PS_IMAGE_STATS_H … … 25 24 #include "psFunctions.h" 26 25 26 /// @addtogroup ImageStats 27 /// @{ 28 27 29 /// This routine must determine the various statistics for the image. 28 psStats *psImageStats( psStats *stats,///< defines statistics to be calculated29 psImage *in,///< image (or subimage) to calculate stats30 psImage *mask,///< mask data for image (NULL ok)31 int maskVal); ///< mask Mask for mask32 33 34 psHistogram *psImageHistogram( psHistogram *out,///< input histogram description & target35 psImage *in,///< Image data to be histogramed.36 psImage *mask,///< mask data for image (NULL ok)37 unsigned int maskVal); ///< mask Mask for mask38 30 psStats *psImageStats( psStats *stats, ///< defines statistics to be calculated 31 psImage *in, ///< image (or subimage) to calculate stats 32 psImage *mask, ///< mask data for image (NULL ok) 33 int maskVal ); ///< mask Mask for mask 34 35 36 psHistogram *psImageHistogram( psHistogram *out, ///< input histogram description & target 37 psImage *in, ///< Image data to be histogramed. 38 psImage *mask, ///< mask data for image (NULL ok) 39 unsigned int maskVal ); ///< mask Mask for mask 40 39 41 /// Fit a 2-D polynomial surface to an image. 40 42 psPolynomial2D * 41 psImageFitPolynomial( const psImage *input,///< image to fit42 psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target43 psImageFitPolynomial( const psImage *input, ///< image to fit 44 psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target 43 45 ); 44 46 45 47 /// Evaluate a 2-D polynomial surface to image pixels. 46 48 int 47 psImageEvalPolynomial( const psImage *input,///< image to fit48 const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms49 psImageEvalPolynomial( const psImage *input, ///< image to fit 50 const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms 49 51 ); 52 53 /// @} 50 54 51 55 #endif -
trunk/psLib/src/imageops/psImageStats.h
r1323 r1374 1 1 /** @file psImageStats.h 2 * \brief Routines for calculating statistics on images. 3 * \ingroup Stats 4 * @ingroup Stats 5 * 6 * This file will hold the prototypes for procedures which calculate 7 * statistic on images, histograms on images, and fit/evaluate Chebyshev 8 * polynomials to images. 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-07-29 02:00:27 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 2 * \brief Routines for calculating statistics on images. 3 * @ingroup ImageStats 4 * 5 * This file will hold the prototypes for procedures which calculate 6 * statistic on images, histograms on images, and fit/evaluate Chebyshev 7 * polynomials to images. 8 * 9 * @author George Gusciora, MHPCC 10 * 11 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-08-04 00:55:17 $ 13 * 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 15 */ 17 16 #if !defined(PS_IMAGE_STATS_H) 18 17 #define PS_IMAGE_STATS_H … … 25 24 #include "psFunctions.h" 26 25 26 /// @addtogroup ImageStats 27 /// @{ 28 27 29 /// This routine must determine the various statistics for the image. 28 psStats *psImageStats( psStats *stats,///< defines statistics to be calculated29 psImage *in,///< image (or subimage) to calculate stats30 psImage *mask,///< mask data for image (NULL ok)31 int maskVal); ///< mask Mask for mask32 33 34 psHistogram *psImageHistogram( psHistogram *out,///< input histogram description & target35 psImage *in,///< Image data to be histogramed.36 psImage *mask,///< mask data for image (NULL ok)37 unsigned int maskVal); ///< mask Mask for mask38 30 psStats *psImageStats( psStats *stats, ///< defines statistics to be calculated 31 psImage *in, ///< image (or subimage) to calculate stats 32 psImage *mask, ///< mask data for image (NULL ok) 33 int maskVal ); ///< mask Mask for mask 34 35 36 psHistogram *psImageHistogram( psHistogram *out, ///< input histogram description & target 37 psImage *in, ///< Image data to be histogramed. 38 psImage *mask, ///< mask data for image (NULL ok) 39 unsigned int maskVal ); ///< mask Mask for mask 40 39 41 /// Fit a 2-D polynomial surface to an image. 40 42 psPolynomial2D * 41 psImageFitPolynomial( const psImage *input,///< image to fit42 psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target43 psImageFitPolynomial( const psImage *input, ///< image to fit 44 psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target 43 45 ); 44 46 45 47 /// Evaluate a 2-D polynomial surface to image pixels. 46 48 int 47 psImageEvalPolynomial( const psImage *input,///< image to fit48 const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms49 psImageEvalPolynomial( const psImage *input, ///< image to fit 50 const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms 49 51 ); 52 53 /// @} 50 54 51 55 #endif -
trunk/psLib/src/pslib.h
r1357 r1374 8 8 * @author Eric Van Alst, MHPCC 9 9 * 10 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-0 7-31 01:50:33$10 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-04 00:55:17 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 75 75 #include "psVector.h" 76 76 77 /// @defgroup Array Array Container 78 /// @ingroup DataContainer 77 79 #include "psArray.h" 78 80 79 81 /// @defgroup Image Image Container 80 82 /// @ingroup DataContainer 83 /// @{ 81 84 #include "psImage.h" 85 #include "psImageExtraction.h" 86 #include "psImageManip.h" 82 87 83 /// @defgroup BitSet Bit Set 88 /// @defgroup ImageIO Image File I/O Functions 89 /// @ingroup Image 90 #include "psImageIO.h" 91 92 93 /// @defgroup ImageStats Image Statistical Functions 94 /// @ingroup Image 95 #include "psImageStats.h" 96 97 /// @} 98 99 /// @defgroup BitSet Bit Set Container 84 100 /// @ingroup DataContainer 85 101 #include "psBitSet.h" 102 103 /// @} 86 104 87 105 // Data Manipulation 88 106 /// @defgroup DataManip Data Manipulation 89 107 /// @{ 108 109 /// @defgroup Compare Comparison Functions 110 /// @ingroup DataManip 111 #include "psCompare.h" 90 112 91 113 /// @defgroup Stats Statistic Functions … … 101 123 #include "psMatrixVectorArithmetic.h" 102 124 103 /// @defgroup Transform Fourier Transform 125 /// @defgroup Transform Fourier Transform Operations 104 126 /// @ingroup DataManip 105 127 #include "psFFT.h" 106 107 /// @defgroup ImageIO Image File I/O108 /// @ingroup DataManip109 #include "psImageIO.h"110 111 #include "psImageManip.h"112 #include "psImageExtraction.h"113 128 114 129 #include "psFunctions.h" … … 120 135 /// @defgroup Astronomy Astronomy Functions 121 136 /// @{ 137 138 /// @defgroup AstroImage Astronomical Imagery 139 /// @ingroup Astronomy 140 #include "psCCD.h" 141 142 /// @defgroup CoordinateTransform Coordinate Functions 143 /// @ingroup Astronomy 144 #include "psCoord.h" 145 #include "psCoord2.h" 146 147 /// @defgroup Photometry Photometry 148 /// @ingroup Astronomy 149 #include "psPhotometry.h" 122 150 123 151 /// @defgroup Time Time Functions -
trunk/psLib/src/types/psMetadata.h
r1351 r1374 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-0 7-30 19:37:07 $12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 00:55:17 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #define PS_METADATA_H 19 19 20 21 20 /// @addtogroup Metadata 22 21 /// @{ … … 30 29 */ 31 30 typedef enum { 32 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items33 PS_META_S32, ///< Signed 32-bit integer data.34 PS_META_F32, ///< Single-precision float data.35 PS_META_F64, ///< Double-precision float data.36 PS_META_STR, ///< String data (Stored in as void *).37 PS_META_IMG, ///< Image data (Stored in as void *).38 PS_META_JPEG, ///< JPEG data (Stored in as void .39 PS_META_PNG, ///< PNG data (Stored in as void *).40 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).41 PS_META_UNKNOWN, ///< Other data (Stored in as void *).31 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 32 PS_META_S32, ///< Signed 32-bit integer data. 33 PS_META_F32, ///< Single-precision float data. 34 PS_META_F64, ///< Double-precision float data. 35 PS_META_STR, ///< String data (Stored in as void *). 36 PS_META_IMG, ///< Image data (Stored in as void *). 37 PS_META_JPEG, ///< JPEG data (Stored in as void . 38 PS_META_PNG, ///< PNG data (Stored in as void *). 39 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 40 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 42 41 PS_META_NTYPE ///< Number of types. Must be last. 43 42 } psMetadataType; … … 97 96 */ 98 97 psMetadataItem *psMetadataItemAlloc( 99 const char *name, ///< Name of metadata item.100 psMetadataType type, ///< Type of metadata item.101 const char *comment, ///< Comment for metadata item.98 const char *name, ///< Name of metadata item. 99 psMetadataType type, ///< Type of metadata item. 100 const char *comment, ///< Comment for metadata item. 102 101 ... ///< Arguments for name formatting and metadata item data. 103 102 ); … … 117 116 */ 118 117 psMetadataItem *psMetadataItemAllocV( 119 const char *name, ///< Name of metadata item.120 psMetadataType type, ///< Type of metadata item.121 const char *comment, ///< Comment for metadata item.118 const char *name, ///< Name of metadata item. 119 psMetadataType type, ///< Type of metadata item. 120 const char *comment, ///< Comment for metadata item. 122 121 va_list list ///< Arguments for name formatting and metadata item data. 123 122 ); … … 140 139 */ 141 140 bool psMetadataAddItem( 142 psMetadata *restrict md, ///< Metadata collection to insert metadat item.143 int where, ///< Location to be added.141 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 142 int where, ///< Location to be added. 144 143 psMetadataItem *restrict item ///< Metadata item to be added. 145 144 ); … … 152 151 */ 153 152 bool psMetadataAdd( 154 psMetadata *restrict md, ///< Metadata collection to insert metadat item.155 int where, ///< Location to be added.156 const char *name, ///< Name of metadata item.157 psMetadataType type, ///< Type of metadata item.158 const char *comment, ///< Comment for metadata item.153 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 155 const char *name, ///< Name of metadata item. 156 psMetadataType type, ///< Type of metadata item. 157 const char *comment, ///< Comment for metadata item. 159 158 ... ///< Arguments for name formatting and metadata item data. 160 159 ); … … 170 169 */ 171 170 bool psMetadataRemove( 172 psMetadata *restrict md, ///< Metadata collection to insert metadat item.173 int where, ///< Location to be removed.171 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 172 int where, ///< Location to be removed. 174 173 const char *restrict key ///< Name of metadata key. 175 174 ); … … 183 182 */ 184 183 psMetadataItem *psMetadataLookup( 185 psMetadata *restrict md, ///< Metadata collection to insert metadat item.184 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 186 185 const char *restrict key ///< Name of metadata key. 187 186 ); … … 194 193 */ 195 194 psMetadataItem *psMetadataGet( 196 psMetadata *restrict md, ///< Metadata collection to insert metadat item.195 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 197 196 int where ///< Location to be retrieved. 198 197 ); … … 205 204 */ 206 205 bool psMetadataSetIterator( 207 psMetadata *restrict md, ///< Metadata collection to iterate.206 psMetadata *restrict md, ///< Metadata collection to iterate. 208 207 int where ///< Location of iterator. 209 208 ); … … 216 215 */ 217 216 psMetadataItem *psMetadataGetNext( 218 psMetadata *restrict md, ///< Metadata collection to iterate.219 const char *restrict match, ///< Beginning of key name.217 psMetadata *restrict md, ///< Metadata collection to iterate. 218 const char *restrict match, ///< Beginning of key name. 220 219 int which ///< Iterator to be used. 221 220 ); … … 228 227 */ 229 228 psMetadataItem *psMetadataGetPrevious( 230 psMetadata *restrict md, ///< Metadata collection to iterate.231 const char *restrict match, ///< Beginning of key name.229 psMetadata *restrict md, ///< Metadata collection to iterate. 230 const char *restrict match, ///< Beginning of key name. 232 231 int which ///< Iterator to be used. 233 232 ); … … 244 243 */ 245 244 void psMetadataItemPrint( 246 FILE *fd, ///< Pointer to file to write metadata item.247 const char *format, ///< Format to print metadata item.245 FILE *fd, ///< Pointer to file to write metadata item. 246 const char *format, ///< Format to print metadata item. 248 247 const psMetadataItem *restrict metadataItem ///< Metadata item to print. 249 248 ); … … 256 255 */ 257 256 psMetadata *psMetadataReadHeader( 258 psMetadata *output, ///< Resulting metadata from read.259 const char *extname, ///< File name extension string.260 int extnum, ///< File name extension number.257 psMetadata *output, ///< Resulting metadata from read. 258 const char *extname, ///< File name extension string. 259 int extnum, ///< File name extension number. 261 260 const char *filename ///< Name of file to read. 262 261 ); … … 269 268 */ 270 269 psMetadata *psMetadataFReadHeader( 271 psMetadata *output, ///< Resulting metadata from read.272 const char *extname, ///< File name extension string.273 int extnum, ///< File name extension number.270 psMetadata *output, ///< Resulting metadata from read. 271 const char *extname, ///< File name extension string. 272 int extnum, ///< File name extension number. 274 273 fitsfile *fd ///< Pointer to file to read. 275 274 );
Note:
See TracChangeset
for help on using the changeset viewer.
