rebin_no_int

sherpa.models.regrid.rebin_no_int(array, dimensions=None, scale=None)[source] [edit on github]

Rebin the array, conserving flux.

Return the array array to the new dimensions conserving flux, so that the sum of the output matches the sum of array.

Raises:

AssertionError – If the totals of the input and result array don’t agree, raise an error because computation may have gone wrong

Notes

This routine is based on the example at http://martynbristow.co.uk/wordpress/blog/rebinning-data/ which was released as GPL v3 © Martyn Bristow 2015. It has been slightly modified for Sherpa.

Examples

>>> ar = np.array([
...    [0,1,2],
...    [1,2,3],
...    [2,3,4],
...    ])
>>> rebin_no_int(ar, (2,2))
array([[1.5, 4.5],
       [4.5, 7.5]])