IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1981


Ignore:
Timestamp:
Oct 6, 2004, 11:30:14 AM (22 years ago)
Author:
desonia
Message:

added psObservatory.

Location:
trunk/psLib/src/astronomy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astronomy/psAstrometry.c

    r1967 r1981  
    11/** @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.30 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-10-06 00:44:16 $
    12 *
    13 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    14 */
     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.31 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-06 21:30:14 $
     12 *
     13 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     14 */
     15
    1516/******************************************************************************/
    1617/*  INCLUDE FILES                                                             */
    1718/******************************************************************************/
    18 #include "slalib.h"
    19 
    20 #include<math.h>
     19#include <string.h>
     20#include <math.h>
     21
    2122#include "psFunctions.h"
    2223#include "psAstrometry.h"
    2324#include "psMemory.h"
    2425#include "psAbort.h"
    25 /******************************************************************************/
    26 /*  DEFINE STATEMENTS                                                         */
    27 /******************************************************************************/
    28 
    29 // None
    30 
    31 /******************************************************************************/
    32 /*  TYPE DEFINITIONS                                                          */
    33 /******************************************************************************/
    34 
    35 // None
    36 
    37 /*****************************************************************************/
    38 /*  GLOBAL VARIABLES                                                         */
    39 /*****************************************************************************/
    40 
    41 // None
    42 
    43 /*****************************************************************************/
    44 /*  FILE STATIC VARIABLES                                                    */
    45 /*****************************************************************************/
    46 
    47 // None
    48 
    49 /*****************************************************************************/
    50 /*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    51 /*****************************************************************************/
     26#include "slalib.h"
    5227
    5328/*****************************************************************************
     
    204179}
    205180
     181static void observatoryFree(psObservatory* obs)
     182{
     183    if (obs != NULL) {
     184        psFree((void*)obs->name);
     185    }
     186}
     187
     188static void fixedPatternFree(psFixedPattern* fp)
     189{
     190    if (fp != NULL) {
     191        for (int i = 0; i < fp->nX; i++) {
     192            psFree(fp->x[i]);
     193        }
     194
     195        for (int j = 0; j < fp->nY; j++) {
     196            psFree(fp->y[j]);
     197        }
     198
     199        psFree(fp->x);
     200        psFree(fp->y);
     201    }
     202}
     203
    206204/*****************************************************************************/
    207205/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
     
    213211 * XXX: Verify that you interpreted the SDR correctly.
    214212 *
    215  * XXX: Must add memory deallocater.
    216213 */
    217 psFixedPattern *psFixedPatternAlloc(double x0,
     214psFixedPattern* psFixedPatternAlloc(double x0,
    218215                                    double y0,
    219216                                    double xScale,
     
    227224
    228225    tmp = (psFixedPattern *) psAlloc(sizeof(psFixedPattern));
    229     tmp->nX = x->numRows * x->numCols;
    230     tmp->nY = y->numRows * y->numCols;
     226    tmp->nX = x->numCols;
     227    tmp->nY = y->numRows;
    231228    tmp->x0 = x0;
    232229    tmp->y0 = y0;
     
    252249        }
    253250    }
     251
     252    p_psMemSetDeallocator(tmp,(psFreeFcn)fixedPatternFree);
     253
    254254    return(tmp);
    255255}
     
    279279}
    280280
    281 /*
    282  * psFPA constructor
    283  */
     281psObservatory* psObservatoryAlloc(const char* name,
     282                                  double latitude,
     283                                  double longitude,
     284                                  double height,
     285                                  double tlr)
     286{
     287    psObservatory* obs = psAlloc(sizeof(obs));
     288
     289    if (obs->name == NULL) {
     290        obs->name = NULL;
     291    } else {
     292        obs->name = psAlloc(strlen(name)+1);
     293        strcpy((char*)obs->name, name);
     294    }
     295
     296    *(double *)&obs->latitude = latitude;
     297    *(double *)&obs->longitude = longitude;
     298    *(double *)&obs->height = height;
     299    *(double *)&obs->tlr = tlr;
     300
     301    p_psMemSetDeallocator(obs,(psFreeFcn)observatoryFree);
     302
     303    return obs;
     304}
     305
    284306psFPA* psFPAAlloc(int nChips,
    285307                  const psExposure* exp)
  • trunk/psLib/src/astronomy/psAstrometry.h

    r1816 r1981  
    88*  @author George Gusciora, MHPCC
    99*
    10 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-09-15 22:57:12 $
     10*  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-10-06 21:30:14 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8383psFixedPattern;
    8484
    85 psFixedPattern *psFixedPatternAlloc(double x0,           ///< X Position of 0,0 corner on focal plane
    86                                     double y0,           ///< Y Position of 0,0 corner on focal plane
    87                                     double xScale,       ///< Scale of the grid in x direction
    88                                     double yScale,       ///< Scale of the grid in x direction
    89                                     const psImage *x,    ///< The grid of offsets in x
    90                                     const psImage *y     ///< The grid of offsets in y
    91                                    );
    92 
    9385/** Readout data structure.
    9486 *
     
    123115 *
    124116 */
    125 typedef struct psCell
     117typedef struct
    126118{
    127119    psArray* readouts;                 ///< readouts from the cell
     
    225217psExposure;
    226218
     219/** Observatory Information
     220 *
     221 *  A container for the observatory data that doesn't change per exposure.
     222 *
     223 */
     224typedef 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}
     232psObservatory;
     233
     234
     235/** Allocator for psFixedPattern struct
     236 *
     237 *  Allocates a new psFixedPattern struct with the attributes coorsponding
     238 *  to the parameters set to the said input values.
     239 *
     240 *  @return psFixedPattern*     New psFixedPattern struct.
     241 */
     242psFixedPattern* psFixedPatternAlloc(
     243    double x0,           ///< X Position of 0,0 corner on focal plane
     244    double y0,           ///< Y Position of 0,0 corner on focal plane
     245    double xScale,       ///< Scale of the grid in x direction
     246    double yScale,       ///< Scale of the grid in x direction
     247    const psImage *x,    ///< The grid of offsets in x
     248    const psImage *y     ///< The grid of offsets in y
     249);
     250
     251
    227252/** Allocator for psExposure
    228253 *
     
    231256 *  quantities can be derived and stored for later use.
    232257 *
    233  *  @return     psExposure*    new psExposure struct
     258 *  @return     psExposure*    New psExposure struct
    234259 */
    235260psExposure* psExposureAlloc(
     
    248273);
    249274
     275/** Allocator for psObservatory
     276 *
     277 *  This function shall construct a new psObservatory with attributes
     278 *  cooresponding to the function parameters.
     279 *
     280 *  @return psObservatory*    new psObservatory struct
     281 */
     282psObservatory* psObservatoryAlloc(
     283    const char* name,                  ///< Name of observatory
     284    double latitude,                   ///< Latitude of observatory, east positive
     285    double longitude,                  ///< Longitude of observatory
     286    double height,                     ///< Height of observatory
     287    double tlr                         ///< Tropospheric Lapse Rate
     288);
     289
    250290/** Allocator for psFPA
    251291 *
Note: See TracChangeset for help on using the changeset viewer.