Response API

class soxs.response.AuxiliaryResponseFile(filename)[source]

A class for auxiliary response files (ARFs).

Parameters:

filename (string) – The filename of the ARF to be read.

Examples

>>> arf = AuxiliaryResponseFile("xrs_mucal_3x10_3.0eV.arf")
detect_events_phlist(events, exp_time, flux, refband, prng=None)[source]

Use the ARF to determine a subset of photons which will be detected.

Parameters:
  • events (dict of np.ndarrays) – The energies and positions of the photons.

  • exp_time (float) – The exposure time in seconds.

  • flux (float) – The total flux of the photons in erg/s/cm^2.

  • refband (array_like) – A two-element array or list containing the limits of the energy band which the flux was computed in.

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

classmethod from_instrument(name)[source]

Return an AuxiliaryResponseFile object from the name of an existing instrument specification in SOXS.

Parameters:

name (string) – The name of the instrument specification to use to obtain the ARF object from.

Examples

>>> arf = soxs.AuxiliaryResponseFile.from_instrument("hdxi")
interpolate_area(energy)[source]

Interpolate the effective area to the energies provided by the supplied energy array.

plot(xscale='log', yscale='log', xlabel=None, ylabel=None, fig=None, ax=None, **kwargs)[source]

Make a quick plot of the effective area curve.

Parameters:
  • xscale (string) – The scale of the x-axis. “linear” or “log”.

  • yscale (string) – The scale of the y-axis. “linear” or “log”.

  • xlabel (string) – The label of the x-axis. Default: “E (keV)”

  • ylabel (string) – The label of the y-axis. Default: “$mathrm{A(cm^2)}$”

  • fig (Figure, optional) – The figure to place the plot in. If not supplied, one will be created.

  • ax (Axes, optional) – The axes to place the plot in. If not supplied, one will be created.

Notes

All other arguments are passed to the call to plot().

Returns:

class soxs.response.FlatResponse(emin, emax, area, nbins)[source]

A flat effective area response.

Parameters:
  • emin (float) – The minimum energy of the response in keV.

  • emax (float) – The maximum energy of the response in keV.

  • area (float) – The effective area in cm**2.

  • nbins (integer) – The number of bins in the response file.

Examples

>>> arf = FlatResponse(0.1, 10.0, 3000.0, 10000)
interpolate_area(energy)[source]

Interpolate the effective area to the energies provided by the supplied energy array.

class soxs.response.RedistributionMatrixFile(filename)[source]

A class for redistribution matrix files (RMFs).

Parameters:

filename (string) – The filename of the RMF to be read.

Examples

>>> rmf = RedistributionMatrixFile("xrs_hdxi.rmf")
classmethod from_instrument(name)[source]

Return an RedistributionMatrixFile object from the name of an existing instrument specification in SOXS.

Parameters:

name (string) – The name of the instrument specification to use to obtain the RMF object from.

Examples

>>> arf = soxs.RedistributionMatrixFile.from_instrument("hdxi")
scatter_energies(events, prng=None)[source]

Scatter photon energies with the RMF and produce the corresponding channel values.

Parameters:
  • events (dict of np.ndarrays) – The energies and positions of the photons.

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