IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20478


Ignore:
Timestamp:
Oct 30, 2008, 1:22:53 PM (18 years ago)
Author:
beaumont
Message:

Completed 'first pass' of psastro visualizations

Location:
branches/cnb_branch_20081011
Files:
3 edited

Legend:

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

    r20443 r20478  
    2525# include <kapa.h>
    2626
    27 # define KAPAX 800
    28 # define KAPAY 800
     27# define KAPAX 700
     28# define KAPAY 700
    2929
    3030
    3131//variables to determine when things are plotted
    3232static bool isVisual             = false;
    33 static bool plotGridMatch        = false;
     33static bool plotGridMatch        = true;
    3434static bool plotTweak            = true;
    3535
     
    266266 * of these two profiles and adjusts the offset accordingly. This procedure plots the profiles.
    267267 */
    268 bool pmAstromVisualPlotTweak (psVector *xHist, psVector *yHist, int xBin, int yBin)
     268bool pmAstromVisualPlotTweak (psVector *xHist, ///< Smoothed Horizontal cut through the histogram
     269                              psVector *yHist, ///< Smoothed Vertical cut throug the histogram
     270                              int xBin,        ///< X Bin index of the histogram peak
     271                              int yBin         ///< Y bin index of the histogram peak
     272    )
    269273{
    270274    //make sure we want to plot this
     
    294298
    295299    // plot the X histogram
    296     pmAstromVisualScaleGraphdata(&graphdata, xIndices, xHistNew, false);
     300    pmAstromVisualScaleGraphdata(&graphdata, xIndices, xHist, false);
    297301    KapaSetSection(kapa, &section1);
    298302    KapaSetLimits (kapa, &graphdata);
     
    321325
    322326    //plot the Y histogram
    323     pmAstromVisualScaleGraphdata(&graphdata, yIndices, yHistNew, false);
     327    pmAstromVisualScaleGraphdata(&graphdata, yIndices, yHist, false);
    324328    KapaSetSection(kapa, &section2);
    325329    KapaSetLimits (kapa, &graphdata);
    326330    KapaSetFont(kapa, "helvetica", 14);
     331    graphdata.color = KapaColorByName ("black");
    327332    KapaBox(kapa, &graphdata);
    328333    KapaSendLabel (kapa, "Y offset Bin", KAPA_LABEL_XM);
     
    333338    graphdata.ptype = 0;
    334339    graphdata.size = 0.4;
    335     graphdata.color = KapaColorByName ("black");
    336340
    337341    KapaPrepPlot (kapa, yHist->n, &graphdata);
  • branches/cnb_branch_20081011/psastro/src/psastroUtils.c

    r20443 r20478  
    7777            }
    7878        }
    79 
    8079    }
    8180    psastroMosaicSetAstrom (fpa);
  • branches/cnb_branch_20081011/psastro/src/psastroVisual.c

    r20443 r20478  
    1414# include <kapa.h>
    1515
    16 # define KAPAX  800
    17 # define KAPAY  800
     16# define KAPAX  700
     17# define KAPAY  700
    1818
    1919//variables to determine when things are plotted
    2020static bool isVisual             = false;
    21 static bool plotRawStars         = false;
     21static bool plotRawStars         = true;
    2222static bool plotRefStars         = false;
    23 static bool plotLumFunc          = false;
    24 static bool plotRemoveClumps     = false;
    25 static bool plotOneChipFit       = false;
     23static bool plotLumFunc          = true;
     24static bool plotRemoveClumps     = true;
     25static bool plotOneChipFit       = true;
    2626static bool plotFixChips         = true;
    27 static bool plotAstromGuessCheck = false;
    28 static bool plotMosaicMatches    = false;
     27static bool plotAstromGuessCheck = true;
     28static bool plotMosaicMatches    = true;
    2929static bool plotCommonScale      = true;
    30 static bool plotMosaicOneChip    = false;
     30static bool plotMosaicOneChip    = true;
    3131
    3232// variables to store plotting window indices
     
    3737bool psastroVisualInitGraph (int kapa, KapaSection *section, Graphdata *graphdata);
    3838bool psastroVisualTriplePlot (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec, psVector *zVec, bool increasing);
    39 bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec);
     39bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec, bool clip);
    4040bool psastroVisualTripleOverplot (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec, psVector *zVec, bool increasing);
    4141bool psastroVisualCreateScaleVec (psVector *zVec, psVector *zScale, bool increasing);
     
    8181    if (key[0] == 'a') {
    8282        psastroSetVisual(false);
     83        pmAstromSetVisual(false);
    8384    }
    8485    return true;
     
    101102
    102103
    103 /**  psastroVisualPlotRawStars
     104/**
    104105 * Plot raw stars as determined from first pass astrometry fit
    105106 * Called within psastroAstromGeuss
     
    269270
    270271
    271 /** psastroVisualPlotRefStars
     272/**
    272273 * plot the location of references stars over the entire fpa
    273274 * invoked during psastroChooseRefStars
     
    277278    //make sure we want to plot this
    278279    if (!isVisual || !plotRefStars) return true;
    279     Graphdata graphdata;
    280280
    281281    //set up plotting variables
     
    283283        return false;
    284284
     285    Graphdata graphdata;
    285286    KapaInitGraph (&graphdata);
    286287    KapaClearSections (kapa);
     
    333334
    334335
    335 /** psastroVisualPlotLuminosityFunction
     336/**
    336337 * Plot the two luminosity functions created within psastroRefStarSubset
    337338 * The luminosity functions are used to select a subset of reference stars,
    338339 * so we plot the cutoff that defines this subset
    339340 */
    340 bool psastroVisualPlotLuminosityFunction (psVector *lnMag, psVector *Mag,
    341                                           pmLumFunc *lumFunc, pmLumFunc *rawFunc) {
     341bool psastroVisualPlotLuminosityFunction (psVector *lnMag,   ///< Log(n) for each magnitude bin
     342                                          psVector *Mag,     ///< magnitude bins
     343                                          pmLumFunc *lumFunc,///< Fit to the reference star luminosity function
     344                                          pmLumFunc *rawFunc ///< Fit to the raw star luminoisty function
     345                                          )
     346{
    342347
    343348    // make sure we want to plot this
     
    361366
    362367    //Determine Plot Limits
    363     psastroVisualScaleGraphdata(&graphdata, Mag, lnMag);
     368    psastroVisualScaleGraphdata(&graphdata, Mag, lnMag, false);
    364369
    365370    //Make a line for the fit
     
    422427
    423428
    424 /** psastroVisualPlotRemoveClumps
     429/**
    425430 * Plot the stars in a region, and indicate which stars are part of 'clumps'
    426431 * These stars are flagged during astrometric fitting, since dense regions are
    427432 * harder to cross-match than sparse ones. Called during psastroRemoveClumps.
    428433 */
    429 bool psastroVisualPlotRemoveClumps (psArray *input, psImage *count, int scale, float limit) {
     434bool psastroVisualPlotRemoveClumps (psArray *input, ///< Array containing the field stars
     435                                    psImage *count, ///< A 2D histogram of the field star distribution
     436                                    int scale,      ///< The pixel size of the histogram
     437                                    float limit     ///< The minimum numuber of stars in a bin flagged as a clump
     438                                    )
     439{
    430440
    431441    //make sure we want to plot this
     
    524534
    525535
    526 /** psastroVisualPlotOneChipFit
    527  * assess the goodness of fit for a signle chip by
     536/**
     537 * Assess the goodness of fit for a signle chip by
    528538 * plotting the fit residuals
    529539 * invoked during psastroOneChipFit
    530540 */
    531 bool psastroVisualPlotOneChipFit (psArray *rawstars, psArray *refstars, psArray *match, psMetadata *recipe) {
     541bool psastroVisualPlotOneChipFit (psArray *rawstars, ///< stars detected in the image
     542                                  psArray *refstars, ///< reference stars over the same region
     543                                  psArray *match,    ///< contains which rawstars match to which refstars
     544                                  psMetadata *recipe ///< data reduction recipe
     545                                  )
     546{
    532547
    533548    //make sure we want to plot this
     
    545560
    546561
    547 /** Plots the chip corners in the FP before and after chips with inconsistent solutions have been fixed.
     562/**
     563 * Plots the chip corners in the FP before and after chips with inconsistent solutions have been fixed.
    548564 * Invoked during psastroFixChips
    549565 */
    550566bool psastroVisualPlotFixChips (pmFPAfile *input, ///< focal plane array file
    551                             psVector *xOld, ///< old X location of chip cornerss
    552                             psVector *yOld ///< old Y location of chip corners
    553     )
     567                                psVector *xOld, ///< old X location of chip cornerss
     568                                psVector *yOld ///< old Y location of chip corners
     569                                )
    554570{
    555571    //make sure we want to plot this
     
    565581    graphdata.style = 2;
    566582
    567     psVector *xNew = psVectorAllocEmpty (xOld->n, PS_TYPE_F32);
    568     psVector *yNew = psVectorAllocEmpty (yOld->n, PS_TYPE_F32);
     583    psVector *xNew = psVectorAlloc (xOld->n, PS_TYPE_F32);
     584    psVector *yNew = psVectorAlloc (yOld->n, PS_TYPE_F32);
    569585
    570586    // copy of the code in psastroFixChips that generated xOld, yOld, but for xNew, yNew
     
    607623
    608624    //set up graph
    609     psastroVisualScaleGraphdata(&graphdata, xOld, yOld);
     625    psastroVisualScaleGraphdata(&graphdata, xOld, yOld, true);
    610626    psastroVisualInitGraph(kapa, &section, &graphdata);
    611627    KapaSendLabel (kapa, "L (FP)", KAPA_LABEL_XM);
     
    637653 *  old to new coordinates
    638654 */
    639 bool psastroVisualPlotAstromGuessCheck (psVector *cornerPo, psVector *cornerQo,
    640                                         psVector *cornerPn, psVector *cornerQn,
    641                                         psVector *cornerPd, psVector *cornerQd) {
     655bool psastroVisualPlotAstromGuessCheck (psVector *cornerPo, ///< P coordinates of chip corners before fitting
     656                                        psVector *cornerQo, ///< Q coordinates of chip corners before fitting
     657                                        psVector *cornerPn, ///< P coordinates of chip corners after fitting
     658                                        psVector *cornerQn, ///< Q coordinates of chip corners after fitting
     659                                        psVector *cornerPd, ///< P coordinate residuals of fit from old to new coordinates
     660                                        psVector *cornerQd  ///< Q coordinate residuals of fit from old to new coordinates
     661                                        )
     662{
    642663
    643664    //make sure we want to plot this
     
    668689    psFree(section.name);
    669690
    670     psastroVisualScaleGraphdata (&graphdata, cornerPo, cornerPo);
     691    psastroVisualScaleGraphdata (&graphdata, cornerPo, cornerPo, true);
    671692    KapaSetLimits (kapa, &graphdata);
    672693    KapaBox (kapa, &graphdata);
     
    705726    psFree(section.name);
    706727
    707     psastroVisualScaleGraphdata (&graphdata, xResid, yResid);
     728    psastroVisualScaleGraphdata (&graphdata, xResid, yResid, true);
    708729    KapaSetLimits (kapa, &graphdata);
    709730    KapaBox (kapa, &graphdata);
     
    723744}
    724745
    725 /** psastroVisualPlotCommonScale (fpa, oldScale, newScale)
     746
     747/**
    726748 * Plots the pixel scales of the fpa before they are
    727749 * equalized in psastroMosaicCommonScale
    728750 */
    729 
    730751bool psastroVisualPlotCommonScale (pmFPA *fpa,         ///< the fpa
    731                               psVector *oldScale) ///< the old pixel scale of each chip in the fpa
     752                                   psVector *oldScale  ///< the old pixel scale of each chip in the fpa
     753                                   )
    732754{
    733755    //make sure we want to plot this
     
    741763    ptCH.x = 0;
    742764    ptCH.y = 0;
    743     psVector *xVec = psVectorAllocEmpty (oldScale->n, PS_TYPE_F32);
    744     psVector *yVec = psVectorAllocEmpty (oldScale->n, PS_TYPE_F32);
     765    psVector *xVec = psVectorAlloc (oldScale->n, PS_TYPE_F32);
     766    psVector *yVec = psVectorAlloc (oldScale->n, PS_TYPE_F32);
     767
    745768    int nobj = 0;
    746769
     
    761784    KapaClearPlots (kapa);
    762785    KapaSetSection (kapa, &section);
    763     psastroVisualInitGraph(kapa, &section, &graphdata);
     786    KapaSetFont (kapa, "helvetica", 14);
    764787    psastroVisualTriplePlot (kapa, &graphdata, xVec, yVec, oldScale, false);
    765788    KapaSendLabel (kapa, "L (FP)", KAPA_LABEL_XM);
     
    773796
    774797/**
    775  * psastroVisualPlotMosaicOneChip (rawstars, refstars, match);
    776798 *   plot the residuals between raw stars and ref stars after
    777799 *   fitting in psastroMosaicOneChip
     
    820842/*********************/
    821843
     844
    822845/** psastroVisualInitGraph (kapa, *section, *graphdata)
    823846 * Initializes graph, sets the section, sets the font,
    824847 * sets the limits, draws the box
    825848 */
    826 
    827849bool psastroVisualInitGraph (int kapa, KapaSection *section, Graphdata *graphdata)
    828850{
     
    834856}
    835857
     858
    836859/** psastroVisualTriplePlot
    837860 * plot 2 vectors whose point sizes are scaled by a third vector
     
    840863bool psastroVisualTriplePlot (int kapid, Graphdata *graphdata, psVector *xVec, psVector *yVec, psVector *zVec, bool increasing)
    841864{
    842     psastroVisualScaleGraphdata (graphdata, xVec, yVec);
     865    psastroVisualScaleGraphdata (graphdata, xVec, yVec, true);
    843866    //printf("%f %f %f %f \n",graphdata->xmin, graphdata->xmax, graphdata->ymin, graphdata->ymax);
    844867    // set the scale vector
     
    851874
    852875    // the point size will be scaled from the z vector
     876    graphdata->ptype = 7;
     877    graphdata->style = 2;
    853878    graphdata->size = -1;
    854879    KapaPrepPlot (kapid, xVec->n, graphdata);
     
    916941 * prevent outliers from making te plot region too big.
    917942 */
    918 bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec) {
     943bool psastroVisualScaleGraphdata(Graphdata *graphdata, psVector *xVec, psVector *yVec, bool clip) {
    919944
    920945    graphdata->xmin = +FLT_MAX;
     
    929954    psVectorStats (statsY, yVec, NULL, NULL, 0);
    930955
    931     float xhi  = statsX->sampleMedian + 3 *statsX->sampleStdev;
    932     float xlo = statsX->sampleMedian - 3 *statsX->sampleStdev;
    933     float yhi = statsY->sampleMedian + 3 *statsY->sampleStdev;
    934     float ylo = statsY->sampleMedian - 3 *statsY->sampleStdev;
     956    float xhi = +FLT_MAX, xlo = -FLT_MAX, yhi = +FLT_MAX, ylo = -FLT_MAX;
     957    if (clip) {
     958        xhi  = statsX->sampleMedian + 3 *statsX->sampleStdev;
     959        xlo = statsX->sampleMedian - 3 *statsX->sampleStdev;
     960        yhi = statsY->sampleMedian + 3 *statsY->sampleStdev;
     961        ylo = statsY->sampleMedian - 3 *statsY->sampleStdev;
     962    }
    935963
    936964    // abort if there is no good data
     
    12201248    float xmax = graphdata.xmax;
    12211249    float ymax = graphdata.ymax;
    1222     psastroVisualScaleGraphdata(&graphdata, xVec, yVec);
     1250    psastroVisualScaleGraphdata(&graphdata, xVec, yVec, true);
    12231251    graphdata.xmin = PS_MIN(xmin, graphdata.xmin);
    12241252    graphdata.ymin = PS_MIN(ymin, graphdata.ymin);
     
    12601288    return true;
    12611289}
     1290
     1291// END OF PROGRAM
    12621292#else
    12631293
Note: See TracChangeset for help on using the changeset viewer.