ratt-ru / CubiCal

A fast radio interferometric calibration suite.
GNU General Public License v2.0
18 stars 13 forks source link

"A Qhull internal error has occurred" when regions are not in physical coordinates #422

Closed viralp closed 3 years ago

viralp commented 3 years ago

Hi

I am getting the following degridding error

INFO 11:56:37 - main [0.3 5.3 9.7Gb] Exiting with exception: QhullError(QH6421 qhull internal error (qh_maxsimplex): qh.MAXwidth required for qh_maxsimplex. Used to estimate determinate

While executing: | qhull i Qt Options selected for Qhull 2019.1.r 2019/06/21: run-id 648547225 incidence Qtriangulate _pre-merge _zero-centrum _max-width 0 Error-roundoff 2.4e-13 _one-merge 1.2e-12 _near-inside 6e-12 Visible-distance 4.8e-13 U-max-coplanar 4.8e-13 Width-outside 9.5e-13 _wide-facet 2.9e-12 _maxoutside 1.4e-12

A Qhull internal error has occurred. Please send the input and output to qhull_bug@qhull.org. If you can duplicate the error with logging ('T4z'), please include the log file. ) Traceback (most recent call last): File "/home/vparekh/CubiCal/cubical/main.py", line 450, in main degrid_opts=GD["degridding"]) File "/home/vparekh/CubiCal/cubical/data_handler/ms_data_handler.py", line 671, in init_models clustercat) File "/home/vparekh/CubiCal/cubical/degridder/DicoSourceProvider.py", line 61, in init min_nfacet_per_axis) File "/home/vparekh/CubiCal/cubical/degridder/DicoSourceProvider.py", line 115, in read_regions_file name="DDE_REG{0:d}".format(regi + 1))) File "/home/vparekh/CubiCal/cubical/degridder/geometry.py", line 39, in init self._hull = spat.ConvexHull(points) File "qhull.pyx", line 2431, in scipy.spatial.qhull.ConvexHull.init__ File "qhull.pyx", line 356, in scipy.spatial.qhull._Qhull.init scipy.spatial.qhull.QhullError: QH6421 qhull internal error (qh_maxsimplex): qh.MAXwidth required for qh_maxsimplex. Used to estimate determinate

While executing: | qhull i Qt Options selected for Qhull 2019.1.r 2019/06/21: run-id 648547225 incidence Qtriangulate _pre-merge _zero-centrum _max-width 0 Error-roundoff 2.4e-13 _one-merge 1.2e-12 _near-inside 6e-12 Visible-distance 4.8e-13 U-max-coplanar 4.8e-13 Width-outside 9.5e-13 _wide-facet 2.9e-12 _maxoutside 1.4e-12

A Qhull internal error has occurred. Please send the input and output to qhull_bug@qhull.org. If you can duplicate the error with logging ('T4z'), please include the log file. ddcal_0.log

o-smirnov commented 3 years ago

Sorry for the delay, @viralp. I can't contribute much since this is @bennahugo's degridder code.

However it's clear from the error that there's something going wrong in the geometry calculations used to extract regions for a DD model. So could you post a picture of the regions you're trying to use for the peeling (do screen grab from DS9 or something)? Maybe you've specified some kind of weird degenerate region, an egde case @bennahugo hasn't accounted for?

(You can also try "redrawing" your regions... maybe make them simpler, see if the error goes away?)

bennahugo commented 3 years ago

I have the parsets regions and dicomodels for this. I have not had a chance to look at it yet (as per email). The regions must be convex hulls - I will draw a convex hull around the polygon you specify. To me it looks like a bug within scipy, but I need to reproduce this for myself. Unfortunately I can only get to it next year when I'm back from leave, as I need to focus on my PhD thesis and articles over the next two weeks.

On Fri, 18 Dec 2020, 18:39 Oleg Smirnov, notifications@github.com wrote:

Sorry for the delay, @viralp https://github.com/viralp. I can't contribute much since this is @bennahugo https://github.com/bennahugo's degridder code.

However it's clear from the error that there's something going wrong in the geometry calculations used to extract regions for a DD model. So could you post a picture of the regions you're trying to use for the peeling (do screen grab from DS9 or something)? Maybe you've specified some kind of weird degenerate region, an egde case @bennahugo https://github.com/bennahugo hasn't accounted for?

