intersperse
- sherpa.plot.utils.intersperse(a, b)[source] [edit on github]
Interleave two arrays a and b
- Parameters
a (array) – Two arrys to interleave. The numbe of elements in the two arrays cannot differ by more than one.
b (array) – Two arrys to interleave. The numbe of elements in the two arrays cannot differ by more than one.
- Returns
out – array that interleaves the input arrays
- Return type
array
Example
>>> import numpy as np >>> a = np.arange(5) >>> b = np.arange(10, 14) >>> intersperse(a, b) array([ 0, 10, 1, 11, 2, 12, 3, 13, 4])
Notes
See https://stackoverflow.com/questions/5347065/interweaving-two-numpy-arrays#5347492 for interleaving arrays.