- sherpa.models.regrid.rebin_no_int(array, dimensions=None, scale=None)
Rebin the array, conserving flux.
Return the array
arrayto the new
dimensionsconserving flux, so that the sum of the output matches the sum of
AssertionError – If the totals of the input and result array don’t agree, raise an error because computation may have gone wrong
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.
>>> 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]])