SourceDetection (xsnap.SourceDetection
)#
Methods |
Attributes |
---|---|
|
|
- class SourceDetection(evt_paths=None, exp_paths=None, pha_paths=None)#
Bases:
object
A class to detect sources (via XIMAGE) with certain SNR (default SNR \(\geq\) 3) across multiple observation datasets.
- pha_paths#
Array of absoulte PHA (spectrum) file paths.
- Type:
array
- evt_paths#
Array of absoulte EVT (event) file paths.
- Type:
array
- exp_paths#
Array of absoulte EXP (exposure image) file paths.
- Type:
array
- results#
Source detection results per event files, mapping
{evt_file: 'detected' | 'not detected'}
.
- detect_tables#
Table of detected sources in an event files, mapping
{evt_file: pandas.DataFrame}
.- Type:
- __iadd__(files)#
Append a dataset via
+=
with an array of length 1–3.- Parameters:
files (array_like) – Files in an array_like with options:
(evt)
;(pha, evt)
; or(pha, evt, exp)
- Returns:
- selfSourceDetection
The same
SourceDetection
instance.
- Raises:
RuntimeError – If array length is not 1, 2, or 3.
FileNotFoundError – If any file does not exist.
- __init__(evt_paths=None, exp_paths=None, pha_paths=None)#
Initialization of the
SourceDetection
class.- Parameters:
evt_paths (array_like, optional) – Paths to event (EVT) files. Defaults to
None
.exp_paths (array_like, optional) – Paths to exposure image (EXP) files. Defaults to
None
.pha_paths (array_like, optional) – Paths to spectrum (PHA) files. Defaults to
None
.
- clear()#
Reset all stored paths, results, and tables.
- detect_all(src_ra=None, src_dec=None, snr_thresh=3.0, match_radius=25.0, details=False)#
Run detection with certain SNR (default SNR \(\geq\) 3) on all loaded datasets.
- Parameters:
src_ra (float, optional) – Source RA in degrees. Must be parsed if there are no PHA files. Defaults to
None
.src_dec (float, optional) – Source Dec in degrees. Must be parsed if there are no PHA files. Defaults to
None
.snr_thresh (float, optional) – SNR threshold for detection. Defaults to
3.0
.match_radius (float, optional) – Detection matching radius in arcseconds. Defaults to
25.0
.details (bool, optional) – If True, print detailed matches and tables. Defaults to
False
.
- Returns:
None - Populates
results
anddetect_tables
.- Raises:
RuntimeError – If the HEADAS environment is not set or files do not exist.:
KeyError – If RA/Dec cannot be read from the PHA header.:
ValueError – If neither
pha_file
nor bothsrc_ra
/src_dec
are provided.:
- load(evt_paths, exp_paths=None, pha_paths=None)#
Load parallel lists of EVT, EXP, and PHA files.
- Parameters:
evt_paths (array_like) – Event (EVT) file paths.
exp_paths (array_like, optional) – Exposure image (EXP) file paths. Defaults to
None
.pha_paths (array_like, optional) – Spectrum (PHA) file paths. Defaults to
None
.
- Raises:
ValueError – If provided lists are not all the same length.:
FileNotFoundError – If any path does not exist.:
- show_source(pha_files=None, cmap='viridis')#
Display the source region image through the pha spectrum files.
- Parameters:
pha_files (array_like, optional) – Paths to pha spectrum files to display. If provided, replaces
self.pha_paths
. Defaults toNone
.cmap (str, optional) – Matplotlib colormap name for
plt.imshow()
. Defaults toviridis
.
- Raises:
RuntimeError – If neither
pha_files
norpha_paths
contains any file paths.:- Returns:
None