Current File : //proc/self/root/proc/self/root/lib64/python2.7/site-packages/numpy/lib/npyio.pyc
�
E�`Qc@s�dddddddddd	d
ddd
ddgZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
ZmZddlmZddlmZmZddlmZmZmZmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$m%Z%ej&ddkr�ddl'm(Z(nddl)m*Z(eZ+d�Z,de-fd��YZ.d�Z/d e-fd!��YZ0e1d"�Z
d#�Z2d$�Z3d%�Z4d&�Z5d'�Z6e7d(e1e1de1e8dd)�Z9d*d+d,d-d-d.d/�Z:d0�Z;e7d(e1ddde1d-e1e1e1e1e1e1d1e8e<d2e1e8e<e<d3�Z=d4�Z>d5�Z?d6�Z@d7�ZAdS(8tsavetxttloadtxtt
genfromtxtt	ndfromtxtt	mafromtxtt
recfromtxtt
recfromcsvtloadtloadstsavetsaveztsavez_compressedtpackbitst
unpackbitst	fromregext
DataSourcei����N(t
itemgetter(RR(R(RR
(tLineSplittert
NameValidatortStringConvertertConverterErrortConverterLockErrortConversionWarningt_is_string_likethas_nested_fieldst
flatten_dtypet
easy_dtypet_bytes_to_name(tasbytestasstrtasbytes_nestedtbytesii(tBytesIO(tStringIOcCs�ddl}d|jfd��Y}t|t�rC||�}nit||j�r�y
|j}Wntk
r~|j}nX|j}|d|jd|�}||_n|S(sXUse this factory to produce the class so that we can do a lazy
    import on gzip.

    i����NtGzipFilecBseZdd�Zd�ZRS(icSs�|dkr|j|}n|dkr7td��n||jkr�|j�||j}x%t|d�D]}|jd�qnW|j|d�ndS(NiisIllegal argumenti(ii(toffsettIOErrortrewindtrangetread(tselfR#twhencetcountti((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pytseek+s

cSs|jS(N(R#(R(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyttell;s(t__name__t
__module__R,R-(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR")stfileobjtfilename(	tgzipR"t
isinstancetstrtnametAttributeErrorR1tmodeR0(tfR2R"R5R7((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pytseek_gzip_factory"s


	tBagObjcBs eZdZd�Zd�ZRS(su
    BagObj(obj)

    Convert attribute look-ups to getitems on the object passed in.

    Parameters
    ----------
    obj : class instance
        Object on which attribute look-up is performed.

    Examples
    --------
    >>> from numpy.lib.npyio import BagObj as BO
    >>> class BagDemo(object):
    ...     def __getitem__(self, key): # An instance of BagObj(BagDemo)
    ...                                 # will call this method when any
    ...                                 # attribute look-up is required
    ...         result = "Doesn't matter what you want, "
    ...         return result + "you're gonna get this"
    ...
    >>> demo_obj = BagDemo()
    >>> bagobj = BO(demo_obj)
    >>> bagobj.hello_there
    "Doesn't matter what you want, you're gonna get this"
    >>> bagobj.I_can_be_anything
    "Doesn't matter what you want, you're gonna get this"

    cCstj|�|_dS(N(tweakreftproxyt_obj(R(tobj((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt__init__oscCs<ytj|d�|SWntk
r7t|��nXdS(NR=(tobjectt__getattribute__tKeyErrorR6(R(tkey((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRArs
(R.R/t__doc__R?RA(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR:Rs	cOs8ddl}tjdkr(t|d<n|j||�S(Ni����iit
allowZip64(ii(tzipfiletsystversion_infotTruetZipFile(targstkwargsRF((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pytzipfile_factoryxs
tNpzFilecBs}eZdZed�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�ZRS(
s�
    NpzFile(fid)

    A dictionary-like object with lazy-loading of files in the zipped
    archive provided on construction.

    `NpzFile` is used to load files in the NumPy ``.npz`` data archive
    format. It assumes that files in the archive have a ".npy" extension,
    other files are ignored.

    The arrays and file strings are lazily loaded on either
    getitem access using ``obj['key']`` or attribute lookup using
    ``obj.f.key``. A list of all files (without ".npy" extensions) can
    be obtained with ``obj.files`` and the ZipFile object itself using
    ``obj.zip``.

    Attributes
    ----------
    files : list of str
        List of all files in the archive with a ".npy" extension.
    zip : ZipFile instance
        The ZipFile object initialized with the zipped archive.
    f : BagObj instance
        An object on which attribute can be performed as an alternative
        to getitem access on the `NpzFile` instance itself.

    Parameters
    ----------
    fid : file or str
        The zipped archive to open. This is either a file-like object
        or a string containing the path to the archive.
    own_fid : bool, optional
        Whether NpzFile should close the file handle.
        Requires that `fid` is a file-like object.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()
    >>> x = np.arange(10)
    >>> y = np.sin(x)
    >>> np.savez(outfile, x=x, y=y)
    >>> outfile.seek(0)

    >>> npz = np.load(outfile)
    >>> isinstance(npz, np.lib.io.NpzFile)
    True
    >>> npz.files
    ['y', 'x']
    >>> npz['x']  # getitem access
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
    >>> npz.f.x  # attribute lookup
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    cCs�t|�}|j�|_g|_xG|jD]<}|jd�rZ|jj|d �q.|jj|�q.W||_t|�|_|r�||_	n	d|_	dS(Ns.npyi����(RMtnamelistt_filestfilestendswithtappendtzipR:R8tfidtNone(R(RUtown_fidt_ziptx((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR?�s		cCs|S(N((R(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt	__enter__�scCs|j�dS(N(tclose(R(texc_typet	exc_valuet	traceback((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt__exit__�scCs]|jdk	r(|jj�d|_n|jdk	rP|jj�d|_nd|_dS(s"
        Close the file.

        N(RTRVR[RUR8(R(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR[�s

cCs|j�dS(N(R[(R(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt__del__�scCs�d}||jkrd}n"||jkr@d}|d7}n|r�|jj|�}|jtj�r�t|�}tj|�S|Snt	d|��dS(Niis.npys%s is not a file in the archive(
RPRQRTR't
startswithtformattMAGIC_PREFIXR t
read_arrayRB(R(RCtmemberRtvalue((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt__getitem__�s		

cCs
t|j�S(N(titerRQ(R(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt__iter__�scCs$g|jD]}|||f^q
S(sV
        Return a list of tuples, with each tuple (filename, array in file).

        (RQ(R(R8((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pytitems�sccs'x |jD]}|||fVq
WdS(s8Generator that returns tuples (filename, array in file).N(RQ(R(R8((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt	iteritemsscCs|jS(s4Return files in the archive with a ".npy" extension.(RQ(R(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pytkeysscCs
|j�S(s1Return an iterator over the files in the archive.(Ri(R(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pytiterkeysscCs|jj|�S(N(RQt__contains__(R(RC((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRns(R.R/RDtFalseR?RZR_R[R`RgRiRjRkRlRmRn(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRN~s7			
							cCsEddl}t}t|t�r9t|d�}t}n't||j�rZt|�}n|}z�td�}t	t
