IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41396


Ignore:
Timestamp:
Aug 10, 2020, 3:39:50 PM (6 years ago)
Author:
eugene
Message:

fix segfault if inputs are not at chip level (e.g. simtest)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpLoop.c

    r40354 r41396  
    123123                        }
    124124
    125                         // Determine the reference catalog used
    126                         if ((!refcat)&&(astromRO)) {
    127                           if ((astromRO->parent->parent->hdu->header)&&(output->fpa->analysis)) {
    128                             psMetadataItem *refItem = psMetadataLookup(astromRO->parent->parent->hdu->header, "PSREFCAT");
    129                             if (refItem) {
    130                               refcat = psMetadataLookupStr(NULL, astromRO->parent->parent->hdu->header, "PSREFCAT");
    131                               psMetadataAddStr(output->fpa->analysis, PS_LIST_TAIL, "REFERENCE_CATALOG", PS_META_REPLACE,
    132                                                "Reference catalog used for calibration.", refcat);
     125                        // Determine the reference catalog used for the astrometry
     126                        if (!refcat && astromRO) {
     127
     128                            // find the HDU for this readout
     129                            pmHDU *hdu = pmHDUFromReadout (astromRO);
     130                            if (! hdu) {
     131                                psWarning ("unable to find HDU for astrometry source, cannot save PSREFCAT");
     132                            }
     133                            if (!output->fpa->analysis) {
     134                                psWarning ("analysis metadata not defined for output, cannot save PSREFCAT");
    133135                            }
    134                           }
     136
     137                            psMetadataItem *refItem = psMetadataLookup(hdu->header, "PSREFCAT");
     138                            if (!refItem) {
     139                                psWarning ("PSREFCAT not found in astrometry HDU, cannot save PSREFCAT");
     140                            }
     141
     142                            if (refItem && hdu && output->fpa->analysis) {
     143                                refcat = psMetadataLookupStr(NULL, hdu->header, "PSREFCAT");
     144                                psMetadataAddStr(output->fpa->analysis, PS_LIST_TAIL, "REFERENCE_CATALOG", PS_META_REPLACE,
     145                                                 "Reference catalog used for calibration.", refcat);
     146                            }
    135147                        }
    136                        
    137148                    }
    138149
Note: See TracChangeset for help on using the changeset viewer.