From 7f9e90bbb4ae5f7c71eda5a90c873f0bfd24fda2 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Wed, 27 Nov 2024 13:54:20 -0500 Subject: [PATCH 1/2] add WFI footprint --- CHANGES.rst | 2 + .../imviz/plugins/footprints/footprints.py | 18 ++++- .../imviz/plugins/footprints/footprints.vue | 2 +- .../plugins/footprints/preset_regions.py | 79 +++++++++++++------ 4 files changed, 73 insertions(+), 28 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 296f82eb5a..68229bb9a0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,8 @@ Imviz * Orientation plugin API now exposes create_north_up_east_left and create_north_up_east_right methods. [#3308] +* Add Roman WFI and CGI footprints to the Footprints plugin. [#3322] + Mosviz ^^^^^^ diff --git a/jdaviz/configs/imviz/plugins/footprints/footprints.py b/jdaviz/configs/imviz/plugins/footprints/footprints.py index 9b0b50d31d..862b58b9c9 100644 --- a/jdaviz/configs/imviz/plugins/footprints/footprints.py +++ b/jdaviz/configs/imviz/plugins/footprints/footprints.py @@ -20,6 +20,13 @@ __all__ = ['Footprints'] +_available_instruments = { + display_name: {'label': display_name, 'siaf_name': siaf_name, 'observatory': observatory} + for observatory, instruments in preset_regions._instruments.items() + for display_name, siaf_name in instruments.items() +} + + @tray_registry('imviz-footprints', label="Footprints") class Footprints(PluginTemplateMixin, ViewerSelectMixin, HasFileImportSelect): """ @@ -119,11 +126,13 @@ def __init__(self, *args, **kwargs): on_remove=self._on_overlay_remove) if self.has_pysiaf: - preset_options = list(preset_regions._instruments.keys()) + preset_options = list(_available_instruments.keys()) else: preset_options = ['None'] + if not self.app.state.settings.get('server_is_remote', False): preset_options.append('From File...') + self.preset = FileImportSelectPluginComponent(self, items='preset_items', selected='preset_selected', @@ -480,8 +489,11 @@ def overlay_regions(self): regs = [regs] overlay['regions'] = regs regs = overlay.get('regions', []) - elif self.has_pysiaf and self.preset_selected in preset_regions._instruments: - regs = preset_regions.jwst_footprint(self.preset_selected, **callable_kwargs) + elif self.has_pysiaf and self.preset_selected in _available_instruments.keys(): + regs = preset_regions.instrument_footprint( + _available_instruments[self.preset_selected]['observatory'], + self.preset_selected, **callable_kwargs + ) else: # pragma: no cover regs = [] return regs diff --git a/jdaviz/configs/imviz/plugins/footprints/footprints.vue b/jdaviz/configs/imviz/plugins/footprints/footprints.vue index a9009792cf..19cc450b96 100644 --- a/jdaviz/configs/imviz/plugins/footprints/footprints.vue +++ b/jdaviz/configs/imviz/plugins/footprints/footprints.vue @@ -91,7 +91,7 @@ Footprint Definition - To use JWST footprints, install pysiaf and restart jdaviz. + To use JWST or Roman footprints, install pysiaf and restart jdaviz. Date: Thu, 5 Dec 2024 09:02:52 -0500 Subject: [PATCH 2/2] addressing review comment from Ricky --- jdaviz/configs/imviz/plugins/footprints/preset_regions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdaviz/configs/imviz/plugins/footprints/preset_regions.py b/jdaviz/configs/imviz/plugins/footprints/preset_regions.py index 030dea9290..9e9200eea5 100644 --- a/jdaviz/configs/imviz/plugins/footprints/preset_regions.py +++ b/jdaviz/configs/imviz/plugins/footprints/preset_regions.py @@ -118,7 +118,7 @@ def instrument_footprint( # use different definitions of the center for JWST and Roman: if observatory == "Roman": - if instrument.startswith("WFI"): + if 'CGI' not in instrument: center = siaf_interface.apertures['WFI_CEN'] else: center = siaf_interface.apertures['CGI_CEN']