Closed eteq closed 3 years ago
scatter2d isn't what I thought it is. To use it, I need to add the table to Glue's data collection. And then I invoke it, it is actually a separate scatter plot. It does not overlay the points on the image as I thought it would.
Maybe I am in the wrong rabbit hole?!
from astropy.table import Table
from glue.core import Data
t = Table({'x': [101, 190], 'y': [225, 283]})
t_glue = Data('Markers', **t)
imviz.app.session.data_collection['Markers'] = t_glue
jglue = imviz.app.session.application
jglue.scatter2d(data=t_glue)
OK, this glupyter example really helped a lot. The mapping from native glupyter to jdaviz was less obvious but I think I got it with some trial and error.
import numpy as np
from astropy.table import Table
from glue.core import Data
t = Table({'x': np.random.randint(0, 100, 10), 'y': np.random.randint(0, 100, 10)})
t_glue = Data('Markers', **t)
data = viewer.state.data_collection[0]
imviz.app.session.application.add_link(t_glue, 'x', data, 'Pixel Axis 1 [x]')
imviz.app.session.application.add_link(t_glue, 'y', data, 'Pixel Axis 0 [y]')
viewer.add_data(t_glue)
Still not sure how to change the color, etc.
This is an outgrowth from #622 / #630 / #632- after some out-of-band conversations (esp with @pllim and @astrofrog), we realized that the concept of "regions" that we are getting from glue's subsets are not quite comparable to ds9-style regions. The regions we're using right now in
jdaviz
aren't really scalable to even many 10s, much less the 1000s or more that are often needed when you want to mark all the objects of some type in a typical astronomical image.So this issue proposes instead that we split our existing "regions" concept into "regions" and "makers". Regions map onto the glue concept of subsets, meaning interactively selectable and grabbable in the notebook as a mask or astropy region or the like. Markers are more like the marks that astrowidgets uses, and more like what happens when you load a large table of point or circles into ds9 as "regions".
So this issue suggests a minimal marker implementation
add_markers
from astrowidgets,remove_markers
from astrowidgets, and maybereset_markers
from astrowidgetsadd_markers
/remove_markers
to reference a viewer by name (reset
would just reset everything), but that's not the minimal case, so if that's too complicated, all is sufficient.🐱