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-05-02 19:36:23,551 Appending source 'ptsrc' to my_cat.simput.
[3]:
<soxs.simput.SimputCatalog at 0x143413560>

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-05-02 19:36:23,990 Making observation of source in ptsrc_cat_evt.fits.
soxs : [INFO     ] 2024-05-02 19:36:24,439 Detecting events from source ptsrc.
soxs : [INFO     ] 2024-05-02 19:36:24,440 Applying energy-dependent effective area from xrs_hdxi_3x10.arf.
soxs : [INFO     ] 2024-05-02 19:36:25,823 Pixeling events.
soxs : [INFO     ] 2024-05-02 19:36:26,620 Scattering events with a image-based PSF.
soxs : [INFO     ] 2024-05-02 19:36:27,275 5574435 events were detected from the source.
soxs : [INFO     ] 2024-05-02 19:36:27,498 Scattering energies with RMF xrs_hdxi.rmf.
soxs : [INFO     ] 2024-05-02 19:36:34,599 Adding background events.
soxs : [INFO     ] 2024-05-02 19:36:34,672 Adding in astrophysical foreground.
soxs : [INFO     ] 2024-05-02 19:36:46,319 Adding in instrumental background.
soxs : [INFO     ] 2024-05-02 19:36:49,223 Making 51241269 events from the galactic foreground.
soxs : [INFO     ] 2024-05-02 19:36:49,226 Making 609340 events from the instrumental background.
soxs : [INFO     ] 2024-05-02 19:36:58,723 Writing events to file ptsrc_cat_evt.fits.
soxs : [INFO     ] 2024-05-02 19:38:12,286 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