IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 3, 2014, 6:11:18 PM (12 years ago)
Author:
watersc1
Message:

I'm reasonably happy with the results it's making now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppBackground/src/ppBackgroundStackLoop.c

    r36642 r36649  
    99
    1010#include "ppBackgroundStack.h"
     11
     12#define WCS_TOLERANCE 0.001             // Tolerance for WCS
     13
    1114
    1215bool ppBackgroundStackLoop(ppBackgroundStackData *data // Run-time data
     
    120123      if (tp->y > data->y_max) { data->y_max = tp->y; }
    121124
    122 /*       data->x_min -= data->ra_min; */
    123 /*       data->x_max -= data->ra_min; */
    124 /*       data->y_min -= data->dec_min; */
    125 /*       data->y_max -= data->dec_min; */
    126      
    127      
    128125      psStats *stats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV);
    129126      psImageBinning *binning = psImageBinningAlloc();
    130127      binning->nXruff = 13; // Number of samples
    131128      binning->nYruff = 13;
    132       //    binning->nXfine = ceil(data->ra_max - data->ra_min) + 1; // This is the range we're looking at
    133       //    binning->nYfine = ceil(data->dec_max - data->dec_min) + 1;
    134129      binning->nXfine = ceil(data->x_max - data->x_min) + 1;
    135130      binning->nYfine = ceil(data->y_max - data->y_min) + 1;
     
    146141      P_PSIMAGE_SET_ROW0(sizeImage, data->y_min);
    147142      data->modelMap = psImageMapAlloc(sizeImage,binning,stats);
    148 /*       psFree(sizeImage); */
    149 /*       data->modelMap = psImageMapNoImageAlloc( binning,stats); */
    150 /*       P_PSIMAGE_SET_COL0(data->modelMap->map, (data->x_min - binning->nXskip) / binning->nXbin); */
    151 /*       P_PSIMAGE_SET_ROW0(data->modelMap->map, (data->y_min - binning->nYskip) / binning->nYbin); */
    152 
    153       // force col0/row0
    154 /*       data->modelMap->map->col0 = data->modelMap->binning->nXskip; */
    155 /*       data->modelMap->map->row0 = data->modelMap->binning->nYskip; */
    156143     
    157144      // PART 2:
     
    173160
    174161      // This is where an iterative solution loop would likely start.
    175       for (int iterator = 0; iterator < 2; iterator++) {
     162      for (int iterator = 0; iterator < 4; iterator++) {
    176163        // Construct the offset information
    177164        printf("Model fit!\n");
     
    310297            psFree(fp);
    311298            psFree(tp);
     299
     300            // Copy WCS (from ppStackUpdateHeader)
     301            pmHDU *inHDU = pmHDUFromCell(readout->parent);
     302            model->parent->hdu = pmHDUAlloc(NULL);
     303            corr->parent->hdu = pmHDUAlloc(NULL);
     304            pmHDU *modHDU= pmHDUFromCell(model->parent);
     305            pmHDU *corHDU= pmHDUFromCell(corr->parent);
     306
     307            if (!modHDU || !inHDU) {
     308              psWarning("Unable to find HDU at FPA level to copy wcs!");
     309            }
     310            else {
     311              if (!pmAstromReadWCS(stack_model->fpa,model_cell->parent,inHDU->header,1.0)) {
     312                psErrorClear();
     313                psWarning("Unable to read WCS astrometry from input FPA!");
     314              }
     315              else {
     316                if (!modHDU->header) {
     317                  modHDU->header = psMetadataAlloc();
     318                }
     319                if (!pmAstromWriteWCS(modHDU->header, stack_model->fpa,model_cell->parent, WCS_TOLERANCE)) {
     320                  psErrorClear();
     321                  psWarning("Unable to read WCS astrometry from input FPA!");
     322                }
     323              }
     324              if (!pmAstromReadWCS(stack_corr->fpa,corr_cell->parent,inHDU->header,1.0)) {
     325                psErrorClear();
     326                psWarning("Unable to read WCS astrometry from input FPA!");
     327              }
     328              else {
     329                if (!corHDU->header) {
     330                  corHDU->header = psMetadataAlloc();
     331                }
     332                if (!pmAstromWriteWCS(corHDU->header, stack_corr->fpa,corr_cell->parent, WCS_TOLERANCE)) {
     333                  psErrorClear();
     334                  psWarning("Unable to read WCS astrometry from input FPA!");
     335                }
     336              }
     337            } // End WCS saving.
     338
     339           
    312340          } // Close readout
    313341          printf("    I'm done with that readout\n");
     
    339367      psFree(view);
    340368      psFree(data->modelMap);
     369      psFree(sizeImage);
    341370    }
    342371               
Note: See TracChangeset for help on using the changeset viewer.