/usr/lib64/python2.6/site-packages/numpy/core
NameSizeModeActions
include/-0755rm
lib/-0755rm
tests/-0755rm
arrayprint.py168120644editdlrm
arrayprint.pyc156010644editdlrm
arrayprint.pyo156010644editdlrm
defchararray.py699520644editdlrm
defchararray.pyc783260644editdlrm
defchararray.pyo783260644editdlrm
defmatrix.py280940644editdlrm
defmatrix.pyc309700644editdlrm
defmatrix.pyo309700644editdlrm
fromnumeric.py711350644editdlrm
fromnumeric.pyc750790644editdlrm
fromnumeric.pyo750790644editdlrm
function_base.py52010644editdlrm
function_base.pyc55690644editdlrm
function_base.pyo55690644editdlrm
generate_numpy_api.py64440644editdlrm
generate_numpy_api.pyc62020644editdlrm
generate_numpy_api.pyo61410644editdlrm
getlimits.py87900644editdlrm
getlimits.pyc100680644editdlrm
getlimits.pyo100680644editdlrm
info.py46350644editdlrm
info.pyc48060644editdlrm
info.pyo48060644editdlrm
machar.py106580644editdlrm
machar.pyc86940644editdlrm
machar.pyo86940644editdlrm
memmap.py93010644editdlrm
memmap.pyc95340644editdlrm
memmap.pyo95340644editdlrm
multiarray.so5848240755editdlrm
multiarray_tests.so130080755editdlrm
numeric.py682800644editdlrm
numeric.pyc720330644editdlrm
numeric.pyo720330644editdlrm
numerictypes.py250880644editdlrm
numerictypes.pyc241890644editdlrm
numerictypes.pyo241440644editdlrm
records.py268380644editdlrm
records.pyc244370644editdlrm
records.pyo244370644editdlrm
scalarmath.so1649280755editdlrm
scons_support.py83520644editdlrm
scons_support.pyc93420644editdlrm
scons_support.pyo93420644editdlrm
setup.py324500644editdlrm
setup.pyc232920644editdlrm
setup.pyo232920644editdlrm
setupscons.py45160644editdlrm
setupscons.pyc40870644editdlrm
setupscons.pyo40870644editdlrm
setup_common.py100690644editdlrm
setup_common.pyc83530644editdlrm
setup_common.pyo83530644editdlrm
shape_base.py62940644editdlrm
shape_base.pyc71230644editdlrm
shape_base.pyo71230644editdlrm
umath.so3259040755editdlrm
umath_tests.so121920755editdlrm
_dotblas.so207120755editdlrm
_internal.py103680644editdlrm
_internal.pyc108700644editdlrm
_internal.pyo108700644editdlrm
_mx_datetime_parser.py332520644editdlrm
_mx_datetime_parser.pyc290290644editdlrm
_mx_datetime_parser.pyo290290644editdlrm
_sort.so907360755editdlrm
__init__.py9830644editdlrm
__init__.pyc12610644editdlrm
__init__.pyo12610644editdlrm
Edit: /usr/lib64/python2.6/site-packages/numpy/core/records.pyo (24437B)
Ñò [ÐKc@sádZdddgZddkZddklZddkZddkZddk Z ddk Z ei Z hdd6d d 6d d 6dd 6d d6d d6dd6dd6dd6d d 6d d 6dd6dd6dd6Z ei ZeiZd„Zdd d„ƒYZdeifd„ƒYZde fd„ƒYZdddddedd„Zdddddedd„Zddddddedd„Zd„Zddddddedd„Zdddddddeded„ ZdS(!ss Record Arrays ============= Record arrays expose the fields of structured arrays as properties. Most commonly, ndarrays contain elements of a single type, e.g. floats, integers, bools etc. However, it is possible for elements to be combinations of these, such as:: >>> a = np.array([(1, 2.0), (1, 2.0)], dtype=[('x', int), ('y', float)]) >>> a array([(1, 2.0), (1, 2.0)], dtype=[('x', '>> a['x'] array([1, 1]) >>> a['y'] array([ 2., 2.]) Record arrays allow us to access fields as properties:: >>> ar = a.view(np.recarray) >>> ar.x array([1, 1]) >>> ar.y array([ 2., 2.]) trecordtrecarrayt format_parseriÿÿÿÿN(t chararrayt>tbt>> np.format_parser(['f8', 'i4', 'a5'], ['col1', 'col2', 'col3'], ... ['T1', 'T2', 'T3']).dtype dtype([(('T1', 'col1'), '>> np.format_parser(['f8', 'i4', 'a5'], ['col1', 'col2', 'col3'], ... []).dtype dtype([('col1', '>> np.format_parser(['f8', 'i4', 'a5'], [], []).dtype dtype([('f0', '', '='}, optional Byte-order for all fields. aligned : bool, optional Align the fields in memory as the C-compiler would. strides : tuple of ints, optional Buffer (`buf`) is interpreted according to these strides (strides define how many bytes each array element, row, column, etc. occupy in memory). offset : int, optional Start reading buffer (`buf`) from this offset onwards. Returns ------- rec : recarray Empty array of the given shape and type. See Also -------- rec.fromrecords : Construct a record array from data. record : fundamental data-type for `recarray`. format_parser : determine a data-type from formats, names, titles. Notes ----- This constructor can be compared to ``empty``: it creates a new record array but does not fill it with data. To create a reccord array from data, use one of the following methods: 1. Create a standard ndarray and convert it to a record array, using ``arr.view(np.recarray)`` 2. Use the `buf` keyword. 3. Use `np.rec.fromrecords`. Examples -------- Create an array with two fields, ``x`` and ``y``: >>> x = np.array([(1.0, 2), (3.0, 4)], dtype=[('x', float), ('y', int)]) >>> x array([(1.0, 2), (3.0, 4)], dtype=[('x', '>> x['x'] array([ 1., 3.]) View the array as a record array: >>> x = x.view(np.recarray) >>> x.x array([ 1., 3.]) >>> x.y array([2, 4]) Create a new, empty record array: >>> np.recarray((2,), ... dtype=[('x', int), ('y', float), ('z', int)]) #doctest: +SKIP rec.array([(-1073741821, 1.2249118382103472e-301, 24547520), (3471280, 1.2134086255804012e-316, 0)], dtype=[('x', '>> x1=np.array([1,2,3,4]) >>> x2=np.array(['a','dd','xyz','12']) >>> x3=np.array([1.1,2,3,4]) >>> r = np.core.records.fromarrays([x1,x2,x3],names='a,b,c') >>> print r[1] (2, 'dd', 2.0) >>> x1[1]=34 >>> r.a array([1, 2, 3, 4]) iR$s*item in the array list must be an ndarray.R%iÿÿÿÿs>mismatch between the number of fields and the number of arrayss array-shape mismatch in array %dN(R+tasarrayR'RkR)R|RhR(t_typestrRR4R~ROtflexibletitemsizeRRR<RRt enumerateRR(t arrayListRRkRRR R!R"R1txRZRCR<tparsedtd0tnntkt testshapet_arrayR((s8/usr/lib64/python2.6/site-packages/numpy/core/records.pyt fromarraysòsN*            cCst|dƒ}|d jo‘|d jo„ti|dtƒ} g} t|ƒD]&} | ti| d| fiƒƒqP~ } t| d|d|d|d|d|d |ƒS|d j otit |fƒ} nt |||||ƒi } yti|d| ƒ}Wn¾t j o²|d jp |djot|ƒ}nt |ttfƒo |f}nt|ƒd jo td ‚nt|| ƒ}x+t|iƒD]}t||ƒ||>> r=np.core.records.fromrecords([(456,'dbe',1.2),(2,'de',1.3)], ... names='col1,col2,col3') >>> print r[0] (456, 'dbe', 1.2) >>> r.col1 array([456, 2]) >>> r.col2 chararray(['dbe', 'de'], dtype='|S3') >>> import cPickle >>> print cPickle.loads(cPickle.dumps(r)) [(456, 'dbe', 1.2) (2, 'de', 1.3)] iR.RRkRR R!R"isCan only deal with 1-d array.N(RR'R+tarrayRmtxrangettolistRRRRRRnR)R|tlongR(RtsizettupleRkRT(trecListRRkRRR R!R"tnfieldsRZR1RtarrlistRCtretvalRŒRŠRY((s8/usr/lib64/python2.6/site-packages/numpy/core/records.pyt fromrecords7s6@    ic CsÉ|djo|djo td‚n|dj oti|ƒ} nt|||||ƒi} | i} |djp|djp |djot|ƒ|| }nt|| d|d|ƒ} | S(sM create a (read-only) record array from binary data contained in a stringsMust have dtype= or formats=iiÿÿÿÿRlRfN( R'R(R+RRRRƒRR( t datastringRRkRfRRR R!R"RCRƒRŒ((s8/usr/lib64/python2.6/site-packages/numpy/core/records.pyt fromstringws   'cCsfy|iƒ}Wn-tj o!tii|iƒ|iƒSXti|ƒ}|i|iƒ}|S(N( tfilenoRRtostpathtgetsizeR`ttelltfstattst_size(tfdtfntstR’((s8/usr/lib64/python2.6/site-packages/numpy/core/records.pytget_remaining_sizeŒsc CsÚ|djp |djo d}n$t|ttfƒo |f}nd} t|tƒod} t|dƒ}n|djo|i|dƒnt|ƒ} |dj oti |ƒ} nt |||||ƒi } | i } ti |ƒiƒ} | | }|djoIt|ƒ}| | ||idƒ>> from tempfile import TemporaryFile >>> a = np.empty(10,dtype='f8,i4,a5') >>> a[5] = (0.5,10,'abcde') >>> >>> fd=TemporaryFile() >>> a = a.newbyteorder('<') >>> a.tofile(fd) >>> >>> fd.seek(0) >>> r=np.core.records.fromfile(fd, formats='f8,i4,a5', shape=10, ... byteorder='<') >>> print r[5] (0.5, 10, 'abcde') >>> r.shape (10,) iiÿÿÿÿitrbs:Not enough bytes left in file for specified shape and types%Didn't read as many bytes as expectedN(iÿÿÿÿ(R'R)R|R‘RJtopentseekR¥R+RRRRƒRŽtprodRtindexR“R(RtreadintotdatatIOErrortclose(R¢RRkRfRRR R!R"R`R’RCRƒt shapeprodt shapesizetnbytesRŒt nbytesread((s8/usr/lib64/python2.6/site-packages/numpy/core/records.pytfromfile•sB              c  Cs¨t|tdƒttfƒo*|djo|djotdƒ‚nh} |dj oti|ƒ}nV|dj ot||||| ƒi }n*h|d6|d6|d6|d6| d6} |djo=|djotdƒ‚nt ||d|d |d |ƒSt|tƒot ||d |d || St|t t fƒoQt|d t t fƒot|d |d || St|d |d || Snt|t ƒoR|dj o#|i|jo|i|ƒ} n|} | o| iƒ} n| St|tƒot|d |d |d |ƒSt|tƒo™|dj o#|i|jo|i|ƒ} n|} | o| iƒ} n| it ƒ} t| iitiƒotit| ifƒ| _n| St|ddƒ}|djpt|tƒ otdƒ‚nti|ƒ}|dj o#|i|jo|i|ƒ}n|it ƒ} t| iitiƒotit| ifƒ| _n| SdS(s=Construct a record array from a wide-variety of objects. sIMust define formats (or dtype) if object is None, string, or an open fileRRR R!R"s"Must define a shape if obj is NoneRlRfRgRkiRt__array_interface__sUnknown input typeN(R)R4R'RJtfileR(R+RRRRRšRR“R˜RRTtcopyR³RhR~RORPRR\tdictRŽ(RZRRkRfRgRRR R!R"R¶tkwdstnewRYt interface((s8/usr/lib64/python2.6/site-packages/numpy/core/records.pyRŽÙsj,         ((RFt__all__tnumericR+t defchararrayRt numerictypesROR5RœRqRhRAttypeDicttnumfmtRRRRPRRR'RGRR˜RšR¥R³tTrueRŽ(((s8/usr/lib64/python2.6/site-packages/numpy/core/records.pyt$sN           ƒFØ D ?  C