IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 21, 2005, 5:33:37 PM (21 years ago)
Author:
eugene
Message:

reorg

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/pmAstrom.c

    r5560 r5565  
    1313}
    1414
    15 psPlane *psCoordReadoutToCell (psPlane *cellpix, psPlane *readpix, pmReadout *readout) {
    16 
    17     if (cellpix == NULL) {
    18         cellpix = psPlaneAlloc ();
    19     }
    20 
    21     cellpix->x = readpix->x*readout->colBins + readout->col0;
    22     cellpix->y = readpix->y*readout->rowBins + readout->row0;
    23 
    24     return (cellpix);
    25 }
    26 
    27 psPlane *psCoordCellToReadout (psPlane *readpix, psPlane *cellpix, pmReadout *readout) {
    28 
    29     if (readpix == NULL) {
    30         readpix = psPlaneAlloc ();
    31     }
    32 
    33     readpix->x = (cellpix->x - readout->col0) / readout->colBins;
    34     readpix->y = (cellpix->y - readout->row0) / readout->rowBins;
    35 
    36     return (readpix);
    37 }
    38 
    39 psPlane* psCoordChipToCell_EAM(psPlane* cellCoord,
    40                            const psPlane* chipCoord,
    41                            const pmCell* cell)
     15// sort by mag (descending)
     16int pmAstromObjSortByMag (const void **a, const void **b)
    4217{
    43     PS_ASSERT_PTR_NON_NULL(chipCoord, NULL);
    44     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    45     PS_ASSERT_PTR_NON_NULL(cell->parent, NULL);
    46 
    47     // XXX EAM : why was this being done?
    48     // pmCell *tmpCell = pmCellInChip(chipCoord, cell->parent);
    49     PS_ASSERT_PTR_NON_NULL(cell->toChip, NULL);
    50     psPlaneTransform *tmpChipToCell = p_psPlaneTransformLinearInvert(cell->toChip);
    51     PS_ASSERT_PTR_NON_NULL(tmpChipToCell, NULL);
    52     cellCoord = psPlaneTransformApply(cellCoord, tmpChipToCell, chipCoord);
    53     psFree(tmpChipToCell);
    54     return(cellCoord);
    55 }
    56 
    57 bool psastroProjectFPA (pmFPA *fpa, char *starlist, bool toSky) {
    58 
    59     bool status;
    60 
    61     for (int i = 0; i < fpa->chips->n; i++) {
    62         pmChip *chip = fpa->chips->data[i];
    63         for (int j = 0; j < chip->cells->n; j++) {
    64             pmCell *cell = chip->cells->data[j];
    65             for (int k = 0; k < cell->readouts->n; k++) {
    66                 pmReadout *readout = cell->readouts->data[k];
    67                 psArray *stars = psMetadataLookupPtr (&status, readout->analysis, starlist);
    68                 if (toSky) {
    69                     psastroProjectRawstars (stars, readout);
    70                 } else {
    71                     psastroProjectRefstars (stars, readout);
    72                 }
    73             }
    74         }
    75     }
    76     return true;
    77 }
    78  
    79 bool psastroProjectRawstars (psArray *stars, pmReadout *readout) {
    80 
    81     pmCell *cell = readout->parent;
    82     pmChip *chip = cell->parent;
    83     pmFPA  *fpa  = chip->parent;
    84 
    85     for (int i = 0; i < stars->n; i++) {
    86         pmAstromObj *star = stars->data[i];
    87         psCoordReadoutToCell (&star->cell, &star->pix, readout);
    88         psCoordCellToChip (&star->chip, &star->cell, cell);
    89         psCoordChipToFPA (&star->FP, &star->chip, chip);
    90         psCoordFPAToTP (&star->TP, &star->FP, 0.0, 0.0, fpa);
    91         psCoordTPToSky (&star->sky, &star->TP, fpa->projection);
    92     }
    93     return true;
    94 }
    95  
    96 bool psastroProjectRefstars (psArray *stars, pmReadout *readout) {
    97 
    98     pmCell *cell = readout->parent;
    99     pmChip *chip = cell->parent;
    100     pmFPA  *fpa  = chip->parent;
    101 
    102     for (int i = 0; i < stars->n; i++) {
    103         pmAstromObj *star = stars->data[i];
    104         psCoordSkyToTP (&star->TP, &star->sky, fpa->projection);
    105         psCoordTPToFPA (&star->FP, &star->TP, 0.0, 0.0, fpa);
    106         psCoordFPAToChip (&star->chip, &star->FP, chip);
    107         psCoordChipToCell_EAM (&star->cell, &star->chip, cell);
    108         psCoordCellToReadout (&star->pix, &star->cell, readout);
    109     }
    110     return true;
    111 }
    112  
     18    pmAstromObj *A = *(pmAstromObj **)a;
     19    pmAstromObj *B = *(pmAstromObj **)b;
     20
     21    psF32 diff = A->Mag - B->Mag;
     22    if (diff > FLT_EPSILON) return (-1);
     23    if (diff < FLT_EPSILON) return (+1);
     24    return (0);
     25}
     26
    11327psArray *pmAstromRadiusMatch (psArray *st1, psArray *st2, psMetadata *config) {
    11428
Note: See TracChangeset for help on using the changeset viewer.