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

Unable to Plot COS Apertures #336

Open
Witchblade101 opened this issue Mar 8, 2024 · 0 comments
Open

Unable to Plot COS Apertures #336

Witchblade101 opened this issue Mar 8, 2024 · 0 comments

Comments

@Witchblade101
Copy link
Collaborator

I get the following errors trying to plot any COS apertures:


import pysiaf
import matplotlib.pyplot as plt
# plot an HST COS aperture
siaf = pysiaf.Siaf('HST')
aperture_names = ['LFMAC']

plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k')
for aperture_name in aperture_names:
    siaf[aperture_name].plot(color='r', fill_color='darksalmon', mark_ref=True)
ax = plt.gca()
ax.set_aspect('equal')
ax.invert_yaxis()
plt.show()

/Users/dlong/pysiaf/pysiaf/aperture.py:1401: SyntaxWarning: invalid escape sequence '\*'
  """Sky to Tel frame transformation. Requires an attitude matrix.
/Users/dlong/pysiaf/pysiaf/aperture.py:1401: SyntaxWarning: invalid escape sequence '\*'
  """Sky to Tel frame transformation. Requires an attitude matrix.

{
	"name": "UnboundLocalError",
	"message": "cannot access local variable 'corners' where it is not associated with a value",
	"stack": "---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
Cell In[1], line 9
      7 plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k')
      8 for aperture_name in aperture_names:
----> 9     siaf[aperture_name].plot(color='r', fill_color='darksalmon', mark_ref=True)
     10 ax = plt.gca()
     11 ax.set_aspect('equal')

File ~/pysiaf/pysiaf/aperture.py:666, in Aperture.plot(self, frame, label, ax, title, units, show_frame_origin, mark_ref, fill, fill_color, fill_alpha, label_rotation, **kwargs)
    663     ax.set_xlabel('X pixels ({0})'.format(frame))
    664     ax.set_ylabel('Y pixels ({0})'.format(frame))
--> 666 x, y = self.corners(frame, rederive=False)
    667 x2, y2 = self.closed_polygon_points(frame, rederive=False)
    669 if units.lower() == 'arcsec':

File ~/pysiaf/pysiaf/aperture.py:1792, in HstAperture.corners(self, to_frame, rederive)
   1789     y_Idl = np.array([self.v1y, self.v2y, self.v3y, self.v4y])
   1790     corners = SiafCoordinates(x_Idl, y_Idl, 'idl')
-> 1792 return self.convert(corners.x, corners.y, corners.frame, to_frame)

UnboundLocalError: cannot access local variable 'corners' where it is not associated with a value"
}

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