IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33848


Ignore:
Timestamp:
May 3, 2012, 5:51:09 PM (14 years ago)
Author:
watersc1
Message:

Upgrade to ppImage to make videodark/masks work.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/gpc1/ppImage.config

    r33642 r33848  
    2525NOISEMAP                BOOL    FALSE          # Apply read noise map
    2626
    27 
     27# Final detrending options
     28HAS.VIDEO       BOOL    FALSE           # Treat this OTA as if it has video data
     29USE.VIDEO.DARK  BOOL    FALSE           # Use a video dark if we have video data?
     30USE.VIDEO.MASK  BOOL    TRUE            # Use a video mask if we have video data?
    2831
    2932
  • trunk/ippconfig/recipes/filerules-mef.mdc

    r33636 r33848  
    5959PPIMAGE.INPUT.SRC       INPUT    @FILES        CHIP       CMF
    6060PPIMAGE.MASK            INPUT    @DETDB        CHIP       MASK
     61PPIMAGE.VIDEOMASK       INPUT    @DETDB        CHIP       MASK
    6162PPIMAGE.BIAS            INPUT    @DETDB        CHIP       IMAGE
    6263PPIMAGE.DARK            INPUT    @DETDB        CHIP       DARK
     64PPIMAGE.VIDEODARK       INPUT    @DETDB        CHIP       DARK
    6365PPIMAGE.FLAT            INPUT    @DETDB        CHIP       IMAGE
    6466PPIMAGE.FRINGE          INPUT    @DETDB        CHIP       FRINGE
  • trunk/ippconfig/recipes/filerules-simple.mdc

    r33636 r33848  
    2323PPIMAGE.INPUT.SRC         INPUT    @FILES        READOUT    CMF       
    2424PPIMAGE.MASK              INPUT    @DETDB        CHIP       MASK
     25PPIMAGE.VIDEOMASK         INPUT    @DETDB        CHIP       MASK
    2526PPIMAGE.BIAS              INPUT    @DETDB        CHIP       IMAGE     
    2627PPIMAGE.DARK              INPUT    @DETDB        CHIP       DARK     
     28PPIMAGE.VIDEODARK         INPUT    @DETDB        CHIP       DARK
    2729PPIMAGE.FLAT              INPUT    @DETDB        CHIP       IMAGE     
    2830PPIMAGE.FRINGE            INPUT    @DETDB        CHIP       FRINGE
  • trunk/ippconfig/recipes/filerules-split.mdc

    r33690 r33848  
    3636PPIMAGE.INPUT             INPUT    @FILES        CHIP       IMAGE
    3737PPIMAGE.INPUT.MASK        INPUT    @FILES        CHIP       MASK
     38PPIMAGE.VIDEOMASK         INPUT    @DETDB        CHIP       MASK
    3839PPIMAGE.INPUT.VARIANCE    INPUT    @FILES        CHIP       VARIANCE
    3940PPIMAGE.INPUT.PSF         INPUT    @FILES        CHIP       PSF
     
    4344PPIMAGE.NOISEMAP          INPUT    @DETDB        CHIP       IMAGE
    4445PPIMAGE.DARK              INPUT    @DETDB        CHIP       DARK
     46PPIMAGE.VIDEODARK         INPUT    @DETDB        CHIP       DARK
    4547PPIMAGE.FLAT              INPUT    @DETDB        CHIP       IMAGE
    4648PPIMAGE.FRINGE            INPUT    @DETDB        CHIP       FRINGE
  • trunk/ippconfig/recipes/ppImage.config

    r33642 r33848  
    153153
    154154GAIN.OVERRIDE   BOOL    FALSE           # Override a non-finite gain?
     155
     156# Final detrending options
     157HAS.VIDEO       BOOL    FALSE           # Treat this OTA as if it has video data
     158USE.VIDEO.DARK  BOOL    FALSE           # Use a video dark if we have video data?
     159USE.VIDEO.MASK  BOOL    FALSE           # Use a video mask if we have video data?
    155160
    156161DETREND.CONSTRAINTS  METADATA
  • trunk/ppImage/src/ppImage.h

    r33590 r33848  
    5757    bool addNoise;                      // Add noise to degrade MD image to 3pi
    5858
     59  bool hasVideo;                      // Determine if this OTA has a video cell
     60  bool useVideoDark;                  // Should we use a video dark if we can?
     61  bool useVideoMask;                  // Should we use a video mask if we can?
     62 
    5963    // output files requested
    6064    bool BaseFITS;
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r33590 r33848  
    3535      }
    3636    }
    37 
     37    // Check to see if we're in a chip that contains video
     38    bool hasVideo = false;
     39    {
     40      if (psMetadataLookupStr(NULL,input->parent->parent->hdu->header,"CELLMODE")) {
     41        psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask);
     42        char *Vptr = strchr(psMetadataLookupStr(NULL,input->parent->parent->hdu->header,"CELLMODE"),'V');
     43        if (Vptr) {
     44          hasVideo = true;
     45          psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask);
     46        }
     47      }
     48    }
     49
     50   
    3851    // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine.
    3952    if (options->doMaskBuild) {
     
    4457    // apply the externally supplied mask to the input->mask pixels
    4558    if (options->doMask) {
    46         pmReadout *mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.MASK");
    47         pmMaskBadPixels(input, mask, options->maskValue);
     59      pmReadout *mask;
     60      if ((options->useVideoMask)&&(hasVideo)) {
     61        mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.VIDEOMASK");
     62      }
     63      else {
     64        mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.MASK");
     65      }
     66      pmMaskBadPixels(input, mask, options->maskValue);
    4867    }
    4968    if (options->doMaskBurntool) {
     
    8099        psMetadata *recipe = psMetadataLookupPtr (&mdok, config->recipes, RECIPE_NAME);
    81100        assert(mdok && recipe);
    82         if (psMetadataLookupBool(&mdok, recipe, "OLDDARK")) {
     101
     102        if ((options->useVideoDark)&&(hasVideo)) {
     103          if (psMetadataLookupBool(&mdok, recipe, "OLDDARK")) {
     104            oldDark = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.VIDEODARK");
     105          } else {
     106            dark = pmFPAfileThisCell(config->files, detview, "PPIMAGE.VIDEODARK");
     107          }
     108        }
     109        else {
     110          if (psMetadataLookupBool(&mdok, recipe, "OLDDARK")) {
    83111            oldDark = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.DARK");
    84         } else {
     112          } else {
    85113            dark = pmFPAfileThisCell(config->files, detview, "PPIMAGE.DARK");
    86         }
     114          }
     115        }
    87116    }
    88117
  • trunk/ppImage/src/ppImageOptions.c

    r33590 r33848  
    4545    options->doMaskStats     = false;   // Calculate mask fractions
    4646    options->addNoise        = false;  //Degrade an MD image to a 3pi image
    47 
     47    options->hasVideo        = false;   // Determine if this OTA has a video cell
     48    options->useVideoDark    = false;   // Use video dark if we can?
     49    options->useVideoMask    = false;   // Use video mask if we can?
    4850    // output files requested
    4951    options->BaseFITS        = false;   // create output image
     
    362364    options->fringeKeep = psMetadataLookupF32(NULL, recipe, "FRINGE.KEEP");
    363365
     366    // Video cell options
     367    if (psMetadataLookup(recipe, "USE.VIDEO.DARK")) {
     368      options->useVideoDark = psMetadataLookupBool(NULL,recipe,"USE.VIDEO.DARK");
     369    }
     370    if (psMetadataLookup(recipe, "USE.VIDEO.MASK")) {
     371      options->useVideoMask = psMetadataLookupBool(NULL,recipe,"USE.VIDEO.MASK");
     372    }
     373
    364374    // Pattern correction
    365375    if (psMetadataLookup(format, "PATTERN.ROW.ORDER")) {
     
    418428      options->patternContinuityEdgeWidth = psMetadataLookupS32(NULL, recipe, "PATTERN.CONTINUITY.WIDTH");
    419429    }
    420    
     430
    421431
    422432    // Remnance options
  • trunk/ppImage/src/ppImageParseCamera.c

    r29833 r33848  
    2222    ppImageOptions *options = ppImageOptionsParse(config);
    2323
     24    // parse the header to extract out whether this OTA has video cells.
     25    // CZW: 2012-05-01 I'm somewhat ashamed of what needs to be done to get to the header. There has to be a simpler way, right?
     26/*     pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest */
     27/*     pmChip *chip;                       // Chip from FPA */
     28/*     while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) { */
     29/*       if (!chip->process || !chip->file_exists) { */
     30/*      continue; */
     31/*       } */
     32/* /\*       if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { *\/ */
     33/* /\*  continue; *\/ */
     34/* /\*       } *\/ */
     35/*       psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
     36/*       if (psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE")) { */
     37/*      psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
     38/*      char *Vptr = strchr(psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE"),'V'); */
     39/*      if (Vptr) { */
     40/*        options->hasVideo = true; */
     41/*        psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */
     42/*      } */
     43/*       } */
     44/*     } */
     45/*     pmFPAviewReset(view); */
     46/*     psFree(view); */
     47   
    2448    // the following are defined from the argument list, if given,
    2549    // otherwise they revert to the config information
     
    4266    }
    4367    if (options->doDark) {
    44         if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.DARK", "DARK",
    45                                PM_FPA_FILE_DARK, PM_DETREND_TYPE_DARK)) {
     68      // Always load the regular Dark
     69      if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.DARK", "DARK",
     70                             PM_FPA_FILE_DARK, PM_DETREND_TYPE_DARK)) {
     71        psError(PS_ERR_IO, false, "Can't find a dark image source");
     72        psFree(options);
     73        return NULL;
     74      }
     75      // Sometimes load the video dark if we need it.
     76      if (options->useVideoDark) {
     77        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.VIDEODARK", "DARK",
     78                               PM_FPA_FILE_DARK, PM_DETREND_TYPE_VIDEODARK)) {
    4679            psError(PS_ERR_IO, false, "Can't find a dark image source");
    4780            psFree(options);
    4881            return NULL;
    4982        }
     83      }
    5084    }
    5185    if (options->doMask) {
    52         if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.MASK", "MASK",
    53                                PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
     86      // Always load the regular mask
     87      if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.MASK", "MASK",
     88                             PM_FPA_FILE_MASK, PM_DETREND_TYPE_MASK)) {
     89        psError(PS_ERR_IO, false, "Can't find a mask image source");
     90        psFree(options);
     91        return NULL;
     92      }
     93
     94      if (options->useVideoMask) {
     95        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.VIDEOMASK", "MASK",
     96                               PM_FPA_FILE_MASK, PM_DETREND_TYPE_VIDEOMASK)) {
    5497            psError(PS_ERR_IO, false, "Can't find a mask image source");
    5598            psFree(options);
    5699            return NULL;
    57100        }
     101      }
    58102    }
    59103    if (options->doShutter) {
  • trunk/psModules/src/detrend/pmDetrendDB.c

    r31067 r33848  
    107107        DETREND_STRING_CASE(ASTROM);
    108108        DETREND_STRING_CASE(NOISEMAP);
     109        DETREND_STRING_CASE(VIDEOMASK);
     110        DETREND_STRING_CASE(VIDEODARK);
    109111        DETREND_STRING_CASE(LINEARITY);
    110112    default:
  • trunk/psModules/src/detrend/pmDetrendDB.h

    r29833 r33848  
    3636    PM_DETREND_TYPE_ASTROM,
    3737    PM_DETREND_TYPE_NOISEMAP,
     38    PM_DETREND_TYPE_VIDEOMASK,
     39    PM_DETREND_TYPE_VIDEODARK,
    3840    PM_DETREND_TYPE_LINEARITY,
    3941} pmDetrendType;
Note: See TracChangeset for help on using the changeset viewer.