(You can also try "redrawing" your regions... maybe make them simpler, see if the error goes away?)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ratt-ru/CubiCal/issues/422#issuecomment-748194855, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6T44DUCHID5QSAC2ALSVOAUFANCNFSM4UWNIQVQ .

bennahugo commented 3 years ago

I would follow Olegs advice for a workaround. Try draw a convex polygon or a box, with 'physical' coordinates (or use catdagger to autotag, see the vermeerkat pipeline on usage).

On Fri, 18 Dec 2020, 20:58 Benna Hugo, bennahugo@gmail.com wrote:

I have the parsets regions and dicomodels for this. I have not had a chance to look at it yet (as per email). The regions must be convex hulls - I will draw a convex hull around the polygon you specify. To me it looks like a bug within scipy, but I need to reproduce this for myself. Unfortunately I can only get to it next year when I'm back from leave, as I need to focus on my PhD thesis and articles over the next two weeks.

On Fri, 18 Dec 2020, 18:39 Oleg Smirnov, notifications@github.com wrote:

Sorry for the delay, @viralp https://github.com/viralp. I can't contribute much since this is @bennahugo https://github.com/bennahugo's degridder code.

However it's clear from the error that there's something going wrong in the geometry calculations used to extract regions for a DD model. So could you post a picture of the regions you're trying to use for the peeling (do screen grab from DS9 or something)? Maybe you've specified some kind of weird degenerate region, an egde case @bennahugo https://github.com/bennahugo hasn't accounted for?

(You can also try "redrawing" your regions... maybe make them simpler, see if the error goes away?)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ratt-ru/CubiCal/issues/422#issuecomment-748194855, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6T44DUCHID5QSAC2ALSVOAUFANCNFSM4UWNIQVQ .

o-smirnov commented 3 years ago

Yeah it feels like one of those bugs where if you just "jiggle" the inputs (i.e. the regions), it will go away.

KshitijT commented 3 years ago

@viralp , maybe post images of the sources with overlaid regions, we can see if there is something wrong with it ?

bennahugo commented 3 years ago

Viral has sent me the regions and dicomodels via email. I need to simulate and image some data to make sense of it though.

On Fri, Dec 18, 2020 at 9:07 PM Kshitij Thorat notifications@github.com wrote:

@viralp https://github.com/viralp , maybe post images of the sources with overlaid regions, we can see if there is something wrong with it ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ratt-ru/CubiCal/issues/422#issuecomment-748266665, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6UFHSD3BTECORJIR5LSVOR6HANCNFSM4UWNIQVQ .

--

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

KshitijT commented 3 years ago

Viral has sent me the regions and dicomodels via email. I need to simulate and image some data to make sense of it though. On Fri, Dec 18, 2020 at 9:07 PM Kshitij Thorat @.***> wrote: @viralp https://github.com/viralp , maybe post images of the sources with overlaid regions, we can see if there is something wrong with it ? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#422 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6UFHSD3BTECORJIR5LSVOR6HANCNFSM4UWNIQVQ . -- -- 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

No worries, @bennahugo . Just trying to see if I can resolve this with minimal effort rather than bothering you, since you have a lot on your plate already.

o-smirnov commented 3 years ago

Viral has sent me the regions and dicomodels via email.

Hence my suggestion that @viralp post it here, so we can get more eyes on the problem. You do have a PhD to finish, and I fully endorse you going away and focusing on that. ;)

viralp commented 3 years ago

Thanks @bennahugo, @o-smirnov and @KshitijT. The error is solved now with physical coordinates (early I was using in degree format).

image

o-smirnov commented 3 years ago

Ah excellent! Let's keep the issue open for now, so that we remember to add a proper error message for when the regions are in the wrong format.

bennahugo commented 3 years ago

Yes sorry I should specify that in a wiki. I will work on it in the new year. Being able to deal with degree coordinates should be added.

On Fri, 18 Dec 2020, 21:28 Oleg Smirnov, notifications@github.com wrote:

Ah excellent! Let's keep the issue open for now, so that we remember to add a proper error message for when the regions are in the wrong format.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ratt-ru/CubiCal/issues/422#issuecomment-748278960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4RE6U2Q4PNJG6CGE5NILLSVOUPPANCNFSM4UWNIQVQ .

o-smirnov commented 3 years ago

Yeah it's probably straightfoward to convert, but let's worry about that in 2021.

bennahugo commented 3 years ago

A fix that changes this into a nicer RuntimeError is added. I will PR as soon as I have a nice reproducer for the other bastard error...