IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27989


Ignore:
Timestamp:
May 17, 2010, 5:49:51 PM (16 years ago)
Author:
Paul Price
Message:

Removing the 'FPA.OBS' concept (once called 'FPA.NAME'). The original idea was to provide a bit of protection against user error --- not reading a flat into an FPA containing an image, etc. However, that's not really necessary, and there's not always a nice keyword that we can use that is the exposure number or something like that, and so we end up with a lot of unneccessary warnings. Better to do away with it completely. It's not used for anything except that check.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageMosaic.c

    r18709 r27989  
    2525    pmChip *inChip = pmFPAviewThisChip(view, in->fpa);
    2626    if (!outChip->hdu && !outChip->parent->hdu) {
    27         const char *name = psMetadataLookupStr(&status, in->fpa->concepts, "FPA.OBS"); // Name of FPA
    28         pmFPAAddSourceFromView(out->fpa, name, view, out->format);
     27        pmFPAAddSourceFromView(out->fpa, view, out->format);
    2928    }
    3029
     
    6665    #endif
    6766
    68     const char *name = psMetadataLookupStr(&status, in->fpa->concepts, "FPA.OBS"); // Name of FPA
    69 
    7067    pmFPAview *view = pmFPAviewAlloc(0);
    71     pmFPAAddSourceFromView(out->fpa, name, view, out->format);
     68    pmFPAAddSourceFromView(out->fpa, view, out->format);
    7269    psFree(view);
    7370
  • trunk/ppMerge/src/ppMergeCamera.c

    r24782 r27989  
    1919                const char *name,       ///< Name of output file
    2020                pmFPAfileType type,     ///< Type of file
    21                 const char *description, ///< Description of file
    2221                psMetadata *format,     ///< Camera format
    2322                pmFPAview *view         ///< View for PHU
     
    8483    output->save = true;
    8584
    86     if (!pmFPAAddSourceFromView(fpa, description, view, format)) {
     85    if (!pmFPAAddSourceFromView(fpa, view, format)) {
    8786        psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");
    8887        return false;
     
    337336      case PPMERGE_TYPE_FRINGE:
    338337        fileType = PM_FPA_FILE_FRINGE;
    339         break;
     338        break;
    340339      default:
    341340        psAbort("Unknown frame type: %x", type);
    342341    }
    343342
    344     if (!outputFile(config, outName, fileType, "Merged detrend", format, phuView)) {
     343    if (!outputFile(config, outName, fileType, format, phuView)) {
    345344        psFree(outName);
    346345        psFree(phuView);
     
    349348    psFree(outName);
    350349
    351     if (!outputFile(config, "PPMERGE.OUTPUT.SIGMA", PM_FPA_FILE_IMAGE, "Merge sigma", format, phuView)) {
     350    if (!outputFile(config, "PPMERGE.OUTPUT.SIGMA", PM_FPA_FILE_IMAGE, format, phuView)) {
    352351        psFree(phuView);
    353352        return false;
    354353    }
    355354
    356     if (!outputFile(config, "PPMERGE.OUTPUT.COUNT", PM_FPA_FILE_IMAGE, "Merged count", format, phuView)) {
     355    if (!outputFile(config, "PPMERGE.OUTPUT.COUNT", PM_FPA_FILE_IMAGE, format, phuView)) {
    357356        psFree(phuView);
    358357        return false;
  • trunk/ppSim/src/ppSimCreate.c

    r23836 r27989  
    198198
    199199    if (phuLevel == PM_FPA_LEVEL_FPA) {
    200         if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) {
     200        if (!pmFPAAddSourceFromView(fpa, view, output->format)) {
    201201            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    202202            psFree(fpa);
     
    209209    while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
    210210        if (phuLevel == PM_FPA_LEVEL_CHIP) {
    211             if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) {
     211            if (!pmFPAAddSourceFromView(fpa, view, output->format)) {
    212212                psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    213213                psFree(fpa);
     
    220220        while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    221221            if (phuLevel == PM_FPA_LEVEL_CELL) {
    222                 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) {
     222                if (!pmFPAAddSourceFromView(fpa, view, output->format)) {
    223223                    psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    224224                    psFree(fpa);
  • trunk/ppSim/src/ppSimMosaicChip.c

    r21183 r27989  
    2222    pmChip *inChip = pmFPAviewThisChip(view, in->fpa);
    2323    if (!outChip->hdu && !outChip->parent->hdu) {
    24         const char *name = psMetadataLookupStr(&status, in->fpa->concepts, "FPA.OBS"); // Name of FPA
    25         pmFPAAddSourceFromView(out->fpa, name, view, out->format);
     24        pmFPAAddSourceFromView(out->fpa, view, out->format);
    2625    }
    2726
  • trunk/ppStack/src/ppStackCamera.c

    r27417 r27989  
    252252    output->save = true;
    253253
    254     if (!pmFPAAddSourceFromFormat(outFPA, "Stack", output->format)) {
     254    if (!pmFPAAddSourceFromFormat(outFPA, output->format)) {
    255255        psError(psErrorCodeLast(), false, "Unable to generate output FPA.");
    256256        return false;
     
    302302    exp->save = true;
    303303
    304     if (!pmFPAAddSourceFromFormat(expFPA, "Stack", exp->format)) {
     304    if (!pmFPAAddSourceFromFormat(expFPA, exp->format)) {
    305305        psError(psErrorCodeLast(), false, "Unable to generate output FPA.");
    306306        return false;
     
    369369    unConv->save = true;
    370370
    371     if (!pmFPAAddSourceFromFormat(unconvFPA, "Stack", unConv->format)) {
     371    if (!pmFPAAddSourceFromFormat(unconvFPA, unConv->format)) {
    372372        psError(psErrorCodeLast(), false, "Unable to generate output FPA.");
    373373        return false;
     
    419419    unconvExp->save = true;
    420420
    421     if (!pmFPAAddSourceFromFormat(unconvExpFPA, "Stack", unconvExp->format)) {
     421    if (!pmFPAAddSourceFromFormat(unconvExpFPA, unconvExp->format)) {
    422422        psError(psErrorCodeLast(), false, "Unable to generate output FPA.");
    423423        return false;
  • trunk/psModules/src/camera/pmFPAConstruct.c

    r27762 r27989  
    100100
    101101    return num;
    102 }
    103 
    104 // Get the name of a PHU chip or cell from the header
    105 static psString phuNameFromHeader(const char *name, // The name to lookup: "CELL.NAME" or "CHIP.NAME"
    106                                   const psMetadata *fileInfo, // FILE within the camera format description
    107                                   const psMetadata *header // Primary header
    108                                  )
    109 {
    110     assert(name && strlen(name) > 0);
    111     assert(fileInfo);
    112     assert(header);
    113 
    114     bool mdok = true;                   // Result of MD lookup
    115     psString keyword = psMetadataLookupStr(&mdok, fileInfo, name);
    116     if (!mdok || strlen(keyword) == 0) {
    117         return false;
    118     }
    119     psMetadataItem *resultItem = psMetadataLookup(header, keyword);
    120     if (!resultItem) {
    121         psError(PS_ERR_IO, true, "Unable to find %s in primary header to identify %s.\n", keyword, name);
    122         return NULL;
    123     }
    124     return psMetadataItemParseString(resultItem);
    125102}
    126103
     
    11021079// It returns a view corresponding to the PHU
    11031080static pmFPAview *addSource(pmFPA *fpa,       // The FPA
    1104                             const char *fpaObs, // The desired FPA observation name
    11051081                            const pmFPAview *phuView, // The view corresponding to the PHU, or NULL
    11061082                            const psMetadata *header, // The PHU header, or NULL
     
    11141090
    11151091    bool mdok;                          // Status of MD lookup
    1116 
    1117     // If FPA.OBS is already defined, new name must match it; otherwise, warn the user that something
    1118     // potentially bad is happening.
    1119     if (fpaObs && install) {
    1120         const char *currentName = psMetadataLookupStr(&mdok, fpa->concepts, "FPA.OBS"); // Current name
    1121         if (mdok && currentName && strlen(currentName) > 0 && strcmp(currentName, fpaObs) != 0) {
    1122             psWarning("FPA.OBS for new source (%s) doesn't match FPA.OBS for current fpa (%s).",
    1123                       fpaObs, currentName);
    1124         }
    1125         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.OBS", PS_META_REPLACE, "Observation identifier",
    1126                          fpaObs);
    1127     } else if (!psMetadataLookup(fpa->concepts, "FPA.OBS")) {
    1128         // Make sure there is an FPA.OBS
    1129         psMetadataAddStr(fpa->concepts, PS_LIST_HEAD, "FPA.OBS", 0, "Observation identifier", "UNKNOWN");
    1130     }
    11311092
    11321093    psMetadata *fileInfo = psMetadataLookupMetadata(&mdok, format, "FILE"); // The file information
     
    13501311}
    13511312
    1352 bool pmFPAAddSourceFromFormat(pmFPA *fpa, const char *fpaObs, const psMetadata *format)
     1313bool pmFPAAddSourceFromFormat(pmFPA *fpa, const psMetadata *format)
    13531314{
    13541315    PS_ASSERT_PTR_NON_NULL(fpa, false);
     
    13591320    pmFPAview *view = pmFPAviewAlloc(0);// View for current level
    13601321    if (phuLevel == PM_FPA_LEVEL_FPA) {
    1361         if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1322        if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13621323            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13631324            psFree(view);
     
    13681329        while ((chip = pmFPAviewNextChip(view, fpa, 1))) {
    13691330            if (phuLevel == PM_FPA_LEVEL_CHIP) {
    1370                 if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1331                if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13711332                    psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13721333                    psFree(view);
     
    13771338                while ((cell = pmFPAviewNextCell(view, fpa, 1))) {
    13781339                    if (phuLevel == PM_FPA_LEVEL_CELL) {
    1379                         if (!pmFPAAddSourceFromView(fpa, fpaObs, view, format)) {
     1340                        if (!pmFPAAddSourceFromView(fpa, view, format)) {
    13801341                            psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");
    13811342                            psFree(view);
     
    13921353}
    13931354
    1394 bool pmFPAAddSourceFromView(pmFPA *fpa, const char *fpaObs, const pmFPAview *phuView,
     1355bool pmFPAAddSourceFromView(pmFPA *fpa, const pmFPAview *phuView,
    13951356                            const psMetadata *format)
    13961357{
     
    13991360    PS_ASSERT_PTR_NON_NULL(format, false);
    14001361
    1401     pmFPAview *view = addSource(fpa, fpaObs, phuView, NULL, format, true);
     1362    pmFPAview *view = addSource(fpa, phuView, NULL, format, true);
    14021363    bool status = (view != NULL);
    14031364    psFree(view);
     
    14181379    }
    14191380
    1420     // Check the name of the FPA
    1421     psString fpaObs = phuNameFromHeader("FPA.OBS", fileInfo, phu); // New observation name for the FPA
    1422     if (!fpaObs || strlen(fpaObs) == 0) {
    1423         psWarning("Unable to determine FPA.OBS: check for FPA.OBS in FILE in camera format");
    1424     }
    1425 
    1426     pmFPAview *view = addSource(fpa, fpaObs, NULL, phu, format, true); // View of PHU, to return
    1427     psFree(fpaObs);
     1381    pmFPAview *view = addSource(fpa, NULL, phu, format, true); // View of PHU, to return
    14281382
    14291383    return view;
     
    14371391    PS_ASSERT_PTR_NON_NULL(format, NULL);
    14381392
    1439     return addSource(fpa, NULL, NULL, phu, format, false);
     1393    return addSource(fpa, NULL, phu, format, false);
    14401394}
    14411395
  • trunk/psModules/src/camera/pmFPAConstruct.h

    r17911 r27989  
    2929/// This is suitable for generating an output FPA given the desired format.
    3030bool pmFPAAddSourceFromFormat(pmFPA *fpa, ///< The FPA
    31                               const char *fpaObs, ///< FPA.NAME for the source
    3231                              const psMetadata *format ///< Format of file
    3332    );
     
    3837/// configuration is required in order to describe how the FPA is laid out in terms of disk files.
    3938bool pmFPAAddSourceFromView(pmFPA *fpa,   ///< The FPA
    40                             const char *fpaObs, ///< FPA.NAME for the source
    4139                            const pmFPAview *phuView, ///< The view, corresponding to the PHU
    4240                            const psMetadata *format ///< Format of file
  • trunk/psModules/src/camera/pmFPAfileFitsIO.c

    r25878 r27989  
    7575    }
    7676
    77     pmFPA *nameSource = file->src; // Source of FPA.OBS
    78     if (!nameSource) {
    79         nameSource = file->fpa;
    80     }
    81     bool mdok;                  // Status of MD lookup
    82     const char *fpaObs = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.OBS"); // Observation id
    83 
    8477    pmFPA *copy = pmFPAConstruct(file->camera, file->cameraName);  // FPA to return
    85     if (!pmFPAAddSourceFromView(copy, fpaObs, phuView, file->format)) {
     78    if (!pmFPAAddSourceFromView(copy, phuView, file->format)) {
    8679        psError(PS_ERR_UNKNOWN, false, "Unable to insert HDU into FPA for writing.\n");
    8780        psFree(copy);
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r26893 r27989  
    286286            }
    287287
    288             pmFPA *nameSource = file->src; // Source of FPA.OBS
    289             if (!nameSource) {
    290                 nameSource = file->fpa;
    291             }
    292             bool mdok;                  // Status of MD lookup
    293             const char *fpaObs = psMetadataLookupStr(&mdok, nameSource->concepts, "FPA.OBS"); // Obs. id
    294 
    295             pmFPAAddSourceFromView(file->fpa, fpaObs, view, format);
     288            pmFPAAddSourceFromView(file->fpa, view, format);
    296289            psTrace ("psModules.camera", 5, "created fpa data elements for %s (%s) (%d:%d:%d)\n",
    297290                     file->name, file->name, view->chip, view->cell, view->readout);
  • trunk/psphot/src/psphotMosaicChip.c

    r21183 r27989  
    2121    pmChip *inChip = pmFPAviewThisChip(view, in->fpa);
    2222    if (!outChip->hdu && !outChip->parent->hdu) {
    23         const char *name = psMetadataLookupStr(&status, in->fpa->concepts, "FPA.OBS"); // Name of FPA
    24         pmFPAAddSourceFromView(out->fpa, name, view, out->format);
     23        pmFPAAddSourceFromView(out->fpa, view, out->format);
    2524    }
    2625
  • trunk/pstamp/src/ppstampMakeStamp.c

    r27461 r27989  
    3636    double d_before = check->sky->d;
    3737    psLogMsg("ppstampMakeStamp", 2, "Before fit  Center Pixel RA: %f   DEC: %f (degrees)\n",
    38              r_before * PS_DEG_RAD, d_before * PS_DEG_RAD);
     38             r_before * PS_DEG_RAD, d_before * PS_DEG_RAD);
    3939
    4040    if (outFPA->toSky->type != PS_PROJ_TAN) {
    41         // we need to make astrometry terms for the output which are centered on the output chip center,
    42         // but we keep the original plate scale
    43         psFree(outFPA->toSky);
    44         outFPA->toSky = psProjectionAlloc (r_before, d_before, inFPA->toSky->Xs, inFPA->toSky->Ys, PS_PROJ_TAN);
    45 
    46         if (!pmAstromLinearizeToSky(inFPA, inChip, outFPA, outChip, roi)) {
     41        // we need to make astrometry terms for the output which are centered on the output chip center,
     42        // but we keep the original plate scale
     43        psFree(outFPA->toSky);
     44        outFPA->toSky = psProjectionAlloc (r_before, d_before, inFPA->toSky->Xs, inFPA->toSky->Ys, PS_PROJ_TAN);
     45
     46        if (!pmAstromLinearizeToSky(inFPA, inChip, outFPA, outChip, roi)) {
    4747            psFree(check);
    4848            psError(PS_ERR_UNKNOWN, false, "Failed to linearize astrometry\n");
     
    5656
    5757        psLogMsg("ppstampMakeStamp", 2, "After fit:  Center Pixel RA: %f   DEC: %f (degrees)\n",
    58                 r_after * PS_DEG_RAD, d_after * PS_DEG_RAD);
    59         psLogMsg("ppstampMakeStamp", 2, "Error in fit to astrometry %.2f    %.2f (arcseconds)\n", 
    60                 (r_after - r_before) *  PS_DEG_RAD * 3600, (d_after - d_before) * PS_DEG_RAD * 3600);
     58                r_after * PS_DEG_RAD, d_after * PS_DEG_RAD);
     59        psLogMsg("ppstampMakeStamp", 2, "Error in fit to astrometry %.2f    %.2f (arcseconds)\n",
     60                (r_after - r_before) *  PS_DEG_RAD * 3600, (d_after - d_before) * PS_DEG_RAD * 3600);
    6161
    6262        // XXX: should we fail if the fit is bad ??
     
    238238        return PS_EXIT_DATA_ERROR;
    239239    }
    240     char *fpaName = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.OBS"); // Name of FPA
    241240    pmFPAview *outview = pmFPAviewAlloc(0);
    242     pmFPAAddSourceFromView(output->fpa, fpaName, outview, output->format);
     241    pmFPAAddSourceFromView(output->fpa, outview, output->format);
    243242
    244243    outview->chip = 0;
  • trunk/pstamp/src/ppstampMosaic.c

    r18712 r27989  
    2424    pmChip  *inChip = pmFPAviewThisChip(view, input->fpa);
    2525    if (!mChip->hdu && !mChip->parent->hdu) {
    26         const char *name = psMetadataLookupStr(&status, input->fpa->concepts, "FPA.OBS"); // Name of FPA
    27         pmFPAAddSourceFromView(mosaic->fpa, name, mosaicView, mosaic->format);
     26        pmFPAAddSourceFromView(mosaic->fpa, mosaicView, mosaic->format);
    2827    }
    2928    psFree(mosaicView);
  • trunk/pswarp/src/pswarpDefine.c

    r27096 r27989  
    124124    }
    125125
    126     const char *name = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.OBS"); ///< Name of FPA
    127126    view->chip = view->cell = view->readout = -1;
    128     pmFPAAddSourceFromView(output->fpa, name, view, output->format);
     127    pmFPAAddSourceFromView(output->fpa, view, output->format);
    129128
    130129    psFree (view);
Note: See TracChangeset for help on using the changeset viewer.