IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 17, 2006, 8:01:05 AM (20 years ago)
Author:
magnier
Message:

updates relative to rel10_ifa_1

Location:
trunk/psModules/src/astrom
Files:
42 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/Makefile.am

    r6301 r6872  
    11noinst_LTLIBRARIES = libpsmoduleastrom.la
    22
    3 libpsmoduleastrom_la_CPPFLAGS = $(SRCINC) $(PSMODULE_CFLAGS)
     3libpsmoduleastrom_la_CPPFLAGS = $(SRCINC) $(PSMODULE_CFLAGS) -I../pslib/
    44libpsmoduleastrom_la_LDFLAGS  = -release $(PACKAGE_VERSION)
    55libpsmoduleastrom_la_SOURCES  = \
    6     pmAstrometry.c \
    7     pmAstrometryObjects.c
     6        pmFPA.c \
     7        pmFPAConstruct.c \
     8        pmFPACopy.c \
     9        pmFPAMaskWeight.c \
     10        pmFPARead.c \
     11        pmFPAUtils.c \
     12        pmFPAWrite.c \
     13        pmHDU.c \
     14        pmHDUUtils.c \
     15        pmReadout.c \
     16        pmConcepts.c \
     17        pmConceptsRead.c \
     18        pmConceptsWrite.c \
     19        pmConceptsStandard.c \
     20        pmFPA_JPEG.c \
     21        pmFPAview.c \
     22        pmFPAfile.c
     23
     24#       pmFPAAstrometry.c
     25#       pmAstrometryObjects.c
     26#       pmChipMosaic.c
    827
    928psmoduleincludedir = $(includedir)
    1029psmoduleinclude_HEADERS = \
    11     pmAstrometry.h \
    12     pmAstrometryObjects.h
     30        pmFPA.h \
     31        pmFPAConstruct.h \
     32        pmFPACopy.h \
     33        pmFPAMaskWeight.h \
     34        pmFPARead.h \
     35        pmFPAUtils.h \
     36        pmFPAWrite.h \
     37        pmHDU.h \
     38        pmHDUUtils.h \
     39        pmReadout.h \
     40        pmConcepts.h \
     41        pmConceptsRead.h \
     42        pmConceptsWrite.h \
     43        pmConceptsStandard.h \
     44        pmFPA_JPEG.h \
     45        pmFPAview.h \
     46        pmFPAfile.h
     47
     48#       pmFPAAstrometry.h
     49#       pmAstrometryObjects.h
     50#       pmChipMosaic.h
  • trunk/psModules/src/astrom/pmAstrometry.c

    r6205 r6872  
    1010* XXX: We should review the extent of the warning messages on these functions
    1111* when the transformations are not successful.
    12 * 
     12*
    1313* XXX: Should we implement non-linear cell->chip transforms?
    14 * 
    15 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    16 *  @date $Date: 2006-01-26 21:10:50 $
     14*
     15*  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     16*  @date $Date: 2006-04-17 18:01:04 $
    1717*
    1818*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include <math.h>
    2626#include "pslib.h"
     27
    2728#include "pmAstrometry.h"
     29#include "pmConcepts.h"
    2830
    2931/*****************************************************************************
     
    6062        psFree(readout->mask);
    6163        psFree(readout->weight);
    62         //
    63         // XXX: Not sure if this is the right way to do things.  Currently the psListAdd()
    64         // increase the memory reference counter to the list data.  So, we
    65         // iterate through the list, and decrement the reference counters.
    66         //
    67         if (1) {
    68             if ((readout->bias != NULL) && (readout->bias->head != NULL)) {
    69                 psListElem *tmpElem = (psListElem *) readout->bias->head;
    70                 while (NULL != tmpElem) {
    71                     psMemDecrRefCounter((psImage *) tmpElem->data);
    72                     tmpElem = tmpElem->next;
    73                 }
    74             }
    75         }
    76         psFree(readout->bias);
    7764        psFree(readout->analysis);
     65        #if 0
     66
    7867        psFree(readout->parent);
     68        #endif
     69
     70        readout->parent = NULL;
    7971    }
    8072}
     
    8880        psFree(cell->concepts);
    8981        psFree(cell->analysis);
     82        psFree(cell->camera);
    9083        //
    9184        // Set the parent to NULL in all cell->readouts before psFree(cell->readouts)
    9285        // in order to avoid memory reference counter problems.
    9386        //
     87        #if 0
     88
    9489        for (psS32 i = 0 ; i < cell->readouts->n ; i++) {
    9590            pmReadout *tmpReadout = (pmReadout *) cell->readouts->data[i];
     
    9994            }
    10095        }
     96        psFree(cell->parent);
     97        #endif
     98
     99        cell->parent = NULL;
     100
    101101        psFree(cell->readouts);
    102         psFree(cell->parent);
    103102        psFree(cell->hdu);
     103
    104104    }
    105105}
     
    116116        // in order to avoid memory reference counter problems.
    117117        //
     118        #if 0
     119
    118120        for (psS32 i = 0 ; i < chip->cells->n ; i++) {
    119121            pmCell *tmpCell = (pmCell *) chip->cells->data[i];
     
    123125            }
    124126        }
     127        psFree(chip->parent);
     128        #endif
     129
     130        chip->parent = NULL;
    125131        psFree(chip->cells);
    126         psFree(chip->parent);
    127132        psFree(chip->hdu);
    128133    }
     
    143148        // in order to avoid memory reference counter problems.
    144149        //
     150        #if 0
     151
    145152        for (psS32 i = 0 ; i < fpa->chips->n ; i++) {
    146153            pmChip *tmpChip = (pmChip *) fpa->chips->data[i];
     
    150157            }
    151158        }
     159        #endif
    152160        psFree(fpa->chips);
    153161        psFree(fpa->hdu);
     
    156164}
    157165
     166void p_pmHDUFree(p_pmHDU *hdu)
     167{
     168    if (hdu) {
     169        psFree(hdu->extname);
     170        psFree(hdu->header);
     171        psFree(hdu->images);
     172        psFree(hdu->masks);
     173        psFree(hdu->weights);
     174    }
     175}
     176
    158177// XXX: Verify these default values for row0, col0, rowBins, colBins
     178// PAP: These values may disappear in the future in favour of values in parent->concepts?
    159179pmReadout *pmReadoutAlloc(pmCell *cell)
    160180{
    161181    pmReadout *tmpReadout = (pmReadout *) psAlloc(sizeof(pmReadout));
    162182
    163     tmpReadout->col0 = -1;
    164     tmpReadout->row0 = -1;
    165     tmpReadout->colBins = -1;
    166     tmpReadout->rowBins = -1;
     183    tmpReadout->col0 = 0;
     184    tmpReadout->row0 = 0;
     185    tmpReadout->colBins = 0;
     186    tmpReadout->rowBins = 0;
    167187    tmpReadout->image = NULL;
    168188    tmpReadout->mask = NULL;
    169189    tmpReadout->weight = NULL;
    170     tmpReadout->bias = NULL;
    171190    tmpReadout->analysis = psMetadataAlloc();
    172191    tmpReadout->parent = cell;
     
    179198
    180199// XXX: Verify these default values for row0, col0.
     200// PAP: These values may disappear in the future in favour of values in the "concepts"?
    181201pmCell *pmCellAlloc(
    182202    pmChip *chip,
    183     psMetadata *cameradata,
    184     psString name)
     203    psMetadata *cameraData,
     204    const char *name)
    185205{
    186206    pmCell *tmpCell = (pmCell *) psAlloc(sizeof(pmCell));
    187207
    188     tmpCell->col0 = -1;
    189     tmpCell->row0 = -1;
     208    tmpCell->col0 = 0;
     209    tmpCell->row0 = 0;
    190210    tmpCell->toChip = NULL;
    191211    tmpCell->toFPA = NULL;
     
    196216        psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not add CELL.NAME to metadata.\n");
    197217    }
    198     tmpCell->camera = cameradata;
    199     tmpCell->analysis = NULL;
     218    tmpCell->camera = psMemIncrRefCounter(cameraData);
     219    tmpCell->analysis = psMetadataAlloc();
    200220    tmpCell->readouts = psArrayAlloc(0);
    201221    tmpCell->parent = chip;
     
    203223        chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell);
    204224    }
    205     tmpCell->valid = false;
     225    tmpCell->process = true;            // All cells are processed by default
     226    tmpCell->exists = false;            // Not yet read in
    206227    tmpCell->hdu = NULL;
     228
     229    pmConceptsBlankCell(tmpCell);
    207230
    208231    psMemSetDeallocator(tmpCell, (psFreeFunc) cellFree);
     
    211234
    212235// XXX: Verify these default values for row0, col0.
     236// PAP: row0, col0 may disappear in the future in favour of storing values in the "concepts".
    213237pmChip *pmChipAlloc(
    214238    pmFPA *fpa,
    215     psString name)
     239    const char *name)
    216240{
    217241    pmChip *tmpChip = (pmChip *) psAlloc(sizeof(pmChip));
    218242
    219     tmpChip->col0 = -1;
    220     tmpChip->row0 = -1;
     243    tmpChip->col0 = 0;
     244    tmpChip->row0 = 0;
    221245    tmpChip->toFPA = NULL;
    222246    tmpChip->fromFPA = NULL;
     
    226250        psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not add CHIP.NAME to metadata.\n");
    227251    }
    228     tmpChip->analysis = NULL;
     252    tmpChip->analysis = psMetadataAlloc();
    229253    tmpChip->cells = psArrayAlloc(0);
    230254    tmpChip->parent = fpa;
     
    232256        fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip);
    233257    }
    234     tmpChip->valid = false;
     258    tmpChip->process = true;            // Work on all chips, by default
     259    tmpChip->exists = false;            // Not read in yet
    235260    tmpChip->hdu = NULL;
     261
     262    pmConceptsBlankChip(tmpChip);
    236263
    237264    psMemSetDeallocator(tmpChip, (psFreeFunc) chipFree);
     
    248275    tmpFPA->concepts = psMetadataAlloc();
    249276    tmpFPA->analysis = NULL;
    250     tmpFPA->camera = camera;
     277    tmpFPA->camera = psMemIncrRefCounter((psPtr)camera);
    251278    tmpFPA->chips = psArrayAlloc(0);
    252279    tmpFPA->hdu = NULL;
    253280    tmpFPA->phu = NULL;
    254281
     282    pmConceptsBlankFPA(tmpFPA);
     283
    255284    psMemSetDeallocator(tmpFPA, (psFreeFunc) FPAFree);
    256285    return(tmpFPA);
     286}
     287
     288p_pmHDU *p_pmHDUAlloc(const char *extname)
     289{
     290    p_pmHDU *hdu = psAlloc(sizeof(p_pmHDU));
     291    psMemSetDeallocator(hdu, (psFreeFunc)p_pmHDUFree);
     292
     293    hdu->extname = psStringCopy(extname);
     294    hdu->header = NULL;
     295    hdu->images = NULL;
     296    hdu->masks = NULL;
     297    hdu->weights = NULL;
     298
     299    return hdu;
    257300}
    258301
     
    317360
    318361
    319 /*****************************************************************************/
    320 /* FUNCTION IMPLEMENTATION - PUBLIC                                          */
    321 /*****************************************************************************/
    322 
    323 pmCell* pmCellInFPA(
    324     const psPlane* fpaCoord,
    325     const pmFPA* FPA)
    326 {
    327     PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);
    328     PS_ASSERT_PTR_NON_NULL(FPA, NULL);
    329 
    330     pmChip* tmpChip = NULL;
    331     psPlane chipCoord;
    332     pmCell* outCell = NULL;
    333 
    334     // Determine which chip contains the fpaCoords.
    335     tmpChip = pmChipInFPA(fpaCoord, FPA);
    336     if (tmpChip == NULL) {
    337         return(NULL);
    338     }
    339 
    340     // Convert to those chip coordinates.
    341     psPlane *rc = pmCoordFPAToChip(&chipCoord, fpaCoord, tmpChip);
    342     if (rc == NULL) {
    343         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine Chip coords.\n");
    344         return(NULL);
    345     }
    346 
    347     // Determine which cell contains those chip coordinates.
    348     outCell = pmCellInChip(&chipCoord, tmpChip);
    349     if (outCell == NULL) {
    350         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the cell.\n");
    351         return(NULL);
    352     }
    353 
    354     return (outCell);
    355 }
    356 
    357 pmChip* pmChipInFPA(
    358     const psPlane* fpaCoord,
    359     const pmFPA* FPA)
    360 {
    361     PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);
    362     PS_ASSERT_PTR_NON_NULL(FPA, NULL);
    363     PS_ASSERT_PTR_NON_NULL(FPA->chips, NULL);
    364 
    365     psArray* chips = FPA->chips;
    366     psS32 nChips = chips->n;
    367     psPlane chipCoord;
    368     pmCell *tmpCell = NULL;
    369 
    370     //
    371     // Loop through every chip in this FPA.  Convert the original FPA
    372     // coordinates to chip coordinates for that chip.  Then, determine if any
    373     // cells in that chip contain those chip coordinates.
    374     // XXX: Depending on the number of chips, and their topology, there may be
    375     // a much more efficient way of doing this.
    376     //
    377     for (psS32 i = 0; i < nChips; i++) {
    378         pmChip* tmpChip = chips->data[i];
    379         PS_ASSERT_PTR_NON_NULL(tmpChip, NULL);
    380         PS_ASSERT_PTR_NON_NULL(tmpChip->fromFPA, NULL);
    381 
    382         psPlaneTransformApply(&chipCoord, tmpChip->fromFPA, fpaCoord);
    383 
    384         tmpCell = pmCellInChip(&chipCoord, tmpChip);
    385         if (tmpCell != NULL) {
    386             return(tmpChip);
    387         }
    388     }
    389 
    390     psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the chip.\n");
    391     return (NULL);
    392 }
    393 
    394 
    395 pmCell* pmCellInChip(
    396     const psPlane* chipCoord,
    397     const pmChip* chip)
    398 {
    399     PS_ASSERT_PTR_NON_NULL(chipCoord, NULL);
    400     PS_ASSERT_PTR_NON_NULL(chip, NULL);
    401 
    402     psPlane cellCoord;
    403     psArray* cells;
    404 
    405     cells = chip->cells;
    406     if (cells == NULL) {
    407         return NULL;
    408     }
    409 
    410     //
    411     // We loop over each cell in the chip.  We transform the chipCoord into
    412     // a cellCoord for that cell and determine if that cellCoord is valid.
    413     // If so, then we return that cell.
    414     // XXX: Depending on the number of cells, and their topology, there may be
    415     // a much more efficient way of doing this.
    416     //
    417     for (psS32 i = 0; i < cells->n; i++) {
    418         pmCell* tmpCell = (pmCell* ) cells->data[i];
    419         PS_ASSERT_PTR_NON_NULL(tmpCell, NULL);
    420 
    421         psPlaneTransform *chipToCell = NULL;
    422         if (true ==  p_psIsProjectionLinear(tmpCell->toChip)) {
    423             chipToCell = p_psPlaneTransformLinearInvert(tmpCell->toChip);
    424         } else {
    425             psLogMsg(__func__, PS_LOG_WARN, "WARNING: non-linear cell->chip transforms are not yet implemented.\n");
    426             //chipToCell = psPlaneTransformInvert(NULL, tmpCell->toChip, NULL, -1);
    427             chipToCell = NULL;
    428         }
    429         if (chipToCell == NULL) {
    430             psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not invert the Cell->toChip transform.\n");
    431             return(NULL);
    432         }
    433         psArray* readouts = tmpCell->readouts;
    434 
    435         if (readouts != NULL) {
    436             for (psS32 j = 0; j < readouts->n; j++) {
    437                 pmReadout* tmpReadout = readouts->data[j];
    438                 PS_ASSERT_READOUT_NON_NULL(tmpReadout, NULL);
    439 
    440                 psPlaneTransformApply(&cellCoord,
    441                                       chipToCell,
    442                                       chipCoord);
    443 
    444                 if (checkValidImageCoords(cellCoord.x,
    445                                           cellCoord.y,
    446                                           tmpReadout->image)) {
    447                     psFree(chipToCell);
    448                     return (tmpCell);
    449                 }
    450             }
    451         }
    452         psFree(chipToCell);
    453     }
    454 
    455     //psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the cell.\n");
    456     return (NULL);
    457 }
    458 
    459 
    460 psPlane* pmCoordCellToFPA(
    461     psPlane* fpaCoord,
    462     const psPlane* cellCoord,
    463     const pmCell* cell)
    464 {
    465     PS_ASSERT_PTR_NON_NULL(cellCoord, NULL);
    466     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    467 
    468     psPlane *rc = psPlaneTransformApply(fpaCoord, cell->toFPA, cellCoord);
    469     if (rc == NULL) {
    470         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform cell coords to FPA coords.\n");
    471     }
    472     return(rc);
    473 }
    474 
    475 
    476 psPlane* pmCoordChipToFPA(
    477     psPlane* outCoord,
    478     const psPlane* inCoord,
    479     const pmChip* chip)
    480 {
    481     PS_ASSERT_PTR_NON_NULL(inCoord, NULL);
    482     PS_ASSERT_PTR_NON_NULL(chip, NULL);
    483 
    484     psPlane *rc = psPlaneTransformApply(outCoord, chip->toFPA, inCoord);
    485     if (rc == NULL) {
    486         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform chip coords to FPA coords.\n");
    487     }
    488     return(rc);
    489 }
    490 
    491 
    492 psPlane* pmCoordFPAToChip(
    493     psPlane* chipCoord,
    494     const psPlane* fpaCoord,
    495     const pmChip* chip)
    496 {
    497     PS_ASSERT_PTR_NON_NULL(fpaCoord, NULL);
    498     PS_ASSERT_PTR_NON_NULL(chip, NULL);
    499     PS_ASSERT_PTR_NON_NULL(chip->fromFPA, NULL);
    500 
    501     psPlane *rc = psPlaneTransformApply(chipCoord, chip->fromFPA, fpaCoord);
    502     if (rc == NULL) {
    503         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform FPA coords to Chip coords.\n");
    504     }
    505     return(rc);
    506 }
    507 
    508 psPlane* pmCoordCellToChip(
    509     psPlane* outCoord,
    510     const psPlane* inCoord,
    511     const pmCell* cell)
    512 {
    513     PS_ASSERT_PTR_NON_NULL(inCoord, NULL);
    514     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    515 
    516     psPlane *rc = psPlaneTransformApply(outCoord, cell->toChip, inCoord);
    517     if (rc == NULL) {
    518         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform Cell coords to Chip coords.\n");
    519     }
    520     return(rc);
    521 }
    522 
    523 psPlane* pmCoordChipToCell(
    524     psPlane* cellCoord,
    525     const psPlane* chipCoord,
    526     const pmCell* cell)
    527 {
    528     PS_ASSERT_PTR_NON_NULL(chipCoord, NULL);
    529     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    530     PS_ASSERT_PTR_NON_NULL(cell->parent, NULL);
    531 
    532     pmCell *tmpCell = pmCellInChip(chipCoord, cell->parent);
    533     if (tmpCell == NULL) {
    534         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine the proper cell.\n");
    535         return(NULL);
    536     }
    537 
    538     psPlaneTransform *tmpChipToCell = NULL;
    539     PS_ASSERT_PTR_NON_NULL(tmpCell->toChip, NULL);
    540     if (true ==  p_psIsProjectionLinear(tmpCell->toChip)) {
    541         tmpChipToCell = p_psPlaneTransformLinearInvert(tmpCell->toChip);
    542     } else {
    543         psLogMsg(__func__, PS_LOG_WARN, "WARNING: non-linear cell->chip transforms are not yet implemented.\n");
    544         // XXX: tmpChipToCell = psPlaneTransformInvert(NULL, tmpCell->toChip, NULL, -1);
    545         tmpChipToCell = NULL;
    546     }
    547     if (tmpChipToCell == NULL) {
    548         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not invert the Cell->toChip transform.\n");
    549         return(NULL);
    550     }
    551 
    552     psPlane *rc = psPlaneTransformApply(cellCoord, tmpChipToCell, chipCoord);
    553     if (rc == NULL) {
    554         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform Chip coords to Cell coords.\n");
    555     }
    556     psFree(tmpChipToCell);
    557     return(rc);
    558 }
    559 
    560 psPlane* pmCoordFPAToTP(
    561     psPlane* outCoord,
    562     const psPlane* inCoord,
    563     double color,
    564     double magnitude,
    565     const pmFPA* fpa)
    566 {
    567     PS_ASSERT_PTR_NON_NULL(inCoord, NULL);
    568     PS_ASSERT_PTR_NON_NULL(fpa, NULL);
    569 
    570     psPlane *rc = psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord, color, magnitude);
    571     if (rc == NULL) {
    572         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform FPA coords to tangent plane coords.\n");
    573     }
    574     return(rc);
    575 }
    576 
    577 psPlane* pmCoordTPToFPA(
    578     psPlane* fpaCoord,
    579     const psPlane* tpCoord,
    580     double color,
    581     double magnitude,
    582     const pmFPA* fpa)
    583 {
    584     PS_ASSERT_PTR_NON_NULL(tpCoord, NULL);
    585     PS_ASSERT_PTR_NON_NULL(fpa, NULL);
    586     PS_ASSERT_PTR_NON_NULL(fpa->fromTangentPlane, NULL);
    587 
    588     psPlane *rc = psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane, tpCoord, color, magnitude);
    589     if (rc == NULL) {
    590         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform tangent plane coords to FPA coords.\n");
    591     }
    592     return(rc);
    593 }
    594 
    595 
    596 /*****************************************************************************
    597 XXXDeproject(outSphere, coord, projection): This private routine is a wrapper
    598 for p_psDeproject().  The reason: p_psDeproject() and p_psProject() combined
    599 do not seem to produce the original coordinates when they even though they
    600 should.  XXXDeproject() simply negates the ->r and ->d members of the output
    601 psSphere if the input ->y is larger than 0.0.  I don't know why it works.
    602  
    603 I'm guessing the p_psProject() and p_psDeproject() functions have bugs.
    604  
    605 XXX: It appears that p_psProject() and p_psDeproject() have been fixed.
    606 Remove this.
    607  *****************************************************************************/
    608 psSphere* XXXDeproject(
    609     psSphere *outSphere,
    610     const psPlane* coord,
    611     const psProjection* projection)
    612 {
    613     psSphere *rc = p_psDeproject(outSphere, coord, projection);
    614 
    615     if (coord->y >= 0.0) {
    616         rc->d = -rc->d;
    617         rc->r = -rc->r;
    618     }
    619 
    620     return(rc);
    621 }
    622 
    623 /*****************************************************************************
    624   *****************************************************************************/
    625 psSphere* pmCoordTPToSky(
    626     psSphere* outSphere,
    627     const psPlane* tpCoord,
    628     const psProjection *projection)
    629 {
    630     PS_ASSERT_PTR_NON_NULL(tpCoord, NULL);
    631     PS_ASSERT_PTR_NON_NULL(projection, NULL);
    632 
    633     //    psSphere *rc = XXXDeproject(outSphere, tpCoord, projection);
    634     psSphere *rc = p_psDeproject(outSphere, tpCoord, projection);
    635     if (rc == NULL) {
    636         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform tangent plane coords to sky coords.\n");
    637     }
    638     return(rc);
    639 }
    640 
    641362/*****************************************************************************
    642363 *****************************************************************************/
    643 psPlane* pmCoordSkyToTP(
    644     psPlane* tpCoord,
    645     const psSphere* in,
    646     const psProjection *projection)
    647 {
    648     PS_ASSERT_PTR_NON_NULL(in, NULL);
    649     PS_ASSERT_PTR_NON_NULL(projection, NULL);
    650 
    651     psPlane *rc = p_psProject(tpCoord, in, projection);
    652     if (rc == NULL) {
    653         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform sky to tangent plane coords.\n");
    654     }
    655     return(rc);
    656 }
    657 
    658 /*****************************************************************************
    659  *****************************************************************************/
    660 psSphere* pmCoordCellToSky(
    661     psSphere* skyCoord,
    662     const psPlane* cellCoord,
    663     double color,
    664     double magnitude,
    665     const pmCell* cell)
    666 {
    667     PS_ASSERT_PTR_NON_NULL(cellCoord, NULL);
    668     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    669     PS_ASSERT_PTR_NON_NULL(cell->toFPA, NULL);
    670     PS_ASSERT_PTR_NON_NULL(cell->parent, NULL);
    671     PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL);
    672     PS_ASSERT_PTR_NON_NULL(cell->parent->parent->toTangentPlane, NULL);
    673     PS_ASSERT_PTR_NON_NULL(cell->parent->parent->projection, NULL);
    674     psPlane fpaCoord;
    675     psPlane tpCoord;
    676     psPlane *rc;
    677     pmFPA* parFPA = (cell->parent)->parent;
    678 
    679     // Convert the input cell coordinates to FPA coordinates.
    680     rc = psPlaneTransformApply(&fpaCoord, cell->toFPA, cellCoord);
    681     if (rc == NULL) {
    682         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could transform cell coords to FPA coords.\n");
    683         return(NULL);
    684     }
    685 
    686     // Convert the FPA coordinates to tangent plane Coordinates.
    687     rc = psPlaneDistortApply(&tpCoord, parFPA->toTangentPlane, &fpaCoord, color, magnitude);
    688     if (rc == NULL) {
    689         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could transform FPA coords to tangent plane coords.\n");
    690         return(NULL);
    691     }
    692 
    693     // Convert the tangent plane Coordinates to sky coordinates.
    694     psSphere *rc2 = pmCoordTPToSky(skyCoord, &tpCoord, parFPA->projection);
    695     if (rc2 == NULL) {
    696         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform cell coords to sky coords.\n");
    697     }
    698 
    699     return(rc2);
    700 }
    701 
    702 /*****************************************************************************
    703  *****************************************************************************/
    704 psPlane* pmCoordSkyToCell(
    705     psPlane* cellCoord,
    706     const psSphere* skyCoord,
    707     float color,
    708     float magnitude,
    709     const pmCell* cell)
    710 {
    711     PS_ASSERT_PTR_NON_NULL(skyCoord, NULL);
    712     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    713     PS_ASSERT_PTR_NON_NULL(cell->parent, NULL);
    714     PS_ASSERT_PTR_NON_NULL(cell->parent->parent, NULL);
    715     pmChip *parChip = cell->parent;
    716     pmFPA *parFPA = parChip->parent;
    717     psPlane tpCoord;
    718     psPlane fpaCoord;
    719     psPlane chipCoord;
    720     psPlane *rc;
    721 
    722     // Convert the skyCoords to tangent plane coords.
    723     rc = pmCoordSkyToTP(&tpCoord, skyCoord, parFPA->projection);
    724     if (rc == NULL) {
    725         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine tangent plane coords.\n");
    726         return(NULL);
    727     }
    728 
    729     // Convert the tangent plane coords to FPA coords.
    730     rc = pmCoordTPToFPA(&fpaCoord, &tpCoord, color, magnitude, parFPA);
    731     if (rc == NULL) {
    732         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine FPA coords.\n");
    733         return(NULL);
    734     }
    735 
    736     // Convert the FPA coords to chip coords.
    737     rc = pmCoordFPAToChip(&chipCoord, &fpaCoord, parChip);
    738     if (rc == NULL) {
    739         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine chip coords.\n");
    740         return(NULL);
    741     }
    742 
    743     // Convert the chip coords to cell coords.
    744     rc = pmCoordChipToCell(cellCoord, &chipCoord, cell);
    745     if (rc == NULL) {
    746         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not determine cell coords.\n");
    747         return(NULL);
    748     }
    749 
    750     return (cellCoord);
    751 }
    752 
    753 /*****************************************************************************
    754  *****************************************************************************/
    755 psSphere* pmCoordCellToSkyQuick(
    756     psSphere* outSphere,
    757     const psPlane* cellCoord,
    758     const pmCell* cell)
    759 {
    760     PS_ASSERT_PTR_NON_NULL(cellCoord, NULL);
    761     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    762     PS_ASSERT_PTR_NON_NULL(cell->toSky, NULL);
    763     psPlane outPlane;
    764     psPlane *rc;
    765     rc = psPlaneTransformApply(&outPlane, cell->toSky, cellCoord);
    766     if (rc == NULL) {
    767         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could transform cell coords to sky coords.\n");
    768         return(NULL);
    769     }
    770 
    771     psSphere *out = outSphere;
    772     if (out == NULL) {
    773         out = psSphereAlloc();
    774     }
    775     out->r = outPlane.y;
    776     out->d = outPlane.x;
    777 
    778     return(out);
    779 }
    780 
    781 /*****************************************************************************
    782  *****************************************************************************/
    783 psPlane* pmCoordSkyToCellQuick(
    784     psPlane* cellCoord,
    785     const psSphere* skyCoord,
    786     const pmCell* cell)
    787 {
    788     PS_ASSERT_PTR_NON_NULL(skyCoord, NULL);
    789     PS_ASSERT_PTR_NON_NULL(cell, NULL);
    790     PS_ASSERT_PTR_NON_NULL(cell->toSky, NULL);
    791     psPlane skyPlane;
    792     skyPlane.y = skyCoord->r;
    793     skyPlane.x = skyCoord->d;
    794 
    795     psPlane *rc = psPlaneTransformApply(cellCoord, cell->toSky, &skyPlane);
    796     if (rc == NULL) {
    797         psLogMsg(__func__, PS_LOG_WARN, "WARNING: could not transform sky to cell coords.\n");
    798     }
    799     return(cellCoord);
     364
     365// Set cells within a chip to be processed or not
     366static bool setCellsProcess(const pmChip *chip, // Chip of interest
     367                            bool process  // Process this chip?
     368                           )
     369{
     370    PS_ASSERT_PTR_NON_NULL(chip, false);
     371
     372    psArray *cells = chip->cells;       // Component cells
     373    if (! cells) {
     374        return false;
     375    }
     376    for (int i = 0; i < cells->n; i++) {
     377        pmCell *tmpCell = cells->data[i]; // Cell of interest
     378        if (tmpCell) {
     379            tmpCell->process = process;
     380        }
     381    }
     382
     383    return true;
    800384}
    801385
     
    807391{
    808392    PS_ASSERT_PTR_NON_NULL(fpa, false);
    809     if ((fpa->chips == NULL) || (chipNum >= fpa->chips->n)) {
     393
     394    psArray *chips = fpa->chips;        // Component chips
     395    if ((chips == NULL) || (chipNum >= chips->n)) {
    810396        return(false);
    811397    }
    812     psBool rc = true;
    813 
    814     for (psS32 i = 0 ; i < fpa->chips->n ; i++) {
    815         pmChip *tmpChip = (pmChip *) fpa->chips->data[i];
     398
     399    for (int i = 0 ; i < chips->n ; i++) {
     400        pmChip *tmpChip = (pmChip *) chips->data[i];
    816401        if (tmpChip == NULL) {
    817             rc = false;
     402            continue;
     403        }
     404        if (i == chipNum) {
     405            tmpChip->process = true;
     406            setCellsProcess(tmpChip, true);
    818407        } else {
    819             if (i == chipNum) {
    820                 tmpChip->valid = true;
    821             } else {
    822                 tmpChip->valid = false;
    823             }
    824         }
    825     }
    826 
    827     return(rc);
     408            tmpChip->process = false;
     409            setCellsProcess(tmpChip, false);
     410        }
     411
     412    }
     413
     414    return true;
    828415}
    829416
     
    831418/*****************************************************************************
    832419XXX: The SDRS is ambiguous on a few things:
    833     Whether or not the other chips should be set valid=true.
    834     Should we return the number of chip valid=true before or after they're set,
     420    Whether or not the other chips should be set process=true. [PAP: No]
     421    Should we return the number of chip process=true before or after they're set, [PAP: After]
    835422 *****************************************************************************/
    836423/**
    837  * 
    838  * pmFPAExcludeChip shall set valid to false only for the specified chip
     424 *
     425 * pmFPAExcludeChip shall set process to false only for the specified chip
    839426 * number (chipNum). In the event that the specified chip number does not exist
    840427 * within the fpa, the function shall generate a warning, and perform no action.
    841  * The function shall return the number of chips within the fpa that have valid
     428 * The function shall return the number of chips within the fpa that have process
    842429 * set to true.
    843  * 
     430 *
    844431 */
    845432int pmFPAExcludeChip(
     
    849436    PS_ASSERT_PTR_NON_NULL(fpa, false);
    850437
    851     if (fpa->chips == NULL) {
     438    psArray *chips = fpa->chips;        // Component chips
     439    if (chips == NULL) {
    852440        psLogMsg(__func__, PS_LOG_WARN, "WARNING: fpa->chips == NULL\n");
    853441        return(0);
    854442    }
    855     if ((chipNum >= fpa->chips->n) || (NULL == (pmChip *) fpa->chips->data[chipNum])) {
     443    if ((chipNum >= chips->n) || (NULL == (pmChip *) chips->data[chipNum])) {
    856444        psLogMsg(__func__, PS_LOG_WARN, "WARNING: the specified chip (%d) does not exist.\n", chipNum);
    857445        return(0);
    858446    }
    859447
    860     psS32 numChips = 0;
    861     for (psS32 i = 0 ; i < fpa->chips->n ; i++) {
    862         pmChip *tmpChip = (pmChip *) fpa->chips->data[i];
     448    int numChips = 0;                   // Number of chips to be processed
     449    for (int i = 0 ; i < chips->n ; i++) {
     450        pmChip *tmpChip = (pmChip *) chips->data[i]; // Chip of interest
    863451        if (tmpChip != NULL) {
    864452            if (i == chipNum) {
    865                 tmpChip->valid = false;
    866             } else {
    867                 tmpChip->valid = true;
     453                tmpChip->process = false;
     454                setCellsProcess(tmpChip, false); // Wipe out the cell as well
     455            } else if (tmpChip->process) {
    868456                numChips++;
    869457            }
     
    874462}
    875463
     464
     465bool pmCellSetWeights(pmCell *cell // Cell for which to set weights
     466                     )
     467{
     468    float gain = psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); // Cell gain
     469    float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE"); // Cell read noise
     470    psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC"); // Trim section
     471
     472    p_pmHDU *hdu = cell->hdu;           // The data unit, containing the weight and mask originals
     473    if (!hdu) {
     474        pmChip *chip = cell->parent;    // The parent chip
     475        if (chip->hdu) {
     476            hdu = chip->hdu;
     477        } else {
     478            pmFPA *fpa = chip->parent;  // The parent FPA
     479            hdu = fpa->hdu;
     480            if (!hdu) {
     481                psError(PS_ERR_UNKNOWN, true, "Unable to find the HDU in the hierarchy!\n");
     482                return false;
     483            }
     484        }
     485    }
     486
     487    psArray *pixels = hdu->images;      // Array of images
     488    psArray *weights = hdu->weights;    // Array of weight images
     489    psArray *masks = hdu->masks;        // Array of mask images
     490    // Generate the weights and masks if required
     491    if (! weights) {
     492        weights = psArrayAlloc(pixels->n);
     493        for (int i = 0; i < pixels->n; i++) {
     494            psImage *image = pixels->data[i];
     495            weights->data[i] = psImageAlloc(image->numCols, image->numRows, PS_TYPE_F32);
     496            psImageInit(weights->data[i], 0.0);
     497        }
     498        hdu->weights = weights;
     499    }
     500    if (! masks) {
     501        masks = psArrayAlloc(pixels->n);
     502        for (int i = 0; i < pixels->n; i++) {
     503            psImage *image = pixels->data[i];
     504            masks->data[i] = psImageAlloc(image->numCols, image->numRows, PS_TYPE_U8);
     505            psImageInit(masks->data[i], 0);
     506        }
     507        hdu->masks = masks;
     508    }
     509
     510    // Set the pixels
     511    psArray *readouts = cell->readouts; // Array of readouts
     512    for (int i = 0; i < readouts->n; i++) {
     513        pmReadout *readout = readouts->data[i]; // The readout of interest
     514
     515        if (! readout->weight) {
     516            readout->weight = weights->data[i];
     517        }
     518        if (! readout->mask) {
     519            readout->mask = masks->data[i];
     520        }
     521
     522        // Mask is already set to 0
     523
     524        // Set weight image to the variance = g*f + rn^2
     525        psImage *image = psImageSubset(readout->image, *trimsec); // The pixels
     526        psImage *weight = psImageSubset(readout->weight, *trimsec); // The weight map
     527        psBinaryOp(weight, image, "*", psScalarAlloc(gain, PS_TYPE_F32));
     528        psBinaryOp(weight, weight, "+", psScalarAlloc(readnoise*readnoise, PS_TYPE_F32));
     529    }
     530
     531    return true;
     532}
     533
     534
  • trunk/psModules/src/astrom/pmAstrometry.h

    r6205 r6872  
    88*  @author GLG, MHPCC
    99*
    10 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2006-01-26 21:10:50 $
     10*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-04-17 18:01:04 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3030{
    3131    const char *extname;                // Extension name, if it corresponds to this level
    32     psArray *pixels;                    // The pixel data, if it corresponds to this level
    3332    psMetadata *header;                 // The FITS header, if it corresponds to this level
     33    psArray *images;                    // The pixel data, if it corresponds to this level
     34    psArray *masks;                     // The mask data, if it corresponds to this level
     35    psArray *weights;                   // The weight data, if it corresponds to this level
    3436}
    3537p_pmHDU;
    3638
    37 p_pmHDU *pmHDUAlloc();
    38 void *pmHDUFree(p_pmHDU *hdu);
    39 
    4039/** Focal plane data structure
    41  * 
     40 *
    4241 *  A focal plane consists of one or more chips (according to the number of
    4342 *  pieces of contiguous silicon). It contains metadata containers for the
     
    5251 *  transformation which will be derived from numerically inverting the forward
    5352 *  transformation.
    54  * 
     53 *
    5554 */
    5655typedef struct
     
    7170
    7271/** Chip data structure
    73  * 
     72 *
    7473 *  A chip consists of one or more cells (according to the number of amplifiers
    7574 *  on the device). The chip contains metadata containers for the concepts and
     
    8281 *  inverting the forward transformation. A boolean indicates whether the chip is
    8382 *  of interest, allowing it to be excluded from analysis.
    84  * 
     83 *
    8584 */
    8685typedef struct
     
    9796    psArray *cells;                     ///< The cells (referred to by name)
    9897    pmFPA *parent;                      ///< Parent FPA
    99     bool valid;                         ///< Do we bother about reading and working with this chip?
     98    bool process;                       ///< Do we bother about reading and working with this chip?
     99    bool exists;                        ///< Does the chip exist --- has it been read in?
    100100    p_pmHDU *hdu;                       ///< FITS data
    101101}
     
    126126    psArray *readouts;                  ///< The readouts (referred to by number)
    127127    pmChip *parent;                     ///< Parent chip
    128     bool valid;                         ///< Do we bother about reading and working with this cell?
     128    bool process;                       ///< Do we bother about reading and working with this cell?
     129    bool exists;                        ///< Does the cell exist --- has it been read in?
    129130    p_pmHDU *hdu;                       ///< FITS data
    130131}
     
    144145{
    145146    // Position on the cell
     147    // XXX: These may be removed in the future; use parent->concepts instead?
    146148    int col0;                           ///< Offset from the left of chip.
    147149    int row0;                           ///< Offset from the bottom of chip.
     
    152154    psImage *mask;                      ///< Mask of input image
    153155    psImage *weight;                    ///< Weight of input image
    154     psList *bias;                       ///< List of bias section (sub-)images
    155156    psMetadata *analysis;               ///< Readout-level analysis metadata
    156157    pmCell *parent;                     ///< Parent cell
     
    183184 */
    184185pmCell *pmCellAlloc(
    185     pmChip *chip,                        ///< Parent chip
    186     psMetadata *cameradata,
    187     psString name
     186    pmChip *chip,       ///< Parent chip
     187    psMetadata *cameraData, ///< Camera data
     188    const char *name    ///< Name of cell
    188189);
    189190
    190191/** Allocates a pmChip
    191  * 
     192 *
    192193 *  The constructor shall make an empty pmChip. If the parent fpa is not NULL,
    193194 *  the parent link is made and the chip shall be placed in the parent's array
     
    199200 */
    200201pmChip *pmChipAlloc(
    201     pmFPA *fpa,
    202     psString name
    203 
     202    pmFPA *fpa,                         ///< FPA to which the chip belongs
     203    const char *name                    ///< Name of chip
    204204);
    205205
    206206/** Allocates a pmFPA
    207  * 
     207 *
    208208 *  The constructor shall make an empty pmFPA. The chips array shall be
    209209 *  allocated with a zero size, the camera and db pointers set to the values
    210210 *  provided, and the concepts metadata constructed. All other pointers in the
    211211 *  structure shall be initialized to NULL.
    212  * 
     212 *
    213213 */
    214214pmFPA *pmFPAAlloc(
     
    216216);
    217217
     218/** Allocates a p_pmHDU
     219 *
     220 * XXX: More detailed description
     221 *
     222 * @return p_pmHDU*    newly allocated p_pmHDU
     223 */
     224p_pmHDU *p_pmHDUAlloc(const char *extname // Extension name
     225                     );
     226
    218227
    219228/** Verify parent links.
    220  * 
     229 *
    221230 *  This function checks the validity of the parent links in the FPA hierarchy.
    222231 *  If a parent link is not set (or not set correctly), it is corrected, and the
    223232 *  function shall return false. If all the parent pointers were correct, the
    224233 *  function shall return true.
    225  * 
     234 *
    226235 */
    227236bool pmFPACheckParents(
     
    232241
    233242/** FUNC DESC
    234  *
    235  *
    236  *
    237  *
    238  */
    239 
     243 *
     244 *
     245 *
     246 *
     247 */
     248
     249
     250
     251/**
     252 *
     253 * pmFPASelectChip shall set valid to true for the specified chip number
     254 * (chipNum), and all other chips shall have valid set to false. In the event
     255 * that the specified chip number does not exist within the fpa, the function
     256 * shall return false.
     257 *
     258 */
     259bool pmFPASelectChip(
     260    pmFPA *fpa,
     261    int chipNum
     262);
     263
     264/**
     265 *
     266 * pmFPAExcludeChip shall set valid to false only for the specified chip
     267 * number (chipNum). In the event that the specified chip number does not exist
     268 * within the fpa, the function shall generate a warning, and perform no action.
     269 * The function shall return the number of chips within the fpa that have valid
     270 * set to true.
     271 *
     272 */
     273int pmFPAExcludeChip(
     274    pmFPA *fpa,
     275    int chipNum
     276);
    240277
    241278
     
    426463);
    427464
    428 /**
    429  *
    430  * pmFPASelectChip shall set valid to true for the specified chip number
    431  * (chipNum), and all other chips shall have valid set to false. In the event
    432  * that the specified chip number does not exist within the fpa, the function
    433  * shall return false.
    434  * 
    435  */
    436 bool pmFPASelectChip(
    437     pmFPA *fpa,
    438     int chipNum
    439 );
    440 
    441 
    442 /**
    443  *
    444  * pmFPAExcludeChip shall set valid to false only for the specified chip
    445  * number (chipNum). In the event that the specified chip number does not exist
    446  * within the fpa, the function shall generate a warning, and perform no action.
    447  * The function shall return the number of chips within the fpa that have valid
    448  * set to true.
    449  * 
    450  */
    451 int pmFPAExcludeChip(
    452     pmFPA *fpa,
    453     int chipNum
    454 );
    455 
    456 
    457 /**
    458  *
    459  * pmFPAConstruct shall construct a focal plane hierarchy from a camera
    460  * configuration. A db handle is also provided so that may be set in the pmFPA.
    461  * The resultant pmFPA and its lower-down components shall be ready for to read a
    462  * FITS file into it by setting the extname pointers at the appropriate levels to
    463  * the appropriate FITS extension name.
    464  * 
    465  */
    466 pmFPA *pmFPAConstruct(
    467     const psMetadata *camera,
    468     psDB *db
    469 );
    470 
    471465
    472466#endif // #ifndef PS_ASTROMETRY_H
  • trunk/psModules/src/astrom/pmAstrometryObjects.c

    r6511 r6872  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2006-03-04 01:01:33 $
     10*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-04-17 18:01:04 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020#include <math.h>
    2121#include "pslib.h"
    22 #include "pmAstrometry.h"
     22#include "pmFPA.h"
    2323#include "pmAstrometryObjects.h"
    2424
     
    540540    psArray *rot;
    541541
    542     pmAstromStats minStat, newStat;
     542    pmAstromStats minStat;
     543    pmAstromStats newStat = {{0, 0, 0, 0}, {0, 0, 0, 0}, 0, 0, 0, 0};
    543544    psPlane center;
    544545
  • trunk/psModules/src/astrom/pmAstrometryObjects.h

    r6205 r6872  
    88*  @author EAM, IfA
    99*
    10 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2006-01-26 21:10:50 $
     10*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2006-04-17 18:01:04 $
    1212*
    1313*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2121# include <unistd.h>   // for unlink
    2222# include <pslib.h>
    23 # include <pmAstrometry.h>
    24 
    25 /*
    26  * 
     23# include <pmFPA.h>
     24
     25/*
     26 *
    2727 * This structure specifies the coordinate of the detection in each of the
    2828 * four necessary coordinate frames: pix defines the position in the psReadout
     
    3535 * coordinates, while the reference detections will be projected to the other
    3636 * frames from the sky coordinates.
    37  * 
     37 *
    3838 * XXX: There are more members here than in the SDRS.
    39  * 
     39 *
    4040 */
    4141typedef struct
     
    5555
    5656/*
    57  * 
     57 *
    5858 * The pmAstromMatch structure defines the cross-correlation between two
    5959 * arrays. A single such data item specifies that item number pmAstromMatch.idx1
    6060 * in the first list corresponds to pmAstromMatch.idx2 in the second list.
    61  * 
     61 *
    6262 */
    6363typedef struct
     
    7070
    7171/*
    72  * 
     72 *
    7373 * XXX: Not in SDRS.
    74  * 
     74 *
    7575 */
    7676typedef struct
     
    8888
    8989/*
    90  * 
     90 *
    9191 * If the two sets of coordinates are expected to agree very well (ie, the
    9292 * current best-guess astrometric solution is quite close to the radius. The
     
    9797 * ASTROM.MATCH.RADIUS). The output consists an array of pmAstromMatch values,
    9898 * defined below.
    99  * 
     99 *
    100100 */
    101101psArray *pmAstromRadiusMatch(
     
    108108
    109109/*
    110  * 
     110 *
    111111 * This function accepts an array of pmAstromObj objects and rotates them by
    112112 * the given angle about the given center coordinate pCenter,qCenter in the Focal
    113113 * Plane Array coordinates.
    114  * 
     114 *
    115115 * XXX: This differs from the SDRS
    116  * 
     116 *
    117117 */
    118118/* SDRS
     
    132132
    133133/*
    134  * 
     134 *
    135135 * If the two sets of coordinates are not known to agree well, but the
    136136 * relative scale and approximate relative rotation is known, then a much faster
     
    147147 * allowing the procedure to scan over a range of rotations. We define the
    148148 * following function to apply this matching algorithm:
    149  * 
     149 *
    150150 * XXX: In the SDRS, this function is a pointer.
    151  * 
     151 *
    152152 */
    153153pmAstromStats pmAstromGridMatch(
     
    159159
    160160/*
    161  * 
     161 *
    162162 * The result of a pmAstromGridMatch may be used to modify the astrometry
    163163 * transformation information for a pmFPA image hierarchy structure. The result
     
    167167 * the linear terms of the pmFPA.toTangentPlane transformation. These two
    168168 * adjustments are made using the function:
    169  * 
     169 *
    170170 * XXX: This function name is different in the SDRS.
    171  * 
     171 *
    172172 */
    173173psPlaneTransform *pmAstromGridApply(
     
    178178
    179179/*
    180  * 
     180 *
    181181 * This function is identical to pmAstromGridMatch, but is valid for only a
    182182 * single relative rotation. The input config information need not contain any of
    183183 * the GRID.*.ANGLE entries (they will be ignored).
    184  *
     184 *
     185 * XXX: This function name is different in the SDRS.
     186 *
    185187 */
    186188/* in pmAstromGrid.c */
     
    193195
    194196/*
    195  * 
     197 *
    196198 * This function accepts the raw and reference source lists and the list of
    197199 * matched entries. It uses the matched list to determine a polynomial
     
    207209 * modifications to pmFPA.toTangentPlane incorporate the rotation component of
    208210 * the linear terms and the higher-order terms of the polynomial fits.
    209  * 
     211 *
    210212 * XXX: No prototype code.
    211  * 
     213 *
    212214 */
    213215bool pmAstromFitFPA(
     
    233235 *ASTROM.ORDER).  The result of this fit is a set of modifications of the
    234236 *components of the pmChip.toFPA transformation.
    235  * 
     237 *
    236238 * XXX: No prototype code.
    237  * 
     239 *
    238240 */
    239241bool pmAstromFitChip(
     
    247249
    248250/*
    249  * 
     251 *
    250252 * The following function determines the position residual, in the tangent
    251253 * plane, as a function of position in the focal plane, for a collection of raw
     
    253255 * the bin size over which the gradient is measured (keyword: ASTROM.GRAD.BOX).
    254256 * The function returns an array of pmAstromGradient structures, defined below.
    255  * 
     257 *
    256258 * XXX: No prototype code.
    257  * 
     259 *
    258260 */
    259261psArray pmAstromMeasureGradients(
     
    267269
    268270/*
    269  * 
     271 *
    270272 * The following data structure carries the information about the residual
    271273 * gradient of source positions in the tangent plane (pmAstromObj.TP) as a
    272274 * function of position in the focal plane (pmAstromObj.FP).
    273  * 
     275 *
    274276 */
    275277typedef struct
     
    283285
    284286/*
    285  * 
     287 *
    286288 * The gradient set measured above can be fitted with a pair of 2D
    287289 * polynomials. The resulting fits can then be related back to the implied
     
    290292 * supplied pmFPA structure. The configuration variable supplies the polynomial
    291293 * order (keyword: ASTROM.DISTORT.ORDER).
    292  * 
     294 *
    293295 * XXX: No prototype code.
    294  * 
     296 *
    295297 */
    296298psArray pmAstromFitDistortion(
     
    308310 ******************************************************************************/
    309311/*
    310  * 
    311  * 
    312  * 
    313  * 
    314  */
    315 
    316 
    317 /*
    318  * 
     312 *
     313 *
     314 *
     315 *
     316 */
     317
     318
     319/*
     320 *
    319321 * Allocates a pmAstromObj struct.
    320  * 
     322 *
    321323 */
    322324pmAstromObj *pmAstromObjAlloc (void);
     
    325327
    326328/*
    327  * 
     329 *
    328330 * Copies a pmAstromObj struct.
    329  * 
     331 *
    330332 */
    331333pmAstromObj *pmAstromObjCopy(
     
    336338
    337339/*
    338  * 
    339  * 
    340  * 
     340 *
     341 *
     342 *
    341343 */
    342344pmAstromMatch *pmAstromMatchAlloc(
     
    349351
    350352/*
    351  * 
    352  * 
    353  * 
     353 *
     354 *
     355 *
    354356 */
    355357psPlaneTransform *pmAstromMatchFit(
     
    364366
    365367/*
    366  * 
    367  * 
    368  * 
     368 *
     369 *
     370 *
    369371 */
    370372int pmAstromObjSortByFPX(
     
    376378
    377379/*
    378  * 
    379  * 
    380  * 
     380 *
     381 *
     382 *
    381383 */
    382384int pmAstromObjSortByMag(
Note: See TracChangeset for help on using the changeset viewer.