IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 4, 2022, 2:07:06 PM (4 years ago)
Author:
eugene
Message:

remove PSCAMERA from the SKYCELL format entries in the temporary config files (ref and src); replace PSCAMERA in RULE for SKYCELL format with the value from the input file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubCamera.c

    r42096 r42279  
    177177    altconfig->user   = psMemIncrRefCounter(config->user);   // inherit from primary camera
    178178    altconfig->site   = psMemIncrRefCounter(config->site);   // inherit from primary camera
    179     altconfig->system = psMemIncrRefCounter(config->system); // inherit from primary camera
     179
     180    psFree (altconfig->system);
     181    altconfig->system = psMetadataCopy(NULL, config->system); // container for camera-specific recipe values (to be dropped)
    180182
    181183    psFree (altconfig->files);
     
    188190    altconfig->recipes = psMetadataCopy(NULL, config->recipes); // container for camera-specific recipe values (to be dropped)
    189191
    190 # if (0)
    191     // XXX ppStack seems to work without removing PSCAMERA
    192     // remove PSCAMERA entries from *-SKYCELL cameras
    193     // XXX make this optional to force matching cameras if desired?
     192    // remove PSCAMERA entries from *-SKYCELL cameras.  This allows skycell images from
     193    // one camera to match those of another camera.  XXX Make this optional to force
     194    // matching cameras if desired?
    194195    bool mdok = false;
    195196    psMetadata *cameras = psMetadataLookupMetadata(&mdok, altconfig->system, "CAMERAS");
     
    229230      psMetadataRemoveKey (rule, "PSCAMERA"); // allow any camera skycell to match
    230231    }
    231 # endif
     232    psFree (camerasIter);
    232233
    233234    return (altconfig);
     235}
     236
     237bool ppSubCopyPSCamera (pmFPAfile *tgt, pmFPAfile *src) {
     238
     239    bool success;
     240    psMetadata *ruleSrc = psMetadataLookupMetadata(&success, src->format, "RULE"); // one true format for skycells
     241    psAssert (ruleSrc, "missing RULE in src->format");
     242
     243    psString pscameraSrc = psMetadataLookupStr(&success, ruleSrc, "PSCAMERA"); // one true format for skycells
     244    psAssert (pscameraSrc, "missing PSCAMERA in src file");
     245
     246    psMetadata *ruleTgt = psMetadataLookupMetadata(&success, tgt->format, "RULE"); // one true format for skycells
     247    psAssert (ruleTgt, "missing RULE in tgt->format");
     248
     249    psMetadataAddStr (ruleTgt, PS_LIST_TAIL, "PSCAMERA", PS_META_REPLACE, "", pscameraSrc);
     250    return true;
    234251}
    235252
     
    271288    // different camera than the input image.  NOTE: there is no check that these two
    272289    // images match in terms of size, pixel scale, etc. That is up to the user.
     290    // The temporary config structure has PSCAMERA entries removed from the SKYCELL rules
     291    // to allow subtraction between cameras.
    273292   
    274293    pmConfig *refconfig = pmConfigMakeTemp(config);
    275294
    276 # if (0)
    277     // EAM TEST: can we bind the ref to the input to force the right skycell format?
    278     // Reference image
    279     pmFPAfile *ref = defineInputFile(&success, config, input, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
    280     if (!success) {
    281         psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");
    282         return false;
    283     }
    284 # else
    285295    // Reference image
    286296    pmFPAfile *ref = defineInputFile(&success, refconfig, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
    287297    if (!success) {
    288         psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");
    289         return false;
    290     }
    291 # endif
    292 
     298        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");
     299        return false;
     300    }
     301    // Reference mask
    293302    defineInputFile(&success, refconfig, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
    294303    if (!success) {
     
    296305        return false;
    297306    }
    298 
     307    // Reference variance
    299308    pmFPAfile *refVar = defineInputFile(&success, refconfig, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
    300309    if (!success) {
     
    302311        return false;
    303312    }
     313    // copy ref->format(RULE) PSCAMERA from input->format(RULE)
     314    ppSubCopyPSCamera (ref, input);
    304315    psFree (refconfig);
    305316
     
    308319    pmConfig *srcconfig = pmConfigMakeTemp(config);
    309320
    310     defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
    311     if (!success) {
    312         psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES");
    313         return false;
    314     }
     321    // Sources input file (CMF)
     322    pmFPAfile *src = defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
     323    if (!success) {
     324        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES");
     325        return false;
     326    }
     327    // XXX do we need to copy the PSCAMERA across to src? 
     328    ppSubCopyPSCamera (src, input);
    315329    psFree (srcconfig);
    316330   
Note: See TracChangeset for help on using the changeset viewer.