Skip to content
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

Viewer does not handle degenerate coordinates properly #117

Open
jpinedaf opened this issue Jul 2, 2014 · 2 comments
Open

Viewer does not handle degenerate coordinates properly #117

jpinedaf opened this issue Jul 2, 2014 · 2 comments

Comments

@jpinedaf
Copy link

jpinedaf commented Jul 2, 2014

Hi,

I run dendrograms on an integrated intensity map from JVLA successfully, which has two degenerate coordinates in the header (Stokes=1, and Frequency=1). The size of the array is:

In [14]: array.shape
Out[14]: (1, 1, 1024, 972)

However, the dendrogram viewer does not know how to handle this image:

In [9]: v = d2.viewer()
ERROR: ValueError: Only 2- and 3-dimensional arrays are supported at this time [astrodendro.viewer]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-3d0d5ce782bb> in <module>()
----> 1 v = d2.viewer()

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astrodendro-0.1.0-py2.7.egg/astrodendro/dendrogram.pyc in viewer(self)
    454         """
    455         from .viewer import BasicDendrogramViewer
--> 456         return BasicDendrogramViewer(self)
    457 
    458 

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astrodendro-0.1.0-py2.7.egg/astrodendro/viewer.pyc in __init__(self, dendrogram)
     10 
     11         if dendrogram.data.ndim not in [2, 3]:
---> 12             raise ValueError("Only 2- and 3-dimensional arrays are supported at this time")
     13 
     14         self.array = dendrogram.data

ValueError: Only 2- and 3-dimensional arrays are supported at this time

I had to go back into CASA and export the data without the degenerate axes, however, since the 2 extra dimensions in the array have length=1 I think that this should be accepted .

Cheers,
Jaime

@keflavich
Copy link
Contributor

A quick solution is to pass data.squeeze() into astrodendro; that drops the degenerate dimensions.

(but I think this is an argument for getting spectral-cube integrated into astrodendro)

@jpinedaf
Copy link
Author

jpinedaf commented Jul 2, 2014

That helps! Thanks for the quick advice :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants