IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 19, 2009, 8:49:41 AM (17 years ago)
Author:
eugene
Message:

further work on the petrosian analysis & extended sources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/psphot/src/psphotVisual.c

    r25433 r25452  
    20942094}
    20952095
    2096 bool psphotVisualShowPetrosian (pmSource *source, pmPetrosian *petrosian) {
    2097 
    2098     KiiOverlay overlay[2];
    2099 
    2100     if (source == NULL) return true;
     2096bool psphotVisualShowPetrosians (psArray *sources) {
     2097
     2098    int Noverlay, NOVERLAY;
     2099    KiiOverlay *overlay;
    21012100
    21022101    // if (!pmVisualIsVisual()) return true;
     
    21052104    if (kapa == -1) return false;
    21062105
    2107     if (kapa == -1) {
    2108         fprintf (stderr, "kapa not opened, skipping\n");
    2109         return false;
    2110     }
    2111 
    2112     overlay[0].type = KII_OVERLAY_CIRCLE;
    2113     overlay[0].x = source->peak->xf;
    2114     overlay[0].y = source->peak->yf;
    2115     overlay[0].dx = 2.0*petrosian->petrosianRadius;
    2116     overlay[0].dy = 2.0*petrosian->petrosianRadius*petrosian->axes.minor/petrosian->axes.major;
    2117     overlay[0].angle = petrosian->axes.theta * PS_DEG_RAD;
    2118     overlay[0].text = NULL;
    2119 
    2120     overlay[1].type = KII_OVERLAY_CIRCLE;
    2121     overlay[1].x = source->peak->xf;
    2122     overlay[1].y = source->peak->yf;
    2123     overlay[1].dx = 4.0*petrosian->petrosianRadius;
    2124     overlay[1].dy = 4.0*petrosian->petrosianRadius*petrosian->axes.minor/petrosian->axes.major;
    2125     overlay[1].angle = petrosian->axes.theta * PS_DEG_RAD;
    2126     overlay[1].text = NULL;
    2127 
    2128     KiiLoadOverlay (kapa, overlay, 2, "red");
     2106    Noverlay = 0;
     2107    NOVERLAY = 100;
     2108    ALLOCATE (overlay, KiiOverlay, NOVERLAY);
     2109
     2110    for (int i = 0; i < sources->n; i++) {
     2111        pmSource *source = sources->data[i];
     2112
     2113        if (!source) continue;
     2114        if (!source->extpars) continue;
     2115        if (!source->extpars->profile) continue;
     2116        if (!source->extpars->petrosian_80) continue;
     2117
     2118        pmSourceRadialProfile *profile = source->extpars->profile;
     2119        pmSourceExtendedFlux *petrosian = source->extpars->petrosian_80;
     2120
     2121        overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
     2122        overlay[Noverlay].x = source->peak->xf;
     2123        overlay[Noverlay].y = source->peak->yf;
     2124        overlay[Noverlay].dx = 2.0*petrosian->radius;
     2125        overlay[Noverlay].dy = 2.0*petrosian->radius*profile->axes.minor/profile->axes.major;
     2126        overlay[Noverlay].angle = profile->axes.theta * PS_DEG_RAD;
     2127        overlay[Noverlay].text = NULL;
     2128        Noverlay ++;
     2129        CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
     2130
     2131        overlay[Noverlay].type = KII_OVERLAY_CIRCLE;
     2132        overlay[Noverlay].x = source->peak->xf;
     2133        overlay[Noverlay].y = source->peak->yf;
     2134        overlay[Noverlay].dx = 4.0*petrosian->radius;
     2135        overlay[Noverlay].dy = 4.0*petrosian->radius*profile->axes.minor/profile->axes.major;
     2136        overlay[Noverlay].angle = profile->axes.theta * PS_DEG_RAD;
     2137        overlay[Noverlay].text = NULL;
     2138        Noverlay ++;
     2139        CHECK_REALLOCATE (overlay, KiiOverlay, NOVERLAY, Noverlay, 100);
     2140    }
     2141
     2142    KiiLoadOverlay (kapa, overlay, Noverlay, "red");
     2143    FREE (overlay);
     2144
     2145    // pause and wait for user input:
     2146    // continue, save (provide name), ??
     2147    char key[10];
     2148    fprintf (stdout, "[c]ontinue? ");
     2149    if (!fgets(key, 8, stdin)) {
     2150        psWarning("Unable to read option");
     2151    }
    21292152
    21302153    return true;
     
    21522175
    21532176# if (0)
    2154     // *** make a histogram of the source counts in the x and y directions
    2155     psHistogram *nX = psHistogramAlloc (graphdata.xmin, graphdata.xmax, 50.0);
    2156     psHistogram *nY = psHistogramAlloc (graphdata.ymin, graphdata.ymax, 50.0);
    2157     psVectorHistogram (nX, xFaint, NULL, NULL, 0);
    2158     psVectorHistogram (nY, yFaint, NULL, NULL, 0);
    2159     psVector *dX = psVectorAlloc (nX->nums->n, PS_TYPE_F32);
    2160     psVector *vX = psVectorAlloc (nX->nums->n, PS_TYPE_F32);
    2161     psVector *dY = psVectorAlloc (nY->nums->n, PS_TYPE_F32);
    2162     psVector *vY = psVectorAlloc (nY->nums->n, PS_TYPE_F32);
    2163     for (int i = 0; i < nX->nums->n; i++) {
    2164         dX->data.F32[i] = nX->nums->data.S32[i];
    2165         vX->data.F32[i] = 0.5*(nX->bounds->data.F32[i] + nX->bounds->data.F32[i+1]);
    2166     }
    2167     for (int i = 0; i < nY->nums->n; i++) {
    2168         dY->data.F32[i] = nY->nums->data.S32[i];
    2169         vY->data.F32[i] = 0.5*(nY->bounds->data.F32[i] + nY->bounds->data.F32[i+1]);
    2170     }
    2171 
    2172     graphdata.color = KapaColorByName ("black");
    2173     graphdata.ptype = 0;
    2174     graphdata.size = 0.0;
    2175     graphdata.style = 0;
    2176     KapaPrepPlot (myKapa, dX->n, &graphdata);
    2177     KapaPlotVector (myKapa, dX->n, dX->data.F32, "x");
    2178     KapaPlotVector (myKapa, vX->n, vX->data.F32, "y");
    2179 
    2180     psFree (nX);
    2181     psFree (dX);
    2182     psFree (vX);
    2183 
    2184     psFree (nY);
    2185     psFree (dY);
    2186     psFree (vY);
     2177// *** make a histogram of the source counts in the x and y directions
     2178psHistogram *nX = psHistogramAlloc (graphdata.xmin, graphdata.xmax, 50.0);
     2179psHistogram *nY = psHistogramAlloc (graphdata.ymin, graphdata.ymax, 50.0);
     2180psVectorHistogram (nX, xFaint, NULL, NULL, 0);
     2181psVectorHistogram (nY, yFaint, NULL, NULL, 0);
     2182psVector *dX = psVectorAlloc (nX->nums->n, PS_TYPE_F32);
     2183psVector *vX = psVectorAlloc (nX->nums->n, PS_TYPE_F32);
     2184psVector *dY = psVectorAlloc (nY->nums->n, PS_TYPE_F32);
     2185psVector *vY = psVectorAlloc (nY->nums->n, PS_TYPE_F32);
     2186for (int i = 0; i < nX->nums->n; i++) {
     2187    dX->data.F32[i] = nX->nums->data.S32[i];
     2188    vX->data.F32[i] = 0.5*(nX->bounds->data.F32[i] + nX->bounds->data.F32[i+1]);
     2189}
     2190for (int i = 0; i < nY->nums->n; i++) {
     2191    dY->data.F32[i] = nY->nums->data.S32[i];
     2192    vY->data.F32[i] = 0.5*(nY->bounds->data.F32[i] + nY->bounds->data.F32[i+1]);
     2193}
     2194
     2195graphdata.color = KapaColorByName ("black");
     2196graphdata.ptype = 0;
     2197graphdata.size = 0.0;
     2198graphdata.style = 0;
     2199KapaPrepPlot (myKapa, dX->n, &graphdata);
     2200KapaPlotVector (myKapa, dX->n, dX->data.F32, "x");
     2201KapaPlotVector (myKapa, vX->n, vX->data.F32, "y");
     2202
     2203psFree (nX);
     2204psFree (dX);
     2205psFree (vX);
     2206
     2207psFree (nY);
     2208psFree (dY);
     2209psFree (vY);
    21872210
    21882211
Note: See TracChangeset for help on using the changeset viewer.