Changeset 2064 for trunk/psLib/test/astronomy/tst_psAstrometry01.c
- Timestamp:
- Oct 12, 2004, 1:06:08 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psAstrometry01.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psAstrometry01.c
r2060 r2064 1 /** @file tst_ps ImageManip.c1 /** @file tst_psAstrometry01.c 2 2 * 3 3 * @brief The code in this file will test the code in psAstrometry.[ch] … … 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10-12 2 0:54:17$7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-12 23:06:08 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 static int test2( void ); 18 18 static int test3( void ); 19 20 testDescription tests[] = { 21 {test1, 0000, "Tests psFixedPatternAlloc()", 0, false}, 22 {test2, 0000, "Tests psGrommitAlloc()", 0, false}, 23 {test3, 0000, "psFunctionBar", 0, false}, 24 {NULL} 25 }; 26 #define RA 1.0 27 #define DEC 2.0 28 #define HA 3.0 29 #define ZD 4.0 30 #define AZ 5.0 31 #define ROT_ANGLE 6.0 32 #define TEMPERATURE 7.0 33 #define PRESSURE 8.0 34 #define HUMIDITY 20.0 35 #define EXP_TIME 22.0 36 #define WAVELENGTH 11.0 37 #define NAME "The Kaiser Royal Observatory" 38 #define LATITUDE 20.7 39 #define LONGITUDE 156.3 40 #define HEIGHT 3055.0 41 #define LAPSERATE 20.0 42 #define NUM_CHIPS 2 43 #define NUM_CELLS 4 44 #define NUM_READOUTS 2 45 #define READOUT_NUM_ROWS 8 46 #define READOUT_NUM_COLS 8 47 #define ROW0 0 48 #define COL0 0 49 50 int genSystem() 51 { 52 int i; 53 int j; 54 int k; 55 psImage *tmpImage; 56 psTime* now = psTimeGetTime(PS_TIME_UTC); 57 psObservatory* obs = psObservatoryAlloc(NAME, LATITUDE, LONGITUDE, HEIGHT, LAPSERATE); 58 psExposure* exp = psExposureAlloc(RA, DEC, HA, ZD, AZ, 59 now, ROT_ANGLE, TEMPERATURE, PRESSURE, HUMIDITY, 60 EXP_TIME, WAVELENGTH, obs); 61 // psGrommit *grom = psGrommitAlloc(exp); 62 psFPA *myFPA = psFPAAlloc(NUM_CHIPS, exp); 63 psChip **chips; 64 psCell **cells; 65 psReadout **readouts; 66 67 myFPA->fromTangentPlane = NULL; 68 myFPA->toTangentPlane = NULL; 69 70 chips = (psChip **) myFPA->chips->data; 71 for (i=0;i<NUM_CHIPS;i++) { 72 chips[i] = psChipAlloc(NUM_CELLS, myFPA); 73 chips[i]->toFPA = NULL; 74 chips[i]->fromFPA = NULL; 75 cells = (psCell **) chips[i]->cells->data; 76 77 for (j=0;j<NUM_CELLS;j++) { 78 cells[j] = psCellAlloc(NUM_READOUTS, chips[i]); 79 cells[j]->toChip = NULL; 80 cells[j]->fromChip = NULL; 81 cells[j]->toFPA = NULL; 82 cells[j]->toTP = NULL; 83 /* 84 readouts = (psReadout **) cells[j]->readouts->data; 85 for (k=0;k<NUM_READOUTS;k++) { 86 tmpImage = psImageAlloc(READOUT_NUM_COLS, READOUT_NUM_ROWS, PS_TYPE_F32); 87 readouts[k] = psReadoutAlloc(COL0, ROW0, tmpImage); 88 } 89 */ 90 } 91 } 92 93 psFree(now); 94 psFree(obs); 95 psFree(exp); 96 chips = (psChip **) myFPA->chips->data; 97 for (i=0;i<NUM_CHIPS;i++) { 98 cells = (psCell **) chips[i]->cells->data; 99 for (j=0;j<NUM_CELLS;j++) { 100 /* 101 readouts = (psReadout **) cells[j]->readouts->data; 102 for (k=0;k<NUM_READOUTS;k++) { 103 psFree(readouts[k]); 104 } 105 */ 106 psFree(cells[j]); 107 } 108 psFree(chips[i]); 109 } 110 psFree(myFPA); 111 return(0); 112 } 113 114 int main( int argc, char* argv[] ) 115 { 116 psLogSetLevel( PS_LOG_INFO ); 117 118 return ( ! runTestSuite( stderr, "psImage", tests, argc, argv ) ); 119 } 19 120 20 121 #define X_NUM_ROWS 4 … … 26 127 #define X0 50.0 27 128 #define Y0 60.0 28 29 30 // test descrription consists of:31 // * test function32 //33 // * testpoint number (item number in gforge testpoint log)34 //35 // * name of the testpoint36 //37 // * expected return value (negative numbers are signal types, e.g.,38 // -6 for aborts). Usually either -6 (psAbort called) or 0.39 //40 // * boolean to signify if the test function is already in list, i.e., if41 // the test function covers multiple testpoints. If true, the line is42 // ignored by runTestSuite if the user didn't explicitly specify the43 // testpoint with the -n or -t option, as to not run a test function44 // multiple times.45 //46 testDescription tests[] = {47 {48 test1, 1118, "psFunctionBar", 0, false49 },50 {51 test2, 1113, "psFunctionFoo", 0, false52 },53 {54 test3, 1114, "psFunctionFunk", 0, false55 },56 57 // A null terminates the testDescription list58 {59 NULL60 }61 };62 63 int main( int argc, char* argv[] )64 {65 psLogSetLevel( PS_LOG_INFO );66 67 return ( ! runTestSuite( stderr, "psImage", tests, argc, argv ) );68 }69 129 70 130 int test1( void ) … … 162 222 } 163 223 164 int test2( void ) 165 { 166 // no need to check for memory leaks, as the runTestSuite does that for you. 167 168 // here is where one implements the tests for generally a single testpoint. 169 170 return 0; // the value that indicates success is part of the testDescription 224 int test2() 225 { 226 int testStatus = 0; 227 228 psTime* now = psTimeGetTime(PS_TIME_UTC); 229 230 psObservatory* obs = psObservatoryAlloc(NAME, LATITUDE, LONGITUDE, HEIGHT, LAPSERATE); 231 232 psExposure* exp = psExposureAlloc(RA, DEC, HA, ZD, AZ, 233 now, ROT_ANGLE, TEMPERATURE, PRESSURE, HUMIDITY, 234 EXP_TIME, WAVELENGTH, obs); 235 236 psGrommit *grom = psGrommitAlloc(exp); 237 238 if (grom->height != HEIGHT) { 239 printf("ERROR: grom->height is %f, should be %f\n", grom->height, HEIGHT); 240 testStatus = 1; 241 } 242 if (grom->temperature != TEMPERATURE) { 243 printf("ERROR: grom->temperature is %f, should be %f\n", grom->temperature, TEMPERATURE); 244 testStatus = 2; 245 } 246 247 if (grom->pressure != PRESSURE) { 248 printf("ERROR: grom->pressure is %f, should be %f\n", grom->pressure, PRESSURE); 249 testStatus = 3; 250 } 251 252 if (grom->humidity != HUMIDITY) { 253 printf("ERROR: grom->humidity is %f, should be %f\n", grom->humidity, HUMIDITY); 254 testStatus = 4; 255 } 256 257 if (grom->wavelength != WAVELENGTH) { 258 printf("ERROR: grom->wavelength is %f, should be %f\n", grom->wavelength, WAVELENGTH); 259 testStatus = 5; 260 } 261 262 if (grom->lapseRate != LAPSERATE) { 263 printf("ERROR: grom->lapseRate is %f, should be %f\n", grom->lapseRate, LAPSERATE); 264 testStatus = 6; 265 } 266 267 /* 268 XXX: Don't know how to verify: latitude, sinLat, cosLat, abberationMag, 269 refractA, refractB, longitudeOffset, siderealTime 270 271 if (grom-> != ) { 272 printf("ERROR: grom-> is %f, should be %f\n", grom->, ); 273 testStatus = 1; 274 } 275 */ 276 277 printf("grom->latitude is %f\n", grom->latitude); 278 printf("grom->sinLat is %f\n", grom->sinLat); 279 printf("grom->cosLat is %f\n", grom->cosLat); 280 printf("grom->abberationMag is %f\n", grom->abberationMag); 281 printf("grom->height is %f\n", grom->height); 282 printf("grom->temperature is %f\n", grom->temperature); 283 printf("grom->pressure is %f\n", grom->pressure); 284 printf("grom->humidity is %f\n", grom->humidity); 285 printf("grom->wavelength is %f\n", grom->wavelength); 286 printf("grom->lapseRate is %f\n", grom->lapseRate); 287 printf("grom->refractA is %f\n", grom->refractA); 288 printf("grom->refractB is %f\n", grom->refractB); 289 printf("grom->longitudeOffset is %f\n", grom->longitudeOffset); 290 printf("grom->siderealTime is %f\n", grom->siderealTime); 291 292 psFree(now); 293 psFree(obs); 294 psFree(exp); 295 psFree(grom); 296 297 return(testStatus); 171 298 } 172 299 173 300 int test3( void ) 174 301 { 175 // no need to check for memory leaks, as the runTestSuite does that for you. 176 177 // here is where one implements the tests for generally a single testpoint. 178 179 return 0; // the value that indicates success is part of the testDescription 180 } 302 genSystem(); 303 return(0); 304 }
Note:
See TracChangeset
for help on using the changeset viewer.