j�}|j|�}|j
|d�|j|�r�t}t|d|�S|t
jkr�|r�t
j|d|�St
j|�Sn.yt|�SWntdt|���nXWd|r@|j�nXdS(	s�	
    Load an array(s) or pickled objects from .npy, .npz, or pickled files.

    Parameters
    ----------
    file : file-like object or string
        The file to read.  It must support ``seek()`` and ``read()`` methods.
        If the filename extension is ``.gz``, the file is first decompressed.
    mmap_mode: {None, 'r+', 'r', 'w+', 'c'}, optional
        If not None, then memory-map the file, using the given mode
        (see `numpy.memmap` for a detailed description of the modes).
        A memory-mapped array is kept on disk. However, it can be accessed
        and sliced like any ndarray.  Memory mapping is especially useful for
        accessing small fragments of large files without reading the entire
        file into memory.

    Returns
    -------
    result : array, tuple, dict, etc.
        Data stored in the file. For '.npz' files, the returned instance of
        NpzFile class must be closed to avoid leaking file descriptors.

    Raises
    ------
    IOError
        If the input file does not exist or cannot be read.

    See Also
    --------
    save, savez, loadtxt
    memmap : Create a memory-map to an array stored in a file on disk.

    Notes
    -----
    - If the file contains pickle data, then whatever object is stored
      in the pickle is returned.
    - If the file is a ``.npy`` file, then a single array is returned.
    - If the file is a ``.npz`` file, then a dictionary-like object is
      returned, containing ``{filename: array}`` key-value pairs, one for
      each file in the archive.
    - If the file is a ``.npz`` file, the returned value supports the context
      manager protocol in a similar fashion to the open function::

        with load('foo.npz') as data:
            a = data['a']

      The underlyling file descriptor is closed when exiting the 'with' block.

    Examples
    --------
    Store data to disk, and load it again:

    >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]]))
    >>> np.load('/tmp/123.npy')
    array([[1, 2, 3],
           [4, 5, 6]])

    Store compressed data to disk, and load it again:

    >>> a=np.array([[1, 2, 3], [4, 5, 6]])
    >>> b=np.array([1, 2])
    >>> np.savez('/tmp/123.npz', a=a, b=b)
    >>> data = np.load('/tmp/123.npz')
    >>> data['a']
    array([[1, 2, 3],
           [4, 5, 6]])
    >>> data['b']
    array([1, 2])
    >>> data.close()

    Mem-map the stored array, and then access the second row
    directly from disk:

    >>> X = np.load('/tmp/123.npy', mmap_mode='r')
    >>> X[1, :]
    memmap([4, 5, 6])

    i����NtrbsPKiRWR7s'Failed to interpret file %s as a pickle(R2RoR3t
