Get the first n elements from a tuple/list, convert to arrays, and ravel.
Use this function to make sure that coordinate and data arrays are ready for building Jacobian matrices and least-squares fitting.
arrays (tuple of arrays) – The arrays. Can be lists or anything that can be converted to a numpy array (including numpy arrays).
n (int) – How many arrays to return.
1darrays (tuple of arrays) – The converted 1D numpy arrays.
>>> import numpy as np >>> arrays = [np.arange(4).reshape(2, 2)]*3 >>> n_1d_arrays(arrays, n=2) (array([0, 1, 2, 3]), array([0, 1, 2, 3]))