IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 25, 2010, 2:45:41 PM (16 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20100823

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtractionVisual.c

    r29004 r29543  
    146146    }
    147147    pmVisualScaleImage(kapa1, canvas, "Subtraction_Stamps", 0, true);
     148    psFree(canvas);
    148149
    149150    pmVisualAskUser(&plotStamps);
     
    152153
    153154/** Plot the least-squares matrix of each stamp */
    154 bool pmSubtractionVisualPlotLeastSquares (pmSubtractionStampList *stamps, bool dual) {
     155bool pmSubtractionVisualPlotLeastSquares (pmSubtractionStampList *stamps) {
    155156
    156157    if (!pmVisualTestLevel("ppsub.chisq", 1)) return true;
     
    209210    pmVisualScaleImage(kapa1, canvas32, "Least_Squares", 0, true);
    210211
     212    if (0) {
     213        static int count = 0;
     214        char filename[64];
     215        sprintf (filename, "chisq.%02d.fits", count);
     216        count ++;
     217        psFits *fits = psFitsOpen (filename, "w");
     218        psFitsWriteImage (fits, NULL, canvas32, 0, NULL);
     219        psFitsClose (fits);
     220    }
     221
    211222    pmVisualAskUser(&plotLeastSquares);
    212223    psFree(canvas);
     
    271282            }
    272283        }
    273         fprintf (stderr, "kernel %d, sum %f\n", i, sum);
     284        // fprintf (stderr, "kernel %d, sum %f\n", i, sum);
    274285    }                                                   
    275286       
    276287    pmVisualScaleImage(kapa1, output, "Image", 0, true);
     288    psFree(output);
    277289    pmVisualAskUser(&plotImage);
    278290    return true;
     
    286298        return false;
    287299    }
     300
     301    // XXX clear the overlay(s) (red at least!)
    288302
    289303    // get the kernel sizes
     
    297311        if (!isfinite(stamp->flux)) continue;
    298312        if (!stamp->convolutions1 && !stamp->convolutions2) continue;
     313        // fprintf (stderr, "flux: %f, maxFlux: %f  ", stamp->flux, maxFlux);
    299314        if (!maxStamp) {
    300315            maxFlux = stamp->flux;
    301316            maxStamp = stamp;
     317            // fprintf (stderr, "maxStamp %d\n", i);
    302318            continue;
     319        } else {
     320            // fprintf (stderr, "\n");
    303321        }
    304322        if (stamp->flux > maxFlux) {
     
    337355           
    338356            double sum = 0.0;
     357            double sum2 = 0.0;
    339358            for (int y = -footprint; y <= footprint; y++) {
    340359                for (int x = -footprint; x <= footprint; x++) {
    341360                    output->data.F32[y + yPix][x + xPix] = kernel->kernel[y][x];
    342361                    sum += kernel->kernel[y][x];
     362                    sum2 += PS_SQR(kernel->kernel[y][x]);
    343363                }
    344364            }
    345             fprintf (stderr, "kernel %d, sum %f\n", i, sum);
     365            // fprintf (stderr, "kernel %d, sum %f, sum2: %e\n", i, sum, sum2);
    346366        }               
    347367        pmVisualScaleImage(kapa2, output, "Image", 0, true);
    348     }                                   
     368
     369        if (0) {
     370            psFits *fits = psFitsOpen("basis.1.fits", "w");
     371            psFitsWriteImage(fits, NULL, output, 0, NULL);
     372            psFitsClose(fits);
     373        }
     374    }
    349375       
    350376    if (maxStamp->convolutions2) {
     
    371397           
    372398            double sum = 0.0;
     399            double sum2 = 0.0;
    373400            for (int y = -footprint; y <= footprint; y++) {
    374401                for (int x = -footprint; x <= footprint; x++) {
    375402                    output->data.F32[y + yPix][x + xPix] = kernel->kernel[y][x];
    376403                    sum += kernel->kernel[y][x];
     404                    sum2 += PS_SQR(kernel->kernel[y][x]);
    377405                }
    378406            }
    379             fprintf (stderr, "kernel %d, sum %f\n", i, sum);
     407            // fprintf (stderr, "kernel %d, sum %f, sum2: %e\n", i, sum, sum2);
    380408        }               
    381409        pmVisualScaleImage(kapa2, output, "Image", 1, true);
     410
     411        if (0) {
     412            psFits *fits = psFitsOpen("basis.2.fits", "w");
     413            psFitsWriteImage(fits, NULL, output, 0, NULL);
     414            psFitsClose(fits);
     415        }
     416        psFree(output);
    382417    }                                   
    383418       
     
    676711    psFree (x);
    677712    psFree (y);
     713    psFree (polyValues);
    678714
    679715    pmVisualAskUser(NULL);
Note: See TracChangeset for help on using the changeset viewer.