IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34628


Ignore:
Timestamp:
Oct 30, 2012, 4:31:12 PM (14 years ago)
Author:
watersc1
Message:

Final changes to implement background restoration in ppBackground. Using the -recipe PPBACKGROUND STACK now gets the information from the correct place. The default value should retain the old behavior as well.

Change to skycell_jpeg to prevent masks from being made the wrong way.

Location:
branches/czw_branch/20120906
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/ippScripts/scripts/skycell_jpeg.pl

    r34491 r34628  
    269269    my %tangents = ();
    270270
    271     my %products = ('image' => "PPSTACK.OUTPUT",
    272                     'mask'  => "PPSTACK.OUTPUT.MASK",
    273                     'variance' => "PPSTACK.OUTPUT.VARIANCE",
    274                     'exp'   => "PPSTACK.OUTPUT.EXP",
    275                     'num'   => "PPSTACK.OUTPUT.EXPNUM",
    276 #                   'bkg'   => "PPSTACK.OUTPUT.BKG"
     271    my %products = ('image' => "PPSTACK.UNCONV",
     272                    'mask'  => "PPSTACK.UNCONV.MASK",
     273                    'variance' => "PPSTACK.UNCONV.VARIANCE",
     274                    'exp'   => "PPSTACK.UNCONV.EXP",
     275                    'num'   => "PPSTACK.UNCONV.EXPNUM",
     276                    'bkg'   => "PPSTACK.OUTPUT.BKGMODEL"
    277277        );
    278278   
     
    292292        unless (exists($tangents{$projection_cell})) {
    293293            # Make a temp file and fill, but be sure to save
    294            
    295294            foreach my $key (keys %products) {
    296                
    297295                ($tempFile, $tempName) = tempfile("/tmp/skycell.$projection_cell.$key.XXXX",
    298296                                                  UNLINK => !$save_temps);
     
    321319            $command = "$ppSkycell -images $tangents{$projection_cell}{$key}{NAME}";
    322320            $command .= " ${outroot}.${projection_cell}.${key} ";
     321            if ($key eq 'bkg') {
     322                $command .= " -Di BIN1 1 -Di BIN2 1 ";
     323            }
     324            elsif ($key eq 'image') {
     325                $command .= " -masks $tangents{$projection_cell}{mask}{NAME} ";
     326            }
     327            elsif ($key eq 'mask') {
     328                next; # This should be made with the images.
     329            }
    323330            print "$command\n";
    324331            ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
  • branches/czw_branch/20120906/ippconfig/recipes/filerules-mef.mdc

    r34531 r34628  
    342342PPSKYCELL.BIN1          OUTPUT {OUTPUT}.{FILE.INDEX}.b1.fits     IMAGE     NONE       FPA        TRUE      NONE
    343343PPSKYCELL.BIN2          OUTPUT {OUTPUT}.{FILE.INDEX}.b2.fits     IMAGE     NONE       FPA        TRUE      NONE
     344PPSKYCELL.BIN1.MASK          OUTPUT {OUTPUT}.{FILE.INDEX}.b1.mk.fits     MASK     COMP_MASK       FPA        TRUE      NONE
     345PPSKYCELL.BIN2.MASK          OUTPUT {OUTPUT}.{FILE.INDEX}.b2.mk.fits     MASK     COMP_MASK       FPA       TRUE      NONE
    344346
    345347LOG.IMFILE              OUTPUT {OUTPUT}.{CHIP.NAME}.log          TEXT      NONE       CHIP       TRUE      NONE
  • branches/czw_branch/20120906/ippconfig/recipes/filerules-simple.mdc

    r34531 r34628  
    321321PPSKYCELL.BIN1               OUTPUT {OUTPUT}.{FILE.INDEX}.b1.fits     IMAGE     NONE       FPA        TRUE      NONE
    322322PPSKYCELL.BIN2               OUTPUT {OUTPUT}.{FILE.INDEX}.b2.fits     IMAGE     NONE       FPA        TRUE      NONE
     323PPSKYCELL.BIN1.MASK          OUTPUT {OUTPUT}.b1.mk.fits     MASK     COMP_MASK       FPA        TRUE      NONE
     324PPSKYCELL.BIN2.MASK          OUTPUT {OUTPUT}.b2.mk.fits     MASK     COMP_MASK       FPA       TRUE      NONE
    323325
    324326LOG.IMFILE                   OUTPUT {OUTPUT}.imfile.log           TEXT            NONE       FPA        TRUE      NONE
  • branches/czw_branch/20120906/ippconfig/recipes/filerules-split.mdc

    r34531 r34628  
    355355PPSKYCELL.BIN1               OUTPUT {OUTPUT}.b1.fits     IMAGE     COMP_IMG       FPA        TRUE      NONE
    356356PPSKYCELL.BIN2               OUTPUT {OUTPUT}.b2.fits     IMAGE     COMP_IMG       FPA       TRUE      NONE
     357PPSKYCELL.BIN1.MASK          OUTPUT {OUTPUT}.b1.mk.fits     MASK     COMP_MASK       FPA        TRUE      NONE
     358PPSKYCELL.BIN2.MASK          OUTPUT {OUTPUT}.b2.mk.fits     MASK     COMP_MASK       FPA       TRUE      NONE
    357359
    358360LOG.IMFILE                   OUTPUT {OUTPUT}.{CHIP.NAME}.log          TEXT            NONE       CHIP       TRUE      NONE
  • branches/czw_branch/20120906/ippconfig/recipes/ppBackground.mdc

    r28486 r34628  
    11# Recipe options for ppBackground
    22
     3BINNING_RECIPE  STR     PSPHOT
     4BINNING_XNAME   STR     BACKGROUND.XBIN
     5BINNING_YNAME   STR     BACKGROUND.YBIN
     6
     7DEFAULT    METADATA
     8END
     9
     10
     11STACK       METADATA
     12  BINNING_RECIPE        STR     PSWARP
     13  BINNING_XNAME STR     BKG.XGRID       
     14  BINNING_YNAME STR     BKG.YGRID
     15END
     16           
    317
    418BACKGROUND       METADATA
  • branches/czw_branch/20120906/ppBackground/src/ppBackground.h

    r28300 r34628  
    3737    );
    3838
     39/// Determine the binning from the recipe if available.
     40psImageBinning *ppBackgroundBinningByRecipe(const psImage *image, // Image for which to generate a bg model
     41                                            const pmConfig *config, // Configuration
     42                                            psString recipe_name,
     43                                            psString Xbin_name,
     44                                            psString Ybin_name
     45                                            );
     46
     47
    3948/// Restore the background to an image
    4049bool ppBackgroundRestore(
  • branches/czw_branch/20120906/ppBackground/src/ppBackgroundRestore.c

    r34298 r34628  
    55
    66#include "ppBackground.h"
     7
     8psImageBinning *ppBackgroundBinningByRecipe(const psImage *image, // Image for which to generate a bg model
     9                                            const pmConfig *config, // Configuration
     10                                            psString recipe_name,
     11                                            psString Xbin_name,
     12                                            psString Ybin_name
     13                                            )
     14{
     15  bool status = true;
     16
     17  psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, recipe_name);
     18  assert (recipe);
     19
     20  // I have the fine image size, I know the binning factor, determine the ruff image size
     21  psImageBinning *binning = psImageBinningAlloc();
     22  binning->nXfine = image->numCols;
     23  binning->nYfine = image->numRows;
     24  binning->nXbin  = psMetadataLookupS32(&status, recipe, Xbin_name);
     25  binning->nYbin  = psMetadataLookupS32(&status, recipe, Ybin_name);
     26
     27  psImageBinningSetRuffSize(binning, PS_IMAGE_BINNING_CENTER);
     28  psImageBinningSetSkip(binning, image);
     29
     30  return binning;
     31}
     32
     33 
     34
    735
    836bool ppBackgroundRestore(pmChip *chip, const pmChip *background, const pmChip *pattern,
     
    2755    if (background) {
    2856        pmReadout *bgRO = pmFPAviewThisReadout(view, background->parent); // Readout with background
    29         psImageBinning *binning = psphotBackgroundBinning(image, config);
     57
     58        psImageBinning *binning;
     59        psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPBACKGROUND_RECIPE); // Recipe
     60        if (!recipe) {
     61          binning = psphotBackgroundBinning(image, config);
     62        }
     63        else {
     64          binning = ppBackgroundBinningByRecipe(image,config,
     65                                                psMetadataLookupStr(NULL,recipe,"BINNING_RECIPE"),
     66                                                psMetadataLookupStr(NULL,recipe,"BINNING_XNAME"),
     67                                                psMetadataLookupStr(NULL,recipe,"BINNING_YNAME"));
     68        }
     69                                               
     70        fprintf(stderr,"%d %d %d %d\n",binning->nXfine,binning->nYfine,binning->nXbin,binning->nYbin);
    3071        if (!binning) {
    3172            psError(psErrorCodeLast(), false, "Unable to find background binning");
     
    4990        for (int y = 0; y < numRows; y++) {
    5091            for (int x = 0; x < numCols; x++) {
     92              if ((y % 250 == 0)&&(x % 250 == 0)) {
     93                printf("%d %d %g\n",x,y,bgImage->data.F32[y][x]);
     94              }
    5195                image->data.F32[y][x] += bgImage->data.F32[y][x];
     96               
    5297            }
    5398        }
Note: See TracChangeset for help on using the changeset viewer.