IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1325


Ignore:
Timestamp:
Jul 28, 2004, 4:08:02 PM (22 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psLib/src
Files:
6 edited

Legend:

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

    r1311 r1325  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-28 20:22:22 $
     12 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-07-29 02:08:02 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    146146}
    147147
    148 psSphereTransform *psSphereTransformEcliptictoICRS(void)
     148psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
    149149{
    150150    struct tm *tmTime = psTimeToTM(time);
     
    293293                            psSphereOffsetUnit unit)
    294294{
    295     psPlane *lin;
     295    //    psPlane *lin;
    296296    psProjection proj;
    297297    psSphere *tmp;
     
    312312        proj.type = PS_PROJ_TAN;
    313313
    314         lin = psProject(position2, proj);
    315         tmp = psDeproject(lin, proj);
     314        //        lin = psProject(position2, proj);
     315        //        tmp = psDeproject(lin, proj);
    316316
    317317        // XXX: Do we need to convert units in tmp?
  • trunk/psLib/src/astro/psCoord.h

    r1297 r1325  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-27 05:30:55 $
     12 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-07-29 02:08:02 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424#include "psList.h"
    2525#include "psFunctions.h"
     26#include "psTime.h"
    2627
    2728typedef struct
     
    121122                                 const psSphere *coord);
    122123
    123 psSphereTransform *psSphereTransformICRStoEcliptic(void);
    124 psSphereTransform *psSphereTransformEcliptictoICRS(void);
     124psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
     125psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
    125126psSphereTransform *psSphereTransformICRStoGalatic(void);
    126127psSphereTransform *psSphereTransformGalatictoICRS(void);
  • trunk/psLib/src/astronomy/psCCD.h

    r1239 r1325  
    1111 *  @author Robert DeSonia, MHPCC
    1212 *
    13  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-07-16 02:33:50 $
     13 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2004-07-29 02:08:02 $
    1515 *
    1616 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7676
    7777    psPlaneTransform* toChip;          ///< transformations from cell to chip coordinates
     78    psPlaneTransform* fromChip;        ///< transformations from chip to cell coordinates
    7879    psPlaneTransform* toFPA;           ///< transformations from cell to FPA coordinates
    7980    psPlaneTransform* toSky;           ///< transformations from cell to sky coordinates
  • trunk/psLib/src/astronomy/psCoord.c

    r1311 r1325  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-28 20:22:22 $
     12 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-07-29 02:08:02 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    146146}
    147147
    148 psSphereTransform *psSphereTransformEcliptictoICRS(void)
     148psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
    149149{
    150150    struct tm *tmTime = psTimeToTM(time);
     
    293293                            psSphereOffsetUnit unit)
    294294{
    295     psPlane *lin;
     295    //    psPlane *lin;
    296296    psProjection proj;
    297297    psSphere *tmp;
     
    312312        proj.type = PS_PROJ_TAN;
    313313
    314         lin = psProject(position2, proj);
    315         tmp = psDeproject(lin, proj);
     314        //        lin = psProject(position2, proj);
     315        //        tmp = psDeproject(lin, proj);
    316316
    317317        // XXX: Do we need to convert units in tmp?
  • trunk/psLib/src/astronomy/psCoord.h

    r1297 r1325  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-27 05:30:55 $
     12 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-07-29 02:08:02 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424#include "psList.h"
    2525#include "psFunctions.h"
     26#include "psTime.h"
    2627
    2728typedef struct
     
    121122                                 const psSphere *coord);
    122123
    123 psSphereTransform *psSphereTransformICRStoEcliptic(void);
    124 psSphereTransform *psSphereTransformEcliptictoICRS(void);
     124psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
     125psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
    125126psSphereTransform *psSphereTransformICRStoGalatic(void);
    126127psSphereTransform *psSphereTransformGalatictoICRS(void);
  • trunk/psLib/src/astronomy/psCoord2.c

    r1312 r1325  
     1// This file contains
    12
    23#include "psType.h"
     
    5354
    5455    for (tmpChip = FPA->chips; tmpChip != NULL; tmpChip++) {
     56        tmpCoord = psPlaneTransformApply(out, tmpChip->fromFPA, coord);
     57
     58
    5559        //XXX     if (this is the correct chip)
    5660        return(tmpChip);
     
    5862}
    5963
     64#define PS_CHECK_VALID_IMAGE_COORDS(X, Y, IMAGE) \
     65
     66p_psCheckValidImageCoords(double x, double y, tmpImage)
     67{
     68    if ((x < 0.0) ||
     69            (x > (double) tmpImage->numCols) ||
     70            (y < 0.0) ||
     71            (y > (double) tmpImage->numRows)) {
     72        return(0);
     73    }
     74    return(1);
     75}
     76
     77
     78/*****************************************************************************
     79XXX: We assume that readouts have valid coordinates from the range
     80(0,numRows or numCols) in each dimension, and that they are square with the
     81x/y axis.
     82 
     83XXX: We assume that if a cell has more than one readout, all readouts have
     84the same coordinates.
     85 
     86XXX: if we find no cell with has this coordinate, we return NULL.
     87 
     88XXX: must deallocate memory.
     89 *****************************************************************************/
    6090psCell *psCellinChip(psCell *out,
    6191                     const psPlane *coord,
     
    6393{
    6494    psCell *tmpCell = NULL;
     95    psReadout *tmpReadout = NULL;
     96    psPlane *tmpCoord = NULL;
    6597
    6698    for (tmpCell = chip->cells; tmpCell != NULL; tmpCell++) {
    67         //XXX        if (this is the correct cell)
    68         return(tmpCcell);
     99        if (tmpCell->readouts != NULL) {
     100            tmpReadout = tmpCell->readouts;
     101            tmpCoord = psPlaneTransformApply(out, tmpCell->fromChip, coord);
     102            if (p_psCheckValidImageCoords(tmpCoord->x, tmpCoord->y,
     103                                          tmpReadout->image)) {
     104                return(tmpCell);
     105            }
     106        }
    69107    }
     108    return(NULL);
    70109}
    71110
     
    74113                           const psCell *cell)
    75114{
    76     return(psPlaneTransformApply(psPlane *out, cell->toChip, in));
     115    return(psPlaneTransformApply(out, cell->toChip, in));
    77116}
    78117
     
    81120                          const psChip *chip)
    82121{
    83     return(psPlaneTransformApply(psPlane *out, chip->toFPA, in));
     122    return(psPlaneTransformApply(out, chip->toFPA, in));
    84123}
    85124
     
    88127                        const psFPA *fpa)
    89128{
    90     return(psPlaneTransformApply(psPlane *out, fpa->toTangentPlane, in));
     129    return(psPlaneTransformApply(out, fpa->toTangentPlane, in));
    91130}
    92131
     
    101140                          const psCell *cell)
    102141{
    103     return(psPlaneTransformApply(psPlane *out, cell->toFPA, in));
    104 }
    105 
     142    return(psPlaneTransformApply(out, cell->toFPA, in));
     143}
     144
     145
     146// XXX: This implementation requires a new psGrommit be created for each
     147// transformation, as well as a few psPlane structs.  Can this be implemented
     148// better?
    106149psSphere *psCoordCelltoSky(psSphere *out,
    107150                           const psPlane *in,
    108151                           const psCell *cell)
    109152{
    110     if (out == NULL) {
    111         out = (psSphere *) psAlloc(sizeof(psSphere));
    112     }
    113 
    114     return(out);
    115 }
    116 
    117 psSphere *psCoordCelltoSkyQuick(psSphere *out,
    118                                 const psPlane *in,
    119                                 const psCell *cell)
    120 {
    121     if (out == NULL) {
    122         out = (psSphere *) psAlloc(sizeof(psSphere));
    123     }
    124 
    125     return(out);
    126 }
    127 
    128 psPlane *psCoordSkytoTP(psPlane *out,
    129                         const psSphere *in,
    130                         const psGrommit *grommit)
    131 {
    132     if (out == NULL) {
    133         out = (psPlane *) psAlloc(sizeof(psPlane));
    134     }
    135 
    136     return(out);
    137 }
    138 
    139 psPlane *psCoordTPtoFPA(psPlane *out,
    140                         const psPlane *in,
    141                         const psFPA *fpa)
    142 {
    143     return(psPlaneTransformApply(psPlane *out, fpa->fromTangentPlane, in));
    144 }
    145 
    146 psPlane *psCoordFPAtoChip(psPlane *out,
    147                           const psPlane *in,
    148                           const psChip *chip)
    149 {
    150 
    151     if (out == NULL) {
    152         out = (psPlane *) psAlloc(sizeof(psPlane));
    153     }
    154 
    155     return(out);
    156 }
    157 
    158 psPlane *psCoordChiptoCell(psPlane *out,
    159                            const psPlane *in,
    160                            const psCell *cell)
    161 {
    162     if (out == NULL) {
    163         out = (psPlane *) psAlloc(sizeof(psPlane));
    164     }
    165 
    166     return(out);
    167 }
    168 
    169 psPlane *psCoordSkytoCell(psPlane *out,
    170                           const psSphere *in,
    171                           const psCell *cell)
    172 {
    173     if (out == NULL) {
    174         out = (psPlane *) psAlloc(sizeof(psPlane));
    175     }
    176 
    177     return(out);
    178 }
    179 
    180 psPlane *psCoordSkytoCellQuick(psPlane *out,
     153    psPlane *tmp1 = NULL;
     154    psPlane *tmp2 = NULL;
     155    psFPA *parFPA = (cell->parent)->parent;
     156    psGrommit *tmpGrommit = NULL;
     157
     158    tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in)
     159           tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1)
     160                  tmpGrommit = psGrommitAlloc(parFPA->exposure)
     161                               tmp3 = psCoordTPtoSky(out, tmp2, psGrommit);
     162
     163    psFree(tmp1);
     164    psFree(tmp2);
     165    psFree(tmpGrommit);
     166
     167    return(psCoordTPtoSky(out, tmp2, psGrommit);
     168       }
     169
     170       psSphere *psCoordCelltoSkyQuick(psSphere *out,
     171                                       const psPlane *in,
     172                                       const psCell *cell)
     173       {
     174           psPlane *tmp1 = NULL;
     175
     176           tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in);
     177
     178           //XXX: Do something to convert the linear coords in tmp1 to spherical
     179           // coords in out.
     180
     181           free(tmp1)
     182
     183           return(out);
     184       }
     185
     186       psPlane *psCoordSkytoTP(psPlane *out,
    181187                               const psSphere *in,
    182                                const psCell *cell)
    183 {
    184     if (out == NULL) {
    185         out = (psPlane *) psAlloc(sizeof(psPlane));
    186     }
    187 
    188     return(out);
    189 }
    190 
    191 
     188                               const psGrommit *grommit)
     189       {
     190           if (out == NULL) {
     191               out = (psPlane *) psAlloc(sizeof(psPlane));
     192           }
     193
     194           return(out);
     195       }
     196
     197       psPlane *psCoordTPtoFPA(psPlane *out,
     198                               const psPlane *in,
     199                               const psFPA *fpa)
     200       {
     201           return(psPlaneTransformApply(out, fpa->fromTangentPlane, in));
     202       }
     203
     204       psPlane *psCoordFPAtoChip(psPlane *out,
     205                                 const psPlane *in,
     206                                 const psChip *chip)
     207       {
     208           return(psPlaneTransformApply(out, chip->fromFPA, in));
     209       }
     210
     211
     212       psPlane *psCoordChiptoCell(psPlane *out,
     213                                  const psPlane *in,
     214                                  const psCell *cell)
     215       {
     216           return(psPlaneTransformApply(out, cell->fromChip, in));
     217       }
     218
     219       psPlane *psCoordSkytoCell(psPlane *out,
     220                                 const psSphere *in,
     221                                 const psCell *cell)
     222       {
     223           out = psCoordSkytoTP(out, in, tmpGrommit);
     224           out = psCoordTPtoFPA(out, out, whichFPA);
     225           out = psCoordFPAtoChip(out, out, whichChip);
     226           out = psCoordChiptoCell(out, out, whichCell);
     227
     228           return(out);
     229       }
     230
     231       psPlane *psCoordSkytoCellQuick(psPlane *out,
     232                                      const psSphere *in,
     233                                      const psCell *cell)
     234       {
     235           if (out == NULL) {
     236               out = (psPlane *) psAlloc(sizeof(psPlane));
     237           }
     238
     239           return(out);
     240       }
     241
     242
Note: See TracChangeset for help on using the changeset viewer.