def array(arr, copy=True):
import ROOT<EOL>if isinstance(arr, ROOT.TArrayD):<EOL><INDENT>arr = _librootnumpy.array_d(ROOT.AsCObject(arr))<EOL><DEDENT>elif isinstance(arr, ROOT.TArrayF):<EOL><INDENT>arr = _librootnumpy.array_f(ROOT.AsCObject(arr))<EOL><DEDENT>elif isinstance(arr, ROOT.TArrayL):<EOL><INDENT>arr = _librootnumpy.array_l(ROOT.AsCObject(arr))<EOL><DEDENT>elif isinstance(arr, ROOT.TArrayI):<EOL><INDENT>arr = _librootnumpy.array_i(ROOT.AsCObject(arr))<EOL><DEDENT>elif isinstance(arr, ROOT.TArrayS):<EOL><INDENT>arr = _librootnumpy.array_s(ROOT.AsCObject(arr))<EOL><DEDENT>elif isinstance(arr, ROOT.TArrayC):<EOL><INDENT>arr = _librootnumpy.array_c(ROOT.AsCObject(arr))<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(type(arr)))<EOL><DEDENT>if copy:<EOL><INDENT>return np.copy(arr)<EOL><DEDENT>return arr<EOL>
Convert a ROOT TArray into a NumPy array.

    Parameters
    ----------
    arr : ROOT TArray
        A ROOT TArrayD, TArrayF, TArrayL, TArrayI or TArrayS
    copy : bool, optional (default=True)
        If True (the default) then copy the underlying array, otherwise the
        NumPy array will view (and not own) the same memory as the ROOT array.

    Returns
    -------
    arr : NumPy array
        A NumPy array

    Examples
    --------
    >>> from root_numpy import array
    >>> from ROOT import TArrayD
    >>> a = TArrayD(5)
    >>> a[3] = 3.141
    >>> array(a)
    array([ 0.   ,  0.   ,  0.   ,  3.141,  0.   ])