SKA-ScienceDataProcessor/algorithm-reference-library

Issue in the gridding correction function?

Closed this issue · 9 comments

Hi,
While using your PSWF code for the Slow Transients Pipeline, I observed that the first element of the 1D gridding correction function (at position nu=-1) is different than the expected:
image
In this image it is about 0.0212, but I would expect a smaller value than next one of 0.007, as it tends to decrease for smaller indexes.
Apparently this can be fixed by changing the following lines of grdsf function:

    part[(nu > 0.75) & (nu < 1.0)] = 1
    nuend[(nu > 0.75) & (nu < 1.0)] = 1.0

to:

    part[(nu > 0.75) & (nu <= 1.0)] = 1
    nuend[(nu > 0.75) & (nu <= 1.0)] = 1.0

Do you agree this is an issue?
Thanks.

I agree it's an issue but I don't agree totally with your change.

[grdsf.f.txt](https://github.com/SKA-ScienceDataProcessor/algorithm-reference-library/files/1951338/grdsf.f.txt)
I've attached the Fortran file from which this python version was derived. Reading from that I think the lines should be:

part[(nu >= 0.0) & (nu < 0.75)] = 0
part[(nu >= 0.75) & (nu <= 1.0)] = 1
nuend[(nu >= 0.0) & (nu <= 0.75)] = 0.75
nuend[(nu > 0.75) & (nu <= 1.0)] = 1.0

Can you check this line of derivation?

How did this manifest itself? I'm impressed that you found it.

Cheers,
Tim

Scratch that. It should be:

part[(nu >= 0.0) & (nu < 0.75)] = 0
part[(nu >= 0.75) & (nu <= 1.0)] = 1
nuend[(nu >= 0.0) & (nu < 0.75)] = 0.75
nuend[(nu >= 0.75) & (nu <= 1.0)] = 1.0

i.e. the selections must be the same for part and nun.

I'm working on W-Projection (implementation based on your paper) for the Slow Transients Pipeline (first on Python and then on C++ implementation).
I found this issue while debugging W-projection implementation for the STP and inspecting the generated matrices. We had an idea to speedup W-projection implementation using Hankel transform. While it appeared to work using a Gaussian AA-kernel, we observed that for PSWF some artifacts arise close to the image borders. I found this issue while inspecting the correction gridding function values but this was not the cause for the artifacts. However, this issue may affect some image border samples when performing the gridding correction step. Thanks for your correction. I'm not aware of PSWF implementation details.

as595 commented

We're seeing if we can be quicker than reprojection :-)

as595 commented

Also - there are a variety of different integration lengths requested for the STP, so a w-correction of some sort may be required anyway.

Thanks Anna.
Tim, I tested your correction. I observe that fixing nu=0.75 results in a quite small difference for the value in this position. But the selections are consistent now. Thanks.

Now complete.