clean#

xrayvision.clean.clean(dirty_map, dirty_beam, pixel_size=None, clean_beam_width=<Quantity 4. arcsec>, gain=0.1, thres=None, niter=5000)[source]#

Clean the image using Hogbom’s original method.

CLEAN iteratively subtracts the PSF or dirty beam from the dirty map to create the residual. At each iteration, the location of the maximum residual is found and a shifted dirty beam is subtracted at that location. This process continues until either niter iterations are reached or the maximum residual <= thres.

Parameters:
  • dirty_map (Quantity) – The dirty map to be cleaned 2D

  • dirty_beam (Quantity) – The dirty beam or point spread function (PSF) 2D must

  • pixel_size (Quantity) – The pixel size in arcsec

  • clean_beam_width (Quantity | None) – The width of the gaussian to convolve the model with. If set to 0.0 the gaussian to convolution is disabled

  • gain (float | None) – The gain per loop or loop gain

  • thres (float | None) – Terminates clean when residual.max() <= thres

  • niter (int) – Maximum number of iterations to perform

Returns:

The CLEAN image 2D

Return type:

Quantity | ndarray[Any, dtype[float64]]

Notes

The CLEAN algorithm can be summarised in pesudo code as follows:

\[\begin{split}& \textrm{CLEAN} \left (I^{D}(l, m),\ B(l,m),\ \gamma,\ f_{Thresh},\ N \right ) \\ & I^{Res} = I^{D},\ M = \{\},\ i=0 \\ & \textbf{while} \ \operatorname{max} I^{Res} > f_{Thresh} \ \textrm{and} \ i \lt N \ \textbf{do:} \\ & \qquad l_{max}, m_{max} = \underset{l,m}{\operatorname{argmax}} I^{Res}(l,m) \\ & \qquad f_{max} = I^{Res}(l_{max}, m_{max}) \\ & \qquad I^{Res} = I^{Res} - \alpha \cdot f_{max} \cdot \operatorname{shift} \left ( B(l,m), l_{max}, m_{max} \right ) \\ & \qquad M = M + \{ l_{max}, m_{max}: \alpha \cdot f_{max} \} \\ & \qquad i = i + 1 \\ & \textbf{done} \\ & \textbf{return}\ M,\ I^{Res}\end{split}\]