Changeset 1382
- Timestamp:
- Aug 4, 2004, 12:11:09 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 deleted
- 9 edited
-
astronomy/Makefile (modified) (1 diff)
-
astronomy/psAstrometry.c (modified) (5 diffs)
-
astronomy/psAstrometry.h (modified) (2 diffs)
-
astronomy/psCCD.c (deleted)
-
astronomy/psCCD.h (deleted)
-
astronomy/psCoord2.c (deleted)
-
astronomy/psCoord2.h (deleted)
-
astronomy/psMetadata.h (modified) (17 diffs)
-
collections/psMetadata.h (modified) (17 diffs)
-
dataManip/psFunctions.h (modified) (4 diffs)
-
math/psPolynomial.h (modified) (4 diffs)
-
math/psSpline.h (modified) (4 diffs)
-
types/psMetadata.h (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/Makefile
r1338 r1382 9 9 SRC_OBJS = psTime.o \ 10 10 psMetadata.o \ 11 psCCD.o \12 11 psCoord.o 12 # psAstrometry.o George, this is crap code! 13 13 14 14 OBJS = $(addprefix makedir/,$(SRC_OBJS)) -
trunk/psLib/src/astronomy/psAstrometry.c
r1333 r1382 1 // This file contains 2 3 #include "psType.h" 4 #include "psImage.h" 5 #include "psArray.h" 6 #include "psList.h" 1 /** @file psAstrometry.c 2 * 3 * @brief This file defines the basic types for astronomical coordinate 4 * transformation 5 * 6 * @ingroup AstroImage 7 * 8 * @author George Gusciora, MHPCC 9 * 10 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-04 22:11:09 $ 12 * 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 14 */ 15 16 #include<math.h> 17 7 18 #include "psFunctions.h" 8 9 psGrommit *psGrommitAlloc(const psExposure *exp) 10 { 11 double *slaGrommit = (double *) psAlloc(14 * sizeof(double)); 12 psGrommit *grommit = (psGrommit *) psAlloc(sizeof(psGrommit)); 19 #include "psAstrometry.h" 20 #include "psMemory.h" 21 22 void grommitFree( psGrommit *grommit ); 23 int checkValidChipCoords( double x, double y, psChip *tmpChip ); 24 int checkValidImageCoords( double x, double y, psImage *tmpImage ); 25 26 psExposure* psExposureAlloc( double ra, double dec, double hourAngle, 27 double zenith, double azimuth, double localTime, float date, 28 float rotAngle, float temperature, float pressure, float humidity, 29 float exposureTime ) 30 { 31 psExposure * exp = psAlloc( sizeof( psExposure ) ); 32 33 *( double* ) & exp->ra = ra; 34 *( double* ) & exp->dec = dec; 35 *( double* ) & exp->hourAngle = hourAngle; 36 *( double* ) & exp->zenith = zenith; 37 *( double* ) & exp->azimuth = azimuth; 38 *( double* ) & exp->localTime = localTime; 39 *( float* ) & exp->date = date; 40 *( float* ) & exp->rotAngle = rotAngle; 41 *( float* ) & exp->temperature = temperature; 42 *( float* ) & exp->pressure = pressure; 43 *( float* ) & exp->humidity = humidity; 44 *( float* ) & exp->exposureTime = exposureTime; 45 46 return exp; 47 48 } 49 50 psGrommit* psGrommitAlloc( const psExposure *exp ) 51 { 52 double * slaGrommit = ( double * ) psAlloc( 14 * sizeof( double ) ); 53 psGrommit *grommit = ( psGrommit * ) psAlloc( sizeof( psGrommit ) ); 13 54 /* 14 55 extern void sla_aoppa(double date, … … 30 71 tlr); 31 72 */ 32 grommit->latitude = exp->dec; // XXX Is this correct?33 grommit->sinLat = sin(grommit->latitude);34 grommit->cosLat = cos(grommit->latitude);35 grommit->abberationMag = 0.0;36 grommit->height = 0.0;37 grommit->temperature = exp->temperature;38 grommit->pressure = exp->pressure;39 grommit->humidity = exp->humidity;40 grommit->wavelength = 0.0;41 grommit->lapseRate = 0.0;42 grommit->refractA = 0.0;43 grommit->refractB = 0.0;44 grommit->longitudeOffset =ra; // XXX Is this correct?45 grommit->siderealTime = 0.0;46 47 psFree( slaGrommit);48 return (grommit);49 } 50 51 void p_psGrommitFree( psGrommit *grommit)52 { 53 psFree( grommit);54 } 55 56 psCell *psCellinFPA( psCell *out,57 const psPlane *coord,58 const psFPA *FPA)59 { 60 psChip * tmpChip = NULL;73 *( double* ) & grommit->latitude = exp->dec; // XXX Is this correct? 74 *( double* ) & grommit->sinLat = sin( grommit->latitude ); 75 *( double* ) & grommit->cosLat = cos( grommit->latitude ); 76 *( double* ) & grommit->abberationMag = 0.0; 77 *( double* ) & grommit->height = 0.0; 78 *( double* ) & grommit->temperature = exp->temperature; 79 *( double* ) & grommit->pressure = exp->pressure; 80 *( double* ) & grommit->humidity = exp->humidity; 81 *( double* ) & grommit->wavelength = 0.0; 82 *( double* ) & grommit->lapseRate = 0.0; 83 *( double* ) & grommit->refractA = 0.0; 84 *( double* ) & grommit->refractB = 0.0; 85 *( double* ) & grommit->longitudeOffset = exp->ra; // XXX Is this correct? 86 *( double* ) & grommit->siderealTime = 0.0; 87 88 psFree( slaGrommit ); 89 return ( grommit ); 90 } 91 92 void p_psGrommitFree( psGrommit *grommit ) 93 { 94 psFree( grommit ); 95 } 96 97 psCell *psCellinFPA( psCell *out, 98 const psPlane *coord, 99 const psFPA *FPA ) 100 { 101 psChip * tmpChip = NULL; 61 102 psCell *tmpCell = NULL; 62 63 tmpChip = psChipinFPA(tmpChip, coord, FPA); 64 tmpCell = psCellinChip(tmpCell, coord, tmpChip); 65 return(tmpCell); 66 } 67 68 69 p_psCheckValidChipCoords(double x, double y, psChil *tmpChip) 70 { 71 return(0); 72 } 73 74 psChip *psChipinFPA(psChip *out, 75 const psPlane *coord, 76 const psFPA *FPA) 77 { 78 psFPA *tmpChip = NULL; 79 80 for (tmpChip = FPA->chips; tmpChip != NULL; tmpChip++) { 81 tmpCoord = psPlaneTransformApply(out, tmpChip->fromFPA, coord); 82 if (p_psCheckValidChipCoords(tmpCoord->x, tmpCoord->y, 83 tmpChip)) { 84 psFree(tmpCoord); 85 return(tmpChip); 86 } 87 psFree(tmpCoord); 88 } 89 psFree(tmpCoord); 90 return(NULL); 91 } 92 93 p_psCheckValidImageCoords(double x, double y, psImage *tmpImage) 94 { 95 if ((x < 0.0) || 96 (x > (double) tmpImage->numCols) || 97 (y < 0.0) || 98 (y > (double) tmpImage->numRows)) { 99 return(0); 100 } 101 return(1); 103 104 tmpChip = psChipinFPA( tmpChip, coord, FPA ); 105 tmpCell = psCellinChip( tmpCell, coord, tmpChip ); 106 return ( tmpCell ); 107 } 108 109 110 int checkValidChipCoords( double x, double y, psChip *tmpChip ) 111 { 112 return ( 0 ); 113 } 114 115 psChip *psChipinFPA( psChip *out, 116 const psPlane *coord, 117 const psFPA *FPA ) 118 { 119 psArray * chips = FPA->chips; 120 int nChips = chips->n; 121 psPlane* tmpCoord = NULL; 122 123 for ( int i = 0; i < nChips; i++ ) { 124 psChip* tmpChip = chips->data[ i ]; 125 tmpCoord = psPlaneTransformApply( tmpCoord, tmpChip->fromFPA, coord ); 126 if ( checkValidChipCoords( tmpCoord->x, tmpCoord->y, 127 tmpChip ) ) { 128 psFree( tmpCoord ); 129 // XXX: George, you didn't use the out parameter! 130 return ( tmpChip ); 131 } 132 psFree( tmpCoord ); 133 } 134 psFree( tmpCoord ); 135 return ( NULL ); 136 } 137 138 int checkValidImageCoords( double x, double y, psImage *tmpImage ) 139 { 140 if ( ( x < 0.0 ) || 141 ( x > ( double ) tmpImage->numCols ) || 142 ( y < 0.0 ) || 143 ( y > ( double ) tmpImage->numRows ) ) { 144 return ( 0 ); 145 } 146 return ( 1 ); 102 147 } 103 148 … … 115 160 XXX: must deallocate memory. 116 161 *****************************************************************************/ 117 psCell *psCellinChip(psCell *out, 118 const psPlane *coord, 119 const psChip *chip) 120 { 121 psCell *tmpCell = NULL; 122 psReadout *tmpReadout = NULL; 123 psPlane *tmpCoord = NULL; 124 125 for (tmpCell = chip->cells; tmpCell != NULL; tmpCell++) { 126 if (tmpCell->readouts != NULL) { 127 tmpReadout = tmpCell->readouts; 128 tmpCoord = psPlaneTransformApply(out, tmpCell->fromChip, coord); 129 if (p_psCheckValidImageCoords(tmpCoord->x, tmpCoord->y, 130 tmpReadout->image)) { 131 return(tmpCell); 132 } 133 } 134 } 135 return(NULL); 136 } 137 138 psPlane *psCoordCelltoChip(psPlane *out, 162 psCell *psCellinChip( psCell *out, 163 const psPlane *coord, 164 const psChip *chip ) 165 { 166 psPlane * tmpCoord = NULL; 167 psArray* cells; 168 169 if ( chip == NULL ) { 170 return NULL; 171 } 172 173 cells = chip->cells; 174 175 if ( cells == NULL ) { 176 return NULL; 177 } 178 179 for ( int i = 0; i < cells->n; i++ ) { 180 psCell* tmpCell = ( psCell* ) cells->data[ i ]; 181 psArray* readouts = tmpCell->readouts; 182 if ( readouts != NULL ) { 183 for ( int j = 0; j < readouts->n; j++ ) { 184 psReadout* tmpReadout = readouts->data[ j ]; 185 tmpCoord = psPlaneTransformApply( tmpCoord, tmpCell->fromChip, coord ); 186 if ( checkValidImageCoords( tmpCoord->x, tmpCoord->y, 187 tmpReadout->image ) ) { 188 return ( tmpCell ); 189 } 190 } 191 } 192 } 193 return ( NULL ); 194 } 195 196 psPlane *psCoordCelltoChip( psPlane *out, 197 const psPlane *in, 198 const psCell *cell ) 199 { 200 return ( psPlaneTransformApply( out, cell->toChip, in ) ); 201 } 202 203 psPlane *psCoordChipToFPA( psPlane *out, 139 204 const psPlane *in, 140 const psCell *cell) 141 { 142 return(psPlaneTransformApply(out, cell->toChip, in)); 143 } 144 145 psPlane *psCoordChipToFPA(psPlane *out, 205 const psChip *chip ) 206 { 207 return ( psPlaneTransformApply( out, chip->toFPA, in ) ); 208 } 209 210 psPlane *psCoordFPAtoTP( psPlane *out, 211 const psPlane *in, 212 const psFPA *fpa ) 213 { 214 // XXX: This code doesn't work; fpa->toTangentPlane is of the wrong type. 215 // return(psPlaneTransformApply(out, fpa->toTangentPlane, in)); 216 return ( NULL ); 217 } 218 219 // XXX: must wrap SLA_QAPQK here. 220 psSphere *psCoordTPtoSky( psSphere *out, 146 221 const psPlane *in, 147 const psChip *chip) 148 { 149 return(psPlaneTransformApply(out, chip->toFPA, in)); 150 } 151 152 psPlane *psCoordFPAtoTP(psPlane *out, 153 const psPlane *in, 154 const psFPA *fpa) 155 { 156 return(psPlaneTransformApply(out, fpa->toTangentPlane, in)); 157 } 158 159 // XXX: must wrap SLA_QAPQK here. 160 psSphere *psCoordTPtoSky(psSphere *out, 161 const psPlane *in, 162 const psGrommit *grommit) 222 const psGrommit *grommit ) 163 223 { 164 224 /* … … 169 229 sla_OAPQK(TYPE, OB1, OB2, *grommit, &RAP, &DAP); 170 230 */ 171 172 return (out);173 } 174 175 176 psPlane *psCoordCellToFPA( psPlane *out,177 const psPlane *in,178 const psCell *cell)179 { 180 return (psPlaneTransformApply(out, cell->toFPA, in));231 232 return ( out ); 233 } 234 235 236 psPlane *psCoordCellToFPA( psPlane *out, 237 const psPlane *in, 238 const psCell *cell ) 239 { 240 return ( psPlaneTransformApply( out, cell->toFPA, in ) ); 181 241 } 182 242 … … 185 245 // transformation, as well as a few psPlane structs. Can this be implemented 186 246 // better? 187 psSphere *psCoordCelltoSky(psSphere *out, 247 psSphere *psCoordCelltoSky( psSphere *out, 248 const psPlane *in, 249 const psCell *cell ) 250 { 251 psPlane * tmp1 = NULL; 252 psPlane *tmp2 = NULL; 253 psFPA *parFPA = ( cell->parent ) ->parent; 254 psGrommit *tmpGrommit = NULL; 255 256 tmp1 = psPlaneTransformApply( tmp1, cell->toFPA, in ); 257 tmp2 = psPlaneTransformApply( tmp2, parFPA->toTangentPlane, tmp1 ); 258 tmpGrommit = psGrommitAlloc( parFPA->exposure ); 259 tmp3 = psCoordTPtoSky( out, tmp2, psGrommit ); 260 261 psFree( tmp1 ); 262 psFree( tmp2 ); 263 psFree( tmpGrommit ); 264 265 return ( psCoordTPtoSky( out, tmp2, psGrommit ) ); 266 267 } 268 269 psSphere *psCoordCelltoSkyQuick( psSphere *out, 270 const psPlane *in, 271 const psCell *cell ) 272 { 273 psPlane * tmp1 = NULL; 274 275 tmp1 = psPlaneTransformApply( tmp1, cell->toSky, in ); 276 277 //XXX: Do something to convert the linear coords in tmp1 to spherical 278 // coords in out. 279 280 psFree( tmp1 ); 281 282 return ( out ); 283 } 284 285 // XXX: must wrap SLA_AOPQK here. 286 psPlane *psCoordSkytoTP( psPlane *out, 287 const psSphere *in, 288 const psGrommit *grommit ) 289 { 290 extern void sla_AOPQK ( RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB ); 291 double AOB; 292 double ZOB; 293 double HOB; 294 double DOB; 295 double ROB; 296 297 if ( out == NULL ) { 298 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 299 } 300 301 sla_AOPQK( psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB ); 302 out->x = XXX; 303 out->y = XXX; 304 return ( out ); 305 } 306 307 psPlane *psCoordTPtoFPA( psPlane *out, 308 const psPlane *in, 309 const psFPA *fpa ) 310 { 311 return ( psPlaneTransformApply( out, fpa->fromTangentPlane, in ) ); 312 } 313 314 psPlane *psCoordFPAtoChip( psPlane *out, 188 315 const psPlane *in, 189 const psCell *cell) 190 { 191 psPlane *tmp1 = NULL; 192 psPlane *tmp2 = NULL; 193 psFPA *parFPA = (cell->parent)->parent; 194 psGrommit *tmpGrommit = NULL; 195 196 tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in) 197 tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1) 198 tmpGrommit = psGrommitAlloc(parFPA->exposure) 199 tmp3 = psCoordTPtoSky(out, tmp2, psGrommit); 200 201 psFree(tmp1); 202 psFree(tmp2); 203 psFree(tmpGrommit); 204 205 return(psCoordTPtoSky(out, tmp2, psGrommit); 206 } 207 208 psSphere *psCoordCelltoSkyQuick(psSphere *out, 209 const psPlane *in, 210 const psCell *cell) 211 { 212 psPlane *tmp1 = NULL; 213 214 tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in); 215 216 //XXX: Do something to convert the linear coords in tmp1 to spherical 217 // coords in out. 218 219 free(tmp1) 220 221 return(out); 222 } 223 224 // XXX: must wrap SLA_AOPQK here. 225 psPlane *psCoordSkytoTP(psPlane *out, 226 const psSphere *in, 227 const psGrommit *grommit) 228 { 229 extern void sla_AOPQK (RAP, DAP, AOPRMS, AOB, ZOB, HOB, DOB, ROB); 230 double AOB; 231 double ZOB; 232 double HOB; 233 double DOB; 234 double ROB; 235 236 if (out == NULL) { 237 out = (psPlane *) psAlloc(sizeof(psPlane)); 238 } 239 240 sla_AOPQK(psSphere->r, psSphere->d, *grommit, &AOB, &ZOB, &HOB, &DOB, &ROB); 241 out->x = XXX; 242 out->y = XXX; 243 return(out); 244 } 245 246 psPlane *psCoordTPtoFPA(psPlane *out, 247 const psPlane *in, 248 const psFPA *fpa) 249 { 250 return(psPlaneTransformApply(out, fpa->fromTangentPlane, in)); 251 } 252 253 psPlane *psCoordFPAtoChip(psPlane *out, 254 const psPlane *in, 255 const psChip *chip) 256 { 257 return(psPlaneTransformApply(out, chip->fromFPA, in)); 258 } 259 260 261 psPlane *psCoordChiptoCell(psPlane *out, 262 const psPlane *in, 263 const psCell *cell) 264 { 265 return(psPlaneTransformApply(out, cell->fromChip, in)); 266 } 267 268 psPlane *psCoordSkytoCell(psPlane *out, 269 const psSphere *in, 270 const psCell *cell) 271 { 272 out = psCoordSkytoTP(out, in, tmpGrommit); 273 out = psCoordTPtoFPA(out, out, whichFPA); 274 out = psCoordFPAtoChip(out, out, whichChip); 275 out = psCoordChiptoCell(out, out, whichCell); 276 277 return(out); 278 } 279 280 psPlane *psCoordSkytoCellQuick(psPlane *out, 281 const psSphere *in, 282 const psCell *cell) 283 { 284 if (out == NULL) { 285 out = (psPlane *) psAlloc(sizeof(psPlane)); 286 } 287 288 return(out); 289 } 290 291 316 const psChip *chip ) 317 { 318 return ( psPlaneTransformApply( out, chip->fromFPA, in ) ); 319 } 320 321 322 psPlane *psCoordChiptoCell( psPlane *out, 323 const psPlane *in, 324 const psCell *cell ) 325 { 326 return ( psPlaneTransformApply( out, cell->fromChip, in ) ); 327 } 328 329 psPlane *psCoordSkytoCell( psPlane *out, 330 const psSphere *in, 331 const psCell *cell ) 332 { 333 out = psCoordSkytoTP( out, in, tmpGrommit ); 334 out = psCoordTPtoFPA( out, out, whichFPA ); 335 out = psCoordFPAtoChip( out, out, whichChip ); 336 out = psCoordChiptoCell( out, out, whichCell ); 337 338 return ( out ); 339 } 340 341 psPlane *psCoordSkytoCellQuick( psPlane *out, 342 const psSphere *in, 343 const psCell *cell ) 344 { 345 if ( out == NULL ) { 346 out = ( psPlane * ) psAlloc( sizeof( psPlane ) ); 347 } 348 349 return ( out ); 350 } 351 352 353 354 -
trunk/psLib/src/astronomy/psAstrometry.h
r1333 r1382 1 /** @file psCoord2.h 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 AstroImage 9 * 10 * @author George Gusciora, MHPCC 11 * 12 * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-07-29 04:22:26 $ 14 * 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 */ 17 18 # ifndef PS_COORD2_H 19 # define PS_COORD2_H 1 /** @file psAstrometry.h 2 * 3 * @brief This file defines the basic types for astronomical coordinate 4 * transformation 5 * 6 * @ingroup AstroImage 7 * 8 * @author George Gusciora, MHPCC 9 * 10 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-04 22:11:09 $ 12 * 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 14 */ 15 16 # ifndef PS_ASTROMETRY_H 17 # define PS_ASTROMETRY_H 20 18 21 19 #include "psType.h" … … 24 22 #include "psList.h" 25 23 #include "psFunctions.h" 24 #include "psMetadata.h" 25 #include "psCoord.h" 26 #include "psPhotometry.h" 27 28 struct psCell; 29 struct psChip; 30 struct psFPA; 31 struct psExposure; 32 33 /// @addtogroup AstroImage 34 /// @{ 26 35 27 36 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 }37 { 38 const double latitude; ///< 39 const double sinLat, cosLat; ///< 40 const double abberationMag; ///< 41 const double height; ///< 42 const double temperature; ///< 43 const double pressure; ///< 44 const double humidity; ///< 45 const double wavelength; ///< 46 const double lapseRate; ///< 47 const double refractA, refractB; ///< 48 const double longitudeOffset; ///< 49 const double siderealTime; ///< 50 } 42 51 psGrommit; 43 52 44 53 typedef struct 45 {46 int nX, nY; ///<47 double x0, y0; ///<48 double xScale, yScale; ///<49 double **x, **y; ///<50 }54 { 55 int nX, nY; ///< 56 double x0, y0; ///< 57 double xScale, yScale; ///< 58 double **x, **y; ///< 59 } 51 60 psFixedPattern; 52 61 53 psGrommit *psGrommitAlloc(const psExposure *exp); 54 55 void p_psGrommitFree(psGrommit *grommit); 56 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, 62 /** Readout data structure. 63 * 64 * A readout is the result of a single read of a cell (or a portion thereof). 65 * It contains a pointer to the pixel data, and additional pointers to the 66 * objects found in the readout, and the readout metadata. It also contains 67 * the offset from the lower-left corner of the chip, in the case that the 68 * CCD was windowed. 69 * 70 */ 71 typedef struct 72 { 73 const unsigned int colBins; ///< Amount of binning in x-dimension 74 const unsigned int rowBins; ///< Amount of binning in y-dimension 75 const int col0; ///< Offset from the left of chip. 76 const int row0; ///< Offset from the bottom of chip. 77 78 psImage* image; ///< imaging area of Readout 79 psList* objects; ///< objects derived from Readout 80 psMetadata* metadata; ///< readout-level metadata 81 } 82 psReadout; 83 84 /** Cell data structure 85 * 86 * A cell consists of one or more readouts. It also contains a pointer to the 87 * cell's metadata, and its parent chip. On the astrometry side, it also 88 * contains coordinate transforms from the cell to chip, from the cell to 89 * focal-plane, as well as a "quick and dirty" tranform from the cell to 90 * sky coordinates. 91 * 92 */ 93 typedef struct psCell 94 { 95 psArray* readouts; ///< readouts from the cell 96 psMetadata* metadata; ///< cell-level metadata 97 98 psPlaneTransform* toChip; ///< transformations from cell to chip coordinates 99 psPlaneTransform* fromChip; ///< transformations from chip to cell coordinates 100 psPlaneTransform* toFPA; ///< transformations from cell to FPA coordinates 101 psPlaneTransform* toSky; ///< transformations from cell to sky coordinates 102 103 struct psChip* parent; ///< chip in which contains this cell 104 } 105 psCell; 106 107 /** Chip data structure 108 * 109 * A chip consists of one or more cells (according to the number of amplifiers 110 * on the CCD). It contains a pointer to the chip's metadata, and a pointer 111 * to the parent focal plane. For astrometry, ot contains a coordinate 112 * transform from the chip to the focal plane, and vis-versa. 113 * 114 */ 115 typedef struct psChip 116 { 117 psArray* cells; ///< cells in the chip 118 psMetadata* metadata; ///< chip-level metadata 119 120 psPlaneTransform* toFPA; ///< transformation from chip to FPA coordinates 121 psPlaneTransform* fromFPA; ///< transformation from FPA to chip coordinates 122 123 struct psFPA* parent; ///< FPA which contains this chip 124 } 125 psChip; 126 127 /** A Focal-Plane 128 * 129 * A focal plane consists of one or more chips (according to the number of 130 * contiguous silicon). It contains pointers to the focal-plane's metadata 131 * and the exposure information. For astrometry, it contains a transformation 132 * from the focal plane to the tangent plane and the fixed pattern residuals. 133 * Since colors are involved in the transformation, it is necessary to specify 134 * the color the transformation is defined. We also include some values to 135 * characterize the quality of the transformation: the root square deviation 136 * for the x and y transformation fits, and the chi-squared for the 137 * transformation fit. 138 * 139 */ 140 typedef struct psFPA 141 { 142 psArray* chips; ///< chips in the focal plane array 143 psMetadata* metadata; ///< focal-plane's metadata 144 145 psPlaneDistort* fromTangentPlane; ///< transformation from tangent plane to focal plane 146 psPlaneDistort* toTangentPlane; ///< transformation from focal plane to tangent plane 147 psFixedPattern* pattern; ///< fixed pattern residual offsets 148 149 const struct psExposure* exposure; ///< information about this exposure 150 151 psPhotSystem* colorPlus; ///< Color reference 152 psPhotSystem* colorMinus; ///< Color reference 153 154 float rmsX; ///< RMS for x transformation fits 155 float rmsY; ///< RMS for y transformation fits 156 float chi2; ///< chi^2 of astrometric solution 157 } 158 psFPA; 159 160 /** Exposure Information 161 * 162 * Several quantities from the telescope in order to make a first guess at 163 * the astrometric solution. From these quantities, further quantities can 164 * be derivedand stored for later use. 165 * 166 */ 167 typedef struct psExposure 168 { 169 const double ra; ///< Telescope boresight, right ascention 170 const double dec; ///< Telescope boresight, declination 171 const double hourAngle; ///< Hour angle 172 const double zenith; ///< Zenith distance 173 const double azimuth; ///< Azimuth 174 const double localTime; ///< Local Sidereal Time 175 const float date; ///< Modified Jullian Date of observation 176 const float rotAngle; ///< Rotator position angle 177 const float temperature; ///< Air temperature, for estimating refraction 178 const float pressure; ///< Air pressure, for calculating refraction 179 const float humidity; ///< Relative humidity, for refraction 180 const float exposureTime; ///< Exposure time 181 182 /* Derived quantities */ 183 const float positionAngle; ///< Position angle 184 const float parallacticAngle; ///< Parallactic angle 185 const float airmass; ///< Airmass, calculated from zenith distance 186 const float parallacticFactor; ///< Parallactic factor 187 const char *cameraName; ///< name of camera which provided exposure 188 const char *telescopeName; ///< name of telescope which provided exposure 189 } 190 psExposure; 191 192 psExposure* psExposureAlloc( 193 double ra, ///< Telescope boresight, right ascention 194 double dec, ///< Telescope boresight, declination 195 double hourAngle, ///< Hour angle 196 double zenith, ///< Zenith distance 197 double azimuth, ///< Azimuth 198 double localTime, ///< Local Sidereal Time 199 float date, ///< MJD 200 float rotAngle, ///< Rotator position angle 201 float temperature, ///< Temperature 202 float pressure, ///< Pressure 203 float humidity, ///< Relative humidity 204 float exposureTime ///< Exposure time 205 ); 206 207 psGrommit* psGrommitAlloc( const psExposure* exp ); 208 209 psCell *psCellinFPA( psCell *out, 66 210 const psPlane *coord, 67 const psChip *chip); 68 69 70 71 72 psPlane *psCoordCelltoChip(psPlane *out, 211 const psFPA *FPA ); 212 213 psChip *psChipinFPA( psChip *out, 214 const psPlane *coord, 215 const psFPA *FPA ); 216 217 psCell *psCellinChip( psCell *out, 218 const psPlane *coord, 219 const psChip *chip ); 220 221 222 223 224 psPlane *psCoordCelltoChip( psPlane *out, 225 const psPlane *in, 226 const psCell *cell ); 227 228 psPlane *psCoordChipToFPA( psPlane *out, 73 229 const psPlane *in, 74 const psCell *cell); 75 76 psPlane *psCoordChipToFPA(psPlane *out, 230 const psChip *chip ); 231 232 psPlane *psCoordFPAtoTP( psPlane *out, 233 const psPlane *in, 234 const psFPA *fpa ); 235 236 psSphere *psCoordTPtoSky( psSphere *out, 77 237 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, 238 const psGrommit *grommit ); 239 240 psPlane *psCoordCellToFPA( psPlane *out, 241 const psPlane *in, 242 const psCell *cell ); 243 244 psSphere *psCoordCelltoSky( psSphere *out, 245 const psPlane *in, 246 const psCell *cell ); 247 248 psSphere *psCoordCelltoSkyQuick( psSphere *out, 249 const psPlane *in, 250 const psCell *cell ); 251 252 psPlane *psCoordSkytoTP( psPlane *out, 253 const psSphere *in, 254 const psGrommit *grommit ); 255 256 psPlane *psCoordTPtoFPA( psPlane *out, 85 257 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, 258 const psFPA *fpa ); 259 260 psPlane *psCoordFPAtoChip( psPlane *out, 93 261 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); 123 262 const psChip *chip ); 263 264 psPlane *psCoordChiptoCell( psPlane *out, 265 const psPlane *in, 266 const psCell *cell ); 267 268 psPlane *psCoordSkytoCell( psPlane *out, 269 const psSphere *in, 270 const psCell *cell ); 271 272 psPlane *psCoordSkytoCellQuick( psPlane *out, 273 const psSphere *in, 274 const psCell *cell ); 275 124 276 #endif -
trunk/psLib/src/astronomy/psMetadata.h
r1379 r1382 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-04 2 0:59:41$12 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 22:11:09 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #define PS_METADATA_H 19 19 20 #include <stdarg.h> 21 #include <stdio.h> 22 #include <fitsio.h> 23 24 #include "psHash.h" 25 #include "psList.h" 20 26 21 27 /// @addtogroup Metadata … … 33 39 */ 34 40 typedef enum { 35 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items36 PS_META_BOOL, ///< Boolean data.37 PS_META_S32, ///< Signed 32-bit integer data.38 PS_META_F32, ///< Single-precision float data.39 PS_META_F64, ///< Double-precision float data.40 PS_META_STR, ///< String data (Stored in as void *).41 PS_META_IMG, ///< Image data (Stored in as void *).42 PS_META_JPEG, ///< JPEG data (Stored in as void .43 PS_META_PNG, ///< PNG data (Stored in as void *).44 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).45 PS_META_UNKNOWN, ///< Other data (Stored in as void *).41 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 42 PS_META_BOOL, ///< Boolean data. 43 PS_META_S32, ///< Signed 32-bit integer data. 44 PS_META_F32, ///< Single-precision float data. 45 PS_META_F64, ///< Double-precision float data. 46 PS_META_STR, ///< String data (Stored in as void *). 47 PS_META_IMG, ///< Image data (Stored in as void *). 48 PS_META_JPEG, ///< JPEG data (Stored in as void . 49 PS_META_PNG, ///< PNG data (Stored in as void *). 50 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 51 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 46 52 PS_META_NTYPE ///< Number of types. Must be last. 47 53 } psMetadataType; … … 78 84 typedef struct psMetadata 79 85 { 80 psList *restrict list;81 psHash *restrict table;86 psList* restrict list; 87 psHash* restrict table; 82 88 } 83 89 psMetadata; … … 102 108 */ 103 109 psMetadataItem *psMetadataItemAlloc( 104 const char *name, ///< Name of metadata item.105 psMetadataType type, ///< Type of metadata item.106 const char *comment, ///< Comment for metadata item.110 const char *name, ///< Name of metadata item. 111 psMetadataType type, ///< Type of metadata item. 112 const char *comment, ///< Comment for metadata item. 107 113 ... ///< Arguments for name formatting and metadata item data. 108 114 ); … … 122 128 */ 123 129 psMetadataItem *psMetadataItemAllocV( 124 const char *name, ///< Name of metadata item.125 psMetadataType type, ///< Type of metadata item.126 const char *comment, ///< Comment for metadata item.130 const char *name, ///< Name of metadata item. 131 psMetadataType type, ///< Type of metadata item. 132 const char *comment, ///< Comment for metadata item. 127 133 va_list list ///< Arguments for name formatting and metadata item data. 128 134 ); … … 145 151 */ 146 152 bool psMetadataAddItem( 147 psMetadata *restrict md, ///< Metadata collection to insert metadat item.148 int where, ///< Location to be added.153 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 149 155 psMetadataItem *restrict item ///< Metadata item to be added. 150 156 ); … … 157 163 */ 158 164 bool psMetadataAdd( 159 psMetadata *restrict md, ///< Metadata collection to insert metadat item.160 int where, ///< Location to be added.161 const char *name, ///< Name of metadata item.162 psMetadataType type, ///< Type of metadata item.163 const char *comment, ///< Comment for metadata item.165 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 166 int where, ///< Location to be added. 167 const char *name, ///< Name of metadata item. 168 psMetadataType type, ///< Type of metadata item. 169 const char *comment, ///< Comment for metadata item. 164 170 ... ///< Arguments for name formatting and metadata item data. 165 171 ); … … 175 181 */ 176 182 bool psMetadataRemove( 177 psMetadata *restrict md, ///< Metadata collection to insert metadat item.178 int where, ///< Location to be removed.183 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 184 int where, ///< Location to be removed. 179 185 const char *restrict key ///< Name of metadata key. 180 186 ); … … 188 194 */ 189 195 psMetadataItem *psMetadataLookup( 190 psMetadata *restrict md, ///< Metadata collection to insert metadat item.196 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 191 197 const char *restrict key ///< Name of metadata key. 192 198 ); … … 199 205 */ 200 206 psMetadataItem *psMetadataGet( 201 psMetadata *restrict md, ///< Metadata collection to insert metadat item.207 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 202 208 int where ///< Location to be retrieved. 203 209 ); … … 210 216 */ 211 217 bool psMetadataSetIterator( 212 psMetadata *restrict md, ///< Metadata collection to iterate.218 psMetadata *restrict md, ///< Metadata collection to iterate. 213 219 int where ///< Location of iterator. 214 220 ); … … 221 227 */ 222 228 psMetadataItem *psMetadataGetNext( 223 psMetadata *restrict md, ///< Metadata collection to iterate.224 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. 225 231 int which ///< Iterator to be used. 226 232 ); … … 233 239 */ 234 240 psMetadataItem *psMetadataGetPrevious( 235 psMetadata *restrict md, ///< Metadata collection to iterate.236 const char *restrict match, ///< Beginning of key name.241 psMetadata *restrict md, ///< Metadata collection to iterate. 242 const char *restrict match, ///< Beginning of key name. 237 243 int which ///< Iterator to be used. 238 244 ); … … 249 255 */ 250 256 void psMetadataItemPrint( 251 FILE *fd, ///< Pointer to file to write metadata item.252 const char *format, ///< Format to print metadata item.257 FILE *fd, ///< Pointer to file to write metadata item. 258 const char *format, ///< Format to print metadata item. 253 259 const psMetadataItem *restrict metadataItem ///< Metadata item to print. 254 260 ); … … 261 267 */ 262 268 psMetadata *psMetadataReadHeader( 263 psMetadata *output, ///< Resulting metadata from read.264 const char *extname, ///< File name extension string.265 int extnum, ///< File name extension number.269 psMetadata *output, ///< Resulting metadata from read. 270 const char *extname, ///< File name extension string. 271 int extnum, ///< File name extension number. 266 272 const char *filename ///< Name of file to read. 267 273 ); … … 274 280 */ 275 281 psMetadata *psMetadataFReadHeader( 276 psMetadata *output, ///< Resulting metadata from read.277 const char *extname, ///< File name extension string.278 int extnum, ///< File name extension number.279 fitsfile *fd ///< Pointer to file to read.282 psMetadata *output, ///< Resulting metadata from read. 283 const char *extname, ///< File name extension string. 284 int extnum, ///< File name extension number. 285 fitsfile *fd ///< Pointer to file to read. 280 286 ); 281 287 /// @} -
trunk/psLib/src/collections/psMetadata.h
r1380 r1382 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-04 2 0:59:41$12 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 22:11:09 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #define PS_METADATA_H 19 19 20 #include <stdarg.h> 21 #include <stdio.h> 22 #include <fitsio.h> 23 24 #include "psHash.h" 25 #include "psList.h" 20 26 21 27 /// @addtogroup Metadata … … 33 39 */ 34 40 typedef enum { 35 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items36 PS_META_BOOL, ///< Boolean data.37 PS_META_S32, ///< Signed 32-bit integer data.38 PS_META_F32, ///< Single-precision float data.39 PS_META_F64, ///< Double-precision float data.40 PS_META_STR, ///< String data (Stored in as void *).41 PS_META_IMG, ///< Image data (Stored in as void *).42 PS_META_JPEG, ///< JPEG data (Stored in as void .43 PS_META_PNG, ///< PNG data (Stored in as void *).44 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).45 PS_META_UNKNOWN, ///< Other data (Stored in as void *).41 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 42 PS_META_BOOL, ///< Boolean data. 43 PS_META_S32, ///< Signed 32-bit integer data. 44 PS_META_F32, ///< Single-precision float data. 45 PS_META_F64, ///< Double-precision float data. 46 PS_META_STR, ///< String data (Stored in as void *). 47 PS_META_IMG, ///< Image data (Stored in as void *). 48 PS_META_JPEG, ///< JPEG data (Stored in as void . 49 PS_META_PNG, ///< PNG data (Stored in as void *). 50 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 51 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 46 52 PS_META_NTYPE ///< Number of types. Must be last. 47 53 } psMetadataType; … … 78 84 typedef struct psMetadata 79 85 { 80 psList *restrict list;81 psHash *restrict table;86 psList* restrict list; 87 psHash* restrict table; 82 88 } 83 89 psMetadata; … … 102 108 */ 103 109 psMetadataItem *psMetadataItemAlloc( 104 const char *name, ///< Name of metadata item.105 psMetadataType type, ///< Type of metadata item.106 const char *comment, ///< Comment for metadata item.110 const char *name, ///< Name of metadata item. 111 psMetadataType type, ///< Type of metadata item. 112 const char *comment, ///< Comment for metadata item. 107 113 ... ///< Arguments for name formatting and metadata item data. 108 114 ); … … 122 128 */ 123 129 psMetadataItem *psMetadataItemAllocV( 124 const char *name, ///< Name of metadata item.125 psMetadataType type, ///< Type of metadata item.126 const char *comment, ///< Comment for metadata item.130 const char *name, ///< Name of metadata item. 131 psMetadataType type, ///< Type of metadata item. 132 const char *comment, ///< Comment for metadata item. 127 133 va_list list ///< Arguments for name formatting and metadata item data. 128 134 ); … … 145 151 */ 146 152 bool psMetadataAddItem( 147 psMetadata *restrict md, ///< Metadata collection to insert metadat item.148 int where, ///< Location to be added.153 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 149 155 psMetadataItem *restrict item ///< Metadata item to be added. 150 156 ); … … 157 163 */ 158 164 bool psMetadataAdd( 159 psMetadata *restrict md, ///< Metadata collection to insert metadat item.160 int where, ///< Location to be added.161 const char *name, ///< Name of metadata item.162 psMetadataType type, ///< Type of metadata item.163 const char *comment, ///< Comment for metadata item.165 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 166 int where, ///< Location to be added. 167 const char *name, ///< Name of metadata item. 168 psMetadataType type, ///< Type of metadata item. 169 const char *comment, ///< Comment for metadata item. 164 170 ... ///< Arguments for name formatting and metadata item data. 165 171 ); … … 175 181 */ 176 182 bool psMetadataRemove( 177 psMetadata *restrict md, ///< Metadata collection to insert metadat item.178 int where, ///< Location to be removed.183 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 184 int where, ///< Location to be removed. 179 185 const char *restrict key ///< Name of metadata key. 180 186 ); … … 188 194 */ 189 195 psMetadataItem *psMetadataLookup( 190 psMetadata *restrict md, ///< Metadata collection to insert metadat item.196 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 191 197 const char *restrict key ///< Name of metadata key. 192 198 ); … … 199 205 */ 200 206 psMetadataItem *psMetadataGet( 201 psMetadata *restrict md, ///< Metadata collection to insert metadat item.207 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 202 208 int where ///< Location to be retrieved. 203 209 ); … … 210 216 */ 211 217 bool psMetadataSetIterator( 212 psMetadata *restrict md, ///< Metadata collection to iterate.218 psMetadata *restrict md, ///< Metadata collection to iterate. 213 219 int where ///< Location of iterator. 214 220 ); … … 221 227 */ 222 228 psMetadataItem *psMetadataGetNext( 223 psMetadata *restrict md, ///< Metadata collection to iterate.224 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. 225 231 int which ///< Iterator to be used. 226 232 ); … … 233 239 */ 234 240 psMetadataItem *psMetadataGetPrevious( 235 psMetadata *restrict md, ///< Metadata collection to iterate.236 const char *restrict match, ///< Beginning of key name.241 psMetadata *restrict md, ///< Metadata collection to iterate. 242 const char *restrict match, ///< Beginning of key name. 237 243 int which ///< Iterator to be used. 238 244 ); … … 249 255 */ 250 256 void psMetadataItemPrint( 251 FILE *fd, ///< Pointer to file to write metadata item.252 const char *format, ///< Format to print metadata item.257 FILE *fd, ///< Pointer to file to write metadata item. 258 const char *format, ///< Format to print metadata item. 253 259 const psMetadataItem *restrict metadataItem ///< Metadata item to print. 254 260 ); … … 261 267 */ 262 268 psMetadata *psMetadataReadHeader( 263 psMetadata *output, ///< Resulting metadata from read.264 const char *extname, ///< File name extension string.265 int extnum, ///< File name extension number.269 psMetadata *output, ///< Resulting metadata from read. 270 const char *extname, ///< File name extension string. 271 int extnum, ///< File name extension number. 266 272 const char *filename ///< Name of file to read. 267 273 ); … … 274 280 */ 275 281 psMetadata *psMetadataFReadHeader( 276 psMetadata *output, ///< Resulting metadata from read.277 const char *extname, ///< File name extension string.278 int extnum, ///< File name extension number.279 fitsfile *fd ///< Pointer to file to read.282 psMetadata *output, ///< Resulting metadata from read. 283 const char *extname, ///< File name extension string. 284 int extnum, ///< File name extension number. 285 fitsfile *fd ///< Pointer to file to read. 280 286 ); 281 287 /// @} -
trunk/psLib/src/dataManip/psFunctions.h
r1342 r1382 1 1 /** @file psFunctions.h 2 * \brief Standard Mathematical Functions.3 * \ingroup Stats4 *5 * This file will hold the prototypes for procedures which allocate, free,6 * and evaluate various polynomials. Those polynomial structures are also7 * defined here.8 *9 * @ingroup Stats10 *11 * @author Someone at IfA12 * @author George Gusciora, MHPCC13 *14 * @version $Revision: 1.11$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-07-29 23:34:24$16 *17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii18 */2 * \brief Standard Mathematical Functions. 3 * \ingroup Stats 4 * 5 * This file will hold the prototypes for procedures which allocate, free, 6 * and evaluate various polynomials. Those polynomial structures are also 7 * defined here. 8 * 9 * @ingroup Stats 10 * 11 * @author Someone at IfA 12 * @author George Gusciora, MHPCC 13 * 14 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-04 22:11:09 $ 16 * 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 18 */ 19 19 20 20 #if !defined(PS_FUNCTIONS_H) 21 21 #define PS_FUNCTIONS_H 22 23 #include <stdbool.h> 24 22 25 #include "psVector.h" 23 26 … … 31 34 32 35 float 33 psGaussian( float x,///< Value at which to evaluate34 float mean,///< Mean for the Gaussian35 float stddev,///< Standard deviation for the Gaussian36 boolnormal ///< Indicates whether result should be normalized36 psGaussian( float x, ///< Value at which to evaluate 37 float mean, ///< Mean for the Gaussian 38 float stddev, ///< Standard deviation for the Gaussian 39 bool normal ///< Indicates whether result should be normalized 37 40 ); 38 39 41 42 40 43 /** Produce a vector of random numbers from a Gaussian distribution with 41 44 the specified mean and sigma */ 42 psVector *psGaussianDev( float mean,///< The mean of the Gaussian43 float sigma,///< The sigma of the Gaussian44 int Npts); ///< The size of the vector45 46 47 48 49 45 psVector *psGaussianDev( float mean, ///< The mean of the Gaussian 46 float sigma, ///< The sigma of the Gaussian 47 int Npts ); ///< The size of the vector 48 49 50 51 52 50 53 /** One-dimensional polynomial */ 51 54 typedef struct 52 {53 int n; ///< Number of terms54 float *coeff; ///< Coefficients55 float *coeffErr; ///< Error in coefficients56 char *mask; ///< Coefficient mask57 }55 { 56 int n; ///< Number of terms 57 float *coeff; ///< Coefficients 58 float *coeffErr; ///< Error in coefficients 59 char *mask; ///< Coefficient mask 60 } 58 61 psPolynomial1D; 59 62 60 63 /** Two-dimensional polynomial */ 61 64 typedef struct 62 {63 int nX, nY; ///< Number of terms in x and y64 float **coeff; ///< Coefficients65 float **coeffErr; ///< Error in coefficients66 char **mask; ///< Coefficients mask67 }65 { 66 int nX, nY; ///< Number of terms in x and y 67 float **coeff; ///< Coefficients 68 float **coeffErr; ///< Error in coefficients 69 char **mask; ///< Coefficients mask 70 } 68 71 psPolynomial2D; 69 72 70 73 /** Three-dimensional polynomial */ 71 74 typedef struct 72 {73 int nX, nY, nZ; ///< Number of terms in x, y and z74 float ***coeff; ///< Coefficients75 float ***coeffErr; ///< Error in coefficients76 char ***mask; ///< Coefficients mask77 }75 { 76 int nX, nY, nZ; ///< Number of terms in x, y and z 77 float ***coeff; ///< Coefficients 78 float ***coeffErr; ///< Error in coefficients 79 char ***mask; ///< Coefficients mask 80 } 78 81 psPolynomial3D; 79 82 80 83 /** Four-dimensional polynomial */ 81 84 typedef struct 82 {83 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z84 float ****coeff; ///< Coefficients85 float ****coeffErr; ///< Error in coefficients86 char ****mask; ///< Coefficients mask87 }85 { 86 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 87 float ****coeff; ///< Coefficients 88 float ****coeffErr; ///< Error in coefficients 89 char ****mask; ///< Coefficients mask 90 } 88 91 psPolynomial4D; 89 92 … … 92 95 93 96 /** Constructor */ 94 psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms95 ); 96 /** Constructor */ 97 psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y98 ); 99 /** Constructor */ 100 psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z101 ); 102 /** Constructor */ 103 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z104 ); 105 97 psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms 98 ); 99 /** Constructor */ 100 psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 101 ); 102 /** Constructor */ 103 psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 104 ); 105 /** Constructor */ 106 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 107 ); 108 106 109 /** Evaluate 1D polynomial */ 107 110 float 108 psPolynomial1DEval( float x,///< Value at which to evaluate109 const psPolynomial1D *myPoly ///< Coefficients for the polynomial110 ); 111 111 psPolynomial1DEval( float x, ///< Value at which to evaluate 112 const psPolynomial1D *myPoly ///< Coefficients for the polynomial 113 ); 114 112 115 /** Evaluate 2D polynomial */ 113 116 float 114 psPolynomial2DEval( float x,///< Value x at which to evaluate115 float y,///< Value y at which to evaluate116 const psPolynomial2D *myPoly ///< Coefficients for the polynomial117 ); 118 117 psPolynomial2DEval( float x, ///< Value x at which to evaluate 118 float y, ///< Value y at which to evaluate 119 const psPolynomial2D *myPoly ///< Coefficients for the polynomial 120 ); 121 119 122 /** Evaluate 3D polynomial */ 120 123 float 121 psPolynomial3DEval( float x,///< Value x at which to evaluate122 float y,///< Value y at which to evaluate123 float z,///< Value z at which to evaluate124 const psPolynomial3D *myPoly ///< Coefficients for the polynomial125 ); 126 124 psPolynomial3DEval( float x, ///< Value x at which to evaluate 125 float y, ///< Value y at which to evaluate 126 float z, ///< Value z at which to evaluate 127 const psPolynomial3D *myPoly ///< Coefficients for the polynomial 128 ); 129 127 130 /** Evaluate 4D polynomial */ 128 131 float 129 psPolynomial4DEval( float w,///< Value w at which to evaluate130 float x,///< Value x at which to evaluate131 float y,///< Value y at which to evaluate132 float z,///< Value z at which to evaluate133 const psPolynomial4D *myPoly ///< Coefficients for the polynomial134 ); 135 132 psPolynomial4DEval( float w, ///< Value w at which to evaluate 133 float x, ///< Value x at which to evaluate 134 float y, ///< Value y at which to evaluate 135 float z, ///< Value z at which to evaluate 136 const psPolynomial4D *myPoly ///< Coefficients for the polynomial 137 ); 138 136 139 /*****************************************************************************/ 137 140 … … 140 143 /** Double-precision one-dimensional polynomial */ 141 144 typedef struct 142 {143 int n; ///< Number of terms144 double *coeff; ///< Coefficients145 double *coeffErr; ///< Error in coefficients146 char *mask; ///< Coefficient mask147 }145 { 146 int n; ///< Number of terms 147 double *coeff; ///< Coefficients 148 double *coeffErr; ///< Error in coefficients 149 char *mask; ///< Coefficient mask 150 } 148 151 psDPolynomial1D; 149 152 150 153 /** Double-precision two-dimensional polynomial */ 151 154 typedef struct 152 {153 int nX, nY; ///< Number of terms in x and y154 double **coeff; ///< Coefficients155 double **coeffErr; ///< Error in coefficients156 char **mask; ///< Coefficients mask157 }155 { 156 int nX, nY; ///< Number of terms in x and y 157 double **coeff; ///< Coefficients 158 double **coeffErr; ///< Error in coefficients 159 char **mask; ///< Coefficients mask 160 } 158 161 psDPolynomial2D; 159 162 160 163 /** Double-precision three-dimensional polynomial */ 161 164 typedef struct 162 {163 int nX, nY, nZ; ///< Number of terms in x, y and z164 double ***coeff; ///< Coefficients165 double ***coeffErr; ///< Error in coefficients166 char ***mask; ///< Coefficient mask167 }165 { 166 int nX, nY, nZ; ///< Number of terms in x, y and z 167 double ***coeff; ///< Coefficients 168 double ***coeffErr; ///< Error in coefficients 169 char ***mask; ///< Coefficient mask 170 } 168 171 psDPolynomial3D; 169 172 170 173 /** Double-precision four-dimensional polynomial */ 171 174 typedef struct 172 {173 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z174 double ****coeff; ///< Coefficients175 double ****coeffErr; ///< Error in coefficients176 char ****mask; ///< Coefficients mask177 }175 { 176 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 177 double ****coeff; ///< Coefficients 178 double ****coeffErr; ///< Error in coefficients 179 char ****mask; ///< Coefficients mask 180 } 178 181 psDPolynomial4D; 179 182 180 183 /** Constructor */ 181 psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms182 ); 183 /** Constructor */ 184 psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y185 ); 186 /** Constructor */ 187 psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z188 ); 189 /** Constructor */ 190 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z191 ); 192 184 psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms 185 ); 186 /** Constructor */ 187 psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 188 ); 189 /** Constructor */ 190 psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 191 ); 192 /** Constructor */ 193 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 194 ); 195 193 196 /** Evaluate 1D polynomial (double precision) */ 194 197 double 195 psDPolynomial1DEval( double x,///< Value at which to evaluate196 const psDPolynomial1D *myPoly ///< Coefficients for the polynomial197 ); 198 198 psDPolynomial1DEval( double x, ///< Value at which to evaluate 199 const psDPolynomial1D *myPoly ///< Coefficients for the polynomial 200 ); 201 199 202 /** Evaluate 2D polynomial (double precision) */ 200 203 double 201 psDPolynomial2DEval( double x,///< Value x at which to evaluate202 double y,///< Value y at which to evaluate203 const psDPolynomial2D *myPoly ///< Coefficients for the polynomial204 ); 205 204 psDPolynomial2DEval( double x, ///< Value x at which to evaluate 205 double y, ///< Value y at which to evaluate 206 const psDPolynomial2D *myPoly ///< Coefficients for the polynomial 207 ); 208 206 209 /** Evaluate 3D polynomial (double precision) */ 207 210 double 208 psDPolynomial3DEval( double x,///< Value x at which to evaluate209 double y,///< Value y at which to evaluate210 double z,///< Value z at which to evaluate211 const psDPolynomial3D *myPoly ///< Coefficients for the polynomial212 ); 213 211 psDPolynomial3DEval( double x, ///< Value x at which to evaluate 212 double y, ///< Value y at which to evaluate 213 double z, ///< Value z at which to evaluate 214 const psDPolynomial3D *myPoly ///< Coefficients for the polynomial 215 ); 216 214 217 /** Evaluate 4D polynomial (double precision) */ 215 218 double 216 psDPolynomial4DEval( double w,///< Value w at which to evaluate217 double x,///< Value x at which to evaluate218 double y,///< Value y at which to evaluate219 double z,///< Value z at which to evaluate220 const psDPolynomial4D *myPoly ///< Coefficients for the polynomial221 ); 222 219 psDPolynomial4DEval( double w, ///< Value w at which to evaluate 220 double x, ///< Value x at which to evaluate 221 double y, ///< Value y at which to evaluate 222 double z, ///< Value z at which to evaluate 223 const psDPolynomial4D *myPoly ///< Coefficients for the polynomial 224 ); 225 223 226 /* \} */ // End of MathGroup Functions 224 227 -
trunk/psLib/src/math/psPolynomial.h
r1342 r1382 1 1 /** @file psFunctions.h 2 * \brief Standard Mathematical Functions.3 * \ingroup Stats4 *5 * This file will hold the prototypes for procedures which allocate, free,6 * and evaluate various polynomials. Those polynomial structures are also7 * defined here.8 *9 * @ingroup Stats10 *11 * @author Someone at IfA12 * @author George Gusciora, MHPCC13 *14 * @version $Revision: 1.11$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-07-29 23:34:24$16 *17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii18 */2 * \brief Standard Mathematical Functions. 3 * \ingroup Stats 4 * 5 * This file will hold the prototypes for procedures which allocate, free, 6 * and evaluate various polynomials. Those polynomial structures are also 7 * defined here. 8 * 9 * @ingroup Stats 10 * 11 * @author Someone at IfA 12 * @author George Gusciora, MHPCC 13 * 14 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-04 22:11:09 $ 16 * 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 18 */ 19 19 20 20 #if !defined(PS_FUNCTIONS_H) 21 21 #define PS_FUNCTIONS_H 22 23 #include <stdbool.h> 24 22 25 #include "psVector.h" 23 26 … … 31 34 32 35 float 33 psGaussian( float x,///< Value at which to evaluate34 float mean,///< Mean for the Gaussian35 float stddev,///< Standard deviation for the Gaussian36 boolnormal ///< Indicates whether result should be normalized36 psGaussian( float x, ///< Value at which to evaluate 37 float mean, ///< Mean for the Gaussian 38 float stddev, ///< Standard deviation for the Gaussian 39 bool normal ///< Indicates whether result should be normalized 37 40 ); 38 39 41 42 40 43 /** Produce a vector of random numbers from a Gaussian distribution with 41 44 the specified mean and sigma */ 42 psVector *psGaussianDev( float mean,///< The mean of the Gaussian43 float sigma,///< The sigma of the Gaussian44 int Npts); ///< The size of the vector45 46 47 48 49 45 psVector *psGaussianDev( float mean, ///< The mean of the Gaussian 46 float sigma, ///< The sigma of the Gaussian 47 int Npts ); ///< The size of the vector 48 49 50 51 52 50 53 /** One-dimensional polynomial */ 51 54 typedef struct 52 {53 int n; ///< Number of terms54 float *coeff; ///< Coefficients55 float *coeffErr; ///< Error in coefficients56 char *mask; ///< Coefficient mask57 }55 { 56 int n; ///< Number of terms 57 float *coeff; ///< Coefficients 58 float *coeffErr; ///< Error in coefficients 59 char *mask; ///< Coefficient mask 60 } 58 61 psPolynomial1D; 59 62 60 63 /** Two-dimensional polynomial */ 61 64 typedef struct 62 {63 int nX, nY; ///< Number of terms in x and y64 float **coeff; ///< Coefficients65 float **coeffErr; ///< Error in coefficients66 char **mask; ///< Coefficients mask67 }65 { 66 int nX, nY; ///< Number of terms in x and y 67 float **coeff; ///< Coefficients 68 float **coeffErr; ///< Error in coefficients 69 char **mask; ///< Coefficients mask 70 } 68 71 psPolynomial2D; 69 72 70 73 /** Three-dimensional polynomial */ 71 74 typedef struct 72 {73 int nX, nY, nZ; ///< Number of terms in x, y and z74 float ***coeff; ///< Coefficients75 float ***coeffErr; ///< Error in coefficients76 char ***mask; ///< Coefficients mask77 }75 { 76 int nX, nY, nZ; ///< Number of terms in x, y and z 77 float ***coeff; ///< Coefficients 78 float ***coeffErr; ///< Error in coefficients 79 char ***mask; ///< Coefficients mask 80 } 78 81 psPolynomial3D; 79 82 80 83 /** Four-dimensional polynomial */ 81 84 typedef struct 82 {83 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z84 float ****coeff; ///< Coefficients85 float ****coeffErr; ///< Error in coefficients86 char ****mask; ///< Coefficients mask87 }85 { 86 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 87 float ****coeff; ///< Coefficients 88 float ****coeffErr; ///< Error in coefficients 89 char ****mask; ///< Coefficients mask 90 } 88 91 psPolynomial4D; 89 92 … … 92 95 93 96 /** Constructor */ 94 psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms95 ); 96 /** Constructor */ 97 psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y98 ); 99 /** Constructor */ 100 psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z101 ); 102 /** Constructor */ 103 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z104 ); 105 97 psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms 98 ); 99 /** Constructor */ 100 psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 101 ); 102 /** Constructor */ 103 psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 104 ); 105 /** Constructor */ 106 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 107 ); 108 106 109 /** Evaluate 1D polynomial */ 107 110 float 108 psPolynomial1DEval( float x,///< Value at which to evaluate109 const psPolynomial1D *myPoly ///< Coefficients for the polynomial110 ); 111 111 psPolynomial1DEval( float x, ///< Value at which to evaluate 112 const psPolynomial1D *myPoly ///< Coefficients for the polynomial 113 ); 114 112 115 /** Evaluate 2D polynomial */ 113 116 float 114 psPolynomial2DEval( float x,///< Value x at which to evaluate115 float y,///< Value y at which to evaluate116 const psPolynomial2D *myPoly ///< Coefficients for the polynomial117 ); 118 117 psPolynomial2DEval( float x, ///< Value x at which to evaluate 118 float y, ///< Value y at which to evaluate 119 const psPolynomial2D *myPoly ///< Coefficients for the polynomial 120 ); 121 119 122 /** Evaluate 3D polynomial */ 120 123 float 121 psPolynomial3DEval( float x,///< Value x at which to evaluate122 float y,///< Value y at which to evaluate123 float z,///< Value z at which to evaluate124 const psPolynomial3D *myPoly ///< Coefficients for the polynomial125 ); 126 124 psPolynomial3DEval( float x, ///< Value x at which to evaluate 125 float y, ///< Value y at which to evaluate 126 float z, ///< Value z at which to evaluate 127 const psPolynomial3D *myPoly ///< Coefficients for the polynomial 128 ); 129 127 130 /** Evaluate 4D polynomial */ 128 131 float 129 psPolynomial4DEval( float w,///< Value w at which to evaluate130 float x,///< Value x at which to evaluate131 float y,///< Value y at which to evaluate132 float z,///< Value z at which to evaluate133 const psPolynomial4D *myPoly ///< Coefficients for the polynomial134 ); 135 132 psPolynomial4DEval( float w, ///< Value w at which to evaluate 133 float x, ///< Value x at which to evaluate 134 float y, ///< Value y at which to evaluate 135 float z, ///< Value z at which to evaluate 136 const psPolynomial4D *myPoly ///< Coefficients for the polynomial 137 ); 138 136 139 /*****************************************************************************/ 137 140 … … 140 143 /** Double-precision one-dimensional polynomial */ 141 144 typedef struct 142 {143 int n; ///< Number of terms144 double *coeff; ///< Coefficients145 double *coeffErr; ///< Error in coefficients146 char *mask; ///< Coefficient mask147 }145 { 146 int n; ///< Number of terms 147 double *coeff; ///< Coefficients 148 double *coeffErr; ///< Error in coefficients 149 char *mask; ///< Coefficient mask 150 } 148 151 psDPolynomial1D; 149 152 150 153 /** Double-precision two-dimensional polynomial */ 151 154 typedef struct 152 {153 int nX, nY; ///< Number of terms in x and y154 double **coeff; ///< Coefficients155 double **coeffErr; ///< Error in coefficients156 char **mask; ///< Coefficients mask157 }155 { 156 int nX, nY; ///< Number of terms in x and y 157 double **coeff; ///< Coefficients 158 double **coeffErr; ///< Error in coefficients 159 char **mask; ///< Coefficients mask 160 } 158 161 psDPolynomial2D; 159 162 160 163 /** Double-precision three-dimensional polynomial */ 161 164 typedef struct 162 {163 int nX, nY, nZ; ///< Number of terms in x, y and z164 double ***coeff; ///< Coefficients165 double ***coeffErr; ///< Error in coefficients166 char ***mask; ///< Coefficient mask167 }165 { 166 int nX, nY, nZ; ///< Number of terms in x, y and z 167 double ***coeff; ///< Coefficients 168 double ***coeffErr; ///< Error in coefficients 169 char ***mask; ///< Coefficient mask 170 } 168 171 psDPolynomial3D; 169 172 170 173 /** Double-precision four-dimensional polynomial */ 171 174 typedef struct 172 {173 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z174 double ****coeff; ///< Coefficients175 double ****coeffErr; ///< Error in coefficients176 char ****mask; ///< Coefficients mask177 }175 { 176 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 177 double ****coeff; ///< Coefficients 178 double ****coeffErr; ///< Error in coefficients 179 char ****mask; ///< Coefficients mask 180 } 178 181 psDPolynomial4D; 179 182 180 183 /** Constructor */ 181 psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms182 ); 183 /** Constructor */ 184 psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y185 ); 186 /** Constructor */ 187 psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z188 ); 189 /** Constructor */ 190 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z191 ); 192 184 psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms 185 ); 186 /** Constructor */ 187 psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 188 ); 189 /** Constructor */ 190 psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 191 ); 192 /** Constructor */ 193 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 194 ); 195 193 196 /** Evaluate 1D polynomial (double precision) */ 194 197 double 195 psDPolynomial1DEval( double x,///< Value at which to evaluate196 const psDPolynomial1D *myPoly ///< Coefficients for the polynomial197 ); 198 198 psDPolynomial1DEval( double x, ///< Value at which to evaluate 199 const psDPolynomial1D *myPoly ///< Coefficients for the polynomial 200 ); 201 199 202 /** Evaluate 2D polynomial (double precision) */ 200 203 double 201 psDPolynomial2DEval( double x,///< Value x at which to evaluate202 double y,///< Value y at which to evaluate203 const psDPolynomial2D *myPoly ///< Coefficients for the polynomial204 ); 205 204 psDPolynomial2DEval( double x, ///< Value x at which to evaluate 205 double y, ///< Value y at which to evaluate 206 const psDPolynomial2D *myPoly ///< Coefficients for the polynomial 207 ); 208 206 209 /** Evaluate 3D polynomial (double precision) */ 207 210 double 208 psDPolynomial3DEval( double x,///< Value x at which to evaluate209 double y,///< Value y at which to evaluate210 double z,///< Value z at which to evaluate211 const psDPolynomial3D *myPoly ///< Coefficients for the polynomial212 ); 213 211 psDPolynomial3DEval( double x, ///< Value x at which to evaluate 212 double y, ///< Value y at which to evaluate 213 double z, ///< Value z at which to evaluate 214 const psDPolynomial3D *myPoly ///< Coefficients for the polynomial 215 ); 216 214 217 /** Evaluate 4D polynomial (double precision) */ 215 218 double 216 psDPolynomial4DEval( double w,///< Value w at which to evaluate217 double x,///< Value x at which to evaluate218 double y,///< Value y at which to evaluate219 double z,///< Value z at which to evaluate220 const psDPolynomial4D *myPoly ///< Coefficients for the polynomial221 ); 222 219 psDPolynomial4DEval( double w, ///< Value w at which to evaluate 220 double x, ///< Value x at which to evaluate 221 double y, ///< Value y at which to evaluate 222 double z, ///< Value z at which to evaluate 223 const psDPolynomial4D *myPoly ///< Coefficients for the polynomial 224 ); 225 223 226 /* \} */ // End of MathGroup Functions 224 227 -
trunk/psLib/src/math/psSpline.h
r1342 r1382 1 1 /** @file psFunctions.h 2 * \brief Standard Mathematical Functions.3 * \ingroup Stats4 *5 * This file will hold the prototypes for procedures which allocate, free,6 * and evaluate various polynomials. Those polynomial structures are also7 * defined here.8 *9 * @ingroup Stats10 *11 * @author Someone at IfA12 * @author George Gusciora, MHPCC13 *14 * @version $Revision: 1.11$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-07-29 23:34:24$16 *17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii18 */2 * \brief Standard Mathematical Functions. 3 * \ingroup Stats 4 * 5 * This file will hold the prototypes for procedures which allocate, free, 6 * and evaluate various polynomials. Those polynomial structures are also 7 * defined here. 8 * 9 * @ingroup Stats 10 * 11 * @author Someone at IfA 12 * @author George Gusciora, MHPCC 13 * 14 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-04 22:11:09 $ 16 * 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 18 */ 19 19 20 20 #if !defined(PS_FUNCTIONS_H) 21 21 #define PS_FUNCTIONS_H 22 23 #include <stdbool.h> 24 22 25 #include "psVector.h" 23 26 … … 31 34 32 35 float 33 psGaussian( float x,///< Value at which to evaluate34 float mean,///< Mean for the Gaussian35 float stddev,///< Standard deviation for the Gaussian36 boolnormal ///< Indicates whether result should be normalized36 psGaussian( float x, ///< Value at which to evaluate 37 float mean, ///< Mean for the Gaussian 38 float stddev, ///< Standard deviation for the Gaussian 39 bool normal ///< Indicates whether result should be normalized 37 40 ); 38 39 41 42 40 43 /** Produce a vector of random numbers from a Gaussian distribution with 41 44 the specified mean and sigma */ 42 psVector *psGaussianDev( float mean,///< The mean of the Gaussian43 float sigma,///< The sigma of the Gaussian44 int Npts); ///< The size of the vector45 46 47 48 49 45 psVector *psGaussianDev( float mean, ///< The mean of the Gaussian 46 float sigma, ///< The sigma of the Gaussian 47 int Npts ); ///< The size of the vector 48 49 50 51 52 50 53 /** One-dimensional polynomial */ 51 54 typedef struct 52 {53 int n; ///< Number of terms54 float *coeff; ///< Coefficients55 float *coeffErr; ///< Error in coefficients56 char *mask; ///< Coefficient mask57 }55 { 56 int n; ///< Number of terms 57 float *coeff; ///< Coefficients 58 float *coeffErr; ///< Error in coefficients 59 char *mask; ///< Coefficient mask 60 } 58 61 psPolynomial1D; 59 62 60 63 /** Two-dimensional polynomial */ 61 64 typedef struct 62 {63 int nX, nY; ///< Number of terms in x and y64 float **coeff; ///< Coefficients65 float **coeffErr; ///< Error in coefficients66 char **mask; ///< Coefficients mask67 }65 { 66 int nX, nY; ///< Number of terms in x and y 67 float **coeff; ///< Coefficients 68 float **coeffErr; ///< Error in coefficients 69 char **mask; ///< Coefficients mask 70 } 68 71 psPolynomial2D; 69 72 70 73 /** Three-dimensional polynomial */ 71 74 typedef struct 72 {73 int nX, nY, nZ; ///< Number of terms in x, y and z74 float ***coeff; ///< Coefficients75 float ***coeffErr; ///< Error in coefficients76 char ***mask; ///< Coefficients mask77 }75 { 76 int nX, nY, nZ; ///< Number of terms in x, y and z 77 float ***coeff; ///< Coefficients 78 float ***coeffErr; ///< Error in coefficients 79 char ***mask; ///< Coefficients mask 80 } 78 81 psPolynomial3D; 79 82 80 83 /** Four-dimensional polynomial */ 81 84 typedef struct 82 {83 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z84 float ****coeff; ///< Coefficients85 float ****coeffErr; ///< Error in coefficients86 char ****mask; ///< Coefficients mask87 }85 { 86 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 87 float ****coeff; ///< Coefficients 88 float ****coeffErr; ///< Error in coefficients 89 char ****mask; ///< Coefficients mask 90 } 88 91 psPolynomial4D; 89 92 … … 92 95 93 96 /** Constructor */ 94 psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms95 ); 96 /** Constructor */ 97 psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y98 ); 99 /** Constructor */ 100 psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z101 ); 102 /** Constructor */ 103 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z104 ); 105 97 psPolynomial1D *psPolynomial1DAlloc( int n ///< Number of terms 98 ); 99 /** Constructor */ 100 psPolynomial2D *psPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 101 ); 102 /** Constructor */ 103 psPolynomial3D *psPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 104 ); 105 /** Constructor */ 106 psPolynomial4D *psPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 107 ); 108 106 109 /** Evaluate 1D polynomial */ 107 110 float 108 psPolynomial1DEval( float x,///< Value at which to evaluate109 const psPolynomial1D *myPoly ///< Coefficients for the polynomial110 ); 111 111 psPolynomial1DEval( float x, ///< Value at which to evaluate 112 const psPolynomial1D *myPoly ///< Coefficients for the polynomial 113 ); 114 112 115 /** Evaluate 2D polynomial */ 113 116 float 114 psPolynomial2DEval( float x,///< Value x at which to evaluate115 float y,///< Value y at which to evaluate116 const psPolynomial2D *myPoly ///< Coefficients for the polynomial117 ); 118 117 psPolynomial2DEval( float x, ///< Value x at which to evaluate 118 float y, ///< Value y at which to evaluate 119 const psPolynomial2D *myPoly ///< Coefficients for the polynomial 120 ); 121 119 122 /** Evaluate 3D polynomial */ 120 123 float 121 psPolynomial3DEval( float x,///< Value x at which to evaluate122 float y,///< Value y at which to evaluate123 float z,///< Value z at which to evaluate124 const psPolynomial3D *myPoly ///< Coefficients for the polynomial125 ); 126 124 psPolynomial3DEval( float x, ///< Value x at which to evaluate 125 float y, ///< Value y at which to evaluate 126 float z, ///< Value z at which to evaluate 127 const psPolynomial3D *myPoly ///< Coefficients for the polynomial 128 ); 129 127 130 /** Evaluate 4D polynomial */ 128 131 float 129 psPolynomial4DEval( float w,///< Value w at which to evaluate130 float x,///< Value x at which to evaluate131 float y,///< Value y at which to evaluate132 float z,///< Value z at which to evaluate133 const psPolynomial4D *myPoly ///< Coefficients for the polynomial134 ); 135 132 psPolynomial4DEval( float w, ///< Value w at which to evaluate 133 float x, ///< Value x at which to evaluate 134 float y, ///< Value y at which to evaluate 135 float z, ///< Value z at which to evaluate 136 const psPolynomial4D *myPoly ///< Coefficients for the polynomial 137 ); 138 136 139 /*****************************************************************************/ 137 140 … … 140 143 /** Double-precision one-dimensional polynomial */ 141 144 typedef struct 142 {143 int n; ///< Number of terms144 double *coeff; ///< Coefficients145 double *coeffErr; ///< Error in coefficients146 char *mask; ///< Coefficient mask147 }145 { 146 int n; ///< Number of terms 147 double *coeff; ///< Coefficients 148 double *coeffErr; ///< Error in coefficients 149 char *mask; ///< Coefficient mask 150 } 148 151 psDPolynomial1D; 149 152 150 153 /** Double-precision two-dimensional polynomial */ 151 154 typedef struct 152 {153 int nX, nY; ///< Number of terms in x and y154 double **coeff; ///< Coefficients155 double **coeffErr; ///< Error in coefficients156 char **mask; ///< Coefficients mask157 }155 { 156 int nX, nY; ///< Number of terms in x and y 157 double **coeff; ///< Coefficients 158 double **coeffErr; ///< Error in coefficients 159 char **mask; ///< Coefficients mask 160 } 158 161 psDPolynomial2D; 159 162 160 163 /** Double-precision three-dimensional polynomial */ 161 164 typedef struct 162 {163 int nX, nY, nZ; ///< Number of terms in x, y and z164 double ***coeff; ///< Coefficients165 double ***coeffErr; ///< Error in coefficients166 char ***mask; ///< Coefficient mask167 }165 { 166 int nX, nY, nZ; ///< Number of terms in x, y and z 167 double ***coeff; ///< Coefficients 168 double ***coeffErr; ///< Error in coefficients 169 char ***mask; ///< Coefficient mask 170 } 168 171 psDPolynomial3D; 169 172 170 173 /** Double-precision four-dimensional polynomial */ 171 174 typedef struct 172 {173 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z174 double ****coeff; ///< Coefficients175 double ****coeffErr; ///< Error in coefficients176 char ****mask; ///< Coefficients mask177 }175 { 176 int nW, nX, nY, nZ; ///< Number of terms in w, x, y and z 177 double ****coeff; ///< Coefficients 178 double ****coeffErr; ///< Error in coefficients 179 char ****mask; ///< Coefficients mask 180 } 178 181 psDPolynomial4D; 179 182 180 183 /** Constructor */ 181 psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms182 ); 183 /** Constructor */ 184 psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y185 ); 186 /** Constructor */ 187 psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z188 ); 189 /** Constructor */ 190 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z191 ); 192 184 psDPolynomial1D *psDPolynomial1DAlloc( int n ///< Number of terms 185 ); 186 /** Constructor */ 187 psDPolynomial2D *psDPolynomial2DAlloc( int nX, int nY ///< Number of terms in x and y 188 ); 189 /** Constructor */ 190 psDPolynomial3D *psDPolynomial3DAlloc( int nX, int nY, int nZ ///< Number of terms in x, y and z 191 ); 192 /** Constructor */ 193 psDPolynomial4D *psDPolynomial4DAlloc( int nW, int nX, int nY, int nZ ///< Number of terms in w, x, y and z 194 ); 195 193 196 /** Evaluate 1D polynomial (double precision) */ 194 197 double 195 psDPolynomial1DEval( double x,///< Value at which to evaluate196 const psDPolynomial1D *myPoly ///< Coefficients for the polynomial197 ); 198 198 psDPolynomial1DEval( double x, ///< Value at which to evaluate 199 const psDPolynomial1D *myPoly ///< Coefficients for the polynomial 200 ); 201 199 202 /** Evaluate 2D polynomial (double precision) */ 200 203 double 201 psDPolynomial2DEval( double x,///< Value x at which to evaluate202 double y,///< Value y at which to evaluate203 const psDPolynomial2D *myPoly ///< Coefficients for the polynomial204 ); 205 204 psDPolynomial2DEval( double x, ///< Value x at which to evaluate 205 double y, ///< Value y at which to evaluate 206 const psDPolynomial2D *myPoly ///< Coefficients for the polynomial 207 ); 208 206 209 /** Evaluate 3D polynomial (double precision) */ 207 210 double 208 psDPolynomial3DEval( double x,///< Value x at which to evaluate209 double y,///< Value y at which to evaluate210 double z,///< Value z at which to evaluate211 const psDPolynomial3D *myPoly ///< Coefficients for the polynomial212 ); 213 211 psDPolynomial3DEval( double x, ///< Value x at which to evaluate 212 double y, ///< Value y at which to evaluate 213 double z, ///< Value z at which to evaluate 214 const psDPolynomial3D *myPoly ///< Coefficients for the polynomial 215 ); 216 214 217 /** Evaluate 4D polynomial (double precision) */ 215 218 double 216 psDPolynomial4DEval( double w,///< Value w at which to evaluate217 double x,///< Value x at which to evaluate218 double y,///< Value y at which to evaluate219 double z,///< Value z at which to evaluate220 const psDPolynomial4D *myPoly ///< Coefficients for the polynomial221 ); 222 219 psDPolynomial4DEval( double w, ///< Value w at which to evaluate 220 double x, ///< Value x at which to evaluate 221 double y, ///< Value y at which to evaluate 222 double z, ///< Value z at which to evaluate 223 const psDPolynomial4D *myPoly ///< Coefficients for the polynomial 224 ); 225 223 226 /* \} */ // End of MathGroup Functions 224 227 -
trunk/psLib/src/types/psMetadata.h
r1380 r1382 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-04 2 0:59:41$12 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-04 22:11:09 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 #define PS_METADATA_H 19 19 20 #include <stdarg.h> 21 #include <stdio.h> 22 #include <fitsio.h> 23 24 #include "psHash.h" 25 #include "psList.h" 20 26 21 27 /// @addtogroup Metadata … … 33 39 */ 34 40 typedef enum { 35 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items36 PS_META_BOOL, ///< Boolean data.37 PS_META_S32, ///< Signed 32-bit integer data.38 PS_META_F32, ///< Single-precision float data.39 PS_META_F64, ///< Double-precision float data.40 PS_META_STR, ///< String data (Stored in as void *).41 PS_META_IMG, ///< Image data (Stored in as void *).42 PS_META_JPEG, ///< JPEG data (Stored in as void .43 PS_META_PNG, ///< PNG data (Stored in as void *).44 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).45 PS_META_UNKNOWN, ///< Other data (Stored in as void *).41 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 42 PS_META_BOOL, ///< Boolean data. 43 PS_META_S32, ///< Signed 32-bit integer data. 44 PS_META_F32, ///< Single-precision float data. 45 PS_META_F64, ///< Double-precision float data. 46 PS_META_STR, ///< String data (Stored in as void *). 47 PS_META_IMG, ///< Image data (Stored in as void *). 48 PS_META_JPEG, ///< JPEG data (Stored in as void . 49 PS_META_PNG, ///< PNG data (Stored in as void *). 50 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 51 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 46 52 PS_META_NTYPE ///< Number of types. Must be last. 47 53 } psMetadataType; … … 78 84 typedef struct psMetadata 79 85 { 80 psList *restrict list;81 psHash *restrict table;86 psList* restrict list; 87 psHash* restrict table; 82 88 } 83 89 psMetadata; … … 102 108 */ 103 109 psMetadataItem *psMetadataItemAlloc( 104 const char *name, ///< Name of metadata item.105 psMetadataType type, ///< Type of metadata item.106 const char *comment, ///< Comment for metadata item.110 const char *name, ///< Name of metadata item. 111 psMetadataType type, ///< Type of metadata item. 112 const char *comment, ///< Comment for metadata item. 107 113 ... ///< Arguments for name formatting and metadata item data. 108 114 ); … … 122 128 */ 123 129 psMetadataItem *psMetadataItemAllocV( 124 const char *name, ///< Name of metadata item.125 psMetadataType type, ///< Type of metadata item.126 const char *comment, ///< Comment for metadata item.130 const char *name, ///< Name of metadata item. 131 psMetadataType type, ///< Type of metadata item. 132 const char *comment, ///< Comment for metadata item. 127 133 va_list list ///< Arguments for name formatting and metadata item data. 128 134 ); … … 145 151 */ 146 152 bool psMetadataAddItem( 147 psMetadata *restrict md, ///< Metadata collection to insert metadat item.148 int where, ///< Location to be added.153 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 149 155 psMetadataItem *restrict item ///< Metadata item to be added. 150 156 ); … … 157 163 */ 158 164 bool psMetadataAdd( 159 psMetadata *restrict md, ///< Metadata collection to insert metadat item.160 int where, ///< Location to be added.161 const char *name, ///< Name of metadata item.162 psMetadataType type, ///< Type of metadata item.163 const char *comment, ///< Comment for metadata item.165 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 166 int where, ///< Location to be added. 167 const char *name, ///< Name of metadata item. 168 psMetadataType type, ///< Type of metadata item. 169 const char *comment, ///< Comment for metadata item. 164 170 ... ///< Arguments for name formatting and metadata item data. 165 171 ); … … 175 181 */ 176 182 bool psMetadataRemove( 177 psMetadata *restrict md, ///< Metadata collection to insert metadat item.178 int where, ///< Location to be removed.183 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 184 int where, ///< Location to be removed. 179 185 const char *restrict key ///< Name of metadata key. 180 186 ); … … 188 194 */ 189 195 psMetadataItem *psMetadataLookup( 190 psMetadata *restrict md, ///< Metadata collection to insert metadat item.196 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 191 197 const char *restrict key ///< Name of metadata key. 192 198 ); … … 199 205 */ 200 206 psMetadataItem *psMetadataGet( 201 psMetadata *restrict md, ///< Metadata collection to insert metadat item.207 psMetadata *restrict md, ///< Metadata collection to insert metadat item. 202 208 int where ///< Location to be retrieved. 203 209 ); … … 210 216 */ 211 217 bool psMetadataSetIterator( 212 psMetadata *restrict md, ///< Metadata collection to iterate.218 psMetadata *restrict md, ///< Metadata collection to iterate. 213 219 int where ///< Location of iterator. 214 220 ); … … 221 227 */ 222 228 psMetadataItem *psMetadataGetNext( 223 psMetadata *restrict md, ///< Metadata collection to iterate.224 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. 225 231 int which ///< Iterator to be used. 226 232 ); … … 233 239 */ 234 240 psMetadataItem *psMetadataGetPrevious( 235 psMetadata *restrict md, ///< Metadata collection to iterate.236 const char *restrict match, ///< Beginning of key name.241 psMetadata *restrict md, ///< Metadata collection to iterate. 242 const char *restrict match, ///< Beginning of key name. 237 243 int which ///< Iterator to be used. 238 244 ); … … 249 255 */ 250 256 void psMetadataItemPrint( 251 FILE *fd, ///< Pointer to file to write metadata item.252 const char *format, ///< Format to print metadata item.257 FILE *fd, ///< Pointer to file to write metadata item. 258 const char *format, ///< Format to print metadata item. 253 259 const psMetadataItem *restrict metadataItem ///< Metadata item to print. 254 260 ); … … 261 267 */ 262 268 psMetadata *psMetadataReadHeader( 263 psMetadata *output, ///< Resulting metadata from read.264 const char *extname, ///< File name extension string.265 int extnum, ///< File name extension number.269 psMetadata *output, ///< Resulting metadata from read. 270 const char *extname, ///< File name extension string. 271 int extnum, ///< File name extension number. 266 272 const char *filename ///< Name of file to read. 267 273 ); … … 274 280 */ 275 281 psMetadata *psMetadataFReadHeader( 276 psMetadata *output, ///< Resulting metadata from read.277 const char *extname, ///< File name extension string.278 int extnum, ///< File name extension number.279 fitsfile *fd ///< Pointer to file to read.282 psMetadata *output, ///< Resulting metadata from read. 283 const char *extname, ///< File name extension string. 284 int extnum, ///< File name extension number. 285 fitsfile *fd ///< Pointer to file to read. 280 286 ); 281 287 /// @}
Note:
See TracChangeset
for help on using the changeset viewer.
