sourcefinder.extract#

Source Extraction Helpers.

These are used in conjunction with image.ImageData.

Attributes#

Classes#

Detection

Propagate a measurement in pixel space to celestial coordinates.

Island

The source extraction process forms islands, which it then fits.

ParamSet

All the source fitting methods should go to produce a

Functions#

first_part_of_celestial_coordinates(ra_dec, ...)

First part of celestial coordinates.

insert_sources_and_noise(some_image, noise_map, inds, ...)

Insert sources and noise.

source_measurements_vectorised(num_islands, npixs, ...)

Source measurements (vectorised).

source_profile_and_errors(data, threshold, rms, noise, ...)

Return a number of measurable properties with errorbars.

Module Contents#

class sourcefinder.extract.Detection(paramset, imagedata, chunk=None)[source]#

Bases: object

Propagate a measurement in pixel space to celestial coordinates.

A source measurement is primarily done in pixel space, this includes the parameters peak spectral brightness, position and (Gaussian) shape, but also derived quanities such as flux density, signal-to-noise ratio and (reduced) chi-squared of the Gaussian model. On top of that, the Gaussian shape parameters have to be deconvolved from the clean beam, if the source is resolved. This adds up to a total of ten source parameters that have to be supplemented with their 1-sigma error bars: 1) peak spectral brightness 2) integrated flux density 3) x-coordinate in pixel space 4) y-coordinate in pixel space 5) semi-major axis in pixel space 6) semi-minor axis in pixel space 7) position angle in radians 8) deconvolved semi-major axis in pixel space 9) deconvolved semi-minor axis in pixel space 10) deconvolved position angle in radians

Quantities 3 through 10 all have to be converted to celestial coordinates.

Parameters:
paramseta ParamSet instance

The measurement of the source, reflected by Gaussian model parameters supplemented with some auxiliary quantities.

imagedataan image.ImageData instance

The actual pixel data from the input image are not used here, we simply need the wcs attribute that is needed to convert to celestial coordinates.

chunktuple of slices, default: None

The rectangular region of the image encompassing the source pixels above the analysis threshold.

eps_rafloat, default: 0

The calibration error in right ascension in degrees following equation 27a of the NVSS paper (Condon et al. 1998, AJ, 115, 1693).

eps_decfloat, default: 0

The calibration error in declination in degrees following equation 27b of the NVSS paper (Condon et al. 1998, AJ, 115, 1693).

Attributes:
peakUncertain instance

The peak spectral brightness of the source in the units used in the image, typically Jy/beam.

fluxUncertain instance

The integrated flux density of the source, typically in Jy.

xUncertain instance

The x-coordinate of the source in pixel space.

yUncertain instance

The y-coordinate of the source in pixel space.

smajUncertain instance

The semi-major axis of the source in units of pixels.

sminUncertain instance

The semi-minor axis of the source in units of pixels.

thetaUncertain instance

The position angle of the major axis in radians, measured from the positive y-axis towards the negative x-axis.

dc_impossint

The number of elliptical axes that could not be deconvolved, minimum = 0, maximum = 2

smaj_dcUncertain instance

The deconvolved semi-major axis of the source in units of pixels.

smin_dcUncertain instance

The deconvolved semi-minor axis of the source in units of pixels.

theta_dcUncertain instance

The deconvolved position angle of the source in degrees.

error_radiusfloat or None

A pessimistic estimate of the 1-sigma positional uncertainty, in arcseconds.

gaussianbool

Indicates whether the measurement is based on a Gaussian fit.

chisqfloat

The chi-squared value of the Gaussian model relative to the data. Can be a Gaussian model derived from a fit or from moments.

reduced_chisqfloat

The reduced chi-squared value of the Gaussian model relative to the data. Can be a Gaussian model derived from a fit or from moments.

sigfloat

The significance of a detection is defined as the maximum signal-to-noise ratio across the island. Often this will be the ratio of the maximum pixel value within the source island divided by the noise at that position.

imagedataan image.ImageData instance

This instance contains the observational image data, as well as the objects that describe how that data should be perceived, e.g. the resolving beam and the WCS information.

chunktuple of slices or None, default: None

The rectangular region of the image encompassing the source pixels above the analysis threshold.

eps_rafloat, default: 0

Extra positional uncertainty (degrees) from calibration errors along right ascension, following equation 27a from the NVSS paper.

eps_decfloat, default: 0

