IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4770


Ignore:
Timestamp:
Aug 15, 2005, 3:10:36 PM (21 years ago)
Author:
gusciora
Message:

There are a lot of changes here required by the new SDRS. Most changes
involve the new definitions of the psAstrometry types. Not all tests work
correctly.

Location:
trunk/psModules
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmAstrometry.c

    r4754 r4770  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-08-11 00:03:51 $
     10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-08-16 01:10:34 $
    1212 *
    1313 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "pmAstrometry.h"
    2424
    25 psDB wow;
    26 
    2725/*****************************************************************************
    28 checkValidImageCoords(): this is a private function which simply
    29 determines if the supplied x,y coordinates are in the range for the supplied
    30 psImage.
     26checkValidImageCoords(): this is a private function which simply determines if
     27the supplied x,y coordinates are in the range for the supplied psImage.
     28 
     29XXX: What about col0 and row0
     30XXX: This should return a psBool.
    3131 *****************************************************************************/
    32 /*
    3332static psS32 checkValidImageCoords(double x,
    3433                                   double y,
     
    3635{
    3736    PS_ASSERT_IMAGE_NON_NULL(tmpImage, 0);
    38  
     37
    3938    if ((x < 0.0) || (x > (double)tmpImage->numCols) ||
    4039            (y < 0.0) || (y > (double)tmpImage->numRows)) {
    4140        return (0);
    4241    }
    43  
     42
    4443    return (1);
    4544}
    46 */
    47 /*
    48 static void FPAFree(psFPA* fpa)
     45
     46/******************************************************************************
     47XXX: Is this the correct way to free metadata?
     48XXX: Is this the correct way to free database structs?
     49 *****************************************************************************/
     50
     51static void FPAFree(pmFPA *fpa)
    4952{
    5053    if (fpa != NULL) {
    51         psFree(fpa->chips);
    52         psFree(fpa->grommit);
    53         psFree(fpa->exposure);
    54         psFree(fpa->metadata);
    5554        psFree(fpa->fromTangentPlane);
    5655        psFree(fpa->toTangentPlane);
    57         psFree(fpa->pattern);
    58         psFree(fpa->colorPlus);
    59         psFree(fpa->colorMinus);
    6056        psFree(fpa->projection);
    61     }
    62 }
    63 */
    64 
    65 /*
    66 static void chipFree(psChip* chip)
     57        psFree(fpa->concepts);
     58        psFree(fpa->analysis);
     59        psFree(fpa->camera);
     60        psFree(fpa->chips);
     61        psFree(fpa->header);
     62        psFree(fpa->db);
     63    }
     64}
     65
     66static void chipFree(pmChip* chip)
    6767{
    6868    if (chip != NULL) {
    69         psFree(chip->cells);
    70         psFree(chip->metadata);
    7169        psFree(chip->toFPA);
    7270        psFree(chip->fromFPA);
    73     }
    74 }
    75 */
    76 
    77 /*
    78 static void cellFree(psCell* cell)
     71        psFree(chip->concepts);
     72        psFree(chip->analysis);
     73        psFree(chip->cells);
     74        psFree(chip->parent);
     75        psFree(chip->extname);
     76        psFree(chip->pixels);
     77        psFree(chip->header);
     78    }
     79}
     80
     81static void cellFree(pmCell *cell)
    7982{
    8083    if (cell != NULL) {
     84        psFree(cell->toChip);
     85        psFree(cell->toFPA);
     86        psFree(cell->toSky);
     87        psFree(cell->concepts);
     88        psFree(cell->analysis);
    8189        psFree(cell->readouts);
    82         psFree(cell->metadata);
    83         psFree(cell->toChip);
    84         psFree(cell->fromChip);
    85         psFree(cell->toFPA);
    86         psFree(cell->toTP);
    87         psFree(cell->toSky);
    88     }
    89 }
    90 */
    91 
    92 static void readoutFree(psReadout* readout)
     90        psFree(cell->parent);
     91        psFree(cell->extname);
     92        psFree(cell->pixels);
     93        psFree(cell->header);
     94    }
     95}
     96
     97static void readoutFree(pmReadout *readout)
    9398{
    9499    if (readout != NULL) {
    95100        psFree(readout->image);
    96101        psFree(readout->mask);
    97         psFree(readout->objects);
    98         psFree(readout->metadata);
    99     }
    100 }
    101 
    102 /*
    103 static void observatoryFree(psObservatory* obs)
    104 {
    105     if (obs != NULL) {
    106         psFree(obs->name);
    107     }
    108 }
    109 */
    110 /*
    111 static void exposureFree(psExposure* exp)
    112 {
    113     if (exp != NULL) {
    114         psFree(exp->time);
    115         psFree(exp->observatory);
    116         psFree(exp->cameraName);
    117         psFree(exp->telescopeName);
    118     }
    119 }
    120 */
    121 /*
    122 static void fixedPatternFree(psFixedPattern* fp)
    123 {
    124     if (fp != NULL) {
    125         for (psS32 i = 0; i < fp->p_ps_xRows; i++) {
    126             psFree(fp->x[i]);
    127         }
    128  
    129         for (psS32 j = 0; j < fp->p_ps_yRows; j++) {
    130             psFree(fp->y[j]);
    131         }
    132  
    133         psFree(fp->x);
    134         psFree(fp->y);
    135     }
    136 }
    137 */
     102        psFree(readout->analysis);
     103        psFree(readout->concepts);
     104        psFree(readout->parent);
     105    }
     106}
     107
     108
     109pmReadout *pmReadoutAlloc(pmCell *cell)
     110{
     111    pmReadout *tmpReadout = (pmReadout *) psAlloc(sizeof(pmReadout));
     112
     113    tmpReadout->col0 = -1;
     114    tmpReadout->row0 = -1;
     115    tmpReadout->colBins = -1;
     116    tmpReadout->rowBins = -1;
     117    tmpReadout->image = NULL;
     118    tmpReadout->mask = NULL;
     119    tmpReadout->analysis = psMetadataAlloc();
     120    tmpReadout->concepts = psMetadataAlloc();
     121    tmpReadout->parent = cell;
     122
     123    if (cell != NULL) {
     124        cell->readouts = psArrayAdd(cell->readouts, 1, (psPtr) tmpReadout);
     125    }
     126    psMemSetDeallocator(tmpReadout, (psFreeFunc) readoutFree);
     127    return(tmpReadout);
     128}
     129
     130pmCell *pmCellAlloc(pmChip *chip)
     131{
     132    pmCell *tmpCell = (pmCell *) psAlloc(sizeof(pmCell));
     133
     134    tmpCell->col0 = -1;
     135    tmpCell->row0 = -1;
     136    tmpCell->toChip = NULL;
     137    tmpCell->toFPA = NULL;
     138    tmpCell->toSky = NULL;
     139    tmpCell->analysis = psMetadataAlloc();
     140    tmpCell->concepts = psMetadataAlloc();
     141    tmpCell->readouts = psArrayAlloc(0);
     142    tmpCell->parent = chip;
     143    if (chip != NULL) {
     144        chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell);
     145    }
     146    tmpCell->valid = false;
     147    tmpCell->extname = NULL;
     148    tmpCell->pixels = NULL;
     149    tmpCell->header = NULL;
     150
     151    psMemSetDeallocator(tmpCell, (psFreeFunc) cellFree);
     152    return(tmpCell);
     153}
     154
     155pmChip *pmChipAlloc(pmFPA *fpa)
     156{
     157    pmChip *tmpChip = (pmChip *) psAlloc(sizeof(pmChip));
     158
     159    tmpChip->col0 = -1;
     160    tmpChip->row0 = -1;
     161    tmpChip->toFPA = NULL;
     162    tmpChip->fromFPA = NULL;
     163    tmpChip->concepts = psMetadataAlloc();
     164    tmpChip->analysis = psMetadataAlloc();
     165    tmpChip->cells = psArrayAlloc(0);
     166    tmpChip->parent = fpa;
     167    if (fpa != NULL) {
     168        fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip);
     169    }
     170    tmpChip->valid = false;
     171    tmpChip->extname = NULL;
     172    tmpChip->pixels = NULL;
     173    tmpChip->header = NULL;
     174
     175    psMemSetDeallocator(tmpChip, (psFreeFunc) chipFree);
     176    return(tmpChip);
     177}
     178
     179pmFPA *pmFPAAlloc(
     180    const psMetadata *camera,
     181    psDB *db)
     182{
     183    pmFPA *tmpFPA = (pmFPA *) psAlloc(sizeof(pmFPA));
     184
     185    tmpFPA->fromTangentPlane = NULL;
     186    tmpFPA->toTangentPlane = NULL;
     187    tmpFPA->projection = NULL;
     188    tmpFPA->concepts = psMetadataAlloc();
     189    tmpFPA->analysis = psMetadataAlloc();
     190    tmpFPA->camera = camera;
     191    tmpFPA->chips = psArrayAlloc(0);
     192    tmpFPA->header = NULL;
     193    tmpFPA->db = db;
     194
     195    psMemSetDeallocator(tmpFPA, (psFreeFunc) FPAFree);
     196    return(tmpFPA);
     197}
     198
     199bool cellCheckParents(pmCell *cell)
     200{
     201    if (cell == NULL) {
     202        return(true);
     203    }
     204    psBool flag = true;
     205
     206    for (psS32 i = 0 ; i < cell->readouts->n ; i++) {
     207        pmReadout *tmpReadout = (pmReadout *) cell->readouts->data[i];
     208        PS_ASSERT_PTR_NON_NULL(tmpReadout, false);
     209        if (tmpReadout->parent != cell) {
     210            tmpReadout->parent = cell;
     211            flag = false;
     212        }
     213    }
     214    return(flag);
     215}
     216
     217bool chipCheckParents(pmChip *chip)
     218{
     219    if (chip == NULL) {
     220        return(true);
     221    }
     222    psBool flag = true;
     223
     224    for (psS32 i = 0 ; i < chip->cells->n ; i++) {
     225        pmCell *tmpCell = (pmCell *) chip->cells->data[i];
     226        PS_ASSERT_PTR_NON_NULL(tmpCell, false);
     227        if (tmpCell->parent != chip) {
     228            tmpCell->parent = chip;
     229            flag = false;
     230        }
     231
     232        flag &= cellCheckParents(tmpCell);
     233    }
     234    return(flag);
     235}
     236
     237bool pmFPACheckParents(pmFPA *fpa)
     238{
     239    if (fpa == NULL) {
     240        return(true);
     241    }
     242    psBool flag = true;
     243
     244    for (psS32 i = 0 ; i < fpa->chips->n ; i++) {
     245        pmChip *tmpChip = (pmChip *) fpa->chips->data[i];
     246        PS_ASSERT_PTR_NON_NULL(tmpChip, false);
     247        if (tmpChip->parent != fpa) {
     248            tmpChip->parent = fpa;
     249            flag = false;
     250        }
     251
     252        flag &= chipCheckParents(tmpChip);
     253    }
     254    return(flag);
     255}
     256
     257
     258
     259// HEY
    138260/*****************************************************************************/
    139261/* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    140262/*****************************************************************************/
    141263
    142 /*
    143  * XXX: Verify that you interpreted the SDR correctly.
    144  *
    145  * XXX: This assumes that x,y must be of type F64
    146  */
    147 /*
    148 psFixedPattern* psFixedPatternAlloc(double x0,
    149                                    double y0,
    150                                    double xScale,
    151                                    double yScale,
    152                                    const psImage *x,
    153                                    const psImage *y)
    154 {
    155    psFixedPattern *tmp;
    156    psS32 i;
    157    psS32 j;
    158  
    159    PS_ASSERT_IMAGE_NON_NULL(x, NULL);
    160    PS_ASSERT_IMAGE_NON_NULL(y, NULL);
    161    PS_ASSERT_IMAGE_TYPE(x, PS_TYPE_F64, NULL);
    162    PS_ASSERT_IMAGE_TYPE(y, PS_TYPE_F64, NULL);
    163  
    164    tmp = (psFixedPattern *) psAlloc(sizeof(psFixedPattern));
    165    // XXX: Is this correct?
    166    tmp->nX = (x->numCols * x->numRows);
    167    tmp->nY = (y->numCols * y->numRows);
    168    tmp->x0 = x0;
    169    tmp->y0 = y0;
    170    tmp->xScale = xScale;
    171    tmp->yScale = yScale;
    172    tmp->p_ps_xRows = x->numRows;
    173    tmp->p_ps_xCols = x->numCols;
    174    tmp->p_ps_yRows = y->numRows;
    175    tmp->p_ps_yCols = y->numCols;
    176    tmp->x = (double **) psAlloc(x->numRows * sizeof(double *));
    177    for (i=0;i<x->numRows;i++) {
    178        (tmp->x)[i] = (double *) psAlloc(x->numCols * sizeof(double));
    179    }
    180    for (i=0;i<x->numRows;i++) {
    181        for (j=0;j<x->numCols;j++) {
    182            (tmp->x)[i][j] = x->data.F64[i][j];
    183        }
    184    }
    185  
    186    tmp->y = (double **) psAlloc(y->numRows * sizeof(double *));
    187    for (i=0;i<y->numRows;i++) {
    188        (tmp->y)[i] = (double *) psAlloc(y->numCols * sizeof(double));
    189    }
    190    for (i=0;i<y->numRows;i++) {
    191        for (j=0;j<y->numCols;j++) {
    192            (tmp->y)[i][j] = y->data.F64[i][j];
    193        }
    194    }
    195  
    196    psMemSetDeallocator(tmp,(psFreeFunc)fixedPatternFree);
    197  
    198    return(tmp);
    199 }
    200 */
    201 /*
    202 psExposure* psExposureAlloc(double ra,
    203                             double dec,
    204                             double hourAngle,
    205                             double zenithDistance,
    206                             double azimuth,
    207                             const psTime* time,
    208                             float rotAngle,
    209                             float temperature,
    210                             float pressure,
    211                             float humidity,
    212                             float exposureTime,
    213                             float wavelength,
    214                             const psObservatory* observatory)
    215 {
    216     PS_ASSERT_PTR_NON_NULL(observatory, NULL);
    217  
    218     psExposure* exp = psAlloc(sizeof(psExposure));
    219     *(double *)&exp->ra = ra;
    220     *(double *)&exp->dec = dec;
    221     *(double *)&exp->hourAngle = hourAngle;
    222     *(double *)&exp->zenithDistance = zenithDistance;
    223     *(double *)&exp->azimuth = azimuth;
    224     *(float *)&exp->rotAngle = rotAngle;
    225     *(float *)&exp->temperature = temperature;
    226     *(float *)&exp->pressure = pressure;
    227     *(float *)&exp->humidity = humidity;
    228     *(float *)&exp->exposureTime = exposureTime;
    229     *(float *)&exp->wavelength = wavelength;
    230  
    231     exp->time = psMemIncrRefCounter((psPtr)time);
    232     exp->observatory = psMemIncrRefCounter((psPtr)observatory);
    233  
    234     // XXX: how is this value derived?
    235     *(double *)&exp->lst = psTimeToLMST((psTime*)time,observatory->longitude);
    236     *(float *)&exp->positionAngle = 0.0f; // XXX: need input, see Bug #207
    237     *(float *)&exp->parallacticAngle = 0.0f; // XXX: need input, see Bug #207
    238     *(float *)&exp->airmass = 0.0f; // XXX: needs calculation!  = slaAirmas(zenithDistance);
    239     *(float *)&exp->parallacticFactor = 0.0f;
    240     exp->cameraName = NULL;
    241     exp->telescopeName = NULL;
    242  
    243     psMemSetDeallocator(exp,(psFreeFunc)exposureFree);
    244  
    245     return exp;
    246 }
    247 */
    248 /*
    249 psObservatory* psObservatoryAlloc(const char* name,
    250                                   double latitude,
    251                                   double longitude,
    252                                   double height,
    253                                   double tlr)
    254 {
    255     psObservatory* obs = psAlloc(sizeof(psObservatory));
    256  
    257     if (name == NULL) {
    258         obs->name = NULL;
    259     } else {
    260         obs->name = psAlloc(strlen(name)+1);
    261         strcpy((char*)obs->name, name);
    262     }
    263  
    264     *(double *)&obs->latitude = latitude;
    265     *(double *)&obs->longitude = longitude;
    266     *(double *)&obs->height = height;
    267     *(double *)&obs->tlr = tlr;
    268  
    269     psMemSetDeallocator(obs,(psFreeFunc)observatoryFree);
    270  
    271     return obs;
    272 }
    273 */
    274 /*
    275 psFPA* psFPAAlloc(psS32 nChips,
    276                   const psExposure* exp)
    277 {
    278     PS_ASSERT_INT_NONNEGATIVE(nChips, NULL);
    279  
    280     psFPA* newFPA = psAlloc(sizeof(psFPA));
    281  
    282     // create array of NULL chips of the size nChips
    283     newFPA->chips = psArrayAlloc(nChips);
    284     psPtr* chips = newFPA->chips->data;
    285     for (psS32 i=0;i<nChips;i++) {
    286         chips[i] = NULL;
    287     }
    288     newFPA->chips->n = 0; // per requirement
    289  
    290     newFPA->metadata = NULL;
    291     newFPA->fromTangentPlane = NULL;
    292     newFPA->toTangentPlane = NULL;
    293     newFPA->pattern = NULL;
    294  
    295     if (exp != NULL) {
    296         newFPA->exposure = psMemIncrRefCounter((psExposure*)exp);
    297         newFPA->grommit = psGrommitAlloc(exp);
    298     } else {
    299         newFPA->exposure = NULL;
    300         newFPA->grommit = NULL;
    301     }
    302  
    303     newFPA->colorPlus = NULL;
    304     newFPA->colorMinus = NULL;
    305     newFPA->projection = NULL;
    306  
    307     newFPA->rmsX = 0.0f;
    308     newFPA->rmsY = 0.0f;
    309     newFPA->chi2 = 0.0f;
    310  
    311     psMemSetDeallocator(newFPA,(psFreeFunc)FPAFree);
    312  
    313     return newFPA;
    314 }
    315 */
    316 /*
    317  * psChip constructor
    318  */
    319 /*
    320 psChip* psChipAlloc(psS32 nCells,
    321                     psFPA *parentFPA)
    322 {
    323     PS_ASSERT_INT_NONNEGATIVE(nCells, NULL);
    324  
    325     psChip* chip = psAlloc(sizeof(psChip));
    326  
    327     // create array of NULL psCells
    328     int n = (nCells > 0) ? nCells : 1;
    329     chip->cells = psArrayAlloc(n);
    330     psPtr* cells = chip->cells->data;
    331     for (psS32 i=0;i<n;i++) {
    332         cells[i] = NULL;
    333     }
    334     chip->cells->n = 0; // per requirement
    335  
    336     *(int*)&chip->row0 = 0;
    337     *(int*)&chip->col0 = 0;
    338  
    339     chip->metadata = NULL;
    340  
    341     chip->toFPA = NULL;
    342     chip->fromFPA = NULL;
    343  
    344     chip->parent = parentFPA;
    345  
    346     psMemSetDeallocator(chip,(psFreeFunc)chipFree);
    347  
    348     return chip;
    349  
    350 }
    351 */
    352 /*
    353  * psCell constructor
    354  */
    355 /*
    356 psCell* psCellAlloc(psS32 nReadouts,
    357                     psChip* parentChip)
    358 {
    359     PS_ASSERT_INT_NONNEGATIVE(nReadouts, NULL);
    360  
    361     psCell* cell = psAlloc(sizeof(psCell));
    362  
    363     // create array of NULL psReadouts
    364     int n = (nReadouts > 0) ? nReadouts : 1;
    365     cell->readouts = psArrayAlloc(n);
    366     psPtr* readouts = cell->readouts->data;
    367     for (psS32 i=0;i<n;i++) {
    368         readouts[i] = NULL;
    369     }
    370     cell->readouts->n = 0; // per requirement
    371  
    372     *(int*)&cell->row0 = 0;
    373     *(int*)&cell->col0 = 0;
    374  
    375     cell->metadata = NULL;
    376  
    377     cell->toChip = NULL;
    378     cell->fromChip = NULL;
    379     cell->toFPA = NULL;
    380     cell->toTP = NULL;
    381     cell->toSky = NULL;
    382  
    383     cell->parent = parentChip;
    384  
    385     psMemSetDeallocator(cell,(psFreeFunc)cellFree);
    386  
    387     return cell;
    388  
    389  
    390 }
    391 */
    392 
    393 psReadout *pmReadoutAlloc(pmCell *cell)
    394 {
    395     psReadout* readout = psAlloc(sizeof(psReadout));
    396 
    397     *(psU32*)&readout->colBins = 1;
    398     *(psU32*)&readout->rowBins = 1;
    399     *(psU32*)&readout->rowParity = 0;
    400     *(psU32*)&readout->colParity = 0;
    401     *(psS32*)&readout->col0 = 0;
    402     *(psS32*)&readout->row0 = 0;
    403 
    404     readout->image = NULL;
    405     readout->mask = NULL;
    406     readout->objects = NULL;
    407     readout->metadata = NULL;
    408 
    409     psMemSetDeallocator(readout,(psFreeFunc)readoutFree);
    410 
    411     return readout;
    412 }
    413 
    414 /*
    415 psGrommit* psGrommitAlloc(const psExposure* exp)
    416 {
    417     PS_ASSERT_PTR_NON_NULL(exp, NULL);
    418  
    419     psSphere* polarMotion = p_psTimeGetPoleCoords(exp->time);
    420  
    421     psGrommit* grommit = (psGrommit* ) psAlloc(sizeof(psGrommit));
    422  
    423     *(double*)&grommit->latitude = exp->observatory->latitude;
    424     *(double*)&grommit->longitude = exp->observatory->longitude;
    425     *(double*)&grommit->height = exp->observatory->height;
    426     *(double*)&grommit->abberationMag = 0.0; // XXX: need to figure out what to set here.
    427     *(double*)&grommit->temperature = exp->temperature;
    428     *(double*)&grommit->pressure = exp->pressure;
    429     *(double*)&grommit->humidity = exp->humidity;
    430     *(double*)&grommit->wavelength = exp->wavelength;
    431     *(double*)&grommit->lapseRate = exp->observatory->tlr;
    432     *(double*)&grommit->refractA = polarMotion->r; // XXX: need to figure out what to set here too.
    433     *(double*)&grommit->refractB = polarMotion->d; // XXX: need to figure out what to set here too.
    434     *(double*)&grommit->siderealTime = psTimeToMJD(exp->time); // XXX: this is probably not correct
    435  
    436     psFree(polarMotion);
    437  
    438     return (grommit);
    439 }
    440 */
    441 /*
    442 psCell* psCellInFPA(const psPlane* fpaCoord,
    443                     const psFPA* FPA)
     264pmCell* pmCellInFPA(const psPlane* fpaCoord,
     265                    const pmFPA* FPA)
    444266{
    445267    PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);
    446268    PS_ASSERT_PTR_NON_NULL(FPA, NULL);
    447  
    448     psChip* tmpChip = NULL;
     269
     270    pmChip* tmpChip = NULL;
    449271    psPlane chipCoord;
    450     psCell* outCell = NULL;
    451  
     272    pmCell* outCell = NULL;
     273
    452274    // Determine which chip contains the fpaCoords.
    453     tmpChip = psChipInFPA(fpaCoord, FPA);
     275    tmpChip = pmChipInFPA(fpaCoord, FPA);
    454276    if (tmpChip == NULL) {
    455277        return(NULL);
    456278    }
    457  
     279
    458280    // Convert to those chip coordinates.
    459281    psCoordFPAToChip(&chipCoord, fpaCoord, tmpChip);
    460  
     282
    461283    // Determine which cell contains those chip coordinates.
    462     outCell = psCellInChip(&chipCoord, tmpChip);
    463  
     284    outCell = pmCellInChip(&chipCoord, tmpChip);
     285
    464286    return (outCell);
    465287}
    466 */
    467 /*
    468 psChip* psChipInFPA(const psPlane* fpaCoord,
    469                     const psFPA* FPA)
     288
     289pmChip* pmChipInFPA(const psPlane* fpaCoord,
     290                    const pmFPA* FPA)
    470291{
    471292    PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);
    472293    PS_ASSERT_PTR_NON_NULL(FPA, NULL);
    473294    PS_ASSERT_PTR_NON_NULL(FPA->chips, NULL);
    474  
     295
    475296    psArray* chips = FPA->chips;
    476297    psS32 nChips = chips->n;
    477298    psPlane chipCoord;
    478     psCell *tmpCell = NULL;
    479  
     299    pmCell *tmpCell = NULL;
     300
    480301    // Loop through every chip in this FPA.  Convert the original FPA
    481302    // coordinates to chip coordinates for that chip.  Then, determine if any
    482303    // cells in that chip contain those chip coordinates.
    483  
     304
    484305    for (psS32 i = 0; i < nChips; i++) {
    485         psChip* tmpChip = chips->data[i];
     306        pmChip* tmpChip = chips->data[i];
    486307        PS_ASSERT_PTR_NON_NULL(tmpChip, NULL);
    487308        PS_ASSERT_PTR_NON_NULL(tmpChip->fromFPA, NULL);
    488  
     309
    489310        psPlaneTransformApply(&chipCoord, tmpChip->fromFPA, fpaCoord);
    490  
    491         tmpCell = psCellInChip(&chipCoord, tmpChip);
     311
     312        tmpCell = pmCellInChip(&chipCoord, tmpChip);
    492313        if (tmpCell != NULL) {
    493314            return(tmpChip);
    494315        }
    495316    }
    496  
     317
    497318    // XXX: Print warning here?
    498319    return (NULL);
    499320}
    500 */
    501 /*
    502 psCell* psCellInChip(const psPlane* chipCoord,
    503                      const psChip* chip)
     321
     322
     323pmCell* pmCellInChip(const psPlane* chipCoord,
     324                     const pmChip* chip)
    504325{
    505326    PS_ASSERT_PTR_NON_NULL(chipCoord, NULL);
    506327    PS_ASSERT_PTR_NON_NULL(chip, NULL);
    507  
     328
    508329    psPlane cellCoord;
    509330    psArray* cells;
    510  
     331
    511332    cells = chip->cells;
    512333    if (cells == NULL) {
    513334        return NULL;
    514335    }
    515  
     336
    516337    // We loop over each cell in the chip.  We transform the chipCoord into
    517338    // a cellCoord for that cell and determine if that cellCoord is valid.
    518339    // If so, then we return that cell.
    519  
     340
    520341    for (psS32 i = 0; i < cells->n; i++) {
    521         psCell* tmpCell = (psCell* ) cells->data[i];
     342        pmCell* tmpCell = (pmCell* ) cells->data[i];
    522343        PS_ASSERT_PTR_NON_NULL(tmpCell, NULL);
    523         PS_ASSERT_PTR_NON_NULL(tmpCell->fromChip, NULL);
     344
     345        psPlaneTransform *chipToCell = NULL;
     346        if (1 != p_psIsProjectionLinear(tmpCell->toChip)) {
     347            // XXX: Generate warning message.
     348            // XXX: Can we use the following function to derive a transform?
     349            // chipToCell = psPlaneTransformInvert(NULL, tmpCell->toChip, NULL, -1);
     350        } else {
     351            chipToCell = p_psPlaneTransformLinearInvert(tmpCell->toChip);
     352        }
     353
     354        PS_ASSERT_PTR_NON_NULL(chipToCell, NULL);
    524355        psArray* readouts = tmpCell->readouts;
    525  
     356
    526357        if (readouts != NULL) {
    527358            for (psS32 j = 0; j < readouts->n; j++) {
    528                 psReadout* tmpReadout = readouts->data[j];
     359                pmReadout* tmpReadout = readouts->data[j];
    529360                PS_ASSERT_READOUT_NON_NULL(tmpReadout, NULL);
    530  
     361
    531362                psPlaneTransformApply(&cellCoord,
    532                                       tmpCell->fromChip,
     363                                      chipToCell,
    533364                                      chipCoord);
    534  
     365
    535366                if (checkValidImageCoords(cellCoord.x,
    536367                                          cellCoord.y,
     
    540371            }
    541372        }
    542     }
    543  
     373        psFree(chipToCell);
     374    }
     375
    544376    return (NULL);
    545377}
    546 */
    547 /*
     378
     379
    548380psPlane* psCoordCellToChip(psPlane* outCoord,
    549381                           const psPlane* inCoord,
    550                            const psCell* cell)
     382                           const pmCell* cell)
    551383{
    552384    PS_ASSERT_PTR_NON_NULL(inCoord, NULL);
    553385    PS_ASSERT_PTR_NON_NULL(cell, NULL);
    554  
     386
    555387    return (psPlaneTransformApply(outCoord, cell->toChip, inCoord));
    556388}
    557 */
    558 /*
     389
     390
    559391psPlane* psCoordChipToFPA(psPlane* outCoord,
    560392                          const psPlane* inCoord,
    561                           const psChip* chip)
     393                          const pmChip* chip)
    562394{
    563395    PS_ASSERT_PTR_NON_NULL(inCoord, NULL);
    564396    PS_ASSERT_PTR_NON_NULL(chip, NULL);
    565  
     397
    566398    return (psPlaneTransformApply(outCoord, chip->toFPA, inCoord));
    567399}
    568 */
    569 /*
     400
     401
     402
    570403psPlane* psCoordFPAToTP(psPlane* outCoord,
    571404                        const psPlane* inCoord,
    572405                        double color,
    573406                        double magnitude,
    574                         const psFPA* fpa)
     407                        const pmFPA* fpa)
    575408{
    576409    PS_ASSERT_PTR_NON_NULL(inCoord, NULL);
    577410    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
    578  
     411
    579412    return(psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord,
    580413                               color, magnitude));
    581414}
    582 */
     415
    583416/*****************************************************************************
    584417XXX: What about units for the (x,y) coords?
    585418 *****************************************************************************/
    586 /*
    587419psSphere* psCoordTPToSky(psSphere* outSphere,
    588420                         const psPlane* tpCoord,
    589                          const psGrommit* grommit)
     421                         const psProjection *projection
     422                        )
    590423{
    591424    PS_ASSERT_PTR_NON_NULL(tpCoord, NULL);
    592     PS_ASSERT_PTR_NON_NULL(grommit, NULL);
    593  
     425
    594426    if (outSphere == NULL) {
    595427        outSphere = (psSphere* ) psAlloc(sizeof(psSphere));
    596428    }
    597  
     429
    598430    // XXX: this was done by a SLALIB call -- needs to be reimplemented
    599431    psWarning("Warning!  psCoordTPToSky functionality is no longer implemented");
    600432    // slaAopqk(tpCoord->x, tpCoord->y, (double*)grommit,
    601433    //         &AOB, &ZOB, &HOB, &outSphere->r, &outSphere->d);
    602  
     434
    603435    return (outSphere);
    604436}
    605 */
    606 /*
     437
     438
     439
    607440psPlane* psCoordCellToFPA(psPlane* fpaCoord,
    608441                          const psPlane* cellCoord,
    609                           const psCell* cell)
     442                          const pmCell* cell)
    610443{
    611444    PS_ASSERT_PTR_NON_NULL(cellCoord, NULL);
    612445    PS_ASSERT_PTR_NON_NULL(cell, NULL);
    613  
     446
    614447    return (psPlaneTransformApply(fpaCoord, cell->toFPA, cellCoord));
    615448}
    616 */
    617 /*
     449
     450
     451
    618452psSphere* psCoordCellToSky(psSphere* skyCoord,
    619453                           const psPlane* cellCoord,
    620454                           double color,
    621455                           double magnitude,
    622                            const psCell* cell)
     456                           const pmCell* cell)
    623457{
    624458    PS_ASSERT_PTR_NON_NULL(cellCoord, NULL);
     
    628462    PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL);
    629463    PS_ASSERT_PTR_NON_NULL(cell->parent->parent->toTangentPlane, NULL);
    630     PS_ASSERT_PTR_NON_NULL(cell->parent->parent->exposure, NULL);
    631  
     464    //    PS_ASSERT_PTR_NON_NULL(cell->parent->parent->exposure, NULL);
     465
    632466    psPlane* fpaCoord = NULL;
    633467    psPlane* tpCoord = NULL;
    634     psFPA* parFPA = (cell->parent)->parent;
    635     psGrommit* tmpGrommit = NULL;
    636  
     468    pmFPA* parFPA = (cell->parent)->parent;
     469    //    psGrommit* tmpGrommit = NULL;
     470
    637471    // Convert the input cell coordinates to FPA coordinates.
    638472    fpaCoord = psPlaneTransformApply(fpaCoord, cell->toFPA, cellCoord);
    639  
     473
    640474    // Convert the FPA coordinates to tangent plane Coordinates.
    641475    tpCoord = psPlaneDistortApply(tpCoord, parFPA->toTangentPlane,
    642476                                  fpaCoord, color, magnitude);
    643  
     477
    644478    // Generate a grommit for this FPA.
    645     tmpGrommit = psGrommitAlloc(parFPA->exposure);
    646  
     479    //    tmpGrommit = psGrommitAlloc(parFPA->exposure);
     480
    647481    // Convert the tangent plane Coordinates to sky coordinates.
    648     skyCoord = psCoordTPToSky(skyCoord, tpCoord, tmpGrommit);
    649  
     482    //    skyCoord = psCoordTPToSky(skyCoord, tpCoord, tmpGrommit);
     483
    650484    psFree(fpaCoord);
    651485    psFree(tpCoord);
    652     psFree(tmpGrommit);
    653  
     486    //    psFree(tmpGrommit);
     487
    654488    return(skyCoord);
    655489}
    656  
    657 */
    658 /*
     490
     491
    659492psSphere* psCoordCellToSkyQuick(psSphere* outSphere,
    660493                                const psPlane* cellCoord,
    661                                 const psCell* cell)
     494                                const pmCell* cell)
    662495{
    663496    PS_ASSERT_PTR_NON_NULL(cellCoord, NULL);
     
    667500    PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL);
    668501    PS_ASSERT_PTR_NON_NULL(cell->parent->parent->projection, NULL);
    669     if (cell->toSky) {
    670         // XXX: Should we use toTP or toSky?
    671         psLogMsg(__func__, PS_LOG_WARN,
    672                  "WARNING: psCoordCellToSkyQuick(): The cell->toSky transform is ignored.  The cell->toTP transform is being used.");
    673     }
    674  
    675     psPlane *tpCoord = NULL;
    676     psChip *chip = cell->parent;
    677     psFPA *FPA = chip->parent;
    678     psProjectionType oldProjectionType;
    679  
    680     if (outSphere == NULL) {
    681         outSphere = (psSphere* ) psAlloc(sizeof(psSphere));
    682     }
    683  
    684     // Determine the tangent plane coordinates.
    685     tpCoord = psPlaneTransformApply(NULL, cell->toTP, cellCoord);
    686  
    687     // Save the old projection type and set the new projection type to TAN.
    688     oldProjectionType = FPA->projection->type;
    689     FPA->projection->type = PS_PROJ_TAN;
    690  
    691     // Deproject the tangent plane coordinates a sphere.
    692     outSphere = psDeproject(tpCoord, FPA->projection);
    693  
    694     // Restore old projection type.  Free memory.
    695     FPA->projection->type = oldProjectionType;
    696     psFree(tpCoord);
    697  
    698     return (outSphere);
    699 }
    700 */
     502
     503    psLogMsg(__func__, PS_LOG_WARN,
     504             "WARNING: psCoordCellToSkyQuick(): This function is not fully specified in the SDRS.  Returning NULL.\n");
     505    return(NULL);
     506
     507    /*
     508        if (cell->toSky) {
     509            // XXX: Should we use toTP or toSky?
     510            psLogMsg(__func__, PS_LOG_WARN,
     511                     "WARNING: psCoordCellToSkyQuick(): The cell->toSky transform is ignored.  The cell->toTP transform is being used.");
     512        }
     513     
     514        psPlane *tpCoord = NULL;
     515        pmChip *chip = cell->parent;
     516        pmFPA *FPA = chip->parent;
     517        psProjectionType oldProjectionType;
     518     
     519        if (outSphere == NULL) {
     520            outSphere = (psSphere* ) psAlloc(sizeof(psSphere));
     521        }
     522     
     523        // Determine the tangent plane coordinates.
     524        tpCoord = psPlaneTransformApply(NULL, cell->toTP, cellCoord);
     525     
     526        // Save the old projection type and set the new projection type to TAN.
     527        oldProjectionType = FPA->projection->type;
     528        FPA->projection->type = PS_PROJ_TAN;
     529     
     530        // Deproject the tangent plane coordinates a sphere.
     531        outSphere = psDeproject(tpCoord, FPA->projection);
     532     
     533        // Restore old projection type.  Free memory.
     534        FPA->projection->type = oldProjectionType;
     535        psFree(tpCoord);
     536     
     537        return (outSphere);
     538    */
     539}
     540
    701541
    702542/*****************************************************************************
    703543XXX: What about units for the (x,y) coords?
    704544 *****************************************************************************/
    705 /*
    706545psPlane* psCoordSkyToTP(psPlane* tpCoord,
    707546                        const psSphere* in,
    708                         const psGrommit* grommit)
     547                        const psProjection *projection)
    709548{
    710549    PS_ASSERT_PTR_NON_NULL(in, NULL);
    711     PS_ASSERT_PTR_NON_NULL(grommit, NULL);
    712  
     550    //    PS_ASSERT_PTR_NON_NULL(grommit, NULL);
     551
    713552    // char* type = "RA";
    714  
     553
    715554    if (tpCoord == NULL) {
    716555        tpCoord = (psPlane* ) psAlloc(sizeof(psPlane));
    717556    }
    718  
     557
    719558    // XXX: this was done by a SLALIB call -- needs to be reimplemented
    720559    psWarning("Warning!  psCoordSkyToTP functionality is no longer implemented");
    721560    // slaOapqk(type, in->r, in->d, (double*)grommit, &tpCoord->x, &tpCoord->y);
    722  
     561
    723562    return(tpCoord);
    724563}
    725 */
    726 /*
     564
     565
    727566psPlane* psCoordTPToFPA(psPlane* fpaCoord,
    728567                        const psPlane* tpCoord,
    729568                        double color,
    730569                        double magnitude,
    731                         const psFPA* fpa)
     570                        const pmFPA* fpa)
    732571{
    733572    PS_ASSERT_PTR_NON_NULL(tpCoord, NULL);
    734573    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
    735574    PS_ASSERT_PTR_NON_NULL(fpa->fromTangentPlane, NULL);
    736  
     575
    737576    return (psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane,
    738577                                tpCoord, color, magnitude));
    739578}
    740 */
    741 /*
     579
     580
    742581psPlane* psCoordFPAToChip(psPlane* chipCoord,
    743582                          const psPlane* fpaCoord,
    744                           const psChip* chip)
     583                          const pmChip* chip)
    745584{
    746585    PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);
    747586    PS_ASSERT_PTR_NON_NULL(chip, NULL);
    748587    PS_ASSERT_PTR_NON_NULL(chip->fromFPA, NULL);
    749  
     588
    750589    chipCoord = psPlaneTransformApply(chipCoord, chip->fromFPA, fpaCoord);
    751590    return(chipCoord);
    752591}
    753 */
    754 /*
     592
     593
    755594psPlane* psCoordChipToCell(psPlane* cellCoord,
    756595                           const psPlane* chipCoord,
    757                            const psCell* cell)
     596                           const pmCell* cell)
    758597{
    759598    PS_ASSERT_PTR_NON_NULL(chipCoord, NULL);
    760599    PS_ASSERT_PTR_NON_NULL(cell, NULL);
    761     PS_ASSERT_PTR_NON_NULL(cell->fromChip, NULL);
    762  
    763     cellCoord = psPlaneTransformApply(cellCoord, cell->fromChip, chipCoord);
     600    PS_ASSERT_PTR_NON_NULL(cell->parent, NULL);
     601
     602    pmCell *tmpCell = pmCellInChip(chipCoord, cell->parent);
     603    PS_ASSERT_PTR_NON_NULL(tmpCell->toChip, NULL);
     604    psPlaneTransform *tmpChipToCell = p_psPlaneTransformLinearInvert(tmpCell->toChip);
     605    PS_ASSERT_PTR_NON_NULL(tmpChipToCell, NULL);
     606    cellCoord = psPlaneTransformApply(cellCoord, tmpChipToCell, chipCoord);
     607    psFree(tmpChipToCell);
    764608    return(cellCoord);
    765609}
    766 */
    767 /*
     610
     611
    768612psPlane* psCoordSkyToCell(psPlane* cellCoord,
    769613                          const psSphere* skyCoord,
    770                           double color,
    771                           double magnitude,
    772                           const psCell* cell)
     614                          float color,
     615                          float magnitude,
     616                          const pmCell* cell)
    773617{
    774618    PS_ASSERT_PTR_NON_NULL(skyCoord, NULL);
     
    776620    PS_ASSERT_PTR_NON_NULL(cell->parent, NULL);
    777621    PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL);
    778     PS_ASSERT_PTR_NON_NULL(cell->parent->parent->grommit, NULL);
    779  
    780     psChip *parChip = cell->parent;
    781     psFPA *parFPA = parChip->parent;
    782     psGrommit* grommit = parFPA->grommit;
    783  
     622    //    PS_ASSERT_PTR_NON_NULL(cell->parent->parent->grommit, NULL);
     623
     624    pmChip *parChip = cell->parent;
     625    pmFPA *parFPA = parChip->parent;
     626
    784627    // Convert the skyCoords to tangent plane coords.
    785     psPlane *tpCoord = psCoordSkyToTP(tpCoord, skyCoord, grommit);
    786  
     628    psPlane *tpCoord = psCoordSkyToTP(NULL, skyCoord, parFPA->projection);
     629
    787630    // Convert the tangent plane coords to FPA coords.
    788     psPlane *fpaCoord = psCoordTPToFPA(fpaCoord, tpCoord, color,
    789                                        magnitude, parFPA);
    790  
     631    psPlane *fpaCoord = psCoordTPToFPA(NULL, tpCoord, color, magnitude, parFPA);
     632
    791633    // Convert the FPA coords to chip coords.
    792     psPlane *chipCoord = psCoordFPAToChip(chipCoord, fpaCoord, parChip);
    793  
     634    psPlane *chipCoord = psCoordFPAToChip(NULL, fpaCoord, parChip);
     635
    794636    // Convert the chip coords to cell coords.
    795637    cellCoord = psCoordChipToCell(cellCoord, chipCoord, cell);
    796  
     638
    797639    psFree(tpCoord);
    798640    psFree(fpaCoord);
    799641    psFree(chipCoord);
    800  
     642
    801643    return (cellCoord);
    802644}
    803 */
    804 /*
     645
     646
    805647psPlane* psCoordSkyToCellQuick(psPlane* cellCoord,
    806648                               const psSphere* skyCoord,
    807                                const psCell* cell)
     649                               const pmCell* cell)
    808650{
    809651    PS_ASSERT_PTR_NON_NULL(skyCoord, NULL);
     
    812654    PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL);
    813655    PS_ASSERT_PTR_NON_NULL(cell->parent->parent->projection, NULL);
    814     PS_ASSERT_PTR_NON_NULL(cell->toTP, NULL);
    815     if (cell->toSky) {
    816         // XXX: Should we use toTP or toSky?
    817         psLogMsg(__func__, PS_LOG_WARN,
    818                  "WARNING: psCoordSkyToCellQuick(): The cell->toSky transform is ignored.  The cell->toTP transform is being used.");
    819     }
    820  
    821     psPlane *tpCoord = NULL;
    822     psChip *whichChip = cell->parent;
    823     psFPA *whichFPA = whichChip->parent;
    824     psProjectionType oldProjectionType;
    825     psPlaneTransform *TPtoCell = NULL;
    826  
    827     // Save the old projection type and set the new projection type to TAN.
    828     oldProjectionType = whichFPA->projection->type;
    829     whichFPA->projection->type = PS_PROJ_TAN;
    830  
    831     if (cellCoord == NULL) {
    832         cellCoord = (psPlane* ) psAlloc(sizeof(psPlane));
    833     }
    834  
    835     tpCoord = psProject(skyCoord, whichFPA->projection);
    836  
    837     // generate an error if cell->toTP is not linear.
    838     if (0 == p_psIsProjectionLinear(cell->toTP)) {
    839         psError(PS_ERR_BAD_PARAMETER_TYPE, true,
    840                 PS_ERRORTEXT_psAstrometry_NONLINEAR_TRANSFORM,
    841                 "cell to tangent plane");
    842     }
    843  
    844     TPtoCell = p_psPlaneTransformLinearInvert(cell->toTP);
    845     cellCoord = psPlaneTransformApply(cellCoord, TPtoCell, tpCoord);
    846  
    847     // Restore old projection type.  Free memory.
    848     whichFPA->projection->type = oldProjectionType;
    849     psFree(tpCoord);
    850     return (cellCoord);
    851 }
    852 */
    853 
    854 
     656
     657
     658    psLogMsg(__func__, PS_LOG_WARN,
     659             "WARNING: psCoordSkyToCellQuick(): This function is not fully specified in the SDRS.  Returning NULL.\n");
     660    return(NULL);
     661    /*
     662     
     663        if (cell->toSky) {
     664            // XXX: Should we use toTP or toSky?
     665            psLogMsg(__func__, PS_LOG_WARN,
     666                     "WARNING: psCoordSkyToCellQuick: The cell->toSky transform is ignored.  The cell->toTP transform is being used.");
     667        }
     668     
     669        psPlane *tpCoord = NULL;
     670        pmChip *whichChip = cell->parent;
     671        pmFPA  *whichFPA = whichChip->parent;
     672        psProjectionType oldProjectionType;
     673        psPlaneTransform *TPtoCell = NULL;
     674     
     675        // Save the old projection type and set the new projection type to TAN.
     676        oldProjectionType = whichFPA->projection->type;
     677        whichFPA->projection->type = PS_PROJ_TAN;
     678     
     679        if (cellCoord == NULL) {
     680            cellCoord = (psPlane* ) psAlloc(sizeof(psPlane));
     681        }
     682     
     683        tpCoord = psProject(skyCoord, whichFPA->projection);
     684     
     685        // generate an error if cell->toTP is not linear.
     686        if (0 == p_psIsProjectionLinear(cell->toTP)) {
     687            psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     688                    PS_ERRORTEXT_psAstrometry_NONLINEAR_TRANSFORM,
     689                    "cell to tangent plane");
     690        }
     691     
     692        TPtoCell = p_psPlaneTransformLinearInvert(cell->toTP);
     693        cellCoord = psPlaneTransformApply(cellCoord, TPtoCell, tpCoord);
     694     
     695        // Restore old projection type.  Free memory.
     696        whichFPA->projection->type = oldProjectionType;
     697        psFree(tpCoord);
     698        return (cellCoord);
     699    */
     700}
     701
     702
     703
  • trunk/psModules/src/pmAstrometry.h

    r4754 r4770  
    88*  @author GLG, MHPCC
    99*
    10 *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2005-08-11 00:03:51 $
     10*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2005-08-16 01:10:34 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    143143    // Information
    144144    psImage *image;                     ///< Imaging area of readout
     145    // XXX: The following mask was removed from the pmReadout struct in recent SDRS
     146    // versions.  However, I'm keeping it here since al ot of modules still require
     147    // it.
     148    psImage *mask;                      ///< Mask of input image
    145149    psMetadata *analysis;               ///< Readout-level analysis metadata
    146150    psMetadata *concepts;               ///< Cache for PS Concepts
    147151    pmCell *parent;                     ///< Parent cell
    148152}
    149 psReadout;
    150 
    151 /** Allocates a psReadout
     153pmReadout;
     154
     155
     156/** Allocates a pmReadout
    152157 *
    153158 *  The constructor shall make an empty pmReadout. If the parent cell is not
     
    156161 *  other pointers in the structure shall be initialized to NULL.
    157162 *
    158  *  @return psReadout*    newly allocated psReadout with all internal pointers set to NULL
    159  */
    160 psReadout *pmReadoutAlloc(
     163 *  @return pmReadout*    newly allocated pmReadout with all internal pointers set to NULL
     164 */
     165pmReadout *pmReadoutAlloc(
    161166    pmCell *cell                        ///< Parent cell
    162167);
    163168
    164 /** Allocates a psCell
     169/** Allocates a pmCell
    165170 *
    166171 *  The constructor shall make an empty pmCell. If the parent chip is not NULL,
    167  *  the parent link is made and the cell shall be placed in the parentThe
    168  *  constructor shall make an empty psCell.s array of cells. The readouts
    169  *  array shall be allocated with a zero size, and the metadata containers
    170  *  constructed. All other pointers in the structure shall be initialized to
    171  *  NULL.
    172  *
    173  *  @return psCell*    newly allocated psCell
     172 *  the parent link is made and the cell shall be placed in the parents array of
     173 *  cells. The readouts array shall be allocated with a zero size, and the
     174 *  metadata containers constructed. All other pointers in the structure shall be
     175 *  initialized to NULL.
     176 *
     177 *  @return pmCell*    newly allocated pmCell
    174178 */
    175179pmCell *pmCellAlloc(
     
    198202 */
    199203pmFPA *pmFPAAlloc(
    200     const psMetadata *camera           ///< Camera configuration
    201     //    psDB *db                            ///< Database handle
    202 );
    203 
     204    const psMetadata *camera,           ///< Camera configuration
     205    psDB *db                            ///< Database handle
     206);
     207
     208
     209/** Verify parent links.
     210 *
     211 *  This function checks the validity of the parent links in the FPA hierarchy.
     212 *  If a parent link is not set (or not set correctly), it is corrected, and the
     213 *  function shall return false. If all the parent pointers were correct, the
     214 *  function shall return true.
     215 *
     216 */
     217bool pmFPACheckParents(
     218    pmFPA *fpa
     219);
     220
     221
     222
     223/** FUNC DESC
     224 *
     225 *
     226 *
     227 *
     228 */
    204229
    205230
     
    211236
    212237
    213 
    214 
    215 
    216 
    217 
    218 /** Wallace's Grommit
    219  *
    220  *  SLALib requires several elements to perform the transformations between
    221  *  the tangent plane and the sky.  Pre-computing these quantities for each
    222  *  exposure means that subsequent transformations are faster.  For historical
    223  *  reasons, this structure is known colloquially as "Wallace's Grommit".
    224  *
    225  */
    226 
    227 /*
    228 typedef struct
    229 {
    230    const double latitude;           ///< geodetic latitude (radians)
    231    const double longitude;          ///< longitude + ... (radians)
    232    const double height;             ///< height (HM)
    233    const double abberationMag;      ///< magnitude of diurnal aberration vector
    234    const double temperature;        ///< ambient temperature (TDK)
    235    const double pressure;           ///< pressure (PMB)
    236    const double humidity;           ///< relative humidity (RH)
    237    const double wavelength;         ///< wavelength (WL)
    238    const double lapseRate;          ///< lapse rate (TLR)
    239    const double refractA, refractB; ///< refraction constants A and B (radians)
    240    const double siderealTime;       ///< local apparent sidereal time (radians)
    241 }
    242 psGrommit;
    243 */
    244 
    245 
    246 /** Fixed Pattern Corrections
    247  *
    248  *  The fixed pattern is a correction to the general astrometric solution
    249  *  formed by summing the residuals from many observations. The intent is to
    250  *  correct for higher-order distortions in the camera system on a coarse
    251  *  grid (larger than individual pixels, but smaller than a single cell).
    252  *  Hence, in addition to the offsets, we need to specify the size and scale
    253  *  of the grid in x and y as well as the origin of the grid.
    254  */
    255 /*
    256 typedef struct
    257 {
    258     psS32 nX;                            ///< Number of elements in x direction
    259     psS32 nY;                            ///< Number of elements in y direction
    260     double x0;                         ///< X Position of 0,0 corner on focal plane
    261     double y0;                         ///< Y Position of 0,0 corner on focal plane
    262     double xScale;                     ///< Scale of the grid in x direction
    263     double yScale;                     ///< Scale of the grid in x direction
    264     /// XXX: I added the following memvers to facilitate the psFreeing of the x,y data structures.
    265     psS32 p_ps_xRows;                    ///< Number of rows in the x member
    266     psS32 p_ps_xCols;                    ///< Number of cols in the x member
    267     psS32 p_ps_yRows;                    ///< Number of rows in the y member
    268     psS32 p_ps_yCols;                    ///< Number of cols in the y member
    269     double **x;                        ///< The grid of offsets in x
    270     double **y;                        ///< The grid of offsets in y
    271 }
    272 psFixedPattern;
    273 */
    274 
    275 
    276 /** Observatory Information
    277  *
    278  *  A container for the observatory data that doesn't change per exposure.
    279  *
    280  */
    281 /*typedef struct
    282 {
    283     const char* name;                  ///< Name of observatory
    284     const double latitude;             ///< Latitude of observatory, east positive (degrees?)
    285     const double longitude;            ///< Longitude of observatory (degrees?)
    286     const double height;               ///< Height of observatory in meters
    287     const double tlr;                  ///< Tropospheric Lapse Rate
    288 }
    289 psObservatory;
    290 */
    291 
    292 /** Exposure Information
    293  *
    294  *  Several quantities from the telescope in order to make a first guess at
    295  *  the astrometric solution.  From these quantities, further quantities can
    296  *  be derivedand stored for later use.
    297  *
    298  */
    299 /*typedef struct psExposure
    300 {
    301     const double ra;                   ///< Telescope boresight, right ascention
    302     const double dec;                  ///< Telescope boresight, declination
    303     const double hourAngle;            ///< Hour angle
    304     const double zenithDistance;       ///< Zenith distance
    305     const double azimuth;              ///< Azimuth
    306     const psTime* time;                ///< Time of observation
    307     const float rotAngle;              ///< Rotator position angle in degrees? XXX: see bug#209
    308     const float temperature;           ///< Air temperature in Kelvin
    309     const float pressure;              ///< Air pressure in mB
    310     const float humidity;              ///< Relative humidity, for refraction
    311     const float exposureTime;          ///< Exposure time
    312     const float wavelength;            ///< Wavelength in microns
    313     const psObservatory* observatory;  ///< Observatory data
    314  
    315     // Derived quantities
    316     const double lst;                  ///< Local Sidereal Time
    317     const float positionAngle;         ///< Position angle
    318     const float parallacticAngle;      ///< Parallactic angle
    319     const float airmass;               ///< Airmass, calculated from zenith distance
    320     const float parallacticFactor;     ///< Parallactic factor
    321     const char* cameraName;            ///< name of camera which provided exposure
    322     const char* telescopeName;         ///< name of telescope which provided exposure
    323 }
    324 psExposure;
    325 */
    326 
    327 /** Allocator for psFixedPattern struct
    328  *
    329  *  Allocates a new psFixedPattern struct with the attributes coorsponding
    330  *  to the parameters set to the said input values.
    331  *
    332  *  @return psFixedPattern*     New psFixedPattern struct.
    333  */
    334 /*psFixedPattern* psFixedPatternAlloc(
    335     double x0,           ///< X Position of 0,0 corner on focal plane
    336     double y0,           ///< Y Position of 0,0 corner on focal plane
    337     double xScale,       ///< Scale of the grid in x direction
    338     double yScale,       ///< Scale of the grid in x direction
    339     const psImage *x,    ///< The grid of offsets in x
    340     const psImage *y     ///< The grid of offsets in y
    341 );
    342 */
    343 
    344 /** Allocator for psExposure
    345  *
    346  *  We need several quantities from the telescope in order to make a first
    347  *  guess at the astrometric solution. From these quantities, further
    348  *  quantities can be derived and stored for later use.
    349  *
    350  *  @return     psExposure*    New psExposure struct
    351  */
    352 /*psExposure* psExposureAlloc(
    353     double ra,                         ///< Telescope boresight, right ascention
    354     double dec,                        ///< Telescope boresight, declination
    355     double hourAngle,                  ///< Hour angle
    356     double zenithDistance,             ///< Zenith distance
    357     double azimuth,                    ///< Azimuth
    358     const psTime* time,                ///< time of observation
    359     float rotAngle,                    ///< Rotator position angle
    360     float temperature,                 ///< Temperature
    361     float pressure,                    ///< Pressure
    362     float humidity,                    ///< Relative humidity
    363     float exposureTime,                ///< Exposure time
    364     float wavelength,                  ///< wavelength
    365     const psObservatory* observatory   ///< Observatory data
    366 );
    367 */
    368 
    369 /** Allocator for psObservatory
    370  *
    371  *  This function shall construct a new psObservatory with attributes
    372  *  cooresponding to the function parameters.
    373  *
    374  *  @return psObservatory*    new psObservatory struct
    375  */
    376 /*psObservatory* psObservatoryAlloc(
    377     const char* name,                  ///< Name of observatory
    378     double latitude,                   ///< Latitude of observatory, east positive
    379     double longitude,                  ///< Longitude of observatory
    380     double height,                     ///< Height of observatory
    381     double tlr                         ///< Tropospheric Lapse Rate
    382 );
    383 */
    384 
    385 /** Allocates a Wallace's Grommit structure.
    386  *
    387  *  The psGrommit is calculated from telescope information for the particular
    388  *  exposure.
    389  *
    390  *  @return psGrommit* New grommit structure.
    391  */
    392 /*psGrommit* psGrommitAlloc(
    393     const psExposure* exp              ///< the cooresponding exposure structure.
    394 );
    395 */
    396 
    397238/** Find cooresponding cell for given FPA coordinate
    398239 *
    399  *  @return psCell*    the cell cooresponding to the coord in FPA
    400  */
    401 /*psCell* psCellInFPA(
     240 *  @return pmCell*    the cell cooresponding to the coord in FPA
     241 */
     242pmCell* pmCellInFPA(
    402243    const psPlane* coord,              ///< the coordinate in FPA plane
    403     const psFPA* FPA                   ///< the FPA to search for the cell
    404 );
    405 */
     244    const pmFPA* FPA                   ///< the FPA to search for the cell
     245);
     246
    406247
    407248/** Find cooresponding chip for given FPA coordinate
    408249 *
    409  *  @return psChip*    the chip cooresponding to coord
    410  */
    411 /*psChip* psChipInFPA(
     250 *  @return pmChip*    the chip cooresponding to coord
     251 */
     252pmChip* pmChipInFPA(
    412253    const psPlane* coord,              ///< the coordinate in FPA plane
    413     const psFPA* FPA                   ///< the FPA to search for the cell
    414 );
    415 */
     254    const pmFPA* FPA                   ///< the FPA to search for the cell
     255);
     256
    416257
    417258/** Find cooresponding cell for given Chip coordinate
    418259 *
    419  *  @return psCell*    the cell cooresponding to coord
    420  */
    421 /*psCell* psCellInChip(
     260 *  @return pmCell*    the cell cooresponding to coord
     261 */
     262pmCell* pmCellInChip(
    422263    const psPlane* coord,              ///< the coordinate in Chip plane
    423     const psChip* chip                 ///< the chip to search for the cell
    424 );
    425 */
     264    const pmChip* chip                 ///< the chip to search for the cell
     265);
     266
    426267
    427268/** Translate a cell coordinate into a chip coordinate
     
    429270 *  @return psPlane*    the resulting chip coordinate
    430271 */
    431 /*psPlane* psCoordCellToChip(
     272psPlane* psCoordCellToChip(
    432273    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    433274    const psPlane* in,                 ///< the coordinate within Cell
    434     const psCell* cell                 ///< the Cell in interest
    435 );
    436 */
     275    const pmCell* cell                 ///< the Cell in interest
     276);
     277
    437278
    438279/** Translate a chip coordinate into a FPA coordinate
     
    440281 *  @return psPlane*    the resulting FPA coordinate
    441282 */
    442 /*psPlane* psCoordChipToFPA(
     283psPlane* psCoordChipToFPA(
    443284    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    444285    const psPlane* in,                 ///< the coordinate within Chip
    445     const psChip* chip                 ///< the chip in interest
    446 );
    447 */
     286    const pmChip* chip                 ///< the chip in interest
     287);
     288
    448289
    449290/** Translate a FPA coordinate into a Tangent Plane coordinate
     
    451292 *  @return psPlane*    the resulting Tangent Plane coordinate
    452293 */
    453 /*psPlane* psCoordFPAToTP(
     294psPlane* psCoordFPAToTP(
    454295    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    455296    const psPlane* in,                 ///< the coordinate within FPA
    456297    double color,                      ///< Color of source
    457298    double magnitude,                  ///< Magnitude of source
    458     const psFPA* fpa                   ///< the FPA in interest
    459 );
    460 */
     299    const pmFPA* fpa                   ///< the FPA in interest
     300);
     301
    461302
    462303/** Translate a Tangent Plane coordinate into a Sky coordinate
     
    464305 *  @return psSphere*    the resulting Sky coordinate
    465306 */
    466 /*psSphere* psCoordTPToSky(
     307psSphere* psCoordTPToSky(
    467308    psSphere* out,                     ///< a sphere struct to recycle. If NULL, a new struct is created
    468     const psPlane* in,                 ///< the coordinate within Tangent Plane
    469     const psGrommit* grommit           ///< the grommit of the tangent plane
    470 );
    471 */
     309    const psPlane* in,                ///< the coordinate within Tangent Plane
     310    const psProjection *projection
     311);
    472312
    473313/** Translate a cell coordinate into a FPA coordinate
     
    475315 *  @return psPlane*    the resulting FPA coordinate
    476316 */
    477 /*psPlane* psCoordCellToFPA(
     317psPlane* psCoordCellToFPA(
    478318    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    479319    const psPlane* in,                 ///< the coordinate within cell
    480     const psCell* cell                 ///< the cell in interest
    481 );
    482 */
     320    const pmCell* cell                 ///< the cell in interest
     321);
     322
    483323
    484324/** Translate a cell coordinate into a Sky coordinate
     
    486326 *  @return psSphere*    the resulting Sky coordinate
    487327 */
    488 /*psSphere* psCoordCellToSky(
     328psSphere* psCoordCellToSky(
    489329    psSphere* out,                     ///< a sphere struct to recycle. If NULL, a new struct is created
    490330    const psPlane* in,                 ///< the coordinate within cell
    491331    double color,                      ///< Color of source
    492332    double magnitude,                  ///< Magnitude of source
    493     const psCell* cell                 ///< the cell in interest
    494 );
    495 */
     333    const pmCell* cell                 ///< the cell in interest
     334);
     335
    496336
    497337/** Translate a cell coordinate into a Sky coordinate using a 'quick and
     
    500340 *  @return psSphere*    the resulting Sky coordinate
    501341 */
    502 /*psSphere* psCoordCellToSkyQuick(
     342psSphere* psCoordCellToSkyQuick(
    503343    psSphere* out,                     ///< a sphere struct to recycle. If NULL, a new struct is created
    504344    const psPlane* in,                 ///< the coordinate within cell
    505     const psCell* cell                 ///< the cell in interest
    506 );
    507 */
     345    const pmCell* cell                 ///< the cell in interest
     346);
     347
    508348
    509349/** Translate a Sky coordinate into a Tangent Plane coordinate
     
    511351 *  @return psPlane*    the resulting Tangent Plane coordinate
    512352 */
    513 /*psPlane* psCoordSkyToTP(
     353psPlane* psCoordSkyToTP(
    514354    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    515355    const psSphere* in,                ///< the sky coordinate
    516     const psGrommit* grommit           ///< the grommit
    517 );
    518 */
     356    const psProjection *projection
     357);
    519358
    520359/** Translate a Tangent Plane coordinate into a FPA coordinate
     
    522361 *  @return psPlane*    the resulting FPA coordinate
    523362 */
    524 /*psPlane* psCoordTPToFPA(
     363psPlane* psCoordTPToFPA(
    525364    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    526365    const psPlane* in,                 ///< the coordinate within tangent plane
    527366    double color,                      ///< Color of source
    528367    double magnitude,                  ///< Magnitude of source
    529     const psFPA* fpa                   ///< the FPA of interest
    530 );
    531 */
     368    const pmFPA* fpa                   ///< the FPA of interest
     369);
     370
    532371
    533372/** Translate a FPA coordinate into a chip coordinate
     
    535374 *  @return psPlane*    the resulting chip coordinate
    536375 */
    537 /*psPlane* psCoordFPAToChip(
     376psPlane* psCoordFPAToChip(
    538377    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    539378    const psPlane* in,                 ///< the FPA coordinate
    540     const psChip* chip                 ///< the chip of interest
    541 );
    542 */
     379    const pmChip* chip                 ///< the chip of interest
     380);
     381
    543382
    544383/** Translate a chip coordinate into a cell coordinate
     
    546385 *  @return psPlane*    the resulting cell coordinate
    547386 */
    548 /*psPlane* psCoordChipToCell(
     387psPlane* psCoordChipToCell(
    549388    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    550389    const psPlane* in,                 ///< the Chip coordinate
    551     const psCell* cell                 ///< the cell of interest
    552 );
    553 */
     390    const pmCell* cell                 ///< the cell of interest
     391);
     392
    554393
    555394/** Translate a sky coordinate into a cell coordinate
     
    557396 *  @return psPlane*    the resulting cell coordinate
    558397 */
    559 /*psPlane* psCoordSkyToCell(
     398psPlane* psCoordSkyToCell(
    560399    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    561400    const psSphere* in,                ///< the Sky coordinate
    562     double color,                      ///< Color of source
    563     double magnitude,                  ///< Magnitude of source
    564     const psCell* cell                 ///< the cell of interest
    565 );
    566 */
     401    float color,                       ///< Color of source
     402    float magnitude,                   ///< Magnitude of source
     403    const pmCell* cell                 ///< the cell of interest
     404);
     405
    567406
    568407/** Translate a sky coordinate into a cell coordinate using a 'quick and
     
    571410 *  @return psPlane*    the resulting cell coordinate
    572411 */
    573 /*psPlane* psCoordSkyToCellQuick(
     412psPlane* psCoordSkyToCellQuick(
    574413    psPlane* out,                      ///< a plane struct to recycle. If NULL, a new struct is created
    575414    const psSphere* in,                ///< the Sky coordinate
    576     const psCell* cell                 ///< the cell of interest
    577 );
    578 */
     415    const pmCell* cell                 ///< the cell of interest
     416);
     417
    579418
    580419#endif // #ifndef PS_ASTROMETRY_H
  • trunk/psModules/src/pmFlatField.c

    r2299 r4770  
    1818 *  @author Ross Harman, MHPCC
    1919 *
    20  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    21  *  @date $Date: 2004-11-06 02:42:03 $
     20 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     21 *  @date $Date: 2005-08-16 01:10:34 $
    2222 *
    2323 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3838
    3939
    40 bool pmFlatField(psReadout *in, const psReadout *flat)
     40bool pmFlatField(pmReadout *in, pmReadout *mask, const pmReadout *flat)
    4141{
     42    // XXX: Not sure if this is correct.  Must consult with IfA.
     43    PS_ASSERT_PTR_NON_NULL(mask, false);
    4244    int i = 0;
    4345    int j = 0;
     
    7173                 PS_ERRORTEXT_pmFlatField_NULL_FLAT_IMAGE);
    7274        return false;
    73     } else if(in->mask == NULL) {
    74         in->mask = psImageAlloc(inImage->numCols, inImage->numRows, PS_TYPE_MASK);
    75         memset(in->mask->data.V[0], 0, inImage->numCols*inImage->numRows*PSELEMTYPE_SIZEOF(PS_TYPE_MASK));
    7675    }
    77     inMask = in->mask;
     76    inMask = mask->image;
    7877
    7978    // Check input image and its mask are not larger than flat image
     79
    8080    if(inImage->numRows>flatImage->numRows || inImage->numCols>flatImage->numCols) {
    8181        psError( PS_ERR_BAD_PARAMETER_SIZE, true,
  • trunk/psModules/src/pmFlatField.h

    r4754 r4770  
    1818 *  @author Ross Harman, MHPCC
    1919 *
    20  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    21  *  @date $Date: 2005-08-11 00:03:51 $
     20 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     21 *  @date $Date: 2005-08-16 01:10:34 $
    2222 *
    2323 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3636 */
    3737bool pmFlatField(
    38     psReadout *in,          ///< Redout with input image and mask
    39     const psReadout *flat   ///< Readout with flat image
     38    pmReadout *in,          ///< Readout with input image
     39    pmReadout *mask,        ///< Input image mask
     40    const pmReadout *flat   ///< Readout with flat image
    4041);
    4142
  • trunk/psModules/src/pmMaskBadPixels.c

    r2275 r4770  
    1919 *  @author Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-11-04 02:02:10 $
     21 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2005-08-16 01:10:34 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3636#include "pmMaskBadPixelsErrors.h"
    3737
    38 bool pmMaskBadPixels(psReadout *in, const psImage *mask, unsigned int maskVal, float sat,
     38bool pmMaskBadPixels(pmReadout *in, const psImage *mask, unsigned int maskVal, float sat,
    3939                     unsigned int growVal, int grow)
    4040{
  • trunk/psModules/src/pmMaskBadPixels.h

    r4754 r4770  
    1919 *  @author Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2005-08-11 00:03:51 $
     21 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2005-08-16 01:10:34 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5252 */
    5353bool pmMaskBadPixels(
    54     psReadout *in,          ///< Readout containing input image data.
     54    pmReadout *in,          ///< Readout containing input image data.
    5555    const psImage *mask,    ///< Mask data to be added to readout mask data.
    5656    unsigned int maskVal,   ///< Mask value to determine what to add to input mask.
  • trunk/psModules/src/pmNonLinear.c

    r4030 r4770  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-05-25 20:28:32 $
     7 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-08-16 01:10:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424
    2525/******************************************************************************
    26 pmNonLinearityLookup(): This routine will take an psReadout image as input
     26pmNonLinearityLookup(): This routine will take an pmReadout image as input
    2727and a 1-D polynomial.  For each pixel in the input image, the polynomial will
    2828be evaluated at that pixels value, and the image pixel will then be set to
     
    3030 *****************************************************************************/
    3131
    32 psReadout *pmNonLinearityPolynomial(psReadout *inputReadout,
     32pmReadout *pmNonLinearityPolynomial(pmReadout *inputReadout,
    3333                                    const psPolynomial1D *input1DPoly)
    3434{
     
    5151
    5252/******************************************************************************
    53 pmNonLinearityLookup(): This routine will take an psReadout image as input
     53pmNonLinearityLookup(): This routine will take an pmReadout image as input
    5454and two input vectors, which constitute a lookup table.  For each pixel in
    5555the input image, that pixels value will be determined in the input vector
     
    5757be set to the value from outFlux.
    5858 *****************************************************************************/
    59 psReadout *pmNonLinearityLookup(psReadout *inputReadout,
     59pmReadout *pmNonLinearityLookup(pmReadout *inputReadout,
    6060                                const psVector *inFlux,
    6161                                const psVector *outFlux)
  • trunk/psModules/src/pmNonLinear.h

    r4754 r4770  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-08-11 00:03:51 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-08-16 01:10:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include "pmAstrometry.h"
    1919
    20 psReadout *pmNonLinearityPolynomial(psReadout *in,
     20pmReadout *pmNonLinearityPolynomial(pmReadout *in,
    2121                                    const psPolynomial1D *coeff);
    2222
    23 psReadout *pmNonLinearityLookup(psReadout *in,
     23pmReadout *pmNonLinearityLookup(pmReadout *in,
    2424                                const psVector *inFlux,
    2525                                const psVector *outFlux);
  • trunk/psModules/src/pmObjects.c

    r4579 r4770  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-07-19 01:44:48 $
     8 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-16 01:10:34 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020
    2121/******************************************************************************
    22 pmPeakAlloc(): Allocate the psPeak data structure and set appropriate members.
    23 *****************************************************************************/
    24 psPeak *pmPeakAlloc(psS32 x,
     22pmPeakAlloc(): Allocate the pmPeak data structure and set appropriate members.
     23*****************************************************************************/
     24pmPeak *pmPeakAlloc(psS32 x,
    2525                    psS32 y,
    2626                    psF32 counts,
    27                     psPeakType class)
    28 {
    29     psPeak *tmp = (psPeak *) psAlloc(sizeof(psPeak));
     27                    pmPeakType class)
     28{
     29    pmPeak *tmp = (pmPeak *) psAlloc(sizeof(pmPeak));
    3030    tmp->x = x;
    3131    tmp->y = y;
     
    3737
    3838/******************************************************************************
    39 pmMomentsAlloc(): Allocate the psMoments structure and initialize the members
     39pmMomentsAlloc(): Allocate the pmMoments structure and initialize the members
    4040to zero.
    4141*****************************************************************************/
    42 psMoments *pmMomentsAlloc()
    43 {
    44     psMoments *tmp = (psMoments *) psAlloc(sizeof(psMoments));
     42pmMoments *pmMomentsAlloc()
     43{
     44    pmMoments *tmp = (pmMoments *) psAlloc(sizeof(pmMoments));
    4545    tmp->x = 0.0;
    4646    tmp->y = 0.0;
     
    5656}
    5757
    58 static void modelFree(psModel *tmp)
     58static void modelFree(pmModel *tmp)
    5959{
    6060    psFree(tmp->params);
     
    6363
    6464/******************************************************************************
    65 pmModelAlloc(): Allocate the psModel structure, along with its parameters,
     65pmModelAlloc(): Allocate the pmModel structure, along with its parameters,
    6666and initialize the type member.  Initialize the params to 0.0.
    6767XXX EAM: changing params and dparams to psVector
    6868*****************************************************************************/
    69 psModel *pmModelAlloc(psModelType type)
    70 {
    71     psModel *tmp = (psModel *) psAlloc(sizeof(psModel));
     69pmModel *pmModelAlloc(pmModelType type)
     70{
     71    pmModel *tmp = (pmModel *) psAlloc(sizeof(pmModel));
    7272
    7373    tmp->type = type;
     
    9999        break;
    100100    default:
    101         psError(PS_ERR_UNKNOWN, true, "Undefined psModelType");
     101        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
    102102        return(NULL);
    103103    }
     
    116116We might need to increase the reference counter and decrease it here.
    117117*****************************************************************************/
    118 static void sourceFree(psSource *tmp)
     118static void sourceFree(pmSource *tmp)
    119119{
    120120    psFree(tmp->peak);
     
    122122    //    psFree(tmp->mask);
    123123    psFree(tmp->moments);
    124     psFree(tmp->models);
    125 }
    126 
    127 /******************************************************************************
    128 pmSourceAlloc(): Allocate the psSource structure and initialize its members
     124    psFree(tmp->modelPSF);
     125    psFree(tmp->modelFLT);
     126}
     127
     128/******************************************************************************
     129pmSourceAlloc(): Allocate the pmSource structure and initialize its members
    129130to NULL.
    130131*****************************************************************************/
    131 psSource *pmSourceAlloc()
    132 {
    133     psSource *tmp = (psSource *) psAlloc(sizeof(psSource));
     132pmSource *pmSourceAlloc()
     133{
     134    pmSource *tmp = (pmSource *) psAlloc(sizeof(pmSource));
    134135    tmp->peak = NULL;
    135136    tmp->pixels = NULL;
    136137    tmp->mask = NULL;
    137138    tmp->moments = NULL;
    138     tmp->models = NULL;
     139    tmp->modelPSF = NULL;
     140    tmp->modelFLT = NULL;
    139141    tmp->type = 0;
    140142    psMemSetDeallocator(tmp, (psFreeFunc) sourceFree);
     
    272274                              psS32 col,
    273275                              psF32 counts,
    274                               psPeakType type)
    275 {
    276     psPeak *tmpPeak = pmPeakAlloc(col, row, counts, type);
     276                              pmPeakType type)
     277{
     278    pmPeak *tmpPeak = pmPeakAlloc(col, row, counts, type);
    277279
    278280    if (list == NULL) {
     
    379381        // Step through all local peaks in this row.
    380382        for (psU32 i = 0 ; i < row1->n ; i++ ) {
    381             psPeakType myType = PM_PEAK_UNDEF;
     383            pmPeakType myType = PM_PEAK_UNDEF;
    382384            col = row1->data.U32[i];
    383385
     
    527529    //    printf("pmCullPeaks(): list size is %d\n", peaks->size);
    528530    while (tmpListElem != NULL) {
    529         psPeak *tmpPeak = (psPeak *) tmpListElem->data;
     531        pmPeak *tmpPeak = (pmPeak *) tmpListElem->data;
    530532        if ((tmpPeak->counts > maxValue) ||
    531533                ((valid != NULL) &&
     
    553555
    554556    for (int i = 0; i < peaks->n; i++) {
    555         psPeak *tmpPeak = (psPeak *) peaks->data[i];
     557        pmPeak *tmpPeak = (pmPeak *) peaks->data[i];
    556558        if (tmpPeak->counts > maxValue)
    557559            continue;
     
    566568
    567569/******************************************************************************
    568 psSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius): this
    569 routine creates a new psSource data structure and sets the following members:
    570     ->psPeak
    571     ->psMoments->sky
     570pmSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius): this
     571routine creates a new pmSource data structure and sets the following members:
     572    ->pmPeak
     573    ->pmMoments->sky
    572574 
    573575The sky value is set from the pixels in the square annulus surrounding the
     
    590592     or they use the image row/column offsets.
    591593 
    592 XXX: Should we simply set psSource->peak = peak?  If so, should we increase
     594XXX: Should we simply set pmSource->peak = peak?  If so, should we increase
    593595the reference counter?  Or, should we copy the data structure?
    594596 
     
    602604     members.
    603605*****************************************************************************/
    604 psSource *pmSourceLocalSky(const psImage *image,
    605                            const psPeak *peak,
     606pmSource *pmSourceLocalSky(const psImage *image,
     607                           const pmPeak *peak,
    606608                           psStatsOptions statsOptions,
    607609                           psF32 innerRadius,
     
    723725    // Create the output mySource, and set appropriate members.
    724726    //
    725     psSource *mySource = pmSourceAlloc();
    726     mySource->peak = (psPeak *) peak;
     727    pmSource *mySource = pmSourceAlloc();
     728    mySource->peak = (pmPeak *) peak;
    727729    mySource->moments = pmMomentsAlloc();
    728730    psF64 tmpF64;
     
    746748XXX: macro this for performance.
    747749*****************************************************************************/
    748 static bool checkRadius(psPeak *peak,
     750static bool checkRadius(pmPeak *peak,
    749751                        psF32 radius,
    750752                        psS32 x,
     
    781783/******************************************************************************
    782784pmSourceMoments(source, radius): this function takes a subImage defined in the
    783 psSource data structure, along with the peak location, and determines the
     785pmSource data structure, along with the peak location, and determines the
    784786various moments associated with that peak.
    785787 
    786788Requires the following to have been created:
    787     psSource
    788     psSource->peak
    789     psSource->pixels
     789    pmSource
     790    pmSource->peak
     791    pmSource->pixels
    790792 
    791793XXX: The peak calculations are done in image coords, not subImage coords.
     
    793795XXX: mask values?
    794796*****************************************************************************/
    795 psSource *pmSourceMoments(psSource *source,
     797pmSource *pmSourceMoments(pmSource *source,
    796798                          psF32 radius)
    797799{
     
    925927int pmComparePeakAscend (const void **a, const void **b)
    926928{
    927     psPeak *A = *(psPeak **)a;
    928     psPeak *B = *(psPeak **)b;
     929    pmPeak *A = *(pmPeak **)a;
     930    pmPeak *B = *(pmPeak **)b;
    929931
    930932    psF32 diff;
     
    940942int pmComparePeakDescend (const void **a, const void **b)
    941943{
    942     psPeak *A = *(psPeak **)a;
    943     psPeak *B = *(psPeak **)b;
     944    pmPeak *A = *(pmPeak **)a;
     945    pmPeak *B = *(pmPeak **)b;
    944946
    945947    psF32 diff;
     
    992994        for (psS32 i = 0 ; i < sources->n ; i++)
    993995        {
    994             psSource *tmpSrc = (psSource *) sources->data[i];
     996            pmSource *tmpSrc = (pmSource *) sources->data[i];
    995997            PS_ASSERT_PTR_NON_NULL(tmpSrc, false); // just skip this one?
    996998            PS_ASSERT_PTR_NON_NULL(tmpSrc->moments, false); // just skip this one?
     
    10271029    // measure statistics on Sx, Sy if Sx, Sy within range of clump
    10281030    {
    1029         psPeak *clump;
     1031        pmPeak *clump;
    10301032        psF32 minSx, maxSx;
    10311033        psF32 minSy, maxSy;
     
    10541056        for (psS32 i = 0 ; i < sources->n ; i++)
    10551057        {
    1056             psSource *tmpSrc = (psSource *) sources->data[i];
     1058            pmSource *tmpSrc = (pmSource *) sources->data[i];
    10571059
    10581060            if (tmpSrc->moments->Sx < minSx)
     
    11031105    for (psS32 i = 0 ; i < sources->n ; i++) {
    11041106
    1105         psSource *tmpSrc = (psSource *) sources->data[i];
     1107        pmSource *tmpSrc = (pmSource *) sources->data[i];
    11061108
    11071109        tmpSrc->peak->class = 0;
     
    11971199     the pmSourceSetLocal() function.
    11981200*****************************************************************************/
    1199 bool pmSourceSetPixelsCircle(psSource *source,
     1201bool pmSourceSetPixelsCircle(pmSource *source,
    12001202                             const psImage *image,
    12011203                             psF32 radius)
     
    12931295/******************************************************************************
    12941296pmSourceModelGuess(source, image, model): This function allocates a new
    1295 psModel structure and stores it in the psSource data structure specified in
     1297pmModel structure and stores it in the pmSource data structure specified in
    12961298the argument list.  The model type is specified in the argument list.  The
    1297 params array in that psModel structure are allocated, and then set to the
     1299params array in that pmModel structure are allocated, and then set to the
    12981300appropriate values.  This function returns true if everything was successful.
    12991301 
     
    13061308image, not subImage coords.  Therefore, the calls to the model evaluation
    13071309functions will be in image, not subImage coords.  Remember this.
    1308 *****************************************************************************/
    1309 bool pmSourceModelGuess(psSource *source,
     1310 
     1311XXX: The source->models member used to be allocated here.  Now I assume
     1312->modelPSF should be allocated
     1313*****************************************************************************/
     1314bool pmSourceModelGuess(pmSource *source,
    13101315                        const psImage *image,
    1311                         psModelType model)
     1316                        pmModelType model)
    13121317{
    13131318    PS_ASSERT_PTR_NON_NULL(source, false);
     
    13161321    PS_ASSERT_IMAGE_NON_NULL(image, false);
    13171322    PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, false);
    1318     if (source->models != NULL) {
    1319         psLogMsg(__func__, PS_LOG_WARN, "WARNING: source->models was non-NULL; calling psFree(source->models).\n");
    1320         psFree(source->models);
     1323    if (source->modelPSF != NULL) {
     1324        psLogMsg(__func__, PS_LOG_WARN, "WARNING: source->modelPSF was non-NULL; calling psFree(source->modelPSF).\n");
     1325        psFree(source->modelPSF);
    13211326    }
    13221327    if (!((model == PS_MODEL_GAUSS) ||
     
    13301335    }
    13311336
    1332     source->models = pmModelAlloc(model);
    1333 
    1334     psVector *params = source->models->params;
     1337    source->modelPSF = pmModelAlloc(model);
     1338
     1339    psVector *params = source->modelPSF->params;
    13351340
    13361341    switch (model) {
     
    13641369        params->data.F32[6] = source->moments->Sxy;
    13651370        // XXX: What are these?
    1366         // source->models->params[7] = B2;
    1367         // source->models->params[8] = B3;
     1371        // source->modelPSF->params[7] = B2;
     1372        // source->modelPSF->params[8] = B3;
    13681373        return(true);
    13691374
     
    14201425/******************************************************************************
    14211426evalModel(source, level, row): a private function which evaluates the
    1422 source->model function at the specified coords.  The coords are subImage, not
     1427source->modelPSF function at the specified coords.  The coords are subImage, not
    14231428image coords.
    14241429 
     
    14301435the coords is in subImage or image space.
    14311436 
    1432 XXX: This should probably be a public psModules function.
     1437XXX: This should probably be a public pmModules function.
    14331438 
    14341439XXX: Use static vectors for x.
     
    14391444testing.  Try to reproduce that and debug.
    14401445*****************************************************************************/
    1441 static psF32 evalModel(psSource *src,
     1446static psF32 evalModel(pmSource *src,
    14421447                       psU32 row,
    14431448                       psU32 col)
    14441449{
    14451450    PS_ASSERT_PTR_NON_NULL(src, false);
    1446     PS_ASSERT_PTR_NON_NULL(src->models, false);
    1447     PS_ASSERT_PTR_NON_NULL(src->models->params, false);
    1448 
    1449     // XXX: The following step will not be necessary if the models->params
     1451    PS_ASSERT_PTR_NON_NULL(src->modelPSF, false);
     1452    PS_ASSERT_PTR_NON_NULL(src->modelPSF->params, false);
     1453
     1454    // XXX: The following step will not be necessary if the modelPSF->params
    14501455    // member is a psVector.  Suggest to IfA.
    14511456
    1452     // XXX EAM: done: models->params is now a vector
    1453     psVector *params = src->models->params;
     1457    // XXX EAM: done: modelPSF->params is now a vector
     1458    psVector *params = src->modelPSF->params;
    14541459
    14551460    //
     
    14611466    psF32 tmpF;
    14621467
    1463     switch (src->models->type) {
     1468    switch (src->modelPSF->type) {
    14641469    case PS_MODEL_GAUSS:
    14651470        tmpF = pmMinLM_Gauss2D(NULL, params, x);
     
    14811486        break;
    14821487    default:
    1483         psError(PS_ERR_UNKNOWN, true, "Undefined psModelType");
     1488        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
    14841489        return(NAN);
    14851490    }
     
    15001505XXX: The result is returned in image coords.
    15011506*****************************************************************************/
    1502 static psF32 findValue(psSource *source,
     1507static psF32 findValue(pmSource *source,
    15031508                       psF32 level,
    15041509                       psU32 row,
     
    15751580XXX: The top, bottom of the contour is not correctly determined.
    15761581*****************************************************************************/
    1577 psArray *pmSourceContour(psSource *source,
     1582psArray *pmSourceContour(pmSource *source,
    15781583                         const psImage *image,
    15791584                         psF32 level,
     
    15851590    PS_ASSERT_PTR_NON_NULL(source->peak, false);
    15861591    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    1587     PS_ASSERT_PTR_NON_NULL(source->models, false);
     1592    PS_ASSERT_PTR_NON_NULL(source->modelPSF, false);
    15881593
    15891594    //
     
    16921697XXX: Probably should remove the "image" argument.
    16931698*****************************************************************************/
    1694 bool pmSourceFitModel(psSource *source,
     1699bool pmSourceFitModel(pmSource *source,
    16951700                      const psImage *image)
    16961701{
     
    16991704    PS_ASSERT_PTR_NON_NULL(source->peak, false);
    17001705    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    1701     PS_ASSERT_PTR_NON_NULL(source->models, false);
     1706    PS_ASSERT_PTR_NON_NULL(source->modelPSF, false);
    17021707    PS_ASSERT_IMAGE_NON_NULL(image, false);
    17031708    PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, false);
     
    17421747                            PM_SOURCE_FIT_MODEL_TOLERANCE);
    17431748
    1744     psVector *params = source->models->params;
    1745 
    1746     switch (source->models->type) {
     1749    psVector *params = source->modelPSF->params;
     1750
     1751    switch (source->modelPSF->type) {
    17471752    case PS_MODEL_GAUSS:
    17481753        rc = psMinimizeLMChi2(myMin, NULL, params, NULL, x, y, yErr, pmMinLM_Gauss2D);
     
    17641769        break;
    17651770    default:
    1766         psError(PS_ERR_UNKNOWN, true, "Undefined psModelType");
     1771        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
    17671772        rc = false;
    17681773    }
    17691774    // XXX EAM: we need to do something (give an error?) if rc is false
    17701775    // XXX EAM: save the resulting chisq, nDOF, nIter
    1771     source->models->chisq = myMin->value;
    1772     source->models->nDOF  = y->n - params->n;
    1773     source->models->nIter = myMin->iter;
     1776    source->modelPSF->chisq = myMin->value;
     1777    source->modelPSF->nDOF  = y->n - params->n;
     1778    source->modelPSF->nIter = myMin->iter;
    17741779
    17751780    psFree(x);
     
    17801785
    17811786static bool sourceAddOrSubModel(psImage *image,
    1782                                 psSource *src,
     1787                                pmSource *src,
    17831788                                bool center,
    17841789                                psS32 flag)
     
    17881793    PS_ASSERT_PTR_NON_NULL(src->peak, false);
    17891794    PS_ASSERT_PTR_NON_NULL(src->pixels, false);
    1790     PS_ASSERT_PTR_NON_NULL(src->models, false);
     1795    PS_ASSERT_PTR_NON_NULL(src->modelPSF, false);
    17911796    PS_ASSERT_IMAGE_NON_NULL(image, false);
    17921797    PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, false);
    17931798
    17941799    psVector *x = psVectorAlloc(2, PS_TYPE_F32);
    1795     psVector *params = src->models->params;
     1800    psVector *params = src->modelPSF->params;
    17961801
    17971802    for (psS32 i = 0; i < src->pixels->numRows; i++) {
     
    18081813            x->data.F32[0] = (float) imageCol;
    18091814            x->data.F32[1] = (float) imageRow;
    1810             switch (src->models->type) {
     1815            switch (src->modelPSF->type) {
    18111816            case PS_MODEL_GAUSS:
    18121817                pixelValue = pmMinLM_Gauss2D(NULL, params, x);
     
    18281833                break;
    18291834            default:
    1830                 psError(PS_ERR_UNKNOWN, true, "Undefined psModelType");
     1835                psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
    18311836                psFree(x);
    18321837                return(false);
     
    18511856 *****************************************************************************/
    18521857bool pmSourceAddModel(psImage *image,
    1853                       psSource *src,
     1858                      pmSource *src,
    18541859                      bool center)
    18551860{
     
    18601865 *****************************************************************************/
    18611866bool pmSourceSubModel(psImage *image,
    1862                       psSource *src,
     1867                      pmSource *src,
    18631868                      bool center)
    18641869{
  • trunk/psModules/src/pmObjects.h

    r4579 r4770  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-07-19 01:44:48 $
     7 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-08-16 01:10:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "pslib.h"
    2424
     25/** pmPeakType
     26 *
     27 *  A peak pixel may have several features which may be determined when the
     28 *  peak is found or measured. These are specified by the pmPeakType enum.
     29 *  PM_PEAK_LONE represents a single pixel which is higher than its 8 immediate
     30 *  neighbors.  The PM_PEAK_EDGE represents a peak pixel which touching the image
     31 *  edge. The PM_PEAK_FLAT represents a peak pixel which has more than a specific
     32 *  number of neighbors at the same value, within some tolarence:
     33 *
     34 */
    2535typedef enum {
    26     PM_PEAK_LONE,           ///< Isolated peak.
    27     PM_PEAK_EDGE,           ///< Peak on edge.
    28     PM_PEAK_FLAT,           ///< Peak has equal-value neighbors.
    29     PM_PEAK_UNDEF           ///< Undefined.
    30 } psPeakType;
    31 
     36    PM_PEAK_LONE,                       ///< Isolated peak.
     37    PM_PEAK_EDGE,                       ///< Peak on edge.
     38    PM_PEAK_FLAT,                       ///< Peak has equal-value neighbors.
     39    PM_PEAK_UNDEF                       ///< Undefined.
     40} pmPeakType;
     41
     42/** pmPeak data structure
     43 * 
     44 * 
     45 * 
     46 */
    3247typedef struct
    3348{
    34     psS32 x;                ///< X-coordinate of peak pixel.
    35     psS32 y;                ///< Y-coordinate of peak pixel.
    36     psF32 counts;           ///< Value of peak pixel (above sky?).
    37     psPeakType class;       ///< Description of peak.
     49    int x;                              ///< X-coordinate of peak pixel.
     50    int y;                              ///< Y-coordinate of peak pixel.
     51    float counts;                       ///< Value of peak pixel (above sky?).
     52    pmPeakType class;                   ///< Description of peak.
    3853}
    39 psPeak;
    40 
     54pmPeak;
     55
     56/** pmMoments data structure
     57 * 
     58 * 
     59 * 
     60 */
    4161typedef struct
    4262{
    43     psF32 x;                ///< X-coord of centroid.
    44     psF32 y;                ///< Y-coord of centroid.
    45     psF32 Sx;               ///< x-second moment.
    46     psF32 Sy;               ///< y-second moment.
    47     psF32 Sxy;              ///< xy cross moment.
    48     psF32 Sum;              ///< Pixel sum above sky (background).
    49     psF32 Peak;             ///< Peak counts above sky.
    50     psF32 Sky;              ///< Sky level (background).
    51     psS32 nPixels;          ///< Number of pixels used.
     63    float x;                            ///< X-coord of centroid.
     64    float y;                            ///< Y-coord of centroid.
     65    float Sx;                           ///< x-second moment.
     66    float Sy;                           ///< y-second moment.
     67    float Sxy;                          ///< xy cross moment.
     68    float Sum;                          ///< Pixel sum above sky (background).
     69    float Peak;                         ///< Peak counts above sky.
     70    float Sky;                          ///< Sky level (background).
     71    int nPixels;                        ///< Number of pixels used.
    5272}
    53 psMoments;
    54 
     73pmMoments;
     74
     75/** pmModelType enumeration
     76 * 
     77 * 
     78 * 
     79 */
    5580typedef enum {
    56     PS_MODEL_GAUSS,   ///< Regular 2-D Gaussian
    57     PS_MODEL_PGAUSS,  ///< Psuedo 2-D Gaussian
    58     PS_MODEL_TWIST_GAUSS, ///< 2-D Twisted Gaussian
    59     PS_MODEL_WAUSS,  ///< 2-D Waussian
    60     PS_MODEL_SERSIC,  ///< Sersic
    61     PS_MODEL_SERSIC_CORE, ///< Sersic Core
    62     PS_MODEL_UNDEFINED  ///< Undefined
    63 } psModelType;
    64 
    65 // XXX: It will be better if params, and dparams, were psVectors.
     81    PS_MODEL_GAUSS,                     ///< Regular 2-D Gaussian
     82    PS_MODEL_PGAUSS,                    ///< Psuedo 2-D Gaussian
     83    PS_MODEL_TWIST_GAUSS,               ///< 2-D Twisted Gaussian
     84    PS_MODEL_WAUSS,                     ///< 2-D Waussian
     85    PS_MODEL_SERSIC,                    ///< Sersic
     86    PS_MODEL_SERSIC_CORE,               ///< Sersic Core
     87    PS_MODEL_UNDEFINED                  ///< Undefined
     88} pmModelType;
     89
     90/** pmModel data structure
     91 * 
     92 * 
     93 * 
     94 */
     95// XXX: The SDRS has the "type" member of type psS32.
    6696typedef struct
    6797{
    68     psModelType type;       ///< Model to be used.
    69     psVector *params;       ///< Paramater values.
    70     psVector *dparams;      ///< Parameter errors.
    71     psF32 chisq;            ///< Fit chi-squared.
    72     psS32 nDOF;             ///< number of degrees of freedom
    73     psS32 nIter;            ///< number of iterations to reach min
     98    pmModelType type;                   ///< Model to be used.
     99    psVector *params;                   ///< Paramater values.
     100    psVector *dparams;                  ///< Parameter errors.
     101    float chisq;                        ///< Fit chi-squared.
     102    int nDOF;                           ///< number of degrees of freedom
     103    int nIter;                          ///< number of iterations to reach min
    74104}
    75 psModel;
    76 
     105pmModel;
     106
     107/** pmSourceType enumeration
     108 * 
     109 * 
     110 * 
     111 */
    77112typedef enum {
    78113    PS_SOURCE_PSFSTAR,
     
    84119    PS_SOURCE_BRIGHTSTAR,
    85120    PS_SOURCE_OTHER
    86 } psSourceType;
    87 
     121} pmSourceType;
     122
     123/** pmSource data structure
     124 * 
     125 *  This source has the capacity for several types of measurements. The
     126 *  simplest measurement of a source is the location and flux of the peak pixel
     127 *  associated with the source:
     128 * 
     129 */
    88130typedef struct
    89131{
    90     psPeak *peak;           ///< Description of peak pixel.
    91     psImage *pixels;        ///< Rectangular region including object pixels.
    92     psImage *mask;          ///< Mask which marks pixels associated with objects.
    93     psMoments *moments;     ///< Basic moments measure for the object.
    94     psModel *models;        ///< Model parameters and type.
    95     psSourceType type;      ///< Best identification of object.
     132    pmPeak *peak;                       ///< Description of peak pixel.
     133    psImage *pixels;                    ///< Rectangular region including object pixels.
     134    psImage *mask;                      ///< Mask which marks pixels associated with objects.
     135    pmMoments *moments;                 ///< Basic moments measure for the object.
     136    pmModel *modelPSF;                  ///< PSF model parameters and type
     137    pmModel *modelFLT;                  ///< FLT model parameters and type
     138    pmSourceType type;                  ///< Best identification of object.
    96139}
    97 psSource;
    98 
    99 psPeak *pmPeakAlloc(psS32 x,  ///< Row-coordinate in image space
    100                     psS32 y,  ///< Col-coordinate in image space
    101                     psF32 counts, ///< The value of the peak pixel
    102                     psPeakType class ///< The type of peak pixel
    103                    );
    104 
    105 psMoments *pmMomentsAlloc();
    106 psModel *pmModelAlloc(psModelType type);
    107 psSource *pmSourceAlloc();
     140pmSource;
     141
     142/** pmPeak data structure
     143 * 
     144 * 
     145 * 
     146 */
     147typedef struct
     148{
     149    psS32 type;                         ///< PSF Model in use
     150    psArray *params;                    ///< Model parameters (psPolynomial2D)
     151    psF32 chisq;                        ///< PSF goodness statistic
     152    psS32 nPSFstars;                    ///< number of stars used to measure PSF
     153}
     154pmPSF;
     155
     156
     157
     158pmPeak *pmPeakAlloc(
     159    int x,                              ///< Row-coordinate in image space
     160    int y,                              ///< Col-coordinate in image space
     161    float counts,                       ///< The value of the peak pixel
     162    pmPeakType class                    ///< The type of peak pixel
     163);
     164
     165pmMoments *pmMomentsAlloc();
     166pmModel *pmModelAlloc(pmModelType type);
     167pmSource *pmSourceAlloc();
    108168
    109169/******************************************************************************
     
    112172the location (x value) of all peaks.
    113173 *****************************************************************************/
    114 psVector *pmFindVectorPeaks(const psVector *vector, ///< The input vector (psF32)
    115                             psF32 threshold  ///< Threshold above which to find a peak
    116                            );
     174psVector *pmFindVectorPeaks(
     175    const psVector *vector,             ///< The input vector (float)
     176    float threshold                     ///< Threshold above which to find a peak
     177);
    117178
    118179/******************************************************************************
     
    121182value) of all peaks.
    122183 *****************************************************************************/
    123 psArray *pmFindImagePeaks(const psImage *image, ///< The input image where peaks will be found (psF32)
    124                           psF32 threshold ///< Threshold above which to find a peak
    125                          );
     184psArray *pmFindImagePeaks(
     185    const psImage *image,               ///< The input image where peaks will be found (float)
     186    float threshold                     ///< Threshold above which to find a peak
     187);
    126188
    127189/******************************************************************************
     
    129191a peak value above the given maximum, or fall outside the valid region.
    130192 *****************************************************************************/
    131 psList *pmCullPeaks(psList *peaks,  ///< The psList of peaks to be culled
    132                     psF32 maxValue,  ///< Cull peaks above this value
    133                     const psRegion *valid ///< Cull peaks otside this psRegion
    134                    );
    135 
    136 /******************************************************************************
    137 psSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius):
     193psList *pmCullPeaks(
     194    psList *peaks,                      ///< The psList of peaks to be culled
     195    float maxValue,                     ///< Cull peaks above this value
     196    const psRegion *valid               ///< Cull peaks otside this psRegion
     197);
     198
     199/******************************************************************************
     200pmSource *pmSourceLocalSky(image, peak, innerRadius, outerRadius):
    138201 
    139202 *****************************************************************************/
    140 psSource *pmSourceLocalSky(const psImage *image, ///< The input image (psF32)
    141                            const psPeak *peak,  ///< The peak for which the psSource struct is created.
    142                            psStatsOptions statsOptions, ///< The statistic used in calculating the background sky
    143                            psF32 innerRadius,  ///< The inner radius of the suqare annulus for calculating sky
    144                            psF32 outerRadius  ///< The outer radius of the suqare annulus for calculating sky
    145                           );
    146 
    147 /******************************************************************************
    148  *****************************************************************************/
    149 psSource *pmSourceMoments(psSource *source, ///< The input psSource for which moments will be computed
    150                           psF32 radius  ///< Use a circle of pixels around the peak
    151                          );
     203pmSource *pmSourceLocalSky(
     204    const psImage *image,               ///< The input image (float)
     205    const pmPeak *peak,                 ///< The peak for which the psSource struct is created.
     206    psStatsOptions statsOptions,        ///< The statistic used in calculating the background sky
     207    float innerRadius,                  ///< The inner radius of the suqare annulus for calculating sky
     208    float outerRadius                   ///< The outer radius of the suqare annulus for calculating sky
     209);
     210
     211/******************************************************************************
     212 *****************************************************************************/
     213pmSource *pmSourceMoments(
     214    pmSource *source,                   ///< The input pmSource for which moments will be computed
     215    float radius                        ///< Use a circle of pixels around the peak
     216);
    152217
    153218/******************************************************************************
     
    155220source classification.
    156221 *****************************************************************************/
    157 bool pmSourceRoughClass(psArray *source, ///< The input psSource
    158                         psMetadata *metadata ///< Contains classification parameters
    159                        );
     222bool pmSourceRoughClass(
     223    psArray *source,                    ///< The input pmSource
     224    psMetadata *metadata                ///< Contains classification parameters
     225);
    160226/******************************************************************************
    161227pmSourceSetPixelCircle(source, image, radius)
    162228 *****************************************************************************/
    163 bool pmSourceSetPixelsCircle(psSource *source,  ///< The input psSource
    164                              const psImage *image, ///< The input image (psF32)
    165                              psF32 radius  ///< The radius of the circle
    166                             );
    167 
    168 /******************************************************************************
    169  *****************************************************************************/
    170 bool pmSourceModelGuess(psSource *source, ///< The input psSource
    171                         const psImage *image, ///< The input image (psF32)
    172                         psModelType model ///< The type of model to be created.
    173                        );
     229bool pmSourceSetPixelsCircle(
     230    pmSource *source,                   ///< The input pmSource
     231    const psImage *image,               ///< The input image (float)
     232    float radius                        ///< The radius of the circle
     233);
     234
     235/******************************************************************************
     236 *****************************************************************************/
     237bool pmSourceModelGuess(
     238    pmSource *source,                   ///< The input pmSource
     239    const psImage *image,               ///< The input image (float)
     240    pmModelType model                   ///< The type of model to be created.
     241);
    174242
    175243/******************************************************************************
     
    179247} pmContourType;
    180248
    181 psArray *pmSourceContour(psSource *source, ///< The input psSource
    182                          const psImage *image, ///< The input image (psF32) (this arg should be removed)
    183                          psF32 level,  ///< The level of the contour
    184                          pmContourType mode ///< Currently this must be PS_CONTOUR_CRUDE
    185                         );
    186 
    187 /******************************************************************************
    188  *****************************************************************************/
    189 bool pmSourceFitModel(psSource *source,  ///< The input psSource
    190                       const psImage *image ///< The input image (psF32)
    191                      );
    192 
    193 /******************************************************************************
    194  *****************************************************************************/
    195 bool pmSourceAddModel(psImage *image,  ///< The opuut image (psF32)
    196                       psSource *source,  ///< The input psSource
    197                       bool center  ///< A boolean flag that determines whether pixels are centered
    198                      );
    199 
    200 /******************************************************************************
    201  *****************************************************************************/
    202 bool pmSourceSubModel(psImage *image,  ///< The output image (psF32)
    203                       psSource *source,  ///< The input psSource
    204                       bool center  ///< A boolean flag that determines whether pixels are centered
    205                      );
     249psArray *pmSourceContour(
     250    pmSource *source,                   ///< The input pmSource
     251    const psImage *image,               ///< The input image (float) (this arg should be removed)
     252    float level,                        ///< The level of the contour
     253    pmContourType mode                  ///< Currently this must be PS_CONTOUR_CRUDE
     254);
     255
     256/******************************************************************************
     257 *****************************************************************************/
     258bool pmSourceFitModel(
     259    pmSource *source,                   ///< The input pmSource
     260    const psImage *image                ///< The input image (float)
     261);
     262
     263/******************************************************************************
     264 *****************************************************************************/
     265bool pmSourceAddModel(
     266    psImage *image,                     ///< The opuut image (float)
     267    pmSource *source,                   ///< The input pmSource
     268    bool center                         ///< A boolean flag that determines whether pixels are centered
     269);
     270
     271/******************************************************************************
     272 *****************************************************************************/
     273bool pmSourceSubModel(
     274    psImage *image,                     ///< The output image (float)
     275    pmSource *source,                   ///< The input pmSource
     276    bool center                         ///< A boolean flag that determines whether pixels are centered
     277);
    206278
    207279/******************************************************************************
    208280XXX: Why only *x argument?
    209 XXX EAM: psMinimizeLMChi2Func returns psF64, not psF32
     281XXX EAM: psMinimizeLMChi2Func returns psF64, not float
    210282 *****************************************************************************/
    211283float pmMinLM_Gauss2D(
    212     psVector *deriv,                   ///< A possibly-NULL structure for the output derivatives
    213     const psVector *params,            ///< A psVector which holds the parameters of this function
    214     const psVector *x                  ///< A psVector which holds the row/col coordinate
     284    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     285    const psVector *params,             ///< A psVector which holds the parameters of this function
     286    const psVector *x                   ///< A psVector which holds the row/col coordinate
    215287);
    216288
     
    218290 *****************************************************************************/
    219291float pmMinLM_PsuedoGauss2D(
    220     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    221     const psVector *params, ///< A psVector which holds the parameters of this function
    222     const psVector *x  ///< A psVector which holds the row/col coordinate
     292    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     293    const psVector *params,             ///< A psVector which holds the parameters of this function
     294    const psVector *x                   ///< A psVector which holds the row/col coordinate
    223295);
    224296
     
    226298 *****************************************************************************/
    227299float pmMinLM_Wauss2D(
    228     psVector *deriv,  ///< A possibly-NULL structure for the output derivatives
    229     const psVector *params,  ///< A psVector which holds the parameters of this function
    230     const psVector *x  ///< A psVector which holds the row/col coordinate
     300    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     301    const psVector *params,             ///< A psVector which holds the parameters of this function
     302    const psVector *x                   ///< A psVector which holds the row/col coordinate
    231303);
    232304
     
    234306 *****************************************************************************/
    235307float pmMinLM_TwistGauss2D(
    236     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    237     const psVector *params, ///< A psVector which holds the parameters of this function
    238     const psVector *x  ///< A psVector which holds the row/col coordinate
     308    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     309    const psVector *params,             ///< A psVector which holds the parameters of this function
     310    const psVector *x                   ///< A psVector which holds the row/col coordinate
    239311);
    240312
     
    242314 *****************************************************************************/
    243315float pmMinLM_Sersic(
    244     psVector *deriv,  ///< A possibly-NULL structure for the output derivatives
    245     const psVector *params,  ///< A psVector which holds the parameters of this function
    246     const psVector *x  ///< A psVector which holds the row/col coordinate
     316    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     317    const psVector *params,             ///< A psVector which holds the parameters of this function
     318    const psVector *x                   ///< A psVector which holds the row/col coordinate
    247319);
    248320
     
    250322 *****************************************************************************/
    251323float pmMinLM_SersicCore(
    252     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    253     const psVector *params, ///< A psVector which holds the parameters of this function
    254     const psVector *x  ///< A psVector which holds the row/col coordinate
     324    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     325    const psVector *params,             ///< A psVector which holds the parameters of this function
     326    const psVector *x                   ///< A psVector which holds the row/col coordinate
    255327);
    256328
     
    258330 *****************************************************************************/
    259331float pmMinLM_PsuedoSersic(
    260     psVector *deriv, ///< A possibly-NULL structure for the output derivatives
    261     const psVector *params, ///< A psVector which holds the parameters of this function
    262     const psVector *x  ///< A psVector which holds the row/col coordinate
    263 );
    264 
     332    psVector *deriv,                    ///< A possibly-NULL structure for the output derivatives
     333    const psVector *params,             ///< A psVector which holds the parameters of this function
     334    const psVector *x                   ///< A psVector which holds the row/col coordinate
     335);
     336
     337
     338/**
     339 *
     340 *  The object model functions are defined to allow for the flexible addition
     341 *  of new object models. Every object model, with parameters represented by
     342 *  pmModel, has an associated set of functions which provide necessary support
     343 *  operations. A set of abstract functions allow the programmer to select the
     344 *  approriate function or property for a specific named object model.
     345 *
     346 */
     347
     348/**
     349 *
     350 *  This function is the model chi-square minimization function for this model.
     351 *
     352 */
     353typedef psMinimizeLMChi2Func pmModelFunc;
     354
     355
     356/**
     357 *
     358 * This function returns the integrated flux for the given model parameters.
     359 */
     360typedef psF64 (*pmModelFlux)(const psVector *params);
     361
     362
     363/**
     364 *
     365 *  This function provides the model guess parameters based on the details of
     366 *   the given source.
     367 *
     368 */
     369typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);
     370
     371
     372/**
     373 *
     374 *  This function constructs the PSF model for the given source based on the
     375 *  supplied psf and the FLT model for the object.
     376 *
     377 */
     378typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelFLT, pmPSF *psf);
     379
     380
     381/**
     382 *
     383 *  This function returns the radius at which the given model and parameters
     384 *  achieves the given flux.
     385 *
     386 */
     387typedef psF64 (*pmModelRadius)(const psVector *params, double flux);
     388
     389
     390/**
     391 *
     392 *  Each of the function types above has a corresponding function which returns
     393 *  the function given the model type:
     394 *
     395 */
     396pmModelFunc pmModelFunc_GetFunction (pmModelType type);
     397pmModelFlux pmModelFlux_GetFunction (pmModelType type);
     398pmModelGuessFunc pmModelGuessFunc_GetFunction (pmModelType type);
     399pmModelFromPSFFunc pmModelFromPSFFunc_GetFunction (pmModelType type);
     400pmModelRadius pmModelRadius_GetFunction (pmModelType type);
    265401
    266402#endif
  • trunk/psModules/src/pmReadoutCombine.c

    r4425 r4770  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-06-29 01:39:10 $
     7 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-08-16 01:10:34 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7272    psS32 minInputRows = PS_MAX_S32;
    7373    psListElem *tmpInput = NULL;
    74     psReadout *tmpReadout = NULL;
     74    pmReadout *tmpReadout = NULL;
    7575    psS32 numInputs = 0;
    7676    psS32 tmpI;
     
    9898    tmpInput = (psListElem *) inputs->head;
    9999    while (NULL != tmpInput) {
    100         tmpReadout = (psReadout *) tmpInput->data;
     100        tmpReadout = (pmReadout *) tmpInput->data;
    101101        PS_ASSERT_READOUT_NON_NULL(tmpReadout, output);
    102102        PS_ASSERT_READOUT_NON_EMPTY(tmpReadout, output);
     
    182182    psVector *outColLower = psVectorAlloc(numInputs, PS_TYPE_U32);
    183183    psVector *outColUpper = psVectorAlloc(numInputs, PS_TYPE_U32);
    184     psReadout **tmpReadouts = (psReadout **) psAlloc(numInputs * sizeof(psReadout *));
     184    pmReadout **tmpReadouts = (pmReadout **) psAlloc(numInputs * sizeof(pmReadout *));
    185185
    186186    // For each input readout, we create a pointer to that readout in
     
    191191    tmpInput = (psListElem *) inputs->head;
    192192    while (NULL != tmpInput) {
    193         tmpReadouts[i] = (psReadout *) tmpInput->data;
     193        tmpReadouts[i] = (pmReadout *) tmpInput->data;
    194194        outRowLower->data.U32[i] = tmpReadouts[i]->row0 + tmpReadouts[i]->image->row0;
    195195        outColLower->data.U32[i] = tmpReadouts[i]->col0 + tmpReadouts[i]->image->col0;
  • trunk/psModules/src/pmSubtractBias.c

    r4579 r4770  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-07-19 01:44:48 $
     8 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-16 01:10:34 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727place from the input image.
    2828 *****************************************************************************/
    29 static psReadout *SubtractFrame(psReadout *in,
    30                                 const psReadout *bias)
     29static pmReadout *SubtractFrame(pmReadout *in,
     30                                const pmReadout *bias)
    3131{
    3232    psS32 i;
     
    245245XXX: The SDRS does not specify type support.  F32 is implemented here.
    246246 *****************************************************************************/
    247 psReadout *pmSubtractBias(psReadout *in,
     247pmReadout *pmSubtractBias(pmReadout *in,
    248248                          void *fitSpec,
    249249                          const psList *overscans,
     
    252252                          psS32 nBinOrig,
    253253                          pmFit fit,
    254                           const psReadout *bias)
     254                          const pmReadout *bias)
    255255{
    256256    psTrace(".psModule.pmSubtracBias.pmSubtractBias", 4,
  • trunk/psModules/src/pmSubtractBias.h

    r4754 r4770  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-08-11 00:03:51 $
     8 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-16 01:10:34 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3838} pmFit;
    3939
    40 psReadout *pmSubtractBias(psReadout *in,                ///< The input psReadout image
     40pmReadout *pmSubtractBias(pmReadout *in,                ///< The input pmReadout image
    4141                          void *fitSpec,                ///< A polynomial or spline, defining the fit type.
    4242                          const psList *overscans,      ///< A psList of overscan images
     
    4545                          int nBin,                     ///< The amount of binning to be done image pixels.
    4646                          pmFit fit,                    ///< PM_FIT_SPLINE, PM_FIT_POLYNOMIAL, or PM_FIT_NONE
    47                           const psReadout *bias);       ///< A possibly NULL bias psReadout which is to be subtracted
     47                          const pmReadout *bias);       ///< A possibly NULL bias pmReadout which is to be subtracted
    4848
    4949#endif
  • trunk/psModules/src/pmSubtractSky.c

    r4425 r4770  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-06-29 01:39:10 $
     8 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-16 01:10:34 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    453453
    454454/******************************************************************************
    455 psReadout pmSubtractSky():
     455pmReadout pmSubtractSky():
    456456 
    457457XXX: use static vectors for myStats, and the binned image
     
    461461XXX: Sync the psTrace message facilities.
    462462 *****************************************************************************/
    463 psReadout *pmSubtractSky(psReadout *in,
     463pmReadout *pmSubtractSky(pmReadout *in,
    464464                         void *fitSpec,
    465465                         psFit fit,
  • trunk/psModules/src/pmSubtractSky.h

    r4754 r4770  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-08-11 00:03:51 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-16 01:10:34 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232} psFit;
    3333
    34 psReadout *pmSubtractSky(psReadout *in,
     34pmReadout *pmSubtractSky(pmReadout *in,
    3535                         void *fitSpec,
    3636                         psFit fit,
  • trunk/psModules/test/tst_pmFlatField.c

    r2950 r4770  
    1616 *    Test M - Attempt to use non-mask type mask image
    1717 *
     18 * XXX: Added a mask argument to pmFlatField().  Must add tests.  For now, all
     19 * masks are NULL.
     20 *
    1821 *  @author Ross Harman, MHPCC
    1922 *
    20  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    21  *  @date $Date: 2005-01-11 01:17:28 $
     23 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     24 *  @date $Date: 2005-08-16 01:10:36 $
    2225 *
    2326 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6871int main(int argc, char* argv[])
    6972{
     73    psLogSetFormat("HLNM");
    7074    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    7175}
     
    7781    printPositiveTestHeader(stdout, "pmFlatField", "Test A - Divide input image by flat image");
    7882    CREATE_AND_SET_IMAGE(inImage,F64,6.0,3,3)
    79     psReadout *inReadout = psReadoutAlloc();
     83    pmReadout *inReadout = pmReadoutAlloc(NULL);
    8084    inReadout->image = inImage;
    8185    PRINT_MATRIX(inImage,F64,"Input image:");
    8286    CREATE_AND_SET_IMAGE(flatImage1,F64,2.0,3,3)
    83     psReadout *flatReadout = psReadoutAlloc();
     87    pmReadout *flatReadout = pmReadoutAlloc(NULL);
    8488    flatReadout->image = flatImage1;
    8589    PRINT_MATRIX(flatImage1,F64,"Flat image:");
    86     if ( !pmFlatField(inReadout, flatReadout) ) {
     90    if ( !pmFlatField(inReadout, NULL, flatReadout) ) {
    8791        psError(PS_ERR_UNKNOWN,true,"Test A - Returned false should be true");
    8892        return 1;
     
    99103    PRINT_MATRIX(flatImage2, F64, "Flat image:");
    100104    flatReadout->image = flatImage2;
    101     if ( !pmFlatField(inReadout, flatReadout) ) {
     105    if ( !pmFlatField(inReadout, NULL, flatReadout) ) {
    102106        psError(PS_ERR_UNKNOWN,true,"Test B - Returned false should be true");
    103107        return 2;
     
    118122    psFree(inReadout->mask);
    119123    inReadout->mask = mask1;
    120     if ( !pmFlatField(inReadout, flatReadout) ) {
     124    if ( !pmFlatField(inReadout, NULL, flatReadout) ) {
    121125        psError(PS_ERR_UNKNOWN,true,"Test C - Returned false should be true");
    122126        return 3;
     
    132136    printNegativeTestHeader(stdout,"pmFlatField", "Test D - Attempt to use null flat readout",
    133137                            "Null not allowed for flat readout", 0);
    134     if( pmFlatField(inReadout, NULL) ) {
     138    if( pmFlatField(inReadout, NULL, NULL) ) {
    135139        psError(PS_ERR_UNKNOWN,true,"Test D - Returned true should be false");
    136140        return 4;
     
    145149    psImage *temp = inReadout->image;
    146150    inReadout->image = NULL;
    147     if ( pmFlatField(inReadout, flatReadout) ) {
     151    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    148152        psError(PS_ERR_UNKNOWN,true,"Test E - Returned true should be false" );
    149153        return 5;
     
    159163    temp = flatReadout->image;
    160164    flatReadout->image = NULL;
    161     if ( pmFlatField(inReadout, flatReadout) ) {
     165    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    162166        psError(PS_ERR_UNKNOWN,true,"Test F - Returned true should be false" );
    163167        return 6;
     
    174178    temp = flatReadout->image;
    175179    flatReadout->image = smallFlat;
    176     if ( pmFlatField(inReadout, flatReadout) ) {
     180    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    177181        psError(PS_ERR_UNKNOWN,true,"Test G - Returned true should be false");
    178182        return 7;
     
    189193    temp = inReadout->mask;
    190194    inReadout->mask = largeMask;
    191     if ( pmFlatField(inReadout, flatReadout) ) {
     195    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    192196        psError(PS_ERR_UNKNOWN,true,"Test H - Returned true should be false");
    193197        return 8;
     
    203207    *(int*)&inReadout->col0 = 50;
    204208    *(int*)&inReadout->row0 = 50;
    205     if ( pmFlatField(inReadout, flatReadout) ) {
     209    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    206210        psError(PS_ERR_UNKNOWN,true,"Test I - Returned true should be false");
    207211        return 9;
     
    217221                            "Complex types not allowed for input image", 0);
    218222    *(psElemType* ) & inReadout->image->type.type = PS_TYPE_C64;
    219     if ( pmFlatField(inReadout, flatReadout) ) {
     223    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    220224        psError(PS_ERR_UNKNOWN,true,"Test J - Returned true should be false");
    221225        return 10;
     
    230234                            "Complex types not allowed for flat image", 0);
    231235    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_C64;
    232     if ( pmFlatField(inReadout, flatReadout) ) {
     236    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    233237        psError(PS_ERR_UNKNOWN,true,"Test K - Returned ture should be false");
    234238        return 11;
     
    243247                            "Input and flat image types differ", 0);
    244248    *(psElemType* ) & flatReadout->image->type.type = PS_TYPE_F32;
    245     if ( pmFlatField(inReadout, flatReadout) ) {
     249    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    246250        psError(PS_ERR_UNKNOWN,true,"Test L - Returned true should be false");
    247251        return 12;
     
    256260                            "Mask must be PS_TYPE_MASK type", 0);
    257261    *(psElemType* ) & inReadout->mask->type.type = PS_TYPE_F32;
    258     if ( pmFlatField(inReadout, flatReadout) ) {
     262    if ( pmFlatField(inReadout, NULL, flatReadout) ) {
    259263        psError(PS_ERR_UNKNOWN,true,"Test M - Returned true should be false");
    260264        return 13;
  • trunk/psModules/test/tst_pmImageCombine.c

    r4579 r4770  
    99 *  XXX: Must verify the results internally.  Don't use stdout file.
    1010 *
    11  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-07-19 01:44:48 $
     11 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-08-16 01:10:36 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525int main(int argc, char* argv[])
    2626{
     27    psLogSetFormat("HLNM");
    2728    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    2829}
  • trunk/psModules/test/tst_pmMaskBadPixels.c

    r2951 r4770  
    1717 *  @author Ross Harman, MHPCC
    1818 *
    19  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    20  *  @date $Date: 2005-01-11 01:30:16 $
     19 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     20 *  @date $Date: 2005-08-16 01:10:36 $
    2121 *
    2222 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8787int main(int argc, char* argv[])
    8888{
     89    psLogSetFormat("HLNM");
    8990    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    9091}
     
    9697    CREATE_AND_SET_IMAGE(inImage1,F64,0,50,50);
    9798    CREATE_AND_SET_IMAGE(mask1,U8,0,50,50)
    98     //    psReadout *inReadout = psReadoutAlloc(0, 0, inImage1);
    99     psReadout *inReadout = psReadoutAlloc();
     99    //    pmReadout *inReadout = pmReadoutAlloc(0, 0, inImage1);
     100    pmReadout *inReadout = pmReadoutAlloc(NULL);
    100101    inReadout->image = inImage1;
    101102    mask1->data.PS_TYPE_MASK_DATA[24][24]=1;
     
    114115    CREATE_AND_SET_IMAGE(inImage2,F64,150.0,50,50);
    115116    CREATE_AND_SET_IMAGE(mask2,U8,0,50,50)
    116     //    psReadout *inReadout2 = psReadoutAlloc(0, 0, inImage2);
    117     psReadout *inReadout2 = psReadoutAlloc();
     117    //    pmReadout *inReadout2 = pmReadoutAlloc(0, 0, inImage2);
     118    pmReadout *inReadout2 = pmReadoutAlloc(NULL);
    118119    inReadout2->image = inImage2;
    119120    PRINT_MATRIX(mask2, U8, "Data mask:");
     
    131132    CREATE_AND_SET_IMAGE(inImage3,F64,50.0,50,50);
    132133    CREATE_AND_SET_IMAGE(mask3,U8,0,50,50)
    133     //    psReadout *inReadout3 = psReadoutAlloc(0, 0, inImage3);
    134     psReadout *inReadout3 = psReadoutAlloc();
     134    //    pmReadout *inReadout3 = pmReadoutAlloc(0, 0, inImage3);
     135    pmReadout *inReadout3 = pmReadoutAlloc(NULL);
    135136    inReadout3->image = inImage3;
    136137    mask3->data.PS_TYPE_MASK_DATA[24][24]=1;
     
    152153    CREATE_AND_SET_IMAGE(mask4,U8,0,50,50)
    153154    CREATE_AND_SET_IMAGE(mask4i,U8,0,50,50)
    154     //    psReadout *inReadout4 = psReadoutAlloc(0, 0, inImage4);
    155     psReadout *inReadout4 = psReadoutAlloc();
     155    //    pmReadout *inReadout4 = pmReadoutAlloc(0, 0, inImage4);
     156    pmReadout *inReadout4 = pmReadoutAlloc(NULL);
    156157    inReadout4->image = inImage4;
    157158    inReadout4->mask = mask4i;
     
    170171    // Test E - Attempt to use null mask
    171172    CREATE_AND_SET_IMAGE(inImage5,F64,50.0,50,50);
    172     //    psReadout *inReadout5 = psReadoutAlloc(0, 0, inImage5);
    173     psReadout *inReadout5 = psReadoutAlloc();
     173    //    pmReadout *inReadout5 = pmReadoutAlloc(0, 0, inImage5);
     174    pmReadout *inReadout5 = pmReadoutAlloc(NULL);
    174175    inReadout5->image = inImage5;
    175176    pmMaskBadPixels(inReadout5, NULL, 0, 100.0, 1, 10);
     
    183184    // Test F - Attempt tp use null input image
    184185    CREATE_AND_SET_IMAGE(mask6,U8,0,50,50)
    185     //    psReadout *inReadout6 = psReadoutAlloc(0, 0, NULL);
    186     psReadout *inReadout6 = psReadoutAlloc();
     186    //    pmReadout *inReadout6 = pmReadoutAlloc(0, 0, NULL);
     187    pmReadout *inReadout6 = pmReadoutAlloc(NULL);
    187188    inReadout6->mask = mask6;
    188189    pmMaskBadPixels(inReadout6, mask6, 0, 100.0, 1, 10);
     
    198199    CREATE_AND_SET_IMAGE(mask7,U8,0,50,50)
    199200    CREATE_AND_SET_IMAGE(mask7i,U8,0,50,50)
    200     //    psReadout *inReadout7 = psReadoutAlloc(0, 0, inImage7);
    201     psReadout *inReadout7 = psReadoutAlloc();
     201    //    pmReadout *inReadout7 = pmReadoutAlloc(0, 0, inImage7);
     202    pmReadout *inReadout7 = pmReadoutAlloc(NULL);
    202203    inReadout7->image = inImage7;
    203204    inReadout7->mask = mask7i;
     
    215216    CREATE_AND_SET_IMAGE(mask8,U8,0,50,50)
    216217    CREATE_AND_SET_IMAGE(mask8i,U8,0,60,60)
    217     //    psReadout *inReadout8 = psReadoutAlloc(0, 0, inImage8);
    218     psReadout *inReadout8 = psReadoutAlloc();
     218    //    pmReadout *inReadout8 = pmReadoutAlloc(0, 0, inImage8);
     219    pmReadout *inReadout8 = pmReadoutAlloc(NULL);
    219220    inReadout8->image = inImage8;
    220221    inReadout8->mask = mask8i;
     
    232233    CREATE_AND_SET_IMAGE(mask9,U8,0,50,50)
    233234    CREATE_AND_SET_IMAGE(mask9i,U8,0,50,50)
    234     //    psReadout *inReadout9 = psReadoutAlloc(0, 0, inImage9);
    235     psReadout *inReadout9 = psReadoutAlloc();
     235    //    pmReadout *inReadout9 = pmReadoutAlloc(0, 0, inImage9);
     236    pmReadout *inReadout9 = pmReadoutAlloc(NULL);
    236237    inReadout9->image = inImage9;
    237238    inReadout9->mask = mask9i;
     
    251252    CREATE_AND_SET_IMAGE(mask10,U8,0,50,50)
    252253    CREATE_AND_SET_IMAGE(mask10i,U8,0,50,50)
    253     //    psReadout *inReadout10 = psReadoutAlloc(0, 0, inImage10);
    254     psReadout *inReadout10 = psReadoutAlloc();
     254    //    pmReadout *inReadout10 = pmReadoutAlloc(0, 0, inImage10);
     255    pmReadout *inReadout10 = pmReadoutAlloc(NULL);
    255256    inReadout10->image = inImage10;
    256257    inReadout10->mask = mask10i;
     
    268269    CREATE_AND_SET_IMAGE(mask11,F64,0,50,50)
    269270    CREATE_AND_SET_IMAGE(mask11i,U8,0,50,50)
    270     //    psReadout *inReadout11 = psReadoutAlloc(0, 0, inImage11);
    271     psReadout *inReadout11 = psReadoutAlloc();
     271    //    pmReadout *inReadout11 = pmReadoutAlloc(0, 0, inImage11);
     272    pmReadout *inReadout11 = pmReadoutAlloc(NULL);
    272273    inReadout11->image = inImage11;
    273274    inReadout11->mask = mask11i;
  • trunk/psModules/test/tst_pmNonLinear.c

    r2961 r4770  
    1616 *  @author GLG, MHPCC
    1717 *
    18  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    19  *  @date $Date: 2005-01-11 23:39:41 $
     18 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     19 *  @date $Date: 2005-08-16 01:10:36 $
    2020 *
    2121 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4040int main(int argc, char* argv[])
    4141{
     42    psLogSetFormat("HLNM");
    4243    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    4344}
     
    5354    int testStatus = true;
    5455    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    55     psReadout *myReadout = psReadoutAlloc();
     56    pmReadout *myReadout = pmReadoutAlloc(NULL);
    5657    myReadout->image = myImage;
    5758    psPolynomial1D *myPoly = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD);
     
    106107    int tableSize = PS_MAX(numCols, numRows)*2;
    107108    psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    108     psReadout *myReadout = psReadoutAlloc();
     109    pmReadout *myReadout = pmReadoutAlloc(NULL);
    109110    myReadout->image = myImage;
    110111    psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
     
    161162    int testStatus = true;
    162163    psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
    163     psReadout *myReadout = psReadoutAlloc();
    164     psReadout *rc = NULL;
     164    pmReadout *myReadout = pmReadoutAlloc(NULL);
     165    pmReadout *rc = NULL;
    165166    myReadout->image = myImage;
    166167    psPolynomial1D *myPoly = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD);
     
    178179    rc = pmNonLinearityPolynomial(NULL, myPoly);
    179180    if (rc != NULL) {
    180         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     181        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    181182        testStatus = false;
    182183    }
     
    188189    rc = pmNonLinearityPolynomial(myReadout, myPoly);
    189190    if (rc != NULL) {
    190         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     191        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    191192        testStatus = false;
    192193    }
     
    197198    rc = pmNonLinearityPolynomial(myReadout, NULL);
    198199    if (rc != NULL) {
    199         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     200        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    200201        testStatus = false;
    201202    }
     
    207208
    208209
    209 int test03Init(psReadout *myReadout)
     210int test03Init(pmReadout *myReadout)
    210211{
    211212    for (psS32 i=0;i<NUM_ROWS;i++) {
     
    224225    int tableSize = PS_MAX(NUM_COLS, NUM_ROWS)*3;
    225226    psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32);
    226     psReadout *myReadout = psReadoutAlloc();
    227     psReadout *rc = NULL;
     227    pmReadout *myReadout = pmReadoutAlloc(NULL);
     228    pmReadout *rc = NULL;
    228229    myReadout->image = myImage;
    229230    psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32);
     
    253254
    254255    printf("------------------------------------------------------------\n");
    255     printf("Calling pmNonLinearityLookup() with NULL input psReadout.  Should generate error, return NULL.\n");
     256    printf("Calling pmNonLinearityLookup() with NULL input pmReadout.  Should generate error, return NULL.\n");
    256257    rc = pmNonLinearityLookup(NULL, in, out);
    257258    if (rc != NULL) {
    258         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
    259         testStatus = false;
    260     }
    261 
    262     printf("------------------------------------------------------------\n");
    263     printf("Calling pmNonLinearityLookup() with NULL input psReadout->image.  Should generate error, return NULL.\n");
     259        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
     260        testStatus = false;
     261    }
     262
     263    printf("------------------------------------------------------------\n");
     264    printf("Calling pmNonLinearityLookup() with NULL input pmReadout->image.  Should generate error, return NULL.\n");
    264265    psImage *tmpImage = myReadout->image;
    265266    myReadout->image = NULL;
    266267    rc = pmNonLinearityLookup(myReadout, in, out);
    267268    if (rc != NULL) {
    268         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     269        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    269270        testStatus = false;
    270271    }
     
    275276    rc = pmNonLinearityLookup(myReadout, NULL, out);
    276277    if (rc != NULL) {
    277         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     278        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    278279        testStatus = false;
    279280    }
     
    283284    rc = pmNonLinearityLookup(myReadout, in, NULL);
    284285    if (rc != NULL) {
    285         printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n");
     286        printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL pmReadout\n");
    286287        testStatus = false;
    287288    }
     
    292293    rc = pmNonLinearityLookup(myReadout, in, outBig);
    293294    if (rc == NULL) {
    294         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     295        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    295296        testStatus = false;
    296297    }
     
    312313    rc = pmNonLinearityLookup(myReadout, in, outSmall);
    313314    if (rc == NULL) {
    314         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     315        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    315316        testStatus = false;
    316317    }
     
    331332    rc = pmNonLinearityLookup(myReadout, inSmall, out);
    332333    if (rc == NULL) {
    333         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     334        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    334335        testStatus = false;
    335336    }
     
    350351    rc = pmNonLinearityLookup(myReadout, inBig, out);
    351352    if (rc == NULL) {
    352         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     353        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    353354        testStatus = false;
    354355    }
     
    369370    rc = pmNonLinearityLookup(myReadout, inSmall, outBig);
    370371    if (rc == NULL) {
    371         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     372        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    372373        testStatus = false;
    373374    }
     
    388389    rc = pmNonLinearityLookup(myReadout, inBig, outSmall);
    389390    if (rc == NULL) {
    390         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
    391         testStatus = false;
    392     }
    393     for (i=0;i<NUM_ROWS;i++) {
    394         for (j=0;j<NUM_COLS;j++) {
    395             psF32 expect = (float) (2 * (i + j));
    396             psF32 actual = rc->image->data.F32[i][j];
    397             if (FLT_EPSILON < fabs(expect - actual)) {
    398                 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
    399                 testStatus = false;
    400             }
    401         }
    402     }
    403 
    404     test03Init(myReadout);
    405     printf("------------------------------------------------------------\n");
    406     printf("Calling pmNonLinearityLookup() with inFlux psVector size 1.  Should generate error, return original psReadout.\n");
     391        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
     392        testStatus = false;
     393    }
     394    for (i=0;i<NUM_ROWS;i++) {
     395        for (j=0;j<NUM_COLS;j++) {
     396            psF32 expect = (float) (2 * (i + j));
     397            psF32 actual = rc->image->data.F32[i][j];
     398            if (FLT_EPSILON < fabs(expect - actual)) {
     399                printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);
     400                testStatus = false;
     401            }
     402        }
     403    }
     404
     405    test03Init(myReadout);
     406    printf("------------------------------------------------------------\n");
     407    printf("Calling pmNonLinearityLookup() with inFlux psVector size 1.  Should generate error, return original pmReadout.\n");
    407408    rc = pmNonLinearityLookup(myReadout, inOne, out);
    408409    if (rc != myReadout) {
    409         printf("TEST ERROR: pmNonLinearityPolynomial() did not return the original psReadout\n");
     410        printf("TEST ERROR: pmNonLinearityPolynomial() did not return the original pmReadout\n");
    410411        testStatus = false;
    411412    }
     
    427428    rc = pmNonLinearityLookup(myReadout, in, out);
    428429    if (rc == NULL) {
    429         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     430        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    430431        testStatus = false;
    431432    }
     
    453454    rc = pmNonLinearityLookup(myReadout, in, out);
    454455    if (rc == NULL) {
    455         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     456        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    456457        testStatus = false;
    457458    }
     
    479480    rc = pmNonLinearityLookup(myReadout, in, out);
    480481    if (rc == NULL) {
    481         printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n");
     482        printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL pmReadout\n");
    482483        testStatus = false;
    483484    }
  • trunk/psModules/test/tst_pmObjects01.c

    r4579 r4770  
    1919 * abd never deallocate, no error is generated.
    2020 *
    21  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2005-07-19 01:44:48 $
     21 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2005-08-16 01:10:36 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6363int main(int argc, char* argv[])
    6464{
     65    psLogSetFormat("HLNM");
    6566    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    66     //    test02();
    6767}
    6868
     
    7676
    7777    printf("Testing pmPeakAlloc()...\n");
    78     psPeak *tmpPeak = pmPeakAlloc(1, 2, 3.0, PM_PEAK_LONE);
     78    pmPeak *tmpPeak = pmPeakAlloc(1, 2, 3.0, PM_PEAK_LONE);
    7979    if (tmpPeak == NULL) {
    80         printf("TEST ERROR: pmPeakAlloc() returned a NULL psPeak\n");
     80        printf("TEST ERROR: pmPeakAlloc() returned a NULL pmPeak\n");
    8181        testStatus = false;
    8282    } else {
    8383        if (tmpPeak->x != 1) {
    84             printf("TEST ERROR: pmPeakAlloc() improperly set psPeak->x\n");
     84            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->x\n");
    8585            testStatus = false;
    8686        }
    8787        if (tmpPeak->y != 2) {
    88             printf("TEST ERROR: pmPeakAlloc() improperly set psPeak->y\n");
     88            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->y\n");
    8989            testStatus = false;
    9090        }
    9191        if (tmpPeak->counts != 3.0) {
    92             printf("TEST ERROR: pmPeakAlloc() improperly set psPeak->counts\n");
     92            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->counts\n");
    9393            testStatus = false;
    9494        }
    9595        if (tmpPeak->class != PM_PEAK_LONE) {
    96             printf("TEST ERROR: pmPeakAlloc() improperly set psPeak->class\n");
     96            printf("TEST ERROR: pmPeakAlloc() improperly set pmPeak->class\n");
    9797            testStatus = false;
    9898        }
     
    101101
    102102    printf("Testing pmMomentsAlloc()...\n");
    103     psMoments *tmpMoments = pmMomentsAlloc();
     103    pmMoments *tmpMoments = pmMomentsAlloc();
    104104    if (tmpMoments == NULL) {
    105         printf("TEST ERROR: pmMomentsAlloc() returned a NULL psMoments\n");
     105        printf("TEST ERROR: pmMomentsAlloc() returned a NULL pmMoments\n");
    106106        testStatus = false;
    107107    } else {
     
    115115                (fabs(tmpMoments->Sky-0.0) > ERROR_TOL) ||
    116116                (tmpMoments->nPixels != 0)) {
    117             printf("TEST ERROR: pmMomentsAlloc() did not properly initialize the psMoments structure.\n");
     117            printf("TEST ERROR: pmMomentsAlloc() did not properly initialize the pmMoments structure.\n");
    118118            testStatus = false;
    119119        }
     
    122122
    123123    printf("Testing pmModelAlloc(PS_MODEL_GAUSS)...\n");
    124     psModel *tmpModel = pmModelAlloc(PS_MODEL_GAUSS);
     124    pmModel *tmpModel = pmModelAlloc(PS_MODEL_GAUSS);
    125125    if (tmpModel == NULL) {
    126         printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) returned a NULL psModel\n");
     126        printf("TEST ERROR: pmModelAlloc(PS_MODEL_GAUSS) returned a NULL pmModel\n");
    127127        testStatus = false;
    128128    } else {
     
    146146    tmpModel = pmModelAlloc(PS_MODEL_PGAUSS);
    147147    if (tmpModel == NULL) {
    148         printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) returned a NULL psModel\n");
     148        printf("TEST ERROR: pmModelAlloc(PS_MODEL_PGAUSS) returned a NULL pmModel\n");
    149149        testStatus = false;
    150150    } else {
     
    168168    tmpModel = pmModelAlloc(PS_MODEL_TWIST_GAUSS);
    169169    if (tmpModel == NULL) {
    170         printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) returned a NULL psModel\n");
     170        printf("TEST ERROR: pmModelAlloc(PS_MODEL_TWIST_GAUSS) returned a NULL pmModel\n");
    171171        testStatus = false;
    172172    } else {
     
    190190    tmpModel = pmModelAlloc(PS_MODEL_WAUSS);
    191191    if (tmpModel == NULL) {
    192         printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) returned a NULL psModel\n");
     192        printf("TEST ERROR: pmModelAlloc(PS_MODEL_WAUSS) returned a NULL pmModel\n");
    193193        testStatus = false;
    194194    } else {
     
    212212    tmpModel = pmModelAlloc(PS_MODEL_SERSIC);
    213213    if (tmpModel == NULL) {
    214         printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) returned a NULL psModel\n");
     214        printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC) returned a NULL pmModel\n");
    215215        testStatus = false;
    216216    } else {
     
    234234    tmpModel = pmModelAlloc(PS_MODEL_SERSIC_CORE);
    235235    if (tmpModel == NULL) {
    236         printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) returned a NULL psModel\n");
     236        printf("TEST ERROR: pmModelAlloc(PS_MODEL_SERSIC_CORE) returned a NULL pmModel\n");
    237237        testStatus = false;
    238238    } else {
     
    253253    psFree(tmpModel);
    254254
    255     psSource *tmpSource = pmSourceAlloc();
     255    pmSource *tmpSource = pmSourceAlloc();
    256256    if (tmpSource == NULL) {
    257         printf("TEST ERROR: pmSourceAlloc() returned a NULL psSource\n");
     257        printf("TEST ERROR: pmSourceAlloc() returned a NULL pmSource\n");
    258258        testStatus = false;
    259259    }
     
    545545        // HEY: verify
    546546        for (psS32 i = 0 ; i < outData->n ; i++) {
    547             psPeak *tmpPeak = (psPeak *) outData->data[i];
     547            pmPeak *tmpPeak = (pmPeak *) outData->data[i];
    548548            if (((tmpPeak->x == 0) && (tmpPeak->y == 0)) ||
    549549                    ((tmpPeak->x == 0) && (tmpPeak->y == numRows-1)) ||
     
    803803        }
    804804    }
    805     psSource *rc = NULL;
    806     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST04_NUM_ROWS / 2),
     805    pmSource *rc = NULL;
     806    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST04_NUM_ROWS / 2),
    807807                                  (psF32) (TST04_NUM_COLS / 2),
    808808                                  200.0,
     
    813813    rc = pmSourceLocalSky(NULL, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
    814814    if (rc != NULL) {
    815         printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     815        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    816816        psFree(rc);
    817817        testStatus = false;
     
    822822    rc = pmSourceLocalSky(imgDataF64, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
    823823    if (rc != NULL) {
    824         printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     824        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    825825        psFree(rc);
    826826        testStatus = false;
     
    828828
    829829    printf("----------------------------------------------------------------------------------\n");
    830     printf("Calling pmSourceLocalSky with NULL psPeak.  Should generate error and return NULL.\n");
     830    printf("Calling pmSourceLocalSky with NULL pmPeak.  Should generate error and return NULL.\n");
    831831    rc = pmSourceLocalSky(imgData, NULL, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
    832832    if (rc != NULL) {
    833         printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     833        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    834834        psFree(rc);
    835835        testStatus = false;
     
    840840    rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, -10.0, 20.0);
    841841    if (rc != NULL) {
    842         printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     842        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    843843        psFree(rc);
    844844        testStatus = false;
     
    849849    rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 5.0);
    850850    if (rc != NULL) {
    851         printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     851        printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    852852        psFree(rc);
    853853        testStatus = false;
     
    861861        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
    862862        if (rc != NULL) {
    863             printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     863            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    864864            psFree(rc);
    865865            testStatus = false;
     
    872872        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
    873873        if (rc != NULL) {
    874             printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     874            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    875875            psFree(rc);
    876876            testStatus = false;
     
    883883        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);
    884884        if (rc != NULL) {
    885             printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     885            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    886886            psFree(rc);
    887887            testStatus = false;
     
    894894        rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, (psF32) TST04_INNER_RADIUS, (psF32) TST04_OUTER_RADIUS);
    895895        if (rc != NULL) {
    896             printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");
     896            printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL pmSource.\n");
    897897            psFree(rc);
    898898            testStatus = false;
     
    915915
    916916    if (rc == NULL) {
    917         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
     917        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
    918918        testStatus = false;
    919919    } else {
    920920        if (rc->peak == NULL) {
    921             printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource->peak.\n");
     921            printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource->peak.\n");
    922922            testStatus = false;
    923923        } else {
    924924            if (rc->peak->x != tmpPeak->x) {
    925                 printf("TEST ERROR: pmSourceLocalSky() psSource->peak->x was %d, should have been %d.\n", rc->peak->x, tmpPeak->x);
     925                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->x was %d, should have been %d.\n", rc->peak->x, tmpPeak->x);
    926926                testStatus = false;
    927927            }
    928928
    929929            if (rc->peak->y != tmpPeak->y) {
    930                 printf("TEST ERROR: pmSourceLocalSky() psSource->peak->y was %d, should have been %d.\n", rc->peak->y, tmpPeak->y);
     930                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->y was %d, should have been %d.\n", rc->peak->y, tmpPeak->y);
    931931                testStatus = false;
    932932            }
    933933
    934934            if (rc->peak->counts != tmpPeak->counts) {
    935                 printf("TEST ERROR: pmSourceLocalSky() psSource->peak->counts was %f, should have been %f.\n", rc->peak->counts, tmpPeak->counts);
     935                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->counts was %f, should have been %f.\n", rc->peak->counts, tmpPeak->counts);
    936936                testStatus = false;
    937937            }
    938938
    939939            if (rc->peak->class != tmpPeak->class) {
    940                 printf("TEST ERROR: pmSourceLocalSky() psSource->peak->class was %d, should have been %d.\n", rc->peak->class, tmpPeak->class);
     940                printf("TEST ERROR: pmSourceLocalSky() pmSource->peak->class was %d, should have been %d.\n", rc->peak->class, tmpPeak->class);
    941941                testStatus = false;
    942942            }
     
    944944
    945945        if (rc->pixels == NULL) {
    946             printf("TEST ERROR: pmSourceLocalSky() psSource->pixels was NULL.\n");
     946            printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels was NULL.\n");
    947947            testStatus = false;
    948948        } else {
    949949            if (rc->pixels->numRows != (2 * TST04_OUTER_RADIUS)) {
    950                 printf("TEST ERROR: pmSourceLocalSky() psSource->pixels->numRows was %d, should have been %d.\n",
     950                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->numRows was %d, should have been %d.\n",
    951951                       rc->pixels->numRows, (2 * TST04_OUTER_RADIUS));
    952952                testStatus = false;
     
    954954
    955955            if (rc->pixels->numCols != (2 * TST04_OUTER_RADIUS)) {
    956                 printf("TEST ERROR: pmSourceLocalSky() psSource->pixels->numCols was %d, should have been %d.\n",
     956                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->numCols was %d, should have been %d.\n",
    957957                       rc->pixels->numCols, (2 * TST04_OUTER_RADIUS));
    958958                testStatus = false;
     
    960960
    961961            if (rc->pixels->col0 != (tmpPeak->x - TST04_OUTER_RADIUS)) {
    962                 printf("TEST ERROR: pmSourceLocalSky() psSource->pixels->col0 was %d, should have been %d.\n",
     962                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->col0 was %d, should have been %d.\n",
    963963                       rc->pixels->col0, (tmpPeak->x - TST04_OUTER_RADIUS));
    964964                testStatus = false;
     
    966966
    967967            if (rc->pixels->row0 != (tmpPeak->y - TST04_OUTER_RADIUS)) {
    968                 printf("TEST ERROR: pmSourceLocalSky() psSource->pixels->row0 was %d, should have been %d.\n",
     968                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->row0 was %d, should have been %d.\n",
    969969                       rc->pixels->row0, (tmpPeak->y - TST04_OUTER_RADIUS));
    970970                testStatus = false;
     
    972972
    973973            if (rc->pixels->type.type != PS_TYPE_F32) {
    974                 printf("TEST ERROR: pmSourceLocalSky() psSource->pixels->type was %d, should have been %d.\n",
     974                printf("TEST ERROR: pmSourceLocalSky() pmSource->pixels->type was %d, should have been %d.\n",
    975975                       rc->pixels->type.type, PS_TYPE_F32);
    976976                testStatus = false;
     
    982982
    983983        if (rc->mask == NULL) {
    984             printf("TEST ERROR: pmSourceLocalSky() psSource->mask was NULL.\n");
     984            printf("TEST ERROR: pmSourceLocalSky() pmSource->mask was NULL.\n");
    985985            testStatus = false;
    986986        } else {
    987987            if (rc->mask->numRows != (2 * TST04_OUTER_RADIUS)) {
    988                 printf("TEST ERROR: pmSourceLocalSky() psSource->mask->numRows was %d, should have been %d.\n",
     988                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask->numRows was %d, should have been %d.\n",
    989989                       rc->mask->numRows, (2 * TST04_OUTER_RADIUS));
    990990                testStatus = false;
     
    992992
    993993            if (rc->mask->numCols != (2 * TST04_OUTER_RADIUS)) {
    994                 printf("TEST ERROR: pmSourceLocalSky() psSource->mask->numCols was %d, should have been %d.\n",
     994                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask->numCols was %d, should have been %d.\n",
    995995                       rc->mask->numCols, (2 * TST04_OUTER_RADIUS));
    996996                testStatus = false;
     
    998998
    999999            if (rc->mask->type.type != PS_TYPE_U8) {
    1000                 printf("TEST ERROR: pmSourceLocalSky() psSource->mask->type was %d, should have been %d.\n",
     1000                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask->type was %d, should have been %d.\n",
    10011001                       rc->mask->type.type, PS_TYPE_U8);
    10021002                testStatus = false;
     
    10181018            }
    10191019            if (maskedPixels != PS_SQR(2*(TST04_INNER_RADIUS-1))) {
    1020                 printf("TEST ERROR: pmSourceLocalSky() psSource->mask had %d masked pixels, should have been %d.\n",
     1020                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask had %d masked pixels, should have been %d.\n",
    10211021                       maskedPixels, PS_SQR(2*(TST04_INNER_RADIUS-1)));
    10221022                testStatus = false;
    10231023            }
    10241024            if (unmaskedPixels != (PS_SQR(2*TST04_OUTER_RADIUS) - PS_SQR(2*(TST04_INNER_RADIUS-1)))) {
    1025                 printf("TEST ERROR: pmSourceLocalSky() psSource->mask had %d masked pixels, should have been %d.\n",
     1025                printf("TEST ERROR: pmSourceLocalSky() pmSource->mask had %d masked pixels, should have been %d.\n",
    10261026                       unmaskedPixels, (PS_SQR(2*TST04_OUTER_RADIUS) - PS_SQR(2*(TST04_INNER_RADIUS-1))));
    10271027                testStatus = false;
     
    10301030
    10311031        if (rc->moments == NULL) {
    1032             printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource->moments.\n");
     1032            printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource->moments.\n");
    10331033            testStatus = false;
    10341034        } else {
    10351035            if (rc->moments->Sky != TST04_SKY) {
    1036                 printf("TEST ERROR: pmSourceLocalSky() psSource->moments->Sky was %f, should have been %f.\n", rc->moments->Sky, TST04_SKY);
     1036                printf("TEST ERROR: pmSourceLocalSky() pmSource->moments->Sky was %f, should have been %f.\n", rc->moments->Sky, TST04_SKY);
    10371037                testStatus = false;
    10381038            }
     
    10631063{
    10641064    bool testStatus = true;
    1065     psSource *tmpSource = NULL;
     1065    pmSource *tmpSource = NULL;
    10661066    bool rc = false;
    10671067    // Create the image used in this test.
     
    10801080
    10811081    //
    1082     // Create a psPeak with the center pixel set to the peak.
    1083     //
    1084     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST06_NUM_ROWS / 2),
     1082    // Create a pmPeak with the center pixel set to the peak.
     1083    //
     1084    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST06_NUM_ROWS / 2),
    10851085                                  (psF32) (TST06_NUM_COLS / 2),
    10861086                                  200.0,
     
    10931093                                 (psF32) TST06_OUTER_RADIUS);
    10941094    if (tmpSource == NULL) {
    1095         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
     1095        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
    10961096        psFree(imgData);
    10971097        psFree(imgDataF64);
     
    11021102
    11031103    printf("----------------------------------------------------------------------------------\n");
    1104     printf("Calling pmSourceSetPixelsCircle with NULL psSource.  Should generate error and return NULL.\n");
     1104    printf("Calling pmSourceSetPixelsCircle with NULL pmSource.  Should generate error and return NULL.\n");
    11051105    rc = pmSourceSetPixelsCircle(NULL, imgData, 10.0);
    11061106    if (rc == true) {
     
    11081108        testStatus = false;
    11091109    }
    1110     // XXX: test with psSource->peaks NULL
     1110    // XXX: test with pmSource->peaks NULL
    11111111
    11121112    printf("----------------------------------------------------------------------------------\n");
     
    12181218{
    12191219    bool testStatus = true;
    1220     psSource *tmpSource = NULL;
    1221     psSource *rc = NULL;
     1220    pmSource *tmpSource = NULL;
     1221    pmSource *rc = NULL;
    12221222    // Create the image used in this test.
    12231223    psImage *imgData = psImageAlloc(TST05_NUM_COLS, TST05_NUM_ROWS, PS_TYPE_F32);
     
    12291229
    12301230    //
    1231     // Create a psPeak with the center pixel set to the peak.
    1232     //
    1233     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST05_NUM_ROWS / 2),
     1231    // Create a pmPeak with the center pixel set to the peak.
     1232    //
     1233    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST05_NUM_ROWS / 2),
    12341234                                  (psF32) (TST05_NUM_COLS / 2),
    12351235                                  200.0,
     
    12421242                                 (psF32) TST05_OUTER_RADIUS);
    12431243    if (tmpSource == NULL) {
    1244         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
     1244        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
    12451245        psFree(tmpSource);
    12461246        testStatus = false;
     
    12491249
    12501250    printf("----------------------------------------------------------------------------------\n");
    1251     printf("Calling pmSourceMoments with NULL psSource.  Should generate error and return NULL.\n");
     1251    printf("Calling pmSourceMoments with NULL pmSource.  Should generate error and return NULL.\n");
    12521252    rc = pmSourceMoments(NULL, 10.0);
    12531253    if (rc != NULL) {
    1254         printf("TEST ERROR: pmSourceMoments() returned a non-NULL psSource.\n");
    1255         testStatus = false;
    1256     }
    1257     // XXX: test with psSource->peaks NULL
    1258     // XXX: test with psSource->pixels NULL
    1259     // XXX: test with psSource->mask NULL
     1254        printf("TEST ERROR: pmSourceMoments() returned a non-NULL pmSource.\n");
     1255        testStatus = false;
     1256    }
     1257    // XXX: test with pmSource->peaks NULL
     1258    // XXX: test with pmSource->pixels NULL
     1259    // XXX: test with pmSource->mask NULL
    12601260
    12611261    printf("----------------------------------------------------------------------------------\n");
     
    12631263    rc = pmSourceMoments(tmpSource, -10.0);
    12641264    if (rc != NULL) {
    1265         printf("TEST ERROR: pmSourceMoments() returned a non-NULL psSource.\n");
     1265        printf("TEST ERROR: pmSourceMoments() returned a non-NULL pmSource.\n");
    12661266        testStatus = false;
    12671267    }
     
    14851485        }
    14861486    }
    1487     psSource *mySrc = NULL;
     1487    pmSource *mySrc = NULL;
    14881488    bool rc = false;
    1489     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST04_NUM_ROWS / 2),
     1489    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST04_NUM_ROWS / 2),
    14901490                                  (psF32) (TST04_NUM_COLS / 2),
    14911491                                  200.0,
     
    15021502
    15031503    if (mySrc == NULL) {
    1504         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
    1505         testStatus = false;
    1506     }
    1507 
    1508     printf("----------------------------------------------------------------------------------\n");
    1509     printf("Calling pmSourceModelGuess with NULL psSource.  Should generate error, return FALSE.\n");
     1504        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
     1505        testStatus = false;
     1506    }
     1507
     1508    printf("----------------------------------------------------------------------------------\n");
     1509    printf("Calling pmSourceModelGuess with NULL pmSource.  Should generate error, return FALSE.\n");
    15101510    rc = pmSourceModelGuess(NULL, imgData, PS_MODEL_GAUSS);
    15111511    if (rc == true) {
     
    16061606        }
    16071607    }
    1608     psSource *mySrc = NULL;
     1608    pmSource *mySrc = NULL;
    16091609    psArray *rc = NULL;
    16101610
    1611     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST09_NUM_ROWS / 2),
     1611    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST09_NUM_ROWS / 2),
    16121612                                  (psF32) (TST09_NUM_COLS / 2),
    16131613                                  200.0,
     
    16241624
    16251625    if (mySrc == NULL) {
    1626         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
     1626        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
    16271627        testStatus = false;
    16281628    }
     
    16351635
    16361636    printf("----------------------------------------------------------------------------------\n");
    1637     printf("Calling pmSourceContour with NULL psSource .  Should generate error, return NULL.\n");
     1637    printf("Calling pmSourceContour with NULL pmSource .  Should generate error, return NULL.\n");
    16381638    rc = pmSourceContour(NULL, imgData, LEVEL, PS_CONTOUR_CRUDE);
    16391639    if (rc != NULL) {
     
    16601660        printf("Calling pmSourceContour with acceptable data.\n");
    16611661        printf("NOTE: must figure out the parameters for this test to be meaningful.\n");
    1662         mySrc->models->params->data.F32[0] = TST09_SKY;
    1663         mySrc->models->params->data.F32[1] = 15.0;
    1664         mySrc->models->params->data.F32[2] = (psF32) (TST09_NUM_ROWS / 2);
    1665         mySrc->models->params->data.F32[3] = (psF32) (TST09_NUM_COLS / 2);
    1666         mySrc->models->params->data.F32[4] = 2.0;
    1667         mySrc->models->params->data.F32[5] = 2.0;
    1668         mySrc->models->params->data.F32[6] = 2.0;
     1662        mySrc->modelPSF->params->data.F32[0] = TST09_SKY;
     1663        mySrc->modelPSF->params->data.F32[1] = 15.0;
     1664        mySrc->modelPSF->params->data.F32[2] = (psF32) (TST09_NUM_ROWS / 2);
     1665        mySrc->modelPSF->params->data.F32[3] = (psF32) (TST09_NUM_COLS / 2);
     1666        mySrc->modelPSF->params->data.F32[4] = 2.0;
     1667        mySrc->modelPSF->params->data.F32[5] = 2.0;
     1668        mySrc->modelPSF->params->data.F32[6] = 2.0;
    16691669        rc = pmSourceContour(mySrc, imgData, LEVEL, PS_CONTOUR_CRUDE);
    16701670        if (rc == NULL) {
     
    17031703        }
    17041704    }
    1705     psSource *mySrc = NULL;
     1705    pmSource *mySrc = NULL;
    17061706    psBool rc = false;
    17071707
    1708     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST15_NUM_ROWS / 2),
     1708    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST15_NUM_ROWS / 2),
    17091709                                  (psF32) (TST15_NUM_COLS / 2),
    17101710                                  200.0,
     
    17211721
    17221722    if (mySrc == NULL) {
    1723         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
    1724         testStatus = false;
    1725     }
    1726 
    1727     mySrc->models = pmModelAlloc(PS_MODEL_GAUSS);
    1728     mySrc->models->params->data.F32[0] = 5.0;
    1729     mySrc->models->params->data.F32[1] = 70.0;
    1730     mySrc->models->params->data.F32[2] = (psF32) (TST15_NUM_ROWS / 2);
    1731     mySrc->models->params->data.F32[3] = (psF32) (TST15_NUM_COLS / 2);
    1732     mySrc->models->params->data.F32[4] = 1.0;
    1733     mySrc->models->params->data.F32[5] = 1.0;
    1734     mySrc->models->params->data.F32[6] = 2.0;
     1723        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
     1724        testStatus = false;
     1725    }
     1726
     1727    mySrc->modelPSF = pmModelAlloc(PS_MODEL_GAUSS);
     1728    mySrc->modelPSF->params->data.F32[0] = 5.0;
     1729    mySrc->modelPSF->params->data.F32[1] = 70.0;
     1730    mySrc->modelPSF->params->data.F32[2] = (psF32) (TST15_NUM_ROWS / 2);
     1731    mySrc->modelPSF->params->data.F32[3] = (psF32) (TST15_NUM_COLS / 2);
     1732    mySrc->modelPSF->params->data.F32[4] = 1.0;
     1733    mySrc->modelPSF->params->data.F32[5] = 1.0;
     1734    mySrc->modelPSF->params->data.F32[6] = 2.0;
    17351735
    17361736    printf("----------------------------------------------------------------------------------\n");
     
    17831783        }
    17841784    }
    1785     psSource *mySrc = NULL;
     1785    pmSource *mySrc = NULL;
    17861786    psBool rc = false;
    17871787
    1788     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST16_NUM_ROWS / 2),
     1788    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST16_NUM_ROWS / 2),
    17891789                                  (psF32) (TST16_NUM_COLS / 2),
    17901790                                  200.0,
     
    18011801
    18021802    if (mySrc == NULL) {
    1803         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
    1804         testStatus = false;
    1805     }
    1806 
    1807     mySrc->models = pmModelAlloc(PS_MODEL_GAUSS);
    1808     mySrc->models->params->data.F32[0] = 5.0;
    1809     mySrc->models->params->data.F32[1] = 70.0;
    1810     mySrc->models->params->data.F32[2] = (psF32) (TST16_NUM_ROWS / 2);
    1811     mySrc->models->params->data.F32[3] = (psF32) (TST16_NUM_COLS / 2);
    1812     mySrc->models->params->data.F32[4] = 1.0;
    1813     mySrc->models->params->data.F32[5] = 1.0;
    1814     mySrc->models->params->data.F32[6] = 2.0;
     1803        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
     1804        testStatus = false;
     1805    }
     1806
     1807    mySrc->modelPSF = pmModelAlloc(PS_MODEL_GAUSS);
     1808    mySrc->modelPSF->params->data.F32[0] = 5.0;
     1809    mySrc->modelPSF->params->data.F32[1] = 70.0;
     1810    mySrc->modelPSF->params->data.F32[2] = (psF32) (TST16_NUM_ROWS / 2);
     1811    mySrc->modelPSF->params->data.F32[3] = (psF32) (TST16_NUM_COLS / 2);
     1812    mySrc->modelPSF->params->data.F32[4] = 1.0;
     1813    mySrc->modelPSF->params->data.F32[5] = 1.0;
     1814    mySrc->modelPSF->params->data.F32[6] = 2.0;
    18151815
    18161816    printf("----------------------------------------------------------------------------------\n");
     
    18631863        }
    18641864    }
    1865     psSource *mySrc = NULL;
     1865    pmSource *mySrc = NULL;
    18661866    psBool rc = false;
    18671867
    1868     psPeak *tmpPeak = pmPeakAlloc((psF32) (TST20_NUM_ROWS / 2),
     1868    pmPeak *tmpPeak = pmPeakAlloc((psF32) (TST20_NUM_ROWS / 2),
    18691869                                  (psF32) (TST20_NUM_COLS / 2),
    18701870                                  200.0,
     
    18811881
    18821882    if (mySrc == NULL) {
    1883         printf("TEST ERROR: pmSourceLocalSky() returned a NULL psSource.\n");
    1884         testStatus = false;
    1885     }
    1886 
    1887     mySrc->models = pmModelAlloc(PS_MODEL_GAUSS);
    1888 
    1889 
    1890     mySrc->models->params->data.F32[0] = 5.0;
    1891     mySrc->models->params->data.F32[1] = 70.0;
    1892     mySrc->models->params->data.F32[2] = (psF32) (TST20_NUM_ROWS / 2);
    1893     mySrc->models->params->data.F32[3] = (psF32) (TST20_NUM_COLS / 2);
    1894     mySrc->models->params->data.F32[4] = 1.0;
    1895     mySrc->models->params->data.F32[5] = 1.0;
    1896     mySrc->models->params->data.F32[6] = 2.0;
     1883        printf("TEST ERROR: pmSourceLocalSky() returned a NULL pmSource.\n");
     1884        testStatus = false;
     1885    }
     1886
     1887    mySrc->modelPSF = pmModelAlloc(PS_MODEL_GAUSS);
     1888
     1889
     1890    mySrc->modelPSF->params->data.F32[0] = 5.0;
     1891    mySrc->modelPSF->params->data.F32[1] = 70.0;
     1892    mySrc->modelPSF->params->data.F32[2] = (psF32) (TST20_NUM_ROWS / 2);
     1893    mySrc->modelPSF->params->data.F32[3] = (psF32) (TST20_NUM_COLS / 2);
     1894    mySrc->modelPSF->params->data.F32[4] = 1.0;
     1895    mySrc->modelPSF->params->data.F32[5] = 1.0;
     1896    mySrc->modelPSF->params->data.F32[6] = 2.0;
    18971897
    18981898    printf("----------------------------------------------------------------------------------\n");
     
    19051905
    19061906    printf("----------------------------------------------------------------------------------\n");
    1907     printf("Calling pmSourceFitModel with NULL psSource.  Should generate error, return FALSE.\n");
     1907    printf("Calling pmSourceFitModel with NULL pmSource.  Should generate error, return FALSE.\n");
    19081908    rc = pmSourceFitModel(NULL, imgData);
    19091909    if (rc == true) {
  • trunk/psModules/test/tst_pmReadoutCombine.c

    r2945 r4770  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-01-10 22:22:52 $
     7 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-08-16 01:10:36 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5656int main(int argc, char* argv[])
    5757{
     58    psLogSetFormat("HLNM");
    5859    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    5960}
     
    118119        *(int *) (& (tmpImage->col0)) = baseCols[r];
    119120        /*
    120                 psReadout *tmpReadout = psReadoutAlloc(baseColsReadout[r],
     121                pmReadout *tmpReadout = pmReadoutAlloc(baseColsReadout[r],
    121122                                                       baseRowsReadout[r],
    122123                                                       tmpImage);
    123124        */
    124         psReadout *tmpReadout = psReadoutAlloc();
     125        pmReadout *tmpReadout = pmReadoutAlloc(NULL);
    125126        tmpReadout->image = tmpImage;
    126127
     
    154155    psListElem *tmpInput = (psListElem *) list->head;
    155156    while (NULL != tmpInput) {
    156         psReadout *tmpReadout = (psReadout *) tmpInput->data;
     157        pmReadout *tmpReadout = (pmReadout *) tmpInput->data;
    157158        psFree(tmpReadout);
    158159        tmpInput = tmpInput->next;
     
    236237        *(int *) (& (tmpImage->col0)) = baseCols[r];
    237238        /*
    238                 psReadout *tmpReadout = psReadoutAlloc(baseColsReadout[r],
     239                pmReadout *tmpReadout = pmReadoutAlloc(baseColsReadout[r],
    239240                                                       baseRowsReadout[r],
    240241                                                       tmpImage);
    241242        */
    242         psReadout *tmpReadout = psReadoutAlloc();
     243        pmReadout *tmpReadout = pmReadoutAlloc(NULL);
    243244        tmpReadout->image = tmpImage;
    244245        minOutRow = PS_MIN(minOutRow, (baseRowsReadout[r] + baseRows[r]));
     
    441442    psListElem *tmpInput = (psListElem *) list->head;
    442443    while (NULL != tmpInput) {
    443         psReadout *tmpReadout = (psReadout *) tmpInput->data;
     444        pmReadout *tmpReadout = (pmReadout *) tmpInput->data;
    444445        psFree(tmpReadout);
    445446        tmpInput = tmpInput->next;
  • trunk/psModules/test/tst_pmSubtractBias.c

    r3582 r4770  
    1414 *  @author GLG, MHPCC
    1515 *
    16  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    17  *  @date $Date: 2005-03-31 02:01:57 $
     16 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     17 *  @date $Date: 2005-08-16 01:10:36 $
    1818 *
    1919 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242int main(int argc, char* argv[])
    4343{
     44    psLogSetFormat("HLNM");
    4445    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    4546}
     
    4849#define NUM_COLS 8
    4950/******************************************************************************
    50 doSubtractBiasFullFrame(): a sample psReadout as well as a bias image are
    51 created and the bias image is subtracted from the psReadout.
     51doSubtractBiasFullFrame(): a sample pmReadout as well as a bias image are
     52created and the bias image is subtracted from the pmReadout.
    5253 *****************************************************************************/
    5354int doSubtractBiasFullFrame(int numCols, int numRows)
     
    6061    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    6162    psImage *tmpImage2 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    62     //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, tmpImage1);
    63     //    psReadout *myBias = psReadoutAlloc(numCols, numRows, tmpImage2);
    64     psReadout *myReadout = psReadoutAlloc();
    65     psReadout *myBias = psReadoutAlloc();
     63    //    pmReadout *myReadout = pmReadoutAlloc(numCols, numRows, tmpImage1);
     64    //    pmReadout *myBias = pmReadoutAlloc(numCols, numRows, tmpImage2);
     65    pmReadout *myReadout = pmReadoutAlloc(NULL);
     66    pmReadout *myBias = pmReadoutAlloc(NULL);
    6667    myReadout->image = tmpImage1;
    6768    myBias->image = tmpImage2;
     
    110111
    111112/******************************************************************************
    112 doSubtractFullOverscans(): a sample psReadout as well as several overscan
     113doSubtractFullOverscans(): a sample pmReadout as well as several overscan
    113114images of the same size are created.  The overscan images are then subtracted
    114 from the psReadout.
     115from the pmReadout.
    115116 *****************************************************************************/
    116117int doSubtractFullOverscans(int numCols, int numRows)
     
    125126    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    126127    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    127     //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, tmpImage1);
    128     psReadout *myReadout = psReadoutAlloc();
     128    //    pmReadout *myReadout = pmReadoutAlloc(numCols, numRows, tmpImage1);
     129    pmReadout *myReadout = pmReadoutAlloc(NULL);
    129130    myReadout->image = tmpImage1;
    130131
     
    185186
    186187/******************************************************************************
    187 doSubtractFullOverscans(): a sample psReadout as well as several overscan
     188doSubtractFullOverscans(): a sample pmReadout as well as several overscan
    188189images of the same size are created.  The overscan images are collected
    189 pixel-by-pixel then subtracted column-wise from the psReadout.
     190pixel-by-pixel then subtracted column-wise from the pmReadout.
    190191 *****************************************************************************/
    191192int doSubtractFullOverscanColumns(int numCols, int numRows)
     
    200201    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    201202    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    202     psReadout *myReadout = psReadoutAlloc();
     203    pmReadout *myReadout = pmReadoutAlloc(NULL);
    203204    myReadout->image = tmpImage1;
    204205    psList *list;
     
    245246}
    246247/******************************************************************************
    247 doSubtractFullOverscans(): a sample psReadout as well as several overscan
     248doSubtractFullOverscans(): a sample pmReadout as well as several overscan
    248249images of the same size are created.  The overscan images are collected
    249 pixel-by-pixel then subtracted column-wise from the psReadout.
     250pixel-by-pixel then subtracted column-wise from the pmReadout.
    250251 *****************************************************************************/
    251252int doSubtractFullOverscanColumnsPoly(int numCols, int numRows)
     
    260261    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    261262    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    262     psReadout *myReadout = psReadoutAlloc();
     263    pmReadout *myReadout = pmReadoutAlloc(NULL);
    263264    myReadout->image = tmpImage1;
    264265    psList *list;
     
    307308}
    308309/******************************************************************************
    309 doSubtractFullOverscansSmall(): a sample psReadout as well as several overscan
     310doSubtractFullOverscansSmall(): a sample pmReadout as well as several overscan
    310311images of smaller size are created.  The overscan images are collected
    311 pixel-by-pixel then subtracted column-wise from the psReadout.
     312pixel-by-pixel then subtracted column-wise from the pmReadout.
    312313 *****************************************************************************/
    313314int doSubtractFullOverscanColumnsSmall(int numCols, int numRows)
     
    319320    int testStatus = 0;
    320321    psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    321     psReadout *myReadout = psReadoutAlloc();
     322    pmReadout *myReadout = pmReadoutAlloc(NULL);
    322323    myReadout->image = tmpImage1;
    323324    psImage *tmpImage2 = psImageAlloc(numCols/2, numRows/2, PS_TYPE_F32);
     
    390391
    391392/******************************************************************************
    392 doSubtractFullOverscans(): a sample psReadout as well as several overscan
     393doSubtractFullOverscans(): a sample pmReadout as well as several overscan
    393394images of the same size are created.  The overscan images are collected
    394 pixel-by-pixel then subtracted row-wise from the psReadout.
     395pixel-by-pixel then subtracted row-wise from the pmReadout.
    395396 *****************************************************************************/
    396397int doSubtractFullOverscanRows(int numCols, int numRows)
     
    405406    psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    406407    psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    407     psReadout *myReadout = psReadoutAlloc();
     408    pmReadout *myReadout = pmReadoutAlloc(NULL);
    408409    myReadout->image = tmpImage1;
    409410    psList *list;
     
    451452
    452453/******************************************************************************
    453 doSubtractFullOverscansSmall(): a sample psReadout as well as several overscan
     454doSubtractFullOverscansSmall(): a sample pmReadout as well as several overscan
    454455images of smaller size are created.  The overscan images are collected
    455 pixel-by-pixel then subtracted row-wise from the psReadout.
     456pixel-by-pixel then subtracted row-wise from the pmReadout.
    456457 *****************************************************************************/
    457458int doSubtractFullOverscanRowsSmall(int numCols, int numRows)
     
    474475    psImage *tmpImage3 = psImageAlloc(OSnumCols, OSnumRows, PS_TYPE_F32);
    475476    psImage *tmpImage4 = psImageAlloc(OSnumCols, OSnumRows, PS_TYPE_F32);
    476     psReadout *myReadout = psReadoutAlloc();
     477    pmReadout *myReadout = pmReadoutAlloc(NULL);
    477478    myReadout->image = tmpImage1;
    478479    psList *list;
     
    554555    psImage *tmpImage3Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32);
    555556    psImage *tmpImage4Short = psImageAlloc(numCols-1, numRows-1, PS_TYPE_F32);
    556     psReadout *myReadout = psReadoutAlloc();
     557    pmReadout *myReadout = pmReadoutAlloc(NULL);
    557558    myReadout->image = tmpImage1;
    558     psReadout *rc = NULL;
     559    pmReadout *rc = NULL;
    559560    psList *list;
    560561    psList *listShort;
    561562    psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    562563    psImage *tmpImage5 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    563     psReadout *myBias = psReadoutAlloc();
     564    pmReadout *myBias = pmReadoutAlloc(NULL);
    564565    myBias->image = tmpImage5;
    565566    printPositiveTestHeader(stdout, "pmSubtractBias", "Testing input parameter error conditions");
    566567
    567568    psImage *tmpImage5ShortRows = psImageAlloc(numCols, numRows-1, PS_TYPE_F32);
    568     psReadout *myBiasShortRows = psReadoutAlloc();
     569    pmReadout *myBiasShortRows = pmReadoutAlloc(NULL);
    569570    myBiasShortRows->image = tmpImage5ShortRows;
    570571    psImage *tmpImage5ShortCols = psImageAlloc(numCols-1, numRows, PS_TYPE_F32);
    571     psReadout *myBiasShortCols = psReadoutAlloc();
     572    pmReadout *myBiasShortCols = pmReadoutAlloc(NULL);
    572573    myBiasShortCols->image = tmpImage5ShortCols;
    573574
     
    611612    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ALL, stat, 0, PM_FIT_NONE, NULL);
    612613    if (rc != myReadout) {
    613         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     614        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    614615        testStatus = false;
    615616    }
     
    619620    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ROWS, stat, 0, PM_FIT_NONE, NULL);
    620621    if (rc != myReadout) {
    621         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     622        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    622623        testStatus = false;
    623624        psFree(rc);
     
    628629    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_COLUMNS, stat, 0, PM_FIT_NONE, NULL);
    629630    if (rc != myReadout) {
    630         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     631        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    631632        testStatus = false;
    632633        psFree(rc);
     
    694695    rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_SPLINE, myBias);
    695696    if (rc != myReadout) {
    696         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     697        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    697698        testStatus = false;
    698699        psFree(rc);
     
    770771                               0, PM_FIT_NONE, myBiasShortRows);
    771772    if (rc != myReadout) {
    772         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     773        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    773774        testStatus = false;
    774775        psFree(rc);
     
    781782                               0, PM_FIT_NONE, myBiasShortCols);
    782783    if (rc != myReadout) {
    783         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     784        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    784785        testStatus = false;
    785786        psFree(rc);
     
    791792                               0, 54321, NULL);
    792793    if (rc != myReadout) {
    793         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     794        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    794795        testStatus = false;
    795796        psFree(rc);
     
    801802                               0, PM_FIT_NONE, NULL);
    802803    if (rc != myReadout) {
    803         printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n");
     804        printf("TEST ERROR: pmSubtractBias() did not return input pmReadout.\n");
    804805        testStatus = false;
    805806        psFree(rc);
     
    847848
    848849/******************************************************************************
    849 doSubtractFullOverscansSmall(): a sample psReadout as well as several overscan
     850doSubtractFullOverscansSmall(): a sample pmReadout as well as several overscan
    850851images of smaller size are created.  The overscan images are collected
    851 pixel-by-pixel then subtracted column-wise from the psReadout.
     852pixel-by-pixel then subtracted column-wise from the pmReadout.
    852853 *****************************************************************************/
    853854int doSubtractFullOverscanColumnsGeneric(int imageNumCols,
     
    866867
    867868    psImage *tmpImage1 = psImageAlloc(imageNumCols, imageNumRows, PS_TYPE_F32);
    868     //    psReadout *myReadout = psReadoutAlloc(imageNumCols, imageNumRows, tmpImage1);
    869     psReadout *myReadout = psReadoutAlloc();
     869    //    pmReadout *myReadout = pmReadoutAlloc(imageNumCols, imageNumRows, tmpImage1);
     870    pmReadout *myReadout = pmReadoutAlloc(NULL);
    870871    myReadout->image = tmpImage1;
    871872    for (i=0;i<imageNumRows;i++) {
  • trunk/psModules/test/tst_pmSubtractSky.c

    r3595 r4770  
    77 *  @author GLG, MHPCC
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-03-31 20:41:35 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-08-16 01:10:36 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3939int main(int argc, char* argv[])
    4040{
     41    psLogSetFormat("HLNM");
    4142    return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);
    4243    //    test00();
     
    5152    int testStatus = 0;
    5253    psImage *tmpImageF32 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    53     //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, tmpImageF32);
    54     psReadout *myReadout = psReadoutAlloc();
     54    //    pmReadout *myReadout = pmReadoutAlloc(numCols, numRows, tmpImageF32);
     55    pmReadout *myReadout = pmReadoutAlloc(NULL);
    5556    myReadout->image = tmpImageF32;
    5657    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     
    8990    int testStatus = 0;
    9091    psImage *tmpImageF32 = psImageAlloc(numCols, numRows, PS_TYPE_F32);
    91     //    psReadout *myReadout = psReadoutAlloc(numCols, numRows, tmpImageF32);
    92     psReadout *myReadout = psReadoutAlloc();
     92    //    pmReadout *myReadout = pmReadoutAlloc(numCols, numRows, tmpImageF32);
     93    pmReadout *myReadout = pmReadoutAlloc(NULL);
    9394    myReadout->image = tmpImageF32;
    9495    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     
    193194    psImage *tmpImageF32 = psImageAlloc(NUM_COLS_SMALL, NUM_ROWS_SMALL, PS_TYPE_F32);
    194195    psImage *tmpImageF64 = psImageAlloc(NUM_COLS_SMALL, NUM_ROWS_SMALL, PS_TYPE_F64);
    195     //    psReadout *myReadout = psReadoutAlloc(NUM_COLS_SMALL, NUM_ROWS_SMALL, tmpImageF32);
    196     psReadout *myReadout = psReadoutAlloc();
    197     myReadout->image = tmpImageF32;
    198     psReadout *rc = NULL;
     196    //    pmReadout *myReadout = pmReadoutAlloc(NUM_COLS_SMALL, NUM_ROWS_SMALL, tmpImageF32);
     197    pmReadout *myReadout = pmReadoutAlloc(NULL);
     198    myReadout->image = tmpImageF32;
     199    pmReadout *rc = NULL;
    199200    psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    200201    psPolynomial2D *myPoly = psPolynomial2DAlloc(POLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);
     
    208209
    209210    printf("----------------------------------------------------------------\n");
    210     printf("Calling pmSubtractSky() with NULL psReadout.  Should error.\n\n");
     211    printf("Calling pmSubtractSky() with NULL pmReadout.  Should error.\n\n");
    211212    rc = pmSubtractSky(NULL, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    212213    if (rc != NULL) {
    213         printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
    214         testStatus = false;
    215     }
    216 
    217     printf("----------------------------------------------------------------\n");
    218     printf("Calling pmSubtractSky() with NULL psReadout->image.  Should error.\n\n");
     214        printf("TEST ERROR: pmSubtractSky() returned a non-NULL pmReadout\n");
     215        testStatus = false;
     216    }
     217
     218    printf("----------------------------------------------------------------\n");
     219    printf("Calling pmSubtractSky() with NULL pmReadout->image.  Should error.\n\n");
    219220    myReadout->image = NULL;
    220221    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    221222    if (rc != NULL) {
    222         printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
    223         testStatus = false;
    224     }
    225     myReadout->image = tmpImageF32;
    226 
    227     printf("----------------------------------------------------------------\n");
    228     printf("Calling pmSubtractSky() with PS_TYPE_F64 psReadout->image.  Should error.\n\n");
     223        printf("TEST ERROR: pmSubtractSky() returned a non-NULL pmReadout\n");
     224        testStatus = false;
     225    }
     226    myReadout->image = tmpImageF32;
     227
     228    printf("----------------------------------------------------------------\n");
     229    printf("Calling pmSubtractSky() with PS_TYPE_F64 pmReadout->image.  Should error.\n\n");
    229230    myReadout->image = tmpImageF64;
    230231    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    231232    if (rc != NULL) {
    232         printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n");
     233        printf("TEST ERROR: pmSubtractSky() returned a non-NULL pmReadout\n");
    233234        testStatus = false;
    234235    }
     
    239240    rc = pmSubtractSky(myReadout, NULL, PM_FIT_POLYNOMIAL, 1, myStats, 2.0);
    240241    if (rc != myReadout) {
    241         printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
     242        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
    242243        testStatus = false;
    243244    }
     
    247248    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_NONE, 1, myStats, 2.0);
    248249    if (rc != myReadout) {
    249         printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
     250        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
    250251        testStatus = false;
    251252    }
     
    255256    rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_SPLINE, 1, myStats, 2.0);
    256257    if (rc != myReadout) {
    257         printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
     258        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
    258259        testStatus = false;
    259260    }
     
    347348    rc = pmSubtractSky(myReadout, (void *) myPoly, 54321, 1, myStats, -1.0);
    348349    if (rc != myReadout) {
    349         printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n");
     350        printf("TEST ERROR: pmSubtractSky() returned something other than pmReadout\n");
    350351        testStatus = false;
    351352    }
  • trunk/psModules/test/verified/tst_pmImageCombine.stderr

    r4579 r4770  
    55\**********************************************************************************/
    66
    7 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     7<HOST>|E|pmCombineImages (FILE:LINENO)
    88    Unallowable operation: images is NULL.
    9 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     9<HOST>|E|pmCombineImages (FILE:LINENO)
    1010    images and errors args must have same length (6 != 5)
    11 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     11<HOST>|E|pmCombineImages (FILE:LINENO)
    1212    Unallowable operation: psImage tmpDataImg has incorrect type.
    13 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     13<HOST>|E|pmCombineImages (FILE:LINENO)
    1414    images and errors args must have same length (5 != 6)
    15 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     15<HOST>|E|pmCombineImages (FILE:LINENO)
    1616    Unallowable operation: psImage tmpErrorImg has incorrect type.
    17 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     17<HOST>|E|pmCombineImages (FILE:LINENO)
    1818    images and masks args must have same length (5 != 6)
    19 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     19<HOST>|E|pmCombineImages (FILE:LINENO)
    2020    Unallowable operation: psImage tmpMaskImg has incorrect type.
    21 <DATE><TIME>|<HOST>|E|pmCombineImages (FILE:LINENO)
     21<HOST>|E|pmCombineImages (FILE:LINENO)
    2222    Unallowable operation: stats is NULL.
    2323
  • trunk/psModules/test/verified/tst_pmImageSubtract.stdout

    r4579 r4770  
    3030Calling pmSubtractionSolveEquation() with acceptable input parameters.  Should return non-NULL.
    3131The solution vector is:
    32 (1.37) (-0.00) (0.10) (0.08) (0.14) (0.10) (0.01) (0.02) (0.00) (-0.02) (-0.01) (-0.00) (0.00) (0.01) (-0.00) (-0.01) (-0.00) (0.00) (0.02) (-0.01) (-0.01) (0.00) (0.00) (0.00) (-0.02) (0.01) (0.00) (-0.01) (0.00) (-0.00) (0.01) (-0.00) (-0.01) (0.00) (0.01) (0.01) (0.01) (0.01) (-0.00) (-0.01) (-0.00) (0.00) (0.00) (0.00) (0.01) (-0.00) (-0.00) (-0.01) (0.02) (-0.00) (0.00) (-0.00) (-0.00) (-0.01) (-0.01) (0.02) (0.01) (-0.01) (-0.00) (-0.00) (0.00) (0.00) (-0.00) (-0.00) (0.00) (-0.00) (-0.02) (0.01) (0.02) (-0.01) (-0.00) (-0.01) (-0.03) (-0.00) (0.04) (0.01) (-0.00) (-0.03) (0.02) (0.02) (0.01) (-0.03) (-0.03) (-0.02) (0.01) (-0.01) (-0.01) (0.00) (0.00) (0.01) (0.02) (-0.02) (-0.02) (0.02) (0.02) (0.02) (0.03) (-0.03) (-0.03) (0.02) (0.02) (0.02) (0.00) (0.01) (-0.02) (-0.01) (-0.01) (0.02) (-0.03) (0.02) (0.03) (-0.02) (-0.03) (-0.02) (-0.01) (-0.01) (0.00) (0.01) (-0.00) (-0.00) (-0.02) (0.01) (0.02) (-0.01) (-0.01) (-0.01) (-0.02) (0.02) (0.01) (-0.02) (-0.02) (-0.00) (0.02) (-0.01) (-0.02) (0.01) (0.00) (0.01) (-0.02) (0.01) (0.00) (-0.00) (-0.01) (0.00) (0.00) (-0.01) (-0.01) (0.01) (0.01) (0.01) (0.51)
     32(-64611.38) (9775.94) (-39812.77) (9051.88) (0.14) (-36863.67) (0.01) (0.02) (0.00) (-0.02) (-0.01) (-0.00) (0.00) (0.01) (-0.00) (-0.01) (-0.00) (0.00) (0.02) (-0.01) (-0.01) (0.00) (0.00) (0.00) (-0.02) (0.01) (0.00) (-0.01) (0.00) (-0.00) (0.01) (-0.00) (-0.01) (0.00) (0.01) (0.01) (0.01) (0.01) (-0.00) (-0.01) (-0.00) (0.00) (0.00) (0.00) (0.01) (-0.00) (-0.00) (-0.01) (0.02) (-0.00) (0.00) (-0.00) (-0.00) (-0.01) (-0.01) (0.02) (0.01) (-0.01) (-0.00) (-0.00) (0.00) (0.00) (-0.00) (-0.00) (0.00) (-0.00) (-0.02) (0.01) (0.02) (-0.01) (-0.00) (-0.01) (-0.03) (-0.00) (0.04) (0.01) (-0.00) (-0.03) (0.02) (0.02) (0.01) (-0.03) (-0.03) (-0.02) (0.01) (-0.01) (-0.01) (0.00) (0.00) (0.01) (0.02) (-0.02) (-0.02) (0.02) (0.02) (0.02) (0.03) (-0.03) (-0.03) (0.02) (0.02) (0.02) (0.00) (0.01) (-0.02) (-0.01) (-0.01) (0.02) (-0.03) (0.02) (0.03) (-0.02) (-0.03) (-0.02) (-0.01) (-0.01) (0.00) (0.01) (-0.00) (-0.00) (-0.02) (0.01) (0.02) (-0.01) (-0.01) (-0.01) (-0.02) (0.02) (0.01) (-0.02) (-0.02) (-0.00) (0.02) (-0.01) (-0.02) (0.01) (0.00) (0.01) (-0.02) (0.01) (0.00) (-0.00) (-0.01) (0.00) (0.00) (-0.01) (-0.01) (0.01) (0.01) (0.01) (0.51)
    3333Calling pmSubtractionRejectStamps() with acceptable input parameters.  Should return TRUE.
    3434Calling pmSubtractionKernelImage() with NULL solution.  Should generate error, return NULL.
     
    3939Calling pmSubtractionKernelImage() unallowable y value.  Should generate error, return NULL.
    4040Calling pmSubtractionKernelImage() with acceptable input parameters.  Should return a psImage.
    41 -0.000774 -0.013938 0.010689 -0.013394 -0.015507
    42 -0.009241 -0.020300 -0.002732 0.016843 0.010743
    43 0.008820 0.015628 1.495404 -0.021095 -0.009788
    44 0.003371 -0.001256 0.017835 0.003308 0.008175
    45 0.009877 -0.010686 0.014775 0.003368 0.006204
     41-0.000791 -0.014015 0.010665 -0.013466 -0.015527
     42-0.009282 -0.020460 -0.002556 0.016698 0.010701
     430.008812 0.015715 -86582.703125 -0.020967 -0.009787
     440.003316 -0.001408 0.018001 0.003171 0.008132
     450.009856 -0.010723 0.014779 0.003320 0.006181
    4646Testing pmSubtractionCalculateEquation():
    4747    image size is (25, 25)
     
    5858Calling pmSubtractionSolveEquation() with acceptable input parameters.  Should return non-NULL.
    5959The solution vector is:
    60 (0.09) (-0.01) (-0.01) (0.00) (-0.00) (-0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.00) (0.55)
     60(0.09) (-0.01) (-0.01) (0.00) (-0.00) (-0.00) (0.00) (0.00) (-0.00) (0.00) (-0.00) (-0.00) (0.00) (0.00) (-0.00) (0.00) (-0.00) (-0.00) (0.00) (0.00) (-0.00) (0.00) (-0.00) (-0.00) (0.00) (0.00) (-0.00) (0.00) (-0.00) (-0.00) (0.00) (0.00) (-0.00) (0.00) (-0.00) (-0.00) (0.55)
    6161Calling pmSubtractionRejectStamps() with acceptable input parameters.  Should return TRUE.
    6262Calling pmSubtractionKernelImage() with NULL solution.  Should generate error, return NULL.
  • trunk/psModules/test/verified/tst_pmNonLinear.stderr

    r3623 r4770  
    2323\**********************************************************************************/
    2424
    25 <DATE><TIME>|<HOST>|E|pmNonLinearityPolynomial (FILE:LINENO)
     25<HOST>|E|pmNonLinearityPolynomial (FILE:LINENO)
    2626    Unallowable operation: inputReadout is NULL.
    27 <DATE><TIME>|<HOST>|E|pmNonLinearityPolynomial (FILE:LINENO)
     27<HOST>|E|pmNonLinearityPolynomial (FILE:LINENO)
    2828    Unallowable operation: inputReadout->image is NULL.
    29 <DATE><TIME>|<HOST>|E|pmNonLinearityPolynomial (FILE:LINENO)
     29<HOST>|E|pmNonLinearityPolynomial (FILE:LINENO)
    3030    Unallowable operation: input1DPoly is NULL.
    3131
     
    3838\**********************************************************************************/
    3939
    40 <DATE><TIME>|<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
     40<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
    4141    Unallowable operation: inputReadout is NULL.
    42 <DATE><TIME>|<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
     42<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
    4343    Unallowable operation: inputReadout->image is NULL.
    44 <DATE><TIME>|<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
     44<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
    4545    Unallowable operation: inFlux is NULL.
    46 <DATE><TIME>|<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
     46<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
    4747    Unallowable operation: outFlux is NULL.
    48 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     48<HOST>|W|pmNonLinearityLookup
    4949    WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (24, 25)
    50 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     50<HOST>|W|pmNonLinearityLookup
    5151    WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (24, 23)
    52 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     52<HOST>|W|pmNonLinearityLookup
    5353    WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (23, 24)
    54 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     54<HOST>|W|pmNonLinearityLookup
    5555    WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (25, 24)
    56 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     56<HOST>|W|pmNonLinearityLookup
    5757    WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (23, 25)
    58 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     58<HOST>|W|pmNonLinearityLookup
    5959    WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (25, 23)
    60 <DATE><TIME>|<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
     60<HOST>|E|pmNonLinearityLookup (FILE:LINENO)
    6161    pmNonLinearityLookup(): input vector less than 2 elements.  Returning inputReadout image.
    62 <DATE><TIME>|<HOST>|W|vectorBinDisectF32
     62<HOST>|W|vectorBinDisectF32
    6363    vectorBinDisectF32(): ordinate -1.000000 is outside vector range (0.000000 - 23.000000).
    64 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     64<HOST>|W|pmNonLinearityLookup
    6565    WARNING: pmNonLinear.c: pmNonLinearityLookup(): 1 pixels outside table.
    66 <DATE><TIME>|<HOST>|W|vectorBinDisectF32
     66<HOST>|W|vectorBinDisectF32
    6767    vectorBinDisectF32(): ordinate 100.000000 is outside vector range (0.000000 - 23.000000).
    68 <DATE><TIME>|<HOST>|W|pmNonLinearityLookup
     68<HOST>|W|pmNonLinearityLookup
    6969    WARNING: pmNonLinear.c: pmNonLinearityLookup(): 1 pixels outside table.
    7070
  • trunk/psModules/test/verified/tst_pmNonLinear.stdout

    r2961 r4770  
    8484Calling pmNonLinearityPolynomial() with NULL polynomial.  Should generate error, return NULL.
    8585------------------------------------------------------------
    86 Calling pmNonLinearityLookup() with NULL input psReadout.  Should generate error, return NULL.
     86Calling pmNonLinearityLookup() with NULL input pmReadout.  Should generate error, return NULL.
    8787------------------------------------------------------------
    88 Calling pmNonLinearityLookup() with NULL input psReadout->image.  Should generate error, return NULL.
     88Calling pmNonLinearityLookup() with NULL input pmReadout->image.  Should generate error, return NULL.
    8989------------------------------------------------------------
    9090Calling pmNonLinearityLookup() with NULL inFlux psVector.  Should generate error, return NULL.
     
    104104Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors.  Should generate warning.
    105105------------------------------------------------------------
    106 Calling pmNonLinearityLookup() with inFlux psVector size 1.  Should generate error, return original psReadout.
     106Calling pmNonLinearityLookup() with inFlux psVector size 1.  Should generate error, return original pmReadout.
    107107------------------------------------------------------------
    108108Calling pmNonLinearityLookup() with one pixels outside inFlux range.  Should generate warnings.
  • trunk/psModules/test/verified/tst_pmObjects01.stderr

    r4228 r4770  
    1414\**********************************************************************************/
    1515
    16 <DATE><TIME>|<HOST>|E|pmFindVectorPeaks (FILE:LINENO)
     16<HOST>|E|pmFindVectorPeaks (FILE:LINENO)
    1717    Unallowable operation: psVector vector or its data is NULL.
    18 <DATE><TIME>|<HOST>|E|pmFindVectorPeaks (FILE:LINENO)
     18<HOST>|E|pmFindVectorPeaks (FILE:LINENO)
    1919    Unallowable operation: psVector vector has no elements.
    20 <DATE><TIME>|<HOST>|E|pmFindVectorPeaks (FILE:LINENO)
     20<HOST>|E|pmFindVectorPeaks (FILE:LINENO)
    2121    Unallowable operation: psVector vector has incorrect type.
    2222
     
    2929\**********************************************************************************/
    3030
    31 <DATE><TIME>|<HOST>|E|psImageAlloc (FILE:LINENO)
     31<HOST>|E|psImageAlloc (FILE:LINENO)
    3232    Specified number of rows (0) or columns (0) is invalid.
    33 <DATE><TIME>|<HOST>|E|pmFindImagePeaks (FILE:LINENO)
    34     Unallowable operation: psImage image or its data is NULL.
    35 <DATE><TIME>|<HOST>|E|pmFindImagePeaks (FILE:LINENO)
    36     Unallowable operation: psImage image or its data is NULL.
    37 <DATE><TIME>|<HOST>|E|pmFindImagePeaks (FILE:LINENO)
     33<HOST>|E|pmFindImagePeaks (FILE:LINENO)
     34    Unallowable operation: psImage image or its data is NULL.
     35<HOST>|E|pmFindImagePeaks (FILE:LINENO)
     36    Unallowable operation: psImage image or its data is NULL.
     37<HOST>|E|pmFindImagePeaks (FILE:LINENO)
    3838    Unallowable operation: psImage image has incorrect type.
    3939
     
    5555\**********************************************************************************/
    5656
    57 <DATE><TIME>|<HOST>|E|pmSourceLocalSky (FILE:LINENO)
    58     Unallowable operation: psImage image or its data is NULL.
    59 <DATE><TIME>|<HOST>|E|pmSourceLocalSky (FILE:LINENO)
     57<HOST>|E|pmSourceLocalSky (FILE:LINENO)
     58    Unallowable operation: psImage image or its data is NULL.
     59<HOST>|E|pmSourceLocalSky (FILE:LINENO)
    6060    Unallowable operation: psImage image has incorrect type.
    61 <DATE><TIME>|<HOST>|E|pmSourceLocalSky (FILE:LINENO)
     61<HOST>|E|pmSourceLocalSky (FILE:LINENO)
    6262    Unallowable operation: peak is NULL.
    63 <DATE><TIME>|<HOST>|E|pmSourceLocalSky (FILE:LINENO)
     63<HOST>|E|pmSourceLocalSky (FILE:LINENO)
    6464    Error: (0.0 > innerRadius) (0.000000 -10.000000)
    65 <DATE><TIME>|<HOST>|E|pmSourceLocalSky (FILE:LINENO)
     65<HOST>|E|pmSourceLocalSky (FILE:LINENO)
    6666    Error: (innerRadius > outerRadius) (10.000000 5.000000)
    6767
     
    7474\**********************************************************************************/
    7575
    76 <DATE><TIME>|<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
    77     Unallowable operation: source is NULL.
    78 <DATE><TIME>|<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
    79     Unallowable operation: psImage image or its data is NULL.
    80 <DATE><TIME>|<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
     76<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
     77    Unallowable operation: source is NULL.
     78<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
     79    Unallowable operation: psImage image or its data is NULL.
     80<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
    8181    Unallowable operation: psImage image has incorrect type.
    82 <DATE><TIME>|<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
     82<HOST>|E|pmSourceSetPixelsCircle (FILE:LINENO)
    8383    Error: (0.0 > radius) (0.000000 -10.000000)
    8484
     
    9191\**********************************************************************************/
    9292
    93 <DATE><TIME>|<HOST>|E|pmSourceMoments (FILE:LINENO)
    94     Unallowable operation: source is NULL.
    95 <DATE><TIME>|<HOST>|E|pmSourceMoments (FILE:LINENO)
     93<HOST>|E|pmSourceMoments (FILE:LINENO)
     94    Unallowable operation: source is NULL.
     95<HOST>|E|pmSourceMoments (FILE:LINENO)
    9696    Error: (0.0 > radius) (0.000000 -10.000000)
    9797
     
    104104\**********************************************************************************/
    105105
    106 <DATE><TIME>|<HOST>|E|pmMinLM_Gauss2D (FILE:LINENO)
    107     Unallowable operation: psVector params or its data is NULL.
    108 <DATE><TIME>|<HOST>|E|pmMinLM_Gauss2D (FILE:LINENO)
    109     Unallowable operation: psVector x or its data is NULL.
    110 <DATE><TIME>|<HOST>|E|pmMinLM_PsuedoGauss2D (FILE:LINENO)
    111     Unallowable operation: psVector params or its data is NULL.
    112 <DATE><TIME>|<HOST>|E|pmMinLM_PsuedoGauss2D (FILE:LINENO)
    113     Unallowable operation: psVector x or its data is NULL.
    114 <DATE><TIME>|<HOST>|E|pmMinLM_Wauss2D (FILE:LINENO)
    115     Unallowable operation: psVector params or its data is NULL.
    116 <DATE><TIME>|<HOST>|E|pmMinLM_Wauss2D (FILE:LINENO)
    117     Unallowable operation: psVector x or its data is NULL.
    118 <DATE><TIME>|<HOST>|E|pmMinLM_TwistGauss2D (FILE:LINENO)
    119     Unallowable operation: psVector params or its data is NULL.
    120 <DATE><TIME>|<HOST>|E|pmMinLM_TwistGauss2D (FILE:LINENO)
    121     Unallowable operation: psVector x or its data is NULL.
    122 <DATE><TIME>|<HOST>|E|pmMinLM_Sersic (FILE:LINENO)
     106<HOST>|E|pmMinLM_Gauss2D (FILE:LINENO)
     107    Unallowable operation: psVector params or its data is NULL.
     108<HOST>|E|pmMinLM_Gauss2D (FILE:LINENO)
     109    Unallowable operation: psVector x or its data is NULL.
     110<HOST>|E|pmMinLM_PsuedoGauss2D (FILE:LINENO)
     111    Unallowable operation: psVector params or its data is NULL.
     112<HOST>|E|pmMinLM_PsuedoGauss2D (FILE:LINENO)
     113    Unallowable operation: psVector x or its data is NULL.
     114<HOST>|E|pmMinLM_Wauss2D (FILE:LINENO)
     115    Unallowable operation: psVector params or its data is NULL.
     116<HOST>|E|pmMinLM_Wauss2D (FILE:LINENO)
     117    Unallowable operation: psVector x or its data is NULL.
     118<HOST>|E|pmMinLM_TwistGauss2D (FILE:LINENO)
     119    Unallowable operation: psVector params or its data is NULL.
     120<HOST>|E|pmMinLM_TwistGauss2D (FILE:LINENO)
     121    Unallowable operation: psVector x or its data is NULL.
     122<HOST>|E|pmMinLM_Sersic (FILE:LINENO)
    123123    This function is not implemented yet.
    124 <DATE><TIME>|<HOST>|E|pmMinLM_Sersic (FILE:LINENO)
    125     Unallowable operation: psVector params or its data is NULL.
    126 <DATE><TIME>|<HOST>|E|pmMinLM_Sersic (FILE:LINENO)
    127     Unallowable operation: psVector x or its data is NULL.
    128 <DATE><TIME>|<HOST>|E|pmMinLM_SersicCore (FILE:LINENO)
     124<HOST>|E|pmMinLM_Sersic (FILE:LINENO)
     125    Unallowable operation: psVector params or its data is NULL.
     126<HOST>|E|pmMinLM_Sersic (FILE:LINENO)
     127    Unallowable operation: psVector x or its data is NULL.
     128<HOST>|E|pmMinLM_SersicCore (FILE:LINENO)
    129129    This function is not implemented yet.
    130 <DATE><TIME>|<HOST>|E|pmMinLM_SersicCore (FILE:LINENO)
    131     Unallowable operation: psVector params or its data is NULL.
    132 <DATE><TIME>|<HOST>|E|pmMinLM_SersicCore (FILE:LINENO)
     130<HOST>|E|pmMinLM_SersicCore (FILE:LINENO)
     131    Unallowable operation: psVector params or its data is NULL.
     132<HOST>|E|pmMinLM_SersicCore (FILE:LINENO)
    133133    Unallowable operation: psVector x or its data is NULL.
    134134
     
    141141\**********************************************************************************/
    142142
    143 <DATE><TIME>|<HOST>|E|pmSourceModelGuess (FILE:LINENO)
    144     Unallowable operation: source is NULL.
    145 <DATE><TIME>|<HOST>|E|pmSourceModelGuess (FILE:LINENO)
    146     Unallowable operation: psImage image or its data is NULL.
    147 <DATE><TIME>|<HOST>|E|pmSourceModelGuess (FILE:LINENO)
     143<HOST>|E|pmSourceModelGuess (FILE:LINENO)
     144    Unallowable operation: source is NULL.
     145<HOST>|E|pmSourceModelGuess (FILE:LINENO)
     146    Unallowable operation: psImage image or its data is NULL.
     147<HOST>|E|pmSourceModelGuess (FILE:LINENO)
    148148    Undefined psModelType
    149 <DATE><TIME>|<HOST>|W|pmSourceModelGuess
    150     WARNING: source->models was non-NULL; calling psFree(source->models).
    151 <DATE><TIME>|<HOST>|W|pmSourceModelGuess
    152     WARNING: source->models was non-NULL; calling psFree(source->models).
    153 <DATE><TIME>|<HOST>|W|pmSourceModelGuess
    154     WARNING: source->models was non-NULL; calling psFree(source->models).
    155 <DATE><TIME>|<HOST>|W|pmSourceModelGuess
    156     WARNING: source->models was non-NULL; calling psFree(source->models).
    157 <DATE><TIME>|<HOST>|W|pmSourceModelGuess
    158     WARNING: source->models was non-NULL; calling psFree(source->models).
     149<HOST>|W|pmSourceModelGuess
     150    WARNING: source->modelPSF was non-NULL; calling psFree(source->modelPSF).
     151<HOST>|W|pmSourceModelGuess
     152    WARNING: source->modelPSF was non-NULL; calling psFree(source->modelPSF).
     153<HOST>|W|pmSourceModelGuess
     154    WARNING: source->modelPSF was non-NULL; calling psFree(source->modelPSF).
     155<HOST>|W|pmSourceModelGuess
     156    WARNING: source->modelPSF was non-NULL; calling psFree(source->modelPSF).
     157<HOST>|W|pmSourceModelGuess
     158    WARNING: source->modelPSF was non-NULL; calling psFree(source->modelPSF).
    159159
    160160---> TESTPOINT PASSED (Test Point Driver{pmObjects: pmSourceModelGuess()} | tst_pmObjects01.c)
     
    166166\**********************************************************************************/
    167167
    168 <DATE><TIME>|<HOST>|E|pmSourceContour (FILE:LINENO)
    169     Unallowable operation: source is NULL.
    170 <DATE><TIME>|<HOST>|E|pmSourceContour (FILE:LINENO)
     168<HOST>|E|pmSourceContour (FILE:LINENO)
     169    Unallowable operation: source is NULL.
     170<HOST>|E|pmSourceContour (FILE:LINENO)
    171171    Unallowable operation: image is NULL.
    172172
     
    179179\**********************************************************************************/
    180180
    181 <DATE><TIME>|<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
    182     Unallowable operation: psImage image or its data is NULL.
    183 <DATE><TIME>|<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
     181<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
     182    Unallowable operation: psImage image or its data is NULL.
     183<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
    184184    Unallowable operation: src is NULL.
    185185
     
    192192\**********************************************************************************/
    193193
    194 <DATE><TIME>|<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
    195     Unallowable operation: psImage image or its data is NULL.
    196 <DATE><TIME>|<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
     194<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
     195    Unallowable operation: psImage image or its data is NULL.
     196<HOST>|E|sourceAddOrSubModel (FILE:LINENO)
    197197    Unallowable operation: src is NULL.
    198198
     
    205205\**********************************************************************************/
    206206
    207 <DATE><TIME>|<HOST>|E|pmSourceFitModel (FILE:LINENO)
    208     Unallowable operation: psImage image or its data is NULL.
    209 <DATE><TIME>|<HOST>|E|pmSourceFitModel (FILE:LINENO)
     207<HOST>|E|pmSourceFitModel (FILE:LINENO)
     208    Unallowable operation: psImage image or its data is NULL.
     209<HOST>|E|pmSourceFitModel (FILE:LINENO)
    210210    Unallowable operation: source is NULL.
    211211
  • trunk/psModules/test/verified/tst_pmObjects01.stdout

    r4228 r4770  
    8181Calling pmSourceLocalSky with wrong-type psImage.  Should generate error and return NULL.
    8282----------------------------------------------------------------------------------
    83 Calling pmSourceLocalSky with NULL psPeak.  Should generate error and return NULL.
     83Calling pmSourceLocalSky with NULL pmPeak.  Should generate error and return NULL.
    8484----------------------------------------------------------------------------------
    8585Calling pmSourceLocalSky with innerRadius<0.0.  Should generate error and return NULL.
     
    9090----------------------------------------------------------------------------------
    9191----------------------------------------------------------------------------------
    92 Calling pmSourceSetPixelsCircle with NULL psSource.  Should generate error and return NULL.
     92Calling pmSourceSetPixelsCircle with NULL pmSource.  Should generate error and return NULL.
    9393----------------------------------------------------------------------------------
    9494Calling pmSourceSetPixelsCircle with NULL psImage.  Should generate error and return NULL.
     
    101101----------------------------------------------------------------------------------
    102102----------------------------------------------------------------------------------
    103 Calling pmSourceMoments with NULL psSource.  Should generate error and return NULL.
     103Calling pmSourceMoments with NULL pmSource.  Should generate error and return NULL.
    104104----------------------------------------------------------------------------------
    105105Calling pmSourceMoments with radius < 0.0.  Should generate error and return NULL.
     
    143143Calling pmSourceLocalSky with valid data.
    144144----------------------------------------------------------------------------------
    145 Calling pmSourceModelGuess with NULL psSource.  Should generate error, return FALSE.
     145Calling pmSourceModelGuess with NULL pmSource.  Should generate error, return FALSE.
    146146----------------------------------------------------------------------------------
    147147Calling pmSourceModelGuess with NULL psImage.  Should generate error, return FALSE.
     
    162162Calling pmSourceLocalSky with valid data.
    163163----------------------------------------------------------------------------------
    164 Calling pmSourceContour with NULL psSource .  Should generate error, return NULL.
     164Calling pmSourceContour with NULL pmSource .  Should generate error, return NULL.
    165165----------------------------------------------------------------------------------
    166166Calling pmSourceContour with NULL psImage .  Should generate error, return NULL.
     
    183183Calling pmSourceFitModel with NULL psImage.  Should generate error, return FALSE.
    184184----------------------------------------------------------------------------------
    185 Calling pmSourceFitModel with NULL psSource.  Should generate error, return FALSE.
     185Calling pmSourceFitModel with NULL pmSource.  Should generate error, return FALSE.
    186186----------------------------------------------------------------------------------
    187187Calling pmSourceFitModel with acceptable data.
  • trunk/psModules/test/verified/tst_pmSubtractSky.stderr

    r3623 r4770  
    55\**********************************************************************************/
    66
    7 <DATE><TIME>|<HOST>|W|p_psVectorSampleStdev
     7<HOST>|W|p_psVectorSampleStdev
    88    WARNING: p_psVectorSampleStdev(): only one valid psVector elements (1).  Setting stats->sampleStdev = 0.0.
    9 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     9<HOST>|W|ImageFitPolynomial
    1010    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in x-dimension.
    11 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     11<HOST>|W|ImageFitPolynomial
    1212    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in y-dimension.
    13 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     13<HOST>|W|ImageFitPolynomial
    1414    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in x-dimension.
    15 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     15<HOST>|W|ImageFitPolynomial
    1616    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in y-dimension.
    17 <DATE><TIME>|<HOST>|W|p_psVectorSampleStdev
     17<HOST>|W|p_psVectorSampleStdev
    1818    WARNING: p_psVectorSampleStdev(): only one valid psVector elements (1).  Setting stats->sampleStdev = 0.0.
    19 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     19<HOST>|W|ImageFitPolynomial
    2020    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in x-dimension.
    21 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     21<HOST>|W|ImageFitPolynomial
    2222    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in y-dimension.
    23 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     23<HOST>|W|ImageFitPolynomial
    2424    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in x-dimension.
    25 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     25<HOST>|W|ImageFitPolynomial
    2626    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in y-dimension.
    27 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     27<HOST>|W|ImageFitPolynomial
    2828    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in x-dimension.
    29 <DATE><TIME>|<HOST>|W|ImageFitPolynomial
     29<HOST>|W|ImageFitPolynomial
    3030    WARNING: ImageFitPolynomial(): Reducing polynomial complexity in y-dimension.
    3131
     
    3838\**********************************************************************************/
    3939
    40 <DATE><TIME>|<HOST>|E|pmSubtractSky (FILE:LINENO)
     40<HOST>|E|pmSubtractSky (FILE:LINENO)
    4141    Unallowable operation: psReadout in or its data is NULL.
    42 <DATE><TIME>|<HOST>|E|pmSubtractSky (FILE:LINENO)
     42<HOST>|E|pmSubtractSky (FILE:LINENO)
    4343    Unallowable operation: psReadout in or its data is NULL.
    44 <DATE><TIME>|<HOST>|E|pmSubtractSky (FILE:LINENO)
     44<HOST>|E|pmSubtractSky (FILE:LINENO)
    4545    Unallowable operation: psImage in has incorrect type.
    46 <DATE><TIME>|<HOST>|W|pmSubtractSky
     46<HOST>|W|pmSubtractSky
    4747    WARNING: pmSubtractSky(): input parameter stats is NULL
    48 <DATE><TIME>|<HOST>|W|pmSubtractSky
     48<HOST>|W|pmSubtractSky
    4949    WARNING: pmSubtractSky(): no stats->options was requested
    50 <DATE><TIME>|<HOST>|W|pmSubtractSky
     50<HOST>|W|pmSubtractSky
    5151    WARNING: Multiple statistical options have been requested.
    52 <DATE><TIME>|<HOST>|W|pmSubtractSky
     52<HOST>|W|pmSubtractSky
    5353    WARNING: pmSubtractSky(): binFactor is 0
    54 <DATE><TIME>|<HOST>|W|pmSubtractSky
     54<HOST>|W|pmSubtractSky
    5555    WARNING: pmSubtractSky(): binFactor is -1
    56 <DATE><TIME>|<HOST>|W|pmSubtractSky
     56<HOST>|W|pmSubtractSky
    5757    WARNING: pmSubtractSky(): clipSD is -1.000000
    58 <DATE><TIME>|<HOST>|E|pmSubtractSky (FILE:LINENO)
     58<HOST>|E|pmSubtractSky (FILE:LINENO)
    5959    psFit is unallowable (54321).  Returning in image.
    6060
  • trunk/psModules/test/verified/tst_pmSubtractSky.stdout

    r2945 r4770  
    176176
    177177----------------------------------------------------------------
    178 Calling pmSubtractSky() with NULL psReadout.  Should error.
    179 
    180 ----------------------------------------------------------------
    181 Calling pmSubtractSky() with NULL psReadout->image.  Should error.
    182 
    183 ----------------------------------------------------------------
    184 Calling pmSubtractSky() with PS_TYPE_F64 psReadout->image.  Should error.
     178Calling pmSubtractSky() with NULL pmReadout.  Should error.
     179
     180----------------------------------------------------------------
     181Calling pmSubtractSky() with NULL pmReadout->image.  Should error.
     182
     183----------------------------------------------------------------
     184Calling pmSubtractSky() with PS_TYPE_F64 pmReadout->image.  Should error.
    185185
    186186----------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.