diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-04-06 16:48:06 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-04-06 16:48:06 +0800 |
commit | 902afb74e35374df2b5314b0537a0e622afb52de (patch) | |
tree | 867ae6ca7e141d85dd9268983b0043f9778d5674 /python | |
parent | e7faf7f1c7f04149627a2d3dd77edb23dc17a561 (diff) | |
download | atoolbox-902afb74e35374df2b5314b0537a0e622afb52de.tar.bz2 |
correct_crosstalk.py: fix RMF get_rmfimg() for XMM EPIC RMF
Diffstat (limited to 'python')
-rwxr-xr-x | python/correct_crosstalk.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python/correct_crosstalk.py b/python/correct_crosstalk.py index e4d956e..7d83912 100755 --- a/python/correct_crosstalk.py +++ b/python/correct_crosstalk.py @@ -16,9 +16,11 @@ # # Weitian LI # Created: 2016-03-26 -# Updated: 2016-04-02 +# Updated: 2016-04-06 # # ChangeLog: +# 2016-04-06: +# * Fix `RMF: get_rmfimg()' for XMM EPIC RMF # 2016-04-02: # * Interpolate ARF in order to match the spectral channel energies # * Add version and date information @@ -298,7 +300,10 @@ class RMF: # {{{ to a 2D image/matrix. """ def _make_rmfimg_row(n_channel, dtype, f_chan, n_chan, mat_row): + # make sure that `f_chan' and `n_chan' are 1-D numpy array + f_chan = np.array(f_chan).reshape(-1) f_chan -= 1 # FITS indices are 1-based + n_chan = np.array(n_chan).reshape(-1) idx = np.concatenate([ np.arange(f, f+n) \ for f, n in zip(f_chan, n_chan) ]) rmfrow = np.zeros(n_channel, dtype=dtype) @@ -311,7 +316,7 @@ class RMF: # {{{ n_channel = len(self.channel) rmf_dtype = self.matrix[0].dtype rmfimg = np.zeros(shape=(n_energy, n_channel), dtype=rmf_dtype) - for i in range(n_energy): + for i in np.arange(n_energy)[self.n_grp > 0]: rmfimg[i, :] = _make_rmfimg_row(n_channel, rmf_dtype, self.f_chan[i], self.n_chan[i], self.matrix[i]) self.rmfimg = rmfimg |