GNU Astronomy Utilities

Next: , Previous: , Up: Modeling basics   [Contents][Index] Defining an ellipse

The PSF, see Point spread function, and galaxy radial profiles are generally defined on an ellipse. Therefore, in this section we’ll start defining an ellipse on a pixelated 2D surface. Labeling the major axis of an ellipse \(a\), and its minor axis with \(b\), the axis ratio is defined as: \(q\equiv b/a\). The major axis of an ellipse can be aligned in any direction, therefore the angle of the major axis with respect to the horizontal axis of the image is defined to be the position angle of the ellipse and in this book, we show it with \(\theta\).

Our aim is to put a radial profile of any functional form \(f(r)\) over an ellipse. Hence we need to associate a radius/distance to every point in space. Let’s define the radial distance \(r_{el}\) as the distance on the major axis to the center of an ellipse which is located at \(i_c\) and \(j_c\) (in other words \(r_{el}\equiv{a}\)). We want to find \(r_{el}\) of a point located at \((i,j)\) (in the image coordinate system) from the center of the ellipse with axis ratio \(q\) and position angle \(\theta\). First the coordinate system is rotated142 by \(\theta\) to get the new rotated coordinates of that point \((i_r,j_r)\):

$$i_r(i,j)=+(i_c-i)\cos\theta+(j_c-j)\sin\theta$$ $$j_r(i,j)=-(i_c-i)\sin\theta+(j_c-j)\cos\theta$$

Recall that an ellipse is defined by \((i_r/a)^2+(j_r/b)^2=1\) and that we defined \(r_{el}\equiv{a}\). Hence, multiplying all elements of the the ellipse definition with \(r_{el}^2\) we get the elliptical distance at this point point located: \(r_{el}=\sqrt{i_r^2+(j_r/q)^2}\). To place the radial profiles explained below over an ellipse, \(f(r_{el})\) is calculated based on the functional radial profile desired.

MakeProfiles builds the profile starting from the nearest element (pixel in an image) in the dataset to the profile center. The profile value is calculated for that central pixel using monte carlo integration, see Sampling from a function. The next pixel is the next nearest neighbor to the central pixel as defined by \(r_{el}\). This process goes on until the profile is fully built upto the truncation radius. This is done fairly efficiently using a breadth first parsing strategy143 which is implemented through an ordered linked list.

Using this approach, we build the profile by expanding the circumference. Not one more extra pixel has to be checked (the calculation of \(r_{el}\) from above is not cheap in CPU terms). Another consequence of this strategy is that extending MakeProfiles to three dimensions becomes very simple: only the neighbors of each pixel have to be changed. Everything else after that (when the pixel index and its radial profile have entered the linked list) is the same, no matter the number of dimensions we are dealing with.



Do not confuse the signs of \(sin\) with the rotation matrix defined in Warping basics. In that equation, the point is rotated, here the coordinates are rotated and the point is fixed.


Next: , Previous: , Up: Modeling basics   [Contents][Index]