-
Notifications
You must be signed in to change notification settings - Fork 65
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
Feature request: to_glue #153
Conversation
I've been thinking that the standalone PV extractor I put together could in fact be a cube viewer (so also have a panel for the spectral extractor) and so |
That's basically what I had in mind. I'll work on it if I finish real work today... =) |
There are several ways to start glue from the command line. The easiest is qglue http://www.glueviz.org/en/stable/glue_from_python.html#quickly-send-data-to-glue-with-qglue , though it doesn't let you pre-configure viewers. If you want to automatically add a cube view, you have to use something like this: http://www.glueviz.org/en/stable/data_viewer_options.html#programmatically-configuring-plots |
@astrofrog @ChrisBeaumont WIP. It works so far in terms of sending data to a Glue application, but it has lots of problems:
|
if data_collection is not None: | ||
if name in data_collection: | ||
name = name+"_" | ||
data_collection[name] = result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, but it was based off of http://www.glueviz.org/en/stable/glue_from_python.html#usage-examples. I guess catalog
is not a DataCollection in that example but something else.
Can you elaborate on that -- is the problem that the cube is weird, or that Glue isn't displaying something properly, or...?
I'll take a look. Glue generates lots of logging messages anyways, so it might be benign, and we just need to send them someplace more quietly
return the GlueApplication object?
The code will look something like
|
result.coords = coordinates_from_header(self.header) | ||
|
||
comp = Component.autotyped(self) | ||
result.add_component(comp, name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure add_component calls autotyped for you, so you can get rid of the line above and pass self in here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
The slider shows 0...500, but the extracted spectrum is fine, so this is just an issue with the slider. Maybe this is the normal behavior, actually, I don't recall.
Yes, this could be glue interacting with astropy's logging too.
This is the problem I described above. For example:
In this case, Glue has started, but
but there is other output cluttering the
That works. Took me a while to figure out what |
Ah I think I know whats going on -- see glue-viz/glue#476 This is orthogonal to this PR, so I wouldn't worry about it for now. |
Yeah that's the intended behavior (slider in pixel coordinates). Maybe it shouldn't be, I'm not sure. |
It's fine as is, but it would be nice if both could be shown. Especially, for example, a velocity/frequency overlay on the image or titlebar or something of that sort. |
So, this works now, but note the slew of warnings:
Also, @ChrisBeaumont, the GUI is somewhat unresponsive right when I start up - I can't grab the corners to drag/expand the viewing window until I've clicked within the image or activated one of the buttons. Also, I can now reproduce the error I mentioned before, kinda (glue-viz/glue#424): right when the cubes open, they are weirdly downsampled. |
@ChrisBeaumont assuming we can clean up some of the error messages etc., what's the next step in terms of writing tests? |
The world velocity coordinates are shown along the bottom of the image view when you mouse hover. I've thought about adding a world label to the slider (although it won't have the option to switch between velocity/frequency, since I don't want to be too astro-specific in the UI) |
Ah, OK. And it's fine to not have a switch in the default glue UI; I was thinking the next step for the |
I would add an keyword (at least for testing) that lets you run |
__getitem__ but that's no problem
the dataset to an existing session
glue-viz/glue#501 partially addresses the NameError issue you had before. Glue still hijacks the REPL once you start the UI, but that's only a problem after you stop the glue session, not before you start it. I'm trying to figure out how to address it (it's an IPython thing) |
@ChrisBeaumont this has been sitting idle for a while and I don't really have time to dig into it; my side-sprint on the other PR was motivated by immediate need. Do you think this is mergeable or should we just leave it until we can make a reasonable test suite? |
IMO this is straightforward + functional enough that you could merge it if you want. |
@ChrisBeaumont this is for you, maybe @astrofrog too since you made the successful one-off pvextractor widget.
Would it be possible to open a cube in Glue, or at least with the Glue quick-viewer, from within an existing session? I'm thinking of getting access to on-the-fly coordinate changes within glue, essentially, but starting from a regular old command line application.