IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2001


Ignore:
Timestamp:
Oct 7, 2004, 9:16:49 AM (22 years ago)
Author:
desonia
Message:

changes resulting of testing (bugs found).

Location:
trunk/psLib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psTime.c

    r1864 r2001  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.24 $ $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 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767                }
    6868
    69                 /** Preprocessor macro to allocate psTime strict */
     69                /** Preprocessor macro to allocate psTime struct */
    7070                #define ALLOC_TIME(TIME)                                                                                     \
    7171                TIME = (psTime*)psAlloc(sizeof(psTime));                                                                     \
     
    469469    // Convert Universal Time (UTC) to  UT1
    470470    ALLOC_TIME(ut1UtcDelta);
    471     ALLOC_TIME(ut1Time);
     471    // ALLOC_TIME(ut1Time);
    472472    ut1UtcDelta->usec = psGetUT1Delta(utcTime)*1e6;
    473473    ut1Time = psTimeAdd(utcTime, ut1UtcDelta);
     
    479479
    480480    // Calculate Terrestial Dynamical Time (TDT)
    481     ALLOC_TIME(tdtTime);
     481    // ALLOC_TIME(tdtTime);
    482482    ALLOC_TIME(tdtDelta);
    483483    tdtDelta->sec = 32;
     
    514514double psGetUT1Delta(psTime *time)
    515515{
    516     psImage *iersTable = NULL;
     516    static psImage* iersTable = NULL;
    517517    double ut1UtcDeltaUsec = 0.0;
    518518
    519519
    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
    521527    ut1UtcDeltaUsec = lookupSer7Table(iersTable, time, 6)*1.0e6;
    522528
     
    527533{
    528534    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    }
    533544    delta = lookupTaiUtcTable(taiUtcTable, time);
    534545
  • trunk/psLib/src/astronomy/psAstrometry.c

    r1981 r2001  
    88 *  @author George Gusciora, MHPCC
    99 *
    10  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-06 21:30:14 $
     10 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-07 19:16:46 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    186186}
    187187
     188static 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
    188198static void fixedPatternFree(psFixedPattern* fp)
    189199{
     
    256266
    257267
    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)
     268psExposure* 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)
    262281{
    263282    psExposure* exp = psAlloc(sizeof(psExposure));
     
    266285    *(double *)&exp->dec = dec;
    267286    *(double *)&exp->hourAngle = hourAngle;
    268     *(double *)&exp->zenith = zenith;
     287    *(double *)&exp->zenithDistance = zenithDistance;
    269288    *(double *)&exp->azimuth = azimuth;
    270     *(double *)&exp->localTime = localTime;
    271     *(float *)&exp->date = date;
    272289    *(float *)&exp->rotAngle = rotAngle;
    273290    *(float *)&exp->temperature = temperature;
     
    275292    *(float *)&exp->humidity = humidity;
    276293    *(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);
    277309
    278310    return exp;
     
    285317                                  double tlr)
    286318{
    287     psObservatory* obs = psAlloc(sizeof(obs));
    288 
    289     if (obs->name == NULL) {
     319    psObservatory* obs = psAlloc(sizeof(psObservatory));
     320
     321    if (name == NULL) {
    290322        obs->name = NULL;
    291323    } else {
  • trunk/psLib/src/astronomy/psAstrometry.h

    r1981 r2001  
    88*  @author George Gusciora, MHPCC
    99*
    10 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-10-06 21:30:14 $
     10*  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-10-07 19:16:46 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    184184psFPA;
    185185
     186/** Observatory Information
     187 *
     188 *  A container for the observatory data that doesn't change per exposure.
     189 *
     190 */
     191typedef 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}
     199psObservatory;
     200
    186201/** Exposure Information
    187202 *
     
    196211    const double dec;                  ///< Telescope boresight, declination
    197212    const double hourAngle;            ///< Hour angle
    198     const double zenith;               ///< Zenith distance
     213    const double zenithDistance;       ///< Zenith distance
    199214    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
    202216    const float rotAngle;              ///< Rotator position angle
    203217    const float temperature;           ///< Air temperature, for estimating refraction
     
    205219    const float humidity;              ///< Relative humidity, for refraction
    206220    const float exposureTime;          ///< Exposure time
    207     const double wavelength;           ///< Wavelength
     221    const float wavelength;            ///< Wavelength
     222    const psObservatory* observatory;  ///< Observatory data
    208223
    209224    /* Derived quantities */
     225    const double lst;                  ///< Local Sidereal Time
    210226    const float positionAngle;         ///< Position angle
    211227    const float parallacticAngle;      ///< Parallactic angle
    212228    const float airmass;               ///< Airmass, calculated from zenith distance
    213229    const float parallacticFactor;     ///< Parallactic factor
    214     const char *cameraName;            ///< name of camera which provided exposure
    215     const char *telescopeName;         ///< name of telescope which provided exposure
     230    const char* cameraName;            ///< name of camera which provided exposure
     231    const char* telescopeName;         ///< name of telescope which provided exposure
    216232}
    217233psExposure;
    218 
    219 /** Observatory Information
    220  *
    221  *  A container for the observatory data that doesn't change per exposure.
    222  *
    223  */
    224 typedef struct
    225 {
    226     const char* name;                  ///< Name of observatory
    227     const double latitude;             ///< Latitude of observatory, east positive
    228     const double longitude;            ///< Longitude of observatory
    229     const double height;               ///< Height of observatory
    230     const double tlr;                  ///< Tropospheric Lapse Rate
    231 }
    232 psObservatory;
    233 
    234234
    235235/** Allocator for psFixedPattern struct
     
    262262    double dec,                        ///< Telescope boresight, declination
    263263    double hourAngle,                  ///< Hour angle
    264     double zenith,                     ///< Zenith distance
     264    double zenithDistance,             ///< Zenith distance
    265265    double azimuth,                    ///< Azimuth
    266     double localTime,                  ///< Local Sidereal Time
    267     float date,                        ///< MJD
     266    const psTime* time,                ///< time of observation
    268267    float rotAngle,                    ///< Rotator position angle
    269268    float temperature,                 ///< Temperature
    270269    float pressure,                    ///< Pressure
    271270    float humidity,                    ///< Relative humidity
    272     float exposureTime                 ///< Exposure time
     271    float exposureTime,                ///< Exposure time
     272    float wavelength,                  ///< wavelength
     273    const psObservatory* observatory   ///< Observatory data
    273274);
    274275
  • trunk/psLib/src/astronomy/psTime.c

    r1864 r2001  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.24 $ $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 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767                }
    6868
    69                 /** Preprocessor macro to allocate psTime strict */
     69                /** Preprocessor macro to allocate psTime struct */
    7070                #define ALLOC_TIME(TIME)                                                                                     \
    7171                TIME = (psTime*)psAlloc(sizeof(psTime));                                                                     \
     
    469469    // Convert Universal Time (UTC) to  UT1
    470470    ALLOC_TIME(ut1UtcDelta);
    471     ALLOC_TIME(ut1Time);
     471    // ALLOC_TIME(ut1Time);
    472472    ut1UtcDelta->usec = psGetUT1Delta(utcTime)*1e6;
    473473    ut1Time = psTimeAdd(utcTime, ut1UtcDelta);
     
    479479
    480480    // Calculate Terrestial Dynamical Time (TDT)
    481     ALLOC_TIME(tdtTime);
     481    // ALLOC_TIME(tdtTime);
    482482    ALLOC_TIME(tdtDelta);
    483483    tdtDelta->sec = 32;
     
    514514double psGetUT1Delta(psTime *time)
    515515{
    516     psImage *iersTable = NULL;
     516    static psImage* iersTable = NULL;
    517517    double ut1UtcDeltaUsec = 0.0;
    518518
    519519
    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
    521527    ut1UtcDeltaUsec = lookupSer7Table(iersTable, time, 6)*1.0e6;
    522528
     
    527533{
    528534    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    }
    533544    delta = lookupTaiUtcTable(taiUtcTable, time);
    534545
  • trunk/psLib/test/astronomy/Makefile

    r1972 r2001  
    33##  Makefile:   test/astronomy
    44##
    5 ##  $Revision: 1.12 $  $Name: not supported by cvs2svn $
    6 ##  $Date: 2004-10-06 01:08:17 $
     5##  $Revision: 1.13 $  $Name: not supported by cvs2svn $
     6##  $Date: 2004-10-07 19:16:49 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727         tst_psMetadata_04 \
    2828         tst_psMetadata_05 \
    29          tst_psMetadata_06
     29         tst_psMetadata_06 \
     30         tst_psAstrometry
    3031
    3132OBJS = $(addprefix builddir/,$(addsuffix .o,$(TARGET)))
Note: See TracChangeset for help on using the changeset viewer.