§ <ˆj�’ãó"—dZddlZddlmZddlmZddlmZddlm Z dd lm Z dd l mZdd lmZgd ¢Ze jZd ddd ddddd ddddddœZe jZd„Zed¦«Gd„d¦«¦«ZGd„de j¦«ZGd„de¦«Zd„Zed¦« d%d„¦«Zed¦« d%d„¦«Zed¦« d&d „¦«Zd!„Zed¦« d&d"„¦«Z ed¦« d'd$„¦«Z!dS)(a‚ 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 using structured types, such as:: >>> a = np.array([(1, 2.0), (1, 2.0)], dtype=[('x', np.int64), ('y', np.float64)]) >>> a array([(1, 2.), (1, 2.)], dtype=[('x', '>> a['x'] array([1, 1]) >>> a['y'] array([2., 2.]) Record arrays allow us to access fields as properties:: >>> ar = np.rec.array(a) >>> ar.x array([1, 1]) >>> ar.y array([2., 2.]) éN)ÚCounter)Ú nullcontexté)Ú set_moduleé)Únumeric)Ú numerictypes)Ú os_fspath)Ú_get_legacy_print_mode)ÚrecordÚrecarrayÚ format_parserÚ fromarraysÚ fromrecordsÚ fromstringÚfromfileÚarrayú>ú<ú=Úsú|)ÚbÚlÚnÚBÚLÚNÚSrrrrrÚIÚicóX—d„t|¦« ¦«D¦«S)z@Find duplication in a list, return a list of duplicated elementscó$—g|] \}}|dk¯ |‘ŒS©r©)Ú.0ÚitemÚcountss úI/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/core/records.pyú z"find_duplicate..Ps-€ð ð ð á ˆD�&Ø �AŠ:ˆ:ð à ˆ:ˆ:ó)rÚitems)Úlists r)Úfind_duplicater.Ns5€ð ð å# D™MœM×/Ò/Ñ1Ô1ð ñ ô ðr+Únumpycó.—eZdZdZdd„Zd d„Zd„Zd„ZdS) ra‡ Class to convert formats, names, titles description to a dtype. After constructing the format_parser object, the dtype attribute is the converted data-type: ``dtype = format_parser(formats, names, titles).dtype`` Attributes ---------- dtype : dtype The converted data-type. Parameters ---------- formats : str or list of str The format description, either specified as a string with comma-separated format descriptions in the form ``'f8, i4, a5'``, or a list of format description strings in the form ``['f8', 'i4', 'a5']``. names : str or list/tuple of str The field names, either specified as a comma-separated string in the form ``'col1, col2, col3'``, or as a list or tuple of strings in the form ``['col1', 'col2', 'col3']``. An empty list can be used, in that case default field names ('f0', 'f1', ...) are used. titles : sequence Sequence of title strings. An empty list can be used to leave titles out. aligned : bool, optional If True, align the fields by padding as the C-compiler would. Default is False. byteorder : str, optional If specified, all the fields will be changed to the provided byte-order. Otherwise, the default byte-order is used. For all available string specifiers, see `dtype.newbyteorder`. See Also -------- dtype, typename, sctype2char Examples -------- >>> np.format_parser(['>> np.format_parser(['f8', 'i4', 'a5'], ['col1', 'col2', 'col3'], ... []).dtype dtype([('col1', '>> np.format_parser(['.Ÿs+€ÐQÐQÐQ± °°7�%—,’,˜q‘/”/ 7Ð+ÐQÐQÐQr+Úf1có,•—g|]}‰|d‘ŒS©rr%©r&ÚkeyÚfieldss €r)r*z/format_parser._parseFormats..©s!ø€Ð:Ð:Ð:¨c˜6 #œ; qœ>Ð:Ð:Ð:r+có,•—g|]}‰|d‘ŒSr$r%rDs €r)r*z/format_parser._parseFormats..ªs!ø€Ð8Ð8Ð8¨C˜ œ QœÐ8Ð8Ð8r+) Ú ValueErrorÚ isinstancer-ÚsbÚdtypeÚ enumeraterFr8Ú _f_formatsÚ_offsetsÚlenÚ_nfields)r6r7r:rKÚkeysrFs @r)r3zformat_parser._parseFormats˜såø€ð ˆ?ÝÐ4Ñ5Ô5Ð 5Ý �g�tÑ $Ô $ð /Ý”HØQÐQ½iÈÑ>PÔ>PÐQÑQÔQØñôˆEˆEõ ”H˜W gÑ.Ô.ˆEØ”ˆØ ˆ>Ý”H˜t U˜m˜_¨gÑ6Ô6ˆEØ”\ˆFØŒ{ˆØ:Ð:Ð:Ð:°TÐ:Ñ:Ô:ˆŒØ8Ð8Ð8Ð8°4Ð8Ñ8Ô8ˆŒ ݘD™ œ ˆŒ ˆ ˆ r+cóΗ|r‡t|¦«ttfvrnJt|t¦«r| d¦«}nt dt|¦«z¦«‚d„|d|j…D¦«|_ ng|_ |xj d„tt|j ¦«|j¦«D¦«z c_ t|j ¦«}|rtd|z¦«‚|rd„|d|j…D¦«|_n g|_g}|jt|¦«kr+|xjdg|jt|¦«z zz c_dSdS)zQconvert input field names into a list and assign to the _names attribute ú,zillegal input names %scó6—g|]}| ¦«‘ŒSr%©Ústrip©r&rs r)r*z0format_parser._setfieldnames..¹s €ÐDÐDÐD¨˜1Ÿ7š7™9œ9ÐDÐDÐDr+Ncó—g|]}d|z‘ŒS)zf%dr%)r&r!s r)r*z0format_parser._setfieldnames..Ás.€ðAðAðA a˜ ™ ðAðAðAr+zDuplicate field names: %scó6—g|]}| ¦«‘ŒSr%rUrWs r)r*z0format_parser._setfieldnames..És €ÐFÐFÐF¨!˜AŸGšG™IœIÐFÐFÐFr+)Útyper-ÚtuplerIÚstrÚsplitÚ NameErrorÚreprrPÚ_namesÚrangerOr.rHÚ_titles)r6r8r9Ú_dups r)r4zformat_parser._setfieldnames­s„€ð ð Ý�E‰{Œ{�t¥U˜mÐ+Ð+ØÝ˜E¥3Ñ'Ô'ð HØŸ š  CÑ(Ô(��åÐ 8½4À¹;¼;Ñ FÑGÔGÐGàDÐD¨e°N°T´]°NÔ.CÐDÑDÔDˆDŒKˆKàˆDŒKð ˆ Œ ðAðA­5µ°T´[Ñ1AÔ1AØ15´ñ,@ô,@ðAñAôAñ Aˆ Œ õ˜dœkÑ*Ô*ˆØ ð AÝÐ8¸4Ñ?Ñ@Ô@Ð @à ð ØFÐF¨v°n°t´}°nÔ/EÐFÑFÔFˆDŒLˆLàˆDŒL؈Fà Œ=�3˜v™;œ;Ò &Ð &Ø ˆLŒL˜T˜F d¤mµc¸&±k´kÑ&AÑBÑ BˆLŒLˆLˆLð 'Ð &r+có—tj|j|j|j|jdœ¦«}|�(t |d}| |¦«}||_dS)N)r8r7Úoffsetsr9r)rJrKr`rMrNrbÚ_byteorderconvÚ newbyteorder)r6r;rKs r)r5zformat_parser._createdtypeÑse€Ý”Ø”[ؔؔ}Ø”lð  ð ñ ô ˆð Ð Ý& y°¤|Ô4ˆIØ×&Ò& yÑ1Ô1ˆEàˆŒ ˆ ˆ r+)FN)F)Ú__name__Ú __module__Ú __qualname__Ú__doc__r<r3r4r5r%r+r)rrWsi€€€€€ð8ð8ðt%ð%ð%ð%ð "ð"ð"ð"ð*"Cð"Cð"CðH ð ð ð ð r+rcóL‡—eZdZdZdZdZˆfd„Zˆfd„Zd„Zd„Zd„Zd„Z ˆxZ S) r zEA data-type scalar that allows field access as attribute lookup. r/có�•—t¦«dkr| ¦«St¦« ¦«S©Néq)r Ú__str__ÚsuperÚ__repr__©r6Ú __class__s €r)rrzrecord.__repr__ès8ø€Ý !Ñ #Ô # sÒ *Ð *Ø—<’<‘>”>Ð !݉wŒw×ÒÑ!Ô!Ð!r+c󪕗t¦«dkr!t| ¦«¦«St¦« ¦«Srn)r r\r'rqrprss €r)rpzrecord.__str__ís>ø€Ý !Ñ #Ô # sÒ *Ð *Ý�t—y’y‘{”{Ñ#Ô#Ð #݉wŒw�ŠÑ Ô Ð r+cóø—|dvr tj ||¦«S tj ||¦«S#t$rYnwxYwtj |d¦«j}| |d¦«}|rW|j|dd…Ž} |j}n#t$r|cYSwxYw|j�!|  |j |jf¦«S|Std|z¦«‚)N©ÚsetfieldÚgetfieldrKrKrú%'record' object has no attribute '%s') ÚntÚvoidÚ__getattribute__ÚAttributeErrorrFÚgetryrKr8Úviewrt)r6ÚattrÚ fielddictÚresÚobjÚdts r)r}zrecord.__getattribute__òs)€Ø Ð4Ð 4Ð 4Ý”7×+Ò+¨D°$Ñ7Ô7Ð 7ð Ý”7×+Ò+¨D°$Ñ7Ô7Ð 7øÝð ð ð Ø ˆDð øøøå”G×,Ò,¨T°7Ñ;Ô;ÔBˆ Ø�mŠm˜D $Ñ'Ô'ˆØ ð -Ø�$”-  R a R¤Ð)ˆCð Ø”Y��øÝ!ð ð ð à� � � ð øøøðŒxÐ#Ø—x’x ¤°´Ð ;Ñ<Ô<Ð<؈Jå ð"%Ø'+ñ",ñ-ô-ð -s#¦AÁ AÁAÂ&B.Â. B=Â<B=có\—|dvrtd|z¦«‚tj |d¦«j}| |d¦«}|r|j|g|dd…¢RŽSt||d¦«r!tj |||¦«Std|z¦«‚)NrwzCannot set '%s' attributerKrrz) r~r{r|r}rFrrxÚgetattrÚ __setattr__)r6r�Úvalr‚rƒs r)rˆzrecord.__setattr__ sÆ€Ø Ð4Ð 4Ð 4Ý Ð!<¸tÑ!CÑDÔDÐ DÝ”G×,Ò,¨T°7Ñ;Ô;ÔBˆ Ø�mŠm˜D $Ñ'Ô'ˆØ ð 1Ø �4”= Ð/ s¨2¨A¨2¤wÐ/Ð/Ð/Ð /å�t˜T 4Ñ(Ô(ð 1Ý”w×*Ò*¨4°°sÑ;Ô;Ð;å$ð&)Ø+/ñ&0ñ1ô1ð1r+cóÔ—tj ||¦«}t|tj¦«r-|jj�!| |j|jf¦«S|Sr2)r{r|Ú __getitem__rIrKr8r€rt)r6Úindxr„s r)r‹zrecord.__getitem__sZ€ÝŒg×!Ò! $¨Ñ-Ô-ˆõ �c�2œ7Ñ #Ô #𠨬 ¬Ð(CØ—8’8˜Tœ^¨S¬YÐ7Ñ8Ô8Ð 8ðˆJr+c󢇇—‰jj}td„|D¦«¦«}d|zŠˆˆfd„|D¦«}d |¦«S)zPretty-print all fields.c3ó4K—|]}t|¦«V—ŒdSr2)rO)r&Únames r)ú z record.pprint..'s(èè€Ð1Ð1 4•S˜‘Y”YÐ1Ð1Ð1Ð1Ð1Ð1r+z %% %ds: %%scó:•—g|]}‰|t‰|¦«fz‘ŒSr%)r‡)r&r�Úfmtr6s €€r)r*z!record.pprint..)s-ø€ÐDÐDÐD°d��t�W T¨4Ñ0Ô0Ð1Ñ1ÐDÐDÐDr+ú )rKr8ÚmaxÚjoin)r6r8ÚmaxlenÚrowsr’s` @r)Úpprintz record.pprint#sbøø€ð” Ô ˆÝÐ1Ð1¨5Ð1Ñ1Ô1Ñ1Ô1ˆØ˜fÑ$ˆØDÐDÐDÐDÐD¸eÐDÑDÔDˆØ�yŠy˜‰ŒÐr+) rhrirjrkrrrpr}rˆr‹r˜Ú __classcell__©rts@r)r r ßs£ø€€€€€ððð €HØ€Jð"ð"ð"ð"ð"ð !ð!ð!ð!ð!ð -ð-ð-ð2 1ð 1ð 1ððððððððððr+r cóX‡—eZdZdZdZdZ dd„Zd„Zd „Zd „Zˆfd „Zd „Z dd „Z ˆxZ S)r a-Construct an ndarray that allows field access using attributes. Arrays may have a data-types containing fields, analogous to columns in a spread sheet. An example is ``[(x, int), (y, float)]``, where each entry in the array is a pair of ``(int, float)``. Normally, these attributes are accessed using dictionary lookups such as ``arr['x']`` and ``arr['y']``. Record arrays allow the fields to be accessed as members of the array, using ``arr.x`` and ``arr.y``. Parameters ---------- shape : tuple Shape of output array. dtype : data-type, optional The desired data-type. By default, the data-type is determined from `formats`, `names`, `titles`, `aligned` and `byteorder`. formats : list of data-types, optional A list containing the data-types for the different columns, e.g. ``['i4', 'f8', 'i4']``. `formats` does *not* support the new convention of using types directly, i.e. ``(int, float, int)``. Note that `formats` must be a list, not a tuple. Given that `formats` is somewhat limited, we recommend specifying `dtype` instead. names : tuple of str, optional The name of each column, e.g. ``('x', 'y', 'z')``. buf : buffer, optional By default, a new array is created of the given shape and data-type. If `buf` is specified and is an object exposing the buffer interface, the array will use the memory from the existing buffer. In this case, the `offset` and `strides` keywords are available. Other Parameters ---------------- titles : tuple of str, optional Aliases for column names. For example, if `names` were ``('x', 'y', 'z')`` and `titles` is ``('x_coordinate', 'y_coordinate', 'z_coordinate')``, then ``arr['x']`` is equivalent to both ``arr.x`` and ``arr.x_coordinate``. byteorder : {'<', '>', '='}, 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. order : {'C', 'F'}, optional Row-major (C-style) or column-major (Fortran-style) order. Returns ------- rec : recarray Empty array of the given shape and type. See Also -------- core.records.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 record 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', '>> x array([(1., 2), (3., 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) # may vary >>> x1[1]=34 >>> r.a array([1, 2, 3, 4]) >>> 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], ... dtype=np.dtype([('a', np.int32), ('b', 'S3'), ('c', np.float32)])) >>> r rec.array([(1, b'a', 1.1), (2, b'dd', 2. ), (3, b'xyz', 3. ), (4, b'12', 4. )], dtype=[('a', '.}s €Ð2Ð2Ð2 1•”˜A‘”Ð2Ð2Ð2r+Nrcó—g|] }|j‘Œ Sr%r«)r&r„s r)r*zfromarrays..Šs€Ð2Ð2Ð2 �3”9Ð2Ð2Ð2r+z>mismatch between the number of fields and the number of arrayszarray-shape mismatch in array z ("z")) rÌr¥rIrÃrJrKrr8rOrHr rLÚndim)Ú arrayListrKr¥r7r8r9r:r;r§r`Úd0ÚnnÚ_arrayÚkr„Ú testshaper�s r)rrLs˜€ðb3Ð2¨ Ð2Ñ2Ô2€Iõ ' uÑ -Ô -€Eà €}ؘ!” Ô"ˆˆÝ �E�3Ñ Ô ðØ�ˆà€˜5˜=ð3Ð2¨ Ð2Ñ2Ô2ˆà ÐÝ”˜‘”ˆˆå˜g u¨f°g¸yÑIÔIÔOˆØ Œ[€Fõ ˆ5�z„z•S˜‘^”^Ò#Ð#Ýð+ñ,ô,ð ,ð ˆqŒŒ€BÝ ˆR‰Œ€BØ ˆA‚v€vØ�d˜�s�d” ˆå �e˜UÑ #Ô #€Fõ˜IÑ&Ô&ðð‰ˆˆ3Ø �1ŒXŒ]ˆØ”I˜n˜sœx¨"™}˜nÔ-ˆ Ø�aŒyˆØ ˜Ò Ð ÝÐL¸aÐLÐLÀDÐLÐLÐLÑMÔMÐ Màˆˆt‰ ˆ à €Mr+c óR‡—|€Y|€Wtj|t¬¦«Šˆfd„t‰jd¦«D¦«}t |||||||¬¦«S|�tjt|f¦«} nt|||||¦«j} tj|| ¬¦«} |�| j|kr|| _nÎ#ttf$rºt|¦«}|€t|¦«}t|t¦«r|f}t|¦«dkrtd¦«‚t|| ¦«} t| j¦«D]} t#|| ¦«| | <Œt%jdt(d ¬ ¦«| cYSwxYw|  t¦«} | S) a Create a recarray from a list of records in text form. Parameters ---------- recList : sequence data in the same field may be heterogeneous - they will be promoted to the highest data type. dtype : data-type, optional valid dtype for all arrays shape : int or tuple of ints, optional shape of each array. formats, names, titles, aligned, byteorder : If `dtype` is ``None``, these arguments are passed to `numpy.format_parser` to construct a dtype. See that function for detailed documentation. If both `formats` and `dtype` are None, then this will auto-detect formats. Use list of tuples rather than list of lists for faster processing. Returns ------- np.recarray record array consisting of given recList rows. Examples -------- >>> 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 array(['dbe', 'de'], dtype='>> import pickle >>> pickle.loads(pickle.dumps(r)) rec.array([(456, 'dbe', 1.2), ( 2, 'de', 1.3)], dtype=[('col1', '.Ùs7ø€ÐPÐPÐP°a•2”8˜C  Q œK×.Ò.Ñ0Ô0Ñ1Ô1ÐPÐPÐPr+éÿÿÿÿ)r7r¥r8r9r:r;rzCan only deal with 1-d array.zxfromrecords expected a list of tuples, may have received a list of lists instead. In the future that will raise an errorrrÇ)rJrr¬rar¥rrKr rr­rHrÌrOrIrÃr r½r[rÉrÊrËr€)ÚrecListrKr¥r7r8r9r:r;Úarrlistr§ÚretvalrÖr×rƒr„s @r)rr«sÜø€ðX€˜5˜=ÝŒh�w¥fÐ-Ñ-Ô-ˆØPÐPÐPÐP½5ÀÄÈ2ÄÑ;OÔ;OÐPÑPÔPˆÝ˜'¨7¸%ÀuØ!'°ÀIðOñOôOð Oð ÐÝ”�& %˜Ñ)Ô)ˆˆå˜g u¨f°g¸yÑIÔIÔOˆð!Ý”˜'¨Ð/Ñ/Ô/ˆð* Ð  ¤°Ò!6Ð!6Ø ˆFŒLøøõ+ •zÐ "ðððå*¨5Ñ1Ô1ˆØ ˆ=ݘ‘L”LˆEÝ �e�SÑ !Ô !ð Ø�HˆEÝ ˆu‰:Œ:˜Š>ˆ>ÝÐ<Ñ=Ô=Ð =ݘ% Ñ'Ô'ˆÝ�v”{Ñ#Ô#ð *ð *ˆAݘg aœjÑ)Ô)ˆF�1‰IˆIõ Œ ð Gå  að )ñ )ô )ð )ðˆ ˆ ˆ ð%øøøð. �+Š+•hÑ Ô €Cà €JsÂB?Â?CF Æ F c ó—|€|€td¦«‚|�tj|¦«} nt|||||¦«j} | j} t |¦«}|dvrt |¦«|z | z}t|| ||¬¦«} | S)aöCreate a record array from binary data Note that despite the name of this function it does not accept `str` instances. Parameters ---------- datastring : bytes-like Buffer of binary data dtype : data-type, optional Valid dtype for all arrays shape : int or tuple of ints, optional Shape of each array. offset : int, optional Position in the buffer to start reading from. formats, names, titles, aligned, byteorder : If `dtype` is ``None``, these arguments are passed to `numpy.format_parser` to construct a dtype. See that function for detailed documentation. Returns ------- np.recarray Record array view into the data in datastring. This will be readonly if `datastring` is readonly. See Also -------- numpy.frombuffer Examples -------- >>> a = b'\x01\x02\x03abc' >>> np.core.records.fromstring(a, dtype='u1,u1,u1,S3') rec.array([(1, 2, 3, b'abc')], dtype=[('f0', 'u1'), ('f1', 'u1'), ('f2', 'u1'), ('f3', 'S3')]) >>> grades_dtype = [('Name', (np.str_, 10)), ('Marks', np.float64), ... ('GradeLevel', np.int32)] >>> grades_array = np.array([('Sam', 33.3, 3), ('Mike', 44.4, 5), ... ('Aadi', 66.6, 6)], dtype=grades_dtype) >>> np.core.records.fromstring(grades_array.tobytes(), dtype=grades_dtype) rec.array([('Sam', 33.3, 3), ('Mike', 44.4, 5), ('Aadi', 66.6, 6)], dtype=[('Name', '>> s = '\x01\x02\x03abc' >>> np.core.records.fromstring(s, dtype='u1,u1,u1,S3') Traceback (most recent call last) ... TypeError: a bytes-like object is required, not 'str' Nz2fromstring() needs a 'dtype' or 'formats' argument)NrÜ)r¦r )r­rJrKrÚitemsizerÌrOr ) Ú datastringrKr¥r r7r8r9r:r;r§rárÖs r)rrs›€ðp €}˜˜ÝÐLÑMÔMÐMà ÐÝ”˜‘”ˆˆå˜g u¨f°g¸yÑIÔIÔOˆàŒ~€Hõ ' uÑ -Ô -€Eà � ÐÐÝ�Z‘” 6Ñ)¨hÑ6ˆå �e˜U¨ ¸6Ð BÑ BÔ B€FØ €Mr+cóè—| ¦«} | dd¦«| ¦«|z | |d¦«S#| |d¦«wxYw)Nrr)ÚtellÚseek)ÚfdÚposs r)Úget_remaining_sizerèKs]€Ø �'Š'‰)Œ)€CðØ �Š��1‰ Œ ˆ Ø�wŠw‰yŒy˜3‰à �Š��Q‰Œˆˆøˆ�Š��Q‰Œˆˆøøøs –,AÁA1c óú—|€|€td¦«‚t|¦«}|€d}nt|t¦«r|f}t |d¦«rt |¦«} nt t|¦«d¦«} | 5}|dkr| |d¦«t|¦«} |�tj |¦«} nt|||||¦«j } | j } tj|¦« t j¬¦«} | | z}|dkrlt%|¦«}| | z|| d ¦«<t)|¦«}tj|¦« t j¬¦«} | | z}|| krt+d ¦«‚t-|| ¦«}| |j¦«}||krt3d ¦«‚ ddd¦«n #1swxYwY|S) aúCreate an array from binary file data Parameters ---------- fd : str or file type If file is a string or a path-like object then that file is opened, else it is assumed to be a file object. The file object must support random access (i.e. it must have tell and seek methods). dtype : data-type, optional valid dtype for all arrays shape : int or tuple of ints, optional shape of each array. offset : int, optional Position in the file to start reading from. formats, names, titles, aligned, byteorder : If `dtype` is ``None``, these arguments are passed to `numpy.format_parser` to construct a dtype. See that function for detailed documentation Returns ------- np.recarray record array consisting of data enclosed in file. Examples -------- >>> 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,) Nz0fromfile() needs a 'dtype' or 'formats' argument)rÜÚreadintoÚrbrrr«rÜz:Not enough bytes left in file for specified shape and typez%Didn't read as many bytes as expected)r­rÌrIrÃÚhasattrrÚopenr rårèrJrKrrárÚprodr{Úintpr-Úindexr[rHr rêÚdataÚOSError)rærKr¥r r7r8r9r:r;Úctxr½r§ráÚ shapeprodÚ shapesizeÚnbytesrÖÚ nbytesreads r)rrTsI€ð\ €}˜˜ÝÐJÑKÔKÐKõ ' uÑ -Ô -€Eà €}؈ˆÝ �E�3Ñ Ô ðØ�ˆåˆr�:ÑÔð(õ˜"‰oŒoˆˆõ•9˜R‘=”= $Ñ'Ô'ˆà ðC�Ø �AŠ:ˆ:Ø �GŠG�F˜AÑ Ô Ð Ý! "Ñ%Ô%ˆà Ð Ý”H˜U‘O”OˆEˆEå! '¨5°&¸'À9ÑMÔMÔSˆEà”>ˆå”H˜U‘O”O×(Ò(­r¬wÐ(Ñ7Ô7ˆ Ø Ñ(ˆ Ø �qŠ=ˆ=ݘ‘K”KˆEØ%)¨i¨ZÑ%7ˆE�%—+’+˜b‘/”/Ñ "ݘ%‘L”LˆEÝœ ™œ×,Ò,µ2´7Ð,Ñ;Ô;ˆIà˜XÑ%ˆà �DŠ=ˆ=ÝØPñRôRð Rõ˜% Ñ'Ô'ˆØ—[’[ ¤Ñ-Ô-ˆ Ø ˜Ò Ð ÝÐAÑBÔBÐ Bð ð;CðCðCñCôCðCðCðCðCðCðCøøøðCðCðCðCð@ €MsÁ?E$G0Ç0G4Ç7G4Tc ó*—t|td¦«tf¦«st|d¦«r|€|€t d¦«‚i} |�t j|¦«}n#|�t||||| ¦«j}n||||| dœ} |€%|€t d¦«‚t|||||¬¦«St|t¦«rt||f||dœ| ¤ŽSt|ttf¦«rBt|dttf¦«rt|f||d œ| ¤ŽSt|f||d œ| ¤ŽSt|t¦«r=|�!|j|kr| |¦«} n|} | r|  ¦«} | St|d¦«rt#||||¬ ¦«St|t$¦«rU|�!|j|kr| |¦«} n|} | r|  ¦«} |  t¦«St'|d d¦«} | �t| t(¦«st d ¦«‚t j|¦«}|� |j|kr| |¦«}| t¦«S) aŸ Construct a record array from a wide-variety of objects. A general-purpose record array constructor that dispatches to the appropriate `recarray` creation function based on the inputs (see Notes). Parameters ---------- obj : any Input object. See Notes for details on how various input types are treated. dtype : data-type, optional Valid dtype for array. shape : int or tuple of ints, optional Shape of each array. offset : int, optional Position in the file or buffer to start reading from. 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). formats, names, titles, aligned, byteorder : If `dtype` is ``None``, these arguments are passed to `numpy.format_parser` to construct a dtype. See that function for detailed documentation. copy : bool, optional Whether to copy the input object (True), or to use a reference instead. This option only applies when the input is an ndarray or recarray. Defaults to True. Returns ------- np.recarray Record array created from the specified object. Notes ----- If `obj` is ``None``, then call the `~numpy.recarray` constructor. If `obj` is a string, then call the `fromstring` constructor. If `obj` is a list or a tuple, then if the first object is an `~numpy.ndarray`, call `fromarrays`, otherwise call `fromrecords`. If `obj` is a `~numpy.recarray`, then make a copy of the data in the recarray (if ``copy=True``) and use the new formats, names, and titles. If `obj` is a file, then call `fromfile`. Finally, if obj is an `ndarray`, then return ``obj.view(recarray)``, making a copy of the data if ``copy=True``. Examples -------- >>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> np.core.records.array(a) rec.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype=int32) >>> b = [(1, 1), (2, 4), (3, 9)] >>> c = np.core.records.array(b, formats = ['i2', 'f2'], names = ('x', 'y')) >>> c rec.array([(1, 1.0), (2, 4.0), (3, 9.0)], dtype=[('x', '>> c.x rec.array([1, 2, 3], dtype=int16) >>> c.y rec.array([ 1.0, 4.0, 9.0], dtype=float16) >>> r = np.rec.array(['abc','def'], names=['col1','col2']) >>> print(r.col1) abc >>> r.col1 array('abc', dtype='>> r.col2 array('def', dtype='r sèðð"ð"ðF€€€ØÐÐÐÐÐØ"Ð"Ð"Ð"Ð"Ð"àÐÐÐÐÐØÐÐÐÐÐØ Ð Ð Ð Ð Ð Ø"Ð"Ð"Ð"Ð"Ð"Ø.Ð.Ð.Ð.Ð.Ð.ð ð ð €ð Œ*€àØØØØØØØØØØØØØð ð €ð( Œ€ððð𠀈GÑÔðDðDðDðDðDñDôDñÔðDðNKðKðKðKðKˆRŒWñKôKðKðjI,ðI,ðI,ðI,ðI,ˆwñI,ôI,ðI,ðX ð ð 𠀈KÑÔØ:>ØAEð[ð[ð[ñÔð[ð| €ˆKÑÔØEIØ6:ðQðQðQñÔðQðh €ˆKÑÔØEIØAEðHðHðHñÔðHðTðð𠀈KÑÔØ;?Ø?CðaðaðañÔðaðH €ˆKÑÔØGKØGKðQ"ðQ"ðQ"ñÔðQ"ðQ"ðQ"r+