IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 22, 2007, 7:42:46 AM (19 years ago)
Author:
eugene
Message:

finished psastroModel for boresite, created gpcModel for rough theoretical model, added useModel and fixChips options

File:
1 edited

Legend:

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

    r15200 r15891  
    3232    }
    3333
     34    // have we already supplied the astrometry from the model?
     35    bool useModel = psMetadataLookupBool (&status, config->arguments, "PSASTRO.USE.MODEL");
     36    if (!status) {
     37        useModel = psMetadataLookupBool (&status, recipe, "PSASTRO.USE.MODEL");
     38    }
     39
    3440    // select the input data sources
    3541    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     
    4652    }
    4753
    48     pmFPAview *view = pmFPAviewAlloc (0);
    4954    pmFPA *fpa = input->fpa;
    5055
    5156    // load mosaic-level astrometry?
    5257    bool bilevelAstrometry = false;
    53     pmHDU *phu = pmFPAviewThisPHU (view, fpa);
    54     if (phu) {
    55       char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");
    56       if (ctype) {
    57         bilevelAstrometry = !strcmp (&ctype[4], "-DIS");
    58       }
     58    if (!useModel) {
     59        psastroAstromGuessSetFPA (fpa, &bilevelAstrometry);
    5960    }
    60     if (bilevelAstrometry) {
    61       pmAstromReadBilevelMosaic (fpa, phu->header);
    62     }
    6361
     62    pmFPAview *view = pmFPAviewAlloc (0);
    6463    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    6564        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    6665        if (!chip->process || !chip->file_exists || !chip->data_exists) { continue; }
    6766
    68         // read WCS data from the corresponding header
    69         pmHDU *hdu = pmFPAviewThisHDU (view, fpa);
    70         if (bilevelAstrometry) {
    71             if (!pmAstromReadBilevelChip (chip, hdu->header)) {
    72                 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip);
    73                 continue;
    74             }
    75         } else {
    76             if (!pmAstromReadWCS (fpa, chip, hdu->header, pixelScale)) {
    77                 psWarning("Could not get WCS information from header for chip %d, skipping", view->chip);
    78                 continue;
    79             }
     67        if (!useModel) {
     68            if (!psastroAstromGuessSetChip (fpa, chip, view, pixelScale, bilevelAstrometry)) continue;
    8069        }
    8170
     
    160149   sky (ra, dec)
    161150*/
     151
     152bool psastroAstromGuessSetChip (pmFPA *fpa, pmChip *chip, pmFPAview *view, double pixelScale, bool bilevelAstrometry) {
     153
     154    // read WCS data from the corresponding header
     155    pmHDU *hdu = pmFPAviewThisHDU (view, fpa);
     156    if (bilevelAstrometry) {
     157        if (!pmAstromReadBilevelChip (chip, hdu->header)) {
     158            psWarning("Could not get WCS information from header for chip %d, skipping", view->chip);
     159            return false;
     160        }
     161    } else {
     162        if (!pmAstromReadWCS (fpa, chip, hdu->header, pixelScale)) {
     163            psWarning("Could not get WCS information from header for chip %d, skipping", view->chip);
     164            return false;
     165        }
     166    }
     167    return true;
     168}
     169
     170bool psastroAstromGuessSetFPA (pmFPA *fpa, bool *bilevelAstrometry) {
     171
     172    pmFPAview *view = pmFPAviewAlloc (0);
     173    pmHDU *phu = pmFPAviewThisPHU (view, fpa);
     174
     175    *bilevelAstrometry = false;
     176
     177    // load mosaic-level astrometry?
     178    if (phu) {
     179        char *ctype = psMetadataLookupStr (NULL, phu->header, "CTYPE1");
     180        if (ctype) {
     181            *bilevelAstrometry = !strcmp (&ctype[4], "-DIS");
     182        }
     183    }
     184    if (*bilevelAstrometry) {
     185        pmAstromReadBilevelMosaic (fpa, phu->header);
     186    }
     187    psFree (view);
     188    return true;
     189}
Note: See TracChangeset for help on using the changeset viewer.