IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34360


Ignore:
Timestamp:
Aug 26, 2012, 1:05:27 PM (14 years ago)
Author:
eugene
Message:

visual adjustment to examine saturated stars

Location:
branches/eam_branches/ipp-20120805/psphot/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120805/psphot/src/psphot.h

    r34266 r34360  
    282282bool            psphotVisualShowPSFModel (pmReadout *readout, pmPSF *psf);
    283283bool            psphotVisualPlotRadialProfile (int myKapa, pmSource *source, psImageMaskType maskVal);
    284 bool            psphotVisualPlotRadialProfiles (psMetadata *recipe, psArray *sources);
     284bool            psphotVisualPlotRadialProfiles (psMetadata *recipe, psArray *sources, pmSourceMode showmode);
    285285bool            psphotVisualShowFlags (psArray *sources);
    286286bool            psphotVisualShowSourceSize (pmReadout *readout, psArray *sources);
  • branches/eam_branches/ipp-20120805/psphot/src/psphotDeblendSatstars.c

    r31154 r34360  
    7878    psVector *index = psVectorSortIndex (NULL, SN);
    7979    // this results in an index of increasing SN
     80
     81    psphotVisualPlotRadialProfiles (recipe, sources, PM_SOURCE_MODE_SATSTAR);
    8082
    8183    // examine sources in decreasing SN order
     
    219221    return true;
    220222}
     223
     224bool psphotDeblendSatstarsReadoutOld (pmConfig *config, const pmFPAview *view, const char *filerule, int fileIndex) {
     225
     226    int N;
     227    pmSource *source;
     228    bool status;
     229
     230    psTimerStart ("psphot.deblend.sat");
     231
     232    int Nblend = 0;
     233    float SAT_MIN_RADIUS = 5.0;
     234
     235    // find the currently selected readout
     236    pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, fileIndex); // File of interest
     237    psAssert (file, "missing file?");
     238
     239    pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);
     240    psAssert (readout, "missing readout?");
     241
     242    pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");
     243    psAssert (detections, "missing detections?");
     244
     245    psArray *sources = detections->newSources;
     246    psAssert (sources, "missing sources?");
     247
     248    if (!sources->n) {
     249        psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping satstar blend");
     250        return true;
     251    }
     252
     253    // select the appropriate recipe information
     254    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     255    psAssert (recipe, "missing recipe?");
     256
     257    pmCell *cell = readout->parent;
     258
     259    float SATURATION = NAN;
     260
     261    // do not completely trust the values in the header...
     262    float CELL_SATURATION = psMetadataLookupF32 (&status, cell->concepts, "CELL.SATURATION");
     263    float MIN_SATURATION = psMetadataLookupF32 (&status, recipe, "DEBLEND_MIN_SATURATION");
     264    if (!status || !isfinite(MIN_SATURATION)) {
     265        MIN_SATURATION = 40000.0;
     266    }
     267    if (!isfinite(CELL_SATURATION)) {
     268        SATURATION = MIN_SATURATION;
     269    } else {
     270        SATURATION = PS_MAX(MIN_SATURATION, CELL_SATURATION);
     271    }
     272    float SAT_TEST_LEVEL = 0.5*SATURATION;
     273
     274    // we need sources spatially-sorted to find overlaps
     275    sources = psArraySort (sources, pmSourceSortByY);
     276
     277    // source analysis is done in peak order (brightest first)
     278    // we use an index for this so the spatial sorting is kept
     279    psVector *SN = psVectorAlloc (sources->n, PS_DATA_F32);
     280    for (int i = 0; i < SN->n; i++) {
     281        source = sources->data[i];
     282        SN->data.F32[i] = source->peak->rawFlux;
     283    }
     284    psVector *index = psVectorSortIndex (NULL, SN);
     285    // this results in an index of increasing SN
     286
     287    // examine sources in decreasing SN order
     288    for (int i = sources->n - 1; i >= 0; i--) {
     289        N = index->data.U32[i];
     290        source = sources->data[N];
     291
     292        // XXX filter? if (source->mode & PM_SOURCE_MODE_SATSTAR) continue;
     293        if (source->mode & PM_SOURCE_MODE_BLEND) continue;
     294        if (source->peak->rawFlux < SAT_TEST_LEVEL) continue;
     295
     296        // save these for reference below
     297        int xPeak = source->peak->x;
     298        int yPeak = source->peak->y;
     299
     300        // generate a basic contour (set of x,y coordinates at-or-below flux level)
     301        psArray *contour = pmSourceContour (source->pixels, xPeak, yPeak, SAT_TEST_LEVEL);
     302        if (contour == NULL) continue;
     303
     304        // contour consists of a set of X,Y coords giving the boundary
     305        psVector *xVec = contour->data[0];
     306        psVector *yVec = contour->data[1];
     307        if (xVec->n < 5) {
     308            psFree(contour);
     309            continue;
     310        }
     311
     312        // find the center of the contour (let's just use mid[x,y])
     313        int xMin = xVec->data.F32[0];
     314        int xMax = xVec->data.F32[0];
     315        int yMin = yVec->data.F32[0];
     316        int yMax = yVec->data.F32[0];
     317        for (int j = 0; j < xVec->n; j++) {
     318            xMin = PS_MIN (xMin, xVec->data.F32[j]);
     319            xMax = PS_MAX (xMax, xVec->data.F32[j]);
     320            yMin = PS_MIN (yMin, yVec->data.F32[j]);
     321            yMax = PS_MAX (yMax, yVec->data.F32[j]);
     322        }       
     323        int xCenter = 0.5*(xMin + xMax);
     324        int yCenter = 0.5*(yMin + yMax);
     325        psFree (contour);
     326
     327        psAssert (xCenter >= source->pixels->col0, "invalid shift in object center");
     328        psAssert (xCenter <  source->pixels->col0 + source->pixels->numCols, "invalid shift in object center");
     329        psAssert (yCenter >= source->pixels->row0, "invalid shift in object center");
     330        psAssert (yCenter <  source->pixels->row0 + source->pixels->numRows, "invalid shift in object center");
     331
     332        // reset the peak for this source to the value of the center pixel
     333        source->peak->x = xCenter;
     334        source->peak->y = yCenter;
     335        source->peak->xf = xCenter;
     336        source->peak->yf = yCenter;
     337       
     338        // temporary array for overlapping objects we find
     339        psArray *overlap = psArrayAllocEmpty (100);
     340
     341        // search backwards for overlapping sources
     342        for (int j = N - 1; j >= 0; j--) {
     343            pmSource *testSource = sources->data[j];
     344            if (testSource->peak->x <  source->pixels->col0) continue;
     345            if (testSource->peak->x >= source->pixels->col0 + source->pixels->numCols) continue;
     346            if (testSource->peak->y <  source->pixels->row0) break;
     347            if (testSource->peak->y >= source->pixels->row0 + source->pixels->numRows) {
     348                fprintf (stderr, "warning: invalid condition\n");
     349                continue;
     350            }
     351            psArrayAdd (overlap, 100, testSource);
     352        }
     353
     354        // search forwards for overlapping sources
     355        for (int j = N + 1; j < sources->n; j++) {
     356            pmSource *testSource = sources->data[j];
     357            if (testSource->peak->x <  source->pixels->col0) continue;
     358            if (testSource->peak->x >= source->pixels->col0 + source->pixels->numCols) continue;
     359            if (testSource->peak->y <  source->pixels->row0) {
     360                fprintf (stderr, "warning: invalid condition\n");
     361                continue;
     362            }
     363            if (testSource->peak->y >= source->pixels->row0 + source->pixels->numRows) break;
     364            psArrayAdd (overlap, 100, testSource);
     365        }
     366
     367        if (overlap->n == 0) {
     368            psFree (overlap);
     369            continue;
     370        }
     371
     372        // now find the contour which is at 0.5*SAT_TEST_LEVEL (xPeak, yPeak is valid high pixel)
     373        contour = pmSourceContour (source->pixels, xPeak, yPeak, 0.5*SAT_TEST_LEVEL);
     374        if (contour == NULL) {
     375            psFree (overlap);
     376            continue;
     377        }
     378       
     379        // any peaks within this contour should be dropped (mark as blend, drop after loop is done)
     380        // also drop any peaks which are too close to this peak
     381        psVector *xv = contour->data[0];
     382        psVector *yv = contour->data[1];
     383        for (int k = 0; k < overlap->n; k++) {
     384            pmSource *testSource = overlap->data[k];
     385            float radius = hypot((testSource->peak->x - xCenter), (testSource->peak->y - yCenter));
     386            if (radius < SAT_MIN_RADIUS) {
     387                testSource->mode |= PM_SOURCE_MODE_BLEND;
     388                Nblend ++;
     389                continue;
     390            }
     391            for (int j = 0; j < xv->n; j+=2) {
     392                if (fabs(yv->data.F32[j] - testSource->peak->y) > 0.5) continue;
     393                if (xv->data.F32[j+0] > testSource->peak->x) break;
     394                if (xv->data.F32[j+1] < testSource->peak->x) break;
     395                testSource->mode |= PM_SOURCE_MODE_BLEND;
     396                Nblend ++;
     397                j = xv->n; // skip rest of contour
     398            }
     399        }
     400        psFree (overlap);
     401        psFree (contour);
     402    }
     403
     404    // drop the sources marked as BLEND
     405    for (int i = 0; i < sources->n;) {
     406        pmSource *source = sources->data[i];
     407
     408        if (!(source->mode & PM_SOURCE_MODE_BLEND)) {
     409            i++;
     410            continue;
     411        }
     412
     413        // shuffle the remaining sources forward
     414        for (int j = i; j < sources->n - 1; j++) {
     415            sources->data[j] = sources->data[j+1];
     416        }
     417        psFree (source);
     418        sources->n --;
     419    }
     420
     421    psFree (SN);
     422    psFree (index);
     423
     424    psLogMsg ("psphot", PS_LOG_INFO, "found %d satstar blend peaks, leaving %ld sources: %f sec\n", Nblend, sources->n, psTimerMark ("psphot.deblend.sat"));
     425    return true;
     426}
  • branches/eam_branches/ipp-20120805/psphot/src/psphotReadout.c

    r34215 r34360  
    129129
    130130    // find blended neighbors of very saturated stars (detections->newSources)
    131     // if (!psphotDeblendSatstars (config, view, filerule)) {
    132     // psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis");
    133     // return psphotReadoutCleanup (config, view, filerule);
    134     // }
     131    if (!psphotDeblendSatstars (config, view, filerule)) {
     132        psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis");
     133        return psphotReadoutCleanup (config, view, filerule);
     134    }
    135135
    136136    // mark blended peaks PS_SOURCE_BLEND (detections->newSources)
  • branches/eam_branches/ipp-20120805/psphot/src/psphotVisual.c

    r31452 r34360  
    11391139    // after displaying (as an image) the psf stars, we cycle throught them and display their
    11401140    // radial profiles:
    1141     psphotVisualPlotRadialProfiles (recipe, sources);
     1141    psphotVisualPlotRadialProfiles (recipe, sources, PM_SOURCE_MODE_PSFSTAR);
    11421142
    11431143    return true;
     
    13021302    int ng = 0;
    13031303    int nb = 0;
    1304     float Xo = source->modelPSF->params->data.F32[PM_PAR_XPOS] - source->pixels->col0;
    1305     float Yo = source->modelPSF->params->data.F32[PM_PAR_YPOS] - source->pixels->row0;
     1304
     1305    float Xo = NAN;
     1306    float Yo = NAN;
     1307
     1308    if (source->modelPSF) {
     1309        Xo = source->modelPSF->params->data.F32[PM_PAR_XPOS] - source->pixels->col0;
     1310        Yo = source->modelPSF->params->data.F32[PM_PAR_YPOS] - source->pixels->row0;
     1311    } else {
     1312        Xo = source->moments->Mx;
     1313        Yo = source->moments->My;
     1314    }
     1315
    13061316    for (int iy = 0; iy < source->pixels->numRows; iy++) {
    13071317        for (int ix = 0; ix < source->pixels->numCols; ix++) {
     
    13221332    }
    13231333
    1324     // generate model profiles (major and minor axis):
    1325     // create a model with theta = 0.0 so major and minor axes are equiv to x and y:
    1326     psEllipseShape rawShape, rotShape;
    1327 
    1328     rawShape.sx  = source->modelPSF->params->data.F32[PM_PAR_SXX] / M_SQRT2;
    1329     rawShape.sy  = source->modelPSF->params->data.F32[PM_PAR_SYY] / M_SQRT2;
    1330     rawShape.sxy = source->modelPSF->params->data.F32[PM_PAR_SXY];
    1331 
    1332     psEllipseAxes axes = psEllipseShapeToAxes (rawShape, 20.0);
    1333 
    1334     axes.theta = 0.0;
    1335 
    1336     rotShape = psEllipseAxesToShape (axes);
    1337 
    1338     psVector *params = psVectorAlloc(source->modelPSF->params->n, PS_TYPE_F32);
    1339     for (int i = 0; i < source->modelPSF->params->n; i++) {
    1340         params->data.F32[i] = source->modelPSF->params->data.F32[i];
    1341     }
    1342     params->data.F32[PM_PAR_SXX] = rotShape.sx * M_SQRT2;
    1343     params->data.F32[PM_PAR_SYY] = rotShape.sy * M_SQRT2;
    1344     params->data.F32[PM_PAR_SXY] = rotShape.sxy;
    1345     params->data.F32[PM_PAR_XPOS] = 0.0;
    1346     params->data.F32[PM_PAR_YPOS] = 0.0;
    1347 
    1348     psVector *rmod = psVectorAlloc(300, PS_TYPE_F32);
    1349     psVector *fmaj = psVectorAlloc(300, PS_TYPE_F32);
    1350     psVector *fmin = psVectorAlloc(300, PS_TYPE_F32);
    1351 
    1352     psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
    1353 
    1354     float r = 0.0;
    1355     for (int i = 0; i < rmod->n; i++) {
    1356         r = i*0.1;
    1357         rmod->data.F32[i] = r;
    1358 
    1359         coord->data.F32[1] = r;
    1360         coord->data.F32[0] = 0.0;
    1361         fmaj->data.F32[i] = log10(source->modelPSF->modelFunc (NULL, params, coord));
    1362 
    1363         coord->data.F32[0] = r;
    1364         coord->data.F32[1] = 0.0;
    1365         fmin->data.F32[i] = log10(source->modelPSF->modelFunc (NULL, params, coord));
    1366     }
    1367     psFree (coord);
    1368     psFree (params);
    1369 
    1370     float FWHM_MAJOR = 2.0*source->modelPSF->modelRadius (source->modelPSF->params, 0.5*source->modelPSF->params->data.F32[PM_PAR_I0]);
    1371     float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
    1372     if (FWHM_MAJOR < FWHM_MINOR) PS_SWAP (FWHM_MAJOR, FWHM_MINOR);
    1373 
    1374     psEllipseMoments emoments;
    1375     emoments.x2 = source->moments->Mxx;
    1376     emoments.xy = source->moments->Mxy;
    1377     emoments.y2 = source->moments->Myy;
    1378     axes = psEllipseMomentsToAxes (emoments, 20.0);
    1379     float MOMENTS_MAJOR = 2.355*axes.major;
    1380     float MOMENTS_MINOR = 2.355*axes.minor;
    1381 
    1382     float logHM = log10(0.5*source->modelPSF->params->data.F32[PM_PAR_I0]);
    1383 
    1384     // reset source Add/Sub state to recorded
    1385     if (subtracted) pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    1386 
    13871334    KapaInitGraph (&graphdata);
    13881335
     
    14171364    KapaPlotVector (myKapa, nb, rb->data.F32, "x");
    14181365    KapaPlotVector (myKapa, nb, fb->data.F32, "y");
    1419 
    1420     graphdata.color = KapaColorByName ("blue");
    1421     graphdata.ptype = 0;
    1422     graphdata.size = 0.0;
    1423     graphdata.style = 0;
    1424     KapaPrepPlot   (myKapa, rmod->n, &graphdata);
    1425     KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
    1426     KapaPlotVector (myKapa, rmod->n, fmin->data.F32, "y");
    1427     plotline (myKapa, &graphdata, 0.0, logHM, 30.0, logHM);
    1428     plotline (myKapa, &graphdata, 0.5*FWHM_MINOR, 0.0, 0.5*FWHM_MINOR, 5.0);
    1429     graphdata.ltype = 1;
    1430     plotline (myKapa, &graphdata, 0.5*MOMENTS_MINOR, 0.0, 0.5*MOMENTS_MINOR, 5.0);
    1431     graphdata.ltype = 0;
    1432        
    1433     graphdata.color = KapaColorByName ("green");
    1434     graphdata.ptype = 0;
    1435     graphdata.size = 0.0;
    1436     graphdata.style = 0;
    1437     KapaPrepPlot   (myKapa, rmod->n, &graphdata);
    1438     KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
    1439     KapaPlotVector (myKapa, rmod->n, fmaj->data.F32, "y");
    1440     plotline (myKapa, &graphdata, 0.5*FWHM_MAJOR, 0.0, 0.5*FWHM_MAJOR, 5.0);
    1441     graphdata.ltype = 1;
    1442     plotline (myKapa, &graphdata, 0.5*MOMENTS_MAJOR, 0.0, 0.5*MOMENTS_MAJOR, 5.0);
    1443     graphdata.ltype = 0;
    1444        
    1445     for (int i = 0; i < rmod->n; i++) {
    1446         rmod->data.F32[i] = log10(rmod->data.F32[i]);
    1447     }
    14481366
    14491367    // ** loglog **
     
    14791397    KapaPlotVector (myKapa, nb, fb->data.F32, "y");
    14801398
    1481     graphdata.color = KapaColorByName ("blue");
    1482     graphdata.ptype = 0;
    1483     graphdata.size = 0.0;
    1484     graphdata.style = 0;
    1485     KapaPrepPlot   (myKapa, rmod->n, &graphdata);
    1486     KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
    1487     KapaPlotVector (myKapa, rmod->n, fmin->data.F32, "y");
    1488 
    1489     graphdata.color = KapaColorByName ("green");
    1490     graphdata.ptype = 0;
    1491     graphdata.size = 0.0;
    1492     graphdata.style = 0;
    1493     KapaPrepPlot   (myKapa, rmod->n, &graphdata);
    1494     KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
    1495     KapaPlotVector (myKapa, rmod->n, fmaj->data.F32, "y");
    1496 
    1497     psFree (rmod);
    1498     psFree (fmin);
    1499     psFree (fmaj);
     1399    if (source->modelPSF) {
     1400        // generate model profiles (major and minor axis):
     1401        // create a model with theta = 0.0 so major and minor axes are equiv to x and y:
     1402        psEllipseShape rawShape, rotShape;
     1403
     1404        rawShape.sx  = source->modelPSF->params->data.F32[PM_PAR_SXX] / M_SQRT2;
     1405        rawShape.sy  = source->modelPSF->params->data.F32[PM_PAR_SYY] / M_SQRT2;
     1406        rawShape.sxy = source->modelPSF->params->data.F32[PM_PAR_SXY];
     1407
     1408        psEllipseAxes axes = psEllipseShapeToAxes (rawShape, 20.0);
     1409
     1410        axes.theta = 0.0;
     1411
     1412        rotShape = psEllipseAxesToShape (axes);
     1413
     1414        psVector *params = psVectorAlloc(source->modelPSF->params->n, PS_TYPE_F32);
     1415        for (int i = 0; i < source->modelPSF->params->n; i++) {
     1416            params->data.F32[i] = source->modelPSF->params->data.F32[i];
     1417        }
     1418        params->data.F32[PM_PAR_SXX] = rotShape.sx * M_SQRT2;
     1419        params->data.F32[PM_PAR_SYY] = rotShape.sy * M_SQRT2;
     1420        params->data.F32[PM_PAR_SXY] = rotShape.sxy;
     1421        params->data.F32[PM_PAR_XPOS] = 0.0;
     1422        params->data.F32[PM_PAR_YPOS] = 0.0;
     1423
     1424        psVector *rmod = psVectorAlloc(300, PS_TYPE_F32);
     1425        psVector *fmaj = psVectorAlloc(300, PS_TYPE_F32);
     1426        psVector *fmin = psVectorAlloc(300, PS_TYPE_F32);
     1427
     1428        psVector *coord = psVectorAlloc(2, PS_TYPE_F32);
     1429
     1430        float r = 0.0;
     1431        for (int i = 0; i < rmod->n; i++) {
     1432            r = i*0.1;
     1433            rmod->data.F32[i] = r;
     1434
     1435            coord->data.F32[1] = r;
     1436            coord->data.F32[0] = 0.0;
     1437            fmaj->data.F32[i] = log10(source->modelPSF->modelFunc (NULL, params, coord));
     1438
     1439            coord->data.F32[0] = r;
     1440            coord->data.F32[1] = 0.0;
     1441            fmin->data.F32[i] = log10(source->modelPSF->modelFunc (NULL, params, coord));
     1442        }
     1443        psFree (coord);
     1444        psFree (params);
     1445
     1446        float FWHM_MAJOR = 2.0*source->modelPSF->modelRadius (source->modelPSF->params, 0.5*source->modelPSF->params->data.F32[PM_PAR_I0]);
     1447        float FWHM_MINOR = FWHM_MAJOR * (axes.minor / axes.major);
     1448        if (FWHM_MAJOR < FWHM_MINOR) PS_SWAP (FWHM_MAJOR, FWHM_MINOR);
     1449
     1450        psEllipseMoments emoments;
     1451        emoments.x2 = source->moments->Mxx;
     1452        emoments.xy = source->moments->Mxy;
     1453        emoments.y2 = source->moments->Myy;
     1454        axes = psEllipseMomentsToAxes (emoments, 20.0);
     1455        float MOMENTS_MAJOR = 2.355*axes.major;
     1456        float MOMENTS_MINOR = 2.355*axes.minor;
     1457
     1458        float logHM = log10(0.5*source->modelPSF->params->data.F32[PM_PAR_I0]);
     1459
     1460        // reset source Add/Sub state to recorded
     1461        if (subtracted) pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
     1462
     1463        // ** linlog **
     1464        KapaSelectSection (myKapa, "linlog");
     1465        KapaGetGraphData (myKapa, &graphdata);
     1466        graphdata.color = KapaColorByName ("blue");
     1467        graphdata.ptype = 0;
     1468        graphdata.size = 0.0;
     1469        graphdata.style = 0;
     1470        KapaPrepPlot   (myKapa, rmod->n, &graphdata);
     1471        KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
     1472        KapaPlotVector (myKapa, rmod->n, fmin->data.F32, "y");
     1473        plotline (myKapa, &graphdata, graphdata.xmin, logHM, graphdata.xmax, logHM);
     1474        plotline (myKapa, &graphdata, 0.5*FWHM_MINOR, graphdata.ymin, 0.5*FWHM_MINOR, graphdata.ymax);
     1475        graphdata.ltype = 1;
     1476        plotline (myKapa, &graphdata, 0.5*MOMENTS_MINOR, graphdata.ymin, 0.5*MOMENTS_MINOR, graphdata.ymax);
     1477        graphdata.ltype = 0;
     1478       
     1479        graphdata.color = KapaColorByName ("green");
     1480        graphdata.ptype = 0;
     1481        graphdata.size = 0.0;
     1482        graphdata.style = 0;
     1483        KapaPrepPlot   (myKapa, rmod->n, &graphdata);
     1484        KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
     1485        KapaPlotVector (myKapa, rmod->n, fmaj->data.F32, "y");
     1486        plotline (myKapa, &graphdata, 0.5*FWHM_MAJOR, graphdata.ymin, 0.5*FWHM_MAJOR, graphdata.ymax);
     1487        graphdata.ltype = 1;
     1488        plotline (myKapa, &graphdata, 0.5*MOMENTS_MAJOR, graphdata.ymin, 0.5*MOMENTS_MAJOR, graphdata.ymax);
     1489        graphdata.ltype = 0;
     1490       
     1491        for (int i = 0; i < rmod->n; i++) {
     1492            rmod->data.F32[i] = log10(rmod->data.F32[i]);
     1493        }
     1494
     1495        // ** loglog **
     1496        KapaSelectSection (myKapa, "loglog");
     1497        KapaGetGraphData (myKapa, &graphdata);
     1498        graphdata.color = KapaColorByName ("blue");
     1499        graphdata.ptype = 0;
     1500        graphdata.size = 0.0;
     1501        graphdata.style = 0;
     1502        KapaPrepPlot   (myKapa, rmod->n, &graphdata);
     1503        KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
     1504        KapaPlotVector (myKapa, rmod->n, fmin->data.F32, "y");
     1505
     1506        graphdata.color = KapaColorByName ("green");
     1507        graphdata.ptype = 0;
     1508        graphdata.size = 0.0;
     1509        graphdata.style = 0;
     1510        KapaPrepPlot   (myKapa, rmod->n, &graphdata);
     1511        KapaPlotVector (myKapa, rmod->n, rmod->data.F32, "x");
     1512        KapaPlotVector (myKapa, rmod->n, fmaj->data.F32, "y");
     1513
     1514        psFree (rmod);
     1515        psFree (fmin);
     1516        psFree (fmaj);
     1517    }
    15001518
    15011519    psFree (rg);
     
    15081526}
    15091527
    1510 bool psphotVisualPlotRadialProfiles (psMetadata *recipe, psArray *sources) {
     1528bool psphotVisualPlotRadialProfiles (psMetadata *recipe, psArray *sources, pmSourceMode showmode) {
    15111529
    15121530    KapaSection section;  // put the positive profile in one and the residuals in another?
     
    15491567
    15501568        pmSource *source = sources->data[i];
    1551         if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
     1569        if (!(source->mode & showmode)) continue;
    15521570
    15531571        psphotVisualPlotRadialProfile (myKapa, source, maskVal);
Note: See TracChangeset for help on using the changeset viewer.