IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33504


Ignore:
Timestamp:
Mar 13, 2012, 2:13:03 PM (14 years ago)
Author:
bills
Message:

add option to to ppstamp to return an entire file instead of a region of interest.
This is useful for two purposes.

  1. To undo the asinh storage for stacks
  2. To replace the astrometry from chip stage with the camera stage fit

Also fixed a bug in jpeg creation for chip stage. Dropped the flipping for chip
stage as well. That is incorrect. We want the jpeg to match the chip image.
Also made the default to no_censor_masked since that isn't the usual case now
that magic is no longer a requirement

Location:
trunk/pstamp/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/ppstampArguments.c

    r33378 r33504  
    6262    *pOptions = options;
    6363
    64     if (!pstampGetROI(&options->roip, &argc, argv, &gotCenter, &gotRange)) {
    65         usage();
     64    if ((argnum = psArgumentGet(argc, argv, "-wholefile"))) {
     65        psArgumentRemove(argnum, &argc, argv);
     66        gotCenter = true;
     67        gotRange = true;
     68        options->wholeFile = true;
     69    } else {
     70        if (!pstampGetROI(&options->roip, &argc, argv, &gotCenter, &gotRange)) {
     71            usage();
     72        }
    6673    }
    6774
     
    105112   
    106113    if ((argnum = psArgumentGet(argc, argv, "-no_censor_masked"))) {
     114        // this is the default. This is for compatiability
    107115        psArgumentRemove(argnum, &argc, argv);
    108116        options->censorMasked = false;
     117    }
     118    if ((argnum = psArgumentGet(argc, argv, "-censor_masked"))) {
     119        // default changed to not censor allow it to be changed back to true
     120        psArgumentRemove(argnum, &argc, argv);
     121        options->censorMasked = true;
     122    }
     123    if ((argnum = psArgumentGet(argc, argv, "-nocompress"))) {
     124        psArgumentRemove(argnum, &argc, argv);
     125        options->nocompress = true;
    109126    }
    110127
  • trunk/pstamp/src/ppstampMakeStamp.c

    r30050 r33504  
    233233    int status = false;
    234234
    235     pmFPAfile *output;
    236     if (!options->stage || (strcmp(options->stage, "diff") != 0)) {
    237         output = psMetadataLookupPtr(NULL, config->files, "PPSTAMP.OUTPUT");
    238     } else {
    239         output = psMetadataLookupPtr(NULL, config->files, "PPSTAMP.OUTPUT.DIFF");
    240     }
     235    pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, options->outputFileRule);
    241236    if (!output) {
    242237        psError(PS_ERR_UNKNOWN, false, "Can't find output data\n");
     
    529524        // If no chip name was specified, select this one (the first one that had data)
    530525        if ((options->chipName == NULL) || !strcasecmp(chipName, options->chipName)) {
    531             psLogMsg("ppstampMakeStamp", 2, "Center on chip: %s\n", chipName);
    532             center->chip->x = options->roip.centerX;
    533             center->chip->y = options->roip.centerY;
     526            if (options->chipName) {
     527                psLogMsg("ppstampMakeStamp", 2, "Center on chip: %s\n", chipName);
     528            }
     529            if (options->wholeFile) {
     530                center->chip->x = (chipBounds->x1 + chipBounds->x0 + 1) / 2;
     531                center->chip->y = (chipBounds->y1 + chipBounds->y0 + 1) / 2;
     532            } else {
     533                center->chip->x = options->roip.centerX;
     534                center->chip->y = options->roip.centerY;
     535            }
    534536            center->chip->xErr = 0;
    535537            center->chip->yErr = 0;
     
    543545            findBoundingBox(options, input->fpa, chip, center);
    544546        } else {
    545             int width  = options->roip.dX;
    546             int height = options->roip.dY;
    547             if (width > 5000) {
    548                 fprintf(stderr, "requested width %d too large reducing to 5000\n", width);
    549                 width = 5000;
     547            if (options->wholeFile) {
     548                options->roi = *chipBounds;
     549            } else {
     550                int width  = options->roip.dX;
     551                int height = options->roip.dY;
     552                if (width > 7000) {
     553                    fprintf(stderr, "requested width %d too large reducing to 7000\n", width);
     554                    width = 7000;
     555                }
     556                if (height > 7000) {
     557                    fprintf(stderr, "requested height %d too large reducing to 7000\n", height);
     558                    height = 7000;
     559                }
     560
     561                // calculate the ROI in chip coordinates
     562                options->roi.x0 = center->chip->x - width / 2;
     563                options->roi.x1 = options->roi.x0 + width;
     564                options->roi.y0 = center->chip->y - height / 2;
     565                options->roi.y1 = options->roi.y0 + height;
    550566            }
    551             if (height > 5000) {
    552                 fprintf(stderr, "requested height %d too large reducing to 5000\n", height);
    553                 height = 5000;
    554             }
    555 
    556             // calculate the ROI in chip coordinates
    557             options->roi.x0 = center->chip->x - width / 2;
    558             options->roi.x1 = options->roi.x0 + width;
    559             options->roi.y0 = center->chip->y - height / 2;
    560             options->roi.y1 = options->roi.y0 + height;
    561         }
    562 
    563 
    564         if (regionContainsRegion(chipBounds, &options->roi)) {
    565             // returnval = findCell(view, options, input, center, ppCell);
     567        }
     568
     569
     570        if (options->wholeFile || regionContainsRegion(chipBounds, &options->roi)) {
    566571            psLogMsg("ppstampMakeStamp", 2, "ROI contained on: %s\n", chipName);
    567572            returnval = PPSTAMP_ON;
  • trunk/pstamp/src/ppstampOptions.c

    r32370 r33504  
    3030    options->cellName  = NULL;
    3131    options->stage  = NULL;
    32     options->censorMasked = true;
     32    options->censorMasked = false;
     33    options->writeJPEG = false;
     34    options->nocompress = false;
     35    options->wholeFile = false;
     36    options->outputFileRule = NULL;
    3337
    3438    return options;
  • trunk/pstamp/src/ppstampOptions.h

    r33378 r33504  
    88    // input arguments
    99    pstampROI   roip;
     10    bool        wholeFile;
    1011    psString    chipName;
    1112    psString    cellName;
    1213    psString    stage;
     14    bool        censorMasked;
     15    bool        writeJPEG;
     16    bool        nocompress;
    1317    //
    1418    // Calculated Values
    1519    //
     20    psString    outputFileRule;
    1621    psRegion    roi;            // roi in chip coordinates
    17     bool        censorMasked;
    18     bool        writeJPEG;
    1922} ppstampOptions;
    2023
  • trunk/pstamp/src/ppstampParseCamera.c

    r33389 r33504  
    88
    99// Set up the ppstamp output Image file
    10 bool setupOutput(pmConfig *config, pmFPAfile *input, psString stage, bool doMask, bool doWeight, pmFPAfile **pOutput)
     10bool setupOutput(pmConfig *config, pmFPAfile *input, ppstampOptions *options, bool doMask, bool doWeight, pmFPAfile **pOutput)
    1111{
    12     pmFPAfile *output;
    13    
    14     if (!stage || (strcmp(stage, "diff") != 0)) {
    15         output = pmFPAfileDefineSkycell(config, NULL, "PPSTAMP.OUTPUT");
     12    if (!options->stage || (strcmp(options->stage, "diff") != 0)) {
     13        if (options->nocompress) {
     14            options->outputFileRule = "PPSTAMP.OUTPUT.NOCOMP";
     15        } else {
     16            options->outputFileRule = "PPSTAMP.OUTPUT";
     17        }
    1618    } else {
    1719        // need special filerule for diff stage image to allow for negative values
    18         output = pmFPAfileDefineSkycell(config, NULL, "PPSTAMP.OUTPUT.DIFF");
     20        if (options->nocompress) {
     21            options->outputFileRule = "PPSTAMP.OUTPUT.DIFF.NOCOMP";
     22        } else {
     23            options->outputFileRule = "PPSTAMP.OUTPUT.DIFF";
     24        }
    1925    }
     26    pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, options->outputFileRule);
    2027    if (!output) {
    2128        psError(PS_ERR_UNKNOWN, false, "Unable to setup output.");
     
    2734
    2835    if (doMask) {
    29         pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PPSTAMP.OUTPUT.MASK");
     36        char *rule;
     37        if (options->nocompress) {
     38            rule =  "PPSTAMP.OUTPUT.MASK.NOCOMP";
     39        } else {
     40            rule =  "PPSTAMP.OUTPUT.MASK";
     41        }
     42        pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, rule);
    3043        outMask->save = true;
    3144    }
    3245    if (doWeight) {
    33         pmFPAfile *outWeight = pmFPAfileDefineSkycell(config, output->fpa, "PPSTAMP.OUTPUT.VARIANCE");
     46        char *rule;
     47        if (options->nocompress) {
     48            rule =  "PPSTAMP.OUTPUT.VARIANCE.NOCOMP";
     49        } else {
     50            rule =  "PPSTAMP.OUTPUT.VARIANCE";
     51        }
     52        pmFPAfile *outWeight = pmFPAfileDefineSkycell(config, output->fpa, rule);
    3453        outWeight->save = true;
    3554    }
    36 
    3755
    3856    return true;
     
    97115    // Set up the output target
    98116    pmFPAfile *output;
    99     if (!setupOutput(config, input, options->stage, doMask, doWeight, &output)) {
     117    if (!setupOutput(config, input, options, doMask, doWeight, &output)) {
    100118        psError(PS_ERR_UNKNOWN, false, "Unable to setup output.");
    101119        return false;
     
    113131
    114132    if (options->writeJPEG) {
    115         char *filerule;
    116         // If stage is chip flip the X axis otherwise don't flip.
    117         // XXX: is this the right thing to do?
    118         // Shouldn't the JPEG match the stamp even for chip stage?
    119         if (!options->stage || strcmp(options->stage, "chip")) {
    120             filerule = "PPSTAMP.OUTPUT.JPEG";
    121         } else {
    122             filerule = "PPSTAMP.OUTPUT.JPEG.FLIP";
    123         }
    124         pmFPAfile *jpg = pmFPAfileDefineOutput(config, output->fpa, filerule);
     133        char *filerule = "PPSTAMP.OUTPUT.JPEG";
     134        pmFPAfile *jpg = pmFPAfileDefineSkycell(config, output->fpa, filerule);
    125135        if (!jpg) {
    126136            psError(PS_ERR_IO, false, "Unable to generate new file from %s", filerule);
Note: See TracChangeset for help on using the changeset viewer.