IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19916


Ignore:
Timestamp:
Oct 6, 2008, 3:18:11 AM (18 years ago)
Author:
eugene
Message:

clean up the APIs, generate radial plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotVisual.c

    r19888 r19916  
    11# include "psphotInternal.h"
    2 bool psphotVisualPlotMoments (pmConfig *config, const pmFPAview *view, psArray *sources);
    32
    43// this function displays representative images as the psphot analysis progresses:
     
    8887}
    8988
    90 bool psphotVisualShowImage (pmConfig *config, pmReadout *readout) {
     89bool psphotVisualShowImage (pmReadout *readout) {
    9190
    9291    if (!isVisual) return true;
     
    178177}
    179178
    180 bool psphotVisualShowPeaks (pmConfig *config, const pmFPAview *view, pmDetections *detections) {
     179bool psphotVisualShowPeaks (pmDetections *detections) {
    181180
    182181    int Noverlay;
     
    256255}
    257256
    258 // XXX this is just wrong: outlines entire image
    259 bool psphotVisualShowFootprints (pmConfig *config, const pmFPAview *view, pmDetections *detections) {
     257bool psphotVisualShowFootprints (pmDetections *detections) {
    260258
    261259    int Noverlay;
     
    371369}
    372370
    373 bool psphotVisualShowMoments (pmConfig *config, const pmFPAview *view, psArray *sources) {
     371bool psphotVisualShowMoments (psArray *sources) {
    374372
    375373    int Noverlay;
     
    429427}
    430428
    431 bool psphotVisualPlotMoments (pmConfig *config, const pmFPAview *view, psArray *sources) {
     429bool psphotVisualPlotMoments (psMetadata *recipe, psArray *sources) {
    432430
    433431    bool status;
     
    445443    } 
    446444
    447     // select the current recipe
    448     psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
    449     if (!recipe) {
    450         fprintf (stderr, "missing recipe, skipping moments plot\n");
    451         return false;
    452     }
    453 
    454445    KapaClearPlots (kapa3);
    455446    KapaInitGraph (&graphdata);
    456447
    457     float psfX  = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.X");
    458     float psfY  = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.Y");
    459     float psfdX = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.DX");
    460     float psfdY = psMetadataLookupF32 (&status, recipe, "PSF.CLUMP.DY");
    461     float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA");
    462     float Rx = psfdX * PSF_CLUMP_NSIGMA;
    463     float Ry = psfdY * PSF_CLUMP_NSIGMA;
     448    // there are N regions: use the first (guaranteed to exist) to get the overall limits
     449    psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, "PSF.CLUMP.REGION.000");
     450   
     451    float psfX  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X");
     452    float psfY  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y");
    464453
    465454    // examine sources to set data range
     
    522511    KapaPlotVector (kapa3, nB, yBright->data.F32, "y");
    523512
    524     // draw a circle centered on psfX,Y with size of the psf limit
    525     psVector *xLimit  = psVectorAlloc (120, PS_TYPE_F32);
    526     psVector *yLimit  = psVectorAlloc (120, PS_TYPE_F32);
    527     for (int i = 0; i < xLimit->n; i++) {
    528         xLimit->data.F32[i] = Rx*cos(i*2.0*M_PI/120.0) + psfX;
    529         yLimit->data.F32[i] = Ry*sin(i*2.0*M_PI/120.0) + psfY;
    530     }
    531     graphdata.color = KapaColorByName ("blue");
    532     graphdata.style = 0;
    533     KapaPrepPlot (kapa3, xLimit->n, &graphdata);
    534     KapaPlotVector (kapa3, xLimit->n, xLimit->data.F32, "x");
    535     KapaPlotVector (kapa3, yLimit->n, yLimit->data.F32, "y");
    536     psFree (xLimit);
    537     psFree (yLimit);
     513    // XXX draw N circles to outline the clumps
     514    {
     515        // draw a circle centered on psfX,Y with size of the psf limit
     516        psVector *xLimit  = psVectorAlloc (120, PS_TYPE_F32);
     517        psVector *yLimit  = psVectorAlloc (120, PS_TYPE_F32);
     518
     519        int nRegions = psMetadataLookupS32 (&status, recipe, "PSF.CLUMP.NREGIONS");
     520        float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA");
     521
     522        graphdata.color = KapaColorByName ("blue");
     523        graphdata.style = 0;
     524
     525        for (int n = 0; n < nRegions; n++) {
     526
     527            char regionName[64];
     528            snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", n);
     529            psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, regionName);
     530   
     531            float psfX  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X");
     532            float psfY  = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y");
     533            float psfdX = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DX");
     534            float psfdY = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DY");
     535            float Rx = psfdX * PSF_CLUMP_NSIGMA;
     536            float Ry = psfdY * PSF_CLUMP_NSIGMA;
     537
     538            for (int i = 0; i < xLimit->n; i++) {
     539                xLimit->data.F32[i] = Rx*cos(i*2.0*M_PI/120.0) + psfX;
     540                yLimit->data.F32[i] = Ry*sin(i*2.0*M_PI/120.0) + psfY;
     541            }
     542            KapaPrepPlot (kapa3, xLimit->n, &graphdata);
     543            KapaPlotVector (kapa3, xLimit->n, xLimit->data.F32, "x");
     544            KapaPlotVector (kapa3, yLimit->n, yLimit->data.F32, "y");
     545        }
     546        psFree (xLimit);
     547        psFree (yLimit);
     548    }
    538549
    539550# if (0)
     
    589600
    590601// assumes 'kapa' value is checked and set
    591 bool psphotVisualShowRoughClass_Single (pmConfig *config, const pmFPAview *view, psArray *sources, pmSourceType type, pmSourceMode mode, char *color) {
     602bool psphotVisualShowRoughClass_Single (psArray *sources, pmSourceType type, pmSourceMode mode, char *color) {
    592603
    593604    int Noverlay;
     
    635646}
    636647
    637 bool psphotVisualShowRoughClass (pmConfig *config, const pmFPAview *view, psArray *sources) {
    638 
    639     psphotVisualPlotMoments (config, view, sources);
     648bool psphotVisualShowRoughClass (psArray *sources) {
    640649
    641650    if (!isVisual) return true;
     
    648657    KiiEraseOverlay (kapa, "yellow"); // moments
    649658
    650     psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_STAR, 0, "red");
    651     psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_EXTENDED, 0, "blue");
    652     psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_DEFECT, 0, "blue");
    653     psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_SATURATED, 0, "red");
    654     psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_PSFSTAR, "yellow");
    655     psphotVisualShowRoughClass_Single (config, view, sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_SATSTAR, "green");
     659    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_STAR, 0, "red");
     660    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_EXTENDED, 0, "blue");
     661    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_DEFECT, 0, "blue");
     662    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_SATURATED, 0, "red");
     663    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_PSFSTAR, "yellow");
     664    psphotVisualShowRoughClass_Single (sources, PM_SOURCE_TYPE_STAR, PM_SOURCE_MODE_SATSTAR, "green");
    656665
    657666    // pause and wait for user input:
     
    666675}
    667676
    668 bool psphotVisualShowPSFStars (pmConfig *config, const pmFPAview *view, pmPSF *psf, psArray *sources) {
    669 
    670     bool status;
     677bool psphotVisualShowPSFModel (pmReadout *readout, pmPSF *psf) {
    671678
    672679    if (!isVisual) return true;
     
    681688    } 
    682689
    683     // select the current recipe
    684     psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
    685     if (!recipe) {
    686         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
    687         return false;
    688     }
     690    int DX = 64;
     691    int DY = 64;
     692
     693    psImage *psfMosaic = psImageAlloc (3*DX, 3*DY, PS_TYPE_F32);
     694    psImageInit (psfMosaic, 0.0);
     695   
     696    pmModel *modelRef = pmModelAlloc(psf->type);
     697
     698    // generate a fake model at each of the 3x3 image grid positions
     699    for (int x = -1; x <= +1; x ++) {
     700        for (int y = -1; y <= +1; y ++) {
     701            // use the center of the center pixel of the image
     702            float xc = (0.5 + 0.45*x)*readout->image->numCols + readout->image->col0;
     703            float yc = (0.5 + 0.45*y)*readout->image->numRows + readout->image->row0;
     704
     705            // assign the x and y coords to the image center
     706            // create an object with center intensity of 1000
     707            modelRef->params->data.F32[PM_PAR_SKY] = 0;
     708            modelRef->params->data.F32[PM_PAR_I0] = 1000;
     709            modelRef->params->data.F32[PM_PAR_XPOS] = xc;
     710            modelRef->params->data.F32[PM_PAR_YPOS] = yc;
     711   
     712            // create modelPSF from this model
     713            pmModel *model = pmModelFromPSF (modelRef, psf);
     714
     715            // place the reference object in the image center
     716            // no need to mask the source here
     717            // XXX should we measure this for the analytical model only or the full model?
     718            pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, -x*DX, -y*DY);
     719            psFree (model);
     720        }
     721    }
     722
     723    psImage *psfLogFlux = (psImage *) psUnaryOp (NULL, psfMosaic, "log");
     724    psphotVisualRangeImage (kapa2, psfLogFlux, "psf_mosaic", 1, -2.0, 3.0);
     725
     726    psFree (psfMosaic);
     727    psFree (psfLogFlux);
     728
     729    // pause and wait for user input:
     730    // continue, save (provide name), ??
     731    char key[10];
     732    fprintf (stdout, "[c]ontinue? ");
     733    if (!fgets(key, 8, stdin)) {
     734        psWarning("Unable to read option");
     735    }
     736    return true;
     737}
     738
     739bool psphotVisualShowPSFStars (psMetadata *recipe, pmPSF *psf, psArray *sources) {
     740
     741    bool status;
     742
     743    if (!isVisual) return true;
     744
     745    if (kapa2 == -1) {
     746        kapa2 = KapaOpenNamedSocket ("kapa", "psphot:psfstars");
     747        if (kapa2 == -1) {
     748            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
     749            isVisual = false;
     750            return false;
     751        }
     752    } 
    689753
    690754    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
     
    822886    psFree (outpos);
    823887    psFree (outsub);
    824     return true;
    825 }
    826 
    827 bool psphotVisualShowSatStars (pmConfig *config, const pmFPAview *view, pmPSF *psf, psArray *sources) {
     888
     889
     890    // after displaying (as an image) the psf stars, we cycle throught them and display their
     891    // radial profiles:
     892    psphotVisualPlotRadialProfiles (recipe, sources);
     893
     894    return true;
     895}
     896
     897bool psphotVisualShowSatStars (psMetadata *recipe, pmPSF *psf, psArray *sources) {
    828898
    829899    bool status;
     
    839909        }
    840910    } 
    841 
    842     // select the current recipe
    843     psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
    844     if (!recipe) {
    845         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
    846         return false;
    847     }
    848911
    849912    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
     
    9711034}
    9721035
    973 bool psphotVisualShowPSFModel (pmConfig *config, pmReadout *readout, pmPSF *psf) {
     1036bool psphotVisualPlotRadialProfile (int myKapa, pmSource *source, psMaskType maskVal) {
     1037
     1038    Graphdata graphdata;
     1039
     1040    bool state = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
     1041    psphotAddWithTest (source, true, maskVal); // replace source if subtracted
     1042
     1043    int nPts = source->pixels->numRows * source->pixels->numCols;
     1044    psVector *rg = psVectorAllocEmpty (nPts, PS_TYPE_F32);
     1045    psVector *Rg = psVectorAllocEmpty (nPts, PS_TYPE_F32);
     1046    psVector *fg = psVectorAllocEmpty (nPts, PS_TYPE_F32);
     1047    psVector *rb = psVectorAllocEmpty (nPts, PS_TYPE_F32);
     1048    psVector *Rb = psVectorAllocEmpty (nPts, PS_TYPE_F32);
     1049    psVector *fb = psVectorAllocEmpty (nPts, PS_TYPE_F32);
     1050
     1051    int ng = 0;
     1052    int nb = 0;
     1053    float Xo = source->modelPSF->params->data.F32[PM_PAR_XPOS] - source->pixels->col0;
     1054    float Yo = source->modelPSF->params->data.F32[PM_PAR_YPOS] - source->pixels->row0;
     1055    for (int iy = 0; iy < source->pixels->numRows; iy++) {
     1056        for (int ix = 0; ix < source->pixels->numCols; ix++) {
     1057            if (source->maskObj->data.U8[iy][ix]) {
     1058                // rb->data.F32[nb] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
     1059                rb->data.F32[nb] = hypot (ix - Xo, iy - Yo) ;
     1060                Rb->data.F32[ng] = log10(rb->data.F32[nb]);
     1061                fb->data.F32[nb] = log10(source->pixels->data.F32[iy][ix]);
     1062                nb++;
     1063            } else {
     1064                // rg->data.F32[ng] = hypot (ix + 0.5 - Xo, iy + 0.5 - Yo) ;
     1065                rg->data.F32[ng] = hypot (ix - Xo, iy - Yo) ;
     1066                Rg->data.F32[ng] = log10(rg->data.F32[ng]);
     1067                fg->data.F32[ng] = log10(source->pixels->data.F32[iy][ix]);
     1068                ng++;
     1069            }
     1070        }
     1071    }
     1072 
     1073    // reset source Add/Sub state to recorded
     1074    psphotSetState (source, state, maskVal);
     1075
     1076    KapaInitGraph (&graphdata);
     1077
     1078    // ** linlog **
     1079    KapaSelectSection (myKapa, "linlog");
     1080
     1081    // examine sources to set data range
     1082    graphdata.xmin =  -0.05;
     1083    graphdata.xmax = +30.05;
     1084    graphdata.ymin = -0.05;
     1085    graphdata.ymax = +5.05;
     1086    KapaSetLimits (myKapa, &graphdata);
     1087 
     1088    KapaSetFont (myKapa, "helvetica", 14);
     1089    KapaBox (myKapa, &graphdata);
     1090    KapaSendLabel (myKapa, "radius (pixels)", KAPA_LABEL_XM);
     1091    KapaSendLabel (myKapa, "log flux (counts)", KAPA_LABEL_YM);
     1092               
     1093    graphdata.color = KapaColorByName ("black");
     1094    graphdata.ptype = 2;
     1095    graphdata.size = 0.5;
     1096    graphdata.style = 2;
     1097    KapaPrepPlot (myKapa, ng, &graphdata);
     1098    KapaPlotVector (myKapa, ng, rg->data.F32, "x");
     1099    KapaPlotVector (myKapa, ng, fg->data.F32, "y");
     1100
     1101    graphdata.color = KapaColorByName ("red");
     1102    graphdata.ptype = 0;
     1103    graphdata.size = 0.3;
     1104    graphdata.style = 2;
     1105    KapaPrepPlot (myKapa, nb, &graphdata);
     1106    KapaPlotVector (myKapa, nb, rb->data.F32, "x");
     1107    KapaPlotVector (myKapa, nb, fb->data.F32, "y");
     1108 
     1109    // ** loglog **
     1110    KapaSelectSection (myKapa, "loglog");
     1111
     1112    // examine sources to set data range
     1113    graphdata.xmin = -1.51;
     1114    graphdata.xmax = +1.51;
     1115    graphdata.ymin = -0.05;
     1116    graphdata.ymax = +5.05;
     1117    KapaSetLimits (myKapa, &graphdata);
     1118 
     1119    KapaSetFont (myKapa, "helvetica", 14);
     1120    KapaBox (myKapa, &graphdata);
     1121    KapaSendLabel (myKapa, "log radius (pixels)", KAPA_LABEL_XM);
     1122    KapaSendLabel (myKapa, "log flux (counts)", KAPA_LABEL_YM);
     1123               
     1124    graphdata.color = KapaColorByName ("black");
     1125    graphdata.ptype = 2;
     1126    graphdata.size = 0.5;
     1127    graphdata.style = 2;
     1128    KapaPrepPlot (myKapa, ng, &graphdata);
     1129    KapaPlotVector (myKapa, ng, Rg->data.F32, "x");
     1130    KapaPlotVector (myKapa, ng, fg->data.F32, "y");
     1131
     1132    graphdata.color = KapaColorByName ("red");
     1133    graphdata.ptype = 0;
     1134    graphdata.size = 0.3;
     1135    graphdata.style = 2;
     1136    KapaPrepPlot (myKapa, nb, &graphdata);
     1137    KapaPlotVector (myKapa, nb, Rb->data.F32, "x");
     1138    KapaPlotVector (myKapa, nb, fb->data.F32, "y");
     1139
     1140    psFree (rg);
     1141    psFree (Rg);
     1142    psFree (fg);
     1143    psFree (rb);
     1144    psFree (Rb);
     1145    psFree (fb);
     1146    return true;
     1147}
     1148
     1149bool psphotVisualPlotRadialProfiles (psMetadata *recipe, psArray *sources) {
     1150
     1151    KapaSection section;  // put the positive profile in one and the residuals in another?
    9741152
    9751153    if (!isVisual) return true;
    9761154
    977     if (kapa2 == -1) {
    978         kapa2 = KapaOpenNamedSocket ("kapa", "psphot:psfstars");
    979         if (kapa2 == -1) {
     1155    if (kapa3 == -1) {
     1156        kapa3 = KapaOpenNamedSocket ("kapa", "psphot:plots");
     1157        if (kapa3 == -1) {
    9801158            fprintf (stderr, "failure to open kapa; visual mode disabled\n");
    9811159            isVisual = false;
     
    9841162    } 
    9851163
    986     int DX = 64;
    987     int DY = 64;
    988 
    989     psImage *psfMosaic = psImageAlloc (3*DX, 3*DY, PS_TYPE_F32);
    990     psImageInit (psfMosaic, 0.0);
    991    
    992     pmModel *modelRef = pmModelAlloc(psf->type);
    993 
    994 # if (1)
    995     // generate a fake model at each of the 3x3 image grid positions
    996     for (int x = -1; x <= +1; x ++) {
    997         for (int y = -1; y <= +1; y ++) {
    998             // use the center of the center pixel of the image
    999             float xc = (0.5 + 0.45*x)*readout->image->numCols + readout->image->col0;
    1000             float yc = (0.5 + 0.45*y)*readout->image->numRows + readout->image->row0;
    1001 
    1002             // assign the x and y coords to the image center
    1003             // create an object with center intensity of 1000
    1004             modelRef->params->data.F32[PM_PAR_SKY] = 0;
    1005             modelRef->params->data.F32[PM_PAR_I0] = 1000;
    1006             modelRef->params->data.F32[PM_PAR_XPOS] = xc;
    1007             modelRef->params->data.F32[PM_PAR_YPOS] = yc;
    1008    
    1009             // create modelPSF from this model
    1010             pmModel *model = pmModelFromPSF (modelRef, psf);
    1011 
    1012             // place the reference object in the image center
    1013             // no need to mask the source here
    1014             // XXX should we measure this for the analytical model only or the full model?
    1015             pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, -x*DX, -y*DY);
    1016             psFree (model);
    1017         }
    1018     }
    1019 # else
    1020     {
    1021         // use the center of the center pixel of the image
    1022         float xc = 0.5*readout->image->numCols + readout->image->col0 + 0.5;
    1023         float yc = 0.5*readout->image->numRows + readout->image->row0 + 0.5;
    1024 
    1025         // assign the x and y coords to the image center
    1026         // create an object with center intensity of 1000
    1027         modelRef->params->data.F32[PM_PAR_SKY] = 0;
    1028         modelRef->params->data.F32[PM_PAR_I0] = 1000;
    1029         modelRef->params->data.F32[PM_PAR_XPOS] = xc;
    1030         modelRef->params->data.F32[PM_PAR_YPOS] = yc;
    1031    
    1032         // create modelPSF from this model
    1033         pmModel *model = pmModelFromPSF (modelRef, psf);
    1034 
    1035         // place the reference object in the image center
    1036         // no need to mask the source here
    1037         // XXX should we measure this for the analytical model only or the full model?
    1038         pmModelAddWithOffset (psfMosaic, NULL, model, PM_MODEL_OP_FULL | PM_MODEL_OP_CENTER, 0, 32.0, 16.0);
    1039     }
    1040 # endif
    1041 
    1042     psImage *psfLogFlux = (psImage *) psUnaryOp (NULL, psfMosaic, "log");
    1043     psphotVisualRangeImage (kapa2, psfLogFlux, "psf_mosaic", 1, -2.0, 3.0);
    1044 
    1045     psFree (psfMosaic);
    1046     psFree (psfLogFlux);
    1047 
    1048     // pause and wait for user input:
    1049     // continue, save (provide name), ??
    1050     char key[10];
    1051     fprintf (stdout, "[c]ontinue? ");
    1052     if (!fgets(key, 8, stdin)) {
    1053         psWarning("Unable to read option");
    1054     }
    1055     return true;
    1056 }
    1057 
    1058 bool psphotVisualShowFlags (pmConfig *config, const pmFPAview *view, psArray *sources) {
     1164    // user-defined masks to test for good/bad pixels (build from recipe list if not yet set)
     1165    bool status;
     1166    psMaskType maskVal = psMetadataLookupU8(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels
     1167    assert (maskVal);
     1168
     1169    KapaClearPlots (kapa3);
     1170    // first section : mag vs CR nSigma
     1171    section.dx = 1.0;
     1172    section.dy = 0.5;
     1173    section.x = 0.0;
     1174    section.y = 0.0;
     1175    section.name = NULL;
     1176    psStringAppend (&section.name, "linlog");
     1177    KapaSetSection (kapa3, &section);
     1178    psFree (section.name);
     1179
     1180    // first section : mag vs CR nSigma
     1181    section.dx = 1.0;
     1182    section.dy = 0.5;
     1183    section.x = 0.0;
     1184    section.y = 0.5;
     1185    section.name = NULL;
     1186    psStringAppend (&section.name, "loglog");
     1187    KapaSetSection (kapa3, &section);
     1188    psFree (section.name);
     1189
     1190    // loop over the PSF stars
     1191    for (int i = 0; i < sources->n; i++) {
     1192
     1193        pmSource *source = sources->data[i];
     1194        if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
     1195
     1196        psphotVisualPlotRadialProfile (kapa3, source, maskVal);
     1197
     1198        // pause and wait for user input:
     1199        // continue, save (provide name), ??
     1200        char key[10];
     1201        fprintf (stdout, "[e]rase and continue? [o]verplot and continue? [s]kip rest of stars? : ");
     1202        if (!fgets(key, 8, stdin)) {
     1203            psWarning("Unable to read option");
     1204        }
     1205        if (key[0] == 'e') {
     1206            KapaClearPlots (kapa3);
     1207        }
     1208        if (key[0] == 's') {
     1209            break;
     1210        }
     1211    }       
     1212
     1213    return true;
     1214}
     1215
     1216bool psphotVisualShowFlags (psArray *sources) {
    10591217
    10601218    int NoverlayE, NOVERLAYE;
     
    11611319}
    11621320
    1163 bool psphotVisualShowSourceSize (pmConfig *config, const pmFPAview *view, psArray *sources) {
     1321bool psphotVisualShowSourceSize (psArray *sources) {
    11641322
    11651323    int Noverlay, NOVERLAY;
     
    12361394}
    12371395
    1238 bool psphotVisualPlotSourceSize (pmConfig *config, psArray *sources) {
    1239 
    1240     bool status;
     1396bool psphotVisualPlotSourceSize (psArray *sources) {
     1397
    12411398    Graphdata graphdata;
    12421399    KapaSection section;
     
    12521409        }
    12531410    } 
    1254 
    1255     // select the current recipe
    1256     psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    1257     if (!recipe) {
    1258         fprintf (stderr, "missing recipe, skipping moments plot\n");
    1259         return false;
    1260     }
    12611411
    12621412    KapaClearPlots (kapa3);
     
    13871537}
    13881538
    1389 bool psphotVisualShowResidualImage (pmConfig *config, pmReadout *readout) {
     1539bool psphotVisualShowResidualImage (pmReadout *readout) {
    13901540
    13911541    if (!isVisual) return true;
     
    14121562}
    14131563
    1414 bool psphotVisualPlotApResid (pmConfig *config, psArray *sources) {
    1415 
    1416     bool status;
     1564bool psphotVisualPlotApResid (psArray *sources) {
     1565
    14171566    Graphdata graphdata;
    14181567
     
    14271576        }
    14281577    } 
    1429 
    1430     // select the current recipe
    1431     psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    1432     if (!recipe) {
    1433         fprintf (stderr, "missing recipe, skipping moments plot\n");
    1434         return false;
    1435     }
    14361578
    14371579    KapaClearPlots (kapa3);
Note: See TracChangeset for help on using the changeset viewer.