opticam.background.local_background =================================== .. py:module:: opticam.background.local_background Classes ------- .. autoapisummary:: opticam.background.local_background.BaseLocalBackground opticam.background.local_background.DefaultLocalBackground Module Contents --------------- .. py:class:: BaseLocalBackground(r_in_scale = 5, r_out_scale = 7.5, sigma_clip = SigmaClip(sigma=3, maxiters=10)) Bases: :py:obj:`abc.ABC` Base class for local background estimators. .. py:attribute:: r_in_scale :value: 5 .. py:attribute:: r_out_scale :value: 7.5 .. py:attribute:: sigma_clip .. py:method:: __call__(data, position, semimajor_axis, semiminor_axis, theta) :abstractmethod: Compute the local background and its error at a given position (**per pixel**). Parameters ---------- data : NDArray The image data. semimajor_axis : float The (unscaled) semi-major axis of the aperture. semiminor_axis : float The (unscaled) semi-minor axis of the aperture. theta : float The rotation angle of the PSF. position : Tuple[float, float] The x, y position at which to compute the local background. Returns ------- Tuple[float, float] The local background and its error per pixel. .. py:method:: get_annulus(position, semimajor_axis, semiminor_axis, theta) :abstractmethod: Define an annulus at the given position. Parameters ---------- position : NDArray The centre of the annulus. semimajor_axis : float The semimajor standard deviation of the PSF. semiminor_axis : float The semiminor standard deviation of the PSF. theta : float The orientation of the source **in radians**. Returns ------- Aperture The annulus. .. py:method:: get_stats(data, position, semimajor_axis, semiminor_axis, theta) Get the stats of the annulus. Parameters ---------- data : NDArray The image data. position : NDArray The centre of the annulus. semimajor_axis : float The semimajor standard deviation of the PSF. semiminor_axis : float The semiminor standard deviation of the PSF. theta : float The orientation of the source **in radians**. Returns ------- ApertureStats The stats of the annulus. .. py:class:: DefaultLocalBackground(r_in_scale = 5, r_out_scale = 7.5, sigma_clip = SigmaClip(sigma=3, maxiters=10)) Bases: :py:obj:`BaseLocalBackground` Default local background estimator using an elliptical annulus. .. py:method:: get_annulus(position, semimajor_axis, semiminor_axis, theta) Define an annulus at the given position. Parameters ---------- position : NDArray The centre of the annulus. semimajor_axis : float The semimajor standard deviation of the PSF. semiminor_axis : float The semiminor standard deviation of the PSF. theta : float The orientation of the source **in radians**. Returns ------- Aperture The annulus. .. py:method:: __call__(data, position, semimajor_axis, semiminor_axis = None, theta = 0.0) Compute the sigma-clipped local background (mean) and its error (standard deviation) at a given position. Parameters ---------- data : NDArray The image data. error : NDArray The error in the image data. position : NDArray The x, y position at which to compute the local background. semimajor_axis : float The (unscaled) semimajor axis of the aperture. semiminor_axis : float | None, optional The (unscaled) semiminor axis of the aperture, by default `None`. If `None`, it is assumed to be equal to the semimajor axis (i.e., the annulus is circular). theta : float, optional The rotation angle of the PSF, by default 0 (i.e., no rotation). Returns ------- Tuple[float, float] The local background (mean) and its error (standard deviation).