IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 1, 2006, 4:15:32 PM (20 years ago)
Author:
Paul Price
Message:

Initialising values to avoid compiler error.

File:
1 edited

Legend:

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

    r7332 r8046  
    44// XXX WCS keywords in the headers corresponding to the chips.
    55// XXX this function is both converting the header WCS astrometry terms to the fpa terms
    6 //     and applying the astrometry to the detected objects. 
     6//     and applying the astrometry to the detected objects.
    77bool psastroAstromGuess (pmConfig *config) {
    88
     
    1010    bool status = false;
    1111    bool isMosaic = false;
    12     double RAmin, RAmax, RAminSky, RAmaxSky;
    13     double DECmin, DECmax;
     12    double RAmin = NAN, RAmax = NAN, RAminSky = NAN, RAmaxSky = NAN;
     13    double DECmin = NAN, DECmax = NAN;
    1414
    1515    pmChip *chip = NULL;
     
    2323    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    2424    if (!recipe) {
    25         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    26         exit(EXIT_FAILURE);
     25        psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
     26        exit(EXIT_FAILURE);
    2727    }
    2828
     
    3030    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    3131    if (!input) {
    32         psErrorStackPrint(stderr, "Can't find input data!\n");
    33         exit(EXIT_FAILURE);
     32        psErrorStackPrint(stderr, "Can't find input data!\n");
     33        exit(EXIT_FAILURE);
    3434    }
    3535
     
    4444        psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    4545        if (!chip->process || !chip->file_exists) { continue; }
    46        
     46
    4747        // read WCS data from the corresponding header
    4848        pmHDU *hdu = pmFPAviewThisHDU (view, fpa);
    4949
    50         pmAstromReadWCS (fpa, chip, hdu->header, plateScale, isMosaic);
    51         if (newFPA) {
    52             newFPA = false;
    53             RAminSky = fpa->projection->R - M_PI;
    54             RAmaxSky = fpa->projection->R + M_PI;
    55             RAmin = RAmax = fpa->projection->R;
    56             DECmin = DECmax = fpa->projection->D;
    57         }
     50        pmAstromReadWCS (fpa, chip, hdu->header, plateScale, isMosaic);
     51        if (newFPA) {
     52            newFPA = false;
     53            RAminSky = fpa->projection->R - M_PI;
     54            RAmaxSky = fpa->projection->R + M_PI;
     55            RAmin = RAmax = fpa->projection->R;
     56            DECmin = DECmax = fpa->projection->D;
     57        }
    5858
    59         // apply the new WCS guess data to all of the data in the readouts
    60         // XXX should this go into a different function? this would separate WCS interpretation from application
    61         while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
     59        // apply the new WCS guess data to all of the data in the readouts
     60        // XXX should this go into a different function? this would separate WCS interpretation from application
     61        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    6262            psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    6363            if (!cell->process || !cell->file_exists) { continue; }
    6464
    65             // process each of the readouts
    66             while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
    67                 if (! readout->data_exists) { continue; }
     65            // process each of the readouts
     66            while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
     67                if (! readout->data_exists) { continue; }
    6868
    69                 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
    70                 if (rawstars == NULL) { continue; }
     69                psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS");
     70                if (rawstars == NULL) { continue; }
    7171
    72                 for (int i = 0; i < rawstars->n; i++) {
    73                     pmAstromObj *raw = rawstars->data[i];
    74        
    75                     psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip);
    76                     psPlaneDistortApply (raw->TP, fpa->toTangentPlane, raw->FP, 0.0, 0.0);
    77                     p_psDeproject (raw->sky, raw->TP, fpa->projection);
     72                for (int i = 0; i < rawstars->n; i++) {
     73                    pmAstromObj *raw = rawstars->data[i];
    7874
    79                     if (i < 0) {
    80                         fprintf (stderr, "up: %f,%f -> %f,%f -> %f,%f -> %f,%f\n",
    81                                  raw->chip->x, raw->chip->y,
    82                                  raw->FP->x, raw->FP->y,
    83                                  raw->TP->x, raw->TP->y,
    84                                  raw->sky->r, raw->sky->d);
     75                    psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip);
     76                    psPlaneDistortApply (raw->TP, fpa->toTangentPlane, raw->FP, 0.0, 0.0);
     77                    p_psDeproject (raw->sky, raw->TP, fpa->projection);
    8578
    86                         psPlane *fp = psPlaneAlloc();
    87                         psPlane *tp = psPlaneAlloc();
    88                         psPlane *ch = psPlaneAlloc();
     79                    if (i < 0) {
     80                        fprintf (stderr, "up: %f,%f -> %f,%f -> %f,%f -> %f,%f\n",
     81                                 raw->chip->x, raw->chip->y,
     82                                 raw->FP->x, raw->FP->y,
     83                                 raw->TP->x, raw->TP->y,
     84                                 raw->sky->r, raw->sky->d);
    8985
    90                         p_psProject (tp, raw->sky, fpa->projection);
    91                         psPlaneDistortApply (fp, fpa->fromTangentPlane, tp, 0.0, 0.0);
    92                         psPlaneTransformApply (ch, chip->fromFPA, fp);
     86                        psPlane *fp = psPlaneAlloc();
     87                        psPlane *tp = psPlaneAlloc();
     88                        psPlane *ch = psPlaneAlloc();
    9389
    94                         fprintf (stderr, "dn: %f,%f <- %f,%f <- %f,%f <- %f,%f\n",
    95                                  ch->x, ch->y,
    96                                  fp->x, fp->y,
    97                                  tp->x, tp->y,
    98                                  raw->sky->r, raw->sky->d);
    99                     }
     90                        p_psProject (tp, raw->sky, fpa->projection);
     91                        psPlaneDistortApply (fp, fpa->fromTangentPlane, tp, 0.0, 0.0);
     92                        psPlaneTransformApply (ch, chip->fromFPA, fp);
    10093
    101                     // rationalize ra to sky range centered on boresite
    102                     while (raw->sky->r < RAminSky) raw->sky->r += M_PI;
    103                     while (raw->sky->r > RAmaxSky) raw->sky->r -= M_PI;
     94                        fprintf (stderr, "dn: %f,%f <- %f,%f <- %f,%f <- %f,%f\n",
     95                                 ch->x, ch->y,
     96                                 fp->x, fp->y,
     97                                 tp->x, tp->y,
     98                                 raw->sky->r, raw->sky->d);
     99                    }
    104100
    105                     RAmin = PS_MIN (raw->sky->r, RAmin);
    106                     RAmax = PS_MAX (raw->sky->r, RAmax);
     101                    // rationalize ra to sky range centered on boresite
     102                    while (raw->sky->r < RAminSky) raw->sky->r += M_PI;
     103                    while (raw->sky->r > RAmaxSky) raw->sky->r -= M_PI;
    107104
    108                     DECmin = PS_MIN (raw->sky->d, DECmin);
    109                     DECmax = PS_MAX (raw->sky->d, DECmax);
    110                 }
    111             }
    112         }
     105                    RAmin = PS_MIN (raw->sky->r, RAmin);
     106                    RAmax = PS_MAX (raw->sky->r, RAmax);
     107
     108                    DECmin = PS_MIN (raw->sky->d, DECmin);
     109                    DECmax = PS_MAX (raw->sky->d, DECmax);
     110                }
     111            }
     112        }
    113113    }
    114114
     
    119119    psMetadataAdd (recipe, PS_LIST_TAIL, "DEC_MIN", PS_DATA_F32 | PS_META_REPLACE, "", DECmin);
    120120    psMetadataAdd (recipe, PS_LIST_TAIL, "DEC_MAX", PS_DATA_F32 | PS_META_REPLACE, "", DECmax);
    121    
     121
    122122    psFree (view);
    123123    return true;
Note: See TracChangeset for help on using the changeset viewer.