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

add find_apernames function #355

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/pysiaf/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ Frame transformations (``det``, ``sci``, ``idl``, ``tel`` are supported frames):
# transform from Science frame to Ideal frame
idl_x, idl_y = nis_cen.sci_to_idl(sci_x, sci_y)

Finding Available Apertures
***************************

Each Siaf instance has an attribute ``apernames`` giving all available aperture names. There are often many of these::

siaf = pysiaf.Siaf('NIRSpec')
print (len(siaf.apernames))
# output: 75

The ``find_apernames`` method allows quick lookup of aperture names matching some substring::

siaf = pysiaf.Siaf('NIRSpec')
siaf.find_apernames('S200')
# output: ['NRS_S200A1_SLIT', 'NRS_S200A2_SLIT', 'NRS_S200B1_SLIT']


Using sky transforms
********************
Expand Down
7 changes: 6 additions & 1 deletion pysiaf/siaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,4 +522,9 @@ def plot_detector_channels(self, frame=None, ax=None):

for ap in self._getFullApertures():
ap.plot_detector_channels(frame=frame, ax=ax)


def find_apernames(self, substring):
""" Return aperture names containing some substring.
Simple utility function to search through names of available apertures.
"""
return [name for name in self.apernames if substring in name]