IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 19, 2009, 7:59:50 AM (17 years ago)
Author:
beaumont
Message:

Added visualizations to ppSub. Set up a single variable in pmVisual to control when plots are drawn.

Location:
branches/cnb_branch_20090215/psModules/src
Files:
1 added
27 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branch_20090215/psModules/src/astrom/pmAstrometryVisual.c

    r21422 r21536  
    2323
    2424//variables to determine when things are plotted
    25 static bool isVisual             = false;
    2625static bool plotGridMatch        = true;
    2726static bool plotTweak            = true;
     
    4847/* Initialization Routines  */
    4948
    50 bool pmAstromSetVisual (bool mode) {
    51     isVisual = mode;
    52     return true;
    53 }
    54 
    55 
    5649bool pmAstromVisualClose()
    5750{
     
    6861{
    6962    // make sure we want to plot this
    70     if (!plotRawStars || !isVisual) return true;
     63    if (!plotRawStars || !pmVisualIsVisual()) return true;
    7164
    7265    //set up plot region
    7366    if (!pmVisualInitWindow (&kapa, "psastro:plots")){
    74         isVisual = false;
    7567        return false;
    7668    }
     
    222214
    223215    // pause and wait for user input:
    224     pmVisualAskUser(&plotRawStars, &isVisual);
     216    pmVisualAskUser(&plotRawStars);
    225217
    226218    psFree (xVec);
     
    234226{
    235227    //make sure we want to plot this
    236     if (!isVisual || !plotRefStars) return true;
     228    if (!pmVisualIsVisual() || !plotRefStars) return true;
    237229
    238230    //set up plotting variables
    239231    if (!pmVisualInitWindow (&kapa, "psastro:plots")) {
    240         isVisual = false;
    241232        return false;
    242233    }
     
    284275
    285276    // pause and wait for user input:
    286     pmVisualAskUser(&plotRefStars, &isVisual);
     277    pmVisualAskUser(&plotRefStars);
    287278
    288279    psFree (xVec);
     
    301292
    302293    // make sure we want to plot this
    303     if ( !isVisual || !plotLumFunc ) return true;
     294    if ( !pmVisualIsVisual() || !plotLumFunc ) return true;
    304295
    305296    //set up plotting variables
    306297    if ( !pmVisualInitWindow (&kapa, "psastro:plots")){
    307         isVisual = false;
    308298        return false;
    309299    }
     
    377367
    378368        // pause and wait for user input:
    379         pmVisualAskUser (&plotLumFunc, &isVisual);
     369        pmVisualAskUser (&plotLumFunc);
    380370    }
    381371    return true;
     
    391381
    392382    //make sure we want to plot this
    393     if (!isVisual || !plotRemoveClumps) return true;
     383    if (!pmVisualIsVisual() || !plotRemoveClumps) return true;
    394384
    395385    //set up plot variables
    396386    if ( !pmVisualInitWindow (&kapa, "psastro:plots")) {
    397         isVisual = false;
    398387        return false;
    399388    }
     
    480469
    481470    //ask for user input and finish
    482     pmVisualAskUser (&plotRemoveClumps, &isVisual);
     471    pmVisualAskUser (&plotRemoveClumps);
    483472    psFree (xVec);
    484473    psFree (yVec);
     
    496485
    497486    //make sure we want to plot this
    498     if (!isVisual || !plotOneChipFit)
     487    if (!pmVisualIsVisual() || !plotOneChipFit)
    499488        return true;
    500489
    501490    if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) {
    502         isVisual = false;
    503491        return false;
    504492    }
     
    511499
    512500    //ask for user input and finish
    513     pmVisualAskUser(&plotOneChipFit, &isVisual);
     501    pmVisualAskUser(&plotOneChipFit);
    514502    return true;
    515503}
     
    522510{
    523511    //make sure we want to plot this
    524     if(!isVisual || !plotFixChips) return true;
     512    if(!pmVisualIsVisual() || !plotFixChips) return true;
    525513
    526514    if(!pmVisualInitWindow(&kapa, "psastro:plots")) {
    527         isVisual = false;
    528515        return false;
    529516    }
     
    588575    KapaPlotVector (kapa, xNew->n, yNew->data.F32, "y");
    589576
    590     pmVisualAskUser(&plotFixChips, &isVisual);
     577    pmVisualAskUser(&plotFixChips);
    591578    psFree(xNew);
    592579    psFree(yNew);
     
    606593
    607594    //make sure we want to plot this
    608     if (!isVisual || !plotAstromGuessCheck) return true;
     595    if (!pmVisualIsVisual() || !plotAstromGuessCheck) return true;
    609596
    610597    //set up graph window
    611598    if ( !pmVisualInitWindow (&kapa, "psastro:plots")) {
    612         isVisual = false;
    613599        return false;
    614600    }
     
    686672    psFree(xResid);
    687673    psFree(yResid);
    688     pmVisualAskUser (&plotAstromGuessCheck, &isVisual);
     674    pmVisualAskUser (&plotAstromGuessCheck);
    689675    return true;
    690676}
     
    696682{
    697683    //make sure we want to plot this
    698     if (!isVisual || !plotCommonScale) return true;
     684    if (!pmVisualIsVisual() || !plotCommonScale) return true;
    699685
    700686    if (!pmVisualInitWindow(&kapa, "psastro:plots")){
    701         isVisual = false;
    702687        return false;
    703688    }
     
    736721    KapaSendLabel (kapa, "Old Pixel Scale of FPA Chips (Not to Scale)", KAPA_LABEL_XP);
    737722
    738     pmVisualAskUser (&plotCommonScale, &isVisual);
     723    pmVisualAskUser (&plotCommonScale);
    739724
    740725    psFree(xVec);
     
    750735
    751736    //make sure we want to plot this
    752     if (!isVisual || !plotMosaicOneChip) return true;
     737    if (!pmVisualIsVisual() || !plotMosaicOneChip) return true;
    753738
    754739    if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) {
    755         isVisual = false;
    756740        return false;
    757741    }
     
    759743    //plot the residuals
    760744    if (!residPlot(rawstars, refstars, match, recipe, "Single Chip Fit Residuals - Mosaic Mode")) {
    761         isVisual = false;
     745        pmVisualSetVisual(false);
    762746        return false;
    763747    }
    764748
    765749    //ask for user input and finish
    766     pmVisualAskUser(&plotMosaicOneChip, &isVisual);
     750    pmVisualAskUser(&plotMosaicOneChip);
    767751
    768752    return true;
     
    775759{
    776760    //make sure we want to plot this
    777     if (!isVisual || !plotMosaicMatches) return true;
     761    if (!pmVisualIsVisual() || !plotMosaicMatches) return true;
    778762
    779763    char title[60];
     
    782766
    783767    if(!pmVisualInitWindow(&kapa, "psastro:plots") || !pmVisualInitWindow(&kapa2, "psastro:plots")) {
    784         isVisual = false;
    785768        return false;
    786769    }
    787770
    788771    if (!residPlot(rawstars, refstars, match, recipe, title)){
    789         isVisual = false;
     772        pmVisualSetVisual(false);
    790773        return false;
    791774    }
    792775
    793776    //ask for user input
    794     pmVisualAskUser (&plotMosaicMatches, &isVisual);
     777    pmVisualAskUser (&plotMosaicMatches);
    795778    return true;
    796779}
     
    807790{
    808791    //make sure we want to plot this
    809     if (!isVisual || !plotGridMatch) return true;
     792    if (!pmVisualIsVisual() || !plotGridMatch) return true;
    810793    if (!pmVisualInitWindow(&kapa, "psastro:plots")){
    811         isVisual = false;
    812794        return false;
    813795    }
     
    952934    KapaPlotVector (kapa, 2, yslice, "y");
    953935
    954     pmVisualAskUser(&plotGridMatch, &isVisual);
     936    pmVisualAskUser(&plotGridMatch);
    955937    psFree(dXplot);
    956938    psFree(dYplot);
     
    966948{
    967949    //make sure we want to plot this
    968     if (!isVisual || !plotTweak) return true;
     950    if (!pmVisualIsVisual() || !plotTweak) return true;
    969951    if (!pmVisualInitWindow(&kapa, "psastro:plots")) {
    970         isVisual = false;
    971952        return false;
    972953    }
     
    10511032                   KAPA_LABEL_XP);
    10521033
    1053     pmVisualAskUser(&plotTweak, &isVisual);
     1034    pmVisualAskUser(&plotTweak);
    10541035
    10551036    psFree(xIndices);
     
    13411322# else
    13421323
    1343 bool pmAstromSetVisual(bool mode) { return true; }
    13441324bool pmAstromVisualClose() { return true; }
    13451325bool pmAstromVisualPlotGridMatch (const psArray *raw, const psArray *ref, psImage *gridNP, double offsetX, double offsetY, double maxOffpix, double Scale, double Offset) { return true; }
  • branches/cnb_branch_20090215/psModules/src/astrom/pmAstrometryVisual.h

    r21422 r21536  
    2222    int sPeak;                          ///< sum of stars to peak bin
    2323} pmLumFunc;
    24 
    25 
    26 /** Enable or disable visual plotting for psastro routines
    27  * @param mode true/false to enable/disable plotting
    28  * @return true for success */
    29 bool pmAstromSetVisual(bool mode);
    3024
    3125
  • branches/cnb_branch_20090215/psModules/src/camera/pmFPACopy.c

    r21363 r21536  
    457457    psMetadataCopy(target->parent->concepts, source->parent->concepts);
    458458
     459    // Update the astrometric parameters
     460    target->toFPA = psMemIncrRefCounter (source->toFPA);
     461    target->fromFPA = psMemIncrRefCounter (source->fromFPA);
     462
     463    // Update the parent fpa astrometry parameters, or check that they match
     464    pmFPA *targetFPA = target->parent;
     465    pmFPA *sourceFPA = source->parent;
     466    // XXX should we require that both of these exist?
     467
     468    if (targetFPA && sourceFPA) {
     469        if (targetFPA->toSky) {
     470            psAssert (targetFPA->toSky == sourceFPA->toSky, "chips within FPA have inconsistent astrometry references");
     471        } else {
     472            targetFPA->toSky = psMemIncrRefCounter (sourceFPA->toSky);
     473        }
     474        if (targetFPA->toTPA) {
     475            psAssert (targetFPA->toTPA == sourceFPA->toTPA, "chips within FPA have inconsistent astrometry references");
     476        } else {
     477            targetFPA->toTPA = psMemIncrRefCounter (sourceFPA->toTPA);
     478        }
     479        if (targetFPA->fromTPA) {
     480            psAssert (targetFPA->fromTPA == sourceFPA->fromTPA, "chips within FPA have inconsistent astrometry references");
     481        } else {
     482            targetFPA->fromTPA = psMemIncrRefCounter (sourceFPA->fromTPA);
     483        }
     484    }
     485
    459486    target->data_exists = true;
    460487    return status;
  • branches/cnb_branch_20090215/psModules/src/detrend/pmShutterCorrection.h

    r21457 r21536  
    55 * @author Paul Price, IfA
    66 *
    7  * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2009-02-12 19:33:30 $
     7 * @version $Revision: 1.23.2.1 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2009-02-19 17:59:50 $
    99 * Copyright 2006 Institute for Astronomy, University of Hawaii
    1010 */
  • branches/cnb_branch_20090215/psModules/src/extras/pmVisual.c

    r21422 r21536  
    2828# define KAPAY 700
    2929
     30static bool isVisual = false;
     31
     32
     33bool pmVisualSetVisual(bool value) {
     34    isVisual = value;
     35    return true;
     36}
     37
     38
     39bool pmVisualIsVisual(void) {return isVisual;}
     40
     41bool pmVisualClose(void) {
     42    pmAstrometryVisualClose();
     43    pmSubtractionVisualClose();
     44    pmStackVisualClose();
     45    //XXX handle psphot
     46    //    psphotVisualClose();
     47    return true;
     48}
    3049
    3150bool pmVisualInitWindow (int *kapid, char *name) {
     
    3453        if (*kapid == -1) {
    3554            fprintf (stderr, "Failure to open kapa.\n");
     55            isVisual = false;
    3656            return false;
    3757        }
     
    5272
    5373
    54 bool pmVisualAskUser(bool *plotFlag, bool *packageFlag)
     74bool pmVisualAskUser(bool *plotFlag)
    5575{
    5676    char key[10];
     
    6383    }
    6484    if (key[0] == 'a') {
    65         *packageFlag = false;
     85        isVisual = false;
    6686    }
    6787    return true;
     
    304324
    305325#else
    306 
     326bool pmVisualSetVisual(bool value) {return true;}
     327bool pmVisualIsVisual(void) {return false;}
     328bool pmVisualClose(void) {return true;}
    307329bool pmVisualInitWindow(int *kapid, char *name){return true;}
    308330bool pmVisualInitGraph (int kapa, void *section, void *graphdata){return true;}
    309331
    310 bool pmVisualAskUser(bool *plotFlag, bool *packageFlag){return true;}
     332bool pmVisualAskUser(bool *plotFlag){return true;}
    311333bool pmVisualImStats(psImage *image, double *mean,
    312334                     double *stdev, double *min, double *max){return true;}
  • branches/cnb_branch_20090215/psModules/src/extras/pmVisual.h

    r21422 r21536  
    1010
    1111#if (HAVE_KAPA)
     12
     13
     14/** Globally enable or disable plotting
     15 * @param value - true to enable plotting
     16 * @return true
     17 */
     18bool pmVisualSetVisual(bool value);
     19
     20
     21/** Check whether plotting is enabled
     22 * @retrun true if plots should be generated
     23 */
     24bool pmVisualIsVisual(void);
     25
     26
     27/** Destroy plotting windows at the end of a run
     28 * @return true for success */
     29bool pmVisualClose(void);
    1230
    1331
     
    3250 * At the user's request, this will disable diagnostic plotting.
    3351 * @param plotFlag, set to false if this plot should be disabled in the future
    34  * @param packageFlag, set to false if all plots from this package (e.g. psastro, pmSubtraction)
    35  *                      should be disabled.
    3652 */
    37 bool pmVisualAskUser(bool *plotFlag, bool *packageFlag);
     53bool pmVisualAskUser(bool *plotFlag);
    3854
    3955
     
    115131
    116132// kapa-specific data types are changed to void
     133bool pmVisualSetVisual(bool value);
     134bool pmVisualIsVisual(void);
     135bool pmVisualClose(void);
    117136bool pmVisualInitWindow (int *kapid, char *name);
    118137bool pmVisualInitGraph (int kapa, void *section, void *graphdata);
    119 bool pmVisualAskUser(bool *plotFlag, bool *packageFlag);
     138bool pmVisualAskUser(bool *plotFlag);
    120139bool pmVisualScaleImage(int kapaFD, psImage *inImage,
    121140                        const char *name, int channel, bool clip);
  • branches/cnb_branch_20090215/psModules/src/imcombine/Makefile.am

    r21422 r21536  
    1919        pmSubtractionThreads.c  \
    2020        pmPSFEnvelope.c         \
    21         pmSubtractionVisual.c
     21        pmSubtractionVisual.c   \
     22        pmStackVisual.c
    2223
    2324pkginclude_HEADERS = \
     
    3738        pmSubtractionThreads.h  \
    3839        pmPSFEnvelope.h         \
    39         pmSubtractionVisual.h
     40        pmSubtractionVisual.h   \
     41        pmStackVisual.h
    4042
    4143CLEANFILES = *~
  • branches/cnb_branch_20090215/psModules/src/imcombine/pmPSFEnvelope.c

    r21363 r21536  
    3030
    3131#include "pmPSFEnvelope.h"
    32 
    33 
    34 
    35 //#define TESTING                         // Enable test output
     32#include "pmStackVisual.h"
     33
     34
     35#define TESTING                         // Enable test output
    3636#define PEAK_FLUX 1.0e4                 // Peak flux for each source
    3737#define SKY_VALUE 0.0e0                 // Sky value for fake image
     
    162162            psStringAppend(&name, "psf_field_%03d.fits", i);
    163163            psFits *fits = psFitsOpen(name, "w");
     164            pmStackVisualPlotTestImage(fakeRO->image, name);
    164165            psFitsWriteImage(fits, NULL, fakeRO->image, 0, NULL);
    165166            psFitsClose(fits);
     
    179180        // Write out the envelope
    180181        psFits *fits = psFitsOpen("psf_field_envelope.fits", "w");
     182        pmStackVisualPlotTestImage(envelope, "psf_field_envelope.fits");
    181183        psFitsWriteImage(fits, NULL, envelope, 0, NULL);
    182184        psFitsClose(fits);
     
    231233        // Write out the envelope
    232234        psFits *fits = psFitsOpen("psf_field_full.fits", "w");
     235        pmStackVisualPlotTestImage(readout->image, "psf_field_full.fits");
    233236        psFitsWriteImage(fits, NULL, readout->image, 0, NULL);
    234237        psFitsClose(fits);
     
    312315        {
    313316            psFits *fits = psFitsOpen("psf_field_model.fits", "w");
     317            pmStackVisualPlotTestImage(generated->image, "psf_field_model.fits");
    314318            psFitsWriteImage(fits, NULL, generated->image, 0, NULL);
    315319            psFitsClose(fits);
     
    318322        {
    319323            psFits *fits = psFitsOpen("psf_field_resid.fits", "w");
     324            pmStackVisualPlotTestImage(generated->image, "psf_field_resid.fits");
    320325            psFitsWriteImage(fits, NULL, generated->image, 0, NULL);
    321326            psFitsClose(fits);
  • branches/cnb_branch_20090215/psModules/src/imcombine/pmStack.c

    r21476 r21536  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2009-02-13 23:52:14 $
     10 *  @version $Revision: 1.48.2.1 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2009-02-19 17:59:50 $
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
    1313 *
     
    3333#define NUM_DIRECT_STDEV 5              // For less than this number of values, measure stdev directly
    3434
    35 //#define TESTING                         // Enable test output
    36 //#define TEST_X 2318                     // x coordinate to examine
    37 //#define TEST_Y 2306                     // y coordinate to examine
     35//CNB change all of these to false
     36#define TESTING                         // Enable test output
     37#define TEST_X 2318                     // x coordinate to examine
     38#define TEST_Y 2306                     // y coordinate to examine
    3839
    3940
  • branches/cnb_branch_20090215/psModules/src/imcombine/pmSubtractionIO.c

    r20355 r21536  
    1616
    1717#include "pmSubtractionIO.h"
     18#include "pmStackVisual.h"
    1819
    1920#define ARRAY_BUFFER 16                 // Number to add to array at a time
     
    144145    // CVS tags, used to identify the version of this file (in case incompatibilities are introduced)
    145146    psString cvsFile = psStringCopy("$RCSfile: pmSubtractionIO.c,v $");
    146     psString cvsRev  = psStringCopy("$Revision: 1.9 $");
    147     psString cvsDate = psStringCopy("$Date: 2008-10-24 21:21:06 $");
     147    psString cvsRev  = psStringCopy("$Revision: 1.9.18.1 $");
     148    psString cvsDate = psStringCopy("$Date: 2009-02-19 17:59:50 $");
    148149    psStringSubstitute(&cvsFile, NULL, "RCSfile: ");
    149150    psStringSubstitute(&cvsRev,  NULL, "Revision: ");
     
    167168
    168169    psImage *image = psMetadataLookupPtr(NULL, ro->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL_IMAGE); // Image
     170    pmStackVisualPlotTestImage(image, "Subtraction_kernels.fits");
     171
    169172    if (image && !psFitsWriteImage(fits, header, image, 0, EXTNAME_IMAGE)) {
    170173        psError(PS_ERR_IO, false, "Unable to write subtraction kernel image.");
  • branches/cnb_branch_20090215/psModules/src/imcombine/pmSubtractionVisual.c

    r21422 r21536  
    2828
    2929//variables to determine when things are plotted
    30 static bool isVisual             = false;
    3130static bool plotConvKernels      = true;
    3231static bool plotStamps           = true;
     
    4241// Initialization Routines
    4342
    44 /** start or stop plotting */
    45 bool pmSubtractionSetVisual (bool mode) {
    46     isVisual = mode;
    47     return true;
    48 }
    4943
    5044
     
    6559 *    @return true for success */
    6660bool pmSubtractionVisualPlotConvKernels(psImage *convKernels) {
    67     if (!isVisual || !plotConvKernels) return true;
     61    if (!pmVisualIsVisual() || !plotConvKernels) return true;
    6862    if (!pmVisualInitWindow(&kapa, "ppSub:Images")) {
    69         isVisual = false;
    7063        return false;
    7164    }
    7265    pmVisualScaleImage(kapa, convKernels, "Convolution_Kernels", 0, true);
    73     pmVisualAskUser(&plotConvKernels, &isVisual);
     66    pmVisualAskUser(&plotConvKernels);
    7467    return true;
    7568}
     
    8073    @return true for success */
    8174bool pmSubtractionVisualPlotStamps(pmSubtractionStampList *stamps, pmReadout *ro) {
    82     if (!isVisual || !plotStamps) return true;
     75    if (!pmVisualIsVisual() || !plotStamps) return true;
    8376    if (!pmVisualInitWindow (&kapa, "ppSub:Images")) {
    84         isVisual = false;
    8577        return false;
    8678    }
    8779    if (!pmVisualInitWindow (&kapa2, "ppSub:StampMasterImage")) {
    88         isVisual = false;
    8980        return false;
    9081    }
     
    145136    pmVisualScaleImage(kapa, canvas, "Subtraction_Stamps", 0, true);
    146137
    147     pmVisualAskUser(&plotStamps, &isVisual);
     138    pmVisualAskUser(&plotStamps);
    148139    return true;
    149140}
     
    152143bool pmSubtractionVisualPlotLeastSquares (pmSubtractionStampList *stamps, bool dual) {
    153144
    154     if (!isVisual || !plotLeastSquares) return true;
     145    if (!pmVisualIsVisual() || !plotLeastSquares) return true;
    155146    if (!pmVisualInitWindow (&kapa, "PPSub:Images")) {
    156         isVisual = false;
    157147        return false;
    158148    }
     
    209199    pmVisualScaleImage(kapa, canvas32, "Least_Squares", 0, true);
    210200
    211     pmVisualAskUser(&plotLeastSquares, &isVisual);
     201    pmVisualAskUser(&plotLeastSquares);
    212202    psFree(canvas);
    213203    psFree(canvas32);
     
    216206
    217207bool pmSubtractionVisualShowSubtraction(psImage *image, psImage *ref, psImage *sub) {
    218     if (!isVisual || !plotImage) return true;
     208    if (!pmVisualIsVisual() || !plotImage) return true;
    219209    if (!pmVisualInitWindow (&kapa, "PPSub:Images")) {
    220         isVisual = false;
    221210        return false;
    222211    }
     
    225214    pmVisualScaleImage(kapa, ref, "Reference", 1, true);
    226215    pmVisualScaleImage(kapa, sub, "Subtraction", 2, true);
    227     pmVisualAskUser(&plotImage, &isVisual);
     216    pmVisualAskUser(&plotImage);
    228217    return true;
    229218}
     
    267256
    268257#else
    269 bool pmSubtractionSetVisual (bool mode) {return true;}
    270258bool pmSubtractionVisualClose() {return true;}
    271259bool pmSubtractionVisualPlotConvKernels(psImage *convKernels) {return true;}
  • branches/cnb_branch_20090215/psModules/src/imcombine/pmSubtractionVisual.h

    r21422 r21536  
    22#define PM_SUBTRACTION_VISUAL_H
    33
    4 bool pmSubtractionSetVisual (bool mode);
    54bool pmSubtractionVisualClose();
    65bool pmSubtractionVisualPlotConvKernels(psImage *convKernels);
  • branches/cnb_branch_20090215/psModules/src/objects/Makefile.am

    r20946 r21536  
    3636        pmSourceIO_PS1_DEV_1.c \
    3737        pmSourceIO_PS1_CAL_0.c \
     38        pmSourceIO_CMF_PS1_V1.c \
    3839        pmSourcePlots.c \
    3940        pmSourcePlotPSFModel.c \
  • branches/cnb_branch_20090215/psModules/src/objects/pmModel.c

    r21381 r21536  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-06 20:54:14 $
     8 *  @version $Revision: 1.27.4.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-19 17:59:50 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959    tmp->chisqNorm = 0.0;
    6060    tmp->nDOF  = 0;
     61    tmp->nPix  = 0;
    6162    tmp->nIter = 0;
    6263    tmp->radiusFit = 0;
     
    234235
    235236    if (model->residuals) {
    236         DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5;
    237         DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5;
    238         Ro = (model->residuals->Ro)   ? model->residuals->Ro->data.F32 : NULL;
    239         Rx = (model->residuals->Rx)   ? model->residuals->Rx->data.F32 : NULL;
    240         Ry = (model->residuals->Ry)   ? model->residuals->Ry->data.F32 : NULL;
    241         Rm = (model->residuals->mask) ? model->residuals->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
    242         if (Ro) {
    243             NX = model->residuals->Ro->numCols;
    244             NY = model->residuals->Ro->numRows;
    245         }           
     237        DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5;
     238        DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5;
     239        Ro = (model->residuals->Ro)   ? model->residuals->Ro->data.F32 : NULL;
     240        Rx = (model->residuals->Rx)   ? model->residuals->Rx->data.F32 : NULL;
     241        Ry = (model->residuals->Ry)   ? model->residuals->Ry->data.F32 : NULL;
     242        Rm = (model->residuals->mask) ? model->residuals->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
     243        if (Ro) {
     244            NX = model->residuals->Ro->numCols;
     245            NY = model->residuals->Ro->numRows;
     246        }
    246247    }
    247248
     
    255256
    256257            // XXX should we use using 0.5 pixel offset?
    257             // Convert to coordinate in parent image, with offset (dx,dy)
     258            // Convert to coordinate in parent image, with offset (dx,dy)
    258259            imageCol = ix + image->col0 - dx;
    259260            imageRow = iy + image->row0 - dy;
     
    275276                float rx = xBin*ix + DX;
    276277
    277                 int rx0 = rx - 0.5;
    278                 int rx1 = rx + 0.5;
    279                 int ry0 = ry - 0.5;
    280                 int ry1 = ry + 0.5;
    281 
    282                 if (rx0 < 0) goto skip;
    283                 if (ry0 < 0) goto skip;
    284                 if (rx1 >= NX) goto skip;
    285                 if (ry1 >= NY) goto skip;
    286 
    287                 // these go from 0.0 to 1.0 between the centers of the pixels
    288                 float fx = rx - 0.5 - rx0;
    289                 float Fx = 1.0 - fx;
    290                 float fy = ry - 0.5 - ry0;
    291                 float Fy = 1.0 - fy;
    292 
    293                 // check the residual image mask (if set). give up if any of the 4 pixels are masked.
    294                 if (Rm) {
    295                     if (Rm[ry0][rx0]) goto skip;
    296                     if (Rm[ry0][rx1]) goto skip;
    297                     if (Rm[ry1][rx0]) goto skip;
    298                     if (Rm[ry1][rx1]) goto skip;
    299                 }
    300 
    301                 // a possible further optimization if we re-use these values
    302                 // XXX allow for masked pixels, and add pixel weights
    303                 float V0 = (Ro[ry0][rx0]*Fx + Ro[ry0][rx1]*fx);
    304                 float V1 = (Ro[ry1][rx0]*Fx + Ro[ry1][rx1]*fx);
    305                 float Vo = V0*Fy + V1*fy;
    306                 if (!isfinite(Vo)) goto skip;
    307 
    308                 float Vx = 0.0;
    309                 float Vy = 0.0;
    310 
    311                 // skip Rx,Ry if Ro is masked
    312                 if (Rx && Ry && (mode & PM_MODEL_OP_RES1)) {
    313                     V0 = (Rx[ry0][rx0]*Fx + Rx[ry0][rx1]*fx);
    314                     V1 = (Rx[ry1][rx0]*Fx + Rx[ry1][rx1]*fx);
    315                     Vx = V0*Fy + V1*fy;
    316 
    317                     V0 = (Ry[ry0][rx0]*Fx + Ry[ry0][rx1]*fx);
    318                     V1 = (Ry[ry1][rx0]*Fx + Ry[ry1][rx1]*fx);
    319                     Vy = V0*Fy + V1*fy;
    320                 }
    321                 if (!isfinite(Vx)) goto skip;
    322                 if (!isfinite(Vy)) goto skip;
    323 
    324                 // 2D residual variations are set for the true source position
    325                 pixelValue += Io*(Vo + XoSave*Vx + XoSave*Vy);
     278                int rx0 = rx - 0.5;
     279                int rx1 = rx + 0.5;
     280                int ry0 = ry - 0.5;
     281                int ry1 = ry + 0.5;
     282
     283                if (rx0 < 0) goto skip;
     284                if (ry0 < 0) goto skip;
     285                if (rx1 >= NX) goto skip;
     286                if (ry1 >= NY) goto skip;
     287
     288                // these go from 0.0 to 1.0 between the centers of the pixels
     289                float fx = rx - 0.5 - rx0;
     290                float Fx = 1.0 - fx;
     291                float fy = ry - 0.5 - ry0;
     292                float Fy = 1.0 - fy;
     293
     294                // check the residual image mask (if set). give up if any of the 4 pixels are masked.
     295                if (Rm) {
     296                    if (Rm[ry0][rx0]) goto skip;
     297                    if (Rm[ry0][rx1]) goto skip;
     298                    if (Rm[ry1][rx0]) goto skip;
     299                    if (Rm[ry1][rx1]) goto skip;
     300                }
     301
     302                // a possible further optimization if we re-use these values
     303                // XXX allow for masked pixels, and add pixel weights
     304                float V0 = (Ro[ry0][rx0]*Fx + Ro[ry0][rx1]*fx);
     305                float V1 = (Ro[ry1][rx0]*Fx + Ro[ry1][rx1]*fx);
     306                float Vo = V0*Fy + V1*fy;
     307                if (!isfinite(Vo)) goto skip;
     308
     309                float Vx = 0.0;
     310                float Vy = 0.0;
     311
     312                // skip Rx,Ry if Ro is masked
     313                if (Rx && Ry && (mode & PM_MODEL_OP_RES1)) {
     314                    V0 = (Rx[ry0][rx0]*Fx + Rx[ry0][rx1]*fx);
     315                    V1 = (Rx[ry1][rx0]*Fx + Rx[ry1][rx1]*fx);
     316                    Vx = V0*Fy + V1*fy;
     317
     318                    V0 = (Ry[ry0][rx0]*Fx + Ry[ry0][rx1]*fx);
     319                    V1 = (Ry[ry1][rx0]*Fx + Ry[ry1][rx1]*fx);
     320                    Vy = V0*Fy + V1*fy;
     321                }
     322                if (!isfinite(Vx)) goto skip;
     323                if (!isfinite(Vy)) goto skip;
     324
     325                // 2D residual variations are set for the true source position
     326                pixelValue += Io*(Vo + XoSave*Vx + XoSave*Vy);
    326327            }
    327328
    328         skip:
     329        skip:
    329330            // add or subtract the value
    330331            if (add) {
  • branches/cnb_branch_20090215/psModules/src/objects/pmModel.h

    r21183 r21536  
    55 * @author EAM, IfA
    66 *
    7  * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2009-01-27 06:39:38 $
     7 * @version $Revision: 1.18.8.1 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2009-02-19 17:59:50 $
    99 *
    1010 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9292    float mag;                          ///< integrated model magnitude
    9393    float magErr;                       ///< integrated model magnitude error
     94    int nPix;                           ///< number of pixels used for fit
    9495    int nDOF;                           ///< number of degrees of freedom
    9596    int nIter;                          ///< number of iterations to reach min
     
    150151    pmModel *model,                     ///< The input pmModel
    151152    pmModelOpMode mode,                 ///< mode to control how the model is added into the image
    152     psImageMaskType maskVal             ///< Value to mask
     153    psImageMaskType maskVal             ///< Value to mask
    153154);
    154155
     
    168169    pmModel *model,                     ///< The input pmModel
    169170    pmModelOpMode mode,                 ///< mode to control how the model is added into the image
    170     psImageMaskType maskVal             ///< Value to mask
     171    psImageMaskType maskVal             ///< Value to mask
    171172);
    172173
  • branches/cnb_branch_20090215/psModules/src/objects/pmPeaks.c

    r20937 r21536  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2008-12-08 02:51:14 $
     8 *  @version $Revision: 1.25.14.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-19 17:59:50 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828AddPeak(): A private function which allocates a psArray, if the peaks
    2929argument is NULL, otherwise it adds the peak to that array.
    30 XXX EAM : row,col now refer to image coords, NOT parent (since this is private) 
     30XXX EAM : row,col now refer to image coords, NOT parent (since this is private)
    3131XXX EAM : now also calculates fractional peak positions from 3x3 bicube region
    3232*****************************************************************************/
     
    6363        peak->xf = min.x + ix + image->col0;
    6464        peak->yf = min.y + iy + image->row0;
    65         peak->dx = NAN;
    66         peak->dy = NAN;
    67        
    68         // xf,yf must land on image with 0 pixel border
    69         peak->xf = PS_MAX (PS_MIN (peak->xf, image->numCols - 1), image->col0);
    70         peak->yf = PS_MAX (PS_MIN (peak->yf, image->numRows - 1), image->row0);
     65
     66        // These errors are fractional errors, and should be scaled by the
     67        // error on the peak pixel (see, eg, psphotFindPeaks)
     68        peak->dx = min.xErr;
     69        peak->dy = min.yErr;
     70
     71        // xf,yf must land on image with 0 pixel border
     72        peak->xf = PS_MAX (PS_MIN (peak->xf, image->numCols - 1), image->col0);
     73        peak->yf = PS_MAX (PS_MIN (peak->yf, image->numRows - 1), image->row0);
    7174    } else {
    7275        peak->xf = ix;
    7376        peak->yf = iy;
    74         peak->dx = NAN;
    75         peak->dy = NAN;
     77        peak->dx = NAN;
     78        peak->dy = NAN;
    7679    }
    7780
     
    8689getRowVectorFromImage(): a private function which simply returns a
    8790psVector containing the specified row of data from the psImage.
    88  
     91
    8992XXX: Is there a better way to do this?
    9093XXX EAM: does this really need to alloc a new vector???
     
    245248above the given threshold.  Returns a vector of type PS_TYPE_U32 containing
    246249the location (x value) of all peaks.
    247  
     250
    248251XXX: What types should be supported?  Only F32 is implemented.
    249  
     252
    250253XXX: We currently step through the input vector twice; once to determine the
    251254size of the output vector, then to set the values of the output vector.
     
    253256*****************************************************************************/
    254257psVector *pmPeaksInVector(const psVector *vector,
    255                         psF32 threshold)
     258                        psF32 threshold)
    256259{
    257260    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     
    347350above the given threshold.  Returns a psArray containing location (x/y value)
    348351of all peaks.
    349  
     352
    350353XXX: I'm not convinced the peak type definition in the SDRS is mutually
    351354exclusive.  Some peaks can have multiple types.  Edges for sure.  Also, a
    352355digonal line with the same value at each point will have a peak for every
    353356point on that line.
    354  
     357
    355358XXX: This does not work if image has either a single row, or a single column.
    356  
     359
    357360The peak is returned in the image parent coordinates
    358361
  • branches/cnb_branch_20090215/psModules/src/objects/pmSource.c

    r21363 r21536  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-06 02:31:25 $
     8 *  @version $Revision: 1.69.4.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-19 17:59:50 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    113113    source->type = PM_SOURCE_TYPE_UNKNOWN;
    114114    source->mode = PM_SOURCE_MODE_DEFAULT;
     115    source->tmpFlags = 0;
    115116    source->extpars = NULL;
    116117    source->region = psRegionSet(NAN, NAN, NAN, NAN);
     
    534535    float INNER_RADIUS = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS");
    535536
     537    pmSourceMode noMoments = PM_SOURCE_MODE_MOMENTS_FAILURE | PM_SOURCE_MODE_SKYVAR_FAILURE | PM_SOURCE_MODE_SKY_FAILURE | PM_SOURCE_MODE_BELOW_MOMENTS_SN;
     538
    536539    // XXX allow clump size to be scaled relative to sigmas?
    537540    // make rough IDs based on clumpX,Y,DX,DY
     
    540543        pmSource *source = (pmSource *) sources->data[i];
    541544
    542         if (source->peak->x < region->x0) continue;
    543         if (source->peak->x > region->x1) continue;
    544         if (source->peak->y < region->y0) continue;
    545         if (source->peak->y > region->y1) continue;
    546 
    547         source->peak->type = 0;
     545        // psf clumps are found for image subregions:
     546        // skip sources not in this region
     547        if (source->peak->x <  region->x0) continue;
     548        if (source->peak->x >= region->x1) continue;
     549        if (source->peak->y <  region->y0) continue;
     550        if (source->peak->y >= region->y1) continue;
     551
     552        // should be set by pmSourceAlloc
     553        psAssert (source->type == PM_SOURCE_TYPE_UNKNOWN, "source type was not init-ed?");
    548554
    549555        // we are basically classifying by moments; use the default if not found
    550556        if (!source->moments) {
    551557            source->type = PM_SOURCE_TYPE_STAR;
     558            psAssert (source->mode & noMoments, "why is this source missing moments?");
    552559            Nstar++;
    553560            continue;
     
    10491056}
    10501057
     1058// sort by Seq (ascending)
     1059int pmSourceSortBySeq (const void **a, const void **b)
     1060{
     1061    pmSource *A = *(pmSource **)a;
     1062    pmSource *B = *(pmSource **)b;
     1063
     1064    int iA = A->seq;
     1065    int iB = B->seq;
     1066
     1067    int diff = iA - iB;
     1068    if (diff > 0) return (+1);
     1069    if (diff < 0) return (-1);
     1070    return (0);
     1071}
     1072
    10511073pmSourceMode pmSourceModeFromString (const char *name) {
    10521074  if (!strcasecmp (name, "DEFAULT"   )) return PM_SOURCE_MODE_DEFAULT;
     
    10661088  if (!strcasecmp (name, "CRLIMIT"   )) return PM_SOURCE_MODE_CR_LIMIT;
    10671089  if (!strcasecmp (name, "EXTLIMIT"  )) return PM_SOURCE_MODE_EXT_LIMIT;
    1068   if (!strcasecmp (name, "SUBTRACTED")) return PM_SOURCE_MODE_SUBTRACTED;
    10691090  return PM_SOURCE_MODE_DEFAULT;
    10701091}
     
    10881109    case PM_SOURCE_MODE_CR_LIMIT   : return psStringCopy ("CRLIMIT"   );
    10891110    case PM_SOURCE_MODE_EXT_LIMIT  : return psStringCopy ("EXTLIMIT"  );
    1090     case PM_SOURCE_MODE_SUBTRACTED : return psStringCopy ("SUBTRACTED");
    10911111    default:
    10921112      return NULL;
  • branches/cnb_branch_20090215/psModules/src/objects/pmSource.h

    r21363 r21536  
    33 * @author EAM, IfA; GLG, MHPCC
    44 *
    5  * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    6  * @date $Date: 2009-02-06 02:31:25 $
     5 * @version $Revision: 1.28.4.1 $ $Name: not supported by cvs2svn $
     6 * @date $Date: 2009-02-19 17:59:50 $
    77 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    88 */
     
    3535} pmSourceType;
    3636
     37// bit flags to distinguish analysis results
    3738typedef enum {
    38     PM_SOURCE_MODE_DEFAULT    = 0x0000, ///<
    39     PM_SOURCE_MODE_PSFMODEL   = 0x0001, ///< Source fitted with a psf model (linear or non-linear)
    40     PM_SOURCE_MODE_EXTMODEL   = 0x0002, ///< Source fitted with an extended-source model
    41     PM_SOURCE_MODE_FITTED     = 0x0004, ///< Source fitted with non-linear model (PSF or EXT; good or bad)
    42     PM_SOURCE_MODE_FAIL       = 0x0008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)
    43     PM_SOURCE_MODE_POOR       = 0x0010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)
    44     PM_SOURCE_MODE_PAIR       = 0x0020, ///< Source fitted with a double psf
    45     PM_SOURCE_MODE_PSFSTAR    = 0x0040, ///< Source used to define PSF model
    46     PM_SOURCE_MODE_SATSTAR    = 0x0080, ///< Source model peak is above saturation
    47     PM_SOURCE_MODE_BLEND      = 0x0100, ///< Source is a blend with other sourcers
    48     PM_SOURCE_MODE_EXTERNAL   = 0x0200, ///< Source based on supplied input position
    49     PM_SOURCE_MODE_BADPSF     = 0x0400, ///< Failed to get good estimate of object's PSF
    50     PM_SOURCE_MODE_DEFECT     = 0x0800, ///< Source is thought to be a defect
    51     PM_SOURCE_MODE_SATURATED  = 0x1000, ///< Source is thought to be saturated pixels (bleed trail)
    52     PM_SOURCE_MODE_CR_LIMIT   = 0x2000, ///< Source has crNsigma above limit
    53     PM_SOURCE_MODE_EXT_LIMIT  = 0x4000, ///< Source has extNsigma above limit
    54     PM_SOURCE_MODE_SUBTRACTED = 0x8000, ///< XXX this flag is actually only used internally (move)
     39    PM_SOURCE_MODE_DEFAULT          = 0x00000000, ///< Initial value: resets all bits
     40    PM_SOURCE_MODE_PSFMODEL         = 0x00000001, ///< Source fitted with a psf model (linear or non-linear)
     41    PM_SOURCE_MODE_EXTMODEL         = 0x00000002, ///< Source fitted with an extended-source model
     42    PM_SOURCE_MODE_FITTED           = 0x00000004, ///< Source fitted with non-linear model (PSF or EXT; good or bad)
     43    PM_SOURCE_MODE_FAIL             = 0x00000008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)
     44    PM_SOURCE_MODE_POOR             = 0x00000010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)
     45    PM_SOURCE_MODE_PAIR             = 0x00000020, ///< Source fitted with a double psf
     46    PM_SOURCE_MODE_PSFSTAR          = 0x00000040, ///< Source used to define PSF model
     47    PM_SOURCE_MODE_SATSTAR          = 0x00000080, ///< Source model peak is above saturation
     48    PM_SOURCE_MODE_BLEND            = 0x00000100, ///< Source is a blend with other sourcers
     49    PM_SOURCE_MODE_EXTERNAL         = 0x00000200, ///< Source based on supplied input position
     50    PM_SOURCE_MODE_BADPSF           = 0x00000400, ///< Failed to get good estimate of object's PSF
     51    PM_SOURCE_MODE_DEFECT           = 0x00000800, ///< Source is thought to be a defect
     52    PM_SOURCE_MODE_SATURATED        = 0x00001000, ///< Source is thought to be saturated pixels (bleed trail)
     53    PM_SOURCE_MODE_CR_LIMIT         = 0x00002000, ///< Source has crNsigma above limit
     54    PM_SOURCE_MODE_EXT_LIMIT        = 0x00004000, ///< Source has extNsigma above limit
     55    PM_SOURCE_MODE_MOMENTS_FAILURE  = 0x00008000, ///< could not measure the moments
     56    PM_SOURCE_MODE_SKY_FAILURE      = 0x00010000, ///< could not measure the local sky
     57    PM_SOURCE_MODE_SKYVAR_FAILURE   = 0x00020000, ///< could not measure the local sky variance
     58    PM_SOURCE_MODE_BELOW_MOMENTS_SN = 0x00040000, ///< moments not measured due to low S/N
     59    PM_SOURCE_MODE_BIG_RADIUS       = 0x00100000, ///< poor moments for small radius, try large radius
     60    PM_SOURCE_MODE_AP_MAGS          = 0x00200000, ///< source has an aperture magnitude
     61    PM_SOURCE_MODE_BLEND_FIT        = 0x00400000, ///< source was fitted as a blend
     62    PM_SOURCE_MODE_EXTENDED_FIT     = 0x00800000, ///< full extended fit was used
     63    PM_SOURCE_MODE_EXTENDED_STATS   = 0x01000000, ///< extended aperture stats calculated
     64    PM_SOURCE_MODE_LINEAR_FIT       = 0x02000000, ///< source fitted with the linear fit
     65    PM_SOURCE_MODE_NONLINEAR_FIT    = 0x04000000, ///< source fitted with the non-linear fit
     66    PM_SOURCE_MODE_RADIAL_FLUX      = 0x08000000, ///< radial flux measurements calculated
     67    PM_SOURCE_MODE_SIZE_SKIPPED     = 0x10000000, ///< size could not be determined
    5568} pmSourceMode;
     69
     70typedef enum {
     71    PM_SOURCE_TMPF_MODEL_GUESS = 0x0001,
     72    PM_SOURCE_TMPF_SUBTRACTED  = 0x0002,
     73} pmSourceTmpF;
    5674
    5775/** pmSource data structure
     
    6886 */
    6987struct pmSource {
    70     const int id;                       ///< Unique ID for object
    71     int seq;                            ///< ID for output (generated on write)
     88    const int id;                       ///< Unique ID for object (generated on alloc)
     89    int seq;                            ///< ID for output (generated on write OR set on read)
    7290    pmPeak  *peak;                      ///< Description of peak pixel.
    7391    psImage *pixels;                    ///< Rectangular region including object pixels.
     
    83101    pmSourceType type;                  ///< Best identification of object.
    84102    pmSourceMode mode;                  ///< analysis flags set for object.
     103    pmSourceTmpF tmpFlags;              ///< internal-only flags
    85104    psArray *blends;                    ///< collection of sources thought to be confused with object
    86105    float psfMag;                       ///< calculated from flux in modelPSF
     
    240259bool pmSourceCachePSF (pmSource *source, psImageMaskType maskVal);
    241260
    242 int             pmSourceSortBySN (const void **a, const void **b);
    243 int             pmSourceSortByY (const void **a, const void **b);
     261int  pmSourceSortBySN (const void **a, const void **b);
     262int  pmSourceSortByY (const void **a, const void **b);
     263int  pmSourceSortBySeq (const void **a, const void **b);
    244264
    245265pmSourceMode pmSourceModeFromString (const char *name);
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourceFitModel.c

    r21363 r21536  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-06 02:31:25 $
     8 *  @version $Revision: 1.30.4.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-19 17:59:50 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    184184    model->chisq = myMin->value;
    185185    model->nIter = myMin->iter;
     186    model->nPix  = y->n;
    186187    model->nDOF  = y->n - nParams;
    187188    model->flags |= PM_MODEL_STATUS_FITTED;
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourceIO.c

    r20937 r21536  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.69 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-12-08 02:51:14 $
     5 *  @version $Revision: 1.69.14.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2009-02-19 17:59:50 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    488488            }
    489489            if (!strcmp (exttype, "PS1_DEV_1")) {
    490                 status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname, xsrcname);
     490                status = pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname);
    491491            }
    492492            if (!strcmp (exttype, "PS1_CAL_0")) {
    493                 status = pmSourcesWrite_PS1_CAL_0 (file->fits, readout, sources, file->header, outhead, dataname, xsrcname);
     493                status = pmSourcesWrite_PS1_CAL_0 (file->fits, readout, sources, file->header, outhead, dataname);
     494            }
     495            if (!strcmp (exttype, "PS1_V1")) {
     496                status = pmSourcesWrite_CMF_PS1_V1 (file->fits, readout, sources, file->header, outhead, dataname);
    494497            }
    495498            if (xsrcname) {
     
    500503                  status = pmSourcesWrite_PS1_CAL_0_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe);
    501504              }
     505              if (!strcmp (exttype, "PS1_V1")) {
     506                  status = pmSourcesWrite_CMF_PS1_V1_XSRC (file->fits, sources, xsrcname, recipe);
     507              }
    502508            }
    503509            if (xfitname) {
     
    507513              if (!strcmp (exttype, "PS1_CAL_0")) {
    508514                  status = pmSourcesWrite_PS1_CAL_0_XFIT (file->fits, readout, sources, file->header, xfitname);
     515              }
     516              if (!strcmp (exttype, "PS1_V1")) {
     517                  status = pmSourcesWrite_CMF_PS1_V1_XFIT (file->fits, sources, xfitname);
    509518              }
    510519            }
     
    929938                sources = pmSourcesRead_PS1_DEV_1 (file->fits, hdu->header);
    930939            }
    931             if (!strcmp (exttype, "PS1_CAL_)")) {
    932                 sources = pmSourcesRead_PS1_CAL_0 (file->fits, hdu->header);
     940            if (!strcmp (exttype, "PS1_V1")) {
     941                sources = pmSourcesRead_CMF_PS1_V1 (file->fits, hdu->header);
    933942            }
    934943        }
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourceIO.h

    r20741 r21536  
    44 * @author EAM, IfA; GLG, MHPCC
    55 *
    6  * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2008-11-14 02:11:45 $
     6 * @version $Revision: 1.19.16.1 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2009-02-19 17:59:50 $
    88 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    99 *
     
    2626bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
    2727bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
    28 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, char *xsrcname);
     28
     29bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
    2930bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname, psMetadata *recipe);
    3031bool pmSourcesWrite_PS1_DEV_1_XFIT (psFits *fits, psArray *sources, char *extname);
    3132
    32 bool pmSourcesWrite_PS1_CAL_0 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, char *xsrcname);
     33bool pmSourcesWrite_PS1_CAL_0 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
    3334bool pmSourcesWrite_PS1_CAL_0_XSRC (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe);
    3435bool pmSourcesWrite_PS1_CAL_0_XFIT (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname);
     36
     37bool pmSourcesWrite_CMF_PS1_V1 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);
     38bool pmSourcesWrite_CMF_PS1_V1_XSRC (psFits *fits, psArray *sources, char *extname, psMetadata *recipe);
     39bool pmSourcesWrite_CMF_PS1_V1_XFIT (psFits *fits, psArray *sources, char *extname);
    3540
    3641bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, pmConfig *config);
     
    4247psArray *pmSourcesRead_PS1_DEV_1 (psFits *fits, psMetadata *header);
    4348psArray *pmSourcesRead_PS1_CAL_0 (psFits *fits, psMetadata *header);
     49psArray *pmSourcesRead_CMF_PS1_V1 (psFits *fits, psMetadata *header);
    4450
    4551bool pmSourcesWritePSFs (psArray *sources, char *filename);
     
    6773bool pmReadoutCheckDataStatusForSources (const pmReadout *readout);
    6874
     75bool pmSourceLocalAstrometry (psSphere *ptSky, float *posAngle, float *pltScale, pmChip *chip, float xPos, float yPos);
     76
    6977/// @}
    7078# endif /* PM_SOURCE_IO_H */
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourceIO_PS1_CAL_0.c

    r20937 r21536  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-12-08 02:51:14 $
     5 *  @version $Revision: 1.2.14.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2009-02-19 17:59:50 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949// XXX how do I generate the source tables which I need to send to PSPS?
    5050
    51 bool pmSourcesWrite_PS1_CAL_0 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader,
    52                                psMetadata *tableHeader, char *extname, char *xsrcname)
     51bool pmSourcesWrite_PS1_CAL_0 (psFits *fits, pmReadout *readout, psArray *sources,
     52                               psMetadata *imageHeader, psMetadata *tableHeader, char *extname)
    5353{
    5454    PS_ASSERT_PTR_NON_NULL(fits, false);
     
    6868    pmFPA  *fpa  = chip->parent;
    6969    if (!chip->toFPA || !fpa->toTPA || !fpa->toSky) {
    70         psWarning ("astrometry calibration is missing, no calibrated coords");
     70        psWarning ("astrometry calibration is missing, no calibrated coords");
    7171    }
    7272
     
    7777    float zeropt  = psMetadataLookupF32 (&status2, imageHeader, "ZPT_OBS");
    7878    if (!status1 || !status2 || (exptime == 0.0)) {
    79         psWarning ("exposure time or measured zero point not found for a readout, no calibrated mags");
     79        psWarning ("exposure time or measured zero point not found for a readout, no calibrated mags");
    8080    } else {
    81         magOffset = zeropt + 2.5*log10(exptime);
     81        magOffset = zeropt + 2.5*log10(exptime);
    8282    }
    8383
     
    9090    for (i = 0; i < sources->n; i++) {
    9191        pmSource *source = (pmSource *) sources->data[i];
    92         if (source->seq == -1) {
    93             source->seq = i;
    94         }
     92        if (source->seq == -1) {
     93            source->seq = i;
     94        }
    9595
    9696        // no difference between PSF and non-PSF model
     
    104104            xErr = dPAR[PM_PAR_XPOS];
    105105            yErr = dPAR[PM_PAR_YPOS];
    106             if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX])) {
    107                 axes = pmPSF_ModelToAxes (PAR, 20.0);
    108             } else {
    109                 axes.major = NAN;
    110                 axes.minor = NAN;
    111                 axes.theta = NAN;
    112             }
    113             chisq = model->chisq;
    114 
    115             // need to determine the PSF photometry error: source->errMag is the error on the 'best' model mag.
    116             errMag = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];
     106            if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX])) {
     107                axes = pmPSF_ModelToAxes (PAR, 20.0);
     108            } else {
     109                axes.major = NAN;
     110                axes.minor = NAN;
     111                axes.theta = NAN;
     112            }
     113            chisq = model->chisq;
     114
     115            // need to determine the PSF photometry error: source->errMag is the error on the 'best' model mag.
     116            errMag = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];
    117117        } else {
    118118            xPos = source->peak->xf;
     
    123123            axes.minor = NAN;
    124124            axes.theta = NAN;
    125             chisq = NAN;
    126             errMag = NAN;
    127         }
    128 
    129         float calMag = source->psfMag + magOffset;
     125            chisq = NAN;
     126            errMag = NAN;
     127        }
     128
     129        float calMag = source->psfMag + magOffset;
    130130        float peakMag = (source->peak->flux > 0) ? -2.5*log10(source->peak->flux) : NAN;
    131131        psS16 nImageOverlap = 1;
    132132
    133         // generate RA,DEC
    134         psPlane ptCH, ptFP, ptTP;
    135         psSphere ptSky;
    136 
    137         ptCH.x = xPos;
    138         ptCH.y = yPos;
    139         if (chip->toFPA && fpa->toTPA && fpa->toSky) {
    140             psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
    141             psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);
    142             psDeproject (&ptSky, &ptTP, fpa->toSky);
    143         } else {
    144             ptSky.r = NAN;
    145             ptSky.d = NAN;
    146         }
     133        // generate RA,DEC
     134        psPlane ptCH, ptFP, ptTP;
     135        psSphere ptSky;
     136
     137        ptCH.x = xPos;
     138        ptCH.y = yPos;
     139        if (chip->toFPA && fpa->toTPA && fpa->toSky) {
     140            psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
     141            psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);
     142            psDeproject (&ptSky, &ptTP, fpa->toSky);
     143        } else {
     144            ptSky.r = NAN;
     145            ptSky.d = NAN;
     146        }
    147147
    148148        row = psMetadataAlloc ();
     
    150150        psMetadataAdd (row, PS_LIST_TAIL, "RA_PSF",           PS_DATA_F32, "PSF RA coordinate (degrees)",                ptSky.r*PS_DEG_RAD);
    151151        psMetadataAdd (row, PS_LIST_TAIL, "DEC_PSF",          PS_DATA_F32, "PSF DEC coordinate (degrees)",               ptSky.d*PS_DEG_RAD);
    152         // XXX need to do the error propagation correctly..
     152        // XXX need to do the error propagation correctly..
    153153        // psMetadataAdd (row, PS_LIST_TAIL, "RA_PSF_SIG",       PS_DATA_F32, "Sigma of PSF fit RA",                     dRA);
    154154        // psMetadataAdd (row, PS_LIST_TAIL, "DEC_PSF_SIG",      PS_DATA_F32, "Sigma of PSF fit DEC",                    dDEC);
     
    170170        psMetadataAdd (row, PS_LIST_TAIL, "EXT_NSIGMA",       PS_DATA_F32,  "Nsigma deviations from PSF to EXT",         source->extNsigma);
    171171
    172         // EXT_NSIGMA will be NAN if: 1) contour ellipse is imaginary; 2) source is not
    173         // subtracted
    174 
    175         // CR_NSIGMA will be NAN if: 1) source is not subtracted; 2) source is on the image
    176         // edge; 3) any pixels in the 3x3 peak region are masked;
     172        // EXT_NSIGMA will be NAN if: 1) contour ellipse is imaginary; 2) source is not
     173        // subtracted
     174
     175        // CR_NSIGMA will be NAN if: 1) source is not subtracted; 2) source is on the image
     176        // edge; 3) any pixels in the 3x3 peak region are masked;
    177177
    178178        // XXX these should be major and minor, not 'x' and 'y'
     
    277277        source->psfMag    = psMetadataLookupF32 (&status, row, "PSF_INST_MAG");
    278278        source->errMag    = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");
    279         PAR[PM_PAR_I0]    = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN;
    280         dPAR[PM_PAR_I0]   = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->errMag : NAN;
     279        PAR[PM_PAR_I0]    = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN;
     280        dPAR[PM_PAR_I0]   = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->errMag : NAN;
    281281
    282282        pmPSF_AxesToModel (PAR, axes);
     
    289289        source->pixWeight = psMetadataLookupF32 (&status, row, "PSF_QF");
    290290
    291         // note that some older versions used PSF_PROBABILITY: this was not well defined.
     291        // note that some older versions used PSF_PROBABILITY: this was not well defined.
    292292        model->chisq      = psMetadataLookupF32 (&status, row, "PSF_CHISQ");
    293293        source->crNsigma  = psMetadataLookupF32 (&status, row, "CR_NSIGMA");
     
    321321    pmFPA  *fpa  = chip->parent;
    322322    if (!chip->toFPA || !fpa->toTPA || !fpa->toSky) {
    323         psWarning ("astrometry calibration is missing, no calibrated coords");
     323        psWarning ("astrometry calibration is missing, no calibrated coords");
    324324    }
    325325
     
    331331    float zeropt  = psMetadataLookupF32 (&status2, imageHeader, "ZPT_OBS");
    332332    if (!status1 || !status2 || (exptime == 0.0)) {
    333         psWarning ("exposure time or measured zero point not found for a readout, no calibrated mags");
     333        psWarning ("exposure time or measured zero point not found for a readout, no calibrated mags");
    334334    } else {
    335         magOffset = zeropt + 2.5*log10(exptime);
    336         calMags = true;
     335        magOffset = zeropt + 2.5*log10(exptime);
     336        calMags = true;
    337337    }
    338338
     
    360360    // we write out all sources, regardless of quality.  the source flags tell us the state
    361361    for (int i = 0; i < sources->n; i++) {
    362         // skip source if it is not a ext sourc
    363         // XXX we have two places that extended source parameters are measured:
    364         // psphotExtendedSources, which measures the aperture-like parameters and (potentially) the psf-convolved extended source models,
    365         // psphotFitEXT, which does the simple extended source model fit (not psf-convolved)
    366         // should we require both?
    367 
    368         pmSource *source = sources->data[i];
    369 
    370         // skip sources without measurements
    371         if (source->extpars == NULL) continue;
    372 
    373         // we require a PSF model fit (ignore the real crud)
    374         pmModel *model = source->modelPSF;
    375         if (model == NULL) continue;
    376 
    377         // XXX I need to split the extended models from the extended aperture measurements
    378         PAR = model->params->data.F32;
    379         dPAR = model->dparams->data.F32;
    380         xPos = PAR[PM_PAR_XPOS];
    381         yPos = PAR[PM_PAR_YPOS];
    382         xErr = dPAR[PM_PAR_XPOS];
    383         yErr = dPAR[PM_PAR_YPOS];
    384 
    385         // generate RA,DEC
    386         psPlane ptCH, ptFP, ptTP;
    387         psSphere ptSky;
    388 
    389         ptCH.x = xPos;
    390         ptCH.y = yPos;
    391         if (chip->toFPA && fpa->toTPA && fpa->toSky) {
    392             psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
    393             psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);
    394             psDeproject (&ptSky, &ptTP, fpa->toSky);
    395         } else {
    396             ptSky.r = NAN;
    397             ptSky.d = NAN;
    398         }
     362        // skip source if it is not a ext sourc
     363        // XXX we have two places that extended source parameters are measured:
     364        // psphotExtendedSources, which measures the aperture-like parameters and (potentially) the psf-convolved extended source models,
     365        // psphotFitEXT, which does the simple extended source model fit (not psf-convolved)
     366        // should we require both?
     367
     368        pmSource *source = sources->data[i];
     369
     370        // skip sources without measurements
     371        if (source->extpars == NULL) continue;
     372
     373        // we require a PSF model fit (ignore the real crud)
     374        pmModel *model = source->modelPSF;
     375        if (model == NULL) continue;
     376
     377        // XXX I need to split the extended models from the extended aperture measurements
     378        PAR = model->params->data.F32;
     379        dPAR = model->dparams->data.F32;
     380        xPos = PAR[PM_PAR_XPOS];
     381        yPos = PAR[PM_PAR_YPOS];
     382        xErr = dPAR[PM_PAR_XPOS];
     383        yErr = dPAR[PM_PAR_YPOS];
     384
     385        // generate RA,DEC
     386        psPlane ptCH, ptFP, ptTP;
     387        psSphere ptSky;
     388
     389        ptCH.x = xPos;
     390        ptCH.y = yPos;
     391        if (chip->toFPA && fpa->toTPA && fpa->toSky) {
     392            psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
     393            psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);
     394            psDeproject (&ptSky, &ptTP, fpa->toSky);
     395        } else {
     396            ptSky.r = NAN;
     397            ptSky.d = NAN;
     398        }
    399399
    400400        row = psMetadataAlloc ();
     
    410410        psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT_SIG",        PS_DATA_F32, "Sigma in EXT y coordinate",                  yErr);
    411411
    412         // Petrosian measurements
    413         // XXX insert header data: petrosian ref radius, flux ratio
    414         if (doPetrosian) {
    415             pmSourcePetrosianValues *petrosian = source->extpars->petrosian;
    416             if (petrosian) {
    417                 if (calMags) {
    418                     psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_CAL",    PS_DATA_F32, "Petrosian Magnitude (calibrated)", petrosian->mag + magOffset);
    419                 } else {
    420                     psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_INST",   PS_DATA_F32, "Petrosian Magnitude (instrumental)", petrosian->mag);
    421                 }
    422                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", petrosian->magErr);
    423                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          petrosian->rad);
    424                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    petrosian->radErr);
    425             } else {
    426                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude",       NAN);
    427                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", NAN);
    428                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          NAN);
    429                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    NAN);
    430             }
    431         }
    432 
    433         // Kron measurements
    434         if (doKron) {
    435             pmSourceKronValues *kron = source->extpars->kron;
    436             if (kron) {
    437                 if (calMags) {
    438                     psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_CAL",  PS_DATA_F32, "Kron Magnitude",     kron->mag + magOffset);
    439                 } else {
    440                     psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_INST", PS_DATA_F32, "Kron Magnitude",     kron->mag);
    441                 }
    442                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", kron->magErr);
    443                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          kron->rad);
    444                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    kron->radErr);
    445             } else {
    446                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG",        PS_DATA_F32, "Kron Magnitude",       NAN);
    447                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", NAN);
    448                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          NAN);
    449                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    NAN);
    450             }
    451         }
    452 
    453         // Isophot measurements
    454         // XXX insert header data: isophotal level
    455         if (doIsophotal) {
    456             pmSourceIsophotalValues *isophot = source->extpars->isophot;
    457             if (isophot) {
    458                 if (calMags) {
    459                     psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_CAL",    PS_DATA_F32, "Isophot Magnitude (calibrated)",   isophot->mag + magOffset);
    460                 } else {
    461                     psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_INST",   PS_DATA_F32, "Isophot Magnitude (uncalibrated)", isophot->mag);
    462                 }
    463                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", isophot->magErr);
    464                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          isophot->rad);
    465                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    isophot->radErr);
    466             } else {
    467                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG",        PS_DATA_F32, "Isophot Magnitude",       NAN);
    468                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", NAN);
    469                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          NAN);
    470                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    NAN);
    471             }
    472         }
    473 
    474         // Flux Annuli
    475         if (doAnnuli) {
    476             pmSourceAnnuli *annuli = source->extpars->annuli;
    477             if (annuli) {
    478                 psVector *fluxVal = annuli->flux;
    479                 psVector *fluxErr = annuli->fluxErr;
    480                 psVector *fluxVar = annuli->fluxVar;
    481 
    482                 for (int j = 0; j < fluxVal->n; j++) {
    483                     char name[32];
    484                     sprintf (name, "FLUX_VAL_R_%02d", j);
    485                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", fluxVal->data.F32[j]);
    486                     sprintf (name, "FLUX_ERR_R_%02d", j);
    487                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", fluxErr->data.F32[j]);
    488                     sprintf (name, "FLUX_VAR_R_%02d", j);
    489                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", fluxVar->data.F32[j]);
    490                 }
    491             } else {
    492                 for (int j = 0; j < radialBinsLower->n; j++) {
    493                     char name[32];
    494                     sprintf (name, "FLUX_VAL_R_%02d", j);
    495                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", NAN);
    496                     sprintf (name, "FLUX_ERR_R_%02d", j);
    497                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", NAN);
    498                     sprintf (name, "FLUX_VAR_R_%02d", j);
    499                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", NAN);
    500                 }
    501             }
    502         }
    503 
    504         psArrayAdd (table, 100, row);
    505         psFree (row);
     412        // Petrosian measurements
     413        // XXX insert header data: petrosian ref radius, flux ratio
     414        if (doPetrosian) {
     415            pmSourcePetrosianValues *petrosian = source->extpars->petrosian;
     416            if (petrosian) {
     417                if (calMags) {
     418                    psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_CAL",    PS_DATA_F32, "Petrosian Magnitude (calibrated)", petrosian->mag + magOffset);
     419                } else {
     420                    psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_INST",   PS_DATA_F32, "Petrosian Magnitude (instrumental)", petrosian->mag);
     421                }
     422                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", petrosian->magErr);
     423                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          petrosian->rad);
     424                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    petrosian->radErr);
     425            } else {
     426                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude",       NAN);
     427                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", NAN);
     428                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          NAN);
     429                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    NAN);
     430            }
     431        }
     432
     433        // Kron measurements
     434        if (doKron) {
     435            pmSourceKronValues *kron = source->extpars->kron;
     436            if (kron) {
     437                if (calMags) {
     438                    psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_CAL",  PS_DATA_F32, "Kron Magnitude",     kron->mag + magOffset);
     439                } else {
     440                    psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_INST", PS_DATA_F32, "Kron Magnitude",     kron->mag);
     441                }
     442                psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", kron->magErr);
     443                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          kron->rad);
     444                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    kron->radErr);
     445            } else {
     446                psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG",        PS_DATA_F32, "Kron Magnitude",       NAN);
     447                psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", NAN);
     448                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          NAN);
     449                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    NAN);
     450            }
     451        }
     452
     453        // Isophot measurements
     454        // XXX insert header data: isophotal level
     455        if (doIsophotal) {
     456            pmSourceIsophotalValues *isophot = source->extpars->isophot;
     457            if (isophot) {
     458                if (calMags) {
     459                    psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_CAL",    PS_DATA_F32, "Isophot Magnitude (calibrated)",   isophot->mag + magOffset);
     460                } else {
     461                    psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_INST",   PS_DATA_F32, "Isophot Magnitude (uncalibrated)", isophot->mag);
     462                }
     463                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", isophot->magErr);
     464                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          isophot->rad);
     465                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    isophot->radErr);
     466            } else {
     467                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG",        PS_DATA_F32, "Isophot Magnitude",       NAN);
     468                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", NAN);
     469                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          NAN);
     470                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    NAN);
     471            }
     472        }
     473
     474        // Flux Annuli
     475        if (doAnnuli) {
     476            pmSourceAnnuli *annuli = source->extpars->annuli;
     477            if (annuli) {
     478                psVector *fluxVal = annuli->flux;
     479                psVector *fluxErr = annuli->fluxErr;
     480                psVector *fluxVar = annuli->fluxVar;
     481
     482                for (int j = 0; j < fluxVal->n; j++) {
     483                    char name[32];
     484                    sprintf (name, "FLUX_VAL_R_%02d", j);
     485                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", fluxVal->data.F32[j]);
     486                    sprintf (name, "FLUX_ERR_R_%02d", j);
     487                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", fluxErr->data.F32[j]);
     488                    sprintf (name, "FLUX_VAR_R_%02d", j);
     489                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", fluxVar->data.F32[j]);
     490                }
     491            } else {
     492                for (int j = 0; j < radialBinsLower->n; j++) {
     493                    char name[32];
     494                    sprintf (name, "FLUX_VAL_R_%02d", j);
     495                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", NAN);
     496                    sprintf (name, "FLUX_ERR_R_%02d", j);
     497                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", NAN);
     498                    sprintf (name, "FLUX_VAR_R_%02d", j);
     499                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", NAN);
     500                }
     501            }
     502        }
     503
     504        psArrayAdd (table, 100, row);
     505        psFree (row);
    506506    }
    507507
    508508    if (table->n == 0) {
    509         psFitsWriteBlank (fits, outhead, extname);
    510         psFree (outhead);
    511         psFree (table);
    512         return true;
     509        psFitsWriteBlank (fits, outhead, extname);
     510        psFree (outhead);
     511        psFree (table);
     512        return true;
    513513    }
    514514
    515515    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    516516    if (!psFitsWriteTable (fits, outhead, table, extname)) {
    517         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
    518         psFree (outhead);
    519         psFree(table);
    520         return false;
     517        psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
     518        psFree (outhead);
     519        psFree(table);
     520        return false;
    521521    }
    522522    psFree (outhead);
     
    540540    pmFPA  *fpa  = chip->parent;
    541541    if (!chip->toFPA || !fpa->toTPA || !fpa->toSky) {
    542         psWarning ("astrometry calibration is missing, no calibrated coords");
     542        psWarning ("astrometry calibration is missing, no calibrated coords");
    543543    }
    544544
     
    549549    float zeropt  = psMetadataLookupF32 (&status2, imageHeader, "ZPT_OBS");
    550550    if (!status1 || !status2 || (exptime == 0.0)) {
    551         psWarning ("exposure time or measured zero point not found for a readout, no calibrated mags");
     551        psWarning ("exposure time or measured zero point not found for a readout, no calibrated mags");
    552552    } else {
    553         magOffset = zeropt + 2.5*log10(exptime);
     553        magOffset = zeropt + 2.5*log10(exptime);
    554554    }
    555555
     
    566566    int nParamMax = 0;
    567567    for (int i = 0; i < sources->n; i++) {
    568         pmSource *source = sources->data[i];
    569         if (source->modelFits == NULL) continue;
    570         for (int j = 0; j < source->modelFits->n; j++) {
    571             pmModel *model = source->modelFits->data[j];
    572             assert (model);
    573             nParamMax = PS_MAX (nParamMax, model->params->n);
    574         }
     568        pmSource *source = sources->data[i];
     569        if (source->modelFits == NULL) continue;
     570        for (int j = 0; j < source->modelFits->n; j++) {
     571            pmModel *model = source->modelFits->data[j];
     572            assert (model);
     573            nParamMax = PS_MAX (nParamMax, model->params->n);
     574        }
    575575    }
    576576
     
    580580    for (int i = 0; i < sources->n; i++) {
    581581
    582         pmSource *source = sources->data[i];
    583 
    584         // XXX if no model fits are saved, write out modelEXT?
    585         if (source->modelFits == NULL) continue;
    586 
    587         // We have multiple sources : need to flag the one used to subtract the light (the 'best' model)
    588         for (int j = 0; j < source->modelFits->n; j++) {
    589 
    590             // choose the convolved EXT model, if available, otherwise the simple one
    591             pmModel *model = source->modelFits->data[j];
    592             assert (model);
    593 
    594             PAR = model->params->data.F32;
    595             dPAR = model->dparams->data.F32;
    596             xPos = PAR[PM_PAR_XPOS];
    597             yPos = PAR[PM_PAR_YPOS];
    598             xErr = dPAR[PM_PAR_XPOS];
    599             yErr = dPAR[PM_PAR_YPOS];
    600 
    601             axes = pmPSF_ModelToAxes (PAR, 20.0);
    602 
    603             // generate RA,DEC
    604             psPlane ptCH, ptFP, ptTP;
    605             psSphere ptSky;
    606 
    607             ptCH.x = xPos;
    608             ptCH.y = yPos;
    609             if (chip->toFPA && fpa->toTPA && fpa->toSky) {
    610                 psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
    611                 psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);
    612                 psDeproject (&ptSky, &ptTP, fpa->toSky);
    613             } else {
    614                 ptSky.r = NAN;
    615                 ptSky.d = NAN;
    616             }
    617 
    618             row = psMetadataAlloc ();
    619 
    620             // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
    621             psMetadataAddU32 (row, PS_LIST_TAIL, "IPP_IDET",         0, "IPP detection identifier index",             source->seq);
    622             psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT",           0, "EXT model RA (degrees)",                     ptSky.r);
    623             psMetadataAddF32 (row, PS_LIST_TAIL, "DEC_EXT",          0, "EXT model DEC (degrees)",                    ptSky.d);
    624             psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT",            0, "EXT model x coordinate",                     xPos);
    625             psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT",            0, "EXT model y coordinate",                     yPos);
    626             psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT_SIG",        0, "Sigma in EXT x coordinate",                  xErr);
    627             psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT_SIG",        0, "Sigma in EXT y coordinate",                  yErr);
    628             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_CAL_MAG",      0, "EXT fit calibrated magnitude",               model->mag + magOffset);
    629             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG",     0, "EXT fit instrumental magnitude",             model->mag);
    630             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", 0, "Sigma of PSF instrumental magnitude",        model->magErr);
    631 
    632             psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
    633             psMetadataAddStr (row, PS_LIST_TAIL, "MODEL_TYPE",       0, "name of model",                              pmModelClassGetName (model->type));
    634 
    635             // XXX these should be major and minor, not 'x' and 'y'
    636             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ",    0, "EXT width in x coordinate",                  axes.major);
    637             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN",    0, "EXT width in y coordinate",                  axes.minor);
    638             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA",        0, "EXT orientation angle",                      axes.theta);
    639 
    640             // write out the other generic parameters
    641             for (int k = 0; k < nParamMax; k++) {
    642                 if (k == PM_PAR_I0) continue;
    643                 if (k == PM_PAR_SKY) continue;
    644                 if (k == PM_PAR_XPOS) continue;
    645                 if (k == PM_PAR_YPOS) continue;
    646                 if (k == PM_PAR_SXX) continue;
    647                 if (k == PM_PAR_SXY) continue;
    648                 if (k == PM_PAR_SYY) continue;
    649 
    650                 snprintf (name, 64, "EXT_PAR_%02d", k);
    651 
    652                 if (k < model->params->n) {
    653                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "", model->params->data.F32[k]);
    654                 } else {
    655                     psMetadataAddF32 (row, PS_LIST_TAIL, name, PS_DATA_F32, "", NAN);
    656                 }
    657             }
    658 
    659             // XXX other parameters which may be set.
    660             // XXX flag / value to define the model
    661             // XXX write out the model type, fit status flags
    662 
    663             psArrayAdd (table, 100, row);
    664             psFree (row);
    665         }
     582        pmSource *source = sources->data[i];
     583
     584        // XXX if no model fits are saved, write out modelEXT?
     585        if (source->modelFits == NULL) continue;
     586
     587        // We have multiple sources : need to flag the one used to subtract the light (the 'best' model)
     588        for (int j = 0; j < source->modelFits->n; j++) {
     589
     590            // choose the convolved EXT model, if available, otherwise the simple one
     591            pmModel *model = source->modelFits->data[j];
     592            assert (model);
     593
     594            PAR = model->params->data.F32;
     595            dPAR = model->dparams->data.F32;
     596            xPos = PAR[PM_PAR_XPOS];
     597            yPos = PAR[PM_PAR_YPOS];
     598            xErr = dPAR[PM_PAR_XPOS];
     599            yErr = dPAR[PM_PAR_YPOS];
     600
     601            axes = pmPSF_ModelToAxes (PAR, 20.0);
     602
     603            // generate RA,DEC
     604            psPlane ptCH, ptFP, ptTP;
     605            psSphere ptSky;
     606
     607            ptCH.x = xPos;
     608            ptCH.y = yPos;
     609            if (chip->toFPA && fpa->toTPA && fpa->toSky) {
     610                psPlaneTransformApply (&ptFP, chip->toFPA, &ptCH);
     611                psPlaneTransformApply (&ptTP, fpa->toTPA, &ptFP);
     612                psDeproject (&ptSky, &ptTP, fpa->toSky);
     613            } else {
     614                ptSky.r = NAN;
     615                ptSky.d = NAN;
     616            }
     617
     618            row = psMetadataAlloc ();
     619
     620            // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
     621            psMetadataAddU32 (row, PS_LIST_TAIL, "IPP_IDET",         0, "IPP detection identifier index",             source->seq);
     622            psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT",           0, "EXT model RA (degrees)",                     ptSky.r);
     623            psMetadataAddF32 (row, PS_LIST_TAIL, "DEC_EXT",          0, "EXT model DEC (degrees)",                    ptSky.d);
     624            psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT",            0, "EXT model x coordinate",                     xPos);
     625            psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT",            0, "EXT model y coordinate",                     yPos);
     626            psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT_SIG",        0, "Sigma in EXT x coordinate",                  xErr);
     627            psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT_SIG",        0, "Sigma in EXT y coordinate",                  yErr);
     628            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_CAL_MAG",      0, "EXT fit calibrated magnitude",               model->mag + magOffset);
     629            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG",     0, "EXT fit instrumental magnitude",             model->mag);
     630            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", 0, "Sigma of PSF instrumental magnitude",        model->magErr);
     631
     632            psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
     633            psMetadataAddStr (row, PS_LIST_TAIL, "MODEL_TYPE",       0, "name of model",                              pmModelClassGetName (model->type));
     634
     635            // XXX these should be major and minor, not 'x' and 'y'
     636            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ",    0, "EXT width in x coordinate",                  axes.major);
     637            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN",    0, "EXT width in y coordinate",                  axes.minor);
     638            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA",        0, "EXT orientation angle",                      axes.theta);
     639
     640            // write out the other generic parameters
     641            for (int k = 0; k < nParamMax; k++) {
     642                if (k == PM_PAR_I0) continue;
     643                if (k == PM_PAR_SKY) continue;
     644                if (k == PM_PAR_XPOS) continue;
     645                if (k == PM_PAR_YPOS) continue;
     646                if (k == PM_PAR_SXX) continue;
     647                if (k == PM_PAR_SXY) continue;
     648                if (k == PM_PAR_SYY) continue;
     649
     650                snprintf (name, 64, "EXT_PAR_%02d", k);
     651
     652                if (k < model->params->n) {
     653                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "", model->params->data.F32[k]);
     654                } else {
     655                    psMetadataAddF32 (row, PS_LIST_TAIL, name, PS_DATA_F32, "", NAN);
     656                }
     657            }
     658
     659            // XXX other parameters which may be set.
     660            // XXX flag / value to define the model
     661            // XXX write out the model type, fit status flags
     662
     663            psArrayAdd (table, 100, row);
     664            psFree (row);
     665        }
    666666    }
    667667
    668668    if (table->n == 0) {
    669         psFitsWriteBlank (fits, outhead, extname);
    670         psFree (outhead);
    671         psFree (table);
    672         return true;
     669        psFitsWriteBlank (fits, outhead, extname);
     670        psFree (outhead);
     671        psFree (table);
     672        return true;
    673673    }
    674674
    675675    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    676676    if (!psFitsWriteTable (fits, outhead, table, extname)) {
    677         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
    678         psFree (outhead);
    679         psFree(table);
    680         return false;
     677        psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
     678        psFree (outhead);
     679        psFree(table);
     680        return false;
    681681    }
    682682    psFree (outhead);
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourceIO_PS1_DEV_1.c

    r20937 r21536  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-12-08 02:51:14 $
     5 *  @version $Revision: 1.14.14.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2009-02-19 17:59:50 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4949// XXX how do I generate the source tables which I need to send to PSPS?
    5050
    51 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader,
    52                                psMetadata *tableHeader, char *extname, char *xsrcname)
     51bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources,
     52                               psMetadata *imageHeader, psMetadata *tableHeader, char *extname)
    5353{
    5454    PS_ASSERT_PTR_NON_NULL(fits, false);
     
    7373    for (i = 0; i < sources->n; i++) {
    7474        pmSource *source = (pmSource *) sources->data[i];
    75         if (source->seq == -1) {
    76             source->seq = i;
    77         }
     75        if (source->seq == -1) {
     76            source->seq = i;
     77        }
    7878
    7979        // no difference between PSF and non-PSF model
     
    8787            xErr = dPAR[PM_PAR_XPOS];
    8888            yErr = dPAR[PM_PAR_YPOS];
    89             if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX])) {
    90                 axes = pmPSF_ModelToAxes (PAR, 20.0);
    91             } else {
    92                 axes.major = NAN;
    93                 axes.minor = NAN;
    94                 axes.theta = NAN;
    95             }
    96             chisq = model->chisq;
    97 
    98             // need to determine the PSF photometry error: source->errMag is the error on the 'best' model mag.
    99             errMag = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];
     89            if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXX])) {
     90                axes = pmPSF_ModelToAxes (PAR, 20.0);
     91            } else {
     92                axes.major = NAN;
     93                axes.minor = NAN;
     94                axes.theta = NAN;
     95            }
     96            chisq = model->chisq;
     97
     98            // need to determine the PSF photometry error: source->errMag is the error on the 'best' model mag.
     99            errMag = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];
    100100        } else {
    101101            xPos = source->peak->xf;
     
    106106            axes.minor = NAN;
    107107            axes.theta = NAN;
    108             chisq = NAN;
    109             errMag = NAN;
     108            chisq = NAN;
     109            errMag = NAN;
    110110        }
    111111
     
    130130        psMetadataAdd (row, PS_LIST_TAIL, "EXT_NSIGMA",       PS_DATA_F32,  "Nsigma deviations from PSF to EXT",         source->extNsigma);
    131131
    132         // EXT_NSIGMA will be NAN if: 1) contour ellipse is imaginary; 2) source is not
    133         // subtracted
    134 
    135         // CR_NSIGMA will be NAN if: 1) source is not subtracted; 2) source is on the image
    136         // edge; 3) any pixels in the 3x3 peak region are masked;
    137 
    138         // CR_NSIGMA and
     132        // EXT_NSIGMA will be NAN if: 1) contour ellipse is imaginary; 2) source is not
     133        // subtracted
     134
     135        // CR_NSIGMA will be NAN if: 1) source is not subtracted; 2) source is on the image
     136        // edge; 3) any pixels in the 3x3 peak region are masked;
     137
     138        // CR_NSIGMA and
    139139
    140140        // XXX these should be major and minor, not 'x' and 'y'
     
    247247        source->psfMag    = psMetadataLookupF32 (&status, row, "PSF_INST_MAG");
    248248        source->errMag    = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");
    249         PAR[PM_PAR_I0]    = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN;
    250         dPAR[PM_PAR_I0]   = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->errMag : NAN;
     249        PAR[PM_PAR_I0]    = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN;
     250        dPAR[PM_PAR_I0]   = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->errMag : NAN;
    251251
    252252        pmPSF_AxesToModel (PAR, axes);
     
    259259        source->pixWeight = psMetadataLookupF32 (&status, row, "PSF_QF");
    260260
    261         // note that some older versions used PSF_PROBABILITY: this was not well defined.
     261        // note that some older versions used PSF_PROBABILITY: this was not well defined.
    262262        model->chisq      = psMetadataLookupF32 (&status, row, "PSF_CHISQ");
    263263        source->crNsigma  = psMetadataLookupF32 (&status, row, "CR_NSIGMA");
     
    311311    // we write out all sources, regardless of quality.  the source flags tell us the state
    312312    for (int i = 0; i < sources->n; i++) {
    313         // skip source if it is not a ext sourc
    314         // XXX we have two places that extended source parameters are measured:
    315         // psphotExtendedSources, which measures the aperture-like parameters and (potentially) the psf-convolved extended source models,
    316         // psphotFitEXT, which does the simple extended source model fit (not psf-convolved)
    317         // should we require both?
    318 
    319         pmSource *source = sources->data[i];
    320 
    321         // skip sources without measurements
    322         if (source->extpars == NULL) continue;
    323 
    324         // we require a PSF model fit (ignore the real crud)
    325         pmModel *model = source->modelPSF;
    326         if (model == NULL) continue;
    327 
    328         // XXX I need to split the extended models from the extended aperture measurements
    329         PAR = model->params->data.F32;
    330         dPAR = model->dparams->data.F32;
    331         xPos = PAR[PM_PAR_XPOS];
    332         yPos = PAR[PM_PAR_YPOS];
    333         xErr = dPAR[PM_PAR_XPOS];
    334         yErr = dPAR[PM_PAR_YPOS];
     313        // skip source if it is not a ext sourc
     314        // XXX we have two places that extended source parameters are measured:
     315        // psphotExtendedSources, which measures the aperture-like parameters and (potentially) the psf-convolved extended source models,
     316        // psphotFitEXT, which does the simple extended source model fit (not psf-convolved)
     317        // should we require both?
     318
     319        pmSource *source = sources->data[i];
     320
     321        // skip sources without measurements
     322        if (source->extpars == NULL) continue;
     323
     324        // we require a PSF model fit (ignore the real crud)
     325        pmModel *model = source->modelPSF;
     326        if (model == NULL) continue;
     327
     328        // XXX I need to split the extended models from the extended aperture measurements
     329        PAR = model->params->data.F32;
     330        dPAR = model->dparams->data.F32;
     331        xPos = PAR[PM_PAR_XPOS];
     332        yPos = PAR[PM_PAR_YPOS];
     333        xErr = dPAR[PM_PAR_XPOS];
     334        yErr = dPAR[PM_PAR_YPOS];
    335335
    336336        row = psMetadataAlloc ();
     
    343343        psMetadataAdd (row, PS_LIST_TAIL, "Y_EXT_SIG",        PS_DATA_F32, "Sigma in EXT y coordinate",                  yErr);
    344344
    345         // Petrosian measurements
    346         // XXX insert header data: petrosian ref radius, flux ratio
    347         if (doPetrosian) {
    348             pmSourcePetrosianValues *petrosian = source->extpars->petrosian;
    349             if (petrosian) {
    350                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude",       petrosian->mag);
    351                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", petrosian->magErr);
    352                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          petrosian->rad);
    353                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    petrosian->radErr);
    354             } else {
    355                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude",       NAN);
    356                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", NAN);
    357                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          NAN);
    358                 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    NAN);
    359             }
    360         }
    361 
    362         // Kron measurements
    363         if (doKron) {
    364             pmSourceKronValues *kron = source->extpars->kron;
    365             if (kron) {
    366                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG",        PS_DATA_F32, "Kron Magnitude",       kron->mag);
    367                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", kron->magErr);
    368                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          kron->rad);
    369                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    kron->radErr);
    370             } else {
    371                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG",        PS_DATA_F32, "Kron Magnitude",       NAN);
    372                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", NAN);
    373                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          NAN);
    374                 psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    NAN);
    375             }
    376         }
    377 
    378         // Isophot measurements
    379         // XXX insert header data: isophotal level
    380         if (doIsophotal) {
    381             pmSourceIsophotalValues *isophot = source->extpars->isophot;
    382             if (isophot) {
    383                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG",        PS_DATA_F32, "Isophot Magnitude",       isophot->mag);
    384                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", isophot->magErr);
    385                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          isophot->rad);
    386                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    isophot->radErr);
    387             } else {
    388                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG",        PS_DATA_F32, "Isophot Magnitude",       NAN);
    389                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", NAN);
    390                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          NAN);
    391                 psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    NAN);
    392             }
    393         }
    394 
    395         // Flux Annuli
    396         if (doAnnuli) {
    397             pmSourceAnnuli *annuli = source->extpars->annuli;
    398             if (annuli) {
    399                 psVector *fluxVal = annuli->flux;
    400                 psVector *fluxErr = annuli->fluxErr;
    401                 psVector *fluxVar = annuli->fluxVar;
    402 
    403                 for (int j = 0; j < fluxVal->n; j++) {
    404                     char name[32];
    405                     sprintf (name, "FLUX_VAL_R_%02d", j);
    406                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", fluxVal->data.F32[j]);
    407                     sprintf (name, "FLUX_ERR_R_%02d", j);
    408                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", fluxErr->data.F32[j]);
    409                     sprintf (name, "FLUX_VAR_R_%02d", j);
    410                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", fluxVar->data.F32[j]);
    411                 }
    412             } else {
    413                 for (int j = 0; j < radialBinsLower->n; j++) {
    414                     char name[32];
    415                     sprintf (name, "FLUX_VAL_R_%02d", j);
    416                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", NAN);
    417                     sprintf (name, "FLUX_ERR_R_%02d", j);
    418                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", NAN);
    419                     sprintf (name, "FLUX_VAR_R_%02d", j);
    420                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", NAN);
    421                 }
    422             }
    423         }
    424 
    425         psArrayAdd (table, 100, row);
    426         psFree (row);
     345        // Petrosian measurements
     346        // XXX insert header data: petrosian ref radius, flux ratio
     347        if (doPetrosian) {
     348            pmSourcePetrosianValues *petrosian = source->extpars->petrosian;
     349            if (petrosian) {
     350                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude",       petrosian->mag);
     351                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", petrosian->magErr);
     352                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          petrosian->rad);
     353                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    petrosian->radErr);
     354            } else {
     355                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude",       NAN);
     356                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG_ERR",    PS_DATA_F32, "Petrosian Magnitude Error", NAN);
     357                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS",     PS_DATA_F32, "Petrosian Radius",          NAN);
     358                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_ERR", PS_DATA_F32, "Petrosian Radius Error",    NAN);
     359            }
     360        }
     361
     362        // Kron measurements
     363        if (doKron) {
     364            pmSourceKronValues *kron = source->extpars->kron;
     365            if (kron) {
     366                psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG",        PS_DATA_F32, "Kron Magnitude",       kron->mag);
     367                psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", kron->magErr);
     368                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          kron->rad);
     369                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    kron->radErr);
     370            } else {
     371                psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG",        PS_DATA_F32, "Kron Magnitude",       NAN);
     372                psMetadataAdd (row, PS_LIST_TAIL, "KRON_MAG_ERR",    PS_DATA_F32, "Kron Magnitude Error", NAN);
     373                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS",     PS_DATA_F32, "Kron Radius",          NAN);
     374                psMetadataAdd (row, PS_LIST_TAIL, "KRON_RADIUS_ERR", PS_DATA_F32, "Kron Radius Error",    NAN);
     375            }
     376        }
     377
     378        // Isophot measurements
     379        // XXX insert header data: isophotal level
     380        if (doIsophotal) {
     381            pmSourceIsophotalValues *isophot = source->extpars->isophot;
     382            if (isophot) {
     383                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG",        PS_DATA_F32, "Isophot Magnitude",       isophot->mag);
     384                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", isophot->magErr);
     385                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          isophot->rad);
     386                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    isophot->radErr);
     387            } else {
     388                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG",        PS_DATA_F32, "Isophot Magnitude",       NAN);
     389                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_MAG_ERR",    PS_DATA_F32, "Isophot Magnitude Error", NAN);
     390                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS",     PS_DATA_F32, "Isophot Radius",          NAN);
     391                psMetadataAdd (row, PS_LIST_TAIL, "ISOPHOT_RADIUS_ERR", PS_DATA_F32, "Isophot Radius Error",    NAN);
     392            }
     393        }
     394
     395        // Flux Annuli
     396        if (doAnnuli) {
     397            pmSourceAnnuli *annuli = source->extpars->annuli;
     398            if (annuli) {
     399                psVector *fluxVal = annuli->flux;
     400                psVector *fluxErr = annuli->fluxErr;
     401                psVector *fluxVar = annuli->fluxVar;
     402
     403                for (int j = 0; j < fluxVal->n; j++) {
     404                    char name[32];
     405                    sprintf (name, "FLUX_VAL_R_%02d", j);
     406                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", fluxVal->data.F32[j]);
     407                    sprintf (name, "FLUX_ERR_R_%02d", j);
     408                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", fluxErr->data.F32[j]);
     409                    sprintf (name, "FLUX_VAR_R_%02d", j);
     410                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", fluxVar->data.F32[j]);
     411                }
     412            } else {
     413                for (int j = 0; j < radialBinsLower->n; j++) {
     414                    char name[32];
     415                    sprintf (name, "FLUX_VAL_R_%02d", j);
     416                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux value in annulus", NAN);
     417                    sprintf (name, "FLUX_ERR_R_%02d", j);
     418                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux error in annulus", NAN);
     419                    sprintf (name, "FLUX_VAR_R_%02d", j);
     420                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "flux stdev in annulus", NAN);
     421                }
     422            }
     423        }
     424
     425        psArrayAdd (table, 100, row);
     426        psFree (row);
    427427    }
    428428
    429429    if (table->n == 0) {
    430         psFitsWriteBlank (fits, outhead, extname);
    431         psFree (outhead);
    432         psFree (table);
    433         return true;
     430        psFitsWriteBlank (fits, outhead, extname);
     431        psFree (outhead);
     432        psFree (table);
     433        return true;
    434434    }
    435435
    436436    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    437437    if (!psFitsWriteTable (fits, outhead, table, extname)) {
    438         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
    439         psFree (outhead);
    440         psFree(table);
    441         return false;
     438        psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
     439        psFree (outhead);
     440        psFree(table);
     441        return false;
    442442    }
    443443    psFree (outhead);
     
    470470    int nParamMax = 0;
    471471    for (int i = 0; i < sources->n; i++) {
    472         pmSource *source = sources->data[i];
    473         if (source->modelFits == NULL) continue;
    474         for (int j = 0; j < source->modelFits->n; j++) {
    475             pmModel *model = source->modelFits->data[j];
    476             assert (model);
    477             nParamMax = PS_MAX (nParamMax, model->params->n);
    478         }
     472        pmSource *source = sources->data[i];
     473        if (source->modelFits == NULL) continue;
     474        for (int j = 0; j < source->modelFits->n; j++) {
     475            pmModel *model = source->modelFits->data[j];
     476            assert (model);
     477            nParamMax = PS_MAX (nParamMax, model->params->n);
     478        }
    479479    }
    480480
     
    484484    for (int i = 0; i < sources->n; i++) {
    485485
    486         pmSource *source = sources->data[i];
    487 
    488         // XXX if no model fits are saved, write out modelEXT?
    489         if (source->modelFits == NULL) continue;
    490 
    491         // We have multiple sources : need to flag the one used to subtract the light (the 'best' model)
    492         for (int j = 0; j < source->modelFits->n; j++) {
    493 
    494             // choose the convolved EXT model, if available, otherwise the simple one
    495             pmModel *model = source->modelFits->data[j];
    496             assert (model);
    497 
    498             PAR = model->params->data.F32;
    499             dPAR = model->dparams->data.F32;
    500             xPos = PAR[PM_PAR_XPOS];
    501             yPos = PAR[PM_PAR_YPOS];
    502             xErr = dPAR[PM_PAR_XPOS];
    503             yErr = dPAR[PM_PAR_YPOS];
    504 
    505             axes = pmPSF_ModelToAxes (PAR, 20.0);
    506 
    507             row = psMetadataAlloc ();
    508 
    509             // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
    510             psMetadataAddU32 (row, PS_LIST_TAIL, "IPP_IDET",         0, "IPP detection identifier index",             source->seq);
    511             psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT",            0, "EXT model x coordinate",                     xPos);
    512             psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT",            0, "EXT model y coordinate",                     yPos);
    513             psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT_SIG",        0, "Sigma in EXT x coordinate",                  xErr);
    514             psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT_SIG",        0, "Sigma in EXT y coordinate",                  yErr);
    515             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG",     0, "EXT fit instrumental magnitude",             model->mag);
    516             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", 0, "Sigma of PSF instrumental magnitude",        model->magErr);
    517 
    518             psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
    519             psMetadataAddStr (row, PS_LIST_TAIL, "MODEL_TYPE",       0, "name of model",                              pmModelClassGetName (model->type));
    520 
    521             // XXX these should be major and minor, not 'x' and 'y'
    522             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ",    0, "EXT width in x coordinate",                  axes.major);
    523             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN",    0, "EXT width in y coordinate",                  axes.minor);
    524             psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA",        0, "EXT orientation angle",                      axes.theta);
    525 
    526             // write out the other generic parameters
    527             for (int k = 0; k < nParamMax; k++) {
    528                 if (k == PM_PAR_I0) continue;
    529                 if (k == PM_PAR_SKY) continue;
    530                 if (k == PM_PAR_XPOS) continue;
    531                 if (k == PM_PAR_YPOS) continue;
    532                 if (k == PM_PAR_SXX) continue;
    533                 if (k == PM_PAR_SXY) continue;
    534                 if (k == PM_PAR_SYY) continue;
    535 
    536                 snprintf (name, 64, "EXT_PAR_%02d", k);
    537 
    538                 if (k < model->params->n) {
    539                     psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "", model->params->data.F32[k]);
    540                 } else {
    541                     psMetadataAddF32 (row, PS_LIST_TAIL, name, PS_DATA_F32, "", NAN);
    542                 }
    543             }
    544 
    545             // XXX other parameters which may be set.
    546             // XXX flag / value to define the model
    547             // XXX write out the model type, fit status flags
    548 
    549             psArrayAdd (table, 100, row);
    550             psFree (row);
    551         }
     486        pmSource *source = sources->data[i];
     487
     488        // XXX if no model fits are saved, write out modelEXT?
     489        if (source->modelFits == NULL) continue;
     490
     491        // We have multiple sources : need to flag the one used to subtract the light (the 'best' model)
     492        for (int j = 0; j < source->modelFits->n; j++) {
     493
     494            // choose the convolved EXT model, if available, otherwise the simple one
     495            pmModel *model = source->modelFits->data[j];
     496            assert (model);
     497
     498            PAR = model->params->data.F32;
     499            dPAR = model->dparams->data.F32;
     500            xPos = PAR[PM_PAR_XPOS];
     501            yPos = PAR[PM_PAR_YPOS];
     502            xErr = dPAR[PM_PAR_XPOS];
     503            yErr = dPAR[PM_PAR_YPOS];
     504
     505            axes = pmPSF_ModelToAxes (PAR, 20.0);
     506
     507            row = psMetadataAlloc ();
     508
     509            // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
     510            psMetadataAddU32 (row, PS_LIST_TAIL, "IPP_IDET",         0, "IPP detection identifier index",             source->seq);
     511            psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT",            0, "EXT model x coordinate",                     xPos);
     512            psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT",            0, "EXT model y coordinate",                     yPos);
     513            psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT_SIG",        0, "Sigma in EXT x coordinate",                  xErr);
     514            psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT_SIG",        0, "Sigma in EXT y coordinate",                  yErr);
     515            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG",     0, "EXT fit instrumental magnitude",             model->mag);
     516            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_MAG_SIG", 0, "Sigma of PSF instrumental magnitude",        model->magErr);
     517
     518            psMetadataAddF32 (row, PS_LIST_TAIL, "NPARAMS",          0, "number of model parameters",                 model->params->n);
     519            psMetadataAddStr (row, PS_LIST_TAIL, "MODEL_TYPE",       0, "name of model",                              pmModelClassGetName (model->type));
     520
     521            // XXX these should be major and minor, not 'x' and 'y'
     522            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ",    0, "EXT width in x coordinate",                  axes.major);
     523            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN",    0, "EXT width in y coordinate",                  axes.minor);
     524            psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA",        0, "EXT orientation angle",                      axes.theta);
     525
     526            // write out the other generic parameters
     527            for (int k = 0; k < nParamMax; k++) {
     528                if (k == PM_PAR_I0) continue;
     529                if (k == PM_PAR_SKY) continue;
     530                if (k == PM_PAR_XPOS) continue;
     531                if (k == PM_PAR_YPOS) continue;
     532                if (k == PM_PAR_SXX) continue;
     533                if (k == PM_PAR_SXY) continue;
     534                if (k == PM_PAR_SYY) continue;
     535
     536                snprintf (name, 64, "EXT_PAR_%02d", k);
     537
     538                if (k < model->params->n) {
     539                    psMetadataAdd (row, PS_LIST_TAIL, name, PS_DATA_F32, "", model->params->data.F32[k]);
     540                } else {
     541                    psMetadataAddF32 (row, PS_LIST_TAIL, name, PS_DATA_F32, "", NAN);
     542                }
     543            }
     544
     545            // XXX other parameters which may be set.
     546            // XXX flag / value to define the model
     547            // XXX write out the model type, fit status flags
     548
     549            psArrayAdd (table, 100, row);
     550            psFree (row);
     551        }
    552552    }
    553553
    554554    if (table->n == 0) {
    555         psFitsWriteBlank (fits, outhead, extname);
    556         psFree (outhead);
    557         psFree (table);
    558         return true;
     555        psFitsWriteBlank (fits, outhead, extname);
     556        psFree (outhead);
     557        psFree (table);
     558        return true;
    559559    }
    560560
    561561    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    562562    if (!psFitsWriteTable (fits, outhead, table, extname)) {
    563         psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
    564         psFree (outhead);
    565         psFree(table);
    566         return false;
     563        psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
     564        psFree (outhead);
     565        psFree(table);
     566        return false;
    567567    }
    568568    psFree (outhead);
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourcePhotometry.c

    r21363 r21536  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2009-02-06 02:31:25 $
     5 *  @version $Revision: 1.49.4.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2009-02-19 17:59:50 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    145145    // measure the contribution of included pixels
    146146    if (mode & PM_SOURCE_PHOT_WEIGHT) {
    147         pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal);
     147        pmSourcePixelWeight (&source->pixWeight, model, source->maskObj, maskVal);
    148148    }
    149149
     
    164164    // XXX full model or just analytical?
    165165    // XXX use pmSourceAdd instead?
    166     if (source->mode & PM_SOURCE_MODE_SUBTRACTED) {
     166    if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) {
    167167        pmModelAdd (source->pixels, source->maskObj, model, PM_MODEL_OP_FULL, maskVal);
    168168    }
     
    170170    // if we are measuring aperture photometry and applying the growth correction,
    171171    // we need to shift the flux in the selected pixels (but not the mask)
    172     // psImageShift ();
    173172    psImage *flux = NULL, *mask = NULL; // Star flux and mask images, to photometer
    174173    if (mode & PM_SOURCE_PHOT_INTERP) {
     
    186185        }
    187186
    188         // XXX this is test code to verify the shift is doing the right thing (seems to be)
    189         # if (0)
    190             // measure centroid of unshifted gaussian (should be 16.0,16.0)
    191         {
    192             psImage *image = source->pixels;
    193             float xo = 0.0;
    194             float yo = 0.0;
    195             float xo2 = 0.0;
    196             float yo2 = 0.0;
    197             float no = 0.0;
    198             for (int j = 0; j < image->numRows; j++)
    199             {
    200                 for (int i = 0; i < image->numCols; i++) {
    201                     xo += i*image->data.F32[j][i];
    202                     yo += j*image->data.F32[j][i];
    203                     xo2 += i*i*image->data.F32[j][i];
    204                     yo2 += j*j*image->data.F32[j][i];
    205                     no += image->data.F32[j][i];
    206                 }
    207             }
    208             xo /= no;
    209             yo /= no;
    210             xo2 = sqrt (xo2/no - xo*xo);
    211             yo2 = sqrt (yo2/no - yo*yo);
    212             fprintf (stderr, "pre-shift centroid: %f,%f, sigma: %f,%f: flux: %f\n", xo, yo, xo2, yo2, no);
    213         }
    214 
    215         // measure centroid of unshifted gaussian (should be 16.0,16.0)
    216         {
    217             psImage *image = flux;
    218             float xo = 0.0;
    219             float yo = 0.0;
    220             float xo2 = 0.0;
    221             float yo2 = 0.0;
    222             float no = 0.0;
    223             for (int j = 0; j < image->numRows; j++)
    224             {
    225                 for (int i = 0; i < image->numCols; i++) {
    226                     xo += i*image->data.F32[j][i];
    227                     yo += j*image->data.F32[j][i];
    228                     xo2 += i*i*image->data.F32[j][i];
    229                     yo2 += j*j*image->data.F32[j][i];
    230                     no += image->data.F32[j][i];
    231                 }
    232             }
    233             xo /= no;
    234             yo /= no;
    235             xo2 = sqrt (xo2/no - xo*xo);
    236             yo2 = sqrt (yo2/no - yo*yo);
    237             fprintf (stderr, "pre-shift centroid: %f,%f, sigma: %f,%f: flux: %f\n", xo, yo, xo2, yo2, no);
    238         }
    239         # endif
    240 
    241187    } else {
    242188        flux = source->pixels;
     
    269215    // if source was originally subtracted, re-subtract object, leave local sky
    270216    // XXX replace with pmSourceSub...
    271     if (source->mode & PM_SOURCE_MODE_SUBTRACTED) {
     217    if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) {
    272218        pmModelSub (source->pixels, source->maskObj, model, PM_MODEL_OP_FULL, maskVal);
    273219    }
     
    344290
    345291// return source aperture magnitude
    346 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psImageMaskType maskVal)
     292bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *mask, psImageMaskType maskVal)
    347293{
    348294    PS_ASSERT_PTR_NON_NULL(pixWeight, false);
    349     PS_ASSERT_PTR_NON_NULL(image, false);
    350295    PS_ASSERT_PTR_NON_NULL(mask, false);
    351296    PS_ASSERT_PTR_NON_NULL(model, false);
     
    377322    Yo = params->data.F32[PM_PAR_YPOS];
    378323
    379     dX = Xo - image->col0;
    380     dP = image->numCols - dX;
     324    dX = Xo - mask->col0;
     325    dP = mask->numCols - dX;
    381326    DX = PS_MAX(dX, dP);
    382     NX = image->numCols;
    383 
    384     dY = Yo - image->row0;
    385     dP = image->numRows - dY;
     327    NX = mask->numCols;
     328
     329    dY = Yo - mask->row0;
     330    dP = mask->numRows - dY;
    386331    DY = PS_MAX(dY, dP);
    387     NY = image->numRows;
     332    NY = mask->numRows;
    388333
    389334    // measure modelSum and validSum.  this function is applied to a sources' subimage.  the
     
    612557# endif
    613558
     559// determine chisq, etc for linear normalization-only fit
    614560bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *variance,
    615561                    psImageMaskType maskVal)
     
    632578        }
    633579    }
     580    model->nPix = Npix;
    634581    model->nDOF = Npix - 1;
    635582    model->chisq = dC;
     
    817764}
    818765
     766// XXX this is test code to verify the shift is doing the right thing (seems to be)
     767# if (0)
     768// measure centroid of unshifted gaussian (should be 16.0,16.0)
     769        {
     770          psImage *image = source->pixels;
     771          float xo = 0.0;
     772          float yo = 0.0;
     773          float xo2 = 0.0;
     774          float yo2 = 0.0;
     775          float no = 0.0;
     776          for (int j = 0; j < image->numRows; j++)
     777          {
     778            for (int i = 0; i < image->numCols; i++) {
     779              xo += i*image->data.F32[j][i];
     780              yo += j*image->data.F32[j][i];
     781              xo2 += i*i*image->data.F32[j][i];
     782              yo2 += j*j*image->data.F32[j][i];
     783              no += image->data.F32[j][i];
     784            }
     785          }
     786          xo /= no;
     787          yo /= no;
     788          xo2 = sqrt (xo2/no - xo*xo);
     789          yo2 = sqrt (yo2/no - yo*yo);
     790          fprintf (stderr, "pre-shift centroid: %f,%f, sigma: %f,%f: flux: %f\n", xo, yo, xo2, yo2, no);
     791        }
     792
     793// measure centroid of unshifted gaussian (should be 16.0,16.0)
     794        {
     795          psImage *image = flux;
     796          float xo = 0.0;
     797          float yo = 0.0;
     798          float xo2 = 0.0;
     799          float yo2 = 0.0;
     800          float no = 0.0;
     801          for (int j = 0; j < image->numRows; j++)
     802          {
     803            for (int i = 0; i < image->numCols; i++) {
     804              xo += i*image->data.F32[j][i];
     805              yo += j*image->data.F32[j][i];
     806              xo2 += i*i*image->data.F32[j][i];
     807              yo2 += j*j*image->data.F32[j][i];
     808              no += image->data.F32[j][i];
     809            }
     810          }
     811          xo /= no;
     812          yo /= no;
     813          xo2 = sqrt (xo2/no - xo*xo);
     814          yo2 = sqrt (yo2/no - yo*yo);
     815          fprintf (stderr, "pre-shift centroid: %f,%f, sigma: %f,%f: flux: %f\n", xo, yo, xo2, yo2, no);
     816        }
     817# endif
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourcePhotometry.h

    r21183 r21536  
    44 * @author EAM, IfA; GLG, MHPCC
    55 *
    6  * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2009-01-27 06:39:38 $
     6 * @version $Revision: 1.12.8.1 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2009-02-19 17:59:50 $
    88 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    99 */
     
    4646    psImage *image,                     ///< image pixels to be used
    4747    psImage *mask,                      ///< mask of pixels to ignore
    48     psImageMaskType maskVal             ///< Value to mask
     48    psImageMaskType maskVal             ///< Value to mask
    4949);
    5050
    5151bool pmSourceMagnitudesInit (psMetadata *config);
    5252bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal);
    53 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psImageMaskType maskVal);
     53bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *mask, psImageMaskType maskVal);
    5454bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psImageMaskType maskVal);
    5555
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.c

    r21183 r21536  
    99# if (HAVE_KAPA)
    1010# include <kapa.h>
     11#include "pmVisual.h"
    1112
    1213// functions used to visualize the analysis as it goes
    1314// these are invoked by the -visual options
    1415
    15 static bool isVisual = false;
    1616static int kapa1 = -1;
    1717// static int kapa2 = -1;
     
    2020bool pmSourcePlotPoints3D (int myKapa, Graphdata *graphdata, psVector *xn, psVector *yn, psVector *zn, float theta, float phi);
    2121
    22 bool pmSourceSetVisual (bool mode) {
    23 
    24     isVisual = mode;
    25     return true;
    26 }
    2722
    2823bool pmSourceVisualPSFModelResid (pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask) {
    2924
    30     KapaSection section;  // put the positive profile in one and the residuals in another? 
     25    KapaSection section;  // put the positive profile in one and the residuals in another?
    3126
    3227    Graphdata graphdata;
    3328
    34     if (!isVisual) return true;
     29    if (!pmVisualIsVisual()) return true;
    3530
    3631    if (kapa1 == -1) {
    3732        kapa1 = KapaOpenNamedSocket ("kapa", "pmSource:plots");
    38         if (kapa1 == -1) {
    39             fprintf (stderr, "failure to open kapa; visual mode disabled\n");
    40             isVisual = false;
    41             return false;
    42         }
    43     } 
     33        if (kapa1 == -1) {
     34            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
     35            pmVisualSetVisual(false);
     36            return false;
     37        }
     38    }
    4439
    4540    KapaClearPlots (kapa1);
     
    5550
    5651    for (int i = 0; i < x->n; i++) {
    57         model->data.F32[i] = pmTrend2DEval (trend, x->data.F32[i], y->data.F32[i]);
    58         resid->data.F32[i] = param->data.F32[i] - model->data.F32[i];
    59         if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue;
    60         min = PS_MIN (min, resid->data.F32[i]);
    61         max = PS_MAX (max, resid->data.F32[i]);
    62         Min = PS_MIN (min, param->data.F32[i]);
    63         Max = PS_MAX (max, param->data.F32[i]);
     52        model->data.F32[i] = pmTrend2DEval (trend, x->data.F32[i], y->data.F32[i]);
     53        resid->data.F32[i] = param->data.F32[i] - model->data.F32[i];
     54        if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i]) continue;
     55        min = PS_MIN (min, resid->data.F32[i]);
     56        max = PS_MAX (max, resid->data.F32[i]);
     57        Min = PS_MIN (min, param->data.F32[i]);
     58        Max = PS_MAX (max, param->data.F32[i]);
    6459    }
    6560
     
    7065    psVector *Fn = psVectorAlloc (x->n, PS_TYPE_F32);
    7166    for (int i = 0; i < x->n; i++) {
    72         xn->data.F32[i] = x->data.F32[i] / 5000.0;
    73         yn->data.F32[i] = y->data.F32[i] / 5000.0;
    74         zn->data.F32[i] = (resid->data.F32[i] - min) / (max - min);
    75         Zn->data.F32[i] = (param->data.F32[i] - Min) / (Max - Min);
    76         Fn->data.F32[i] = (model->data.F32[i] - Min) / (Max - Min);
     67        xn->data.F32[i] = x->data.F32[i] / 5000.0;
     68        yn->data.F32[i] = y->data.F32[i] / 5000.0;
     69        zn->data.F32[i] = (resid->data.F32[i] - min) / (max - min);
     70        Zn->data.F32[i] = (param->data.F32[i] - Min) / (Max - Min);
     71        Fn->data.F32[i] = (model->data.F32[i] - Min) / (Max - Min);
    7772    }
    7873
     
    155150    fprintf (stdout, "[c]ontinue? ");
    156151    if (!fgets(key, 8, stdin)) {
    157         psWarning("Unable to read option");
     152        psWarning("Unable to read option");
    158153    }
    159154    return true;
     
    173168
    174169    for (int i = 0; i < xn->n; i++) {
    175         xv->data.F32[2*i+0] = +xn->data.F32[i]*cos(theta) + yn->data.F32[i]*sin(theta)*cos(phi) + zn->data.F32[i]*sin(theta)*sin(phi);
    176         yv->data.F32[2*i+0] = -xn->data.F32[i]*sin(theta) + yn->data.F32[i]*cos(theta)*cos(phi) + zn->data.F32[i]*cos(theta)*sin(phi);
    177         zv->data.F32[2*i+0] = -yn->data.F32[i]*sin(phi)   + zn->data.F32[i]*cos(phi);
    178         xv->data.F32[2*i+1] = +xn->data.F32[i]*cos(theta) + yn->data.F32[i]*sin(theta)*cos(phi);
    179         yv->data.F32[2*i+1] = -xn->data.F32[i]*sin(theta) + yn->data.F32[i]*cos(theta)*cos(phi);
    180         zv->data.F32[2*i+1] = -yn->data.F32[i]*sin(phi);
    181         graphdata->xmin = PS_MIN(graphdata->xmin, xv->data.F32[2*i+0]);
    182         graphdata->xmax = PS_MAX(graphdata->xmax, xv->data.F32[2*i+0]);
    183         graphdata->ymin = PS_MIN(graphdata->ymin, zv->data.F32[2*i+0]);
    184         graphdata->ymax = PS_MAX(graphdata->ymax, zv->data.F32[2*i+0]);
    185         graphdata->xmin = PS_MIN(graphdata->xmin, xv->data.F32[2*i+1]);
    186         graphdata->xmax = PS_MAX(graphdata->xmax, xv->data.F32[2*i+1]);
    187         graphdata->ymin = PS_MIN(graphdata->ymin, zv->data.F32[2*i+1]);
    188         graphdata->ymax = PS_MAX(graphdata->ymax, zv->data.F32[2*i+1]);
     170        xv->data.F32[2*i+0] = +xn->data.F32[i]*cos(theta) + yn->data.F32[i]*sin(theta)*cos(phi) + zn->data.F32[i]*sin(theta)*sin(phi);
     171        yv->data.F32[2*i+0] = -xn->data.F32[i]*sin(theta) + yn->data.F32[i]*cos(theta)*cos(phi) + zn->data.F32[i]*cos(theta)*sin(phi);
     172        zv->data.F32[2*i+0] = -yn->data.F32[i]*sin(phi)   + zn->data.F32[i]*cos(phi);
     173        xv->data.F32[2*i+1] = +xn->data.F32[i]*cos(theta) + yn->data.F32[i]*sin(theta)*cos(phi);
     174        yv->data.F32[2*i+1] = -xn->data.F32[i]*sin(theta) + yn->data.F32[i]*cos(theta)*cos(phi);
     175        zv->data.F32[2*i+1] = -yn->data.F32[i]*sin(phi);
     176        graphdata->xmin = PS_MIN(graphdata->xmin, xv->data.F32[2*i+0]);
     177        graphdata->xmax = PS_MAX(graphdata->xmax, xv->data.F32[2*i+0]);
     178        graphdata->ymin = PS_MIN(graphdata->ymin, zv->data.F32[2*i+0]);
     179        graphdata->ymax = PS_MAX(graphdata->ymax, zv->data.F32[2*i+0]);
     180        graphdata->xmin = PS_MIN(graphdata->xmin, xv->data.F32[2*i+1]);
     181        graphdata->xmax = PS_MAX(graphdata->xmax, xv->data.F32[2*i+1]);
     182        graphdata->ymin = PS_MIN(graphdata->ymin, zv->data.F32[2*i+1]);
     183        graphdata->ymax = PS_MAX(graphdata->ymax, zv->data.F32[2*i+1]);
    189184    }
    190185    xv->n = xn->n;
  • branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.h

    r20582 r21536  
    11/* @file  pmKapaPlots.h
    2  * @brief functions to make plots with the external program 'kapa' 
     2 * @brief functions to make plots with the external program 'kapa'
    33 *
    44 * @author EAM, IfA
    55 *
    6  * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2008-11-08 01:52:34 $
     6 * @version $Revision: 1.1.16.1 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2009-02-19 17:59:50 $
    88 * Copyright 2006 Institute for Astronomy, University of Hawaii
    99 */
     
    1515/// @{
    1616
    17 bool pmSourceSetVisual (bool mode);
    1817bool pmSourceVisualPSFModelResid (pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask);
    1918
Note: See TracChangeset for help on using the changeset viewer.