IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 24, 2010, 2:59:09 PM (16 years ago)
Author:
Paul Price
Message:

Merging trunk in advance of reintegrating into trunk.

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/ppTranslate/src/ppMopsDetections.c

    r28027 r28484  
    1010static void mopsDetectionsFree(ppMopsDetections *det)
    1111{
     12    psFree(det->component);
    1213    psFree(det->raBoresight);
    1314    psFree(det->decBoresight);
    1415    psFree(det->filter);
     16    psFree(det->header);
     17    psFree(det->table);
    1518    psFree(det->x);
    1619    psFree(det->y);
    1720    psFree(det->ra);
    1821    psFree(det->dec);
    19     psFree(det->raErr);
    20     psFree(det->decErr);
    21     psFree(det->mag);
    22     psFree(det->magErr);
    23     psFree(det->chi2);
    24     psFree(det->dof);
    25     psFree(det->cr);
    26     psFree(det->extended);
    27     psFree(det->psfMajor);
    28     psFree(det->psfMinor);
    29     psFree(det->psfTheta);
    30     psFree(det->quality);
    31     psFree(det->numPix);
    32     psFree(det->xxMoment);
    33     psFree(det->xyMoment);
    34     psFree(det->yyMoment);
    35     psFree(det->flags);
    36     psFree(det->diffSkyfileId);
    37     psFree(det->naxis1);
    38     psFree(det->naxis2);
    39     psFree(det->mask);
    40     psFree(det->nPos);
    41     psFree(det->fPos);
    42     psFree(det->nRatioBad);
    43     psFree(det->nRatioMask);
    44     psFree(det->nRatioAll);
     22    psFree(det->deteffHeader);
     23    psFree(det->deteffTable);
    4524
    4625    return;
    4726}
    4827
    49 ppMopsDetections *ppMopsDetectionsAlloc(long num)
     28ppMopsDetections *ppMopsDetectionsAlloc(void)
    5029{
    5130    ppMopsDetections *det = psAlloc(sizeof(ppMopsDetections)); // Detections, to return
    5231    psMemSetDeallocator(det, (psFreeFunc)mopsDetectionsFree);
    5332
     33    det->component = NULL;
    5434    det->raBoresight = NULL;
    5535    det->decBoresight = NULL;
     
    6343    det->seeing = NAN;
    6444    det->num = 0;
    65     det->x = psVectorAllocEmpty(num, PS_TYPE_F32);
    66     det->y = psVectorAllocEmpty(num, PS_TYPE_F32);
    67     det->ra = psVectorAllocEmpty(num, PS_TYPE_F64);
    68     det->dec = psVectorAllocEmpty(num, PS_TYPE_F64);
    69     det->raErr = psVectorAllocEmpty(num, PS_TYPE_F64);
    70     det->decErr = psVectorAllocEmpty(num, PS_TYPE_F64);
    71     det->mag = psVectorAllocEmpty(num, PS_TYPE_F32);
    72     det->magErr = psVectorAllocEmpty(num, PS_TYPE_F32);
    73     det->chi2 = psVectorAllocEmpty(num, PS_TYPE_F32);
    74     det->dof = psVectorAllocEmpty(num, PS_TYPE_S32);
    75     det->cr = psVectorAllocEmpty(num, PS_TYPE_F32);
    76     det->extended = psVectorAllocEmpty(num, PS_TYPE_F32);
    77     det->psfMajor = psVectorAllocEmpty(num, PS_TYPE_F32);
    78     det->psfMinor = psVectorAllocEmpty(num, PS_TYPE_F32);
    79     det->psfTheta = psVectorAllocEmpty(num, PS_TYPE_F32);
    80     det->quality = psVectorAllocEmpty(num, PS_TYPE_F32);
    81     det->numPix = psVectorAllocEmpty(num, PS_TYPE_S32);
    82     det->xxMoment = psVectorAllocEmpty(num, PS_TYPE_F32);
    83     det->xyMoment = psVectorAllocEmpty(num, PS_TYPE_F32);
    84     det->yyMoment = psVectorAllocEmpty(num, PS_TYPE_F32);
    85     det->flags = psVectorAllocEmpty(num, PS_TYPE_U32);
    86     det->diffSkyfileId = psVectorAllocEmpty(num, PS_TYPE_S64);
    87     det->naxis1 = psVectorAllocEmpty(num, PS_TYPE_S32);
    88     det->naxis2 = psVectorAllocEmpty(num, PS_TYPE_S32);
    89     det->mask = psVectorAllocEmpty(num, PS_TYPE_U8);
    90     det->nPos = psVectorAllocEmpty(num, PS_TYPE_S32);
    91     det->fPos = psVectorAllocEmpty(num, PS_TYPE_F32);
    92     det->nRatioBad = psVectorAllocEmpty(num, PS_TYPE_F32);
    93     det->nRatioMask = psVectorAllocEmpty(num, PS_TYPE_F32);
    94     det->nRatioAll = psVectorAllocEmpty(num, PS_TYPE_F32);
     45    det->header = NULL;
     46    det->table = NULL;
     47    det->x = NULL;
     48    det->y = NULL;
     49    det->ra = NULL;
     50    det->dec = NULL;
     51    det->deteffHeader = NULL;
     52    det->deteffTable = NULL;
    9553
    9654    return det;
    9755}
    98 
    99 
    100 ppMopsDetections *ppMopsDetectionsRealloc(ppMopsDetections *det, long num)
    101 {
    102     det->x = psVectorRealloc(det->x, num);
    103     det->y = psVectorRealloc(det->y, num);
    104     det->ra = psVectorRealloc(det->ra, num);
    105     det->dec = psVectorRealloc(det->dec, num);
    106     det->raErr = psVectorRealloc(det->raErr, num);
    107     det->decErr = psVectorRealloc(det->decErr, num);
    108     det->mag = psVectorRealloc(det->mag, num);
    109     det->magErr = psVectorRealloc(det->magErr, num);
    110     det->chi2 = psVectorRealloc(det->chi2, num);
    111     det->dof = psVectorRealloc(det->dof, num);
    112     det->cr = psVectorRealloc(det->cr, num);
    113     det->extended = psVectorRealloc(det->extended, num);
    114     det->psfMajor = psVectorRealloc(det->psfMajor, num);
    115     det->psfMinor = psVectorRealloc(det->psfMinor, num);
    116     det->psfTheta = psVectorRealloc(det->psfTheta, num);
    117     det->quality = psVectorRealloc(det->quality, num);
    118     det->numPix = psVectorRealloc(det->numPix, num);
    119     det->xxMoment = psVectorRealloc(det->xxMoment, num);
    120     det->xyMoment = psVectorRealloc(det->xyMoment, num);
    121     det->yyMoment = psVectorRealloc(det->yyMoment, num);
    122     det->flags = psVectorRealloc(det->flags, num);
    123     det->diffSkyfileId = psVectorRealloc(det->diffSkyfileId, num);
    124     det->naxis1 = psVectorRealloc(det->naxis1, num);
    125     det->naxis2 = psVectorRealloc(det->naxis2, num);
    126     det->mask = psVectorRealloc(det->mask, num);
    127     det->nPos = psVectorRealloc(det->nPos, num);
    128     det->fPos = psVectorRealloc(det->fPos, num);
    129     det->nRatioBad = psVectorRealloc(det->nRatioBad, num);
    130     det->nRatioMask = psVectorRealloc(det->nRatioMask, num);
    131     det->nRatioAll = psVectorRealloc(det->nRatioAll, num);
    132 
    133     return det;
    134 }
    135 
    136 
    137 bool ppMopsDetectionsAdd(ppMopsDetections *det, float x, float y, double ra, double dec,
    138                          double raErr, double decErr, float mag, float magErr,
    139                          float chi2, int dof, float cr, float extended, float psfMajor,
    140                          float psfMinor, float psfTheta, float quality, int numPix,
    141                          float xxMoment, float xyMoment, float yyMoment,
    142                          psU32 flags, psS64 diffSkyfileId, int naxis1, int naxis2,
    143                          int nPos, float fPos, float nRatioBad, float nRatioMask, float nRatioAll)
    144 {
    145     psVectorAppend(det->x, x);
    146     psVectorAppend(det->y, y);
    147     psVectorAppend(det->ra, ra);
    148     psVectorAppend(det->dec, dec);
    149     psVectorAppend(det->raErr, raErr);
    150     psVectorAppend(det->decErr, decErr);
    151     psVectorAppend(det->mag, mag);
    152     psVectorAppend(det->magErr, magErr);
    153     psVectorAppend(det->chi2, chi2);
    154     psVectorAppend(det->dof, dof);
    155     psVectorAppend(det->cr, cr);
    156     psVectorAppend(det->extended, extended);
    157     psVectorAppend(det->psfMajor, psfMajor);
    158     psVectorAppend(det->psfMinor, psfMinor);
    159     psVectorAppend(det->psfTheta, psfTheta);
    160     psVectorAppend(det->quality, quality);
    161     psVectorAppend(det->numPix, numPix);
    162     psVectorAppend(det->xxMoment, xxMoment);
    163     psVectorAppend(det->xyMoment, xyMoment);
    164     psVectorAppend(det->yyMoment, yyMoment);
    165     psVectorAppend(det->flags, flags);
    166     psVectorAppend(det->diffSkyfileId, diffSkyfileId);
    167     psVectorAppend(det->naxis1, naxis1);
    168     psVectorAppend(det->naxis2, naxis2);
    169     psVectorAppend(det->mask, 0);
    170     psVectorAppend(det->nPos, nPos);
    171     psVectorAppend(det->fPos, fPos);
    172     psVectorAppend(det->nRatioBad, nRatioBad);
    173     psVectorAppend(det->nRatioMask, nRatioMask);
    174     psVectorAppend(det->nRatioAll, nRatioAll);
    175 
    176     return true;
    177 }
    178 
    179 
    180 bool ppMopsDetectionsCopySingle(ppMopsDetections *target, const ppMopsDetections *source, long index)
    181 {
    182     psVectorAppend(target->x, source->x->data.F32[index]);
    183     psVectorAppend(target->y, source->y->data.F32[index]);
    184     psVectorAppend(target->ra, source->ra->data.F64[index]);
    185     psVectorAppend(target->dec, source->dec->data.F64[index]);
    186     psVectorAppend(target->raErr, source->raErr->data.F64[index]);
    187     psVectorAppend(target->decErr, source->decErr->data.F64[index]);
    188     psVectorAppend(target->mag, source->mag->data.F32[index]);
    189     psVectorAppend(target->magErr, source->magErr->data.F32[index]);
    190     psVectorAppend(target->chi2, source->chi2->data.F32[index]);
    191     psVectorAppend(target->dof, source->dof->data.S32[index]);
    192     psVectorAppend(target->cr, source->cr->data.F32[index]);
    193     psVectorAppend(target->extended, source->extended->data.F32[index]);
    194     psVectorAppend(target->psfMajor, source->psfMajor->data.F32[index]);
    195     psVectorAppend(target->psfMinor, source->psfMinor->data.F32[index]);
    196     psVectorAppend(target->psfTheta, source->psfTheta->data.F32[index]);
    197     psVectorAppend(target->quality, source->quality->data.F32[index]);
    198     psVectorAppend(target->numPix, source->numPix->data.S32[index]);
    199     psVectorAppend(target->xxMoment, source->xxMoment->data.F32[index]);
    200     psVectorAppend(target->xyMoment, source->xyMoment->data.F32[index]);
    201     psVectorAppend(target->yyMoment, source->yyMoment->data.F32[index]);
    202     psVectorAppend(target->flags, source->flags->data.U32[index]);
    203     psVectorAppend(target->diffSkyfileId, source->diffSkyfileId->data.S64[index]);
    204     psVectorAppend(target->naxis1, source->naxis1->data.S32[index]);
    205     psVectorAppend(target->naxis2, source->naxis2->data.S32[index]);
    206     psVectorAppend(target->mask, 0);
    207     psVectorAppend(target->nPos, source->nPos->data.S32[index]);
    208     psVectorAppend(target->fPos, source->fPos->data.F32[index]);
    209     psVectorAppend(target->nRatioBad, source->nRatioBad->data.F32[index]);
    210     psVectorAppend(target->nRatioMask, source->nRatioMask->data.F32[index]);
    211     psVectorAppend(target->nRatioAll, source->nRatioAll->data.F32[index]);
    212 
    213     target->num++;
    214 
    215     return true;
    216 }
    217 
    218 
    219 bool ppMopsDetectionsPurge(ppMopsDetections *det)
    220 {
    221     long num = 0;
    222     for (long i = 0; i < det->num; i++) {
    223         if (!det->mask->data.U8[i]) {
    224             if (i == num) {
    225                 // No need to copy
    226                 num++;
    227                 continue;
    228             }
    229             det->x->data.F32[num] = det->x->data.F32[i];
    230             det->y->data.F32[num] = det->y->data.F32[i];
    231             det->ra->data.F64[num] = det->ra->data.F64[i];
    232             det->dec->data.F64[num] = det->dec->data.F64[i];
    233             det->raErr->data.F64[num] = det->raErr->data.F64[i];
    234             det->decErr->data.F64[num] = det->decErr->data.F64[i];
    235             det->mag->data.F32[num] = det->mag->data.F32[i];
    236             det->magErr->data.F32[num] = det->magErr->data.F32[i];
    237             det->chi2->data.F32[num] = det->chi2->data.F32[i];
    238             det->dof->data.S32[num] = det->dof->data.S32[i];
    239             det->cr->data.F32[num] = det->cr->data.F32[i];
    240             det->extended->data.F32[num] = det->extended->data.F32[i];
    241             det->psfMajor->data.F32[num] = det->psfMajor->data.F32[i];
    242             det->psfMinor->data.F32[num] = det->psfMinor->data.F32[i];
    243             det->psfTheta->data.F32[num] = det->psfTheta->data.F32[i];
    244             det->quality->data.F32[num] = det->quality->data.F32[i];
    245             det->numPix->data.S32[num] = det->numPix->data.S32[i];
    246             det->xxMoment->data.F32[num] = det->xxMoment->data.F32[i];
    247             det->xyMoment->data.F32[num] = det->xyMoment->data.F32[i];
    248             det->yyMoment->data.F32[num] = det->yyMoment->data.F32[i];
    249             det->flags->data.U32[num] = det->flags->data.U32[i];
    250             det->diffSkyfileId->data.S64[num] = det->diffSkyfileId->data.S64[i];
    251             det->naxis1->data.S32[num] = det->naxis1->data.S32[i];
    252             det->naxis2->data.S32[num] = det->naxis2->data.S32[i];
    253             det->mask->data.U8[num] = 0;
    254             det->nPos->data.S32[num] = det->nPos->data.S32[i];
    255             det->fPos->data.F32[num] = det->fPos->data.F32[i];
    256             det->nRatioBad->data.F32[num] = det->nRatioBad->data.F32[i];
    257             det->nRatioMask->data.F32[num] = det->nRatioMask->data.F32[i];
    258             det->nRatioAll->data.F32[num] = det->nRatioAll->data.F32[i];
    259             num++;
    260         }
    261     }
    262     det->x->n = num;
    263     det->y->n = num;
    264     det->ra->n = num;
    265     det->dec->n = num;
    266     det->raErr->n = num;
    267     det->decErr->n = num;
    268     det->mag->n = num;
    269     det->magErr->n = num;
    270     det->chi2->n = num;
    271     det->dof->n = num;
    272     det->cr->n = num;
    273     det->extended->n = num;
    274     det->psfMajor->n = num;
    275     det->psfMinor->n = num;
    276     det->psfTheta->n = num;
    277     det->quality->n = num;
    278     det->numPix->n = num;
    279     det->xxMoment->n = num;
    280     det->xyMoment->n = num;
    281     det->yyMoment->n = num;
    282     det->flags->n = num;
    283     det->diffSkyfileId->n = num;
    284     det->naxis1->n = num;
    285     det->naxis2->n = num;
    286     det->mask->n = num;
    287     det->num = num;
    288     det->nPos->n = num;
    289     det->fPos->n = num;
    290     det->nRatioBad->n = num;
    291     det->nRatioMask->n = num;
    292     det->nRatioAll->n = num;
    293 
    294     return true;
    295 }
    296 
Note: See TracChangeset for help on using the changeset viewer.