§ y<ˆjèãón—dZddlZddlZddlmZddlmZmZddlmZddl m Z ddl m Z ddl mZejjjZgd¢Zd „Ze e¦«d „¦«Zd „Zd „Zd „Zd„ZdAd„ZdAd„ZdBd„Zd„Zd„ZdCd„ZdDd„ZdEd„Z dFd„Z e e ¦« dGd„¦«Z!dBd„Z"e e"¦«dDd„¦«Z#dDd„Z$d„Z%e e%¦«d „¦«Z&d!„Z'e e'¦«d"„¦«Z( dFd#„Z)e e)¦« dHd$„¦«Z*dEd%„Z+e e+¦«dEd&„¦«Z,dBd'„Z-e e-¦«dId(„¦«Z.dJd)„Z/d*„Z0 dKd+„Z1e e1¦«dLd-„¦«Z2 dMd.„Z3e e3¦« dNd/„¦«Z4d0„Z5e e5¦«d1„¦«Z6dEd2„Z7e e7¦«dOd3„¦«Z8d4„Z9e e9¦«d5„¦«Z: dFd6„Z;e e;¦« dPd7„¦«Z< dKd8„Z=e e=¦«dQd9„¦«Z> dRd:„Z?e e?¦« dSd>„¦«Z@ dFd?„ZAe eA¦« dTd@„¦«ZBdS)UzÆ Collection of utilities to manipulate structured arrays. Most of these functions were initially implemented by John Hunter for matplotlib. They have been rewritten and extended for convenience. éN)ÚndarrayÚrecarray)Ú MaskedArray)Ú MaskedRecords)Úarray_function_dispatch)Ú_is_string_like)Ú append_fieldsÚapply_along_fieldsÚassign_fields_by_nameÚ drop_fieldsÚfind_duplicatesÚ flatten_descrÚget_fieldstructureÚ get_namesÚget_names_flatÚjoin_byÚ merge_arraysÚrec_append_fieldsÚrec_drop_fieldsÚrec_joinÚrecursive_fill_fieldsÚ rename_fieldsÚ repack_fieldsÚrequire_fieldsÚ stack_arraysÚstructured_to_unstructuredÚunstructured_to_structuredcó —||fS©N©)ÚinputÚoutputs új/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib64/python3.11/site-packages/numpy/lib/recfunctions.pyÚ!_recursive_fill_fields_dispatcherr$s €Ø �6ˆ?ÐócóÖ—|j}|jD]Y} ||}n#t$rYŒwxYw|jj�t|||¦«Œ?|||dt |¦«…<ŒZ|S)aj Fills fields from output with fields from input, with support for nested structures. Parameters ---------- input : ndarray Input array. output : ndarray Output array. Notes ----- * `output` should be at least the same size as `input` Examples -------- >>> from numpy.lib import recfunctions as rfn >>> a = np.array([(1, 10.), (2, 20.)], dtype=[('A', np.int64), ('B', np.float64)]) >>> b = np.zeros((3,), dtype=a.dtype) >>> rfn.recursive_fill_fields(a, b) array([(1, 10.), (2, 20.), (0, 0.)], dtype=[('A', '>> dt = np.dtype([(('a', 'A'), np.int64), ('b', np.double, 3)]) >>> dt.descr [(('a', 'A'), '>> _get_fieldspec(dt) [(('a', 'A'), dtype('int64')), ('b', dtype(('z!_get_fieldspec..as/øèè€ÐEÐE°�4˜œ dÔ+Ð,ÐEÐEÐEÐEÐEÐEr%cób—g|],\}}t|¦«dkr|n |d|f|df‘Œ-S)ér©r*)r3r4Úfs r#ú z"_get_fieldspec..csO€ð ð ð á��aõ˜‘V”V˜q’[�[ˆTˆT q¨¤t¨T l°A°a´DÐ 9ð ð ð r%©r()r'r1s` r#Ú_get_fieldspecr<JsUø€ð& „{Ðà�U� ˆ}ÐàEÐEÐEÐE¸¼ÐEÑEÔEˆð ð à!ð ñ ô ð r%c óè—g}|j}|D]X}||}|j�2| |tt|¦«¦«f¦«ŒC| |¦«ŒYt|¦«S)aG Returns the field names of the input datatype as a tuple. Input datatype must have fields otherwise error is raised. Parameters ---------- adtype : dtype Input datatype Examples -------- >>> from numpy.lib import recfunctions as rfn >>> rfn.get_names(np.empty((1,), dtype=[('A', int)]).dtype) ('A',) >>> rfn.get_names(np.empty((1,), dtype=[('A',int), ('B', float)]).dtype) ('A', 'B') >>> adtype = np.dtype([('a', int), ('b', [('ba', int), ('bb', int)])]) >>> rfn.get_names(adtype) ('a', ('b', ('ba', 'bb'))) )r(ÚappendÚtupler©ÚadtypeÚ listnamesr(r4r-s r#rris�€ð*€IØ ŒL€EØð#ð#ˆØ˜”,ˆØ Œ=Ð $Ø × Ò ˜d¥E­)°GÑ*<Ô*<Ñ$=Ô$=Ð>Ñ ?Ô ?Ð ?Ð ?à × Ò ˜TÑ "Ô "Ð "Ð "Ý �Ñ Ô Ðr%cóÈ—g}|j}|D]H}| |¦«||}|j�"| t|¦«¦«ŒIt |¦«S)a† Returns the field names of the input datatype as a tuple. Input datatype must have fields otherwise error is raised. Nested structure are flattened beforehand. Parameters ---------- adtype : dtype Input datatype Examples -------- >>> from numpy.lib import recfunctions as rfn >>> rfn.get_names_flat(np.empty((1,), dtype=[('A', int)]).dtype) is None False >>> rfn.get_names_flat(np.empty((1,), dtype=[('A',int), ('B', str)]).dtype) ('A', 'B') >>> adtype = np.dtype([('a', int), ('b', [('ba', int), ('bb', int)])]) >>> rfn.get_names_flat(adtype) ('a', 'b', 'ba', 'bb') )r(r>Úextendrr?r@s r#rr‰so€ð,€IØ ŒL€EØð6ð6ˆØ×Ò˜ÑÔÐØ˜”,ˆØ Œ=Ð $Ø × Ò �^¨GÑ4Ô4Ñ 5Ô 5Ð 5øÝ �Ñ Ô Ðr%cóì—|j}|€d|ffSg}|D]S}|j|\}}|j�#| t|¦«¦«Œ<| ||f¦«ŒTt |¦«S)aD Flatten a structured data-type description. Examples -------- >>> from numpy.lib import recfunctions as rfn >>> ndtype = np.dtype([('a', '>> rfn.flatten_descr(ndtype) (('a', dtype('int32')), ('ba', dtype('float64')), ('bb', dtype('int32'))) Nr/)r(r1rDrr>r?)Úndtyper(Údescrr,ÚtypÚ_s r#rr©sŠ€ð ŒL€EØ €}Ø�V� ˆÐàˆØð +ð +ˆEØ”} UÔ+‰HˆS�!ØŒyÐ$Ø— ’ �]¨3Ñ/Ô/Ñ0Ô0Ð0Ð0à— ’ ˜e S˜\Ñ*Ô*Ð*Ð*Ý�U‰|Œ|Ðr%FcóV—g}|r-|D])}| t|j¦«¦«Œ*ne|D]b}|j}|j�;t |j¦«dkr#| t |¦«¦«ŒK| d|f¦«Œctj|¦«S)Nér/)rDrr'r(r*r<r>Únp)Ú seqarraysÚflattenr+Úar-s r#Ú _zip_dtyperPÃs¼€Ø€HØð /Øð 4ð 4ˆAØ �OŠO�M¨!¬'Ñ2Ô2Ñ 3Ô 3Ð 3Ð 3ð 4ðð /ð /ˆAØ”gˆGØŒ}Ð(­S°´Ñ-?Ô-?À1Ò-DÐ-Dà—’¥¨wÑ 7Ô 7Ñ8Ô8Ð8Ð8à—’  W  Ñ.Ô.Ð.Ð.Ý Œ8�HÑ Ô Ðr%có.—t||¬¦«jS)zî Combine the dtype description of a series of arrays. Parameters ---------- seqarrays : sequence of arrays Sequence of arrays flatten : {boolean}, optional Whether to collapse nested descriptions. ©rN)rPrG)rMrNs r#Ú _zip_descrrSÓs€õ �i¨Ð 1Ñ 1Ô 1Ô 7Ð7r%có6—|€i}|j}|D]Š}||}|j�3|r|g||<ng||<| t|||¦«¦«ŒDd„| |g¦«pgD¦«}|r| |¦«n|r|g}|pg||<Œ‹|S)ab Returns a dictionary with fields indexing lists of their parent fields. This function is used to simplify access to fields nested in other fields. Parameters ---------- adtype : np.dtype Input datatype lastname : optional Last processed field name (used internally during recursion). parents : dictionary Dictionary of parent fields (used interbally during recursion). Examples -------- >>> from numpy.lib import recfunctions as rfn >>> ndtype = np.dtype([('A', int), ... ('B', [('BA', int), ... ('BB', [('BBA', int), ('BBB', int)])])]) >>> rfn.get_fieldstructure(ndtype) ... # XXX: possible regression, order of BBA and BBB is swapped {'A': [], 'B': [], 'BA': ['B'], 'BB': ['B'], 'BBA': ['B', 'BB'], 'BBB': ['B', 'BB']} Ncó—g|]}|‘ŒSr r )r3rIs r#r:z&get_fieldstructure..s€ÐGÐGÐG ˜!ÐGÐGÐGr%)r(ÚupdaterÚgetr>)rAÚlastnameÚparentsr(r4r-Ú lastparents r#rrásÞ€ð4€ØˆØ ŒL€EØð-ð-ˆØ˜”,ˆØ Œ=Ð $Øð #Ø!)  �˜‘ � à "�˜‘ Ø �NŠNÕ-¨g°t¸WÑEÔEÑ FÔ FÐ FÐ FàGÐG g§k¢k°(¸BÑ&?Ô&?Ð&EÀ2ÐGÑGÔGˆJØð *Ø×!Ò! (Ñ+Ô+Ð+Ð+Øð *Ø&˜\� Ø&Ð,¨"ˆG�D‰MˆMØ €Nr%c#ó–K—|D]C}t|tj¦«r#tt |¦«¦«Ed{V—†Œ?|V—ŒDdS)zu Returns an iterator of concatenated fields from a sequence of arrays, collapsing any nested structure. N)Ú isinstancerLÚvoidÚ_izip_fields_flatr?©ÚiterableÚelements r#r^r^sièè€ð ððˆÝ �g�rœwÑ 'Ô 'ð Ý(­¨w©¬Ñ8Ô8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8àˆMˆMˆMˆMð ðr%c#ó2K—|D]‘}t|d¦«r+t|t¦«st|¦«Ed{V—†Œ=t|tj¦«r6t t|¦«¦«dkrt|¦«Ed{V—†Œ�|V—Œ’dS)zP Returns an iterator of concatenated fields from a sequence of arrays. Ú__iter__NrK)Úhasattrr\ÚstrÚ _izip_fieldsrLr]r*r?r_s r#rfrfsÂèè€ð ððˆÝ �G˜ZÑ (Ô (ð ݘw­Ñ,Ô,ð å# GÑ,Ô,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ý ˜¥¤Ñ )Ô )ð ­cµ%¸±.´.Ñ.AÔ.AÀQÒ.FÐ.Få# GÑ,Ô,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,Ð ,àˆMˆMˆMˆMððr%Tc#óˆK—|rt}nt}tj|d|iŽD]}t ||¦«¦«V—ŒdS)a* Returns an iterator of concatenated items from a sequence of arrays. Parameters ---------- seqarrays : sequence of arrays Sequence of arrays. fill_value : {None, integer} Value used to pad shorter iterables. flatten : {True, False}, Whether to Ú fillvalueN)r^rfÚ itertoolsÚ zip_longestr?)rMÚ fill_valuerNÚzipfuncÚtups r#Ú _izip_recordsrn-sdèè€ððÝ#ˆˆåˆåÔ$ iÐF¸:ÐFÐFð"ð"ˆÝ�G�G˜C‘L”LÑ!Ô!Ð!Ð!Ð!Ð!ð"ð"r%cóÒ—t|t¦«sd}|r|r| t¦«}n0t j|¦«}|r| t ¦«}|S)z€ Private function: return a recarray, a ndarray, a MaskedArray or a MaskedRecords depending on the input parameters F)r\rÚviewrÚmaÚfilledr)r"ÚusemaskÚ asrecarrays r#Ú _fix_outputruEsj€õ �f�kÑ *Ô *ðØˆØð+Ø ð 0Ø—[’[¥Ñ/Ô/ˆFøå”˜6Ñ"Ô"ˆØ ð +Ø—[’[¥Ñ*Ô*ˆFØ €Mr%có´—|jj}|j|j|j}}}|pi ¦«D]\}}||vr|||<|||||<Œ |S)zp Update the fill_value and masked data of `output` from the default given in a dictionary defaults. )r'r(ÚdataÚmaskrkÚitems)r"Údefaultsr(rwrxrkÚkÚvs r#Ú _fix_defaultsr}Vso€ð ŒLÔ €EØ &¤ ¨V¬[¸&Ô:K�ˆ4€TØ�>˜r×(Ò(Ñ*Ô*ð!ð!‰ˆˆAØ �ˆ:ˆ:؈J�q‰MØ ˆD�ŒG�D˜”GÑ øØ €Mr%có—|Srr )rMrkrNrsrts r#Ú_merge_arrays_dispatcherrds€à Ðr%éÿÿÿÿc ó—t|¦«dkrtj|d¦«}t|ttjf¦«r‘|j}|j€tjd|fg¦«}|rt|fd¬¦«|krP|  ¦«}|r|rt}nt}n|rt}nt}|  ||¬¦«S|f}n d„|D¦«}td „|D¦«¦«}t|¦«}t||¬¦«} g} g} |�rít!||¦«D�]X\} } || z }|   ¦« ¦«}t%j| ¦«  ¦«}|r£t)|| j¦«}t|ttjf¦«rlt|j¦«dkr| ¦«d}d}n>> from numpy.lib import recfunctions as rfn >>> rfn.merge_arrays((np.array([1, 2]), np.array([10., 20., 30.]))) array([( 1, 10.), ( 2, 20.), (-1, 30.)], dtype=[('f0', '>> rfn.merge_arrays((np.array([1, 2], dtype=np.int64), ... np.array([10., 20., 30.])), usemask=False) array([(1, 10.0), (2, 20.0), (-1, 30.0)], dtype=[('f0', '>> rfn.merge_arrays((np.array([1, 2]).view([('a', np.int64)]), ... np.array([10., 20., 30.])), ... usemask=False, asrecarray=True) rec.array([( 1, 10.), ( 2, 20.), (-1, 30.)], dtype=[('a', '.´s"€Ð;Ð;Ð;¨2•R”] 2Ñ&Ô&Ð;Ð;Ð;r%c3ó$K—|] }|jV—Œ dSr)Úsize©r3rOs r#r5zmerge_arrays..¶s$èè€Ð,Ð,˜Q�!”&Ð,Ð,Ð,Ð,Ð,Ð,r%)r'Úndmin)rK©r')r'Úcount)rx)r*rLr„r\rr]r'r(rPÚravelrrrrpr?ÚmaxÚzipÚ __array__rqÚ getmaskarrayÚ_check_fill_valueÚitemÚarrayÚonesr>riÚchainrnÚfromiterÚlist)rMrkrNrsrtÚseqdtypeÚseqtypeÚsizesÚ maxlengthr+ÚseqdataÚseqmaskrOÚnÚ nbmissingrwrxÚfvalÚfmskr"s r#rris1€õb ˆI‰Œ˜!ÒÐÝ”M )¨A¤,Ñ/Ô/ˆ å�)�g¥r¤wÐ/Ñ0Ô0ð<Ø”?ˆà Œ>Ð !Ý”x " h Ð 0Ñ1Ô1ˆHØð %�* i \¸4Ð@Ñ@Ô@ÀHÒLÐLà!ŸšÑ)Ô)ˆIàð "Øð*Ý+�G�Gå)�G�GØð "Ý"��å!�Ø—>’>¨°w�>Ñ?Ô?Ð ?à"˜ ˆIˆIð<Ð;°Ð;Ñ;Ô;ˆ å Ð,Ð, )Ð,Ñ,Ô,Ñ ,Ô ,€EÝ�E‘ ” €Iå˜)¨WÐ5Ñ5Ô5€Hà€GØ€Gàñ.+ݘ) UÑ+Ô+ð Fñ F‰FˆQ�Ø" Q™ˆIà—7’7‘9”9×&Ò&Ñ(Ô(ˆDÝ”? 1Ñ%Ô%×+Ò+Ñ-Ô-ˆDàð Ý(¨°Q´WÑ=Ô=�ݘd¥W­b¬gÐ$6Ñ7Ô7ð?ݘ4œ:‘”¨!Ò+Ð+Ø#Ÿyšy™{œ{¨1œ~˜Ø#˜˜å!œx¨°A´GÀ1ÐEÑEÔE˜Ý!œw t°4´:Ð>Ñ>Ô>˜øà�Ø�à �NŠN�9œ?¨4°$°¸)Ñ1CÑDÔDÑ EÔ EÐ EØ �NŠN�9œ?¨4°$°¸)Ñ1CÑDÔDÑ EÔ EÐ EÑ Eå•] 7°GÐ<Ñ<Ô<Ñ=Ô=ˆÝ”�"œ+ d°(À)ÐLÑLÔLÝ#¥M°'À7Ð$KÑ$KÔ$KÑLÔLðNñNôNˆà ð 0Ø—[’[¥Ñ/Ô/ˆFùõ˜) UÑ+Ô+ð Fð F‰FˆQ�Ø" Q™ˆIØ—7’7‘9”9×&Ò&Ñ(Ô(ˆDØð Ý(¨°Q´WÑ=Ô=�ݘd¥W­b¬gÐ$6Ñ7Ô7ðFݘ4œ:‘”¨!Ò+Ð+Ø#Ÿyšy™{œ{¨1œ~˜˜å!œx¨°A´GÀ1ÐEÑEÔE˜øà�Ø �NŠN�9œ?¨4°$°¸)Ñ1CÑDÔDÑ EÔ EÐ EÐ EÝ”�U¥=°À'Ð#JÑ#JÔ#JÑKÔKØ#+°9ð>ñ>ô>ˆà ð +Ø—[’[¥Ñ*Ô*ˆFà €Mr%có—|fSrr )ÚbaseÚ drop_namesrsrts r#Ú_drop_fields_dispatcherr¥ñó €Ø ˆ7€Nr%cót|¦«r|g}nt|¦«}ˆfd„Љ|j|¦«}tj|j|¬¦«}t ||¦«}t|||¬¦«S)a Return a new array with fields in `drop_names` dropped. Nested fields are supported. .. versionchanged:: 1.18.0 `drop_fields` returns an array with 0 fields if all fields are dropped, rather than returning ``None`` as it did previously. Parameters ---------- base : array Input array drop_names : string or sequence String or sequence of strings corresponding to the names of the fields to drop. usemask : {False, True}, optional Whether to return a masked array or not. asrecarray : string or sequence, optional Whether to return a recarray or a mrecarray (`asrecarray=True`) or a plain ndarray or masked array with flexible dtype. The default is False. Examples -------- >>> from numpy.lib import recfunctions as rfn >>> a = np.array([(1, (2, 3.0)), (4, (5, 6.0))], ... dtype=[('a', np.int64), ('b', [('ba', np.double), ('bb', np.int64)])]) >>> rfn.drop_fields(a, 'a') array([((2., 3),), ((5., 6),)], dtype=[('b', [('ba', '>> rfn.drop_fields(a, 'ba') array([(1, (3,)), (4, (6,))], dtype=[('a', '>> rfn.drop_fields(a, ['ba', 'bb']) array([(1,), (4,)], dtype=[('a', ')rFr¤r(r+r4r-rGÚ _drop_descrs €r#r©z drop_fields.._drop_descr s‹ø€Ø” ˆØˆØð 1ð 1ˆDؘT”lˆGØ�zÐ!Ð!ØØŒ}Ð(Ø#˜  G¨ZÑ8Ô8�Øð3Ø—O’O T¨5 MÑ2Ô2Ð2øà—’  w Ñ0Ô0Ð0Ð0؈r%rŠ©rsrt)rÚsetr'rLÚemptyÚshaperru)r£r¤rsrtr+r"r©s @r#r r õs’ø€õL�zÑ"Ô"ð%Ø �\ˆ ˆ 嘑_”_ˆ ð ð ð ð ð ðˆ{˜4œ: zÑ2Ô2€Hå ŒX�d”j¨Ð 1Ñ 1Ô 1€FÝ " 4¨Ñ 0Ô 0€FÝ �v w¸:Ð FÑ FÔ FÐFr%c󚇗ˆfd„|D¦«}tj‰j|¬¦«}t‰|¦«}t |||¬¦«S)aŒ Return a new array keeping only the fields in `keep_names`, and preserving the order of those fields. Parameters ---------- base : array Input array keep_names : string or sequence String or sequence of strings corresponding to the names of the fields to keep. Order of the names will be preserved. usemask : {False, True}, optional Whether to return a masked array or not. asrecarray : string or sequence, optional Whether to return a recarray or a mrecarray (`asrecarray=True`) or a plain ndarray or masked array with flexible dtype. The default is False. có.•—g|]}|‰j|f‘ŒSr rŠ)r3ržr£s €r#r:z _keep_fields..Is$ø€Ð7Ð7Ð7 q��D”J˜q”MÐ"Ð7Ð7Ð7r%rŠrª)rLr¬r­rru)r£Ú keep_namesrsrtr+r"s` r#Ú _keep_fieldsr±6sXø€ð&8Ð7Ð7Ð7¨JÐ7Ñ7Ô7€HÝ ŒX�d”j¨Ð 1Ñ 1Ô 1€FÝ " 4¨Ñ 0Ô 0€FÝ �v w¸:Ð FÑ FÔ FÐFr%có—|fSrr ©r£r¤s r#Ú_rec_drop_fields_dispatcherr´Or¦r%có(—t||dd¬¦«S)zK Returns a new numpy.recarray with fields in `drop_names` dropped. FTrª)r r³s r#rrSs€õ �t˜Z°À4Ð HÑ HÔ HÐHr%có—|fSrr )r£Ú namemappers r#Ú_rename_fields_dispatcherr¸[r¦r%cóZ‡—ˆfd„Љ|j|¦«}| |¦«S)aÁ Rename the fields from a flexible-datatype ndarray or recarray. Nested fields are supported. Parameters ---------- base : ndarray Input array whose fields must be modified. namemapper : dictionary Dictionary mapping old field names to their new version. Examples -------- >>> from numpy.lib import recfunctions as rfn >>> a = np.array([(1, (2, [3.0, 30.])), (4, (5, [6.0, 60.]))], ... dtype=[('a', int),('b', [('ba', float), ('bb', (float, 2))])]) >>> rfn.rename_fields(a, {'a':'A', 'bb':'BB'}) array([(1, (2., [ 3., 30.])), (4, (5., [ 6., 60.]))], dtype=[('A', ')rFr·r+r4Únewnamer-Ú_recursive_rename_fieldss €r#r¼z/rename_fields.._recursive_rename_fieldsws�ø€ØˆØ”Lð 4ð 4ˆDØ —n’n T¨4Ñ0Ô0ˆGؘT”lˆGØŒ}Ð(Ø—’ØÐ6Ð6°wÀ ÑKÔKÐLñôððð—’ ¨'Ð 2Ñ3Ô3Ð3Ð3؈r%)r'rp)r£r·r+r¼s @r#rr_sDø€ð0 ð ð ð ð ð(Ð'¨¬ °JÑ?Ô?€HØ �9Š9�XÑ Ô Ðr%c#ó"K—|V—|Ed{V—†dSrr )r£r(rwÚdtypesrkrsrts r#Ú_append_fields_dispatcherr¿‡s$èè€à €J€J€JØ€O€O€O€O€O€O€O€O€Or%có—t|ttf¦«r2t|¦«t|¦«krd}t |¦«‚nt|t ¦«r|g}|g}|€'d„|D¦«}d„t ||¦«D¦«}n‘t|ttf¦«s|g}t|¦«t|¦«kr7t|¦«dkr|t|¦«z}nd}t |¦«‚d„t |||¦«D¦«}t|||¬¦«}t|¦«dkrt|d ||¬ ¦«}n| ¦«}tj tt|¦«t|¦«¦«t|j ¦«t|j ¦«z¬ ¦«}t||¦«}t||¦«}t|||¬ ¦«S) a  Add new fields to an existing array. The names of the fields are given with the `names` arguments, the corresponding values with the `data` arguments. If a single field is appended, `names`, `data` and `dtypes` do not have to be lists but just values. Parameters ---------- base : array Input array to extend. names : string, sequence String or sequence of strings corresponding to the names of the new fields. data : array or sequence of arrays Array or sequence of arrays storing the fields to add to the base. dtypes : sequence of datatypes, optional Datatype or sequence of datatypes. If None, the datatypes are estimated from the `data`. fill_value : {float}, optional Filling value used to pad missing data on the shorter arrays. usemask : {False, True}, optional Whether to return a masked array or not. asrecarray : {False, True}, optional Whether to return a recarray (MaskedRecords) or not. z7The number of arrays does not match the number of namesNcó<—g|]}tj|dd¬¦«‘ŒS)FT)ÚcopyÚsubok)rLr“rˆs r#r:z!append_fields..¶s)€ÐBÐBÐB¸•”˜ ¨dÐ3Ñ3Ô3ÐBÐBÐBr%cóN—g|]"\}}| ||jfg¦«‘Œ#Sr )rpr')r3r4rOs r#r:z!append_fields..·s1€ÐLÐLÐL©i¨t°Q�—’˜˜qœw˜Ð(Ñ)Ô)ÐLÐLÐLr%rKz5The dtypes argument must be None, a dtype, or a list.cór—g|]4\}}}tj|dd|¬¦« ||fg¦«‘Œ5S)FT)rÂrÃr')rLr“rp)r3rOržÚds r#r:z!append_fields..ÁsU€ð;ð;ð;Ù�Q˜˜1õ”˜ ¨d¸!Ð<Ñ<Ô<×AÒAÀAÀqÀ6À(ÑKÔKð;ð;ð;r%)rsrkT)rNrsrkrŠrª)r\r?r—r*r)rerŽrÚpoprqÚ masked_allr�r<r'rru) r£r(rwr¾rkrsrtÚmsgr"s r#r r �s €õ@�%�%¥˜Ñ'Ô'ðÝ ˆu‰:Œ:�˜T™œÒ "Ð "ØKˆCݘS‘/”/Ð !ð #õ �E�3Ñ Ô ðØ� ˆØˆxˆà €~ØBÐB¸TÐBÑBÔBˆØLÐL½3¸uÀdÑ;KÔ;KÐLÑLÔLˆˆå˜&¥5­$ -Ñ0Ô0ð Ø�ZˆFÝ ˆt‰9Œ9�˜F™ œ Ò #Ð #Ý�6‰{Œ{˜aÒÐØ¥# d¡)¤)Ñ+��àM�Ý  ‘o”oÐ%ð;ð;Ý!$ T¨5°&Ñ!9Ô!9ð;ñ;ô;ˆõ ˜ g¸*Ð EÑ EÔ E€DÝ ˆ4�y„y�1‚}€}ݘD¨$¸Ø'1ð3ñ3ô3ˆˆð�xŠx‰zŒzˆå Œ]Ý �C�‰IŒI•s˜4‘y”yÑ!Ô!ݘTœZÑ(Ô(­>¸$¼*Ñ+EÔ+EÑEðGñGôG€Fõ# 4¨Ñ 0Ô 0€FÝ " 4¨Ñ 0Ô 0€Få �v w¸:Ð FÑ FÔ FÐFr%c#ó"K—|V—|Ed{V—†dSrr ©r£r(rwr¾s r#Ú_rec_append_fields_dispatcherrÌÔs$èè€Ø €J€J€JØ€O€O€O€O€O€O€O€O€Or%có,—t||||dd¬¦«S)aM Add new fields to an existing array. The names of the fields are given with the `names` arguments, the corresponding values with the `data` arguments. If a single field is appended, `names`, `data` and `dtypes` do not have to be lists but just values. Parameters ---------- base : array Input array to extend. names : string, sequence String or sequence of strings corresponding to the names of the new fields. data : array or sequence of arrays Array or sequence of arrays storing the fields to add to the base. dtypes : sequence of datatypes, optional Datatype or sequence of datatypes. If None, the datatypes are estimated from the `data`. See Also -------- append_fields Returns ------- appended_array : np.recarray TF)rwr¾rtrs)r rËs r#rrÙs(€õ> ˜˜u¨4¸Ø$(°%ð 9ñ 9ô 9ð9r%có—|fSrr )rOÚalignÚrecurses r#Ú_repack_fields_dispatcherrÑüs €Ø ˆ4€Kr%cóæ—t|tj¦«s.t|j||¬¦«}| |d¬¦«S|j€|Sg}|jD]f}|j|}|rt|d|d¬¦«}n|d}t|¦«dkr |d|f}| ||f¦«Œgtj||¬ ¦«}tj|j |f¦«S) a Re-pack the fields of a structured array or dtype in memory. The memory layout of structured datatypes allows fields at arbitrary byte offsets. This means the fields can be separated by padding bytes, their offsets can be non-monotonically increasing, and they can overlap. This method removes any overlaps and reorders the fields in memory so they have increasing byte offsets, and adds or removes padding bytes depending on the `align` option, which behaves like the `align` option to `numpy.dtype`. If `align=False`, this method produces a "packed" memory layout in which each field starts at the byte the previous field ended, and any padding bytes are removed. If `align=True`, this methods produces an "aligned" memory layout in which each field's offset is a multiple of its alignment, and the total itemsize is a multiple of the largest alignment, by adding padding bytes as needed. Parameters ---------- a : ndarray or dtype array or dtype for which to repack the fields. align : boolean If true, use an "aligned" memory layout, otherwise use a "packed" layout. recurse : boolean If True, also repack nested structures. Returns ------- repacked : ndarray or dtype Copy of `a` with fields repacked, or `a` itself if no repacking was needed. Examples -------- >>> from numpy.lib import recfunctions as rfn >>> def print_offsets(d): ... print("offsets:", [d.fields[name][1] for name in d.names]) ... print("itemsize:", d.itemsize) ... >>> dt = np.dtype('u1, >> dt dtype({'names': ['f0', 'f1', 'f2'], 'formats': ['u1', '>> print_offsets(dt) offsets: [0, 8, 16] itemsize: 24 >>> packed_dt = rfn.repack_fields(dt) >>> packed_dt dtype([('f0', 'u1'), ('f1', '>> print_offsets(packed_dt) offsets: [0, 1, 9] itemsize: 17 )rÏrÐF)rÂNrTér7©rÏ) r\rLr'rÚastyper(r1r*r>r‚)rOrÏrÐÚdtÚ fieldinfor4rmÚfmts r#rrsþ€õx �a�œÑ "Ô "ð(Ý ˜1œ7¨%¸Ð AÑ AÔ AˆØ�xŠx˜ ˆxÑ'Ô'Ð'à„w€Øˆà€IØ”ð &ð &ˆØŒh�tŒnˆØ ð Ý  A¤¨e¸TÐBÑBÔBˆCˆCà�a”&ˆCå ˆs‰8Œ8�qŠ=ˆ=ؘ”F˜D�>ˆDà×Ò˜$ ˜Ñ%Ô%Ð%Ð%å Œ�) 5Ð )Ñ )Ô )€BÝ Œ8�Q”V˜R�LÑ !Ô !Ð!r%có‡ ‡ —d„}g}|jD]Ï}|j|}|d|d}}||¦«\}}|j€1| tj||ff¦«|||zf¦«Œet |||z¦«} |jŠ t|¦«D]@Š ‰ dkr| | ¦«Œ| ˆ ˆ fd„| D¦«¦«ŒAŒÐ|S)z£ Returns a flat list of (dtype, count, offset) tuples of all the scalar fields in the dtype "dt", including nested fields, in left to right order. cóf—d}|jdkr!|jD]}||z}Œ|j}|jdk°!||fS)NrKr )r­r£)rÖr‹r‡s r#Ú count_elemz+_get_fields_and_offsets..count_elem\sN€ØˆØŒh˜"ŠnˆnØœð ð �ؘ‘ ��Ø”ˆBðŒh˜"Šnˆnð�5ˆyÐr%rrKNcó.•—g|]\}}}|||‰‰zzf‘ŒSr r )r3rÆÚcÚoÚir‡s €€r#r:z+_get_fields_and_offsets..us.ø€Ð"OÐ"OÐ"O¹'¸!¸QÀ A q¨!¨a°©f©*Ð#5Ð"OÐ"OÐ"Or%) r(r1r>rLr'Ú_get_fields_and_offsetsÚitemsizeÚrangerD) rÖÚoffsetrÛr1r4r,Úf_dtÚf_offsetržÚ subfieldsrßr‡s @@r#ràràSsøø€ðððð€FØ”ðQðQˆØ” ˜$”ˆØ˜qœ 5¨¤8ˆhˆØ�*˜TÑ"Ô"‰ˆˆaà Œ:Ð Ø �MŠM�2œ8 T¨A¨4 LÑ1Ô1°1°hÀÑ6GÐHÑ IÔ IÐ IÐ Iå/°°hÀÑ6GÑHÔHˆIØ”=ˆDå˜1‘X”Xð Qð Q�ؘ’6�6à—M’M )Ñ,Ô,Ð,Ð,à—M’MÐ"OÐ"OÐ"OÐ"OÐ"OÀYÐ"OÑ"OÔ"OÑPÔPÐPÐPð  Qð €Mr%cóh—t|¦«dkr|S|d|dk}|r+tt|¦«t|¦«¦«}nt||¦«}d}d}|D]A\}}|dkr|rdS|€|}||krdS||dz |zz} n|} |�||z } |€| }|| krdS| }ŒB|r| S|S)zì Returns the stride between the fields, or None if the stride is not constant. The values in "counts" designate the lengths of subarrays. Subarrays are treated as many contiguous fields, with always positive stride. rKrN)r*rŽÚreversed) ÚoffsetsÚcountsráÚnegativeÚitÚ prev_offsetÚstriderãr‹Ú end_offsetÚ new_strides r#Ú_common_striderñxs€õ ˆ7�|„|�qÒÐØˆà�qŒz˜G AœJÒ&€HØð"å •˜'Ñ"Ô"¥H¨VÑ$4Ô$4Ñ 5Ô 5ˆˆå �˜&Ñ !Ô !ˆà€KØ €FØð!ð!‰ ˆ�Ø �AŠ:ˆ:Øð Ø�t�t؈~Ø!�ؘÒ!Ð!Ø�t�tØ 5¨1¡9°Ñ"8Ñ8ˆJˆJàˆJà Ð "Ø +Ñ-ˆJ؈~Ø#�ؘÒ#Ð#Ø�t�tà ˆ ˆ àð؈wˆØ €Mr%có—|fSrr )Úarrr'rÂÚcastings r#Ú&_structured_to_unstructured_dispatcherrõ¥ó €à ˆ6€Mr%Úunsafec󨇗|jj€td¦«‚t|j¦«}t |¦«}|dkr|€td¦«‚|dkrt d¦«‚t |Ž\}}}d„t|¦«D¦«} |€tj d„|D¦«ŽŠntj|¦«Štj| |||jj dœ¦«} |  | ¦«}t|¦«tj tjtjfv} |�sF| �rCt!ˆfd „|D¦«¦«�r't#||‰j ¦«} | ��|j} |jt)|¦«‰j fz}|jt-| ¦«d fz}|d tjf  tj¦«}|d t3|¦«d…f}tjj |||d ¬ ¦«}|  ‰¦«d}| dkr |d ddd…f}t|¦«t| j¦«ur | |¦«}|Stj| ˆfd„|D¦«dœ¦«}| |||¬¦«}|  ‰t)|¦«ff¦«S)aW Converts an n-D structured array into an (n+1)-D unstructured array. The new array will have a new last dimension equal in size to the number of field-elements of the input array. If not supplied, the output datatype is determined from the numpy type promotion rules applied to all the field datatypes. Nested fields, as well as each element of any subarray fields, all count as a single field-elements. Parameters ---------- arr : ndarray Structured array or dtype to convert. Cannot contain object datatype. dtype : dtype, optional The dtype of the output unstructured array. copy : bool, optional If true, always return a copy. If false, a view is returned if possible, such as when the `dtype` and strides of the fields are suitable and the array subtype is one of `np.ndarray`, `np.recarray` or `np.memmap`. .. versionchanged:: 1.25.0 A view can now be returned if the fields are separated by a uniform stride. casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional See casting argument of `numpy.ndarray.astype`. Controls what kind of data casting may occur. Returns ------- unstructured : ndarray Unstructured array with one more dimension. Examples -------- >>> from numpy.lib import recfunctions as rfn >>> a = np.zeros(4, dtype=[('a', 'i4'), ('b', 'f4,u2'), ('c', 'f4', 2)]) >>> a array([(0, (0., 0), [0., 0.]), (0, (0., 0), [0., 0.]), (0, (0., 0), [0., 0.]), (0, (0., 0), [0., 0.])], dtype=[('a', '>> rfn.structured_to_unstructured(a) array([[0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.], [0., 0., 0., 0., 0.]]) >>> b = np.array([(1, 2, 5), (4, 5, 7), (7, 8 ,11), (10, 11, 12)], ... dtype=[('x', 'i4'), ('y', 'f4'), ('z', 'f8')]) >>> np.mean(rfn.structured_to_unstructured(b[['x', 'z']]), axis=-1) array([ 3. , 5.5, 9. , 11. ]) Núarr must be a structured arrayrz(arr has no fields. Unable to guess dtypez#arr with no fields is not supportedcó8—g|]}d |¦«‘ŒS©zf{}©Úformat©r3ržs r#r:z.structured_to_unstructured..ðs"€Ð 6Ð 6Ð 6 ˆU�\Š\˜!‰_Œ_Ð 6Ð 6Ð 6r%có—g|] }|j‘Œ Sr ©r£)r3rÖs r#r:z.structured_to_unstructured..ós€Ð$;Ð$;Ð$;° R¤WÐ$;Ð$;Ð$;r%©r(Úformatsrérác3ó.•K—|]}|j‰kV—ŒdSrr©r3rÖÚ out_dtypes €r#r5z-structured_to_unstructured..s*øèè€Ð&JÐ&JÀ r¤w°)Ò';Ð&JÐ&JÐ&JÐ&JÐ&JÐ&Jr%rK.T)ré.rr€có"•—g|] }‰|jf‘Œ Sr )r­rs €r#r:z.structured_to_unstructured..$s ø€Ð)NÐ)NÐ)NÀB¨9°b´hÐ*?Ð)NÐ)NÐ)Nr%©r(r©rÂrô)r'r(r)ràr*ÚNotImplementedErrorrŽrârLÚ result_typerárpr‚rrÚmemmapÚallrñÚ__array_wrap__r­ÚsumÚstridesÚabsÚnewaxisÚuint8ÚminÚlibÚ stride_tricksÚ as_stridedÚ__self__rÕ)rór'rÂrôr1Ún_fieldsÚdtsrêrér(Úflattened_fieldsÚcan_viewÚ common_strideÚwrapÚ new_shapeÚ new_stridesÚ packed_fieldsrs @r#rr©sîø€ðv „y„ÐÝÐ9Ñ:Ô:Ð:å $ S¤YÑ /Ô /€FÝ�6‰{Œ{€HØ�1‚}€}˜˜ÝÐCÑDÔDÐDØ �QŠˆå!Ð"GÑHÔHÐHå ˜<Ñ€Cˆ�Ø 6Ð 6¥e¨H¡o¤oÐ 6Ñ 6Ô 6€Eà €}Ý”NÐ$;Ð$;°sÐ$;Ñ$;Ô$;Ð<ˆ ˆ å”H˜U‘O”Oˆ õ ”x¨%Ø,/Ø,3Ø-0¬YÔ-?ð!Að!AñBôBÐð �(Š(Ð#Ñ $Ô $€Cõ �C‰yŒy�RœZ­¬µb´iÐ@Ð@€HØ ñ�hñ¥3Ð&JÐ&JÐ&JÐ&JÀcÐ&JÑ&JÔ&JÑ#JÔ#Jñõ' w°¸ Ô8JÑKÔKˆ Ø Ñ $ØÔ%ˆDàœ ¥S¨¡[¤[°)Ô2DÐ$EÑEˆIØœ+­¨]Ñ);Ô);¸QÐ(?Ñ?ˆKà�c�2œ:�oÔ&×+Ò+­B¬HÑ5Ô5ˆCØ�c�3˜w™<œ<˜=˜=Ð(Ô)ˆCÝ”&Ô&×1Ò1°#Ø2;Ø2=Ø8<ð2ñ>ô>ˆCð —(’(˜9Ñ%Ô% fÔ-ˆCà˜qÒ Ð Ø˜#˜t˜t ˜t˜)”n�Ý�C‰yŒy¥ T¤]Ñ 3Ô 3Ð3Ð3ð�d˜3‘i”i�؈Jõ”H uØ)NÐ)NÐ)NÐ)NÈ#Ð)NÑ)NÔ)NðPðPñQôQ€Mà �*Š*�]¨°wˆ*Ñ ?Ô ?€Cð �8Š8�Y¥ V¡¤ Ð/Ñ 0Ô 0Ð0r%có—|fSrr )rór'r(rÏrÂrôs r#Ú&_unstructured_to_structured_dispatcherr#+rör%có䇗‰jdkrtd¦«‚‰jd}|dkrtd¦«‚|€Z|€d„t|¦«D¦«}t jˆfd„|D¦«|¬ ¦«}t |¦«}t|Ž\} } } n—|�td ¦«‚t j|¦«}t |¦«}t|¦«dkrggg} } } n t|Ž\} } } |t| ¦«krtd ¦«‚|}|r|j std ¦«‚d „tt|¦«¦«D¦«}t j|ˆfd„| D¦«dœ¦«} t j ‰¦«  | ¦«Št j|| | |j dœ¦«} ‰ | ||¬¦«Љ  |¦«dS)a Converts an n-D unstructured array into an (n-1)-D structured array. The last dimension of the input array is converted into a structure, with number of field-elements equal to the size of the last dimension of the input array. By default all output fields have the input array's dtype, but an output structured dtype with an equal number of fields-elements can be supplied instead. Nested fields, as well as each element of any subarray fields, all count towards the number of field-elements. Parameters ---------- arr : ndarray Unstructured array or dtype to convert. dtype : dtype, optional The structured dtype of the output array names : list of strings, optional If dtype is not supplied, this specifies the field names for the output dtype, in order. The field dtypes will be the same as the input array. align : boolean, optional Whether to create an aligned memory layout. copy : bool, optional See copy argument to `numpy.ndarray.astype`. If true, always return a copy. If false, and `dtype` requirements are satisfied, a view is returned. casting : {'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional See casting argument of `numpy.ndarray.astype`. Controls what kind of data casting may occur. Returns ------- structured : ndarray Structured array with fewer dimensions. Examples -------- >>> from numpy.lib import recfunctions as rfn >>> dt = np.dtype([('a', 'i4'), ('b', 'f4,u2'), ('c', 'f4', 2)]) >>> a = np.arange(20).reshape((4,5)) >>> a array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]]) >>> rfn.unstructured_to_structured(a, dt) array([( 0, ( 1., 2), [ 3., 4.]), ( 5, ( 6., 7), [ 8., 9.]), (10, (11., 12), [13., 14.]), (15, (16., 17), [18., 19.])], dtype=[('a', '.ps"€Ð<Ð<Ð<¨�U—\’\ !‘_”_Ð<Ð<Ð.qsø€Ð<Ð<Ð<°˜q #¤)˜nÐ<Ð<Ð.‡s"€Ð 9Ð 9Ð 9 ˆU�\Š\˜!‰_Œ_Ð 9Ð 9Ð 9r%có,•—g|]}‰j|jf‘ŒSr )r'r­)r3rÖrós €r#r:z.unstructured_to_structured..�s"ø€Ð)NÐ)NÐ)NÀB¨3¬9°b´hÐ*?Ð)NÐ)NÐ)Nr%rrr r)r­r)r rârLr'ràrŽr*rÚisalignedstructÚascontiguousarrayrprárÕ)rór'r(rÏrÂrôÚn_elemrr1rrêrér!rs` r#rr/s=ø€ðp „y�B‚€ÝÐ?Ñ@Ô@Ð@Ø ŒY�rŒ]€FØ �‚{€{å!Ð"JÑKÔKÐKà €}Ø ˆ=Ø<Ð<­e°F©m¬mÐ<Ñ<Ô<ˆEÝ”HÐ<Ð<Ð<Ð<°eÐ<Ñ<Ô<ÀEÐJÑJÔJˆ Ý(¨Ñ3Ô3ˆÝ" F˜|шˆV�W�Wà Ð ÝÐ@ÑAÔAÐ A唘‘”ˆå(¨Ñ/Ô/ˆÝ ˆv‰;Œ;˜!Ò Ð Ø#% r¨2˜�ˆCˆCå#&¨ <Ñ ˆC�˜à •S˜‘[”[Ò Ð ÝðIñJôJð Jàˆ Ø ð H˜Ô2ð HÝÐFÑGÔGÐ Gà 9Ð 9¥e­C°©K¬KÑ&8Ô&8Ð 9Ñ 9Ô 9€Eõ ”H uØ)NÐ)NÐ)NÐ)NÈ#Ð)NÑ)NÔ)NðPðPñQôQ€Må Ô ˜sÑ #Ô #× (Ò (¨Ñ 7Ô 7€Cõ”x¨%Ø,/Ø,3Ø-6Ô-?ð!Að!AñBôBÐð �*Š*Ð%¨D¸'ˆ*Ñ BÔ B€Cð �8Š8�IÑ Ô ˜vÔ &Ð&r%có—|fSrr )Úfuncrós r#Ú_apply_along_fields_dispatcherr.šs €Ø ˆ6€Mr%cóp—|jj€td¦«‚t|¦«}||d¬¦«S)a@ Apply function 'func' as a reduction across fields of a structured array. This is similar to `apply_along_axis`, but treats the fields of a structured array as an extra axis. The fields are all first cast to a common type following the type-promotion rules from `numpy.result_type` applied to the field's dtypes. Parameters ---------- func : function Function to apply on the "field" dimension. This function must support an `axis` argument, like np.mean, np.sum, etc. arr : ndarray Structured array for which to apply func. Returns ------- out : ndarray Result of the recution operation Examples -------- >>> from numpy.lib import recfunctions as rfn >>> b = np.array([(1, 2, 5), (4, 5, 7), (7, 8 ,11), (10, 11, 12)], ... dtype=[('x', 'i4'), ('y', 'f4'), ('z', 'f8')]) >>> rfn.apply_along_fields(np.mean, b) array([ 2.66666667, 5.33333333, 8.66666667, 11. ]) >>> rfn.apply_along_fields(np.mean, b[['x', 'z']]) array([ 3. , 5.5, 9. , 11. ]) Nrùr€)Úaxis)r'r(r)r)r-róÚuarrs r#r r �s@€ðF „y„ÐÝÐ9Ñ:Ô:Ð:å % cÑ *Ô *€DØ ˆ4�˜2Ð Ñ Ô Ðr%có —||fSrr )ÚdstÚsrcÚzero_unassigneds r#Ú!_assign_fields_by_name_dispatcherr6Ès €Ø �ˆ8€Or%có°—|jj€||d<dS|jjD]5}||jjvr|rd||<Œt|||||¦«Œ6dS)aÆ Assigns values from one structured array to another by field name. Normally in numpy >= 1.14, assignment of one structured array to another copies fields "by position", meaning that the first field from the src is copied to the first field of the dst, and so on, regardless of field name. This function instead copies "by field name", such that fields in the dst are assigned from the identically named field in the src. This applies recursively for nested structures. This is how structure assignment worked in numpy >= 1.6 to <= 1.13. Parameters ---------- dst : ndarray src : ndarray The source and destination arrays during assignment. zero_unassigned : bool, optional If True, fields in the dst for which there was no matching field in the src are filled with the value 0 (zero). This was the behavior of numpy <= 1.13. If False, those fields are not modified. N.r)r'r(r )r3r4r5r4s r#r r Ës€€ð4 „y„ÐØˆˆC‰Øˆà” ”ð3ð3ˆØ �s”y”Ð &Ð &Øð Ø��D‘ øå ! # d¤)¨S°¬YØ"1ñ 3ô 3ð 3ð 3ð 3ð3r%có—|fSrr )r“Úrequired_dtypes r#Ú_require_fields_dispatcherr:ñs €Ø ˆ8€Or%có\—tj|j|¬¦«}t||¦«|S)aç Casts a structured array to a new dtype using assignment by field-name. This function assigns from the old to the new array by name, so the value of a field in the output array is the value of the field with the same name in the source array. This has the effect of creating a new ndarray containing only the fields "required" by the required_dtype. If a field name in the required_dtype does not exist in the input array, that field is created and set to 0 in the output array. Parameters ---------- a : ndarray array to cast required_dtype : dtype datatype for output array Returns ------- out : ndarray array with the new dtype, with field values copied from the fields in the input array with the same name Examples -------- >>> from numpy.lib import recfunctions as rfn >>> a = np.ones(4, dtype=[('a', 'i4'), ('b', 'f8'), ('c', 'u1')]) >>> rfn.require_fields(a, [('b', 'f4'), ('c', 'u1')]) array([(1., 1), (1., 1), (1., 1), (1., 1)], dtype=[('b', '>> rfn.require_fields(a, [('b', 'f4'), ('newf', 'u1')]) array([(1., 0), (1., 0), (1., 0), (1., 0)], dtype=[('b', '>> from numpy.lib import recfunctions as rfn >>> x = np.array([1, 2,]) >>> rfn.stack_arrays(x) is x True >>> z = np.array([('A', 1), ('B', 2)], dtype=[('A', '|S3'), ('B', float)]) >>> zz = np.array([('a', 10., 100.), ('b', 20., 200.), ('c', 30., 300.)], ... dtype=[('A', '|S3'), ('B', np.double), ('C', np.double)]) >>> test = rfn.stack_arrays((z,zz)) >>> test masked_array(data=[(b'A', 1.0, --), (b'B', 2.0, --), (b'a', 10.0, 100.0), (b'b', 20.0, 200.0), (b'c', 30.0, 300.0)], mask=[(False, False, True), (False, False, True), (False, False, False), (False, False, False), (False, False, False)], fill_value=(b'N/A', 1.e+20, 1.e+20), dtype=[('A', 'S3'), ('B', '.Rs.€Ð:Ð:Ð:¨a•”˜qÑ!Ô!×'Ò'Ñ)Ô)Ð:Ð:Ð:r%có,—g|]}t|¦«‘ŒSr r8rˆs r#r:z stack_arrays..Ss€Ð*Ð*Ð*˜1•�A‘”Ð*Ð*Ð*r%có—g|] }|j‘Œ Sr rŠrˆs r#r:z stack_arrays..Ts€Ð )Ð )Ð )˜!ˆaŒgÐ )Ð )Ð )r%có—g|] }|j‘Œ Sr r;)r3rÆs r#r:z stack_arrays..Us€Ð(Ð(Ð(˜A�”Ð(Ð(Ð(r%có—g|]\}}|‘ŒSr r )r3ržrÆs r#r:z stack_arrays..Ys€Ð $Ð $Ð $‘4�1�aˆQÐ $Ð $Ð $r%NzIncompatible type 'z' <> 'ú'r€zf%irª)r\rr*r<r>Úindexr�Ú TypeErrorrqÚ concatenaterÈrLrÚcumsumÚr_rŽr'r(rur})r>rzrsrtr?rMÚnrecordsrFÚfldnamesÚdtype_lÚnewdescrr(Údtype_nÚfnameÚfdtypeÚnameidxrIÚcdtyper"rãÚseenrOržrßÚjr4s r#rr%sË€õR�&�'Ñ"Ô"ðØˆ Ý ˆV‰Œ˜Ò Ð Ø�aŒyÐØ:Ð:°6Ð:Ñ:Ô:€IØ*Ð*  Ð*Ñ*Ô*€HØ )Ð )˜yÐ )Ñ )Ô )€FØ(Ð( Ð(Ñ(Ô(€Hà�QŒi€GݘgÑ&Ô&€HØ $Ð $˜8Ð $Ñ $Ô $€Eؘ!˜"˜"”:ð 6ð 6ˆÝ+¨GÑ4Ô4ð 6ð 6‰MˆE�6ؘEÐ!Ð!Ø—’ ¨ Ñ0Ô0Ð0Ø— ’ ˜UÑ#Ô#Ð#Ð#àŸ+š+ eÑ,Ô,�Ø$ WÔ-‘ ��6Øð6Ø).µ°F¸FÑ0CÔ0CÐ(D�H˜WÑ%Ð%ؘvÒ%Ð%Ý#˜)Ø%+ V V¨V¨V¨Vð%5ñ6ô6ð6ð&ð 6õ ˆ8�}„}˜ÒÐÝ”  Ñ*Ô*ˆˆõ”¥¤ xÑ 0Ô 0Ð2°HÑ=Ô=ˆÝ”�2œ5  H Ô-Ñ.Ô.ˆØˆÝ  ¨8°V¸C¸R¸C´[À&ÈÈÈÄ*ÑMÔMð *ð *‰LˆQ��1�aØ”G”MˆE؈}Ø12��u�s 4™yœyÑ(Ô)¨!¨A¨#Ñ.Ð.àð*ð*�DØ()¨$¬�F˜4”L  1 Ñ%Ø 4Ð'Ð'ØŸ š  DÑ)Ô)Ð)øð*õ •} V¨XÑ6Ô6Ø&°:ð ?ñ ?ô ?ð?r%có—|fSrr )rOÚkeyÚ ignoremaskÚ return_indexs r#Ú_find_duplicates_dispatcherr\}s €à ˆ4€Kr%có—tj|¦« ¦«}t|j¦«}|}|r||D] }||}Œ ||}| ¦«}||}| ¦«} | dd…| dd…k} |r|j} d| | dd…<tjdg| f¦«} | dd…| dd…z| dd…<||| } |r | || fS| S)aç Find the duplicates in a structured array along a given key Parameters ---------- a : array-like Input array key : {string, None}, optional Name of the fields along which to check the duplicates. If None, the search is performed by records ignoremask : {True, False}, optional Whether masked data should be discarded or considered as duplicates. return_index : {False, True}, optional Whether to return the indices of the duplicated values. Examples -------- >>> from numpy.lib import recfunctions as rfn >>> ndtype = [('a', int)] >>> a = np.ma.array([1, 1, 1, 2, 2, 3, 3], ... mask=[0, 0, 1, 0, 0, 0, 1]).view(ndtype) >>> rfn.find_duplicates(a, ignoremask=True, return_index=True) (masked_array(data=[(1,), (1,), (2,), (2,)], mask=[(False,), (False,), (False,), (False,)], fill_value=(999999,), dtype=[('a', '˜E˜7 D˜/Ñ *Ô *€Dà�S�b�S” ˜D   œHÑ$€Dˆˆ"ˆ�IØ�7”˜DÔ!€JØðؘG DœMÐ*Ð*àÐr%c ó —||fSrr ) rYÚr1Úr2ÚjointypeÚ r1postfixÚ r2postfixrzrsrts r#Ú_join_by_dispatcherrl¼ó €ð �ˆ8€Or%ÚinnerÚ1Ú2c ó¦ ‡—|dvrtd|z¦«‚t‰t¦«r‰fŠtt ‰¦«¦«t‰¦«kr:t ˆfd„t ‰¦«D¦«¦«} td| z¦«‚‰D]B} | |jjvrtd| z¦«‚| |jjvrtd| z¦«‚ŒC|  ¦«}|  ¦«}t|¦«} |jj|jj} } t | ¦«t | ¦«zt ‰¦«z }|r|s|sd}|dz }t|¦«‚ˆfd „| D¦«}t||¦«}t||¦«}tj ||f¦«}|  ‰¬ ¦«}||}tj d g|d d …|d d…kf¦«}|d d …|d d…z|d d…<||}||| k}||| k| z }t|¦«t|¦«}}|dkrd\}}nº|dkrq||}tj |||| kf¦«}tj |||| k| z f¦«}t|¦«|z t|¦«|z }}nC|dkr=||}tj |||| kf¦«}t|¦«|z d}}||||}}t|j¦«} t|j¦«D] \}!}"|!‰vr|  |!|"f¦«Œ!t|j¦«D]–\}!}"t#d„| D¦«¦«}# |# |!¦«}$| |$\}%}&|!‰vr|!t'|"|&¦«f| |$<ŒY|!|z|&f|!|z|"fg| |$|$d z…<Œp#t$r|  |!|"f¦«YŒ“wxYwtj| ¦«} t'||¦«}'tj|'|z|zf| ¬¦«}(|(jj}#| D]J})||)}*|)|#vs |)| vr |s |)‰vr|)|z })|(|)}+|*d |…|+d |…<|dvr|*|d …|+|'|'|z…<ŒK| D]L})||)}*|)|#vs |)| vr |s |)‰vr|)|z })|(|)}+|*d |…|+d |…<|dkr|r|*|d …|+| d …<ŒM|( ‰¬ ¦«t-||¬¦«},t/t1|(|¦«fi|,¤ŽS)a< Join arrays `r1` and `r2` on key `key`. The key should be either a string or a sequence of string corresponding to the fields used to join the array. An exception is raised if the `key` field cannot be found in the two input arrays. Neither `r1` nor `r2` should have any duplicates along `key`: the presence of duplicates will make the output quite unreliable. Note that duplicates are not looked for by the algorithm. Parameters ---------- key : {string, sequence} A string or a sequence of strings corresponding to the fields used for comparison. r1, r2 : arrays Structured arrays. jointype : {'inner', 'outer', 'leftouter'}, optional If 'inner', returns the elements common to both r1 and r2. If 'outer', returns the common elements as well as the elements of r1 not in r2 and the elements of not in r2. If 'leftouter', returns the common elements and the elements of r1 not in r2. r1postfix : string, optional String appended to the names of the fields of r1 that are present in r2 but absent of the key. r2postfix : string, optional String appended to the names of the fields of r2 that are present in r1 but absent of the key. defaults : {dictionary}, optional Dictionary mapping field names to the corresponding default values. usemask : {True, False}, optional Whether to return a MaskedArray (or MaskedRecords is `asrecarray==True`) or a ndarray. asrecarray : {False, True}, optional Whether to return a recarray (or MaskedRecords if `usemask==True`) or just a flexible-type ndarray. Notes ----- * The output is sorted along the key. * A temporary array is formed by dropping the fields not in the key for the two arrays and concatenating the result. This array is then sorted, and the common entries selected. The output is constructed by filling the fields with the selected entries. Matching is not preserved if there are some duplicates... )rnÚouterÚ leftouterzWThe 'jointype' argument should be in 'inner', 'outer' or 'leftouter' (got '%s' instead)c3ó@•K—|]\}}|‰|dzd…v¯|V—ŒdS)rKNr )r3ržÚxrYs €r#r5zjoin_by..s7øèè€ÐAÐA™˜˜1°!°s¸1¸Q¹3¸4¸4´y°.°.�1°.°.°.°.ÐAÐAr%zduplicate join key %rzr1 does not have key field %rzr2 does not have key field %rz8r1 and r2 contain common names, r1postfix and r2postfix zcan't both be emptycó•—g|]}|‰v¯|‘Œ Sr r )r3ržrYs €r#r:zjoin_by..sø€Ð -Ð -Ð -�1 1¨ 8 8ˆQ 8 8 8r%)ÚorderFrKNr€rn)rrrrrsrc3ó K—|] \}}|V—Œ dSrr r2s r#r5zjoin_by..Es&èè€Ð4Ð4™k˜d E�TÐ4Ð4Ð4Ð4Ð4Ð4r%rŠ)rrrsrª)r)r\rer*r«ÚnextÚ enumerater'r(rŒr±rqrJr^rLr<r>r—rHr�rÈÚsortÚdictrur})-rYrgrhrirjrkrzrsrtÚdupr4Únb1Úr1namesÚr2namesÚ collisionsrÉÚkey1Úr1kÚr2kÚauxÚidx_sortÚflag_inÚidx_inÚidx_1Úidx_2Úr1cmnÚr2cmnÚr1spcÚr2spcÚidx_outÚs1Ús2rFrRrSr(rTrIrUÚcmnr"r9Úselectedr-Úkwargss-` r#rrÂsTø€ðhÐ6Ð6Ð6Ýð<Ø>FñGñôð õ �#•sÑÔð؈fˆõ �3ˆs‰8Œ8�}„}�˜C™œÒ Ð ÝÐAÐAÐAÐA¥ ¨#¡¤ÐAÑAÔAÑAÔAˆÝÐ0°3Ñ6Ñ7Ô7Ð7ØðEðEˆØ �r”x”~Ð %Ð %ÝÐ<¸tÑCÑDÔDÐ DØ �r”x”~Ð %Ð %ÝÐ<¸tÑCÑDÔDÐ Dð &ð �ЉŒ€BØ �ЉŒ€Bõ ˆb‰'Œ'€CØœ(œ.¨"¬(¬.ˆg€Wõ�g‘,”,¥ W¡¤Ñ-µ°S±´Ñ9€JØð˜9ð¨ ðØHˆØ Ð$Ñ$ˆÝ˜‰oŒoÐð .Ð -Ð -Ð -˜Ð -Ñ -Ô -€DÝ �r˜4Ñ Ô €CÝ �r˜4Ñ Ô €Cõ Œ.˜#˜s˜Ñ $Ô $€CØ�{Š{ ˆ{Ñ%Ô%€HØ ˆhŒ-€CõŒn˜u˜g s¨1¨2¨2¤w°#°c°r°c´(Ò':Ð;Ñ<Ô<€Gؘ1˜2˜2”; ¨¨"¨¤Ñ-€GˆCˆRˆC�LØ �gÔ €FØ �F˜S’LÔ "€EØ �F˜c’MÔ # cÑ )€Eݘ%‘j”j¥# e¡*¤*ˆE€UØ�7ÒÐØ‰ˆ��Ø �WÒ Ð Ø˜G˜8Ô$ˆÝ”  w°¸#² Ô'?Ð@ÑAÔAˆÝ”  w°¸3²Ô'@À3Ñ'FÐGÑHÔHˆÝ˜e™*œ* uÑ,­c°%©j¬j¸5Ñ.@�ˆˆØ �[Ò Ð Ø˜G˜8Ô$ˆÝ”  w°¸#² Ô'?Ð@ÑAÔAˆÝ˜e™*œ* uÑ,¨a�ˆà�5” ˜2˜eœ9ˆ€Rõ˜CœIÑ &Ô &€Fõ(¨¬Ñ1Ô1ð+ð+‰ ˆˆvØ ˜Ð Ð Ø �MŠM˜5 &˜/Ñ *Ô *Ð *øõ(¨¬Ñ1Ô1ðð‰ ˆˆvõÐ4Ð4¨VÐ4Ñ4Ô4Ñ4Ô4ˆð Ø—k’k %Ñ(Ô(ˆGð ˜wœ‰IˆAˆvؘˆ|ˆ|à#(­#¨f°fÑ*=Ô*=Ð">��w‘�ð ˜YÑ&¨Ð/ؘYÑ&¨Ð/ð/��w˜w¨™{Ð*Ñ+Ð+øõð +ð +ð +à �MŠM˜5 &˜/Ñ *Ô *Ð *Ð *Ð *ð +øøøõ"ŒX�fÑ Ô €Fõ ˆe�UÑ Ô €Cå Œ]˜C %™K¨%Ñ/Ð1¸Ð @Ñ @Ô @€FØ ŒLÔ €EØ ð8ð8ˆØ�a”5ˆØ �Eˆ>ˆ>˜a 7˜l˜l°9˜lÀÈ#ÀÀØ �‰NˆAؘ”)ˆØ" 6 E 6Ô*ˆ���‰Ø Ð-Ð -Ð -Ø'/°°°Ô'7ˆG�C˜˜e™ �OÑ $øØ ð0ð0ˆØ�a”5ˆØ �Eˆ>ˆ>˜a 7˜l˜l°9˜lÀÈ#ÀÀØ �‰NˆAؘ”)ˆØ" 6 E 6Ô*ˆ���‰Ø ˜Ò Ð  UÐ Ø'¨¨¨Ô/ˆG�U�F�G�GÑ øà ‡K‚K�c€KÑÔÐÝ ˜'¨jÐ 9Ñ 9Ô 9€FÝ •} V¨XÑ6Ô6Ð AÐ A¸&Ð AÐ AÐAsÎ0PÐ!P%Ð$P%có —||fSrr )rYrgrhrirjrkrzs r#Ú_rec_join_dispatcherr–vrmr%cóJ—t||||dd¬¦«}t|||fi|¤ŽS)z¨ Join arrays `r1` and `r2` on keys. Alternative to join_by, that always returns a np.recarray. See Also -------- join_by : equivalent function FT)rirjrkrzrsrt)r|r)rYrgrhrirjrkrzr”s r#rr|sB€õ˜8¨yÀIØ#¨U¸tðEñEôE€Få �3˜˜BÐ )Ð ) &Ð )Ð )Ð)r%)F)NN)NT)TFr)NNNN)r€FFF)Nr€TF)FF)r)NNN)NFr÷)NNNNN)NNFFr÷)T)NTFF)NTF)NNNNNN)rnrorpNTF)rnrorpN)CÚ__doc__riÚnumpyrLÚnumpy.marqrrrÚnumpy.ma.mrecordsrÚnumpy.core.overridesrÚnumpy.lib._iotoolsrÚcorer‘Ú__all__r$rr<rrrrPrSrr^rfrnrur}rrr¥r r±r´rr¸rr¿r rÌrrÑrràrñrõrr#rr.r r6r r:rr@rr\r rlrr–rr r%r#úr sšððððÐÐÐØÐÐÐØÐÐÐÐÐØ#Ð#Ð#Ð#Ð#Ð#Ð#Ð#Ø Ð Ð Ð Ð Ð Ø+Ð+Ð+Ð+Ð+Ð+Ø8Ð8Ð8Ð8Ð8Ð8Ø.Ð.Ð.Ð.Ð.Ð.à”E”JÔ0Ðð ð ð €ððððÐÐ:Ñ;Ô;ð#ð#ñ<Ô;ð#ðL ð ð ð>ððð@ððð@ððð4 ð ð ð ð 8ð 8ð 8ð 8ð,ð,ð,ð,ð^ ð ð ð ð ð ð "ð"ð"ð"ð0ðððð" ð ð ð ðBFØ6:ððððð ÐÐ1Ñ2Ô2Ø38Ø+0ðDðDðDñ3Ô2ðDðNððððÐÐ0Ñ1Ô1ð=Gð=Gð=Gñ2Ô1ð=Gð@GðGðGðGð2ðððÐÐ4Ñ5Ô5ðIðIñ6Ô5ðIððððÐÐ2Ñ3Ô3ð$ð$ñ4Ô3ð$ðN9=ØHLððððð ÐÐ2Ñ3Ô3Ø,0Ø:?ðCGðCGðCGñ4Ô3ðCGðLðððð ÐÐ6Ñ7Ô7ð9ð9ð9ñ8Ô7ð9ðDððððÐÐ2Ñ3Ô3ðP"ðP"ðP"ñ4Ô3ðP"ðd#ð#ð#ð#ðJ*ð*ð*ðZBFØ37ðððððÐÐ?Ñ@Ô@ð~1ð~1ð~1ñAÔ@ð~1ðBCGØJNðððððÐÐ?Ñ@Ô@ØBGØ3;ðh'ðh'ðh'ñAÔ@ðh'ðTðððÐÐ7Ñ8Ô8ð&ð&ñ9Ô8ð&ðTððððÐÐ:Ñ;Ô;ð#3ð#3ð#3ñ<Ô;ð#3ðJðððÐÐ3Ñ4Ô4ð(ð(ñ5Ô4ð(ðV=AØ:>ððððð ÐÐ1Ñ2Ô2ØAFØ"ðT?ðT?ðT?ñ3Ô2ðT?ðp48ððððð ÐÐ4Ñ5Ô5ð6ð6ð6ñ6Ô5ð6ðt?CØ04ððððð ÐÐ,Ñ-Ô-ØDGØ49ðpBðpBðpBñ.Ô-ðpBðh?CØððððð ÐÐ-Ñ.Ô.ØEHØð *ð *ð *ñ/Ô.ð *ð *ð *r%