SIMPUT API

class soxs.simput.SimputCatalog(spectra, images, src_names, ra, dec, fluxes, emin, emax, filename)[source]
append(source, src_filename=None, overwrite=False)[source]

Add a source to this catalog.

Parameters:
  • source (SimputSource) – The SIMPUT source to append to this catalog.

  • src_filename (string, optional) – If set, this will be the filename to write the source to. By default, the source will be written to the same file as the SIMPUT catalog.

  • overwrite (boolean, optional) – Whether to overwrite an existing file with the same name. If src_filename=None and the source is to be written to the SIMPUT catalog file, then this argument is ignored. If src_filename is another value, it exists, and overwrite=False, the source will be appended to the file. Default: False

classmethod from_file(filename)[source]

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

Parameters:

filename (string) – The name of the SIMPUT catalog file to read the catalog and photon lists from.

classmethod from_source(filename, source, src_filename=None, overwrite=False)[source]

Create a new SimputCatalog instance using a single SimputSource instance.

Parameters:
  • filename (string) – The name of the SIMPUT catalog file to write. The file will be written

  • source (SimputSource) – The SIMPUT source to create the catalog with.

  • src_filename (string, optional) – If set, this will be the filename to write the source to. By default, the source will be written to the same file as the SIMPUT catalog.

  • overwrite (boolean, optional) – Whether to overwrite an existing file with the same name. If src_filename=None and the source is to the written to the SIMPUT catalog file, then this argument is ignored. If src_filename is another value, it exists, and overwrite=False, the source will be appended to the file. Default: False

read_source(spec)[source]

Read a source from the SIMPUT catalog with the identifier spec for the SPECTRUM field.

class soxs.simput.SimputSpectrum(emin, emax, flux, energy, fluxdensity, ra, dec, name=None, imhdu=None)[source]
classmethod from_models(name, spectral_model, spatial_model, width, nx)[source]

Generate a SIMPUT spectrum from a spectral and a spatial model, and parameters for an image.

Parameters:
  • name (string) – The name of the SIMPUT spectrum.

  • 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.

  • width (float, (value, unit) tuple, or Quantity) – The width of the image in arcminutes.

  • nx (integer) – The resolution of the image, e.g. the number of pixels on a side.

classmethod from_spectrum(name, spectral_model, ra, dec, imhdu=None)[source]

Generates a SIMPUT spectrum model for a point source from a spectral model and a coordinate on the sky. An image can be optionally included for an extended source.

Parameters:
  • name (string) – The name of the SIMPUT spectrum.

  • spectral_model (Spectrum) – The spectral model to use to generate the event energies.

  • ra (float, (value, unit) tuple, or Quantity) – The RA of the source in degrees.

  • dec (float, (value, unit) tuple, or Quantity) – The Dec of the source in degrees.

  • imhdu (string or ImageHDU instance) – An image to be used to simulate an extended source. Can be an ImageHDU instance or the name of a file to read one from. If the name contains an HDU extension, e.g. “cluster.fits[1]” or “cluster.fits[‘perseus’]”, that extension will be loaded.

class soxs.simput.SimputPhotonList(ra, dec, energy, flux, name=None)[source]
classmethod from_models(name, spectral_model, spatial_model, t_exp, area, prng=None)[source]

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

Parameters:
  • name (string) – The name of the SIMPUT 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.

soxs.simput.make_bkgnd_simput(filename, exp_time, area, fov, sky_center, absorb_model=None, nH=None, frgnd_velocity=None, frgnd_spec_model=None, frgnd_abund=None, append=False, overwrite=False, src_filename=None, input_sources=None, output_sources=None, diffuse_unresolved=True, prng=None)[source]

Create a SIMPUT catalog including the Galactic foreground and the CXB point sources, suitable for including in a simulation by another package that can take SIMPUT inputs, such as SIXTE, SIMX, or MARX.

Parameters:
  • filename (string) – The filename to write the SIMPUT catalog to.

  • exp_time (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.

  • fov (float, (value, unit) tuple, or Quantity) – The field of view in arcminutes.

  • sky_center (array-like) – The center RA, Dec of the field of view in degrees.

  • absorb_model (string, optional) – The absorption model to use, “wabs” or “tbabs”. Defaults to the value in the SOXS configuration file.

  • nH (float, (value, unit) tuple, or Quantity, optional) – The hydrogen column in units of 10**22 atoms/cm**2. Defaults to the value in the SOXS configuration file.

  • frgnd_velocity (float, (value, unit) tuple, or Quantity, optional) – The velocity dispersion to apply to the Galactic foreground lines. Defaults to the value in the SOXS configuration file.

  • frgnd_spec_model (string, optional) – The model for the Galactic foreground spectrum to use, currently either “default” or “halosat”. Defaults to the value in the SOXS configuration file.

  • frgnd_abund (float, optional) – The metal abundance to use for the hot halo components of the Galactic foreground spectrum. Defaults to the value in the SOXS configuration file.

  • append (boolean, optional) – If True, the photon list source will be appended to an existing SIMPUT catalog. Default: False

  • overwrite (boolean, optional) – Set to True to overwrite previous files. Default: False

  • src_filename (string, optional) – If set, this will be the filename to write the source to. By default, the source will be written to the same file as the SIMPUT catalog.

  • input_sources (string, optional) – If set to a filename, input the source positions, fluxes, and spectral indices from an ASCII table instead of generating them. Default: None

  • output_sources (string, optional) – If set to a filename, output the properties of the sources within the field of view to a file. Default: None

  • diffuse_unresolved (boolean, optional) – Add a diffuse component across the entire field of view to represent the unresolved flux from sources at very small fluxes. Default: True

  • 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.