This function should start with ``data = np.asarray(data)`` for efficiency/robustness I think; it takes ``array_like`` input.