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-04-15 22:14:08,653 Appending source 'ptsrc' to my_cat.simput.
[3]:
<soxs.simput.SimputCatalog at 0x1473cc7d0>

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-04-15 22:14:08,991 Making observation of source in ptsrc_cat_evt.fits.
soxs : [INFO     ] 2024-04-15 22:14:09,338 Detecting events from source ptsrc.
soxs : [INFO     ] 2024-04-15 22:14:09,339 Applying energy-dependent effective area from xrs_hdxi_3x10.arf.
soxs : [INFO     ] 2024-04-15 22:14:10,815 Pixeling events.
soxs : [INFO     ] 2024-04-15 22:14:11,682 Scattering events with a image-based PSF.
soxs : [INFO     ] 2024-04-15 22:14:12,345 5576529 events were detected from the source.
soxs : [INFO     ] 2024-04-15 22:14:12,526 Scattering energies with RMF xrs_hdxi.rmf.
soxs : [INFO     ] 2024-04-15 22:14:19,006 Adding background events.
soxs : [INFO     ] 2024-04-15 22:14:19,078 Adding in astrophysical foreground.
soxs : [INFO     ] 2024-04-15 22:14:30,533 Adding in instrumental background.
soxs : [INFO     ] 2024-04-15 22:14:33,143 Making 51235855 events from the galactic foreground.
soxs : [INFO     ] 2024-04-15 22:14:33,146 Making 611329 events from the instrumental background.
soxs : [INFO     ] 2024-04-15 22:14:40,192 Writing events to file ptsrc_cat_evt.fits.
soxs : [INFO     ] 2024-04-15 22:15:15,058 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],
)
../_images/cookbook_Point_Source_Catalog_14_0.png