clean#

xrayvision.clean.clean(dirty_map, dirty_beam, pixel=None, clean_beam_width=4.0, gain=0.1, thres=0.01, 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 that location updating the residual. This process continues until either niter iterations is reached or the maximum residual <= thres.

Parameters:
  • dirty_map (numpy.ndarray) – The dirty map to be cleaned 2D

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

  • pixel – Size of a pixel

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

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

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

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

Returns:

numpy.ndarray – The CLEAN image 2D

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}\]