Skip to content

Commit

Permalink
Merge pull request #52 from winter-telescope/imgselector
Browse files Browse the repository at this point in the history
Enforce typing on ImageSelector
  • Loading branch information
robertdstein authored Jul 29, 2022
2 parents 6c334fe + 7f7d343 commit c5a95c2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions winterdrp/processors/utils/image_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ def select_from_images(
target_values: str | list[str] = "science",
) -> tuple[list[np.ndarray], list[astropy.io.fits.Header]]:

if isinstance(target_values, str):
target_values = [target_values]
# Enforce string in list for later matching
if not isinstance(target_values, list):
target_values = [str(target_values)]
else:
target_values = [str(x) for x in target_values]

passing_images = []
passing_headers = []

for i, header in enumerate(headers):
if header[header_key] in target_values:
if str(header[header_key]) in target_values:
passing_images.append(images[i])
passing_headers.append(header)

Expand Down

0 comments on commit c5a95c2

Please sign in to comment.