Skip to content

Commit

Permalink
add find_apernames function
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrin committed Oct 25, 2024
1 parent bce46e3 commit 942dcb8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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]

0 comments on commit 942dcb8

Please sign in to comment.