IQCalc

class ginga.util.iqcalc_astropy.IQCalc(*args, **kwargs)[source]

Bases: IQCalc

This is ginga.util.iqcalc.IQCalc that uses astropy.

This subclass has an extra self.fitter attribute for astropy fitting.

Methods Summary

calc_fwhm(arr1d[, medv, method_name])

Calculate FWHM for the given input array.

calc_fwhm_gaussian(arr1d[, medv])

FWHM calculation on a 1D array by using least square fitting of a Gaussian function on the data.

calc_fwhm_lorentz(arr1d[, medv])

FWHM calculation on a 1D array by using least square fitting of a Lorentz function on the data.

calc_fwhm_moffat(arr1d[, medv])

FWHM calculation on a 1D array by using least square fitting of a Moffat function on the data.

centroid(data, xc, yc, radius)

Calculate centroid from center of mass.

find_bright_peaks(data[, threshold, sigma, ...])

Find bright peak candidates in in the given data.

gaussian(x, p)

Evaluate Gaussian function in 1D.

lorentz(x, p)

Evaluate Lorentz function in 1D.

moffat(x, p)

Evaluate Moffat function in 1D.

Methods Documentation

calc_fwhm(arr1d, medv=None, method_name='gaussian')[source]

Calculate FWHM for the given input array.

Parameters:
arr1darray-like

1D array cut in either X or Y direction on the object.

medvfloat or None

Median of the data. If not given, it is calculated from arr1d.

method_name{‘gaussian’, ‘moffat’, ‘lorentz’}

Function to use for fitting.

Returns:
resBunch

Fitting results.

Raises:
NotImplementedError

Given function is not supported.

calc_fwhm_gaussian(arr1d, medv=None, **kwargs)[source]

FWHM calculation on a 1D array by using least square fitting of a Gaussian function on the data.

Parameters:
arr1darray-like

1D array cut in either X or Y direction on the object.

medvfloat or None

Median of the data. If not given, it is calculated from arr1d.

kwargsdict

Not used; for backward-compatible API call only.

Returns:
resBunch

Fitting results.

Raises:
IQCalcError

Fitting failed.

calc_fwhm_lorentz(arr1d, medv=None, **kwargs)[source]

FWHM calculation on a 1D array by using least square fitting of a Lorentz function on the data.

Parameters:
arr1darray-like

1D array cut in either X or Y direction on the object.

medvfloat or None

Median of the data. If not given, it is calculated from arr1d.

kwargsdict

Not used; for backward-compatible API call only.

Returns:
resBunch

Fitting results.

Raises:
IQCalcError

Fitting failed.

calc_fwhm_moffat(arr1d, medv=None, **kwargs)[source]

FWHM calculation on a 1D array by using least square fitting of a Moffat function on the data.

Parameters:
arr1darray-like

1D array cut in either X or Y direction on the object.

medvfloat or None

Median of the data. If not given, it is calculated from arr1d.

kwargsdict

Not used; for backward-compatible API call only.

Returns:
resBunch

Fitting results.

Raises:
IQCalcError

Fitting failed.

centroid(data, xc, yc, radius)[source]

Calculate centroid from center of mass.

Parameters:
dataarray-like

Data array.

xc, ycint

X and Y indices of the approximate center.

radiusfloat

Half-width of the region to consider around the given center.

Returns:
x, yfloat

Centroid indices.

Raises:
IQCalcError

Missing dependency.

find_bright_peaks(data, threshold=None, sigma=5, radius=5)[source]

Find bright peak candidates in in the given data.

Parameters:
dataarray-like

Input data to find peaks from.

thresholdfloat or None

Detection threshold. Below this value, an object is not considered a candidate. If not given, a default is calculated using get_threshold() with the given sigma.

sigmafloat

Sigma for the threshold.

radiusfloat

Pixel radius for determining local maxima. If the desired objects are larger in size, specify a larger radius.

Returns:
peakslist of tuple

A list of candidate object coordinate tuples (x, y) in data.

gaussian(x, p)[source]

Evaluate Gaussian function in 1D.

Parameters:
xarray-like

X values.

ptuple of float

Parameters for Gaussian, i.e., (mean, stddev, amplitude).

Returns:
yarray-like

Y values.

lorentz(x, p)[source]

Evaluate Lorentz function in 1D.

Parameters:
xarray-like

X values.

ptuple of float

Parameters for Lorentz, i.e., (x_0, fwhm, amplitude).

Returns:
yarray-like

Y values.

moffat(x, p)[source]

Evaluate Moffat function in 1D.

Parameters:
xarray-like

X values.

ptuple of float

Parameters for Moffat, i.e., (x_0, gamma, alpha, amplitude), where x_0 a.k.a. mean and gamma core width.

Returns:
yarray-like

Y values.