Class to fit ellipses.
The sample data to be fitted.
fit([conver, minit, maxit, fflag, maxgerr, …])
Fit an elliptical isophote.
fit(conver=0.05, minit=10, maxit=50, fflag=0.7, maxgerr=0.5, going_inwards=False)¶
Fit an elliptical isophote.
- converfloat, optional
The main convergence criterion. Iterations stop when the largest harmonic amplitude becomes smaller (in absolute value) than
convertimes the harmonic fit rms. The default is 0.05.
- minitint, optional
The minimum number of iterations to perform. A minimum of 10 (the default) iterations guarantees that, on average, 2 iterations will be available for fitting each independent parameter (the four harmonic amplitudes and the intensity level). For the first isophote, the minimum number of iterations is 2 *
minitto ensure that, even departing from not-so-good initial values, the algorithm has a better chance to converge to a sensible solution.
- maxitint, optional
The maximum number of iterations to perform. The default is 50.
- fflagfloat, optional
The acceptable fraction of flagged data points in the sample. If the actual fraction of valid data points is smaller than this, the iterations will stop and the current
Isophotewill be returned. Flagged data points are points that either lie outside the image frame, are masked, or were rejected by sigma-clipping. The default is 0.7.
- maxgerrfloat, optional
The maximum acceptable relative error in the local radial intensity gradient. This is the main control for preventing ellipses to grow to regions of too low signal-to-noise ratio. It specifies the maximum acceptable relative error in the local radial intensity gradient. Busko (1996; ASPC 101, 139) showed that the fitting precision relates to that relative error. The usual behavior of the gradient relative error is to increase with semimajor axis, being larger in outer, fainter regions of a galaxy image. In the current implementation, the
maxgerrcriterion is triggered only when two consecutive isophotes exceed the value specified by the parameter. This prevents premature stopping caused by contamination such as stars and HII regions.
A number of actions may happen when the gradient error exceeds
maxgerr(or becomes non-significant and is set to
None). If the maximum semimajor axis specified by
maxsmais set to
None, semimajor axis growth is stopped and the algorithm proceeds inwards to the galaxy center. If
maxsmais set to some finite value, and this value is larger than the current semimajor axis length, the algorithm enters non-iterative mode and proceeds outwards until reaching
maxsma. The default is 0.5.
- going_inwardsbool, optional
Parameter to define the sense of SMA growth. When fitting just one isophote, this parameter is used only by the code that defines the details of how elliptical arc segments (“sectors”) are extracted from the image, when using area extraction modes (see the
integrmodeparameter in the
EllipseSampleclass). The default is
The fitted isophote, which also contains fit status information.
>>> from photutils.isophote import EllipseSample, EllipseFitter >>> sample = EllipseSample(data, sma=10.) >>> fitter = EllipseFitter(sample) >>> isophote = fitter.fit()