Bases: object
Container class to store parameters for the geometry of an ellipse.
Parameters that describe the relationship of a given ellipse with other associated ellipses are also encapsulated in this container. These associated ellipses may include, e.g., the two (inner and outer) bounding ellipses that are used to build sectors along the elliptical path. These sectors are used as areas for integrating pixel values, when the area integration mode (mean or median) is used.
This class also keeps track of where in the ellipse we are when performing an ‘extract’ operation. This is mostly relevant when using an area integration mode (as opposed to a pixel integration mode)
The center pixel coordinate of the ellipse.
The semimajor axis of the ellipse in pixels.
The ellipticity of the ellipse. The ellipticity is defined as
\[\epsilon = 1 - \frac{b}{a}\]
where a and b are the lengths of the semimajor and semimior axes, respectively.
The position angle (in radians) of the semimajor axis in relation to the positive x axis of the image array (rotating towards the positive y axis). Position angles are defined in the range \(0 < PA <= \pi\). Avoid using as starting position angle of 0., since the fit algorithm may not work properly. When the ellipses are such that position angles are near either extreme of the range, noise can make the solution jump back and forth between successive isophotes, by amounts close to 180 degrees.
The step value for growing/shrinking the semimajor axis. It can be expressed either in pixels (when linear_growth=True
) or as a relative value (when linear_growth=False
). The default is 0.1.
The semimajor axis growing/shrinking mode. The default is False
.
Keep center of ellipse fixed during fit? The default is False.
Keep position angle of semi-major axis of ellipse fixed during fit? The default is False.
Keep ellipticity of ellipse fixed during fit? The default is False.
Methods Summary
Methods Documentation
Compute the semimajor axis of the two ellipses that bound the annulus where integrations take place.
The smaller and larger values of semimajor axis length that define the annulus bounding ellipses.
Find the center of a galaxy.
If the algorithm is successful the (x, y) coordinates in this EllipseGeometry
(i.e., the x0
and y0
attributes) instance will be modified.
The isophote fit algorithm requires an initial guess for the galaxy center (x, y) coordinates and these coordinates must be close to the actual galaxy center for the isophote fit to work. This method provides can provide an initial guess for the galaxy center coordinates. See the Notes section below for more details.
ndarray
The image array. Masked arrays are not recognized here. This assumes that centering should always be done on valid pixels.
The centerer threshold. To turn off the centerer, set this to a large value (i.e., >> 1). The default is 0.1.
Whether to print object centering information. The default is True
.
Notes
The centerer function scans a 10x10 window centered on the (x, y) coordinates in the EllipseGeometry
instance passed to the constructor of the Ellipse
class. If any of the EllipseGeometry
(x, y) coordinates are None
, the center of the input image frame is used. If the center acquisition is successful, the EllipseGeometry
instance is modified in place to reflect the solution of the object centerer algorithm.
In some cases the object centerer algorithm may fail even though there is enough signal-to-noise to start a fit (e.g., objects with very high ellipticity). In those cases the sensitivity of the algorithm can be decreased by decreasing the value of the object centerer threshold parameter. The centerer works by looking where a quantity akin to a signal-to-noise ratio is maximized within the 10x10 window. The centerer can thus be shut off entirely by setting the threshold to a large value (i.e., >> 1; meaning no location inside the search window will achieve that signal-to-noise ratio).
Initialize geometry attributes associated with an elliptical sector at the given polar angle phi
.
This function computes:
the four vertices that define the elliptical sector on the pixel array.
the sector area (saved in the sector_area
attribute)
the sector angular width (saved in sector_angular_width
attribute)
The polar angle (radians) where the sector is located.
ndarray
The x and y coordinates of each vertex as 1D arrays.
Return the two polar angles that bound the sector.
The two bounding polar angles become available only after calling the initialize_sector_geometry()
method.
The smaller and larger values of polar angle that bound the current sector.
Calculate the polar radius for a given polar angle.
The polar angle (radians).
The polar radius (pixels).
Change the direction of semimajor axis growth, from outwards to inwards.
The current step value.
The new semimajor axis length and the new step value to initiate the shrinking of the semimajor axis length. This is the step value that should be used when calling the update_sma()
method.
Return the radius and polar angle in the ellipse coordinate system given (x, y) pixel image coordinates.
This function takes care of the different definitions for position angle (PA) and polar angle (phi):
\[ \begin{align}\begin{aligned}-\pi < PA < \pi\\0 < phi < 2 \pi\end{aligned}\end{align} \]
Note that radius can be anything. The solution is not tied to the semimajor axis length, but to the center position and tilt angle.
The (x, y) image coordinates.
The ellipse radius and polar angle.
Calculate an updated value for the semimajor axis, given the current value and the step value.
The step value must be managed by the caller to support both modes: grow outwards and shrink inwards.
The step value.
The new semimajor axis length.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4