IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 251


Ignore:
Timestamp:
Mar 17, 2004, 2:53:17 PM (22 years ago)
Author:
eugene
Message:

extensive re-organization of astrometry, image, object data structures

Location:
trunk/archive/pslib/include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psAstrom.h

    r247 r251  
    1 #if !defined(PS_ASTROM_H)
    2 #define PS_ASTROM_H
     1# if !defined(PS_ASTROM_H)
     2# define PS_ASTROM_H
    33
    44/** \file psAstrom.h
     
    77 */
    88
     9/** Astrometric solution for an OTA.
     10 * There are five coordinate frames that we need to worry about:
     11 * 1. Cell frame:    x,y in pixels (raw coordinates; lower-left pixel center is 0.5,0.5 TBR)
     12 * 2. Chip frame:    X,Y in pixels
     13 * 3. FPA frame:     P,Q in microns
     14 * 4. Tangent plane: L,M in arcsec (TBR - angles or linear?) from the telescope boresight.
     15 * 5. Sky frame:     R,D in degrees (TBR - radians?)
     16 *
     17 * 1 <--> 2: cell.coords : a 2-D linear transformation : rotation, scaling, offset, (skew)
     18 * 2 <--> 3: chip.coords : a 2-D cubic (max) transform : specifies how the chips are mounted on the focal plane.
     19 * 3 <--> 4: fpa.distort : a 2-D quartic (?) transform : specifies the distortions in the optics
     20 * 4 <--> 5: fpa.SLpars  : SLALib parameters generated based on the telescope, ra, dec, time, etc from exposure info
     21 */
     22
     23/** Information needed (by SLALIB) to convert Apparent to Observed Position */
     24typedef struct {
     25    double latitude;                    ///< geodetic latitude (radians)
     26    double sinLat, cosLat;              ///< sine and cosine of geodetic latitude
     27    double abberationMag;               ///< magnitude of diurnal aberration vector
     28    double height;                      ///< height (HM)
     29    double temperature;                 ///< ambient temperature (TDK)
     30    double pressure;                    ///< pressure (PMB)
     31    double humidity;                    ///< relative humidity (RH)
     32    double wavelength;                  ///< wavelength (WL)
     33    double lapseRate;                   ///< lapse rate (TLR)
     34    double refractA, refractB;          ///< refraction constants A and B (radians)
     35    double longitudeOffset;             ///< longitude + eqn of equinoxes + ``sidereal UT'' (radians)
     36    double siderealTime;                ///< local apparent sidereal time (radians)
     37} psGrommit;
     38
     39/** Exposure information from the telescope */
     40typedef struct {
     41    // Telescope longitude, latitude and height are stored separately, since they don't change with pointing
     42    double ra, dec;                     //!< Telescope boresight
     43    double ha;                          //!< Hour angle
     44    double zd;                          //!< Zenith distance
     45    double az;                          //!< Azimuth
     46    double lst;                         //!< Local Sidereal Time
     47    float mjd;                          //!< MJD of observation
     48    float rotAngle;                     //!< Rotator position angle
     49    float temp;                         //!< Air temperature, for estimating refraction
     50    float pressure;                     //!< Air pressure, for calculating refraction
     51    float humidity;                     //!< Relative humidity, for calculating refraction
     52    float exptime;                      //!< Exposure time
     53    /* Derived quantities */
     54    float posAngle;                     //!< Position angle
     55    float parallactic;                  //!< Parallactic angle
     56    float airmass;                      //!< Airmass, calculated from zenith distance
     57    float pf;                           //!< Parallactic factor
     58    char *cameraName;                   ///< name of camera which provided exposure
     59    char *telescopeName;                ///< name of telescope which provided exposure
     60    psGrommit *grommit;                 //!< Data needed to convert from the sky to the tangent plane
     61} psExposure;
     62
     63/** a Focal plane array: a collection of chips.  Not all chips in a camera need to be listed in an instance of
     64 *  psFPA.
     65 */
     66typedef struct {
     67    int nChips;                         ///< Number of Cells assigned
     68    int nAlloc;                         ///< Number of Cells available
     69    psChip *chips;                      ///< Chips in the Focal Plane Array
     70    psMetaData *md;                     ///< FPA-level metadata
     71    psDistort *TPtoFP;                  ///< Transformation term from
     72    psDistort *FPtoTP;                  ///< Transformation term from
     73    psExposure *exp;                    ///< information about this exposure
     74    psMatrix *dx, *dy;                  //!< Focal Plane fixed pattern residual offsets
     75    psPhotSystem colorPlus, colorMinus; ///< Colour reference
     76    float rmsX, rmsY;                   //!< Dispersion in astrometric solution
     77    float chi2;                         //!< chi^2 of astrometric solution
     78} psFPA;
     79
     80/** a Chip: a collection of cells.  Not all valid cells in a chip need to be listed in an
     81 *  instance of psChip.
     82 */
     83typedef struct {
     84    int nCells;                         ///< Number of Cells assigned
     85    psCell *cells;                      ///< Cells in the Chip
     86    psMetaData *md;                     ///< Chip-level metadata
     87
     88    psCoordXform *chipToFPA;            ///< Transformations from chip coordinates to FPA coordinates
     89    psCoordXform *FPAtoChip;            ///< Transformations from chip coordinates to FPA coordinates
     90
     91    psFPA *parentFPA;                   ///< FPA which contains this chip
     92} psChip;
     93
     94/** a Cell: a collection of pixels.
     95 */
     96typedef struct {
     97    psObjectTable *objects;             ///< objects derived from cell
     98    psImage *image;                     ///< imaging area of cell
     99    psImage *overscan;                  ///< bias region (subimage) of cell
     100    psMetaData *md;                     ///< Cell-level metadata
     101
     102    psCoordXform *cellToChip;           ///< Transformations from cell coordinates to chip coordinates
     103    psCoordXform *cellToFPA;            ///< Transformations from cell coordinates to FPA coordinates
     104
     105    psChip  *parentChip;                ///< chip which contains this cell
     106} psCell;
     107
     108/*** Functions ***********************************************************************/
     109
    9110/***********************************************************************************************************/
    10111
    11 /** Exposure information from the telescope */
    12 typedef struct {
    13     // Telescope longitude, latitude and height are stored separately, since they don't change with pointing
    14     double ra, dec;                     //!< Telescope boresight
    15     double ha;                          //!< Hour angle
    16     double zd;                          //!< Zenith distance
    17     double az;                          //!< Azimuth
    18     double lst;                         //!< Local Sidereal Time
    19     float mjd;                          //!< MJD of observation
    20     float rotAngle;                     //!< Rotator position angle
    21     float temp;                         //!< Air temperature, for estimating refraction
    22     float pressure;                     //!< Air pressure, for calculating refraction
    23     float humidity;                     //!< Relative humidity, for calculating refraction
    24     float exptime;                      //!< Exposure time
    25     /* Derived quantities */
    26     float posAngle;                     //!< Position angle
    27     float parallactic;                  //!< Parallactic angle
    28     float airmass;                      //!< Airmass, calculated from zenith distance
    29     float pf;                           //!< Parallactic factor
    30 } psExposure;
     112/* Calculating and applying astrometric solutions */
     113
     114/** returns Cell in Chip which contains the given point */
     115int
     116psCellInChip (psChip *chip,             ///< chip description
     117              psCoords *coords          ///< coordinate to find
     118              );
     119
     120/** returns the Cell coords for the specified Cell corresponding to the given Chip coords */
     121psCoords
     122psChipCoordsOnCell (psCell *cell,       ///< source cell for coordinate
     123                    psCoords *coords    ///< coordinate of interest
     124                    );
     125
     126/** returns the Cell coords for the specified Cell corresponding to the given Chip coords */
     127psCoords
     128psCellCoordsInChip (psChip *chip,       ///<
     129                    int cell,           ///<
     130                    psCoords *coords    ///<
     131                    );
     132
     133/** returns Chip in FPA which contains the given point */
     134int
     135psChipInFPA (psFPA *fpa,                ///<
     136             psCoords *coords           ///<
     137             );
     138
     139/** returns the Chip coords for the specified Chip corresponding to the given FPA coords */
     140psCoords
     141psFPACoordsOnChip (psChip *chip,        ///<
     142                   psCoords *coords     ///<
     143                   );
     144
     145/** returns the Chip coords for the specified Chip corresponding to the given FPA coords */
     146psCoords
     147psChipCoordsInFPA (psFPA *fpa,          ///<
     148                   int chip,            ///<
     149                   psCoords *coords     ///<
     150                   );
     151
     152/** Convert (RA,Dec) to (cell#,x,y) */
     153psCoords *
     154psSkyToFPA(psFPA *fpa,                  //!< OTA details
     155           psCoords *coords             //!< Position on the sky
     156           );
     157
     158/** Convert (cell#,x,y) to (RA,Dec) */
     159psCoords *
     160psFPAToSky(psFPA *fpa,                  //!< OTA details
     161           psCoords *coords             //!< Position on the sky
     162           );
     163
     164/** Convert (RA,Dec) to (cell#,x,y) */
     165psCoords *
     166psSkyToTP(psExposure *exp,              //!< OTA details
     167          psCoords *coords              //!< Position on the sky
     168          );
     169
     170/** Convert (RA,Dec) to (cell#,x,y) */
     171psCoords *
     172psTPtoSky(psExposure *exp,              //!< OTA details
     173          psCoords *coords              //!< Position on the sky
     174          );
     175
     176/** Get the airmass for a given position and sidereal time */
     177float
     178psGetAirmass(psCoords *coords,          //!< Position on the sky
     179             double siderealTime        //!< Sidereal time
     180             );
     181
     182/** Get the parallactic angle for a given position and sidereal time */
     183float
     184psGetParallactic(psCoords *coords,      //!< Position on the sky
     185                 double siderealTime    //!< Sidereal time
     186                 );
     187
     188/** Estimate atmospheric refraction, along the parallactic */
     189float
     190psGetRefraction(float colour,           //!< Colour of object
     191                psColourRef colourRef,  //!< Colour reference
     192                psExposure *exp         //!< Telescope pointing information, for airmass, temp and pressure
     193                );
     194
     195/** Fit astrometric solution to list of (chip#,x,y) and (RA,Dec) */
     196int
     197psFitAstrom(psOTADescription *restrict ota, //!< Initial guess for coefficients
     198            const psOTAPosArray *restrict detector, //!< Positions on OTA (chip#,x,y)
     199            const psSkyPosArray *restrict sky, //!< Positions on the sky (RA,Dec)
     200            const psExposure *exp       //!< Telescope pointing information, for airmass, parallactic angle
     201                                        //!< which may help set the astrometric solution
     202            );
     203
     204/*** Constructors / Destructors ******************************************************/
    31205
    32206/** Constructor */
    33207psExposure *
    34 psExposureAlloc(double ra, double dec,  //!< Telescope boresight
    35                 double ha,              //!< Hour angle
    36                 double zd,              //!< Zenith distance
    37                 double az,              //!< Azimuth
    38                 double lst,             //!< Local Sidereal Time
    39                 float mjd,              //!< MJD
    40                 float rotAngle,         //!< Rotator position angle
    41                 float temp,             //!< Temperature
    42                 float pressure,         //!< Pressure
    43                 float humidity,         //!< Relative humidity
    44                 float exptime           //!< Exposure time
    45     );
     208psExposureAlloc(double ra, double dec,  //!< Telescope boresight
     209                double ha,              //!< Hour angle
     210                double zd,              //!< Zenith distance
     211                double az,              //!< Azimuth
     212                double lst,             //!< Local Sidereal Time
     213                float mjd,              //!< MJD
     214                float rotAngle,         //!< Rotator position angle
     215                float temp,             //!< Temperature
     216                float pressure,         //!< Pressure
     217                float humidity,         //!< Relative humidity
     218                float exptime           //!< Exposure time
     219                );
    46220
    47221/** Destructor */
    48222void
    49223psExposureFree(psExposure *restrict myExp //!< Object to destroy
    50     );
    51 
    52 
    53 /***********************************************************************************************************/
    54 
    55 /** Cell details: specifies how the cell is mounted on its parent OTA */
    56 typedef struct {
    57     double x, y;                        //!< Position of cell in its OTA.  Specifies the position of the
    58                                         //!< (imaginary) pixel (0,0)
    59     double xErr, yErr;                  //!< Error in position of cell in the OTA.
    60     double rotation;                    //!< Rotation of cell in its OTA.  Specified from +x through +y
    61     int xSize, ySize;                   //!< Number of pixels in x and y
    62     double scale;                       //!< Relative pixel scales, if CCD pitch varies over the OTA. Specify
    63                                         //!< a positive scale for a left-handed coordinate system, negative
    64                                         //!< for right. If NULL, then every chip has identical scale, and
    65                                         //!< system is left-handed.
    66 } psCellDescription;
    67 
    68 /** Constructor */
    69 psCellDescription *
    70 psCellDescriptionAlloc(void);
    71 
    72 /** Destructor */
    73 void
    74 psCellDescriptionFree(psCellDescription *restrict myCell //!< Cell description to destroy
    75     );
    76 
    77 /***********************************************************************************************************/
    78 
    79 /** Array of cell descriptions */
    80 typedef struct {
    81     psType type;                        //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    82     int size;                           //!< Total number of elements available
    83     int n;                              //!< Number of elements in use
    84     double *arr;                        //!< The array data
    85 } psCellDescriptionArray;
    86 
    87 /** Constructor */
    88 psCellDescriptionArray *psCellDescriptionArrayAlloc(int s, //!< Total number of elements to make available
    89                                                     int n //!< Number of elements that will be used
    90                                                     );
    91 /** Reallocator */
    92 psCellDescriptionArray *psCellDescriptionArrayRealloc(psCellDescriptionArray *myArray, //!< Array to
    93                                                                                        //!< reallocate
    94                                                       int s //!< Total number of elements to make available
    95                                                       );
    96 /** Destructor */
    97 void psCellDescriptionArrayFree(psCellDescriptionArray *restrict myArray //!< Array to free
    98                                 );
    99 
    100 /***********************************************************************************************************/
    101 
    102 /** OTA details: specifies how the OTA is mounted on the focal plane */
    103 typedef struct {
    104     double x, y;                        //!< Position of OTA on the focal plane.  Specifies the position of
    105                                         //!< the bottom left-hand corner.
    106     double xErr, yErr;                  //!< Error in the position of the OTA.
    107     double rotation;                    //!< Rotation of OTA on the focal plane.  Specified from +x through +y
    108     psCellDescriptionArray *restrict cells; //!< Cell descriptions
    109     struct psOTAAstrom *astrom;         //!< OTA astrometry
    110     psExposure *exp;                    //!< Exposure data
    111 } psOTADescription;
    112 
    113 /** Constructor */
    114 psOTADescription *
    115 psOTADescriptionAlloc(void);
    116 
    117 /** Destructor. */
    118 void
    119 psOTADescriptionFree(psOTADescription *restrict myOTA //!< OTA description to destroy
    120     );
    121 
    122 /***********************************************************************************************************/
    123 
    124 /** Astrometric solution for an OTA.
    125  * There are four coordinate frames that we need to worry about:
    126  * 1. Chip frame: chip# plus x,y in pixels
    127  * 2. Focal plane frame: X,Y in microns
    128  * 3. Tangent plane: xi,eta in arcsec from the telescope boresight.
    129  * 4. Sky frame: RA,Dec
    130  *
    131  * 1 <--> 2: OTA description (parent of this struct) specifies how the chips are mounted on the focal plane.
    132  * 2 <--> 3: The astrometric solution corrects for distortions in the optics so we can go from what the
    133  * telescope sees on the focal plane to what it really should be like (i.e. the tangent plane).
    134  * 3 <--> 4: SLALib converts between the tangent plane and the celestial sphere using a set of numbers one
    135  * must calculate for each tangent point.
    136  *
    137  * Coordinate frames 2 and 3 are generally hidden from the user because all they care about is going between
    138  * frames 1 and 4.
    139  */
    140 typedef struct {
    141     /* Focal plane to and from tangent plane */
    142     psDPolynomial4D *restrict tpToFPX, *restrict tpToFPY; //!< General astrometric solution for tangent plane
    143                                                           //!< to focal plane
    144     psDPolynomial4D *restrict fpToTPXi, *restrict fpToTPEta; //!< General astrometric solution for focal plane
    145                                                              //!< to tangent plane
    146     psMatrix *pattern;                  //!< Fixed pattern distortions for focal plane to tangent plane (simply
    147                                         //!< * -1 for the reverse); MAY NEED TO BE REVISED UPON IMPLEMENTATION
    148     /* Tangent plane to and from the celestial sphere */
    149     psDoubleArray *restrict tp;         //!< Data needed to convert from the sky to the tangent plane and back;
    150                                         //!< produced by and used by SLALib (a.k.a. "Wallace's Grommit")
    151     psColourRef colorRef;               //!< Colour reference
    152     /* Characterisation of the solution */
    153     float rmsX, rmsY;                   //!< Dispersion in astrometric solution
    154     float chi2;                         //!< chi^2 of astrometric solution
    155 } psOTAAstrom;
    156 
    157 /** Constructor */
    158 psOTAAstrom *
    159 psOTAAstromAlloc(const psExposure *exp //!< Telescope pointing, used to initialise the tp data.
    160     );
    161 
    162 /** Destructor */
    163 void
    164 psOTAAstromFree(psOTAAstrom *restrict myAstrom  //!< Object to destroy
    165     );
    166 
    167 /***********************************************************************************************************/
    168 
    169 /* Calculating and applying astrometric solutions */
    170 
    171 /** Convert (RA,Dec) to (cell#,x,y) */
    172 psOTAPos *
    173 psSkyToOTA(const psSkyPos *restrict position, //!< Position on the sky
    174            const psOTADescription *restrict ota //!< OTA details
    175     );
    176 
    177 /** Convert (cell#,x,y) to (RA,Dec) */
    178 psSkyPos *
    179 psOTAToSky(const psOTAPos *restrict position, //!< Position on the detector
    180            const psOTADescription *restrict ota //!< OTA details
    181     );
    182 
    183 /** Fit astrometric solution to list of (chip#,x,y) and (RA,Dec) */
    184 int
    185 psFitAstrom(psOTADescription *restrict ota, //!< Initial guess for coefficients
    186             const psOTAPosArray *restrict detector, //!< Positions on OTA (chip#,x,y)
    187             const psSkyPosArray *restrict sky, //!< Positions on the sky (RA,Dec)
    188             const psExposure *exp       //!< Telescope pointing information, for airmass, parallactic angle
    189                                         //!< which may help set the astrometric solution
    190             );
    191 
    192 /***********************************************************************************************************/
    193 
    194 /* Functions needed for astrometry, and will likely be useful elsewhere */
    195 
    196 /** Get the airmass for a given position and sidereal time */
    197 float
    198 psGetAirmass(const psSkyPos *restrict position, //!< Position on the sky
    199              double siderealTime        //!< Sidereal time
    200              );
    201 
    202 /** Get the parallactic angle for a given position and sidereal time */
    203 float
    204 psGetParallactic(const psSkyPos *restrict position, //!< Position on the sky
    205                  double siderealTime    //!< Sidereal time
    206                  );
    207 
    208 /** Estimate atmospheric refraction, along the parallactic */
    209 float
    210 psGetRefraction(float colour,           //!< Colour of object
    211                 psColourRef colourRef,  //!< Colour reference
    212                 psExposure *exp         //!< Telescope pointing information, for airmass, temp and pressure
    213     );
    214 
    215 /***********************************************************************************************************/
     224               );
    216225
    217226#endif
  • trunk/archive/pslib/include/psImage.h

    r243 r251  
    88
    99/** General image manipulation functions.
     10 *  These functions operate on individual 2D images
    1011 */
    1112
     
    2728    struct psImage *children;           ///< children of this region
    2829    int Nchildren;                      ///< number of subimages
    29     struct psMetaDataSet *md;           ///< metadata associated with image
    30     psObjectArray *objtable;            ///< objects associated with image
    3130} psImage;
    3231
  • trunk/archive/pslib/include/psLib.h

    r248 r251  
    3333
    3434/** @defgroup AstroGroup Astronomy-Specific Utilities */
    35 # include <psAstrom.h>
    36 # include <psPhotom.h>
    37 # include <psImage.h>
    38 # include <psObject.h>
    3935# include <psPosition.h>
    4036# include <psDateTime.h>
    4137# include <psMetaData.h>
     38# include <psImage.h>
     39# include <psPhotom.h>
     40# include <psAstrom.h>
     41# include <psObject.h>
    4242
    4343# endif
  • trunk/archive/pslib/include/psObject.h

    r244 r251  
    1111/** Object definition, to handle both objects we detect, and catalogues */
    1212typedef struct {
    13     psOTAPos *otaPos;                   //!< Centre position on OTA, with associated error
    14     psSkyPos *skyPos;                   //!< Position on the sky, with associated error
     13    psCoord *cell;                      //!< Centre position on Cell, with associated error
     14    psCoord *sky;                       //!< Position on the sky, with associated error
    1515    float mag, magErr;                  //!< Magnitude and associated error
    1616    float isoMag, isoMagErr;            //!< Isophotal magnitude and associated error
     
    2020    float sky, skyErr;                  //!< Local sky level, and associated error
    2121    float colour, colourErr;            //!< Colour and associated error, if known
    22     psColourRef colourRef;              //!< Colour reference
     22    psPhotSysrem colorPlus, colorMinus; //!< Colour reference
    2323    psBitMask *quality;                 //!< Bit mask for quality information
     24    psCell *parentCell;                 ///< Cell this measurement came from
    2425} psObject;
    2526
  • trunk/archive/pslib/include/psPosition.h

    r247 r251  
    77 */
    88
    9 /***********************************************************************************************************/
     9/*************************************************/
     10typedef struct {
     11    union {
     12        double x;                               //!< x position
     13        double r;                               //!< x position
     14    }
     15    union {
     16        double xErr;                            //!< Error in x position
     17        double rErr;                            //!< Error in x position
     18    }
     19    union {
     20        double y;                               //!< y position
     21        double d;                               //!< y position
     22    }
     23    union {
     24        double yErr;                            //!< Error in y position
     25        double dErr;                            //!< Error in y position
     26    }
     27} psCoord;
    1028
    11 /** Planets */
    12 typedef enum {
    13     PS_MERCURY = 1,
    14     PS_VENUS = 2,
    15     PS_MARS = 4,
    16     PS_JUPITER = 5,
    17     PS_SATURN = 6,
    18     PS_URANUS = 7,
    19     PS_NEPTUNE = 8,
    20     PS_PLUTO = 9
    21 } psPlanetNum;
     29typedef struct {
     30    psDPolynomial4D *x;
     31    psDPolynomial4D *y;
     32} psDistortion;
    2233
    23 /** Catalogues */
    24 typedef enum {
    25     PS_PANSTARRS,                       //!< Pan-STARRS object catalogue
    26     PS_USNO,                            //!< USNO-B1 catalogue
    27     PS_2MASS,                           //!< 2MASS catalogue
    28     PS_TYCHO,                           //!< Tycho catalogue
    29     PS_UCAC2 = 4                        //!< UCAC2 catalogue
    30 } psCatalogue;
     34typedef struct {
     35    psDPolynomial2D *x;
     36    psDPolynomial2D *y;
     37} psCoordXform;
    3138
    32 /***********************************************************************************************************/
     39psCoord *psCoordXformApply (psCoordXform *frame, psCoord *coords);
    3340
    34 /** A position on an OTA */
    35 typedef struct {
    36     int chip;                           //!< Chip number
    37     float x;                            //!< x position
    38     float xErr;                         //!< Error in x position
    39     float y;                            //!< y position
    40     float yErr;                         //!< Error in y position
    41 } psOTAPos;
    42 
    43 /** Constructor */
    44 psOTAPos *
    45 psOTAPosAlloc(void);
    46 
    47 /** Destructor */
    48 void
    49 psOTAPosFree(psOTAPos *restrict myOTAPos        //!< Object to destroy
    50     );
    51 
    52 /***********************************************************************************************************/
    53 
    54 /** A position on a cell */
    55 typedef psOTAPos psCellPos;             //!< Same thing as for an OTA.
    56 #define psCellPosAlloc() psOTAPosAlloc() //!< Constructor
    57 #define psCellPosFree(C) psOTAPosFree(C) //!< Destructor
    58 
    59 /***********************************************************************************************************/
    60 
    61 /** An array of detector positions */
    62 typedef struct {
    63     psType type;                        //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    64     int size;                           //!< Total number of elements available
    65     int n;                              //!< Number of elements in use
    66     psOTAPos *arr;                      //!< The array data
    67 } psOTAPosArray;
    68 
    69 /** Constructor */
    70 psOTAPosArray *psOTAPosArrayAlloc(int s, //!< Total number of elements to make available
    71                                   int n //!< Number of elements that will be used
    72     );
    73 /** Reallocator */
    74 psOTAPosArray *psOTAPosArrayRealloc(psOTAPosArray *myArray, //!< Array to reallocate
    75                                     int s       //!< Total number of elements to make available
    76     );
    77 /** Destructor */
    78 void psOTAPosArrayFree(psOTAPosArray *restrict myArray //!< Array to free
    79     );
    80 
    81 /***********************************************************************************************************/
    82 
    83 /*
    84  * \brief A simple RA/Dec position on the sky, default system is ICRS.  Double precision needed for
    85  * milli-arcsec.
    86  */
    87 typedef struct {
    88     double ra;                          //!< Right Ascension
    89     double raErr;                       //!< Error in RA
    90     double dec;                         //!< Declination
    91     double decErr;                      //!< Error in Dec
    92 } psSkyPos;
    93 
    94 /** Constructor */
    95 psSkyPos *
    96 psSkyPosAlloc(void);
    97 
    98 /** Destructor */
    99 void
    100 psSkyPosFree(psSkyPos *restrict mySkyPos        //!< Object to destroy
    101     );
    102 
    103 /***********************************************************************************************************/
    104 
    105 /** An array of sky positions */
    106 typedef struct {
    107     psType type;                        //!< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
    108     int size;                           //!< Total number of elements available
    109     int n;                              //!< Number of elements in use
    110     psSkyPos *arr;                      //!< The array data
    111 } psSkyPosArray;
    112 
    113 /** Constructor */
    114 psSkyPosArray *psSkyPosArrayAlloc(int s, //!< Total number of elements to make available
    115                                   int n //!< Number of elements that will be used
    116     );
    117 /** Reallocator */
    118 psSkyPosArray *psSkyPosArrayRealloc(psSkyPosArray *myArray, //!< Array to reallocate
    119                                     int s       //!< Total number of elements to make available
    120     );
    121 /** Destructor */
    122 void psSkyPosArrayFree(psSkyPosArray *restrict myArray //!< Array to free
    123     );
    124 
    125 /***********************************************************************************************************/
    126 
    127 /** Latitude and Longitude.  Double precision needed for milli-arcsec */
    128 typedef struct {
    129     double lat;                         //!< Latitude
    130     double latErr;                      //!< Error in Latitude
    131     double lng;                         //!< Longitude (can't use "long")
    132     double lngErr;                      //!< Error in Longitude
    133 } psLatLong;
    134 
    135 /** Constructor */
    136 psLatLong *
    137 psLatLongAlloc(void);
    138 
    139 /** Destructor */
    140 void
    141 psLatLongFree(psLatLong *restrict myLatLong //!< Object to destroy
    142     );
     41psCoord *psDistortionApply (psCoordXform *frame, psCoord *coords);
    14342
    14443/***********************************************************************************************************/
     
    14746
    14847/** Get offset (RA,Dec) on the sky between two positions position1 and position2 may not be identical */
    149 psSkyPos *
    150 psGetOffset(const psSkyPos *restrict position1, //!< Position 1
    151             const psSkyPos *restrict position2 //!< Position 2
     48psCoords *
     49psGetOffset(const psCoords *restrict position1, //!< Position 1
     50            const psCoords *restrict position2, //!< Position 2
     51            char *system
    15252            );
    15353
    15454/** Apply an offset to a position */
    155 psSkyPos *
    156 psApplyOffset(const psSkyPos *restrict position, //!< Position
    157               const psSkyPos *restrict offset //!< Offset
    158               );
     55psCoords *
     56psApplyOffset(const psCoords *restrict position, //!< Position
     57              const psCoords *restrict offset, //!< Offset
     58              char *system
     59    );
    15960
    16061/***********************************************************************************************************/
     
    16364
    16465/** Get Sun Position */
    165 psSkyPos *
     66psCoords *
    16667psGetSunPos(float mjd                   //!< MJD to get position for
    16768            );
    16869
    16970/** Get Moon position */
    170 psSkyPos *
     71psCoords *
    17172psGetMoonPos(float mjd,                 //!< MJD to get position for
    17273             double latitude,           //!< Latitude for apparent position
     
    18081
    18182/** Get Planet positions */
    182 psSkyPos *
    183 psGetPlanetPos(psPlanetNum myPlanetNum, //!< Number for planet
    184                float mjd                //!< MJD to get position for
    185                );
    186 
    187 /** Get star list from catalogue */
    188 struct psObjectArray *
    189 psReadStarCatalogue(double ra,          //!< RA of centre of search
    190                     double dec,         //!< Declination of centre of search
    191                     float radius,       //!< Radius of search for stars in catalogue
    192                     float mjd,          //!< The epoch (in MJD) for which to get positions
    193                     psCatalogue myCatalogue //!< The catalogue to use
     83psCoords *
     84psGetSolarSystemPos(char *solarSystemObject, //!< Named S.S. object
     85                    float mjd           //!< MJD to get position for
    19486    );
    19587
     
    19991
    20092/** Convert ICRS to Ecliptic */
    201 psLatLong *
    202 psCoordinatesItoE(const psSkyPos *restrict coordinates //!< ICRS coordinates to convert
     93psCoord *
     94psCoordinatesItoE(const psCoord *restrict coordinates //!< ICRS coordinates to convert
    20395                  );
    20496
    20597/** Convert Ecliptic to ICRS */
    206 psSkyPos *
    207 psCoordinatesEtoI(const psLatLong *restrict coordinates //!< Ecliptic coordinates to convert
     98psCoord *
     99psCoordinatesEtoI(const psCoord *restrict coordinates //!< Ecliptic coordinates to convert
    208100                  );
    209101
    210102/** Convert ICRS to Galactic */
    211 psLatLong *
    212 psCoordinatesItoG(const psSkyPos *restrict coordinates //!< ICRS coordinates to convert
     103psCoord *
     104psCoordinatesItoG(const psCoord *restrict coordinates //!< ICRS coordinates to convert
    213105                  );
    214106
    215107/** Convert Galactic to ICRS */
    216 psSkyPos *
    217 psCoordinatesGtoI(const psLatLong *restrict coordinates //!< Galactic coordinates to convert
     108psCoord *
     109psCoordinatesGtoI(const psCoord *restrict coordinates //!< Galactic coordinates to convert
    218110                  );
    219111
Note: See TracChangeset for help on using the changeset viewer.