IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 11, 2012, 2:04:31 PM (13 years ago)
Author:
watersc1
Message:

Merge from my branch including background restoration and stack stage projection cell binned images.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ppStack/src/ppStackCombinePrepare.c

    r30620 r34800  
    11#include "ppStack.h"
    22
    3 bool ppStackCombinePrepare(const char *outName, const char *expName,
     3bool ppStackCombinePrepare(const char *outName, const char *expName, const char *bkgName,
    44                           ppStackFileList files, ppStackThreadData *stack,
    55                           ppStackOptions *options, pmConfig *config)
     
    2727    options->outRO = pmReadoutAlloc(cell); // Output readout
    2828
    29     pmCell *expCell = pmFPAfileThisCell(config->files, view, expName); // Exposure cell
    30     options->expRO = pmReadoutAlloc(expCell); // Output readout
     29    if (expName) {
     30      pmCell *expCell = pmFPAfileThisCell(config->files, view, expName); // Exposure cell
     31      options->expRO = pmReadoutAlloc(expCell); //Output readout
     32    }
     33/*     else { */
     34/*       options->expRO = NULL; */
     35/*     } */
     36    pmCell *bkgCell;
     37    int bkg_r0,bkg_c0;
     38    int bkg_nC,bkg_nR;
     39    if (bkgName) {
     40      ppStackFileActivationSingle(config, PPSTACK_FILES_BKG, true, 0);
     41      pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT.BKGMODEL", 0);
     42      pmFPAview *view = ppStackFilesIterateDown(config);
     43      pmReadout *ro = pmFPAviewThisReadout(view,file->fpa);
     44
     45      bkg_r0 = ro->image->row0;
     46      bkg_c0 = ro->image->col0;
     47      bkg_nC = ro->image->numCols;
     48      bkg_nR = ro->image->numRows;
     49      bkgCell = pmFPAfileThisCell(config->files, view, bkgName); // Bkg cell
     50     
     51      options->bkgRO = pmReadoutAlloc(bkgCell); // BKG readout
     52      //      if (!pmHDUGenerateForFPA(options->bkgRO->parent->parent->parent)) {
     53      options->bkgRO->parent->parent->parent->hdu = pmHDUAlloc(NULL);
     54      if (!options->bkgRO->parent->parent->parent->hdu) {
     55        fprintf(stderr,"failed to generate a HDU for this thing.\n");
     56      }
     57      options->bkgRO->parent->parent->parent->hdu->header = psMetadataCopy(options->bkgRO->parent->parent->parent->hdu->header,
     58                                                                           ro->parent->parent->parent->hdu->header);
     59
     60      options->bkgRO->parent->concepts = psMetadataCopy(options->bkgRO->parent->concepts,
     61                                                        ro->parent->concepts);
     62      options->bkgRO->parent->parent->concepts = psMetadataCopy(options->bkgRO->parent->parent->concepts,
     63                                                                ro->parent->parent->concepts);
     64      options->bkgRO->parent->parent->parent->concepts = psMetadataCopy(options->bkgRO->parent->parent->parent->concepts,
     65                                                                        ro->parent->parent->parent->concepts);
     66
     67    }
     68    else {
     69      options->bkgRO = NULL;
     70    }
    3171
    3272    psFree(view);
     
    4282    }
    4383
    44     if (!pmReadoutStackDefineOutput(options->expRO, col0, row0, numCols, numRows, true, true, 0)) {
     84    if (expName) {
     85      if (!pmReadoutStackDefineOutput(options->expRO, col0, row0, numCols, numRows, true, true, 0)) {
    4586        psError(PPSTACK_ERR_ARGUMENTS, false, "Unable to prepare output.");
    4687        return false;
     88      }
     89    }
     90
     91    if (bkgName) {
     92      if (!pmReadoutStackDefineOutput(options->bkgRO, bkg_c0, bkg_r0, bkg_nC, bkg_nR, false, false, 0)) {
     93        psError(PPSTACK_ERR_ARGUMENTS, false, "Unable to prepare output.");
     94        return false;
     95      }
     96     
     97
     98     
    4799    }
    48100
Note: See TracChangeset for help on using the changeset viewer.