basestringtopenRIR"R9RtlenRbRcR'R,RaRNtopen_memmapRdt_cloadR$treprR[(tfilet	mmap_modeR2RWRUt_ZIP_PREFIXtNtmagic((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRs6O	cCs�t}t|t�rI|jd�s1|d}nt|d�}t}n|}z#tj|�}tj	||�Wd|r�|j
�nXdS(s�
    Save an array to a binary file in NumPy ``.npy`` format.

    Parameters
    ----------
    file : file or str
        File or filename to which the data is saved.  If file is a file-object,
        then the filename is unchanged.  If file is a string, a ``.npy``
        extension will be appended to the file name if it does not already
        have one.
    arr : array_like
        Array data to be saved.

    See Also
    --------
    savez : Save several arrays into a ``.npz`` archive
    savetxt, load

    Notes
    -----
    For a description of the ``.npy`` format, see `format`.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()

    >>> x = np.arange(10)
    >>> np.save(outfile, x)

    >>> outfile.seek(0) # Only needed here to simulate closing & reopening file
    >>> np.load(outfile)
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    s.npytwbN(RoR3RqRRRrRItnpt
asanyarrayRbtwrite_arrayR[(RwtarrRWRU((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR	�s$
	cOst|||t�dS(s9

    Save several arrays into a single file in uncompressed ``.npz`` format.

    If arguments are passed in with no keywords, the corresponding variable
    names, in the .npz file, are 'arr_0', 'arr_1', etc. If keyword arguments
    are given, the corresponding variable names, in the ``.npz`` file will
    match the keyword names.

    Parameters
    ----------
    file : str or file
        Either the file name (string) or an open file (file-like object)
        where the data will be saved. If file is a string, the ``.npz``
        extension will be appended to the file name if it is not already there.
    args : Arguments, optional
        Arrays to save to the file. Since it is not possible for Python to
        know the names of the arrays outside `savez`, the arrays will be saved
        with names "arr_0", "arr_1", and so on. These arguments can be any
        expression.
    kwds : Keyword arguments, optional
        Arrays to save to the file. Arrays will be saved in the file with the
        keyword names.

    Returns
    -------
    None

    See Also
    --------
    save : Save a single array to a binary file in NumPy format.
    savetxt : Save an array to a file as plain text.
    savez_compressed : Save several arrays into a compressed .npz file format

    Notes
    -----
    The ``.npz`` file format is a zipped archive of files named after the
    variables they contain.  The archive is not compressed and each file
    in the archive contains one variable in ``.npy`` format. For a
    description of the ``.npy`` format, see `format`.

    When opening the saved ``.npz`` file with `load` a `NpzFile` object is
    returned. This is a dictionary-like object which can be queried for
    its list of arrays (with the ``.files`` attribute), and for the arrays
    themselves.

    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()
    >>> x = np.arange(10)
    >>> y = np.sin(x)

    Using `savez` with \*args, the arrays are saved with default names.

    >>> np.savez(outfile, x, y)
    >>> outfile.seek(0) # Only needed here to simulate closing & reopening file
    >>> npzfile = np.load(outfile)
    >>> npzfile.files
    ['arr_1', 'arr_0']
    >>> npzfile['arr_0']
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    Using `savez` with \**kwds, the arrays are saved with the keyword names.

    >>> outfile = TemporaryFile()
    >>> np.savez(outfile, x=x, y=y)
    >>> outfile.seek(0)
    >>> npzfile = np.load(outfile)
    >>> npzfile.files
    ['y', 'x']
    >>> npzfile['x']
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

    N(t_savezRo(RwRKtkwds((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR
�sKcOst|||t�dS(s
    Save several arrays into a single file in compressed ``.npz`` format.

    If keyword arguments are given, then filenames are taken from the keywords.
    If arguments are passed in with no keywords, then stored file names are
    arr_0, arr_1, etc.

    Parameters
    ----------
    file : str
        File name of .npz file.
    args : Arguments
        Function arguments.
    kwds : Keyword arguments
        Keywords.

    See Also
    --------
    numpy.savez : Save several arrays into an uncompressed .npz file format

    N(R�RI(RwRKR�((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRscCs�ddl}ddl}t|t�rF|jd�sF|d}qFn|}xSt|�D]E\}}d|}	|	|j�kr�td|	��n|||	<qYW|r�|j}
n	|j	}
t
|ddd|
�}|jdd	�\}}
tj
|�z�x�|j�D]|\}	}|	d
}t|
d�}z@tj|tj|��|j
�d}|j|
d|�Wd|r�|j
�nXq
WWdtj|
�X|j
�dS(
Ni����s.npzsarr_%ds,Cannot use un-named variables and keyword %sR7twtcompressiontsuffixs
-numpy.npys.npyR|tarcname(RFttempfileR3RqRRt	enumerateRlt
ValueErrortZIP_DEFLATEDt
ZIP_STOREDRMtmkstemptosR[RkRrRbRR}R~RVtwritetremove(RwRKR�tcompressRFR�tnamedictR+tvalRCR�RTtfdttmpfiletfnameRU((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR�s<
	


cCs�|j}t|tj�r"d�St|tj�r;tjSt|tj�rTtjSt|tj�rmd�St|tj�r�tSt|tj	�r�t	St|tj
�r�tStSdS(NcSstt|��S(N(tbooltint(RY((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt<lambda>PscSstt|��S(N(R�tfloat(RY((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR�Vs(
ttypet
issubclassR}tbool_tuint64tint64tintegertfloatingR�tcomplextbytes_RR4(tdtypettyp((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt_getconvMs 	t#c	s�t���|}	�dk	r-t���n|dk	rHt|�}nt}
y�t|�r�t}
|jd�r�tt|��}q�|jd�r�ddl	}t|j
|��}q�tt|d��}nt|�}Wntk
r�t
d��nXg}
�fd���fd����fd	�}zUtj|�}t|�}xt|�D]}|j�q`Wd}y)x"|s�|j�}||�}q�WWn.tk
r�d
}g}tjd|�nXt|p�|�}�|�\}}t|�dkr,g|D]}t|�^q}n=gt|�D]}|^q9}|dkri|tfg}nx]|	puij�D]I\}}|r�y|j|�}Wq�t
k
r�q|q�Xn|||<q|Wx�ttj|g|��D]�\}}||�}t|�d
krq�n|r;g|D]}||^q"}ngt||�D]\}}||�^qK}�||�}|
j|�q�WWd|
r�|j�nXtj |
|�}
|
j!dkr�|
j"d dkr�d|
_"n|dkrt
d|��n|
j!|kr!tj#|
�}
n|
j!|krr|dkrNtj$|
�}
qr|dkrrtj%|
�j&}
qrn|r�t|�dkr�g|j'D]}|
|^q�S|
j&Sn|
SdS(s�
    Load data from a text file.

    Each row in the text file must have the same number of values.

    Parameters
    ----------
    fname : file or str
        File, filename, or generator to read.  If the filename extension is
        ``.gz`` or ``.bz2``, the file is first decompressed. Note that
        generators should return byte strings for Python 3k.
    dtype : data-type, optional
        Data-type of the resulting array; default: float.  If this is a
        record data-type, the resulting array will be 1-dimensional, and
        each row will be interpreted as an element of the array.  In this
        case, the number of columns used must match the number of fields in
        the data-type.
    comments : str, optional
        The character used to indicate the start of a comment;
        default: '#'.
    delimiter : str, optional
        The string used to separate values.  By default, this is any
        whitespace.
    converters : dict, optional
        A dictionary mapping column number to a function that will convert
        that column to a float.  E.g., if column 0 is a date string:
        ``converters = {0: datestr2num}``.  Converters can also be used to
        provide a default value for missing data (but see also `genfromtxt`):
        ``converters = {3: lambda s: float(s.strip() or 0)}``.  Default: None.
    skiprows : int, optional
        Skip the first `skiprows` lines; default: 0.
    usecols : sequence, optional
        Which columns to read, with 0 being the first.  For example,
        ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns.
        The default, None, results in all columns being read.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = loadtxt(...)``.  When used with a record
        data-type, arrays are returned for each field.  Default is False.
    ndmin : int, optional
        The returned array will have at least `ndmin` dimensions.
        Otherwise mono-dimensional axes will be squeezed.
        Legal values: 0 (default), 1 or 2.
        .. versionadded:: 1.6.0

    Returns
    -------
    out : ndarray
        Data read from the text file.

    See Also
    --------
    load, fromstring, fromregex
    genfromtxt : Load data with missing values handled as specified.
    scipy.io.loadmat : reads MATLAB data files

    Notes
    -----
    This function aims to be a fast reader for simply formatted files.  The
    `genfromtxt` function provides more sophisticated handling of, e.g.,
    lines with missing values.

    Examples
    --------
    >>> from StringIO import StringIO   # StringIO behaves like a file object
    >>> c = StringIO("0 1\n2 3")
    >>> np.loadtxt(c)
    array([[ 0.,  1.],
           [ 2.,  3.]])

    >>> d = StringIO("M 21 72\nF 35 58")
    >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'),
    ...                      'formats': ('S1', 'i4', 'f4')})
    array([('M', 21, 72.0), ('F', 35, 58.0)],
          dtype=[('gender', '|S1'), ('age', '<i4'), ('weight', '<f4')])

    >>> c = StringIO("1,0,2\n3,0,4")
    >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True)
    >>> x
    array([ 1.,  3.])
    >>> y
    array([ 2.,  4.])

    s.gzs.bz2i����NtUs1fname must be a string, file handle, or generatorc
si|jdkr�|j}t|�dkr:|jgdfS|dtfg}t|�dkr�x@|jddd�D]%}||dd||fg}qvWn|jgttj|j��|fSn�g}g}x�|jD]v}|j	|\}}�|�\}}	|j
|�t|j�dkr>|j
|	�q�|jt|�|	f�q�W||fSdS(s;Unpack a structured data-type, and produce re-packing info.ii����ii����N(tnamesRVtshapeRstbasetlistR�R}tprodtfieldstextendRS(
tdtR�tpackingtdimttypestfieldttpRtflat_dttflat_packing(R(s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR�s&	&)
cs�|dkr|dS|tkr*t|�S|tkr@t|�Sd}g}x?|D]7\}}|j�||||!|��||7}qSWt|�SdS(s6Pack items into nested lists based on re-packing info.iN(RVttupleR�RS(RjR�tstarttrettlengtht
subpacking(t
pack_items(s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR��s

!csCt|�j��djtd��}|r;|j��SgSdS(s1Chop off comments, strip, and split at delimiter.is
N(Rtsplittstrip(tline(tcommentst	delimiter(s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt
split_line�s(
tsloadtxt: Empty input file: "%s"iiiis"Illegal value of ndmin keyword: %s(ii(ii����(iii((RRVR�RoRRIRRRhR9tbz2tBZ2FileRrt	TypeErrorR�R}R�R�txrangetnextt
StopIterationtwarningstwarnRsR�RktindexR�t	itertoolstchainRTRSR[tarraytndimR�tsqueezet
atleast_1dt
atleast_2dtTR�(R�R�R�R�t
converterstskiprowstusecolstunpacktndmintuser_converterstfowntfhR�tXR�tdefconvR+t
first_valst
first_lineRztdtype_typesR�R�tconvR�tvalsR�RjR�((R�R�RR�s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRbs�X
	
"

( ."
s%.18et s
R�s# cCs�t|t�rt|�}nt|�}t}t|�r�t}|jd�rrddl}	|	j|d�}
q�t	j
ddkr�t|d�}
q�t|d�}
n$t|d�r�|}
ntd	��z�t
j|�}|jd
kr0|jjdkrt
j|�j}d
}q=t|jj�}n
|jd
}t
j|�}t|�ttfkr�t|�|kr�tdt|���nt|�jtt|��}
n�t|�tkrp|j d�}td
|�}|d
kr,|r
d||fg|}n
|g|}|j|�}
qp|rK|d|krK|�qp|rg||krg|�qp|}
nt|�dkr�|j!dd|�}|
j"t#|||��n|r(x�|D]^}g}x.|D]&}|j$|j%�|j$|j&�q�W|
j"t#|
t|�|��q�Wn2x/|D]'}|
j"t#|
t|�|��q/Wt|�dkr�|j!dd|�}|
j"t#|||��nWd|r�|
j'�nXdS(sJ
    Save an array to a text file.

    Parameters
    ----------
    fname : filename or file handle
        If the filename ends in ``.gz``, the file is automatically saved in
        compressed gzip format.  `loadtxt` understands gzipped files
        transparently.
    X : array_like
        Data to be saved to a text file.
    fmt : str or sequence of strs, optional
        A single format (%10.5f), a sequence of formats, or a
        multi-format string, e.g. 'Iteration %d -- %10.5f', in which
        case `delimiter` is ignored. For complex `X`, the legal options
        for `fmt` are:
            a) a single specifier, `fmt='%.4e'`, resulting in numbers formatted
                like `' (%s+%sj)' % (fmt, fmt)`
            b) a full string specifying every real and imaginary part, e.g.
                `' %.4e %+.4j %.4e %+.4j %.4e %+.4j'` for 3 columns
            c) a list of specifiers, one per column - in this case, the real
                and imaginary part must have separate specifiers,
                e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns
    delimiter : str, optional
        Character separating columns.
    newline : str, optional
        .. versionadded:: 1.5.0
    header : str, optional
        String that will be written at the beginning of the file.
        .. versionadded:: 1.7.0
    footer : str, optional
        String that will be written at the end of the file.
        .. versionadded:: 1.7.0
    comments : str, optional
        String that will be prepended to the ``header`` and ``footer`` strings,
        to mark them as comments. Default: '# ',  as expected by e.g.
        ``numpy.loadtxt``.
        .. versionadded:: 1.7.0

        Character separating lines.

    See Also
    --------
    save : Save an array to a binary file in NumPy ``.npy`` format
    savez : Save several arrays into a ``.npz`` compressed archive

    Notes
    -----
    Further explanation of the `fmt` parameter
    (``%[flag]width[.precision]specifier``):

    flags:
        ``-`` : left justify

        ``+`` : Forces to preceed result with + or -.

        ``0`` : Left pad the number with zeros instead of space (see width).

    width:
        Minimum number of characters to be printed. The value is not truncated
        if it has more characters.

    precision:
        - For integer specifiers (eg. ``d,i,o,x``), the minimum number of
          digits.
        - For ``e, E`` and ``f`` specifiers, the number of digits to print
          after the decimal point.
        - For ``g`` and ``G``, the maximum number of significant digits.
        - For ``s``, the maximum number of characters.

    specifiers:
        ``c`` : character

        ``d`` or ``i`` : signed decimal integer

        ``e`` or ``E`` : scientific notation with ``e`` or ``E``.

        ``f`` : decimal floating point

        ``g,G`` : use the shorter of ``e,E`` or ``f``

        ``o`` : signed octal

        ``s`` : string of characters

        ``u`` : unsigned decimal integer

        ``x,X`` : unsigned hexadecimal integer

    This explanation of ``fmt`` is not complete, for an exhaustive
    specification see [1]_.

    References
    ----------
    .. [1] `Format Specification Mini-Language
           <http://docs.python.org/library/string.html#
           format-specification-mini-language>`_, Python Documentation.

    Examples
    --------
    >>> x = y = z = np.arange(0.0,5.0,1.0)
    >>> np.savetxt('test.out', x, delimiter=',')   # X is an array
    >>> np.savetxt('test.out', (x,y,z))   # x,y,z equal sized 1D arrays
    >>> np.savetxt('test.out', x, fmt='%1.4e')   # use exponential notation

    s.gzi����NR|iiR�R,s%fname must be a string or file handleisfmt has wrong shape.  %st%s'fmt has wrong number of %% formats:  %ss	 (%s+%sj)is
((R3RRRoRRIRRR2RrRGRHthasattrR�R}tasarrayR�R�R�RVR�R�RstdescrR�tiscomplexobjR�R�R�R6R4tjointmapR*treplaceR�RRStrealtimagR[(R�R�tfmtR�tnewlinetheadertfooterR�town_fhR2R�tncoltiscomplex_XRbtn_fmt_charsterrortrowtrow2tnumber((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRbstn		
!
			

(
%"cCst}t|d�s-t|d�}t}nz�t|d�sWtjt|��}nt|tj	�s{tj	|�}n|j
|j��}|r�t|dt�r�tj	||j
d�}tj|d|�}||_	ntj|d|�}|SWd|r|j�nXdS(s�
    Construct an array from a text file, using regular expression parsing.

    The returned array is always a structured array, and is constructed from
    all matches of the regular expression in the file. Groups in the regular
    expression are converted to fields of the structured array.

    Parameters
    ----------
    file : str or file
        File name or file object to read.
    regexp : str or regexp
        Regular expression used to parse the file.
        Groups in the regular expression correspond to fields in the dtype.
    dtype : dtype or list of dtypes
        Dtype for the structured array.

    Returns
    -------
    output : ndarray
        The output array, containing the part of the content of `file` that
        was matched by `regexp`. `output` is always a structured array.

    Raises
    ------
    TypeError
        When `dtype` is not a valid dtype for a structured array.

    See Also
    --------
    fromstring, loadtxt

    Notes
    -----
    Dtypes for structured arrays can be specified in several forms, but all
    forms specify at least the data type and field name. For details see
    `doc.structured_arrays`.

    Examples
    --------
    >>> f = open('test.dat', 'w')
    >>> f.write("1312 foo\n1534  bar\n444   qux")
    >>> f.close()

    >>> regexp = r"(\d+)\s+(...)"  # match [digits, whitespace, anything]
    >>> output = np.fromregex('test.dat', regexp,
    ...                       [('num', np.int64), ('key', 'S3')])
    >>> output
    array([(1312L, 'foo'), (1534L, 'bar'), (444L, 'qux')],
          dtype=[('num', '<i8'), ('key', '|S3')])
    >>> output['num']
    array([1312, 1534,  444], dtype=int64)

    R'RptmatchiR�N(RoR�RrRItretcompileRR3R}R�tfindallR'R�R�R�R[(RwtregexpR�R�tseqtnewdtypetoutput((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRs$7	t_sf%icYs�|d(k	rt|�}nt|t�r9t|�}nt|t�rWt|�}nt|	tttf�r~t|	�}	n|r�ddlm}m	}n|p�i}t|t
�s�d}t|t|���nt
}yFt|t�rttjjj|d��}t}nt|�}Wn'tk
rLtdt|���nXtd|d|d|�j}td	|
d
|d|d|�}|r�tjd
t�|}nxt|�D]�|j�q�Wd(}yixb|s9|j�} |tkr*|| kr*td�j| j|�d�} q*n|| �}q�WWn4tk
rqtd�} g}tjd|�nX|tkr�|dj �}!|!|kr�|d=q�n|d(k	r#y,g|jd�D]}"|"j �^q�}Wq#t!k
ryt|�}Wq tk
r|g}q Xq#Xnt"|p/|�}#|tkr{|g|D]}"t#|"j ��^qK�}td�} nRt$|�r�|g|jd�D]}"|"j �^q��}n|r�||�}n|d(k	r�t%|d|d|�}n|d(k	rt|�}n|rx_t&|�D]Q\�}$t$|$�rP|j'|$�|�<q"|$dkr"|$t"|�|�<q"q"W|d(k	r�t"|�|#kr�|j(}%tj)g|D]}"|%|"^q��}t|j*�}qA|d(k	rAt"|�|#krAg|D]}"||"^q�}qAn*|d(k	rA|d(k	rAt|j*�}n|	pJd)}&gt+|#�D]}"ttd�g�^qZ}	t|&t
�r�x�|&j,�D]�\}'}(t$|'�r�y|j'|'�}'Wq�t-k
r�q�q�Xn|ry|j'|'�}'Wqt-k
rqXnt|(ttf�rCg|(D]}"t.|"�^q(}(nt.|(�g}(|'d(krx/|	D]})|)j/|(�qeWq�|	|'j/|(�q�Wn�t|&ttf�r�x�t0|&|	�D]4\}*}+t.|*�}*|*|+kr�|+j1|*�q�q�Wnlt|&t2�r<|&jtd��},xE|	D]}+|+j/|,�q"Wn'x$|	D]}+|+j/t.|&�g�qCW|td�kr�tjdt�g|jtd��D]}"t.|"�^q�}-x|	D]}+|+j/|-�q�Wn|
p�g}.d(g|#}
t|.t
�r�x�|.j,�D]\}'}(t$|'�rNy|j'|'�}'WqNt-k
rJq	qNXn|r~y|j'|'�}'Wq~t-k
rzq~Xn|(|
|'<q	WnTt|.ttf�r�t"|.�}/|/|#kr�|.|
|/*q�|.|# }
n
|.g|#}
|d(kr,	gt0|	|
�D]$\})}0t3d(d|)d|0�^q�}n�t4|dt�}1t"|1�dkr�	t0|1|	|
�}2g|2D]-\}3})}0t3|3dtd|)d|0�^qi	}nFt0|	|
�}2g|2D]*\})}0t3|dtd|)d|0�^q�	}g}4x�|j,�D]�\�}5t$��r=
y|j'���Wqp
t-k
r9
q�	qp
Xn3|rp
y|j'���Wqp
t-k
rl
q�	qp
Xnt"| �r�
|�}6nd(}6|�j5|5dtd|6d|
�d|	��|4j1�|5f�q�	W|j5|4�g|D]}"|"j6^q�
}7g}8|8j1}9|r'g}:|:j1};ng}<|<j1}=x-t&t7j8| g|��D]\�}>||>�}-t"|-�}?|?dkr�qRn|r�y!g|D]}"|-|"^q�}-Wqt9k
r�|=�|d|?f�qRqXn*|?|#kr|=�|d|?f�qRn|9t|-��|rR|;tgt0|-|	�D]\}@}A|@j �|Ak^q7��qRqRW|ry|j:�n|d(krw
x�t&|�D]�\�}Bt;t<��|8�}Cy|Bj=|C�Wq�t>k
ro
d�}t7j?t<��|8�}Cxwt&|C�D]e\}D}*y|Bj@|*�Wq
tAt-fk
rg
|d7}||Dd||*f;}tA|��q
Xq
Wq�Xq�Wnt"|<�}E|Edkr�t"|8�|E|}Fd|#}G|dkrt"g|<D] }"|"d|F|kr�
|"^q�
�}H|<|E|H }<||H8}ng|<D]\�}I|G�|If^q}t"|�r�|jBdd�dj|�}|rpt-|��q�tj|tC�q�n|dkr�|8| }8|r�|:| }:q�n|rt0gt&|�D]-\�}Bt;|BjDt;t<��|8��^q��}8nFt0gt&|�D]-\�}Bt;|BjEt;t<��|8��^q�}8|8}J|d(kr#g|D]}5|5j^qb}Kgt&|K�D]-\�}@|@td �tjFfkr��^q�}Lx2|LD]*�d!tG�fd"�|JD��|K�<q�W|d(kr�tHg|D]}M|MjIr|Mj^q�}Nt"|N�dkrRt|N�dtjJ}O}Pq�gt&|K�D]\�}3|�|3f^q_}O|r�gt&|K�D]\�}3|�tjJf^q�}Pq�n.t0||K�}Ot0|tjJgt"|K��}PtjK|Jd#|O�}Q|r�tjK|:d#|P�}Rq�n�|r>|j*r>||_*nt"|1�dkr=d$d%�|1D�kr�tL|�r�d&}tM|��q�tjK|Jd#|�}Qn=tjK|Jd#g|1D]}"d|"f^q��}8|8jN|�}Q|r�tjK|:d#tj)g|1D]}SdtjJf^q���}T||�}P|TjN|P�}Rq�nh|r;t}Ug}%x�t&g|D]}5|5j^q\�D]�\�}V�|kr�|U|V|jkM}U|VtjFkr�d!tG�fd'�|JD��}Vn|%j1d|Vf�qr|%j1d|f�qrW|Us;t"|%�dkr&tj)|%�}q8tj)|V�}q;ntjK|J|�}Q|r�|j*r�g|j*D]}"|"tjJf^qf}Pn	tjJ}PtjK|:d#|P�}Rn|Qj)j*}|rE|rEx�t0|p�d*|�D]k\}W}5g|5j6D]$}"|"td�kr�|5|"�^q�}	x(|	D] }X|R|Wc|Q|W|XkO<qWq�Wn|rf|QjN|�}Q|R|Q_On|ry|QjP�jQS|QjP�S(+sD
    Load data from a text file, with missing values handled as specified.

    Each line past the first `skip_header` lines is split at the `delimiter`
    character, and characters following the `comments` character are discarded.

    Parameters
    ----------
    fname : file or str
        File, filename, or generator to read.  If the filename extension is
        `.gz` or `.bz2`, the file is first decompressed. Note that
        generators must return byte strings in Python 3k.
    dtype : dtype, optional
        Data type of the resulting array.
        If None, the dtypes will be determined by the contents of each
        column, individually.
    comments : str, optional
        The character used to indicate the start of a comment.
        All the characters occurring on a line after a comment are discarded
    delimiter : str, int, or sequence, optional
        The string used to separate values.  By default, any consecutive
        whitespaces act as delimiter.  An integer or sequence of integers
        can also be provided as width(s) of each field.
    skip_header : int, optional
        The numbers of lines to skip at the beginning of the file.
    skip_footer : int, optional
        The numbers of lines to skip at the end of the file
    converters : variable, optional
        The set of functions that convert the data of a column to a value.
        The converters can also be used to provide a default value
        for missing data: ``converters = {3: lambda s: float(s or 0)}``.
    missing_values : variable, optional
        The set of strings corresponding to missing data.
    filling_values : variable, optional
        The set of values to be used as default when the data are missing.
    usecols : sequence, optional
        Which columns to read, with 0 being the first.  For example,
        ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns.
    names : {None, True, str, sequence}, optional
        If `names` is True, the field names are read from the first valid line
        after the first `skip_header` lines.
        If `names` is a sequence or a single-string of comma-separated names,
        the names will be used to define the field names in a structured dtype.
        If `names` is None, the names of the dtype fields will be used, if any.
    excludelist : sequence, optional
        A list of names to exclude. This list is appended to the default list
        ['return','file','print']. Excluded names are appended an underscore:
        for example, `file` would become `file_`.
    deletechars : str, optional
        A string combining invalid characters that must be deleted from the
        names.
    defaultfmt : str, optional
        A format used to define default field names, such as "f%i" or "f_%02i".
    autostrip : bool, optional
        Whether to automatically strip white spaces from the variables.
    replace_space : char, optional
        Character(s) used in replacement of white spaces in the variables
        names. By default, use a '_'.
    case_sensitive : {True, False, 'upper', 'lower'}, optional
        If True, field names are case sensitive.
        If False or 'upper', field names are converted to upper case.
        If 'lower', field names are converted to lower case.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = loadtxt(...)``
    usemask : bool, optional
        If True, return a masked array.
        If False, return a regular array.
    invalid_raise : bool, optional
        If True, an exception is raised if an inconsistency is detected in the
        number of columns.
        If False, a warning is emitted and the offending lines are skipped.

    Returns
    -------
    out : ndarray
        Data read from the text file. If `usemask` is True, this is a
        masked array.

    See Also
    --------
    numpy.loadtxt : equivalent function when no data is missing.

    Notes
    -----
    * When spaces are used as delimiters, or when no delimiter has been given
      as input, there should not be any missing data between two fields.
    * When the variables are named (either by a flexible dtype or with `names`,
      there must not be any header in the file (else a ValueError
      exception is raised).
    * Individual values are not stripped of spaces by default.
      When using a custom converter, make sure the function does remove spaces.

    References
    ----------
    .. [1] Numpy User Guide, section `I/O with Numpy
           <http://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_.

    Examples
    ---------
    >>> from StringIO import StringIO
    >>> import numpy as np

    Comma delimited file with mixed dtype

    >>> s = StringIO("1,1.3,abcde")
    >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'),
    ... ('mystring','S5')], delimiter=",")
    >>> data
    array((1, 1.3, 'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])

    Using dtype = None

    >>> s.seek(0) # needed for StringIO example only
    >>> data = np.genfromtxt(s, dtype=None,
    ... names = ['myint','myfloat','mystring'], delimiter=",")
    >>> data
    array((1, 1.3, 'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])

    Specifying dtype and names

    >>> s.seek(0)
    >>> data = np.genfromtxt(s, dtype="i8,f8,S5",
    ... names=['myint','myfloat','mystring'], delimiter=",")
    >>> data
    array((1, 1.3, 'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', '|S5')])

    An example with fixed-width columns

    >>> s = StringIO("11.3abcde")
    >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'],
    ...     delimiter=[1,3,5])
    >>> data
    array((1, 1.3, 'abcde'),
          dtype=[('intvar', '<i8'), ('fltvar', '<f8'), ('strvar', '|S5')])

    i����(tMaskedArraytmake_mask_descrsNThe input argument 'converter' should be a valid dictionary (got '%s' instead)trbUsAfname mustbe a string, filehandle, or generator. (got %s instead)R�R�t	autostriptexcludelisttdeletecharstcase_sensitivet
replace_spacesgThe use of `skiprows` is deprecated, it will be removed in numpy 2.0.
Please use `skip_header` instead.R�is"genfromtxt: Empty input file: "%s"it,t
defaultfmtR�siThe use of `missing` is deprecated, it will be removed in Numpy 2.0.
Please use `missing_values` instead.tmissing_valuestdefaulttflatten_basetlockedt
testing_values0Converter #%i is locked and cannot be upgraded: s"(occurred line #%i for value '%s')s-    Line #%%i (got %%i columns instead of %i)sSome errors were detected !s
tSs|S%ic3s|]}t|��VqdS(N(Rs(t.0R�(R+(s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pys	<genexpr>�sR�tOcss|]}|jVqdS(N(tchar(RR((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pys	<genexpr>�ss4Nested fields involving objects are not supported...c3s|]}t|��VqdS(N(Rs(RR�(R+(s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pys	<genexpr>�sN(((RRVRR3tunicodeR�R�Rtnumpy.maRRtdictR�R�RoRqRhR}tlibt_datasourceRrRIRt	_handymanRR�R�tDeprecationWarningR�R�R�R�R�R�R6RsRRRR�R�R�R�R�R&RjR�R4R�RTRSRRRtupdateRR�R�t
IndexErrorR[R�RtiterupgradeRtimaptupgradeRtinsertRt_loose_callt_strict_calltstring_tmaxtsett_checkedR�R�RtNotImplementedErrortviewt_maskR�R�(YR�R�R�R�R�tskip_headertskip_footerR�tmissingRtfilling_valuesR�R�RR	RRR
R
R�tusemasktlooset
invalid_raiseRRR�terrmsgtown_fhdtfhdR�tvalidate_namestfirst_valuesR�tfvalRtnbcolstcurrentR�tuser_missing_valuesRCR�tmissRftentryt
user_valuetvaluestuser_filling_valuestntfillt
dtype_flattzipitR�t	uc_updateR�Rt
miss_charstrowstappend_to_rowstmaskstappend_to_maskstinvalidtappend_to_invalidR�tnbvaluestvtmt	convertertcurrent_columntjt	nbinvalidtnbrowsttemplatetnbinvalid_skippedtnbtdatatcolumn_typest	strcolidxtcR�tddtypetmdtypeRt
outputmasktttrowmaskst
ishomogeneoustttypeR5tmval((R+s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyRzs|�	
			(

,

%1	&#.


"


.







::4






		(!

	<




#
&C@'
(+,5.	%/#	(	"$
%
cKst|d<t||�S(s�
    Load ASCII data stored in a file and return it as a single array.

    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.

    See Also
    --------
    numpy.genfromtxt : generic function.

    R1(RoR(R�RL((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR�s
cKst|d<t||�S(s
    Load ASCII data stored in a text file and return a masked array.

    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.

    See Also
    --------
    numpy.genfromtxt : generic function to load ASCII data.

    R1(RIR(R�RL((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR�s
cKs{|jd|jdd��|jdt�}t||�}|reddlm}|j|�}n|jtj	�}|S(s�
    Load ASCII data from a file and return it in a record array.

    If ``usemask=False`` a standard `recarray` is returned,
    if ``usemask=True`` a MaskedRecords array is returned.

    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.

    See Also
    --------
    numpy.genfromtxt : generic function

    Notes
    -----
    By default, `dtype` is None, which means that the data-type of the output
    array will be determined from the data.

    R�R1i����(t
MaskedRecordsN(
RtgetRVRoRtnumpy.ma.mrecordsReR+R}trecarray(R�RLR1RRe((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR
scKs�|jdd�pd}|jdt�}|dkr?t}n|jd|jdd�d|jdd�podd|d|�|jdt�}t||�}|r�d	d
lm}|j|�}n|jt	j
�}|S(s�
    Load ASCII data stored in a comma-separated file.

    The returned array is a record array (if ``usemask=False``, see
    `recarray`) or a masked record array (if ``usemask=True``,
    see `ma.mrecords.MaskedRecords`).

    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.

    See Also
    --------
    numpy.genfromtxt : generic function to load ASCII data.

    R
tlowerR�R�RR�RR1i����(ReN(RfRIRVRRoRRgReR+R}Rh(R�RLR
R�R1RRe((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyR-s	(Bt__all__tnumpyR}RbRGR�R�R�R�R;toperatorRtcPickleRRuRRRt_compiled_baseRR
t_iotoolsRRRRRRRRRRRtnumpy.compatRRRRRHtioR t	cStringIOR!t_string_likeR9R@R:RMRNRVR	R
RR�R�R�RoRRRRIRRRRR(((s5/usr/lib64/python2.7/site-packages/numpy/lib/npyio.pyt<module>sdL"	0&	�r	4	M		/		��	[				��m