EllipticalSource

class sofia_redux.scan.source_models.beams.elliptical_source.EllipticalSource(peak=1.0, x_mean=0.0, y_mean=0.0, x_fwhm=0.0, y_fwhm=0.0, theta=<Quantity 0. deg>, peak_unit=None, position_unit=None, gaussian_model=None)[source]

Bases: GaussianSource

Initialize an EllipticalSource model.

The elliptical source is used to represent a Gaussian source using elliptical parameters such as major/minor FWHM, elongation and rotation.

Parameters:
peakfloat or units.Quantity, optional

The peak amplitude of the Gaussian.

x_meanfloat or units.Quantity, optional

The position of the peak along the x-axis.

y_meanfloat or units.Quantity, optional

The position of the peak along the y-axis.

x_fwhmfloat or units.Quantity, optional

The Full-Width-Half-Max beam width in the x-direction.

y_fwhmfloat or units.Quantity, optional

The Full-Width-Half-Max beam width in the y-direction.

thetafloat or units.Quantity, optional

The rotation of the beam pertaining to x_fwhm and y_fwhm in relation to the actual (x, y) coordinate axis. If a float value is supplied, it is assumed to be in degrees.

peak_unitunits.Unit or units.Quantity or str, optional

The physical units for the peak amplitude. The default is dimensionless.

position_unitunits.Unit or units.Quantity or str, optional

The physical units of all position based parameters (x_mean, y_mean, x_fwhm, y_fwhm)

gaussian_modelGaussian2D, optional

If supplied, extracts all the above parameters from the supplied model.

Attributes Summary

angle

Return the angle of the ellipse.

angle_rms

Return the rms of the angle.

elongation_rms

Return the RMS of the elongation.

major_fwhm

Return the major FWHM of the Gaussian ellipse.

major_fwhm_rms

Return the major FWHM RMS.

major_fwhm_weight

Return the major FWHM weight (1/variance) of the Gaussian ellipse.

minor_fwhm

Return the minor FWHM of the Gaussian ellipse.

minor_fwhm_rms

Return the minor FWHM RMS.

minor_fwhm_weight

Return the minor FWHM weight (1/variance) of the Gaussian ellipse.

Methods Summary

edit_header(header[, fits_id, beam_name, ...])

Edit a FITS header with the elliptical beam parameters.

find_source_extent(image[, max_iterations, ...])

Find the extent of the source and shape.

fit_map_least_squares(map2d[, degree, ...])

Fit the Gaussian to a given map using LSQ method (adaptTo).

get_data(map2d[, size_unit])

Return a dictionary of properties for to the source model on a map.

measure_shape(image[, min_radius_scale, ...])

Measure the shape of an elliptical source on an image.

pointing_info(map2d)

Return a list of strings with pointing information.

set_elongation([major, minor, weight, angle])

Set the elongation parameter.

Attributes Documentation

angle

Return the angle of the ellipse.

Returns:
angleunits.Quantity
angle_rms

Return the rms of the angle.

Returns:
angle_rmsunits.Quantity
elongation_rms

Return the RMS of the elongation.

Returns:
elongation_rmsfloat
major_fwhm

Return the major FWHM of the Gaussian ellipse.

Returns:
majorunits.Quantity
major_fwhm_rms

Return the major FWHM RMS.

Returns:
major_rmsfloat or units.Quantity
major_fwhm_weight

Return the major FWHM weight (1/variance) of the Gaussian ellipse.

Returns:
major_weightfloat or units.Quantity
minor_fwhm

Return the minor FWHM of the Gaussian ellipse.

Returns:
minorunits.Quantity
minor_fwhm_rms

Return the minor FWHM RMS.

Returns:
minor_rmsfloat or units.Quantity
minor_fwhm_weight

Return the minor FWHM weight (1/variance) of the Gaussian ellipse.

Returns:
minor_weightfloat or units.Quantity

Methods Documentation

edit_header(header, fits_id='', beam_name=None, size_unit=None)[source]

Edit a FITS header with the elliptical beam parameters.

Parameters:
headerastropy.io.fits.header.Header

The FITS header to edit.

fits_idstr, optional

Not used.

beam_namestr, optional

The name of the beam.

size_unitastropy.units.Unit or Quantity or str, optional

If set, convert the major/minor beam values to this unit before setting in the header.

Returns:
None
find_source_extent(image, max_iterations=40, radius_increment=1.1, tolerance=0.05)[source]

Find the extent of the source and shape.

Parameters:
imageFlaggedArray
max_iterationsint, optional

The maximum number of iterations, each of which increases the search radius by radius_increment.

radius_incrementfloat, optional

The factor by which to increase the search radius between iterations.

tolerancefloat, optional

Halt iterations if the change in data sum is less than 1 + tolerance between iterations.

Returns:
None
fit_map_least_squares(map2d, degree=3, reduce_degrees=False)[source]

Fit the Gaussian to a given map using LSQ method (adaptTo).

Parameters:
map2dMap2D or Observation2D
degreeint, optional

The spline degree used to fir the map peak value.

reduce_degreesbool, optional

If True, allow the spline fit to reduce the number of degrees in cases where there are not enough points available to perform the spline fit of degree. If False, a ValueError will be raised if such a fit fails.

Returns:
data_sumfloat

The sum of the source withing the source radius.

get_data(map2d, size_unit=None)[source]

Return a dictionary of properties for to the source model on a map.

The key values returned are:

  • peak: The fitted peak value

  • dpeak: The fitted peak value RMS

  • peakS2N: The peak signal-to-noise ratio

  • int: The integral of the peak on the map

  • dint: The integral rms of the peak on the map

  • intS2N: The significance of the peak on the map

  • FWHM: The full-width-half maximum of the peak

  • dFWHM: The full-width-half-maximum RMS of the peak

  • a: The major FWHM

  • b: The minor FWHM

  • da: The major FWHM RMS

  • db: The minor FWHM RMS

  • angle: The rotation of the major axis

  • dangle: The RMS of the rotation of the major axis

Parameters:
map2dMap2D

The map for which to calculate an integral.

size_unitunits.Unit or str, optional

If set, converts FWHM and dFWHM to size_unit.

Returns:
dict
measure_shape(image, min_radius_scale=0.0, max_radius_scale=1.5)[source]

Measure the shape of an elliptical source on an image.

Parameters:
imageFlaggedArray
min_radius_scalefloat, optional
max_radius_scalefloat, optional
Returns:
None
pointing_info(map2d)[source]

Return a list of strings with pointing information.

Parameters:
map2dMap2d
Returns:
list (str)
set_elongation(major=None, minor=None, weight=inf, angle=None)[source]

Set the elongation parameter.

Parameters:
majorfloat or astropy.units.Quantity, optional

The major axis of the ellipse. If not supplied defaults to the fwhm of the Gaussian in the x-direction.

minorfloat or astropy.units.Quantity, optional

The minor axis of the ellipse. If not supplied defaults to the fwhm of the Gaussian in the y-direction.

weightfloat or astropy.units.Quantity, optional

The weight (inverse variance) of the elongation. If not supplied defaults to infinity (exact).

anglefloat or astropy.units.Quantity, optional

The angle of the principle axis. If not supplied defaults to the position angle of the Gaussian. If a float value is supplied, is assumed to be in radians.

Returns:
None