MaxSourceFinder

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

Bases: object

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

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
  • subimage_size (int) – subimage size radius in pixels, around the higher excess in SNR, used by the fit. Default=10.
  • image_margins (int) – margins of the image to not include in the research for source. Default=10.

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 (float (>0)) – snr limit for the source research
  • peak_position ([float, float]) – position of the peak to be fitted, if already known. [pix_y, pix_z]. Default=None
  • show (string ('2d' or '3d' or default=None)) – show fit plot
  • verbose (bool (default=None)) – print statement feedback
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