IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2222


Ignore:
Timestamp:
Oct 27, 2004, 1:49:00 PM (22 years ago)
Author:
gusciora
Message:

Parameter checking for the psAstrometry.c file.

File:
1 edited

Legend:

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

    r2221 r2222  
    88 *  @author George Gusciora, MHPCC
    99 *
    10  *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-10-27 23:31:43 $
     10 *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-10-27 23:49:00 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3636                                   psImage* tmpImage)
    3737{
    38     if (tmpImage == NULL) {
    39         return(0);
    40     }
    41 
    42     if ((x < 0.0) ||
    43             (x > (double)tmpImage->numCols) ||
    44             (y < 0.0) ||
    45             (y > (double)tmpImage->numRows)) {
     38    PS_IMAGE_CHECK_NULL(tmpImage, 0);
     39
     40    if ((x < 0.0) || (x > (double)tmpImage->numCols) ||
     41            (y < 0.0) || (y > (double)tmpImage->numRows)) {
    4642        return (0);
    4743    }
     
    5753static psS32 isProjectionLinear(psPlaneTransform *transform)
    5854{
    59     int i = 0;
    6055    PS_PTR_CHECK_NULL(transform, 0);
     56    PS_PTR_CHECK_NULL(transform->x, 0);
     57    PS_PTR_CHECK_NULL(transform->y, 0);
     58
     59    int i;
    6160
    6261    for (i=2;i<(transform->x->nX);i++) {
     
    106105static psPlaneTransform *invertPlaneTransform(psPlaneTransform *transform)
    107106{
     107    PS_PTR_CHECK_NULL(transform, 0);
     108    PS_PTR_CHECK_NULL(transform->x, 0);
     109    PS_PTR_CHECK_NULL(transform->y, 0);
     110
    108111    double A = transform->x->coeff[0][0];
    109112    double B = transform->x->coeff[1][0];
     
    113116    double F = transform->y->coeff[0][1];
    114117
    115     PS_PTR_CHECK_NULL(transform, NULL);
    116118    psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform));
    117119
     
    210212/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    211213/*****************************************************************************/
    212 
    213214
    214215/*
     
    286287{
    287288    PS_PTR_CHECK_NULL(observatory, NULL);
     289
    288290    psExposure* exp = psAlloc(sizeof(psExposure));
    289 
    290291    *(double *)&exp->ra = ra;
    291292    *(double *)&exp->dec = dec;
     
    345346                  const psExposure* exp)
    346347{
     348    PS_INT_CHECK_NON_NEGATIVE(nChips, NULL);
     349
    347350    psFPA* newFPA = psAlloc(sizeof(psFPA));
    348351
     
    386389                    psFPA *parentFPA)
    387390{
     391    PS_INT_CHECK_NON_NEGATIVE(nCells, NULL);
     392
    388393    psChip* chip = psAlloc(sizeof(psChip));
    389394
     
    414419                    psChip* parentChip)
    415420{
     421    PS_INT_CHECK_NON_NEGATIVE(nReadouts, NULL);
     422
    416423    psCell* cell = psAlloc(sizeof(psCell));
    417424
     
    443450                          const psImage* image)
    444451{
     452    PS_INT_CHECK_NON_NEGATIVE(col0, NULL);
     453    PS_INT_CHECK_NON_NEGATIVE(row0, NULL);
     454
    445455    psReadout* readout = psAlloc(sizeof(psReadout));
    446456
     
    494504    PS_PTR_CHECK_NULL(fpaCoord, NULL);
    495505    PS_PTR_CHECK_NULL(FPA, NULL);
     506
    496507    psChip* tmpChip = NULL;
    497508    psPlane chipCoord;
     
    519530    PS_PTR_CHECK_NULL(FPA, NULL);
    520531    PS_PTR_CHECK_NULL(FPA->chips, NULL);
     532
    521533    psArray* chips = FPA->chips;
    522534    psS32 nChips = chips->n;
     
    530542    for (psS32 i = 0; i < nChips; i++) {
    531543        psChip* tmpChip = chips->data[i];
     544        PS_PTR_CHECK_NULL(tmpChip, NULL);
     545        PS_PTR_CHECK_NULL(tmpChip->fromFPA, NULL);
     546
    532547        psPlaneTransformApply(&chipCoord, tmpChip->fromFPA, fpaCoord);
    533548
     
    561576    for (psS32 i = 0; i < cells->n; i++) {
    562577        psCell* tmpCell = (psCell* ) cells->data[i];
     578        PS_PTR_CHECK_NULL(tmpCell, NULL);
     579        PS_PTR_CHECK_NULL(tmpCell->fromChip, NULL);
    563580        psArray* readouts = tmpCell->readouts;
    564581
     
    566583            for (psS32 j = 0; j < readouts->n; j++) {
    567584                psReadout* tmpReadout = readouts->data[j];
     585                PS_READOUT_CHECK_NULL(tmpReadout, NULL);
    568586
    569587                psPlaneTransformApply(&cellCoord,
     
    657675    PS_PTR_CHECK_NULL(cellCoord, NULL);
    658676    PS_PTR_CHECK_NULL(cell, NULL);
     677    PS_PTR_CHECK_NULL(cell->toFPA, NULL);
     678    PS_PTR_CHECK_NULL(cell->parent, NULL);
     679    PS_PTR_CHECK_NULL(cell->parent->parent, NULL);
     680    PS_PTR_CHECK_NULL(cell->parent->parent->toTangentPlane, NULL);
     681    PS_PTR_CHECK_NULL(cell->parent->parent->exposure, NULL);
    659682
    660683    psPlane* fpaCoord = NULL;
     
    689712    PS_PTR_CHECK_NULL(cellCoord, NULL);
    690713    PS_PTR_CHECK_NULL(cell, NULL);
     714    PS_PTR_CHECK_NULL(cell->toTP, NULL);
     715    PS_PTR_CHECK_NULL(cell->parent, NULL);
     716    PS_PTR_CHECK_NULL(cell->parent->parent, NULL);
     717    PS_PTR_CHECK_NULL(cell->parent->parent->projection, NULL);
    691718
    692719    psPlane *tpCoord = NULL;
     
    700727
    701728    // Determine the tangent plane coordinates.
    702     tpCoord = psPlaneTransformApply(tpCoord, cell->toTP, cellCoord);
     729    tpCoord = psPlaneTransformApply(NULL, cell->toTP, cellCoord);
    703730
    704731    // Save the old projection type and set the new projection type to TAN.
     
    746773    PS_PTR_CHECK_NULL(tpCoord, NULL);
    747774    PS_PTR_CHECK_NULL(fpa, NULL);
     775    PS_PTR_CHECK_NULL(fpa->fromTangentPlane, NULL);
    748776
    749777    return (psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane,
     
    757785    PS_PTR_CHECK_NULL(fpaCoord, NULL);
    758786    PS_PTR_CHECK_NULL(chip, NULL);
    759     PS_PTR_CHECK_NULL(chip->parent, NULL);
     787    PS_PTR_CHECK_NULL(chip->fromFPA, NULL);
    760788
    761789    chipCoord = psPlaneTransformApply(chipCoord, chip->fromFPA, fpaCoord);
     
    769797    PS_PTR_CHECK_NULL(chipCoord, NULL);
    770798    PS_PTR_CHECK_NULL(cell, NULL);
    771     PS_PTR_CHECK_NULL(cell->parent, NULL);
     799    PS_PTR_CHECK_NULL(cell->fromChip, NULL);
    772800
    773801    cellCoord = psPlaneTransformApply(cellCoord, cell->fromChip, chipCoord);
     
    783811    PS_PTR_CHECK_NULL(skyCoord, NULL);
    784812    PS_PTR_CHECK_NULL(cell, NULL);
     813    PS_PTR_CHECK_NULL(cell->parent, NULL);
     814    PS_PTR_CHECK_NULL(cell->parent->parent, NULL);
     815    PS_PTR_CHECK_NULL(cell->parent->parent->grommit, NULL);
    785816
    786817    psChip *parChip = cell->parent;
     
    814845    PS_PTR_CHECK_NULL(skyCoord, NULL);
    815846    PS_PTR_CHECK_NULL(cell, NULL);
     847    PS_PTR_CHECK_NULL(cell->parent, NULL);
     848    PS_PTR_CHECK_NULL(cell->parent->parent, NULL);
     849    PS_PTR_CHECK_NULL(cell->parent->parent->projection, NULL);
     850    PS_PTR_CHECK_NULL(cell->toTP, NULL);
    816851
    817852    psPlane *tpCoord = NULL;
Note: See TracChangeset for help on using the changeset viewer.