set_origin

sherpa.utils.set_origin(dims, maxindex=None)[source] [edit on github]

Return the position of the origin of the kernel.

Parameters
  • dims (number or sequence) – The dimensions of the kernel. This should be a scalar or a one- or two-element sequence.

  • maxindex (None or int, optional) – If given, then use this location - which is the index into the flattened array - as the center, otherwise use the center of the grid.

Returns

cs – The coordinates of the center, matching the input dims format.

Return type

ndarray or number

Examples

>>> set_origin(12)
5
>>> set_origin([12])
array([5])
>>> set_origin([12], 4)
array([4])
>>> set_origin([12, 13])
array([5, 6])
>>> set_origin([12, 13], 42)
array([6, 3])