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

Missing aperture in version 0.14.0 #211

Open
bhilbert4 opened this issue Feb 1, 2022 · 5 comments
Open

Missing aperture in version 0.14.0 #211

bhilbert4 opened this issue Feb 1, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@bhilbert4
Copy link

I'm running into an odd error when testing version 0.14.0.

I have a package that relies on pysiaf. Within that package I have a test that uses pysiaf to generate coordinates of the corners of various apertures. (https://github.com/spacetelescope/mirage/blob/master/tests/test_siaf_interface.py) When I run this test using version 0.13.0, it completes successfully. But when I run it with version 0.14.0 it fails. It appears that the list of aperture names generated using iando.read.read_siaf_detector_layout() contains an aperture that is not present in the NIRCam Siaf instance that is created later. The aperture causing the problem is NRCA2_FULL_WEDGE_BAR, which is one of several new NIRCam apertures in version 0.14.0.

Here is a working example of the failure:

In [1]: from pysiaf import iando

In [2]: siaf_detector_layout = iando.read.read_siaf_detector_layout()

In [3]: master_aperture_names = siaf_detector_layout['AperName'].data

In [4]: master_aperture_names
Out[4]: 
array(['NRCA1_FULL', 'NRCA3_FULL', 'NRCA5_FULL', 'NRCB2_FULL',
       'NRCB4_FULL', 'NRCA2_FULL', 'NRCA4_FULL', 'NRCB1_FULL',
       'NRCB3_FULL', 'NRCB5_FULL', 'NRCA2_FULL_WEDGE_RND',
       'NRCA2_FULL_WEDGE_BAR', 'NRCA4_FULL_WEDGE_RND',
       'NRCA4_FULL_WEDGE_BAR', 'NRCA1_FULL_WEDGE_RND',
       'NRCA1_FULL_WEDGE_BAR', 'NRCA3_FULL_WEDGE_RND',
       'NRCA3_FULL_WEDGE_BAR', 'NRCA5_FULL_WEDGE_RND',
       'NRCA5_FULL_WEDGE_BAR', 'FGS1_FULL', 'FGS2_FULL', 'NIS_CEN',
       'NRS1_FULL', 'NRS2_FULL', 'MIRIM_FULL'], dtype='<U20')

In [5]: from pysiaf import Siaf

In [6]: n = Siaf('nircam')

In [7]: n['NRCA2_FULL_WEDGE_BAR']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-7-574026bae4c4> in <module>
----> 1 n['NRCA2_FULL_WEDGE_BAR']

~/miniconda3/envs/mirage-py3.8/lib/python3.8/site-packages/pysiaf/siaf.py in __getitem__(self, key)
     56     def __getitem__(self, key):
     57         """Return aperture corresponding to name key."""
---> 58         return self.apertures[key]
     59 
     60     def __str__(self):

KeyError: 'NRCA2_FULL_WEDGE_BAR'
@Witchblade101 Witchblade101 added the bug Something isn't working label Feb 1, 2022
@Witchblade101
Copy link
Collaborator

I can reproduce this error with PySIAF 0.14.0 and Python 3.7

@mfixstsci
Copy link
Collaborator

Hey All -- I made a mistake in the release and just updated it. It was release 0.14.0 but some folks need pysiaf to be installed via astroconda and I changed it to v0.14.0 to be in line with our releasing convention and for it to work with the astroconda channel. Let me double check pip to see if it was updated there too. I am hoping it's just as simple as a pip install pysiaf --upgrade

@mfixstsci
Copy link
Collaborator

Okay, it doesn't look like anything was effected by changing the release name... Just thought I would start there because of the timing.

@Witchblade101
Copy link
Collaborator

Witchblade101 commented Feb 1, 2022

For completeness I checked all of the NRC master aperture names:

Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 05:59:23)

Type 'copyright', 'credits' or 'license' for more information
IPython 7.31.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pysiaf import Siaf

In [2]: n = Siaf('nircam')

In [3]: n['NRCA1_FULL']
Out[3]: <pysiaf.Aperture object AperName=NRCA1_FULL >

In [4]: n['NRCA3_FULL']
Out[4]: <pysiaf.Aperture object AperName=NRCA3_FULL >

In [5]: n['NRCA5_FULL']
Out[5]: <pysiaf.Aperture object AperName=NRCA5_FULL >

In [6]: n['NRCB2_FULL']
Out[6]: <pysiaf.Aperture object AperName=NRCB2_FULL >

