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

Cannot add beam when setting north=True #479

Open
astrojysun opened this issue Sep 22, 2022 · 0 comments
Open

Cannot add beam when setting north=True #479

astrojysun opened this issue Sep 22, 2022 · 0 comments

Comments

@astrojysun
Copy link

I got the following error when working on an image that has beam information in its header:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/var/folders/qh/btyjv_d12px7hzhdnhx71t8m0000gn/T/ipykernel_66057/151975569.py in <module>
     37     ra_deg, dec_deg, width=width_deg, height=height_deg)
     38 subfig.show_colorscale(cmap='coolwarm')
---> 39 subfig.add_beam()
     40 subfig.beam.set_facecolor('w')
     41 subfig.beam.set_linewidth(0)

~/software/miniconda3/envs/py3.7/lib/python3.7/site-packages/aplpy/decorators.py in wrapper(*args, **kwargs)
     26 
     27         try:
---> 28             return f(*args, **kwargs)
     29         finally:
     30             mydata.nesting -= 1

~/software/miniconda3/envs/py3.7/lib/python3.7/site-packages/aplpy/core.py in add_beam(self, *args, **kwargs)
   1970         # Initalize the beam and set parameters
   1971         b = Beam(self)
-> 1972         b.show(*args, **kwargs)
   1973 
   1974         if hasattr(self, 'beam'):

~/software/miniconda3/envs/py3.7/lib/python3.7/site-packages/aplpy/decorators.py in wrapper(*args, **kwargs)
     26 
     27         try:
---> 28             return f(*args, **kwargs)
     29         finally:
     30             mydata.nesting -= 1

~/software/miniconda3/envs/py3.7/lib/python3.7/site-packages/aplpy/overlays.py in show(self, major, minor, angle, corner, frame, borderpad, pad, **kwargs)
    379 
    380         if isinstance(major, str):
--> 381             major = self._header[major]
    382 
    383         if isinstance(minor, str):

~/software/miniconda3/envs/py3.7/lib/python3.7/site-packages/astropy/io/fits/header.py in __getitem__(self, key)
    155             keyword = key
    156 
--> 157         card = self._cards[self._cardindex(key)]
    158 
    159         if card.field_specifier is not None and keyword == card.rawkeyword:

~/software/miniconda3/envs/py3.7/lib/python3.7/site-packages/astropy/io/fits/header.py in _cardindex(self, key)
   1744 
   1745         if not indices:
-> 1746             raise KeyError(f"Keyword {keyword!r} not found.")
   1747 
   1748         try:

KeyError: "Keyword 'BMAJ' not found."

Upon further tests, I noticed this error would go away if I don't use north=True when initializing the FITSFigure object. I haven't checked the source code, but I am guessing that the header information somehow gets dropped when converting the header to make the image north-aligned?

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

No branches or pull requests

1 participant