glue-viz / glue-jupyter

Glue front-end for the Jupyter ecosystem
https://glue-jupyter.readthedocs.io/en/latest/
Other
88 stars 38 forks source link

Measuring tools in glupyter, and glue #305

Open aagoodman opened 2 years ago

aagoodman commented 2 years ago

This is a feature request, to implement more measuring tools. In CosmicDS @Carifio24 created a measuring tool in 2D. We'd like that tool to work across the glue/glupyter ecosystem, and to be extended to 3D plots as well.

Desired solution. Implement 2D and 3D measuring tools in glue and glupyter. Tools should understand plot units.

Describe alternatives you've considered: No solution currently exists, except in CosmicDS.

If it is not related to a problem--please describe the feature: This feature will benefit many ongoing projects

Additional context: Alyssa is asking! ;-)

Carifio24 commented 2 years ago

Some additional info/context, for anyone interested:

The CosmicDS measuring tool can be found here. CosmicDS is built using ipyvuetify, so the tool has both Python and Vue pieces, with JavaScript on the Vue side doing most of the heavy lifting. The basic idea of this implementation is that we drop in a canvas with the same dimensions as the viewer and use canvas events (mousemove, mousedown/up, etc) to allow the measuring to take place - in the CDS case, the user can create/manipulate a line whose length serves as the basis for the measurement. In CosmicDS, where we have easy access to JavaScript, this is done using a regular HTML canvas element. This obviously doesn't work in a more general glue/glupyter environment, but I imagine we could use ipycanvas in glupyter. I'm not sure about Qt - maybe QGraphicsView?

The main thing that needs to be determined for any particular viewer is how to convert pixel dimensions to the relevant distance measurement. Depending on the viewer and its axes, this may or may not be completely trivial. For something like a rectilinear scatter viewer, it should be a straightforward affine transformation. But change to some other projection (polar or full-sphere), and there's potentially more work to do. For example, our CosmicDS tool uses a WWT widget, and the conversion uses small-angle approximation, since students will only be looking at galaxies. Doing the measurement with a full FOV will likely be unreliable.

dhomeier commented 2 years ago

cf. #152?