Extra positional uncertainty (degrees) from calibration errors along declination, following equation 27b from the NVSS paper.

_physical_coordinates()[source]#

Convert the pixel parameters for this object into something physical.

distance_from(x, y)[source]#

Distance from the center.

serialize(conf=Conf, every_parm=False)[source]#

Return source properties suitable for database storage.

We manually add ew_sys_err, ns_sys_err as defined in conf.image.

Parameters:
confConf, default: Conf

Configuration object for customizing the parameters to be included.

every_parmbool, default: False

If True, return every parameter from conf.export.source_params, if False, return only the parameters from conf.export.source_params_file.

Returns:
list

A list with all entries from either conf.export.source_params or conf.export.source_params_file.

chisq[source]#
chunk = None[source]#
dc_imposs[source]#
eps_dec[source]#
eps_ra[source]#
error_radius = None[source]#
flux[source]#
gaussian[source]#
imagedata[source]#
peak[source]#
reduced_chisq[source]#
sig[source]#
smaj[source]#
smaj_dc[source]#
smin[source]#
smin_dc[source]#
theta[source]#
theta_dc[source]#
x[source]#
y[source]#
class sourcefinder.extract.Island(data, rms, chunk, detection_map, beam, image_conf, analysis_threshold=None, rms_orig=None, flux_orig=None, subthrrange=None)[source]#

Bases: object

The source extraction process forms islands, which it then fits.

Each island needs to know its position in the image (ie, x, y pixel value at one corner), the threshold above which it is detected (analysis_threshold by default, but will increase if the island is the result of deblending), and a data array.

The island should provide a means of deblending: splitting itself apart and returning multiple sub-islands, if necessary.

Parameters:
datandarray

A 2D array representing the rectangular patch of the observational image encompassing the island. Values as small as -BIGNUM denote pixels outside the island, they will typically be in the corners of the patch.

rmsMaskedArray

A 2D masked array representing the patch of the rms noise map, corresponding to the same pixel positions as data. The values are interpolated from a grid of standard deviations of the background noise across the image.

chunktuple of slices

Defines the corners of the patch encompassing the island as a tuple of slices.

detection_mapMaskedArray

A 2D masked array corresponding to the same patch of the sky as data, but applied to the detection threshold map. Typically a higher threshold than the analysis threshold map.

beamtuple of floats

The clean beam parameters as the semi-major and semi-minor axes in pixel coordinates and the position angle in radians.

image_confconfig.ImgConf

Holds the configuration parameters for observational image processing.

analysis_thresholdfloat, default: None

The analysis threshold, when multiplied with the local rms noise, segments the observational image - with the mean background subtracted - into islands. Only applied in the deblending process, then it will be set to 1.0.

rms_origMaskedArray, default: None

The original rms noise of the island.

flux_origfloat, default: None

The original flux value of the island.

subthrrangendarray, default: None

The subthreshold range for deblending.

deblend(niter=0)[source]#

Decompose the island into subislands.

Parameters:
niterint, default: 0

A value of niter corresponds to a subthreshold level. There will be self.deblend_nthresh subthresholds in total, evenly spaced logarithmically, between the lowest and highest pixel value, but not include these limits. niter==0 corresponds to the lowest subthreshold, i.e. to the subthreshold just above self.data.min().

Returns:
numpy.ndarray

A decomposed numpy array of all the subislands.

Notes

This function iterates up through subthresholds, looking for the island to split into two or more separate islands. If splitting occurs, the function starts again with the new subislands.

fit(fudge_max_pix_factor, beamsize, correlation_lengths, fixed=None)[source]#

Fit.

Measure the source, i.e. compute its Gaussian parameters and the corresponding errors.

Parameters:
fudge_max_pix_factorfloat

Factor to correct for the underestimation of the peak spectral brightness, since that peak will in general be positioned some small angular distance from the center of the pixel with the highest spectral brightness.

beamsizefloat

The size of the clean beam, in square pixels.

correlation_lengthstuple

2 floats describing over which distance (in pixels) noise should be considered correlated, along both principal axes of the Gaussian profile of the restoring beam. This has to be taken into account when errors on source parameters are derived.

fixeddict, default: None

Parameters & their values to be kept frozen (ie, not fitted).

Returns:
tuple

A tuple containing the measurement as a Paramset instance and a Gaussian island and a Gaussian residual, both as regular ndarrays. In those ndarrays masked (unfitted) regions have been filled with 0-values, typically in the corners of the rectangular area encompassing the island.

