-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swap out ddfacet degridder for Nifty degridder #353
Comments
This defines the faceting scheme implemented by Eric Greisen in AIPS, based on the scheme by Perley and Cornwell 1992 and is the most trivial form of non-coplanar imaging. It will perform very well (better than w-projection approaches), because the number of facets are small because of the specification of regions. It is in essence a variation on the targetted faceting regime. |
I'm not sure whether this issue is still active, but perhaps it is of interest that |
Hi @mreineck thanks. The approach I have taken has now been adopted as DD calibration system for a number of projects, so this would be useful. One would need an additional modification to the approach taken in the nifty gridder (or its successor) in that the UVW coordinates should be rotated such that each facet is tangent to the celestial sphere plus a phase shift to the facet centres, therefore no w-stacking or w-projection would be needed. Since we are doing targetted faceting in small patches this would mean that we only apply anti-aliasing filters and would be more optimal than computing w kernels. See https://github.com/ratt-ru/codex-africanus/blob/master/africanus/gridding/perleypolyhedron/policies/baseline_transform_policies.py and https://github.com/ratt-ru/codex-africanus/blob/master/africanus/gridding/perleypolyhedron/gridder.py#L92 for a working implementation of this This is one of the core reasons why I haven't yet adopted the nifty gridder so would be nice feature request if you have time. The successor to this would not be implemented in cubical. @JSKenyon is working on a successor package to cubical based on Dask, although much of the machinery here to mark and split regions would remain the same. |
Isn't this something that can be done as a preprocessing step? I try to keep the core algorithm as small as possible and try to omly integrate features which cannot be moved outside without a big performance loss.
Fine, that would simply mean using the wgridder in narrow-field mode (i.e. At the moment my main focus is on porting the algorithm to GPUs, and this doesn't leave me a lot of spare time ;-) |
Thanks for the replies @mreineck! As @bennahugo mentioned, QuartiCal will hopefully begin to replace CubiCal soon. Degridding is an important feature which we are currently missing but I am very keen to try out the |
Great! I'll most likely talk to @landmanbester next week, then we can discuss this in more detail. |
Hmm.. I don't think one would be able to do this as a pre-processing step -- the phases have to be steered with the original uv coordinates which means one would need to keep NFacet x DATA columns in memory. But thanks for the input |
I wouldn't be surprised if I was completely wrong about the preprocessing ;-) |
Yeah, let's discuss next week. I would be interested to see how the wgridder compares to non-coplanar facetting in terms of accuracy and speed. Since we are degridding small patches the overhead of including the w-term in the wgridder may be small, especially if low accuracy is required. But let's try to set up a benchmark to compare |
I just noticed something interesting: the necessary phase adjustments for the visibilities seem to be practically identical for both the shifting (https://github.com/mreineck/ducc/blob/1548bad07fac2f4331b551d7e239401d572a88e0/src/ducc0/wgridder/wgridder.h#L1028) and the rotating (https://github.com/ratt-ru/codex-africanus/blob/29c463c7e79eb8d2a2703d3381448d96c6840eb3/africanus/gridding/perleypolyhedron/policies/phase_transform_policies.py#L49) approach. So with a bit of luck we might be able to pull this of with only preprocessing after all ... |
Hi @mreineck. I had a quick look through the codebase wrt. to the shifting :-: As for the question: Btw: |
Hi @bennahugo, the code you point out is an implementation of the tiling approach discussed in section 2.3 of https://arxiv.org/pdf/1407.1943. This involves rephasing the visibilities, and indeed I had forgotten that I do this already. That's why I had (unjustified) reservations about adding this kind of functionality further up in this issue.
I think that this was exactly the point of this method. At least that's how I interpret the section of the wsclean paper. If that addresses your concern and we can stick to this method, I'd of course be extremely happy :-) |
(I should perhaps add that section 2.3 of the wsclean paper was not originally meant for tiling a large image into smaller parts, but it is now being used for that purpose in wsclean.) |
Thanks @mreineck . The reservation I have is how you interpret delta l and delta m in the wsclean paper -- it is not just a linear scale stepping with the pixel size -- it is a difference of cosines. This makes little difference when radec is on or near the equator on the equatorial frame, however it gives large offsets at the poles as I explained (a requested offset in RA of a degree or so can be off by many arcminutes at say declination of 80 with the former approach). Eqn 8 does indeed make the w correction dependent on the rephased centre, which is the correct thing to do to limit the number of planes. It looks to me like the only change required is then to fix the interpretation of the rephasing operation? |
Re tests, as suggested to @landmanbester would be to: Target offsets (say up to 5 degrees from the original phase centre) in the sky for high declination positions on the sphere. The error at the edge of the FoV can then be given by evaluating the backward step and looking at the smearing- induced drop in amplitude. One would place a (unity) point source at the edge of the facet, itself placed far away and evaluate the smearing level. I don't think real data is actually a good test to quantify error though -- I would stick to simulation here |
I can outline the algorithm for you here: Once you have the offset position in radians then use the identities to derive the cosines off the original phase direction. See https://github.com/ratt-ru/fundamentals_of_interferometry/blob/master/3_Positional_Astronomy/3_4_direction_cosine_coordinates.ipynb for a full discussion. |
Maybe we are talking at cross purposes here ... |
@mreineck I'm referring to getting the correct projected point on the linearly stepped image plane, not changing the stepping on the plane from linear to non-linear. The requested l,m coordinates are not radians (only in a small angle approximation is a radian approximately the same as a cosine). As implemented now the targetted offset will give you the wrong projected position on the linearly-stepped image plane. |
I agree completely that the l,m coordinates are not radians, they are Cartesian coordinates, and Perhaps it is easier to describe what I mean using code: https://github.com/mreineck/ducc/blob/1548bad07fac2f4331b551d7e239401d572a88e0/python/test/test_wgridder.py#L196 shows the unit test that makes sure our faceting gridder is doing what we expect it to do, even for very wide fields (i.e. no matter whether we grid a certain field in one go or in 2x2 or 2x4 tiles, we get the same result within the specified error ranges). If your interpretation of delta_l and delta_m is different, would it be possible to translate it into ours before calling the gridder? I'd rather not introduce a dependency on WCS for just this purpose (having no external dependencies feels really good :-) |
Ah wait ok I misunderstood the code - I see you pass the requested
positions in:
https://github.com/mreineck/ducc/blob/1548bad07fac2f4331b551d7e239401d572a88e0/src/ducc0/wgridder/wgridder.h#L1540
Yes so as long as they are correctly passed in it should be fine - the
WCSlib dependencies can live on the exterior.
The way to test that targetted faceting works is to take a high declination
dataset take a off-axis source, predict it with a DFT using, e.g. Meqtrees,
and target the source position.
Cheers,
…On Mon, Mar 28, 2022 at 11:40 AM mreineck ***@***.***> wrote:
I agree completely that the l,m coordinates are not radians, they are
Cartesian coordinates, and l*2+m*2=1 at the horizon.
Perhaps it is easier to describe what I mean using code:
https://github.com/mreineck/ducc/blob/1548bad07fac2f4331b551d7e239401d572a88e0/python/test/test_wgridder.py#L196
shows the unit test that makes sure our faceting gridder is doing what we
expect it to do, even for very wide fields (i.e. no matter whether we grid
a certain field in one go or in 2x2 or 2x4 tiles, we get the same result
within the specified error ranges).
If your interpretation of delta_l and delta_m is different, would it be
possible to translate it into ours before calling the gridder? I'd rather
not introduce a dependency on WCS for just this purpose (having no external
dependencies feels really good :-)
—
Reply to this email directly, view it on GitHub
<#353 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4RE6R7AMFST2JQLDXRZ3DVCF5BFANCNFSM4LEIUZMQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
--
Benjamin Hugo
PhD. student,
Centre for Radio Astronomy Techniques and Technologies
Department of Physics and Electronics
Rhodes University
Junior software developer
Radio Astronomy Research Group
South African Radio Astronomy Observatory
Black River Business Park
Observatory
Cape Town
|
Perfect! I don't have enough knowledge to set up the proposed test, but I'll be happy to hear about the results and help out with any problems that might turn up. |
The time has come for optimization. The goal is to replace the DDFacet degridder with the NIFTY row parallel degridder.
I will incorporate the necessary transforms for non-coplanar faceting without w correction because the nifty gridder w kernels are wrong in the faceting case (l0 and m0 are not 0 in that case).
The approach is to apply the inverse of:
https://github.com/ratt-ru/bullseye/blob/master/bullseye/mo/cpu_gpu_common/baseline_transform_policies.h#L70
to the uvw coordinates per facet (trivially parallel with another numba kernel), and apply
https://github.com/ratt-ru/bullseye/blob/master/bullseye/mo/cpu_gpu_common/phase_transform_policies.h#L141
to the visibilities. This last bit is also trivially parallel, but quite expensive to compute in comparison (a row x chan matrix of complex exponentials). There is a cheat if the channelization is regular which can be checked and applied in the code path.
I will do both with Numba.
The text was updated successfully, but these errors were encountered: