dendrograms / astrodendro

Generate a dendrogram from a dataset
https://dendrograms.readthedocs.io/
Other
37 stars 36 forks source link

Make viewers linkable #101

Closed ChrisBeaumont closed 10 years ago

ChrisBeaumont commented 10 years ago

Not ready for merging -- posting here so @tomr-stargazer can track progress as we hack on this

ChrisBeaumont commented 10 years ago

@tomr-stargazer here's a start. Take a look at https://github.com/ChrisBeaumont/dendro-core/blob/ed643a419ae3e8d2c75a47537a2f8161453edc18/astrodendro/viewer.py#L208

https://github.com/ChrisBeaumont/dendro-core/blob/ed643a419ae3e8d2c75a47537a2f8161453edc18/astrodendro/viewer.py#L164 and

The basic idea is to call hub.select to send new selections, and to attach a callback method to respond to hub notifications that the selection has changed. This will allow sets of viewers to stay in sync, without having to know about each other

tomr-stargazer commented 10 years ago

@ChrisBeaumont Check out this commit -- https://github.com/tomr-stargazer/astrodendro/commit/b69444f110f14fd1a11cafb7c3132009b262fd96

tomr-stargazer commented 10 years ago

@ChrisBeaumont after merging commit ed643a4 into my code I got this error after playing around with the viewer. Can you double check that it works on your end? The crash seems to occur when I click on a region of the map where there is nothing to select; previously the behavior would be to just "unselect" the current structure, but now it crashes.

    295                     "Multiple structures per selection not supported")
    296             struct = struct[0]
--> 297             mask = struct.get_mask(subtree=True)
    298             if self.array.ndim == 3:
    299                 mask = mask[self.slice, :, :]

AttributeError: 'NoneType' object has no attribute 'get_mask' 
ChrisBeaumont commented 10 years ago

Ok, added fix for this

ChrisBeaumont commented 10 years ago

Sorry, @tomr-stargazer! Anyways, I think this can be closed, since these changes are absorbed into your final contribution