noise()[source]#

Noise at position of the island pixel with the highest spectral brightness.

sig()[source]#

Source significance expressed as the maximum signal-to-noise across the island.

threshold()[source]#

Threshold for island segmentation.

It is expressed as the rms noise at the position of the island’s pixel with the highest spectral brightness times the analysis threshold.

beam[source]#
chunk[source]#
data[source]#
deblend_mincont[source]#
deblend_nthresh[source]#
detection_map[source]#
image_conf[source]#
max_pos[source]#
position[source]#
rms[source]#
structuring_element[source]#
class sourcefinder.extract.ParamSet(image_conf: sourcefinder.config.ImgConf | None = None)[source]#

Bases: collections.abc.MutableMapping

All the source fitting methods should go to produce a ParamSet, which gives all the information necessary to make a Detection.

Parameters:
image_confconfig.ImgConf

Holds the configuration parameters for observational image processing.

Parameters:

image_conf (sourcefinder.config.ImgConf | None)

_condon_formulae(noise, correlation_lengths)[source]#

Returns the errors on parameters from Gaussian fits.

The errors are according to the Condon (PASP 109, 166 (1997)) formulae.

These formulae are not perfect, but we’ll use them for the time being. (See Refregier and Brown (astro-ph/9803279v1) for a more rigorous approach.) It also returns the corrected peak. The peak is corrected for the overestimate due to the local noise gradient.

Parameters:
noisefloat

The noise level at the position of the island pixel with the highest spectral brightness.

correlation_lengthstuple of floats

Tuple describing over which distance (in pixels) noise should be considered correlated, along both principal axes of the Gaussian profile of the restoring beam.

Returns:
ParamSet

The updated ParamSet instance with calculated errors.

_error_bars_from_moments(noise, correlation_lengths, threshold)[source]#

Provide 1-sigma error bars for source parameters derived from moments

Parameters:
noisefloat

The noise level at the position of the island pixel with the highest spectral brightness.

correlation_lengthstuple of floats

Tuple describing over which distance (in pixels) noise should be considered correlated, along both principal axes of the Gaussian profile of the restoring beam.

thresholdfloat

The threshold for island segmentation expressed as the rms noise at the position of the island’s pixel with the highest spectral brightness times the analysis threshold.

Returns:
ParamSet

The updated ParamSet instance with calculated errors.

calculate_errors(noise, correlation_lengths, threshold)[source]#

Calculate 1-sigma error bars for the source parameters.

This method uses the Condon formulae if the object is based on a Gaussian fit, or error bars from moments if it’s based on moments.

Parameters:
noisefloat

The noise level at the position of the island pixel with the highest spectral brightness.

correlation_lengthstuple of floats

Tuple describing over which distance (in pixels) noise should be considered correlated, along both principal axes of the Gaussian profile of the restoring beam.

thresholdfloat

The threshold for island segmentation expressed as the rms noise at the position of the island’s pixel with the highest spectral brightness times the analysis threshold.

Returns:
An updated ParamSet instance
compute_bounds(data_shape)[source]#

Calculate bounds for ‘safer’ Gauss fitting.

Here, ‘safer’ means a smaller chance on runaway solutions. The bounds are largely based on moments estimation, so it only makes sense to impose bounds if moments estimation was successful.

Parameters:
data_shapetuple of (int32, int32) or (int64, int64)

Shape of the rectangular area (slice) encompassing the island used for the fit. This shape is used to set bounds for the position of the source in the fitting process, i.e. the position is bounded to be within this shape.

Returns:
dict of (float, float, bool) tuples

Bounds for a maximum of six Gaussian fit parameters, less if “fixed” is not None. Each 3-tuple has lower_bound (float), upper_bound (float) and boolean elements. If the boolean is True, a bound will be loosened when the fit becomes unfeasible. See the documentation on scipy.optimize.Bounds for details.

deconvolve_from_clean_beam(beam)[source]#

Deconvolve from the clean beam.

Parameters:
beamtuple of floats

The clean beam parameters as the semi-major and semi-minor axes in pixel coordinates and the position angle in radians.

Returns:
ParamSet

The updated ParamSet instance with deconvolved Gaussian shape parameters, i.e. the semi-major and semi-minor axes and the position angle.

keys()[source]#

D.keys() -> a set-like object providing a view on D’s keys

