pad_bounding_box

sherpa.utils.pad_bounding_box(kernel, mask)[source] [edit on github]

Expand the kernel to match the mask.

Parameters
  • kernel (numeric sequence) – The data to copy. The data is a 1D array.

  • mask (int sequence) – The mask determines the size of the output and where to place the kernel values. It is expected that the number of non-zero mask elements matches the size of the kernel parameter.

Returns

nkernel – The output is the same size as the mask, and initialized to zero everywhere. Cells where the mask is non-zero are copied from the kernel.

Return type

ndarray

Examples

>>> pad_bounding_box([1, 2, 3, 4], [1, 1, 0, 1, 1, 0, 0, 0, 0])
array([ 1.,  2.,  0.,  3.,  4.,  0.,  0.,  0.,  0.])