IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34623


Ignore:
Timestamp:
Oct 29, 2012, 2:26:09 PM (14 years ago)
Author:
watersc1
Message:

ppSkycell binning mostly working, but not for masks yet.

Location:
branches/czw_branch/20120906
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/ppSkycell/src/ppSkycellCamera.c

    r28375 r34623  
    103103        return false;
    104104    }
    105     if (!pmFPAfileDefineOutput(data->config, NULL, "PPSKYCELL.BIN1")) {
     105    pmFPAfile *bin1 = pmFPAfileDefineOutput(data->config, NULL, "PPSKYCELL.BIN1");
     106    if (!bin1) {
    106107        psError(psErrorCodeLast(), false, "Unable to define output.");
    107108        return false;
    108109    }
    109     if (!pmFPAfileDefineOutput(data->config, NULL, "PPSKYCELL.BIN2")) {
     110    pmFPAfile *bin2 = pmFPAfileDefineOutput(data->config, NULL, "PPSKYCELL.BIN2");
     111    if (!bin2) {
     112        psError(psErrorCodeLast(), false, "Unable to define output.");
     113        return false;
     114    }
     115    if (!pmFPAfileDefineOutput(data->config, bin1->fpa , "PPSKYCELL.BIN1.MASK")) {
     116        psError(psErrorCodeLast(), false, "Unable to define output.");
     117        return false;
     118    }
     119    if (!pmFPAfileDefineOutput(data->config, bin2->fpa, "PPSKYCELL.BIN2.MASK")) {
    110120        psError(psErrorCodeLast(), false, "Unable to define output.");
    111121        return false;
  • branches/czw_branch/20120906/ppSkycell/src/ppSkycellLoop.c

    r34458 r34623  
    249249            psFree(view);
    250250
     251            //      data->maskVal = 1;
    251252            pmReadout *bin1RO = pmReadoutAlloc(NULL), *bin2RO = pmReadoutAlloc(NULL); // Binned readouts
    252253            if (!pmReadoutRebin(bin1RO, inRO, data->maskVal, data->bin1, data->bin1)) {
     
    293294          pmFPAfileActivate(data->config->files, true, "PPSKYCELL.BIN1");
    294295          pmFPAfileActivate(data->config->files, true, "PPSKYCELL.BIN2");
     296/*        if (data->masksName) { */
     297/*          pmFPAfileActivate(data->config->files, true, "PPSKYCELL.BIN1.MASK"); */
     298/*          pmFPAfileActivate(data->config->files, true, "PPSKYCELL.BIN2.MASK"); */
     299/*        } */
    295300        }
    296301       
     
    400405          fits1->fileIndex = i;
    401406
     407          // Do the mask if we need to
     408/*        if (data->masksName) { */
     409/*          pmFPAfile *Mask1 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.BIN1.MASK", 0); */
     410/*          Mask1->fpa->hdu = pmHDUAlloc(NULL); */
     411/*          Mask1->fpa->hdu->header = psMetadataAlloc(); */
     412/*          psMetadataCopy(Mask1->fpa->hdu->header,fits1->fpa->hdu->header); */
     413/*          pmChip *Mchip1 = pmFPAfileThisChip(data->config->files, view, "PPSKYCELL.BIN1.MASK"); */
     414/*          psMetadataAddS32(Mchip1->concepts,PS_LIST_TAIL,"CHIP.XPARITY", PS_META_REPLACE,"",1); */
     415/*          psMetadataAddS32(Mchip1->concepts,PS_LIST_TAIL,"CHIP.YPARITY", PS_META_REPLACE,"",1); */
     416           
     417/*          pmCell *Mcell1 = pmFPAfileThisCell(data->config->files, view, "PPSKYCELL.BIN1.MASK"); // Rebinned cell 1 */
     418/*          /\*           // This is a hack to get a functioning header created so the fits images can be written out. *\/ */
     419/*          psMetadataAddS32(Mcell1->concepts,PS_LIST_TAIL,"CELL.XPARITY", PS_META_REPLACE,"",1); */
     420/*          psMetadataAddS32(Mcell1->concepts,PS_LIST_TAIL,"CELL.YPARITY", PS_META_REPLACE,"",1); */
     421/*          psMetadataAddS32(Mcell1->concepts,PS_LIST_TAIL,"CELL.READDIR", PS_META_REPLACE,"",1); */
     422           
     423/*          pmReadout *Mro1 = pmReadoutAlloc(Mcell1); */
     424/*          Mro1->image = image1; */
     425/*          Mro1->mask = mask1; */
     426/*          Mro1->data_exists = Mcell1->data_exists = Mcell1->parent->data_exists = true; */
     427           
     428/*          Mask1->save = true; */
     429/*          Mask1->fileIndex = i; */
     430/*        } */
     431           
     432           
     433         
    402434          // Repeat with second binned image
    403435          pmFPAfile *fits2 = pmFPAfileSelectSingle(data->config->files, "PPSKYCELL.BIN2", 0);
     
    447479          fits2->save = true;
    448480          fits2->fileIndex = i;
     481
     482         
    449483        }
    450484
  • branches/czw_branch/20120906/ppStack/src/ppStackCamera.c

    r34516 r34623  
    223223              pmFPAfile *inputBKG = defineFile(config,NULL,"PPSTACK.INPUT.BKGMODEL",bkgmodel,
    224224                                               PM_FPA_FILE_IMAGE);
    225               fprintf(stderr,"ppSC: %s\n",bkgmodel);
    226225              if (!inputBKG) {
    227226                psError(psErrorCodeLast(), false,
  • branches/czw_branch/20120906/ppStack/src/ppStackCleanup.c

    r34516 r34623  
    2828    options->expRO = NULL;
    2929
    30     options->bkgRO->data_exists = false;
    31     options->bkgRO->parent->data_exists = false;
    32     options->bkgRO->parent->parent->data_exists = false;
    33     psFree(options->bkgRO);
    34     options->bkgRO = NULL;
     30    if (options->bkgRO) {
     31      options->bkgRO->data_exists = false;
     32      options->bkgRO->parent->data_exists = false;
     33      options->bkgRO->parent->parent->data_exists = false;
     34      psFree(options->bkgRO);
     35      options->bkgRO = NULL;
     36    }
    3537   
    3638    for (int i = 0; i < options->num; i++) {
  • branches/czw_branch/20120906/ppStack/src/ppStackCombineFinal.c

    r34531 r34623  
    2727    return(false);
    2828  }
     29#if 0
    2930  if (!ppStackWriteImage("/tmp/test_forced.bkgmdl.fits",
    3031                         bkgRO->parent->parent->parent->hdu->header,
     
    3334    fprintf(stderr,"Failed to write image because fail.\n");
    3435  }
    35  
     36#endif
    3637  for (int i = 0; i < options->num; i++) {
    3738    pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT.BKGMODEL", i);
     
    5354  bkgRO->parent->data_exists = true;
    5455  bkgRO->parent->parent->data_exists = true;
     56 
    5557  return(true);
    5658}
  • branches/czw_branch/20120906/ppStack/src/ppStackCombinePrepare.c

    r34531 r34623  
    6060      options->bkgRO->parent->parent->parent->concepts = psMetadataCopy(options->bkgRO->parent->parent->parent->concepts,
    6161                                                                        ro->parent->parent->parent->concepts);
     62
    6263    }
    6364
     
    8485        return false;
    8586      }
     87     
     88
     89     
    8690    }
    8791
  • branches/czw_branch/20120906/ppStack/src/ppStackFiles.c

    r34531 r34623  
    2727static char *filesUnconv[] = { "PPSTACK.UNCONV", "PPSTACK.UNCONV.MASK", "PPSTACK.UNCONV.VARIANCE",
    2828                               "PPSTACK.UNCONV.EXP", "PPSTACK.UNCONV.EXPNUM", "PPSTACK.UNCONV.EXPWT",
    29                                "PPSTACK.OUTPUT.BKGMODEL",
    3029                               NULL };
    3130
  • branches/czw_branch/20120906/ppStack/src/ppStackLoop.c

    r34516 r34623  
    193193
    194194        // Prepare for combination
    195         if (!ppStackCombinePrepare("PPSTACK.UNCONV", "PPSTACK.UNCONV.EXP", "PPSTACK.OUTPUT.BKGMODEL", PPSTACK_FILES_UNCONV,
     195        if (!ppStackCombinePrepare("PPSTACK.UNCONV", "PPSTACK.UNCONV.EXP", NULL, PPSTACK_FILES_UNCONV,
    196196                                   stack, options, config)) {
    197197            psError(psErrorCodeLast(), false, "Unable to prepare for combination.");
  • branches/czw_branch/20120906/ppStack/src/ppStackThread.c

    r34516 r34623  
    3535            psFitsClose(stack->varianceFits->data[i]);
    3636        }
    37 /*         if (stack->bkgFits->data[i]) { */
    38 /*             psFitsClose(stack->bkgFits->data[i]); */
    39 /*         } */
    4037        stack->imageFits->data[i] = stack->maskFits->data[i] = stack->varianceFits->data[i] = NULL;
    4138    }
     
    5754    const psArray *varianceNames = conv ? options->convVariances : options->origVariances; // Variance names
    5855    const psArray *covariances = conv ? options->convCovars : options->origCovars; // Covariance matrices
    59     const psArray *bkgNames = options->bkgImages;
     56
    6057    PS_ASSERT_ARRAY_NON_NULL(cells, NULL);
    6158    if (imageNames) {
     
    10097            psFree(resolved); \
    10198        }
    102         fprintf(stderr,"%d %s\n",i,(char*) bkgNames->data[i]);
    10399        IMAGE_OPEN(imageNames, stack->imageFits, i);
    104100        IMAGE_OPEN(maskNames, stack->maskFits, i);
    105101        IMAGE_OPEN(varianceNames, stack->varianceFits, i);
    106         //      IMAGE_OPEN(bkgNames, stack->bkgFits, i);
    107102    }
    108103
  • branches/czw_branch/20120906/ppStack/src/ppStackUpdateHeader.c

    r31158 r34623  
    66
    77    pmReadout *outRO = options->outRO;                                      // Output readout
     8    pmReadout *expRO = options->expRO;
    89
    910    // Propagate WCS
     
    123124        snprintf (field, 64, "AIR_%04d", i);
    124125        psMetadataAddF32(hdu->header, PS_LIST_TAIL, field, PS_META_REPLACE, "input image airmass", value);
    125     }   
     126    }
     127
     128    // Copy information into expRO, because it should be there too.
     129    pmHDU *expROhdu = pmHDUFromCell(expRO->parent);
     130    if (!expROhdu->header) {
     131      expROhdu->header = psMetadataAlloc();
     132    }
     133    expRO->parent->parent->parent->hdu->header = psMetadataCopy(expRO->parent->parent->parent->hdu->header,
     134                                                                outRO->parent->parent->parent->hdu->header);
     135   
     136    expRO->parent->concepts = psMetadataCopy(expRO->parent->concepts,
     137                                             outRO->parent->concepts);
     138    expRO->parent->parent->concepts = psMetadataCopy(expRO->parent->parent->concepts,
     139                                                     outRO->parent->concepts);
     140    expRO->parent->parent->parent->concepts = psMetadataCopy(expRO->parent->parent->parent->concepts,
     141                                                             outRO->parent->parent->parent->concepts);
     142   
     143   
    126144    return true;
    127145}
  • branches/czw_branch/20120906/psModules/src/camera/pmFPAfileIO.c

    r34403 r34623  
    7676    while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
    7777        pmFPAfile *file = item->data.V;
    78 
    7978        switch (place) {
    8079          case PM_FPA_BEFORE:
Note: See TracChangeset for help on using the changeset viewer.