alpha_brightness1[source]#
alpha_brightness2[source]#
alpha_maj1[source]#
alpha_maj2[source]#
alpha_min1[source]#
alpha_min2[source]#
bounds: dict[str, tuple[float, float, bool]][source]#
chisq = None[source]#
clean_bias[source]#
clean_bias_error[source]#
deconv_imposs = 2[source]#
frac_flux_cal_error[source]#
gaussian = False[source]#
image_conf[source]#
measurements[source]#
moments = False[source]#
reduced_chisq = None[source]#
sig = None[source]#
thin_detection = True[source]#
sourcefinder.extract.first_part_of_celestial_coordinates(ra_dec, endy_ra_dec, xbar_ybar_error, xbar_ybar_smaj_smin_theta, dummy, return_values)[source]#

First part of celestial coordinates.

Similar to func:extract.Detection._physical_coordinates, but vectorized and mainly the first part, until we need another call to wcs.all_pix2world, based on the output from this part. What we have learned from moments_enhanced is that measuring the islands can be done very rapidly, by vectorizing the measurements rather than parallellizing, although one can do both by using the guvectorize decorator from Numba. Contrary to vectorizing moments, vectorizing the transformation to celestial coordinates is harder, since it involves wcs.wcs_pix2world from Astropy, which Numba cannot compile. The way out of this is to use wcs.all_pix2world from Astropy, which is a fast vectorized function, but this has to be done outside the routine compiled by Numba, i.e. this routine. We will be needing a number of calls to wcs.all_pix2world to traverse all the steps from extract.Detection._physical_coordinates.

Parameters:
ra_decnp.ndarray

Array of floats of length 2, containing the right ascension (degrees) and the declination (degrees) corresponding to [xbar, ybar] of the source.

endy_ra_decnp.ndarray

Array of floats of length 2, containing the right ascension (degrees) and the declination (degrees) corresponding to [xbar, ybar + 1] of the source.

xbar_ybar_errornp.ndarray

Array of floats of length 2, with the errors on the barycentric positions, in pixel coordinates, in both dimensions.

xbar_ybar_smaj_smin_thetanp.ndarray

Array of floats of length 5, with the barycentric positions, the semi-major and semi-minor axes, all in pixel coordinates and the position angles, in radians.

dummynp.ndarray

Same shape as return_values, to accommodate for a missing feature in the guvectorize decorator, i.e. this is a trick to pass on information about the shape of the output array.

return_valuesnp.ndarray

Strictly speaking nothing is returned, because of the guvectorize decorator, but return_values is filled with xerror_proj, yerror_proj, yoffset_angle, end_smaj_x, start_smaj_x, end_smaj_y, start_smaj_y, end_smin_x, start_smin_x, end_smin_y and start_smin_y.

Returns:
None

This method does not return anything. The results are stored in the return_values array.

sourcefinder.extract.insert_sources_and_noise(some_image, noise_map, inds, labelled_data, label, npix, source, noise, xpos, ypos, min_width)[source]#

Insert sources and noise.

We want to copy the relevant source and noise data into input arrays for measuring.moments_enhanced. Simultaneously calculate the minimum width of each island; when determining source properties this is an important integer, i.e. with sufficient width all six Gaussian parameters can be calculated in a robust manner.

Parameters:
some_imagenp.ndarray

The 2D ndarray with all the pixel values, typically image.ImageData().data_bgsubbed.data.

noise_mapnp.ndarray

The 2D ndarray with all the noise values, i.e. an estimate of the standard deviation of the background pixels, from an interpolation across the background grid, centered on subimages. Typically image.ImageData().rmsmap.data.

indsnp.ndarray

A ndarray of four indices indicating the slice encompassing an island. Such a slice would typically be a pick from a list of slices from a call to scipy.ndimage.find_objects. Since we are attempting vectorized processing here, the slice should have been replaced by its four coordinates through a call to image.ImageData.slices_to_indices.

labelled_datanp.ndarray

A ndarray with the same shape as some_image, with labelled islands with integer values and zeroes for all background pixels.

labelint

The label (integer value) indicates the island we are processing since the pixel positions of the island are determined by labelled_data==label.

npixint

Number of pixels comprising the island we are processing. The island pixel positions are determined by labelled_data==label.

sourcenp.ndarray

1D ndarray of float32 pixel values of the island with label = label. Length= maxpix, the number of pixels in the largest possible island, indicating that there will be a number of unassigned values for the highest indices, for some islands.

