Skip to content

Commit 73c691e

Browse files
author
David Turner
committed
Neatened combine_phot_prod a little, and clarified that it only exists to be analogous to the XMM emosaic function.
1 parent 82a54da commit 73c691e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

xga/generate/esass/phot.py

Lines changed: 26 additions & 26 deletions
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 (djturner@umbc.edu) 12/12/2025, 12:24. Copyright (c) The Contributors
2+
# Last modified by David J Turner (djturner@umbc.edu) 12/12/2025, 12:30. Copyright (c) The Contributors
33

44
import os
55
from random import randint
@@ -600,14 +600,20 @@ def expmap(sources: Union[BaseSource, NullSource, BaseSample], lo_en: Quantity =
600600
return sources_cmds, stack, execute, num_cores, sources_types, sources_paths, sources_extras, disable_progress
601601

602602

603-
def combine_phot_prod(sources: Union[BaseSource, BaseSample], to_combine: str,
604-
lo_en: Quantity = Quantity(0.2, 'keV'), hi_en: Quantity = Quantity(10, 'keV'),
603+
def combine_phot_prod(sources: Union[BaseSource, BaseSample],
604+
to_combine: str,
605+
lo_en: Quantity = Quantity(0.2, 'keV'),
606+
hi_en: Quantity = Quantity(10, 'keV'),
605607
num_cores: int = NUM_CORES,
606608
disable_progress: bool = False):
607609
"""
608-
A convenient Python wrapper for the eSASS evtool and expmap commands. Images or exposure maps
609-
will be generated from all Obs IDs associated with the source, combined together (duplicate
610-
events are removed).
610+
A convenient Python wrapper for the eSASS evtool and expmap commands. Combined
611+
images or exposure maps will be generated from all skytiles associated with the
612+
source (duplicate events are removed).
613+
614+
This only exists as an analogy to XGA-XMM's 'emosaic' function, you could
615+
just as easily use xga.generate.esass.phot.evtool_image/expmap directly, with
616+
'combine_obs=True' as an argument.
611617
612618
:param BaseSource/NullSource/BaseSample sources: A single source object, or sample of sources
613619
:param str to_combine: The data type to produce, can be either image or expmap.
@@ -618,29 +624,23 @@ def combine_phot_prod(sources: Union[BaseSource, BaseSample], to_combine: str,
618624
:param bool disable_progress: Setting this to true will turn off the eSASS generation progress
619625
bar.
620626
"""
621-
# We check to see whether there is an eROSITA entry in the 'telescopes' property.
622-
# If sources is a Source object, then that property contains the telescopes associated with
623-
# that source, and if it is a Sample object then 'telescopes' contains the list of unique
624-
# telescopes that are associated with at least one member source.
625-
# Clearly if eROSITA isn't associated at all, then continuing with this function would be pointless
626-
if ((not isinstance(sources, list) and 'erosita' not in sources.telescopes) or
627-
(isinstance(sources, list) and 'erosita' not in sources[0].telescopes)):
628-
raise TelescopeNotAssociatedError("There are no eROSITA data associated with the "
629-
"source/sample, as such eROSITA"
630-
"images or exposure maps cannot be generated.")
631-
632627
if to_combine not in ["image", "expmap"]:
633-
raise ValueError("The only valid choices for to_combine are image and expmap.")
634-
# Don't do much value checking in this module, but this one is so fundamental that I will do it
635-
elif lo_en > hi_en:
636-
raise ValueError("lo_en cannot be greater than hi_en")
628+
raise ValueError("The 'to_combine' argument accepts either 'image' or "
629+
"'expmap' as a value.")
637630

638-
# To make a mosaic we need to have the individual products in the first place
639631
if to_combine == "image":
640-
sources = evtool_image(sources, lo_en, hi_en, combine_obs=True,
641-
disable_progress=disable_progress, num_cores=num_cores)
632+
evtool_image(sources,
633+
lo_en,
634+
hi_en,
635+
combine_obs=True,
636+
disable_progress=disable_progress,
637+
num_cores=num_cores)
642638
elif to_combine == "expmap":
643-
sources = expmap(sources, lo_en, hi_en, combine_obs=True,
644-
disable_progress=disable_progress, num_cores=num_cores)
639+
expmap(sources,
640+
lo_en,
641+
hi_en,
642+
combine_obs=True,
643+
disable_progress=disable_progress,
644+
num_cores=num_cores)
645645

646646

0 commit comments

Comments
 (0)