Changeset 2001
- Timestamp:
- Oct 7, 2004, 9:16:49 AM (22 years ago)
- Location:
- trunk/psLib
- Files:
-
- 5 edited
-
src/astro/psTime.c (modified) (6 diffs)
-
src/astronomy/psAstrometry.c (modified) (6 diffs)
-
src/astronomy/psAstrometry.h (modified) (5 diffs)
-
src/astronomy/psTime.c (modified) (6 diffs)
-
test/astronomy/Makefile (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psTime.c
r1864 r2001 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-23 18:31:49$13 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-07 19:16:46 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 } 68 68 69 /** Preprocessor macro to allocate psTime str ict */69 /** Preprocessor macro to allocate psTime struct */ 70 70 #define ALLOC_TIME(TIME) \ 71 71 TIME = (psTime*)psAlloc(sizeof(psTime)); \ … … 469 469 // Convert Universal Time (UTC) to UT1 470 470 ALLOC_TIME(ut1UtcDelta); 471 ALLOC_TIME(ut1Time);471 // ALLOC_TIME(ut1Time); 472 472 ut1UtcDelta->usec = psGetUT1Delta(utcTime)*1e6; 473 473 ut1Time = psTimeAdd(utcTime, ut1UtcDelta); … … 479 479 480 480 // Calculate Terrestial Dynamical Time (TDT) 481 ALLOC_TIME(tdtTime);481 // ALLOC_TIME(tdtTime); 482 482 ALLOC_TIME(tdtDelta); 483 483 tdtDelta->sec = 32; … … 514 514 double psGetUT1Delta(psTime *time) 515 515 { 516 psImage *iersTable = NULL;516 static psImage* iersTable = NULL; 517 517 double ut1UtcDeltaUsec = 0.0; 518 518 519 519 520 iersTable = readSer7File("../../data/ser7.dat"); 520 if (iersTable == NULL) { 521 iersTable = readSer7File("../../data/ser7.dat"); 522 p_psMemSetPersistent(iersTable,true); 523 p_psMemSetPersistent(iersTable->data.V,true); 524 p_psMemSetPersistent(iersTable->rawDataBuffer,true); 525 } 526 521 527 ut1UtcDeltaUsec = lookupSer7Table(iersTable, time, 6)*1.0e6; 522 528 … … 527 533 { 528 534 double delta = 0.0; 529 psImage *taiUtcTable = NULL; 530 531 532 taiUtcTable = readTaiUtcFile("../../data/tai-utc.dat"); 535 static psImage* taiUtcTable = NULL; 536 537 538 if (taiUtcTable == NULL) { 539 taiUtcTable = readTaiUtcFile("../../data/tai-utc.dat"); 540 p_psMemSetPersistent(taiUtcTable,true); 541 p_psMemSetPersistent(taiUtcTable->data.V,true); 542 p_psMemSetPersistent(taiUtcTable->rawDataBuffer,true); 543 } 533 544 delta = lookupTaiUtcTable(taiUtcTable, time); 534 545 -
trunk/psLib/src/astronomy/psAstrometry.c
r1981 r2001 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-0 6 21:30:14$10 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-07 19:16:46 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 186 186 } 187 187 188 static void exposureFree(psExposure* exp) 189 { 190 if (exp != NULL) { 191 psFree((void*)exp->time); 192 psFree((void*)exp->observatory); 193 psFree((void*)exp->cameraName); 194 psFree((void*)exp->telescopeName); 195 } 196 } 197 188 198 static void fixedPatternFree(psFixedPattern* fp) 189 199 { … … 256 266 257 267 258 psExposure* psExposureAlloc(double ra, double dec, double hourAngle, 259 double zenith, double azimuth, double localTime, float date, 260 float rotAngle, float temperature, float pressure, float humidity, 261 float exposureTime) 268 psExposure* psExposureAlloc(double ra, 269 double dec, 270 double hourAngle, 271 double zenithDistance, 272 double azimuth, 273 const psTime* time, 274 float rotAngle, 275 float temperature, 276 float pressure, 277 float humidity, 278 float exposureTime, 279 float wavelength, 280 const psObservatory* observatory) 262 281 { 263 282 psExposure* exp = psAlloc(sizeof(psExposure)); … … 266 285 *(double *)&exp->dec = dec; 267 286 *(double *)&exp->hourAngle = hourAngle; 268 *(double *)&exp->zenith = zenith;287 *(double *)&exp->zenithDistance = zenithDistance; 269 288 *(double *)&exp->azimuth = azimuth; 270 *(double *)&exp->localTime = localTime;271 *(float *)&exp->date = date;272 289 *(float *)&exp->rotAngle = rotAngle; 273 290 *(float *)&exp->temperature = temperature; … … 275 292 *(float *)&exp->humidity = humidity; 276 293 *(float *)&exp->exposureTime = exposureTime; 294 *(float *)&exp->wavelength = wavelength; 295 296 exp->time = psMemIncrRefCounter((void*)time); 297 exp->observatory = psMemIncrRefCounter((void*)observatory); 298 299 // XXX: how is these value derived? 300 *(double *)&exp->lst = psTimeToLST((psTime*)time,observatory->longitude); 301 *(float *)&exp->positionAngle = 0.0f; 302 *(float *)&exp->parallacticAngle = 0.0f; 303 *(float *)&exp->airmass = 0.0f; 304 *(float *)&exp->parallacticFactor = 0.0f; 305 exp->cameraName = NULL; 306 exp->telescopeName = NULL; 307 308 p_psMemSetDeallocator(exp,(psFreeFcn)exposureFree); 277 309 278 310 return exp; … … 285 317 double tlr) 286 318 { 287 psObservatory* obs = psAlloc(sizeof( obs));288 289 if ( obs->name == NULL) {319 psObservatory* obs = psAlloc(sizeof(psObservatory)); 320 321 if (name == NULL) { 290 322 obs->name = NULL; 291 323 } else { -
trunk/psLib/src/astronomy/psAstrometry.h
r1981 r2001 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.2 6$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-10-0 6 21:30:14$10 * @version $Revision: 1.27 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-10-07 19:16:46 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 184 184 psFPA; 185 185 186 /** Observatory Information 187 * 188 * A container for the observatory data that doesn't change per exposure. 189 * 190 */ 191 typedef struct 192 { 193 const char* name; ///< Name of observatory 194 const double latitude; ///< Latitude of observatory, east positive 195 const double longitude; ///< Longitude of observatory 196 const double height; ///< Height of observatory 197 const double tlr; ///< Tropospheric Lapse Rate 198 } 199 psObservatory; 200 186 201 /** Exposure Information 187 202 * … … 196 211 const double dec; ///< Telescope boresight, declination 197 212 const double hourAngle; ///< Hour angle 198 const double zenith ;///< Zenith distance213 const double zenithDistance; ///< Zenith distance 199 214 const double azimuth; ///< Azimuth 200 const double localTime; ///< Local Sidereal Time 201 const float date; ///< Modified Jullian Date of observation 215 const psTime* time; ///< Time of observation 202 216 const float rotAngle; ///< Rotator position angle 203 217 const float temperature; ///< Air temperature, for estimating refraction … … 205 219 const float humidity; ///< Relative humidity, for refraction 206 220 const float exposureTime; ///< Exposure time 207 const double wavelength; ///< Wavelength 221 const float wavelength; ///< Wavelength 222 const psObservatory* observatory; ///< Observatory data 208 223 209 224 /* Derived quantities */ 225 const double lst; ///< Local Sidereal Time 210 226 const float positionAngle; ///< Position angle 211 227 const float parallacticAngle; ///< Parallactic angle 212 228 const float airmass; ///< Airmass, calculated from zenith distance 213 229 const float parallacticFactor; ///< Parallactic factor 214 const char *cameraName; ///< name of camera which provided exposure215 const char *telescopeName; ///< name of telescope which provided exposure230 const char* cameraName; ///< name of camera which provided exposure 231 const char* telescopeName; ///< name of telescope which provided exposure 216 232 } 217 233 psExposure; 218 219 /** Observatory Information220 *221 * A container for the observatory data that doesn't change per exposure.222 *223 */224 typedef struct225 {226 const char* name; ///< Name of observatory227 const double latitude; ///< Latitude of observatory, east positive228 const double longitude; ///< Longitude of observatory229 const double height; ///< Height of observatory230 const double tlr; ///< Tropospheric Lapse Rate231 }232 psObservatory;233 234 234 235 235 /** Allocator for psFixedPattern struct … … 262 262 double dec, ///< Telescope boresight, declination 263 263 double hourAngle, ///< Hour angle 264 double zenith ,///< Zenith distance264 double zenithDistance, ///< Zenith distance 265 265 double azimuth, ///< Azimuth 266 double localTime, ///< Local Sidereal Time 267 float date, ///< MJD 266 const psTime* time, ///< time of observation 268 267 float rotAngle, ///< Rotator position angle 269 268 float temperature, ///< Temperature 270 269 float pressure, ///< Pressure 271 270 float humidity, ///< Relative humidity 272 float exposureTime ///< Exposure time 271 float exposureTime, ///< Exposure time 272 float wavelength, ///< wavelength 273 const psObservatory* observatory ///< Observatory data 273 274 ); 274 275 -
trunk/psLib/src/astronomy/psTime.c
r1864 r2001 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2004- 09-23 18:31:49$13 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-10-07 19:16:46 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 } 68 68 69 /** Preprocessor macro to allocate psTime str ict */69 /** Preprocessor macro to allocate psTime struct */ 70 70 #define ALLOC_TIME(TIME) \ 71 71 TIME = (psTime*)psAlloc(sizeof(psTime)); \ … … 469 469 // Convert Universal Time (UTC) to UT1 470 470 ALLOC_TIME(ut1UtcDelta); 471 ALLOC_TIME(ut1Time);471 // ALLOC_TIME(ut1Time); 472 472 ut1UtcDelta->usec = psGetUT1Delta(utcTime)*1e6; 473 473 ut1Time = psTimeAdd(utcTime, ut1UtcDelta); … … 479 479 480 480 // Calculate Terrestial Dynamical Time (TDT) 481 ALLOC_TIME(tdtTime);481 // ALLOC_TIME(tdtTime); 482 482 ALLOC_TIME(tdtDelta); 483 483 tdtDelta->sec = 32; … … 514 514 double psGetUT1Delta(psTime *time) 515 515 { 516 psImage *iersTable = NULL;516 static psImage* iersTable = NULL; 517 517 double ut1UtcDeltaUsec = 0.0; 518 518 519 519 520 iersTable = readSer7File("../../data/ser7.dat"); 520 if (iersTable == NULL) { 521 iersTable = readSer7File("../../data/ser7.dat"); 522 p_psMemSetPersistent(iersTable,true); 523 p_psMemSetPersistent(iersTable->data.V,true); 524 p_psMemSetPersistent(iersTable->rawDataBuffer,true); 525 } 526 521 527 ut1UtcDeltaUsec = lookupSer7Table(iersTable, time, 6)*1.0e6; 522 528 … … 527 533 { 528 534 double delta = 0.0; 529 psImage *taiUtcTable = NULL; 530 531 532 taiUtcTable = readTaiUtcFile("../../data/tai-utc.dat"); 535 static psImage* taiUtcTable = NULL; 536 537 538 if (taiUtcTable == NULL) { 539 taiUtcTable = readTaiUtcFile("../../data/tai-utc.dat"); 540 p_psMemSetPersistent(taiUtcTable,true); 541 p_psMemSetPersistent(taiUtcTable->data.V,true); 542 p_psMemSetPersistent(taiUtcTable->rawDataBuffer,true); 543 } 533 544 delta = lookupTaiUtcTable(taiUtcTable, time); 534 545 -
trunk/psLib/test/astronomy/Makefile
r1972 r2001 3 3 ## Makefile: test/astronomy 4 4 ## 5 ## $Revision: 1.1 2$ $Name: not supported by cvs2svn $6 ## $Date: 2004-10-0 6 01:08:17$5 ## $Revision: 1.13 $ $Name: not supported by cvs2svn $ 6 ## $Date: 2004-10-07 19:16:49 $ 7 7 ## 8 8 ## Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 tst_psMetadata_04 \ 28 28 tst_psMetadata_05 \ 29 tst_psMetadata_06 29 tst_psMetadata_06 \ 30 tst_psAstrometry 30 31 31 32 OBJS = $(addprefix builddir/,$(addsuffix .o,$(TARGET)))
Note:
See TracChangeset
for help on using the changeset viewer.