noisenp.ndarray

1D ndarray of float32 rms noise values - local estimates of the standard deviation of the background noise - of the island with label = label. Length= maxpix, the number of pixels in the largest possible island, indicating that there will be a number of unassigned values for the highest indices, for some islands.

xposnp.ndarray

1D ndarray of integers indicating the row indices of the pixels of the island with label = label, relative to the position of pixel [0, 0] of the rectangular slice encompassing the island. Must have same order as pixel values in island. Length = maxpix, the number of pixels in the largest possible island, indicating that there will be a number of unassigned values for the highest indices.

yposnp.ndarray

1D ndarray of integers indicating the column indices of the pixels of the island with label = label, relative to the position of pixel [0, 0] of the rectangular slice encompassing the island. Must have same order as pixel values in island. Length = maxpix, the number of pixels in the largest possible island, indicating that there will be a number of unassigned values for the highest indices.

min_widthint

int32 indicating the minimum width of the island, in order to assess whether the island has sufficient width to determine Gaussian parameters. Calculated from the maximum widths of the island over x and y and subsequently taking the minimum of those two maximum widths.

Returns:
None

No return values, because of the use of the guvectorize decorator: ‘guvectorize() functions don’t return their result value: they take it as an array argument, which must be filled in by the function’. In this case source, noise, xpos, ypos and min_width will be filled with values.

sourcefinder.extract.source_measurements_vectorised(num_islands, npixs, maxposs, maxis, data_bgsubbeddata, rmsdata, analysisthresholddata, indices, labelled_data, labels, wcs, fudge_max_pix_factor, beam, beamsize, correlation_lengths, conf)[source]#

Source measurements (vectorised).

From islands of pixels above the analysis threshold with peaks above the detection threshold source parameters are extracted, including error bars. These quantities are transformed to celestial coordinates in a vectorized way, making it suitable for tens of thousands of sources per image. Per island one can extract a maximum of 10 quantities: peak spectral brightness, flux density, i.e. the spectral brightness integrated over the source, position in the sky along both axes and the source shape parameters: semi-major and semi-minor axes and the position angle of the major axis, measured east from local north. The latter three quantities can be deconvolved from the clean beam if the source is resolved. That gives a total of 20 numbers, 10 measurements and their error bars. 8 of these have to be transformed to celestial coordinates, which adds another 16 numbers. This function is a duplicate of code elsewhere, in particular of ‘measuring.moments’ and ‘extract.Detection._physical_coordinates’ but with a data layout suitable for vectorisation.

Parameters:
num_islandsint

Number of islands detected.

npixsnp.ndarray

1D int32 array of length num_islands representing the number of pixels comprising every island.

maxpossnp.ndarray

2D int32 array of shape (num_islands, 2) with the peak positions per island.

maxisnp.ndarray

1D float32 array of length num_islands with the peak pixel values corresponding to the maxposs positions.

data_bgsubbeddatanp.ndarray

2D float32 array representing the image. These are the data of image.ImageData().data_bgsubbed, i.e. ImageData().data_bgsubbed.data, without the mask, since we assume that any mask has already been properly propagated in selecting the islands pixels. The interpolated mean background has been subtracted from the image data.

rmsdatanp.ndarray

2D float32 or float64 array, same shape as the image (data_bgsubbeddata). rms is jargon in image processing, it refers to “Root mean square”, but is taken as the standard deviation of the background noise. The standard deviation of the background noise is determined after kappa, sigma clipping subimages of appropriate size and interpolating this across the image while including masks. This is image.ImageData().rmsmap.data, i.e. without the mask, since we assume that any mask has already been properly propagated in selecting the islands pixels.

analysisthresholddatanp.ndarray

2D float32 or float64 array, same shape as data_bgsubbeddata. These are the data of the analysisthresholdmap, i.e. analysisthresholdmap.data, without the mask, since we assume that any mask has already been properly propagated in the process of selecting the island pixels.

indicesnp.ndarray

2D int32 array of shape (num_islands, 4) representing positions of the corners of the “chunks”, i.e. slices encompassing every island, relative to upper left corner of the image, i.e. relative to array element [0,0] of data_bgsubbeddata.

labelled_datanp.ndarray

2D int32 array of shape data_bgsubbeddata.shape, representing all unmasked island pixels above the analysis threshold, with labels (integers) > 0. All background or masked pixels from image.ImageData().data_bgsubbed should have value (label) = 0.

