Point Source Catalog¶
Though SOXS creates events from point sources as part of the background, one may want to study the point source properties in detail, and desire finer-grained control over their generation. SOXS provides the make_point_sources_file()
function for this purpose, to create a set of photons from point sources using the point-source background model and store them in a SIMPUT catalog.
First, import our modules:
[1]:
import matplotlib
matplotlib.rc("font", size=18)
import soxs
Second, define our parameters:
[2]:
exp_time = (300.0, "ks") # in seconds
fov = 20.0 # in arcmin
sky_center = [22.0, -27.0] # in degrees
Now, use make_point_sources_file()
to create a SIMPUT catalog made up of photons from point sources. We’ll set a random seed using the prng
parameter to make sure we get the same result every time. We will also write the point source properties to an ASCII table for later analysis, using the output_sources
parameter:
[3]:
soxs.make_point_sources_file(
"my_cat.simput",
"ptsrc",
exp_time,
fov,
sky_center,
prng=24,
output_sources="point_source_table.dat",
overwrite=True,
)
soxs : [INFO ] 2024-06-19 16:00:53,705 Appending source 'ptsrc' to my_cat.simput.
[3]:
<soxs.simput.SimputCatalog at 0x1262382f0>
In a subsequent invocation of make_point_sources_file()
, one could use the ASCII table of sources as an input to generate events from the same sources, using the input_sources
keyword argument.
Next, use the instrument_simulator()
to simulate the observation. Since we explicitly created a SIMPUT catalog of point sources, we should turn the automatic point-source background in SOXS off by setting ptsrc_bkgnd=False
:
[4]:
soxs.instrument_simulator(
"my_cat.simput",
"ptsrc_cat_evt.fits",
exp_time,
"lynx_hdxi",
sky_center,
overwrite=True,
ptsrc_bkgnd=False,
)
soxs : [INFO ] 2024-06-19 16:00:53,909 Making observation of source in ptsrc_cat_evt.fits.
soxs : [INFO ] 2024-06-19 16:00:54,217 Detecting events from source ptsrc.
soxs : [INFO ] 2024-06-19 16:00:54,217 Applying energy-dependent effective area from xrs_hdxi_3x10.arf.
soxs : [INFO ] 2024-06-19 16:00:55,595 Pixeling events.
soxs : [INFO ] 2024-06-19 16:00:56,353 Scattering events with a image-based PSF.
soxs : [INFO ] 2024-06-19 16:00:56,961 5575845 events were detected from the source.
soxs : [INFO ] 2024-06-19 16:00:57,125 Scattering energies with RMF xrs_hdxi.rmf.
soxs : [INFO ] 2024-06-19 16:01:03,907 Adding background events.
soxs : [INFO ] 2024-06-19 16:01:03,984 Adding in astrophysical foreground.
soxs : [INFO ] 2024-06-19 16:01:15,317 Adding in instrumental background.
soxs : [INFO ] 2024-06-19 16:01:17,252 Making 51226542 events from the galactic foreground.
soxs : [INFO ] 2024-06-19 16:01:17,252 Making 785694 events from the instrumental background.
soxs : [INFO ] 2024-06-19 16:01:22,159 Writing events to file ptsrc_cat_evt.fits.
soxs : [INFO ] 2024-06-19 16:01:41,556 Observation complete.
We can use the write_image()
function in SOXS to bin the events into an image and write them to a file, restricting the energies between 0.7 and 2.0 keV:
[5]:
soxs.write_image(
"ptsrc_cat_evt.fits", "ptsrc_img.fits", emin=0.7, emax=2.0, overwrite=True
)
We can now show the resulting image:
[6]:
fig, ax = soxs.plot_image(
"ptsrc_img.fits",
stretch="sqrt",
cmap="plasma",
width=0.1,
vmin=0.0,
vmax=1.0,
center=[22.0, -27.0],
)