Closed tomr-stargazer closed 9 years ago
Structure 1517 looks small enough that you should be able to directly extract a mask of pixel locations, and from that build a simple script to reproduce the bug (ideally passing the dendrogram and catalog steps, since I bet the logic bug is somewhere in the structure or statistic classes)
Looks like the error may come from here, in the self.wcs.all_pix2world
call (and there's a cryptic todo comment) :
https://github.com/dendrograms/astrodendro/blob/master/astrodendro/analysis.py#L293
class SpatialBase(object):
...
def _world_pos(self):
xyz = self.stat.mom1()[::-1]
if self.wcs is None:
return xyz[::-1] * u.pixel
else:
# TODO: set units correctly following WCS
# We use origin=0 since the indices come from Numpy indexing
return self.wcs.all_pix2world([xyz], 0).ravel()[::-1]
Structure 1517's (ScalarStatistic) mom1 looks like this
In [103]: stat1517.mom1()
Out[103]: [123.44708399481173, 9.5652454276340659, 1440.223699313673]
when the data's shape
tuple is (246, 40, 1440)
.
I'm still playing with this -- maybe wcs.all_pix2world
always throws up when the nominal pixel value is bigger than the data, in which case maybe I'll throw a modulo 1440 operation somewhere before passing mom1
to _world_pos
.
I believe I've solved this problem with #124 , but let's see if others think that code is ready for merging.
wcs_object.wcs.bounds_check(False)
fixes this as noted in #124. Closing.
Hi, For the most part, creating dendrograms with
periodic_neighbours
(#108) has been working correctly (with the help of #121). However, I recently created a wraparound dendrogram containing 2,177 structures, and discovered that five of those structures hadnan
values for their positional values, even though their sizes seemed to compute properly:In the viewer, these structures look like this:![stupid_viewer_view](https://cloud.githubusercontent.com/assets/679378/3819997/d25c918c-1cf1-11e4-8a2d-b9980ca6f9e6.png)
In case you missed that, here's some zoomed in-views:
![image](https://cloud.githubusercontent.com/assets/679378/3820020/f9990190-1cf1-11e4-98e4-6ac79007790e.png)
(image axes are in coordinate space.)
Structure 1517 (the smallest one) looks more like this -- note that part of its footprint is a single-pixel-wide strip (on this velocity channel) at the far right edge of the data :
![image](https://cloud.githubusercontent.com/assets/679378/3820048/32e60fba-1cf2-11e4-819d-6edab599a901.png)
I'm currently adding a few more tests to test_compute and test_analysis that may explore what's going on here. It's also possible that the fault is in the WCS conversion -- I'll play around with putting a warning if the catalog gets passed a
nan
.