labelsnp.ndarray

1D int32 or int64 array representing the labels in labelled_data corresponding to islands in data_bgsubbeddata that have peak values above the local detection threshold. Thus, it is a subset of np.unique( labelled_data) because the ‘insignificant’ islands have been filtered out, i.e. the islands above the analysis threshold with peak values below the (local) detection threshold. Also, labels does not contain the zero label corresponding to background or masked pixels in ImageData.data_bgsubbed.

wcsutility.coordinates.wcs

A utility.coordinates.wcs instance, filled with appropriate values from the image header, issued e.g. through accessors.fitsimage.FitSImage. With numbers representing the center of the image and the width of the pixels in celestial coordinates plus the type of projection used, we can transform from pixel coordinates to celestial coordinates.

fudge_max_pix_factorfloat

Correction for the underestimate of the true peak when the maximum pixel method is used. It is a statistical correction, so on average correct over a large ensemble of unresolved sources, when a circular restoring beam is appropriate.

beamtuple

Three floats describing the restoring beam in terms of its semi-major and semi-minor axes (in pixels) and the position angle of the semi-major axis, east from local north, in radians.

beamsizefloat

Area of the restoring beam, in square pixels.

correlation_lengthstuple

Two floats describing over which distance (in pixels) noise should be considered correlated, along both principal axes of the Gaussian profile of the restoring beam.

confconfig.Conf instance

Configuration options for source finding. This includes settings related to image processing (e.g., background and rms noise estimation, thresholds) as well as export options (e.g., source parameters and output maps).

Returns:
moments_of_sourcesnp.ndarray

3D float32 array, with a row index corresponding to each island, i.e. num_islands rows, a 0 and 1 column index corresponding to values and their error bars, respectively and a third index [0…9] which represents the measurements of the sources, i.e. peak spectral brightness, in Jy/beam and the integrated spectral brightness a.k.a. flux density in Jy. All the other numbers in moments_of_sources are in pixel coordinates. These are position on the sky, along both image axes, semi-major and semi-minor axis of the Gaussian profile of the source and the position angle of the major axis (in radians) measured from the positive y-axis towards the positive x-axis. These three Gaussian profile parameters can be deconvolved from the clean beam if the source is resolved. This adds up to ten quantities and corresponding error bars for each island. Note that the deconvolved position angle is in degrees, not in radians.

sky_barycentersnp.ndarray

(num_islands, 2) array of floats: each row has an entry for right ascension (degrees, float64) and declination (degrees, float64).

chunk_positionsnp.ndarray

(num_islands, 2) array of integers denoting the indices that correspond to the upper left corners of the islands. They are used in this module and returned to the calling module. However, their return is only useful if the user requires a residual map.

ra_errorsnp.ndarray
1D float64 array of uncertainties (degrees) corresponding to the first

column in sky_barycenters.

dec_errorsnp.ndarray

1D float64 array of uncertainties (degrees) corresponding to the second column in sky_barycenters.

error_radiinp.ndarray

1D float64 array representing an absolute error bar (arcseconds) on the position of every source. This is an important quantity to associate an observation of a source with its previous observations.

smaj_asecnp.ndarray

1D float64 array representing the convolved semi-major axes - i.e. not deconvolved from the restoring beam - transformed from pixel coordinates to celestial coordinates, in arcseconds.

errsmaj_asecnp.ndarray

1D float64 array representing the 1-sigma error bars of the convolved semi-major axes, in arcseconds.

smin_asecnp.ndarray

1D float64 array representing the convolved semi-minor axes - i.e. not deconvolved from the restoring beam - transformed from pixel coordinates to celestial coordinates, in arcseconds.

errsmin_asecnp.ndarray

1D float64 array representing the 1-sigma error bars of the convolved semi-minor axes, in arcseconds.

theta_celes_valuesnp.ndarray

1D float32 array representing the position angles of the semi-major axes of the convolved Gaussian profiles, i.e. not yet deconvolved from the restoring beam, in degrees.

theta_celes_errorsnp.ndarray

1D float32 array representing the 1-sigma error bars of the position angles of the semi-major axes of the convolved Gaussian profiles, in degrees.

theta_dc_celes_valuesnp.ndarray

1D float32 array representing the position angles of the semi-major axes of the deconvolved Gaussian profiles, i.e. deconvolved from the restoring beam, in degrees.

