IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 7, 2009, 4:50:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging branches/pap from r23739 onto trunk. No conflicts, ppSub builds fine.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ppSub

  • trunk/ppSub/src

    • Property svn:ignore
      •  

        old new  
        1010stamp-h1
        1111ppSubKernel
         12ppSubErrorCodes.h
         13ppSubErrorCodes.c
  • trunk/ppSub/src/ppSubReadoutUpdate.c

    r23688 r23740  
    2020
    2121#include "ppSub.h"
    22 
    23 bool ppSubReadoutUpdate(pmConfig *config, ppSubData *data, const pmFPAview *view)
    24 {
    25     psAssert(config, "Require configuration");
    26     psAssert(view, "Require view");
    27 
    28     bool mdok = false;                  // Status of MD lookup
    29 
    30     // Look up recipe values
    31     psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    32     psAssert(recipe, "We checked this earlier, so it should be here.");
    33 
    34     pmFPAfile *outFile = psMetadataLookupPtr(&mdok, config->files, "PPSUB.OUTPUT"); // Output file
    35     pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); // Output image
    36     pmFPA *outFPA = outFile->fpa;       // Output FPA
    37     pmHDU *outHDU = outFPA->hdu;        // Output HDU
    38 
    39     // Add additional data to the header
    40     pmFPAfile *refFile = psMetadataLookupPtr(NULL, config->files, "PPSUB.REF"); // Reference file
    41     pmFPAfile *inFile = psMetadataLookupPtr(NULL, config->files, "PPSUB.INPUT"); // Input file
    42     psMetadataAddStr(outHDU->header, PS_LIST_TAIL, "PPSUB.REFERENCE", 0,
    43                      "Subtraction reference", refFile->filename);
    44     psMetadataAddStr(outHDU->header, PS_LIST_TAIL, "PPSUB.INPUT", 0,
    45                      "Subtraction input", inFile->filename);
    46     ppSubVersionHeader(outHDU->header);
    47 
    48     // Statistics on the matching
    49     if (data->stats) {
    50         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MODE);
    51         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_STAMPS);
    52         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_MEAN);
    53         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_DEV_RMS);
    54         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_NORM);
    55         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_BGDIFF);
    56         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MX);
    57         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MY);
    58         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXX);
    59         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MXY);
    60         psMetadataCopySingle(data->stats, outRO->analysis, PM_SUBTRACTION_ANALYSIS_MYY);
    61 
    62         psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_MATCH", 0, "Time to match PSFs",
    63                          psTimerClear("PPSUB_MATCH"));
    64     }
    65 
    66     // Generate binned JPEGs
    67     {
    68         psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask for bad pixels
    69 
    70         int bin1 = psMetadataLookupS32(NULL, recipe, "BIN1"); // First binning level
    71         int bin2 = psMetadataLookupS32(NULL, recipe, "BIN2"); // Second binning level
    72 
    73         // Target cells
    74         pmCell *cell1 = pmFPAfileThisCell(config->files, view, "PPSUB.OUTPUT.JPEG1"); // Rebinned cell once
    75         pmCell *cell2 = pmFPAfileThisCell(config->files, view, "PPSUB.OUTPUT.JPEG2"); // Rebinned cell twice
    76 
    77         pmReadout *ro1 = pmReadoutAlloc(cell1), *ro2 = pmReadoutAlloc(cell2); // Binned readouts
    78         if (!pmReadoutRebin(ro1, outRO, maskBad, bin1, bin1)) {
    79             psError(PS_ERR_UNKNOWN, false, "Unable to bin output (1st binning)");
    80             psFree(ro1);
    81             psFree(ro2);
    82             return false;
    83         }
    84         if (!pmReadoutRebin(ro2, ro1, 0, bin2, bin2)) {
    85             psError(PS_ERR_UNKNOWN, false, "Unable to bin output (2nd binning)");
    86             psFree(ro1);
    87             psFree(ro2);
    88             return false;
    89         }
    90         psFree(ro1);
    91         psFree(ro2);
    92     }
    93 
    94 #ifdef TESTING
    95     // Significance image
    96     {
    97         psImage *sig = (psImage*)psBinaryOp(NULL, outRO->image, "*", outRO->image);
    98         psBinaryOp(sig, sig, "/", outRO->variance);
    99         psFits *fits = psFitsOpen("significance.fits", "w");
    100         psFitsWriteImage(fits, NULL, sig, 0, NULL);
    101         psFitsClose(fits);
    102         psFree(sig);
    103     }
    104 #endif
    105 
    106     return true;
    107 }
Note: See TracChangeset for help on using the changeset viewer.