IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 3, 2021, 11:37:46 AM (5 years ago)
Author:
eugene
Message:

add alternative configuration for reference image so we can run diff with two different cameras (recipes from first image camera are used); remove commented out test lines and move test function to end of ppSubLoop.c; move bit of code to remove extra detection block into ppSubReadoutInverse to clean up the ppSubLoop flow

File:
1 edited

Legend:

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

    r38709 r41528  
    171171}
    172172
     173pmConfig *pmConfigMakeTemp (pmConfig *config) {
     174    pmConfig *altconfig = pmConfigAlloc();
     175
     176    // these are NULL on pmConfigAlloc
     177    altconfig->user   = psMemIncrRefCounter(config->user);   // inherit from primary camera
     178    altconfig->site   = psMemIncrRefCounter(config->site);   // inherit from primary camera
     179    altconfig->system = psMemIncrRefCounter(config->system); // inherit from primary camera
     180
     181    psFree (altconfig->files);
     182    altconfig->files  = psMemIncrRefCounter(config->files); // inherit from primary camera
     183
     184    psFree (altconfig->arguments);
     185    altconfig->arguments = psMemIncrRefCounter(config->arguments); // inherit from primary camera
     186
     187    psFree (altconfig->recipes);
     188    altconfig->recipes = psMetadataCopy(NULL, config->recipes); // container for camera-specific recipe values (to be dropped)
     189
     190    return (altconfig);
     191}
    173192
    174193bool ppSubCamera(ppSubData *data)
     
    205224    }
    206225
     226    // Use a temporary config for the reference image, keeping the main user, site,
     227    // system, files, arguments entries.  This allows the reference image to be from a
     228    // different camera than the input image.  NOTE: there is no check that these two
     229    // images match in terms of size, pixel scale, etc. That is up to the user.
     230   
     231    pmConfig *refconfig = pmConfigMakeTemp(config);
     232
    207233    // Reference image
    208     pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
     234    pmFPAfile *ref = defineInputFile(&success, refconfig, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
    209235    if (!success) {
    210236        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");
     
    212238    }
    213239
    214     defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
     240    defineInputFile(&success, refconfig, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
    215241    if (!success) {
    216242        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.MASK");
     
    218244    }
    219245
    220     pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
     246    pmFPAfile *refVar = defineInputFile(&success, refconfig, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
    221247    if (!success) {
    222248        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.VARIANCE");
    223249        return false;
    224250    }
    225 
    226     defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
     251    psFree (refconfig);
     252
     253    // The reference sources may not be from the same origin as the reference image, so
     254    // use another temporary camera.
     255    pmConfig *srcconfig = pmConfigMakeTemp(config);
     256
     257    defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
    227258    if (!success) {
    228259        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES");
    229260        return false;
    230261    }
    231 
     262    psFree (srcconfig);
     263   
    232264    // Now that the camera has been determined, we can read the recipe
    233265    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
     266
    234267    if (!recipe) {
    235268        psError(PPSUB_ERR_CONFIG, false, "Unable to find recipe %s", PPSUB_RECIPE);
     
    498531}
    499532
    500 
     533// Test function if needed:
     534bool pmConfigDumpSub (pmConfig *config, char *filename) {
     535
     536    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
     537    psAssert (recipe, "oops");
     538
     539    psMetadataConfigWrite (recipe, filename, NULL);
     540
     541    return true;
     542}
     543
Note: See TracChangeset for help on using the changeset viewer.