theta_dc_celes_errorsnp.ndarray

1D float32 array representing the 1-sigma error bars of the position angles of the semi-major axes of the deconvolved Gaussian profiles, in degrees.

Gaussian_islands_mapnp.ndarray

2D float32 array with the same shape as data_bgsubbed from the image.ImageData class instantiation. The derived Gaussian parameters have been used to reconstruct Gaussian profiles at the pixel positions of the islands and zero outside those islands. This array can be saved e.g. as a FITS image for inspection of the source processing.

Gaussian_residuals_mapnp.ndarray

Similar to Gaussian_islands_map, but as residuals, i.e. the Gaussian islands have been subtracted from the image data at the pixel positions of the islands - and zero outside the islands. This array can be saved e.g. as a FITS image for inspection of the source processing.

signp.ndarray

1D float32 array indicating the significances of the detections. Often this will be the ratio of the peak spectral brightness of the source island divided by the noise at the position of that peak. But for extended sources, the noise can perhaps decrease away from the position of the peak spectral brightness more steeply than the source spectral brightness and the maximum signal-to-noise ratio can be found at a different position.

chisqnp.ndarray

1D float32 array representing chi-squared statistics reflecting an indication of the goodness-of-fit, equivalent to chisq as calculated in measuring.goodness_of_fit.

reduced_chisqnp.ndarray

1D float32 array representing reduced chi-squared statistics reflecting an indication of the goodness-of-fit, equivalent to reduced_chisq as calculated in measuring.goodness_of_fit.

sourcefinder.extract.source_profile_and_errors(data, threshold, rms, noise, beam, fudge_max_pix_factor, beamsize, correlation_lengths, image_conf, fixed=None)[source]#

Return a number of measurable properties with errorbars.

Given an island of pixels it will return a number of measurable properties including errorbars. It will also compute residuals from Gauss fitting and export these to a residual map.

In addition to handling the initial parameter estimation, and any fits which fail to converge, this function runs the goodness-of-fit calculations - see sourcefinder.measuring.goodness_of_fit() for details.

Parameters:
datanp.ndarray

Array of pixel values, can be a masked array, which is necessary for proper Gauss fitting, because the pixels below the threshold in the corners and along the edges should not be included in the fitting process.

thresholdfloat

Threshold used for selecting pixels for the source (ie, building an island). Typically, this will be the analysis threshold (float) times the noise level (float) at the position of the island’s pixel with the highest spectral brightness.

rmsMaskedArray

A 2D masked array representing the patch of the rms noise map, corresponding to the same pixel positions as data. The values are interpolated from a grid of standard deviations of the background noise across the image.

noisefloat

Noise level at the position of the island pixel with the highest spectral brightness.

beamtuple

Beam parameters (semimaj, semimin, theta), i.e. the semi-major and semi-minor axes in pixel coordinates and the position angle in radians.

fudge_max_pix_factorfloat

Correct for the underestimation of the peak when taking the maximum pixel value.

beamsizefloat

The FWHM size of the clean beam in square pixels.

correlation_lengthstuple

Two floats describing the distance along the semimajor and semiminor axes of the clean beam beyond which noise is assumed uncorrelated. Some background: Aperture synthesis imaging yields noise that is partially correlated over the entire image. This has a considerable effect on error estimates. We approximate this by considering all noise within the correlation length completely correlated and beyond that completely uncorrelated.

image_confconfig.ImgConf

Holds the configuration parameters for observational image processing.

fixeddict, default: None

Parameters (and their values) to hold fixed while fitting. Passed on to measuring.fitgaussian().

Returns:
tuple

A populated ParamSet, a Gaussian islands np.ndarray and a residuals np.ndarray. The Gaussian islands are reconstructions using the derived Gaussian parameters and the residuals are the difference between the data and those reconstructions, i.e. the reconstructions are subtracted from the data. Both the Gaussian islands and residuals are regular ndarrays, where masked (unfitted) regions have been filled with 0-values. The Gaussian islands and residuals arrays have nonzero values for the pixel posiions of the corresponding island, i.e. for the corresponding contiguous region of the observational image (with mean background subtracted), which was segmented at the level of the analysis threshold.

sourcefinder.extract.BIGNUM = 99999.0[source]#
sourcefinder.extract.logger[source]#
sourcefinder.extract.sigma_to_ax[source]#