Redistribution Matrix File (RMF)

The Redistribution Matrix File (frequenty referred to simply as RMF) describes the probability distribution of detector pulse heights that arise when a photon interacts with the detector. It is a 2D matrix with the pulse height distribution as a function of incoming photon energy. Seee the CXC documentation page on RMFs

class pyxsis.xrayspectrum1d.RMF(energ_lo=None, energ_hi=None, matrix=None, energ_unit=None, offset=0.0, n_grp=array([], dtype=float64), f_chan=array([], dtype=float64), n_chan=array([], dtype=float64), detchans=0)[source]
apply_rmf(model)[source]

Fold the spectrum through the redistribution matrix.

The redistribution matrix is saved as a flattened 1-dimensional vector to save space. In reality, for each entry in the flux vector, there exists one or more sets of channels that this flux is redistributed into. The additional arrays n_grp, f_chan and n_chan store this information:

  • n_group stores the number of channel groups for each energy bin

  • f_chan stores the first channel that each channel for each channel set

  • n_chan stores the number of channels in each channel set

As a result, for a given energy bin i, we need to look up the number of channel sets in n_grp for that energy bin. We then need to loop over the number of channel sets. For each channel set, we look up the first channel into which flux will be distributed as well as the number of channels in the group. We then need to also loop over the these channels and actually use the corresponding elements in the redistribution matrix to redistribute the photon flux into channels.

All of this is basically a big bookkeeping exercise in making sure to get the indices right.

Inputs

modelnumpy.ndarray

The (model) spectrum to be folded

Returns

countsnumpy.ndarray

The (model) spectrum after folding, in counts/s/channel