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

[FEAT] Turning off certain features in plugins #2696

Open
jzuhone opened this issue Feb 9, 2024 · 4 comments
Open

[FEAT] Turning off certain features in plugins #2696

jzuhone opened this issue Feb 9, 2024 · 4 comments
Labels
feature Feature request imviz

Comments

@jzuhone
Copy link

jzuhone commented Feb 9, 2024

Jdaviz component

Imviz

What is the problem this feature will solve?

The context: I am thinking about developing a new prototype exposure time calculator for X-ray missions. What I would like to have in this calculator is a way to display images generated from mocks (that we already have the software to make) and extract spectra from those images (that we can already do) that would be displayed in the Jdaviz plugins. After experimenting with Jdaviz it seems like I should be using this to build some components of it and not reinventing the wheel--even though we'd have to manipulate the X-ray data behind the scenes, it would work very nicely.

The issue is that by default plugins like Imviz have a lot of options in the menus that would not be useful for such a use case, like catalogs, etc., since the data are mocks. I was wondering if there was an easy way to turn them off--simply to reduce the number of options to what the user expects to find useful. I saw that there are YAML config files in the code base, and that there are methods like Application.load_configuration, but it doesn't look like I can turn off menu / tray items this way with the current API.

If there's a way to do it with the current API, great--but if not and there's some way I can do this by subclassing Imviz or something else, that would also be fine (more than happy to submit a PR if whatever I come up with ends up being generally useful).

Describe the desired outcome

Being able to hide/remove options that are not relevant to the use case.

Additional context

No response

@jzuhone jzuhone added feature Feature request needs-triage Issue opened via template and needs triaging labels Feb 9, 2024
@pllim pllim added imviz and removed needs-triage Issue opened via template and needs triaging labels Feb 9, 2024
@pllim
Copy link
Contributor

pllim commented Feb 9, 2024

Thanks for reaching out! There is no easy way right now, except for subclassing and defining your own config (as you suspected). See this test for example:

def test_nonstandard_specviz_viewer_name(spectrum1d):

I know @bmorris3 been investigating reusing Cubeviz for Roman ramp cubes (different viewer config but same underlying problem conceptually), so maybe he can advise.

@pllim
Copy link
Contributor

pllim commented Feb 9, 2024

p.s. If you are talking about image cube and wanting to extract spectra from them "in real time," maybe Cubeviz is a better fit for you than Imviz. For instance: https://jdaviz.readthedocs.io/en/latest/cubeviz/plugins.html#spectral-extraction

@jzuhone
Copy link
Author

jzuhone commented Feb 9, 2024

@pllim thanks for the explanation, I think I will try this route and see how it goes. '

As far as your second recommendation, I will have a look at it, but the real issue is that X-ray data is typically stored in FITS table data lists of photon events, given how few photons there are compared to longer-wavelength bands. So one then bins up these events into images and/or spectra from these primary data products. But for Cubeviz I think the idea is that you have the spectral cube already. X-ray data is unfortunately a long way away from having enough data that it makes sense to store it in a cube, though maybe creating a virtual in-memory cube for cubeviz is feasible.

@kecnry
Copy link
Member

kecnry commented Feb 12, 2024

If you just want to remove plugins from the sidebar that aren't relevant, you can do that fairly easily without modifying source code (although note that this isn't technically considered public API and so could break in the future):

imviz.app.state.tray_items = [ti for ti in imviz.app.state.tray_items if ti['label'] not in ('Metadata', 'Catalog Search')]

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

No branches or pull requests

3 participants