In [7]: n['NRCB4_FULL']
Out[7]: <pysiaf.Aperture object AperName=NRCB4_FULL >

In [8]: n['NRCA2_FULL']
Out[8]: <pysiaf.Aperture object AperName=NRCA2_FULL >

In [9]: n['NRCA4_FULL']
Out[9]: <pysiaf.Aperture object AperName=NRCA4_FULL >

In [10]: n['NRCB1_FULL']
Out[10]: <pysiaf.Aperture object AperName=NRCB1_FULL >

In [11]: n['NRCB3_FULL']
Out[11]: <pysiaf.Aperture object AperName=NRCB3_FULL >

In [12]: n['NRCB5_FULL']
Out[12]: <pysiaf.Aperture object AperName=NRCB5_FULL >

In [13]: n['NRCA2_FULL_WEDGE_RND']
Out[13]: <pysiaf.Aperture object AperName=NRCA2_FULL_WEDGE_RND >

In [14]: n['NRCA4_FULL_WEDGE_RND']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-14-e0dda8d0de64> in <module>
----> 1 n['NRCA4_FULL_WEDGE_RND']

~/miniconda3/envs/pysiaf-3.7/lib/python3.7/site-packages/pysiaf/siaf.py in __getitem__(self, key)
     56     def __getitem__(self, key):
     57         """Return aperture corresponding to name key."""
---> 58         return self.apertures[key]
     59
     60     def __str__(self):

KeyError: 'NRCA4_FULL_WEDGE_RND'

In [15]: n['NRCA4_FULL_WEDGE_BAR']
Out[15]: <pysiaf.Aperture object AperName=NRCA4_FULL_WEDGE_BAR >

In [16]: n['NRCA1_FULL_WEDGE_RND']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-16-3b9f10100442> in <module>
----> 1 n['NRCA1_FULL_WEDGE_RND']

~/miniconda3/envs/pysiaf-3.7/lib/python3.7/site-packages/pysiaf/siaf.py in __getitem__(self, key)
     56     def __getitem__(self, key):
     57         """Return aperture corresponding to name key."""
---> 58         return self.apertures[key]
     59
     60     def __str__(self):

KeyError: 'NRCA1_FULL_WEDGE_RND'

In [17]: n['NRCA1_FULL_WEDGE_BAR']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-17-f8cb592410b9> in <module>
----> 1 n['NRCA1_FULL_WEDGE_BAR']

~/miniconda3/envs/pysiaf-3.7/lib/python3.7/site-packages/pysiaf/siaf.py in __getitem__(self, key)
     56     def __getitem__(self, key):
     57         """Return aperture corresponding to name key."""
---> 58         return self.apertures[key]
     59
     60     def __str__(self):

KeyError: 'NRCA1_FULL_WEDGE_BAR'

In [18]: n['NRCA3_FULL_WEDGE_RND']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-18-aeb439f6f843> in <module>
----> 1 n['NRCA3_FULL_WEDGE_RND']

~/miniconda3/envs/pysiaf-3.7/lib/python3.7/site-packages/pysiaf/siaf.py in __getitem__(self, key)
     56     def __getitem__(self, key):
     57         """Return aperture corresponding to name key."""
---> 58         return self.apertures[key]
     59
     60     def __str__(self):

KeyError: 'NRCA3_FULL_WEDGE_RND'

In [19]: n['NRCA3_FULL_WEDGE_BAR']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-19-8e29596973ae> in <module>
----> 1 n['NRCA3_FULL_WEDGE_BAR']

~/miniconda3/envs/pysiaf-3.7/lib/python3.7/site-packages/pysiaf/siaf.py in __getitem__(self, key)
     56     def __getitem__(self, key):
     57         """Return aperture corresponding to name key."""
---> 58         return self.apertures[key]
     59
     60     def __str__(self):

KeyError: 'NRCA3_FULL_WEDGE_BAR'

In [20]: n['NRCA5_FULL_WEDGE_RND']
Out[20]: <pysiaf.Aperture object AperName=NRCA5_FULL_WEDGE_RND >

In [21]: n['NRCA5_FULL_WEDGE_BAR']
Out[21]: <pysiaf.Aperture object AperName=NRCA5_FULL_WEDGE_BAR >

It looks like all 6 of the new apertures fail.

@Witchblade101
Copy link
Collaborator

This looks like it's resolved in v15. @bhilbert4 if you can confirm that then we can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants