sourcefinder.extract ==================== .. py:module:: sourcefinder.extract .. autoapi-nested-parse:: Source Extraction Helpers. These are used in conjunction with image.ImageData. .. !! processed by numpydoc !! Attributes ---------- .. autoapisummary:: sourcefinder.extract.BIGNUM sourcefinder.extract.logger sourcefinder.extract.sigma_to_ax Classes ------- .. autoapisummary:: sourcefinder.extract.Detection sourcefinder.extract.Island sourcefinder.extract.ParamSet Functions --------- .. autoapisummary:: sourcefinder.extract.first_part_of_celestial_coordinates sourcefinder.extract.insert_sources_and_noise sourcefinder.extract.source_measurements_vectorised sourcefinder.extract.source_profile_and_errors Module Contents --------------- .. py:class:: Detection(paramset, imagedata, chunk=None) Bases: :py:obj:`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: **paramset** : a ParamSet instance The measurement of the source, reflected by Gaussian model parameters supplemented with some auxiliary quantities. **imagedata** : an 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. **chunk** : tuple of slices, default: None The rectangular region of the image encompassing the source pixels above the analysis threshold. **eps_ra** : float, 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_dec** : float, default: 0 The calibration error in declination in degrees following equation 27b of the NVSS paper (Condon et al. 1998, AJ, 115, 1693). :Attributes: **peak** : Uncertain instance The peak spectral brightness of the source in the units used in the image, typically Jy/beam. **flux** : Uncertain instance The integrated flux density of the source, typically in Jy. **x** : Uncertain instance The x-coordinate of the source in pixel space. **y** : Uncertain instance The y-coordinate of the source in pixel space. **smaj** : Uncertain instance The semi-major axis of the source in units of pixels. **smin** : Uncertain instance The semi-minor axis of the source in units of pixels. **theta** : Uncertain instance The position angle of the major axis in radians, measured from the positive y-axis towards the negative x-axis. **dc_imposs** : int The number of elliptical axes that could not be deconvolved, minimum = 0, maximum = 2 **smaj_dc** : Uncertain instance The deconvolved semi-major axis of the source in units of pixels. **smin_dc** : Uncertain instance The deconvolved semi-minor axis of the source in units of pixels. **theta_dc** : Uncertain instance The deconvolved position angle of the source in degrees. **error_radius** : float or None A pessimistic estimate of the 1-sigma positional uncertainty, in arcseconds. **gaussian** : bool Indicates whether the measurement is based on a Gaussian fit. **chisq** : float 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_chisq** : float 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. **sig** : float 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. **imagedata** : an 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. **chunk** : tuple of slices or None, default: None The rectangular region of the image encompassing the source pixels above the analysis threshold. **eps_ra** : float, default: 0 Extra positional uncertainty (degrees) from calibration errors along right ascension, following equation 27a from the NVSS paper. **eps_dec** : float, default: 0 Extra positional uncertainty (degrees) from calibration errors along declination, following equation 27b from the NVSS paper. .. !! processed by numpydoc !! .. py:method:: _physical_coordinates() Convert the pixel parameters for this object into something physical. .. !! processed by numpydoc !! .. py:method:: distance_from(x, y) Distance from the center. .. !! processed by numpydoc !! .. py:method:: serialize(conf=Conf, every_parm=False) Return source properties suitable for database storage. We manually add ew_sys_err, ns_sys_err as defined in conf.image. :Parameters: **conf** : Conf, default: Conf Configuration object for customizing the parameters to be included. **every_parm** : bool, 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. .. !! processed by numpydoc !! .. py:attribute:: chisq .. py:attribute:: chunk :value: None .. py:attribute:: dc_imposs .. py:attribute:: eps_dec .. py:attribute:: eps_ra .. py:attribute:: error_radius :value: None .. py:attribute:: flux .. py:attribute:: gaussian .. py:attribute:: imagedata .. py:attribute:: peak .. py:attribute:: reduced_chisq .. py:attribute:: sig .. py:attribute:: smaj .. py:attribute:: smaj_dc .. py:attribute:: smin .. py:attribute:: smin_dc .. py:attribute:: theta .. py:attribute:: theta_dc .. py:attribute:: x .. py:attribute:: y .. py:class:: Island(data, rms, chunk, detection_map, beam, image_conf, analysis_threshold=None, rms_orig=None, flux_orig=None, subthrrange=None) Bases: :py:obj:`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: **data** : ndarray 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. **rms** : MaskedArray 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. **chunk** : tuple of slices Defines the corners of the patch encompassing the island as a tuple of slices. **detection_map** : MaskedArray 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. **beam** : tuple of floats The clean beam parameters as the semi-major and semi-minor axes in pixel coordinates and the position angle in radians. **image_conf** : config.ImgConf Holds the configuration parameters for observational image processing. **analysis_threshold** : float, 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_orig** : MaskedArray, default: None The original rms noise of the island. **flux_orig** : float, default: None The original flux value of the island. **subthrrange** : ndarray, default: None The subthreshold range for deblending. .. !! processed by numpydoc !! .. py:method:: deblend(niter=0) Decompose the island into subislands. :Parameters: **niter** : int, 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. .. rubric:: 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. .. !! processed by numpydoc !! .. py:method:: fit(fudge_max_pix_factor, beamsize, correlation_lengths, fixed=None) Fit. Measure the source, i.e. compute its Gaussian parameters and the corresponding errors. :Parameters: **fudge_max_pix_factor** : float 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. **beamsize** : float The size of the clean beam, in square pixels. **correlation_lengths** : tuple 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. **fixed** : dict, 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. .. !! processed by numpydoc !! .. py:method:: noise() Noise at position of the island pixel with the highest spectral brightness. .. !! processed by numpydoc !! .. py:method:: sig() Source significance expressed as the maximum signal-to-noise across the island. .. !! processed by numpydoc !! .. py:method:: threshold() 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. .. !! processed by numpydoc !! .. py:attribute:: beam .. py:attribute:: chunk .. py:attribute:: data .. py:attribute:: deblend_mincont .. py:attribute:: deblend_nthresh .. py:attribute:: detection_map .. py:attribute:: image_conf .. py:attribute:: max_pos .. py:attribute:: position .. py:attribute:: rms .. py:attribute:: structuring_element .. py:class:: ParamSet(image_conf: sourcefinder.config.ImgConf | None = None) Bases: :py:obj:`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_conf** : config.ImgConf Holds the configuration parameters for observational image processing. .. !! processed by numpydoc !! .. py:method:: _condon_formulae(noise, correlation_lengths) 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: **noise** : float The noise level at the position of the island pixel with the highest spectral brightness. **correlation_lengths** : tuple 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. .. !! processed by numpydoc !! .. py:method:: _error_bars_from_moments(noise, correlation_lengths, threshold) Provide 1-sigma error bars for source parameters derived from moments :Parameters: **noise** : float The noise level at the position of the island pixel with the highest spectral brightness. **correlation_lengths** : tuple 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. **threshold** : float 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. .. !! processed by numpydoc !! .. py:method:: calculate_errors(noise, correlation_lengths, threshold) 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: **noise** : float The noise level at the position of the island pixel with the highest spectral brightness. **correlation_lengths** : tuple 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. **threshold** : float 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 .. .. !! processed by numpydoc !! .. py:method:: compute_bounds(data_shape) 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_shape** : tuple 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. .. !! processed by numpydoc !! .. py:method:: deconvolve_from_clean_beam(beam) Deconvolve from the clean beam. :Parameters: **beam** : tuple 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. .. !! processed by numpydoc !! .. py:method:: keys() D.keys() -> a set-like object providing a view on D's keys .. !! processed by numpydoc !! .. py:attribute:: alpha_brightness1 .. py:attribute:: alpha_brightness2 .. py:attribute:: alpha_maj1 .. py:attribute:: alpha_maj2 .. py:attribute:: alpha_min1 .. py:attribute:: alpha_min2 .. py:attribute:: bounds :type: dict[str, tuple[float, float, bool]] .. py:attribute:: chisq :value: None .. py:attribute:: clean_bias .. py:attribute:: clean_bias_error .. py:attribute:: deconv_imposs :value: 2 .. py:attribute:: frac_flux_cal_error .. py:attribute:: gaussian :value: False .. py:attribute:: image_conf .. py:attribute:: measurements .. py:attribute:: moments :value: False .. py:attribute:: reduced_chisq :value: None .. py:attribute:: sig :value: None .. py:attribute:: thin_detection :value: True .. py:function:: first_part_of_celestial_coordinates(ra_dec, endy_ra_dec, xbar_ybar_error, xbar_ybar_smaj_smin_theta, dummy, return_values) 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_dec** : np.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_dec** : np.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_error** : np.ndarray Array of floats of length 2, with the errors on the barycentric positions, in pixel coordinates, in both dimensions. **xbar_ybar_smaj_smin_theta** : np.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. **dummy** : np.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_values** : np.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. .. !! processed by numpydoc !! .. py:function:: insert_sources_and_noise(some_image, noise_map, inds, labelled_data, label, npix, source, noise, xpos, ypos, min_width) 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_image** : np.ndarray The 2D ndarray with all the pixel values, typically image.ImageData().data_bgsubbed.data. **noise_map** : np.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. **inds** : np.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_data** : np.ndarray A ndarray with the same shape as some_image, with labelled islands with integer values and zeroes for all background pixels. **label** : int The label (integer value) indicates the island we are processing since the pixel positions of the island are determined by labelled_data==label. **npix** : int Number of pixels comprising the island we are processing. The island pixel positions are determined by labelled_data==label. **source** : np.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. **noise** : np.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. **xpos** : np.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. **ypos** : np.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_width** : int 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. .. !! processed by numpydoc !! .. py:function:: 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 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_islands** : int Number of islands detected. **npixs** : np.ndarray 1D int32 array of length num_islands representing the number of pixels comprising every island. **maxposs** : np.ndarray 2D int32 array of shape (num_islands, 2) with the peak positions per island. **maxis** : np.ndarray 1D float32 array of length num_islands with the peak pixel values corresponding to the maxposs positions. **data_bgsubbeddata** : np.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. **rmsdata** : np.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. **analysisthresholddata** : np.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. **indices** : np.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_data** : np.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. **labels** : np.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. **wcs** : utility.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_factor** : float 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. **beam** : tuple 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. **beamsize** : float Area of the restoring beam, in square pixels. **correlation_lengths** : tuple 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. **conf** : config.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_sources** : np.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_barycenters** : np.ndarray (num_islands, 2) array of floats: each row has an entry for right ascension (degrees, float64) and declination (degrees, float64). **chunk_positions** : np.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_errors** : np.ndarray 1D float64 array of uncertainties (degrees) corresponding to the first column in sky_barycenters. **dec_errors** : np.ndarray 1D float64 array of uncertainties (degrees) corresponding to the second column in sky_barycenters. **error_radii** : np.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_asec** : np.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_asec** : np.ndarray 1D float64 array representing the 1-sigma error bars of the convolved semi-major axes, in arcseconds. **smin_asec** : np.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_asec** : np.ndarray 1D float64 array representing the 1-sigma error bars of the convolved semi-minor axes, in arcseconds. **theta_celes_values** : np.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_errors** : np.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_values** : np.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_errors** : np.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_map** : np.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_map** : np.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. **sig** : np.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. **chisq** : np.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_chisq** : np.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. .. !! processed by numpydoc !! .. py:function:: source_profile_and_errors(data, threshold, rms, noise, beam, fudge_max_pix_factor, beamsize, correlation_lengths, image_conf, fixed=None) 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 :func:`sourcefinder.measuring.goodness_of_fit` for details. :Parameters: **data** : np.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. **threshold** : float 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. **rms** : MaskedArray 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. **noise** : float Noise level at the position of the island pixel with the highest spectral brightness. **beam** : tuple 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_factor** : float Correct for the underestimation of the peak when taking the maximum pixel value. **beamsize** : float The FWHM size of the clean beam in square pixels. **correlation_lengths** : tuple 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_conf** : config.ImgConf Holds the configuration parameters for observational image processing. **fixed** : dict, 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. .. !! processed by numpydoc !! .. py:data:: BIGNUM :value: 99999.0 .. py:data:: logger .. py:data:: sigma_to_ax