Skip to content

Commit 5ad3d15

Browse files
committed
Should have fixed the tiny issue when reading regions - if there is only one image read in from disk then get_images would return an image rather than a list, and as images can't be indexed Python gets upset.
1 parent 8fe25d2 commit 5ad3d15

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

xga/sources/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
2-
# Last modified by David J Turner (turne540@msu.edu) 12/08/2024, 11:43. Copyright (c) The Contributors
2+
# Last modified by David J Turner (turne540@msu.edu) 11/03/2025, 21:00. Copyright (c) The Contributors
33

44
import os
55
import pickle
@@ -1327,6 +1327,9 @@ def dist_from_source(reg):
13271327
# TODO see issue #908, figure out how to support different resolutions of image
13281328
try:
13291329
ims = self.get_images(obs_id)
1330+
# Make sure that the return is in a list
1331+
if not isinstance(ims, list):
1332+
ims = [ims]
13301333
except NoProductAvailableError:
13311334
raise NoProductAvailableError("There is no image available for observation {o}, associated "
13321335
"with {n}. An image is currently required to check for sky "

0 commit comments

Comments
 (0)