- Timestamp:
- Sep 19, 2009, 8:49:41 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotVisual.c
r25433 r25452 2094 2094 } 2095 2095 2096 bool psphotVisualShowPetrosian (pmSource *source, pmPetrosian *petrosian) { 2097 2098 KiiOverlay overlay[2]; 2099 2100 if (source == NULL) return true; 2096 bool psphotVisualShowPetrosians (psArray *sources) { 2097 2098 int Noverlay, NOVERLAY; 2099 KiiOverlay *overlay; 2101 2100 2102 2101 // if (!pmVisualIsVisual()) return true; … … 2105 2104 if (kapa == -1) return false; 2106 2105 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 } 2129 2152 2130 2153 return true; … … 2152 2175 2153 2176 # if (0) 2154 // *** make a histogram of the source counts in the x and y directions2155 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 2178 psHistogram *nX = psHistogramAlloc (graphdata.xmin, graphdata.xmax, 50.0); 2179 psHistogram *nY = psHistogramAlloc (graphdata.ymin, graphdata.ymax, 50.0); 2180 psVectorHistogram (nX, xFaint, NULL, NULL, 0); 2181 psVectorHistogram (nY, yFaint, NULL, NULL, 0); 2182 psVector *dX = psVectorAlloc (nX->nums->n, PS_TYPE_F32); 2183 psVector *vX = psVectorAlloc (nX->nums->n, PS_TYPE_F32); 2184 psVector *dY = psVectorAlloc (nY->nums->n, PS_TYPE_F32); 2185 psVector *vY = psVectorAlloc (nY->nums->n, PS_TYPE_F32); 2186 for (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 } 2190 for (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 2195 graphdata.color = KapaColorByName ("black"); 2196 graphdata.ptype = 0; 2197 graphdata.size = 0.0; 2198 graphdata.style = 0; 2199 KapaPrepPlot (myKapa, dX->n, &graphdata); 2200 KapaPlotVector (myKapa, dX->n, dX->data.F32, "x"); 2201 KapaPlotVector (myKapa, vX->n, vX->data.F32, "y"); 2202 2203 psFree (nX); 2204 psFree (dX); 2205 psFree (vX); 2206 2207 psFree (nY); 2208 psFree (dY); 2209 psFree (vY); 2187 2210 2188 2211
Note:
See TracChangeset
for help on using the changeset viewer.
