MaxSourceFinder

class MaxSourceFinder(sky_count, sky_snr, fit_method=<function gaussian_2d_2width_offset>, fit_sigma=1.155, subimage_size=10, image_margins=0)[source]

Bases: object

Sky source finder, based on the best excess in the SNR image

Constructor

if subimage_size=0: only the peak is taken. Then, the ‘subimage_size’ radius is in addition of the central pixel.

Parameters:
  • sky_count (2D array) – sky image to loo for sources in
  • sky_snr (2D array) – sky snr image
  • fit_method (gaussian_2d_2width) – fit method to use to identified the source
  • fit_sigma (float>0) – standard deviation of the gaussian fit_function. Default is 1.555.
  • subimage_size – subimage size radius in pixels,

around the higher excess in SNR, used by the fit. Default=10. :type subimage_size: int :param image_margins: margins of the image to not include in the research for source. Default=10. :type image_margins: int

Methods Summary

change_sky(sky_count, sky_snr) re-configure the MaxSourceFinder with a new sky
fit_source(snr_min[, peak_position, show, …]) Finds the source using the SkySNR and SkyCount images
fit_source_position([show]) fit a gaussian 2D on a sky portion around the source
get_peak_position_and_value() Returns the pixel coordinates and the value of the maximum SNR found on the SNR image

Methods Documentation

change_sky(sky_count, sky_snr)[source]

re-configure the MaxSourceFinder with a new sky

Parameters:
  • sky_count (2D array) – sky image to loo for sources in
  • sky_snr (2D array) – sky snr image
fit_source(snr_min, peak_position=None, show=None, verbose=None)[source]

Finds the source using the SkySNR and SkyCount images

  • look for the best excess in the SkySNR map.
  • select a region around the source in the SkyCount image to do the fit (+-10 pixels)
  • perform a 2D-Gaussian fit to get the final location of the source

fit results in self.params = [height_fit, x_pos_fit, y_pos_fit, sigma_x_fit, sigma_y_fit]

Parameters:
  • snr_min – snr limit for the source research
  • peak_position – position of the peak to be fitted,

if already known. [pix_y, pix_z]. Default=None :param show: show fit plot :param verbose: print statement feedback :type snr_min: float (>0) :type peak_position: [float, float] :type show: string (‘2d’ or ‘3d’ or default=None) :type verbose: bool (default=None)

Variables:success – 0
fit_source_position(show=None)[source]

fit a gaussian 2D on a sky portion around the source

sky portion = subimage_size around the source

If the fitted peak position is out of the sky portion, the fit is considered as a failure.

fit params are save in sky image pixel coordinates

Parameters:show (string) – plot the sky portion in ‘2d’ or in ‘3d’. Default=None.
get_peak_position_and_value()[source]

Returns the pixel coordinates and the value of the maximum SNR found on the SNR image