SIMPUT API

class soxs.simput.SimputCatalog(name, photon_lists)[source]
append(photon_list)[source]

Add a photon list to this catalog.

Parameters:photon_list (PhotonList) – The photon list to append to this catalog.
classmethod from_file(simput_file)[source]

Generate a SIMPUT catalog object by reading it in from disk.

Parameters:simput_file (string) – The name of the SIMPUT catalog file to read the catalog and photon lists from.
classmethod from_models(name, phlist_name, spectral_model, spatial_model, t_exp, area, prng=None)[source]

Generate a SIMPUT catalog object and a single photon list from a spectral and a spatial model.

Parameters:
  • name (string) – The name of the SIMPUT catalog. This will be the prefix of the SIMPUT catalog file that is written from this SIMPUT catalog.
  • phlist_name (string) – The name of the photon list. This will be the prefix of the photon list file which is created from the PhotonList object which is created here.
  • spectral_model (Spectrum) – The spectral model to use to generate the event energies.
  • spatial_model (SpatialModel) – The spatial model to use to generate the event coordinates.
  • t_exp (float, (value, unit) tuple, or Quantity) – The exposure time in seconds.
  • area (float, (value, unit) tuple, or Quantity) – The effective area in cm**2. If one is creating events for a SIMPUT file, a constant should be used and it must be large enough so that a sufficiently large sample is drawn for the ARF.
  • prng (RandomState object, integer, or None) – A pseudo-random number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is None, which sets the seed based on the system time.
write_catalog(overwrite=False)[source]

Write the SIMPUT catalog and associated photon lists to disk.

Parameters:overwrite (boolean, optional) – Whether or not to overwrite an existing file with the same name. Default: False
class soxs.simput.PhotonList(name, ra, dec, energy, flux)[source]
classmethod from_models(name, spectral_model, spatial_model, t_exp, area, prng=None)[source]

Generate a single photon list from a spectral and a spatial model.

Parameters:
  • name (string) – The name of the photon list. This will also be the prefix of any photon list file that is written from this photon list.
  • spectral_model (Spectrum) – The spectral model to use to generate the event energies.
  • spatial_model (SpatialModel) – The spatial model to use to generate the event coordinates.
  • t_exp (float, (value, unit) tuple, or Quantity) – The exposure time in seconds.
  • area (float, (value, unit) tuple, or Quantity) – The effective area in cm**2. If one is creating events for a SIMPUT file, a constant should be used and it must be large enough so that a sufficiently large sample is drawn for the ARF.
  • prng (RandomState object, integer, or None) – A pseudo-random number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is None, which sets the seed based on the system time.
plot(center, width, s=None, c=None, marker=None, stride=1, emin=None, emax=None, label=None, fontsize=18, fig=None, ax=None, **kwargs)[source]

Plot event coordinates from this photon list in a scatter plot, optionally restricting the photon energies which are plotted and using only a subset of the photons.

Parameters:
  • center (array-like) – The RA, Dec of the center of the plot in degrees.
  • width (float, (value, unit) tuple, or Quantity) – The width of the plot in arcminutes.
  • s (integer, optional) – Size of the scatter marker in points^2.
  • c (string, optional) – The color of the points.
  • marker (string, optional) – The marker to use for the points in the scatter plot. Default: ‘o’
  • stride (integer, optional) – Plot every stride events. Default: 1
  • emin (float, (value, unit) tuple, or Quantity) – The minimum energy of the photons to plot. Default is the minimum energy in the list.
  • emax (float, (value, unit) tuple, or Quantity) – The maximum energy of the photons to plot. Default is the maximum energy in the list.
  • label (string, optional) – The label of the spectrum. Default: None
  • fontsize (int) – Font size for labels and axes. Default: 18
  • fig (Figure, optional) – A Figure instance to plot in. Default: None, one will be created if not provided.
  • ax (Axes, optional) – An Axes instance to plot in. Default: None, one will be created if not provided.
write_photon_list(simput_prefix, append=False, overwrite=False)[source]

Write the photon list to disk, attaching it to a SIMPUT catalog.

Parameters:
  • simput_prefix (string) – The prefix of the SIMPUT catalog file to associate this photon list with. If it does not exist, it will be created.
  • append (boolean, optional) – If True, append to an existing SIMPUT catalog. If False, overwrite an existing SIMPUT catalog with this name (if it exists) and create a new one with this photon list. Default: False
  • overwrite (boolean, optional) – Whether or not to overwrite an existing file with the same name. Default: False