IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35531


Ignore:
Timestamp:
May 7, 2013, 4:01:35 PM (13 years ago)
Author:
bills
Message:

add new recipe options to ppImage to control application of an auxiliary
mask. This is intended to be a more selective mask that will be used by M31
and STS projects for their reprocessing. This masking is added to the
mask constructed during detrending after the cells have bee mosaiced.

Location:
trunk
Files:
11 edited

Legend:

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

    r35332 r35531  
    3030USE.VIDEO.MASK  BOOL    TRUE            # Use a video mask if we have video data?
    3131
     32# aditional auxillary mask applied to corners of all chips in video cells.
     33# Is only applied if MASK.AUXMASK and USE.VIDEO.MASK are both true
     34AUX.VIDEO.MASK  STR     neb://any/gpc1/auxmask/mpg.20130506/mask_video_cell_corners.fits
    3235
    3336
     
    150153FRINGE.FILTERS  STR y.00000
    151154
    152 # Standard chip processing
     155# Standard chip processing (NOTE: when changing this be sure to check whether changes should be applied toCHIP_BGPRESEVE and/or CHIP_AUXMASK
    153156CHIP METADATA
    154157  BASE.FITS          BOOL    FALSE           # Save base detrended image?
     
    169172  MASK.BUILD         BOOL    TRUE            # Build internal mask?
    170173  MASK.BURNTOOL      BOOL    TRUE            # Mask potential burntool trails
     174  MASK.AUXMASK       BOOL    FALSE           # augment with more restrictive auxillary mask
    171175  PATTERN.ROW        BOOL    TRUE            # Row pattern correction
    172176  PATTERN.CELL       BOOL    FALSE           # Cell pattern correction
     
    12201224END
    12211225
     1226# Standard chip processing + auxillary mask
     1227CHIP_AUXMASK METADATA
     1228  BASE.FITS          BOOL    FALSE           # Save base detrended image?
     1229  BASE.MASK.FITS     BOOL    FALSE           # Save base detrended image?
     1230  BASE.VARIANCE.FITS BOOL    FALSE           # Save base detrended image?
     1231  CHIP.FITS          BOOL    TRUE            # Save chip-mosaic-ed image?
     1232  CHIP.MASK.FITS     BOOL    TRUE            # Save chip-mosaic-ed image?
     1233  CHIP.VARIANCE.FITS BOOL    TRUE            # Save chip-mosaic-ed image?
     1234  OVERSCAN           BOOL    TRUE            # Overscan subtraction
     1235  NONLIN             BOOL    TRUE            # apply non-linearity correction
     1236  BIAS               BOOL    FALSE           # Bias subtraction
     1237  DARK               BOOL    TRUE            # Dark subtraction
     1238  NOISEMAP           BOOL    TRUE           
     1239  REMNANCE           BOOL    FALSE           # Remnance masking
     1240  SHUTTER            BOOL    FALSE           # Shutter correction
     1241  FLAT               BOOL    TRUE            # Flat-field normalisation
     1242  MASK               BOOL    TRUE            # Mask bad pixels
     1243  MASK.BUILD         BOOL    TRUE            # Build internal mask?
     1244  MASK.BURNTOOL      BOOL    TRUE            # Mask potential burntool trails
     1245  MASK.AUXMASK       BOOL    TRUE            # augment with more restrictive auxillary mask
     1246  PATTERN.ROW        BOOL    TRUE            # Row pattern correction
     1247  PATTERN.CELL       BOOL    FALSE           # Cell pattern correction
     1248  PATTERN.CONTINUITY BOOL    TRUE            # Cell pattern correction using edge continuity
     1249  FRINGE             BOOL    TRUE            # Fringe subtraction
     1250  BIN1.FITS          BOOL    TRUE            # Save 1st binned chip image?
     1251  BIN2.FITS          BOOL    TRUE            # Save 2nd binned chip image?
     1252  PHOTOM             BOOL    TRUE            # Source identification and photometry
     1253  ASTROM.CHIP        BOOL    FALSE           # Astrometry per chip?
     1254  ASTROM.MOSAIC      BOOL    FALSE           # Astrometry for mosaic?
     1255  BACKGROUND         BOOL    TRUE            # Subtract background?
     1256  CROSSTALK.MEASURE  BOOL    TRUE            # Subtract model background?
     1257END
     1258
    12221259# Standard chip processing without any background removal
    12231260CHIP_PRESERVE_BG        METADATA
     
    12391276  MASK.BUILD         BOOL    TRUE            # Build internal mask?
    12401277  MASK.BURNTOOL      BOOL    TRUE            # Mask potential burntool trails
     1278  MASK.AUXMASK       BOOL    TRUE            # augment with more restrictive auxillary mask
    12411279  PATTERN.ROW        BOOL    FALSE           # Row pattern correction
    12421280  PATTERN.CELL       BOOL    FALSE           # Cell pattern correction
  • trunk/ippconfig/recipes/ppImage.config

    r35081 r35531  
    1717MASK.LOW           BOOL    TRUE            # Mask pixels below valid range
    1818MASK.BURNTOOL      BOOL    FALSE           # Mask potential burntool trails
     19MASK.AUXMASK       BOOL    FALSE           # augment mask with auxillary mask
     20AUX.VIDEO.MASK     STR     NULL
    1921VARIANCE.BUILD     BOOL    FALSE           # Build internal variance image
    2022ADDNOISE           BOOL    FALSE           # Add noise to degrade an MD image to a 3pi image?
     
    168170# Standard chip processing
    169171CHIP    METADATA
     172  BASE.FITS          BOOL    FALSE           # Save base detrended image?
     173  BASE.MASK.FITS     BOOL    FALSE           # Save base detrended image?
     174  BASE.VARIANCE.FITS BOOL    FALSE           # Save base detrended image?
     175  CHIP.FITS          BOOL    TRUE            # Save chip-mosaic-ed image?
     176  CHIP.MASK.FITS     BOOL    TRUE            # Save chip-mosaic-ed image?
     177  CHIP.VARIANCE.FITS BOOL    TRUE            # Save chip-mosaic-ed image?
     178  OVERSCAN           BOOL    TRUE            # Overscan subtraction
     179  NONLIN             BOOL    FALSE           # Non-linearity correction; not implemented
     180  BIAS               BOOL    TRUE            # Bias subtraction
     181  DARK               BOOL    TRUE            # Dark subtraction
     182  SHUTTER            BOOL    FALSE           # Shutter correction
     183  FLAT               BOOL    TRUE            # Flat-field normalisation
     184  MASK               BOOL    TRUE            # Mask bad pixels
     185  FRINGE             BOOL    TRUE            # Fringe subtraction
     186  BIN1.FITS          BOOL    TRUE            # Save 1st binned chip image?
     187  BIN2.FITS          BOOL    TRUE            # Save 2nd binned chip image?
     188  PHOTOM             BOOL    TRUE            # Source identification and photometry
     189  ASTROM.CHIP        BOOL    FALSE           # Astrometry per chip?
     190  ASTROM.MOSAIC      BOOL    FALSE           # Astrometry for mosaic?
     191  BACKGROUND         BOOL    TRUE            # Subtract background?
     192  MASK.STATS         BOOL    TRUE            # Calculate Mask statistics.
     193END
     194
     195# Standard chip processing
     196CHIP_AUXMASK    METADATA
    170197  BASE.FITS          BOOL    FALSE           # Save base detrended image?
    171198  BASE.MASK.FITS     BOOL    FALSE           # Save base detrended image?
  • trunk/ippconfig/recipes/reductionClasses.mdc

    r35455 r35531  
    10071007
    10081008STS_DATASET METADATA
    1009    CHIP_PPIMAGE STR CHIP
     1009   CHIP_PPIMAGE STR CHIP_AUXMASK
    10101010   CHIP_PSPHOT STR CHIP
    10111011   WARP_PSWARP STR WARP
     
    10231023END
    10241024
     1025M31_DATASET             METADATA
     1026        CHIP_PPIMAGE      STR     CHIP_AUXMASK
     1027        CHIP_PSPHOT       STR     CHIP
     1028        WARP_PSWARP       STR     WARP
     1029        STACK_PPSTACK     STR     STACK
     1030        STACK_PPSUB       STR     STACK
     1031        STACK_PSPHOT      STR     STACK
     1032        DIFF_PPSUB        STR     DIFF
     1033        DIFF_PSPHOT       STR     DIFF
     1034        JPEG_BIN1         STR     PPIMAGE_J1
     1035        JPEG_BIN2         STR     PPIMAGE_J2
     1036        FAKEPHOT          STR     FAKEPHOT
     1037        ADDSTAR           STR     ADDSTAR
     1038        PSASTRO           STR     DEFAULT_RECIPE
     1039        STACKPHOT_PSPHOT  STR     STACKPHOT
     1040        STACKPHOT_PPSUB   STR     STACKPHOT
     1041        STACKPHOT_PPSTACK STR     STACKPHOT
     1042        STACKPHOT_SINGLE_PSPHOT  STR     STACKPHOT_SINGLE
     1043        BACKGROUND_PPBACKGROUND STR     BACKGROUND
     1044        BACKGROUND_PSWARP       STR     BACKGROUND
     1045        PSVIDEOPHOT             STR     PSVIDEOPHOT
     1046        STATICSKY_CALIBRATION   STR     STATICSKY_CAL
     1047END
     1048
    10251049CNP_DATASET     METADATA
    10261050        CHIP_PPIMAGE      STR     CHIP
  • trunk/ppImage/src/Makefile.am

    r35081 r35531  
    6565        ppImageMemory.c \
    6666        ppImageAddNoise.c \
    67         ppImageRandomGaussian.c
     67        ppImageRandomGaussian.c \
     68        ppImageAuxiliaryMask.c
    6869
    6970CLEANFILES = *~
  • trunk/ppImage/src/ppImage.h

    r35081 r35531  
    3030    bool doMaskLow;                     // mask low pixels
    3131    bool doMask;                        // Mask bad pixels
     32    bool doAuxMask;                     // apply auxillary mask
    3233    bool doNonLin;                      // Non-linearity correction
    3334    bool doOverscan;                    // Overscan subtraction
     
    126127  psU16 maskstat_magic;
    127128  psU16 maskstat_advisory;
     129
     130  psString auxVideoMask;                // auxillary video mask file
    128131 
    129132} ppImageOptions;
     
    312315void ppImageRandomGaussianFree(void);
    313316
     317bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options);
    314318
    315319#endif
  • trunk/ppImage/src/ppImageAuxiliaryMask.c

    r35528 r35531  
    4040}
    4141
     42bool recordFileInHeader(pmChip *chip, psString tag, psString desc, psString filename)
     43{
     44    pmHDU *hdu = pmHDUGetHighest(chip->parent, chip, NULL);
     45
     46    // strip off the directories and nebulous bits
     47    char *base = filename;
     48    for (char *new = base; (new = strpbrk(base, "/:")); base = new + 1);
     49
     50    psMetadataAddStr(hdu->header, PS_LIST_TAIL, tag, PS_META_DUPLICATE_OK, desc, base);
     51    return true;
     52}
     53
    4254// In this function, we augment the mask with the more conservative auxiliary mask
    4355bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options)
     
    5163    }
    5264
    53     bool status;                        // Status of MD lookup
     65    bool status;
     66    // Our target chip
    5467    pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.CHIP"); // File to correct
    5568    if (!status) {
     
    5871    }
    5972
     73    // Find a suitable detRun with type AUXMASK
     74
    6075    psTime *time = psMetadataLookupPtr(NULL, input->fpa->concepts, "FPA.TIME");
    6176    if (time->sec == 0 && time->nsec == 0) {
     
    6378    }
    6479
    65     // XXX careful about this: is this set correctly in the camera.config files?
    6680    char *cameraName = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.CAMERA");
    6781    pmDetrendSelectOptions *detrendOptions = pmDetrendSelectOptionsAlloc(cameraName, *time, PM_DETREND_TYPE_AUXMASK);
     
    8094    }
    8195   
    82 #ifdef notdef
    83     psMetadata *ppImageRecipe = psMetadataLookupPtr(NULL, config->recipes, RECIPE_NAME);
    84     psAssert(ppImageRecipe, "Need PPIMAGE recipe");
    85     psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE);
    86     psAssert(psphotRecipe, "Need PSPHOT recipe");
    87 
    88     // XXX Should this be options->maskValue or options->maskValue & ~options->satMask?
    89     //     The latter will leave saturated pixels high
    90     psImageMaskType maskVal = options->maskValue;
    91 
    92     // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
    93     psMetadataAddImageMask(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskVal);
    94 #endif
    95 
     96    // Go find the readout
     97    // code to find the readouts was adapted from ppImageSubtractBackground
    9698    // XXX: shouldn't most of these psWarnings be psAsserts?
    9799
     
    129131    psImage *mask = ro->mask;
    130132
    131     // now read the mask file
     133    // now read the auxiliary mask file
    132134    psString class_id = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME");
    133135
     
    139141
    140142    psFree(results);
     143    // record that we read this file in the config dump file.
     144    // Note: this value isn't used during updates though.
     145    pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXMASK", auxMaskFileName);
     146    recordFileInHeader(chip, "DETREND.AUXMASK", "auxiliary mask", auxMaskFileName);
    141147
    142148    psImage *auxMask = readAuxiliaryMask(config, auxMaskFileName);
    143149    psFree(auxMaskFileName);
    144150    if (!auxMask) {
    145         // readAuxiliaryMask prints enough diagnostic information
     151        psError(PS_ERR_UNKNOWN, false, "failed to read auxiliary mask file");
    146152        return false;
    147153    }
     
    151157        psImage *videoMask = readAuxiliaryMask(config, options->auxVideoMask);
    152158        if (!videoMask) {
     159            psError(PS_ERR_UNKNOWN, false, "failed to read auxiliary video mask file");
    153160            return false;
    154161        }
    155         // auxMask *= videoMask
     162        pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXVIDEOMASK", options->auxVideoMask);
     163        recordFileInHeader(chip, "DETREND.AUXVIDEOMASK", "auxiliary video mask", options->auxVideoMask);
     164
     165        // compute auxMask *= videoMask
    156166        if (!psBinaryOp(auxMask, auxMask, "*", videoMask)) {
    157167            psError(PS_ERR_UNKNOWN, false, "mulitplication of auxiliary mask and auxiliary video mask failed");
  • trunk/ppImage/src/ppImageDetrendReadout.c

    r34082 r35531  
    5050        char *Vptr = strchr(psMetadataLookupStr(NULL,input->parent->parent->hdu->header,"CELLMODE"),'V');
    5151        if (Vptr) {
    52           hasVideo = true;
     52          hasVideo = options->hasVideo = true;
    5353          psLogMsg ("ppImage.detrend", PS_LOG_INFO, "VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask);
    5454        }
  • trunk/ppImage/src/ppImageLoop.c

    r35081 r35531  
    188188            ESCAPE("Unable to mosaic chip");
    189189        }
     190
     191        if (!ppImageAuxiliaryMask(config, view, options)) {
     192            ESCAPE("Unable to apply auxiliary mask");
     193        }
     194
    190195        timeDetrend += psTimerClear(TIMER_DETREND);
    191196
  • trunk/ppImage/src/ppImageOptions.c

    r35081 r35531  
    1010    // psFree(options->nonLinearData);
    1111    // psFree(options->nonLinearSource);
     12    psFree(options->auxVideoMask);
    1213}
    1314
     
    2425    options->doVarianceBuild = false;   // Build internal variance
    2526    options->doMask          = false;   // Mask bad pixels
     27    options->doAuxMask       = false;   // apply auxillary mask
    2628    options->doNonLin        = false;   // Non-linearity correction
    2729    options->doOverscan      = false;   // Overscan subtraction
     
    116118    options->normClass       = NULL;    // per-class normalizations refer to this class
    117119
     120    options->auxVideoMask    = NULL;    // auxillary video mask file name
     121
    118122    return options;
    119123}
     
    228232    options->doMaskBurntool  = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");
    229233    options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
     234    options->doAuxMask       = psMetadataLookupBool(NULL, recipe, "MASK.AUXMASK");
     235    if (options->doAuxMask) {
     236        // if we are applying an auxiliary mask we can optionally apply another
     237        // mask to video cells only.
     238        psString auxVideoMask = psMetadataLookupStr(NULL, recipe, "AUX.VIDEO.MASK");
     239        // save the value if defined and not the value "NULL"
     240        if (auxVideoMask && strcmp(auxVideoMask, "NULL")) {
     241            options->auxVideoMask = psStringCopy(auxVideoMask);
     242        }
     243    }
    230244
    231245    // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c)
  • trunk/psModules/src/detrend/pmDetrendDB.c

    r33848 r35531  
    110110        DETREND_STRING_CASE(VIDEODARK);
    111111        DETREND_STRING_CASE(LINEARITY);
     112        DETREND_STRING_CASE(AUXMASK);
    112113    default:
    113114        return NULL;
  • trunk/psModules/src/detrend/pmDetrendDB.h

    r33848 r35531  
    3939    PM_DETREND_TYPE_VIDEODARK,
    4040    PM_DETREND_TYPE_LINEARITY,
     41    PM_DETREND_TYPE_AUXMASK,
    4142} pmDetrendType;
    4243
Note: See TracChangeset for help on using the changeset viewer.