1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
U
P±d×Iã²@sÖdZddlZddlZddlZddlZddlZddlZddlmZddl    Z
ddl m m Z ddlm mZddlmZddl    mZmZmZmZmZmZddl    mZddlmZddlmZm Z m!Z!m"Z"m#Z#dd    l    m$Z$dd
l%m&Z&d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd€dd‚dƒd„d…d†d‡dˆd‰dŠd‹dŒddŽddd‘d’d“d”d•d–d—d˜d™dšd›dœddždŸd d¡d¢d£d¤d¥d¦d§d¨d©dªd«d¬d­d®d¯d°d±d²d³d´dµd¶d·d¸d¹dºd»d¼g²Z'e
jZ(e(dƒZ)Gd½d¾„d¾e*ƒZ+d¿dÀ„Z,dÁd„Z-dÃdĄZ.GdÅd „d e/ƒZ0GdÆd „d e0ƒZ1dÇdÈdÉdÊdËdÌdÊdÍdÎdϜ    Z2dÐD]6Z3e
 4dÑe3¡e2dÒe3dÓ<e
 5dÑe3¡e2dÔe3dÓ<q¾e
j6e
j7e
j8e
j9e
j:e
j;e
j<gZ=ej>Z?e? @dÕdքe=ddׅDƒ¡e? @dØdքe=dÙd…Dƒ¡ejAZBeB @dÚdքe=ddׅDƒ¡eB @dÛdքe=dÙd…Dƒ¡[=dÜd݄ZCdÞd߄ZDdàd@„ZEdádâ„ZFdãdŠ„ZGdäd†„ZHdådæ„ZIdçdè„ZJdéd¥„ZKdêdë„ZLdìd3„ZMd’dídK„ZNdîdï„ZOd“dðdU„ZPePZQe)dÇdfdñdL„ZRdòdó„ZSiZTiZUGdôdõ„dõƒZVGdöd÷„d÷ƒZWGdødù„dùƒZXGdúdû„dûƒZYGdüdý„dýƒZZGdþdÿ„dÿƒZ[Gdd„de[ƒZ\Gdd„de[ƒZ]Gdd„de[ƒZ^e\e j_ƒZ_e\e j`ƒZ`e\e jaƒZae\e jbƒZbe\e jcƒZce\e jdƒZde\e jeƒZee\e jfƒZfe\e jgƒZge\e jhƒZiZhe\eƒZe\e jjƒZje\e jkƒZke\e jlƒZle\e jmƒZme\e
jnƒZoe\e jpƒZpe\e jqdeZdƒƒZqe\e jrdeYdƒƒZre\e jsdeYdƒƒZse\e jtdeYdƒƒZte\e judeWdƒƒZue\e jvdeVd    dƒƒZve\e jwdeVd    dƒƒZwe\e jxdeZdƒƒZxe\e jydeVd
d ƒƒZye]e jzƒZze]e j{ƒZ{e]e j|d d ƒZ|e]e j}ddƒZ}e]e j~ƒZ~de~_e]e jƒZde_e]e j€ƒZ€de€_e]e jƒZde_e]e j‚ƒZ‚de‚_e]e jƒƒZƒdeƒ_e]e j„ƒZ„e]e j„d d ƒjZ…e]e j†ƒZ†e†jZ‡e]e jˆƒZˆe]e j‰ƒZ‰e]e jŠƒZŠe]e j‹ƒZ‹e]e jŒƒZŒe^e jeXƒdd ƒZe^e jŽeXƒdd ƒZŽe^e jeXƒdd ƒZe^e jeXƒdd ƒZe^e j‘eXƒdd ƒZ‘e^e j’eXƒdd ƒZ’d d„Z“dd„Z”ddq„Z•ddV„Z–e–Z—ddW„Z˜ddc„Z™dd„ZšddÇe(fddp„Z›d”ddr„Zœdd„Zd•dds„ZžddM„ZŸe
jfdd„Z d–d dƒ„Z¡d—d!dw„Z¢d˜d"dx„Z£d™d#d{„Z¤dšd$d|„Z¥d›d%d}„Z¦dœd&dv„Z§dd'dy„Z¨džd(d„Z©dŸd)d~„Zªd d,d‚„Z«d¡d-dz„Z¬Gd.d/„d/ƒZ­e­d0ƒZ®d1d2„Z¯e°e ±d3¡e ±d4¡e ±d5¡e ±d6¡d7Z²d8d9„Z³d:dN„Z´d¢d;d<„ZµGd=d>„d>ƒZ¶Gd?d„deƒZ·d@dA„Z¸GdBd„de·ƒZ¹dCdb„ZºeºZ»eºZ¼GdDdE„dEe·ƒZ½e½ƒZ¾Z¿e·ZÀddde)ddǐddÇdÇdf
dFd)„ZeÀje_dGdd„ZÁGdHdI„dIe[ƒZÂddde
jfdJdˆ„ZÃe·jÃjeÃ_ddde
jfdKd„„ZÄe·jÄjeÄ_ddde
jfdLdš„ZÅe·jÅjeÅ_GdMdN„dNƒZÆeÆdƒZÇeÆdƒZÈZÉeÆdƒZÊeÆd4dǐdOZËeÆd>ƒZÌeÆd?ƒZÍeÆd9ƒZÎeÆdBƒZÏeÆdZƒZÐeÆd]ƒZÑeÂe jÒeƒeHƒZÒeÆd‡ƒZÓeÂe jÔe‚eGƒZÔeÆd‘ƒZÕeÆd˜ƒZÖeÆd˜ƒZ×eÆdƒZØeÆdŸƒZÙeƐdPƒZÚeÆdªƒZÛeÆd¯ƒZÜeÆd±ƒZÝeÆd²ƒZÞeÆd¶ƒZßeÆd¹ƒZàeÆd=ƒZád£dRd³„Zâd¤dSd—„ZãeÆd&ƒZäeÆd%ƒZåe
jdddÇdfdTd'„Zæe·jæjeæ_d¥dVd¬„ZçdWd5„Zèd¦dXd6„Zéd§dYdA„ZêdZdf„Zëd[d¢„Zìd¨d\d›„Zíd]dœ„Zîd©d^d·„Zïdªd`d „Zðdad¡„ZñdbdŽ„Zòe
jòjeò_dcd¦„Zóe
jójeó_d«ddd©„Zôe
jôjeô_eefdedº„Zõd¬dfd1„Zöd­dgd¤„ZnenZ÷d®dhdi„Zød¯djdk„Zùdld_„Zúe-e
jújdmƒeú_eúZûdnd•„Züe-e
jüjdmƒeü_eüZýdodp„Zþd°drd:„Zÿd±dtd8„Zd²dud„Zd³dvd„Zd´dwd+„Zdµdxd*„ZedUdyfdzd{„Zd|dS„ZGd}d~„d~ƒZede°dddd€dd‚Z    ed2e°ddddƒd„d‚Z
edCe°dddd…d†d‚Z edEe°dddd‡dˆd‚Z edFd‡dˆd‰Z edRd‡dАd‰ZedTd‹dŒd‰Zed\e°dddd‡dˆd‚Zed^e°dddddސd‚Zed“e°dddd‡dˆd‚Zed”d‡dˆd‰Zed®e°dddddd‚Zed»e°dddd‡dˆd‚Zed¼d‡dˆd‰Zd¶d‘d„ZdS(·aú
numpy.ma : a package to handle missing or invalid values.
 
This package was initially written for numarray by Paul F. Dubois
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by Pierre Gerard-Marchant
(University of Georgia) to make the MaskedArray class a subclass of ndarray,
and to improve support of structured arrays.
 
 
Copyright 1999, 2000, 2001 Regents of the University of California.
Released for unlimited redistribution.
 
* Adapted for numpy_core 2005 by Travis Oliphant and (mainly) Paul Dubois.
* Subclassing of the base `ndarray` 2006 by Pierre Gerard-Marchant
  (pgmdevlist_AT_gmail_DOT_com)
* Improvements suggested by Reggie Dugard (reggie_AT_merfinllc_DOT_com)
 
.. moduleauthor:: Pierre Gerard-Marchant
 
éN)Úreduce)Ú
multiarray)ÚndarrayÚamaxÚaminÚ iscomplexobjÚbool_Ú_NoValue)Úarray)Úangle)Ú
getargspecÚ formatargspecÚlongÚunicodeÚbytes)Ú expand_dims)Únormalize_axis_tupleÚMAErrorÚ    MaskErrorÚMaskTypeÚ MaskedArrayÚabsÚabsoluteÚaddÚallÚallcloseÚallequalÚalltruerrr ÚanomÚ    anomaliesÚanyÚappendÚarangeÚarccosÚarccoshÚarcsinÚarcsinhÚarctanÚarctan2ÚarctanhÚargmaxÚargminÚargsortÚaroundr
Ú
asanyarrayÚasarrayÚ bitwise_andÚ
bitwise_orÚ bitwise_xorrÚceilÚchooseÚclipÚcommon_fill_valueÚcompressÚ
compressedÚ concatenateÚ    conjugateÚconvolveÚcopyÚ    correlateÚcosÚcoshÚcountÚcumprodÚcumsumÚdefault_fill_valueÚdiagÚdiagonalÚdiffÚdivideÚemptyÚ
empty_likeÚequalÚexprÚfabsÚfilledÚ fix_invalidÚ flatten_maskÚflatten_structured_arrayÚfloorÚ floor_divideÚfmodÚ
frombufferÚfromflexÚ fromfunctionÚgetdataÚgetmaskÚ getmaskarrayÚgreaterÚ greater_equalÚ harden_maskÚhypotÚidentityÚidsÚindicesÚinnerÚ innerproductÚisMAÚ isMaskedArrayÚis_maskÚ    is_maskedÚisarrayÚ
left_shiftÚlessÚ
less_equalÚlogÚlog10Úlog2Ú logical_andÚ logical_notÚ
logical_orÚ logical_xorÚ    make_maskÚmake_mask_descrÚmake_mask_noneÚmask_orÚmaskedÚ masked_arrayÚ masked_equalÚmasked_greaterÚmasked_greater_equalÚ masked_insideÚmasked_invalidÚ masked_lessÚmasked_less_equalÚmasked_not_equalÚ masked_objectÚmasked_outsideÚmasked_print_optionÚmasked_singletonÚ masked_valuesÚ masked_whereÚmaxÚmaximumÚmaximum_fill_valueÚmeanÚminÚminimumÚminimum_fill_valueÚmodÚmultiplyÚmvoidÚndimÚnegativeÚnomaskÚnonzeroÚ    not_equalÚonesÚ    ones_likeÚouterÚ outerproductÚpowerÚprodÚproductÚptpÚputÚputmaskÚravelÚ    remainderÚrepeatÚreshapeÚresizeÚ right_shiftÚroundÚround_Úset_fill_valueÚshapeÚsinÚsinhÚsizeÚ soften_maskÚsometrueÚsortÚsqrtÚsqueezeÚstdÚsubtractÚsumÚswapaxesÚtakeÚtanÚtanhÚtraceÚ    transposeÚ true_divideÚvarÚwhereÚzerosÚ
zeros_likec@s eZdZdS)ÚMaskedArrayFutureWarningN)Ú__name__Ú
__module__Ú __qualname__©rÃrÃúDd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/ma/core.pyr¿Tsr¿cCs&|jdkrdStjdtdddSdS)aª
    Adjust the axis passed to argsort, warning if necessary
 
    Parameters
    ----------
    arr
        The array which argsort was called on
 
    np.ma.argsort has a long-term bug where the default of the axis argument
    is wrong (gh-8701), which now must be kept for backwards compatibility.
    Thankfully, this only makes a difference when arrays are 2- or more-
    dimensional, so we only need a warning then.
    ééÿÿÿÿz«In the future the default for argsort will be axis=-1, not the current None, to match its documentation and np.argsort. Explicitly pass -1 or None to silence this warning.é©Ú
stacklevelN)rÚwarningsÚwarnr¿)ÚarrrÃrÃrÄÚ_deprecate_argsort_axisWs
ürÍcCs\|dkr dS|dkr|St dt |¡¡}dt |¡}d |dd…|g|dd…¡S)z9
    Adds a Notes section to an existing docstring.
 
    Nz\n\s*?Notes\n\s*?-----z
 
Notes
-----
%s
ÚrÅ)ÚreÚsplitÚinspectÚcleandocÚjoin)Z
initialdocZnoteZ    notesplitZnotedocrÃrÃrÄÚdoc_notessrÔcCs.ztt|ƒŽ}Wntk
r(d}YnX|S)z%
    Get the signature from obj
 
    rÎ)r r Ú    TypeError)ÚobjÚsigrÃrÃrÄÚget_object_signatureƒs
 
rØc@seZdZdZdS)rz1
    Class for masked array related errors.
 
    N©rÀrÁrÂÚ__doc__rÃrÃrÃrÄr”sc@seZdZdZdS)rz)
    Class for mask related errors.
 
    NrÙrÃrÃrÃrÄrœsTy@Œµx¯Dg@Œµx¯Di?Bú?sN/As???zN/A)    ÚbÚcÚfÚiÚOÚSÚuÚVÚU) ÚYÚMÚWÚDÚhÚmÚsÚmsÚusÚnsZpsÚfsÚasZNaTzM8[ú]zm8[cCsg|]}|tj f‘qSréÚnpÚinf©Ú.0ÚkrÃrÃrÄÚ
<listcomp>¾srøécCs"g|]}|ttj tj ƒf‘qSréÚcomplexrórôrõrÃrÃrÄrø¿séýÿÿÿcCsg|]}|tj
f‘qSrÃròrõrÃrÃrÄrøÂscCs"g|]}|ttj
tj
ƒf‘qSrÃrúrõrÃrÃrÄrøÃscshˆjdk    r6t‡‡fdd„ˆjDƒƒ}tj|ˆddSˆjr\ˆj\}}t|ˆƒ}t ||¡SˆˆƒSdS)zR
    Recursively produce a fill value for `dtype`, calling f on scalar dtypes
    Nc3s"|]}t tˆ|ˆƒ¡VqdS©N)rór
Ú_recursive_fill_value©röÚname©ÚdtyperÞrÃrÄÚ    <genexpr>Ðsÿz(_recursive_fill_value.<locals>.<genexpr>©rrÃ)ÚnamesÚtuplerór
ÚsubdtyperþÚfull)rrÞÚvalsÚsubtyper¨ZsubvalrÃrrÄrþÇs
þ
 
 rþcCs0t|tjƒr|St|dƒr |jSt |¡jSdS)z4 Convert the argument for *_fill_value into a dtype rN)Ú
isinstancerórÚhasattrr.©rÖrÃrÃrÄÚ _get_dtype_ofÜs
 
rcCsdd„}t|ƒ}t||ƒS)aN
    Return the default fill value for the argument object.
 
    The default filling value depends on the datatype of the input
    array or the type of the input scalar:
 
       ========  ========
       datatype  default
       ========  ========
       bool      True
       int       999999
       float     1.e20
       complex   1.e20+0j
       object    '?'
       string    'N/A'
       ========  ========
 
    For structured types, a structured scalar is returned, with each field the
    default fill value for its type.
 
    For subarray types, the fill value is an array of the same size containing
    the default scalar fill value.
 
    Parameters
    ----------
    obj : ndarray, dtype or scalar
        The array data-type or scalar for which the default fill value
        is returned.
 
    Returns
    -------
    fill_value : scalar
        The default fill value.
 
    Examples
    --------
    >>> np.ma.default_fill_value(1)
    999999
    >>> np.ma.default_fill_value(np.array([1.1, 2., np.pi]))
    1e+20
    >>> np.ma.default_fill_value(np.dtype(complex))
    (1e+20+0j)
 
    cSs2|jdkr t |jdd…d¡St |jd¡SdS)NZMmrÅrÛ)ÚkindÚdefault_fillerÚgetÚstrrrÃrÃrÄÚ_scalar_fill_values
z.default_fill_value.<locals>._scalar_fill_value©rrþ)rÖrrrÃrÃrÄrCæs-cs ‡‡fdd„}t|ƒ}t||ƒS)Nc
sJz
ˆ|WStk
rD}ztd|›dˆ›dƒd‚W5d}~XYnXdS)NzUnsuitable type z for calculating Ú.)ÚKeyErrorrÕ)rÚe©ÚextremumÚ extremum_namerÃrÄrs
ÿþz0_extremum_fill_value.<locals>._scalar_fill_valuer)rÖrrrrrÃrrÄÚ_extremum_fill_valuesrcCs t|tdƒS)a`
    Return the maximum value that can be represented by the dtype of an object.
 
    This function is useful for calculating a fill value suitable for
    taking the minimum of an array with a given dtype.
 
    Parameters
    ----------
    obj : ndarray, dtype or scalar
        An object that can be queried for it's numeric type.
 
    Returns
    -------
    val : scalar
        The maximum representable value.
 
    Raises
    ------
    TypeError
        If `obj` isn't a suitable numeric type.
 
    See Also
    --------
    maximum_fill_value : The inverse function.
    set_fill_value : Set the filling value of a masked array.
    MaskedArray.fill_value : Return current fill value.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.int8()
    >>> ma.minimum_fill_value(a)
    127
    >>> a = np.int32()
    >>> ma.minimum_fill_value(a)
    2147483647
 
    An array of numeric data can also be passed.
 
    >>> a = np.array([1, 2, 3], dtype=np.int8)
    >>> ma.minimum_fill_value(a)
    127
    >>> a = np.array([1, 2, 3], dtype=np.float32)
    >>> ma.minimum_fill_value(a)
    inf
 
    r‹)rÚ
min_fillerr rÃrÃrÄrŒ+s0cCs t|tdƒS)ad
    Return the minimum value that can be represented by the dtype of an object.
 
    This function is useful for calculating a fill value suitable for
    taking the maximum of an array with a given dtype.
 
    Parameters
    ----------
    obj : ndarray, dtype or scalar
        An object that can be queried for it's numeric type.
 
    Returns
    -------
    val : scalar
        The minimum representable value.
 
    Raises
    ------
    TypeError
        If `obj` isn't a suitable numeric type.
 
    See Also
    --------
    minimum_fill_value : The inverse function.
    set_fill_value : Set the filling value of a masked array.
    MaskedArray.fill_value : Return current fill value.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.int8()
    >>> ma.maximum_fill_value(a)
    -128
    >>> a = np.int32()
    >>> ma.maximum_fill_value(a)
    -2147483648
 
    An array of numeric data can also be passed.
 
    >>> a = np.array([1, 2, 3], dtype=np.int8)
    >>> ma.maximum_fill_value(a)
    -128
    >>> a = np.array([1, 2, 3], dtype=np.float32)
    >>> ma.maximum_fill_value(a)
    -inf
 
    r‡)rÚ
max_fillerr rÃrÃrÄrˆ^s0cCs„t |t|jƒ¡}g}t||jƒD]X\}}||}|jrB|jd}|jdk    rb| tt||ƒƒ¡q"| tj    ||d 
¡¡q"t|ƒS)aÆ
    Create a fill value for a structured dtype.
 
    Parameters
    ----------
    fillvalue : scalar or array_like
        Scalar or array representing the fill value. If it is of shorter
        length than the number of fields in dt, it will be resized.
    dt : dtype
        The structured dtype for which to create the fill value.
 
    Returns
    -------
    val : tuple
        A tuple of values corresponding to the structured fill value.
 
    rNr) rór£ÚlenrÚziprr!rÚ_recursive_set_fill_valuer
Úitem)Ú    fillvalueÚdtZ output_valueÚfvalrZcdtyperÃrÃrÄr ‘s
 
r c
Cs0t |¡}|dkrt|ƒ}n|jdk    r¬t|ttjfƒrˆztj|d|d}Wqªtk
r„}zd}t|||fƒ|‚W5d}~XYqªXn"tj    |t
d}tjt ||ƒ|d}nzt|t ƒrÒ|j dkrÒd}t||ƒ‚nTztj|d|d}Wn>ttfk
r$}zd}t|||fƒ|‚W5d}~XYnXt |¡S)    a
    Private function validating the given `fill_value` for the given dtype.
 
    If fill_value is None, it is set to the default corresponding to the dtype.
 
    If fill_value is not None, its value is forced to the given dtype.
 
    The result is always a 0d array.
 
    NF©r<rz"Unable to transform %s to dtype %srZOSVUz6Cannot set fill value of string with array of dtype %sz(Cannot convert fill_value %s to dtype %s)rórrCrr rÚvoidr
Ú
ValueErrorr/Úobjectr rÚcharrÕÚ OverflowError)Ú
fill_valueÚndtyperÚerr_msgrÃrÃrÄÚ_check_fill_value±s.
 
& ÿ$r.cCst|tƒr| |¡dS)aâ
    Set the filling value of a, if a is a masked array.
 
    This function changes the fill value of the masked array `a` in place.
    If `a` is not a masked array, the function returns silently, without
    doing anything.
 
    Parameters
    ----------
    a : array_like
        Input array.
    fill_value : dtype
        Filling value. A consistency test is performed to make sure
        the value is compatible with the dtype of `a`.
 
    Returns
    -------
    None
        Nothing returned by this function.
 
    See Also
    --------
    maximum_fill_value : Return the default fill value for a dtype.
    MaskedArray.fill_value : Return current fill value.
    MaskedArray.set_fill_value : Equivalent method.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(5)
    >>> a
    array([0, 1, 2, 3, 4])
    >>> a = ma.masked_where(a < 3, a)
    >>> a
    masked_array(data=[--, --, --, 3, 4],
                 mask=[ True,  True,  True, False, False],
           fill_value=999999)
    >>> ma.set_fill_value(a, -999)
    >>> a
    masked_array(data=[--, --, --, 3, 4],
                 mask=[ True,  True,  True, False, False],
           fill_value=-999)
 
    Nothing happens if `a` is not a masked array.
 
    >>> a = list(range(5))
    >>> a
    [0, 1, 2, 3, 4]
    >>> ma.set_fill_value(a, 100)
    >>> a
    [0, 1, 2, 3, 4]
    >>> a = np.arange(5)
    >>> a
    array([0, 1, 2, 3, 4])
    >>> ma.set_fill_value(a, 100)
    >>> a
    array([0, 1, 2, 3, 4])
 
    N)r rr§©Úar+rÃrÃrÄr§Ýs<
 
cCst|tƒr|j}nt|ƒ}|S)zr
    Return the filling value of a, if any.  Otherwise, returns the
    default filling value for that type.
 
    )r rr+rC)r0ÚresultrÃrÃrÄÚget_fill_values
r2cCs t|ƒ}t|ƒ}||kr|SdS)a
    Return the common filling value of two masked arrays, if any.
 
    If ``a.fill_value == b.fill_value``, return the fill value,
    otherwise return None.
 
    Parameters
    ----------
    a, b : MaskedArray
        The masked arrays for which to compare fill values.
 
    Returns
    -------
    fill_value : scalar or None
        The common fill value, or None.
 
    Examples
    --------
    >>> x = np.ma.array([0, 1.], fill_value=3)
    >>> y = np.ma.array([0, 1.], fill_value=3)
    >>> np.ma.common_fill_value(x, y)
    3.0
 
    N)r2)r0rÜÚt1Út2rÃrÃrÄr6+s
cCsFt|dƒr| |¡St|tƒr"|St|tƒr8t |d¡St |¡SdS)aÈ
    Return input as an array with masked data replaced by a fill value.
 
    If `a` is not a `MaskedArray`, `a` itself is returned.
    If `a` is a `MaskedArray` and `fill_value` is None, `fill_value` is set to
    ``a.fill_value``.
 
    Parameters
    ----------
    a : MaskedArray or array_like
        An input object.
    fill_value : array_like, optional.
        Can be scalar or non-scalar. If non-scalar, the
        resulting filled array should be broadcastable
        over input array. Default is None.
 
    Returns
    -------
    a : ndarray
        The filled array.
 
    See Also
    --------
    compressed
 
    Examples
    --------
    >>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0],
    ...                                                   [1, 0, 0],
    ...                                                   [0, 0, 0]])
    >>> x.filled()
    array([[999999,      1,      2],
           [999999,      4,      5],
           [     6,      7,      8]])
    >>> x.filled(fill_value=333)
    array([[333,   1,   2],
           [333,   4,   5],
           [  6,   7,   8]])
    >>> x.filled(fill_value=np.arange(3))
    array([[0, 1, 2],
           [0, 4, 5],
           [6, 7, 8]])
 
    rMràN)r rMr rÚdictrór
r/rÃrÃrÄrMKs-
 
 
 
 cGs„t|ƒdkr.|d}t|tƒr(t|ƒ}qrt}nDdd„|Dƒ}|d}t|tƒsRt}|dd…D]}t||ƒr^|}q^|jdkr€tS|S)z
    Return the youngest subclass of MaskedArray from a list of (masked) arrays.
 
    In case of siblings, the first listed takes over.
 
    rÅrcSsg|] }t|ƒ‘qSrÃ)Útype©rör0rÃrÃrÄrø’sz'get_masked_subclass.<locals>.<listcomp>NÚMaskedConstant)rr rr6Ú
issubclassrÀ)ÚarraysrÌÚrclsZarrclsÚclsrÃrÃrÄÚget_masked_subclass„s 
 
 
 
 
r=cCsBz
|j}Wn$tk
r.tj|d|d}YnX|s>| t¡S|S)aE
    Return the data of a masked array as an ndarray.
 
    Return the data of `a` (if any) as an ndarray if `a` is a ``MaskedArray``,
    else return `a` as a ndarray or subclass (depending on `subok`) if not.
 
    Parameters
    ----------
    a : array_like
        Input ``MaskedArray``, alternatively a ndarray or a subclass thereof.
    subok : bool
        Whether to force the output to be a `pure` ndarray (False) or to
        return a subclass of ndarray if appropriate (True, default).
 
    See Also
    --------
    getmask : Return the mask of a masked array, or nomask.
    getmaskarray : Return the mask of a masked array, or full array of False.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = ma.masked_equal([[1,2],[3,4]], 2)
    >>> a
    masked_array(
      data=[[1, --],
            [3, 4]],
      mask=[[False,  True],
            [False, False]],
      fill_value=2)
    >>> ma.getdata(a)
    array([[1, 2],
           [3, 4]])
 
    Equivalently use the ``MaskedArray`` `data` attribute.
 
    >>> a.data
    array([[1, 2],
           [3, 4]])
 
    F©r<Úsubok)Ú_dataÚAttributeErrorrór
Úviewr)r0r?ÚdatarÃrÃrÄrWŸs*
 
cCsXt|||dd}t t |j¡¡}| ¡s.|S|j|O_|dkrJ|j}||j|<|S)aQ
    Return input with invalid data masked and replaced by a fill value.
 
    Invalid data means values of `nan`, `inf`, etc.
 
    Parameters
    ----------
    a : array_like
        Input array, a (subclass of) ndarray.
    mask : sequence, optional
        Mask. Must be convertible to an array of booleans with the same
        shape as `data`. True indicates a masked (i.e. invalid) data.
    copy : bool, optional
        Whether to use a copy of `a` (True) or to fix `a` in place (False).
        Default is True.
    fill_value : scalar, optional
        Value used for fixing invalid data. Default is None, in which case
        the ``a.fill_value`` is used.
 
    Returns
    -------
    b : MaskedArray
        The input array with invalid entries fixed.
 
    Notes
    -----
    A copy is performed by default.
 
    Examples
    --------
    >>> x = np.ma.array([1., -1, np.nan, np.inf], mask=[1] + [0]*3)
    >>> x
    masked_array(data=[--, -1.0, nan, inf],
                 mask=[ True, False, False, False],
           fill_value=1e+20)
    >>> np.ma.fix_invalid(x)
    masked_array(data=[--, -1.0, --, --],
                 mask=[ True, False,  True,  True],
           fill_value=1e+20)
 
    >>> fixed = np.ma.fix_invalid(x)
    >>> fixed.data
    array([ 1.e+00, -1.e+00,  1.e+20,  1.e+20])
    >>> x.data
    array([ 1., -1., nan, inf])
 
    T)r<Úmaskr?N)rwróroÚisfiniter@r Ú_maskr+)r0rDr<r+ÚinvalidrÃrÃrÄrNÕs0
cCs,t|tƒp*t|tƒo*|o*t dd„|Dƒ¡S)Ncss|]}t|tƒVqdSrý)r r)rörërÃrÃrÄrsz/is_string_or_list_of_strings.<locals>.<genexpr>)r rÚlistÚbuiltinsr)ÚvalrÃrÃrÄÚis_string_or_list_of_stringss
þrKc@s eZdZdZdd„Zdd„ZdS)Ú_DomainCheckIntervalz~
    Define a valid interval, so that :
 
    ``domain_check_interval(a,b)(x) == True`` where
    ``x < a`` or ``x > b``.
 
    cCs"||kr||}}||_||_dS)z9domain_check_interval(a,b)(x) = true where x < a or y > bN)r0rÜ©Úselfr0rÜrÃrÃrÄÚ__init__&s
z_DomainCheckInterval.__init__c
CsDtjdd.t t ||j¡t ||j¡¡W5QR£SQRXdS)úExecute the call behavior.Úignore©rGN)róÚerrstateÚumathrprZrÜrir0©rNÚxrÃrÃrÄÚ__call__-s ÿz_DomainCheckInterval.__call__N©rÀrÁrÂrÚrOrWrÃrÃrÃrÄrLsrLc@s eZdZdZdd„Zdd„ZdS)Ú
_DomainTanz
    Define a valid interval for the `tan` function, so that:
 
    ``domain_tan(eps) = True`` where ``abs(cos(x)) < eps``
 
    cCs
||_dS)z/domain_tan(eps) = true where abs(cos(x)) < eps)N)Úeps)rNrZrÃrÃrÄrO>sz_DomainTan.__init__c
Cs>tjdd(t t t |¡¡|j¡W5QR£SQRXdS©úExecutes the call behavior.rQrRN)rórSrTrirr>rZrUrÃrÃrÄrWBsz_DomainTan.__call__NrXrÃrÃrÃrÄrY6srYc@s"eZdZdZddd„Zdd„ZdS)Ú_DomainSafeDividez-
    Define a domain for safe division.
 
    NcCs
||_dSrý)Ú    tolerance)rNr^rÃrÃrÄrONsz_DomainSafeDivide.__init__c
Csl|jdkrt t¡j|_t |¡t |¡}}tjdd(t |¡|jt |¡kW5QR£SQRXdS)NrQrR)    r^róZfinfoÚfloatZtinyr/rSrTrrMrÃrÃrÄrWQs
 
z_DomainSafeDivide.__call__)NrXrÃrÃrÃrÄr]Hs
r]c@s eZdZdZdd„Zdd„ZdS)Ú_DomainGreaterz4
    DomainGreater(v)(x) is True where x <= v.
 
    cCs
||_dS)z'DomainGreater(v)(x) = true where x <= vN©Úcritical_value©rNrbrÃrÃrÄrOcsz_DomainGreater.__init__c
Cs2tjddt ||j¡W5QR£SQRXdSr[)rórSrTrjrbrUrÃrÃrÄrWgsz_DomainGreater.__call__NrXrÃrÃrÃrÄr`]sr`c@s eZdZdZdd„Zdd„ZdS)Ú_DomainGreaterEqualz8
    DomainGreaterEqual(v)(x) is True where x < v.
 
    cCs
||_dS)z+DomainGreaterEqual(v)(x) = true where x < vNrarcrÃrÃrÄrOssz_DomainGreaterEqual.__init__c
Cs2tjddt ||j¡W5QR£SQRXdSr[)rórSrTrirbrUrÃrÃrÄrWwsz_DomainGreaterEqual.__call__NrXrÃrÃrÃrÄrdmsrdc@seZdZdd„Zdd„ZdS)Ú _MaskedUFunccCs||_|j|_|j|_dSrý)rÞrÚrÀ)rNÚufuncrÃrÃrÄrO~sz_MaskedUFunc.__init__cCs d|j›S)NzMasked version of )rÞ©rNrÃrÃrÄÚ__str__ƒsz_MaskedUFunc.__str__N)rÀrÁrÂrOrhrÃrÃrÃrÄre}srecs*eZdZdZd‡fdd„    Zdd„Z‡ZS)    Ú_MaskedUnaryOperationaÈ
    Defines masked version of unary operations, where invalid values are
    pre-masked.
 
    Parameters
    ----------
    mufunc : callable
        The function for which to define a masked version. Made available
        as ``_MaskedUnaryOperation.f``.
    fill : scalar, optional
        Filling value, default is 0.
    domain : class instance
        Domain for the function. Should be one of the ``_Domain*``
        classes. Default is None.
 
    rNcs,tƒ |¡||_||_|t|<|t|<dSrý)ÚsuperrOÚfillÚdomainÚ ufunc_domainÚ ufunc_fills)rNZmufuncrkrl©Ú    __class__rÃrÄrO™s
 z_MaskedUnaryOperation.__init__c    Ost|ƒ}|jdk    rftjddd|j|f|ž|Ž}W5QRXt |¡}|| |¡O}|t|ƒO}n4tjddd|j|f|ž|Ž}W5QRXt|ƒ}|js¬|r¨t    S|S|t
k    rÞztj |||dWnt k
rÜYnX|  t|ƒ¡}||_| |¡|S)ú-
        Execute the call behavior.
 
        NrQ©rGrG©r¼)rWrlrórSrÞrTrErXrrvr’ÚcopytorÕrBr=rFÚ _update_from)rNr0ÚargsÚkwargsÚdr1rêÚ masked_resultrÃrÃrÄrW s.
 
z_MaskedUnaryOperation.__call__)rN©rÀrÁrÂrÚrOrWÚ __classcell__rÃrÃrorÄri‡sricsFeZdZdZd‡fdd„    Zdd„Zddd    „Zd
d „Zdd d „Z‡Z    S)Ú_MaskedBinaryOperationaC
    Define masked version of binary operations, where invalid
    values are pre-masked.
 
    Parameters
    ----------
    mbfunc : function
        The function for which to define a masked version. Made available
        as ``_MaskedBinaryOperation.f``.
    domain : class instance
        Default domain for the function. Should be one of the ``_Domain*``
        classes. Default is None.
    fillx : scalar, optional
        Filling value for the first argument, default is 0.
    filly : scalar, optional
        Filling value for the second argument, default is 0.
 
    rcs0tƒ |¡||_||_dt|<||ft|<dS)zr
        abfunc(fillx, filly) must be defined.
 
        abfunc(x, filly) = x for all x to enable reduce.
 
        N)rjrOÚfillxÚfillyrmrn)rNZmbfuncr}r~rorÃrÄrOås
 z_MaskedBinaryOperation.__init__c     Os>t|ƒt|ƒ}}t ¡(tjddd|j||f|ž|Ž}W5QRXt|ƒt|ƒ}}    |tkr‚|    tkrpt}
q¨t t    |ƒ|    ¡}
n&|    tkrœt |t    |ƒ¡}
n t ||    ¡}
|j
sº|
r¶t S|S|
tk    rö|
  ¡röztj ||d|
dWntk
rôYnX| t||ƒ¡} |
| _t|tƒr$|  |¡nt|tƒr:|  |¡| S)rqrQrrÚunsafe©Úcastingr¼)rWrórSZseterrrÞrXr’rTrprYrrvr rtÚ    ExceptionrBr=rFr rru) rNr0rÜrvrwÚdaÚdbr1ÚmaÚmbrêryrÃrÃrÄrWòs8
 
z_MaskedBinaryOperation.__call__Nc
Cs¬t|ƒ}t|ƒ}t||jƒ}|jdkrJ| d¡}|tk    rJt|dd}d|_|tkrf|j     ||¡}t}n |jj    |||d}t
j      ||¡}|js˜|r”t S|S|  |¡}    ||    _|    S)z:
        Reduce `target` along the given `axis`.
 
        rÃrÅT©r<©rÅr)r=rXrMr~r¨r¢r’rrrÞrrTrnrvrBrF)
rNÚtargetÚaxisrÚtclassrêÚtÚtrÚmrZ    masked_trrÃrÃrÄr!s( 
 
 
z_MaskedBinaryOperation.reducec
Cs®t|ƒt|ƒ}}|j ||¡}t|ƒ}t|ƒ}|tkrF|tkrFt}nt|ƒ}t|ƒ}tj ||¡}|jsr|rrt    S|tk    rŠt
j |||d|j s”|S|  t||ƒ¡}    ||    _|    S)zO
        Return the function applied to the outer product of a and b.
 
        rs)rWrÞr—rXr’rYrTrprrvrórtr¨rBr=rF)
rNr0rÜrƒr„rxr…r†rêZmasked_drÃrÃrÄr—?s$
z_MaskedBinaryOperation.outercCs0t|ƒ}t||jƒ}|j ||¡}| |¡}|S)zSAccumulate `target` along `axis` after filling with y fill
        value.
 
        )r=rMr~rÞÚ
accumulaterB)rNr‰rŠr‹rŒr1ryrÃrÃrÄrXs
 
z!_MaskedBinaryOperation.accumulate)rr)rN)r)
rÀrÁrÂrÚrOrWrr—rr{rÃrÃrorÄr|Ñs  /
r|cs*eZdZdZd‡fdd„    Zdd„Z‡ZS)Ú_DomainedBinaryOperationaH
    Define binary operations that have a domain, like divide.
 
    They have no reduce, outer or accumulate.
 
    Parameters
    ----------
    mbfunc : function
        The function for which to define a masked version. Made available
        as ``_DomainedBinaryOperation.f``.
    domain : class instance
        Default domain for the function. Should be one of the ``_Domain*``
        classes.
    fillx : scalar, optional
        Filling value for the first argument, default is 0.
    filly : scalar, optional
        Filling value for the second argument, default is 0.
 
    rcs6tƒ |¡||_||_||_|t|<||ft|<dS)zjabfunc(fillx, filly) must be defined.
           abfunc(x, filly) = x for all x to enable reduce.
        N)rjrOrlr}r~rmrn)rNZdbfuncrlr}r~rorÃrÄrOzs  z!_DomainedBinaryOperation.__init__c     Os6t|ƒt|ƒ}}tjddd|j||f|ž|Ž}W5QRXt |¡}|t|ƒO}|t|ƒO}t |jd¡}    |    dk    rˆ||    ||ƒO}|j    sš|r–t
S|Sz>tj |dd|dt  ||¡}
tj |
j|jddrÖ||
7}Wntk
rìYnX| t||ƒ¡} || _t|tƒr|  |¡nt|tƒr2|  |¡| S)    rPrQrrNrrr€Úsafe)r)rWrórSrÞrTrErXrmrrrvrtrŽZcan_castrr‚rBr=rFr rru) rNr0rÜrvrwrƒr„r1rêrlZ    masked_daryrÃrÃrÄrW…s6        
z!_DomainedBinaryOperation.__call__)rrrzrÃrÃrorÄres rççð?gzø·¥•ª8gð¿g÷ÿÿÿÿÿï¿g÷ÿÿÿÿÿï?rÅcCs¬t}|jdk    rdg}|jD]>}|j|}t|ƒdkr>|d|f}| |||d|ƒf¡qt |¡}n8|jr˜t|jƒ}||jd|ƒ|d<t t    |ƒ¡}n|}||kr¨|}|S)z=Private function allowing recursion in _replace_dtype_fields.NrÇrÆr)
Ú_replace_dtype_fields_recursiverÚfieldsrr!rórrrHr)rÚprimitive_dtypeZ_recurseÚdescrrÚfieldZ    new_dtyperÃrÃrÄr”s"
 
 
 
r”cCst |¡}t |¡}t||ƒS)zí
    Construct a dtype description list from a given dtype.
 
    Returns a new dtype object, with all fields and subtypes in the given type
    recursively replaced with `primitive_dtype`.
 
    Arguments are coerced to dtypes first.
    )rórr”)rr–rÃrÃrÄÚ_replace_dtype_fields#s    
 
r™cCs
t|tƒS)að
    Construct a dtype description list from a given dtype.
 
    Returns a new dtype object, with the type of all fields in `ndtype` to a
    boolean type. Field names are not altered.
 
    Parameters
    ----------
    ndtype : dtype
        The dtype to convert.
 
    Returns
    -------
    result : dtype
        A dtype that looks like `ndtype`, the type of all fields is boolean.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> dtype = np.dtype({'names':['foo', 'bar'],
    ...                   'formats':[np.float32, np.int64]})
    >>> dtype
    dtype([('foo', '<f4'), ('bar', '<i8')])
    >>> ma.make_mask_descr(dtype)
    dtype([('foo', '|b1'), ('bar', '|b1')])
    >>> ma.make_mask_descr(np.float32)
    dtype('bool')
 
    )r™r)r,rÃrÃrÄrs1scCs t|dtƒS)a
    Return the mask of a masked array, or nomask.
 
    Return the mask of `a` as an ndarray if `a` is a `MaskedArray` and the
    mask is not `nomask`, else return `nomask`. To guarantee a full array
    of booleans of the same shape as a, use `getmaskarray`.
 
    Parameters
    ----------
    a : array_like
        Input `MaskedArray` for which the mask is required.
 
    See Also
    --------
    getdata : Return the data of a masked array as an ndarray.
    getmaskarray : Return the mask of a masked array, or full array of False.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = ma.masked_equal([[1,2],[3,4]], 2)
    >>> a
    masked_array(
      data=[[1, --],
            [3, 4]],
      mask=[[False,  True],
            [False, False]],
      fill_value=2)
    >>> ma.getmask(a)
    array([[False,  True],
           [False, False]])
 
    Equivalently use the `MaskedArray` `mask` attribute.
 
    >>> a.mask
    array([[False,  True],
           [False, False]])
 
    Result when mask == `nomask`
 
    >>> b = ma.masked_array([[1,2],[3,4]])
    >>> b
    masked_array(
      data=[[1, 2],
            [3, 4]],
      mask=False,
      fill_value=999999)
    >>> ma.nomask
    False
    >>> ma.getmask(b) == ma.nomask
    True
    >>> b.mask == ma.nomask
    True
 
    rF)Úgetattrr’)r0rÃrÃrÄrXRs8cCs,t|ƒ}|tkr(tt |¡t|ddƒƒ}|S)ae
    Return the mask of a masked array, or full boolean array of False.
 
    Return the mask of `arr` as an ndarray if `arr` is a `MaskedArray` and
    the mask is not `nomask`, else return a full boolean array of False of
    the same shape as `arr`.
 
    Parameters
    ----------
    arr : array_like
        Input `MaskedArray` for which the mask is required.
 
    See Also
    --------
    getmask : Return the mask of a masked array, or nomask.
    getdata : Return the data of a masked array as an ndarray.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = ma.masked_equal([[1,2],[3,4]], 2)
    >>> a
    masked_array(
      data=[[1, --],
            [3, 4]],
      mask=[[False,  True],
            [False, False]],
      fill_value=2)
    >>> ma.getmaskarray(a)
    array([[False,  True],
           [False, False]])
 
    Result when mask == ``nomask``
 
    >>> b = ma.masked_array([[1,2],[3,4]])
    >>> b
    masked_array(
      data=[[1, 2],
            [3, 4]],
      mask=False,
      fill_value=999999)
    >>> ma.getmaskarray(b)
    array([[False, False],
           [False, False]])
 
    rN)rXr’rtrór¨rš)rÌrDrÃrÃrÄrYs/cCs*z|jjtkWStk
r$YdSXdS)a)
    Return True if m is a valid, standard mask.
 
    This function does not check the contents of the input, only that the
    type is MaskType. In particular, this function returns False if the
    mask has a flexible dtype.
 
    Parameters
    ----------
    m : array_like
        Array to test.
 
    Returns
    -------
    result : bool
        True if `m.dtype.type` is MaskType, False otherwise.
 
    See Also
    --------
    ma.isMaskedArray : Test whether input is an instance of MaskedArray.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> m = ma.masked_equal([0, 1, 0, 2, 3], 0)
    >>> m
    masked_array(data=[--, 1, --, 2, 3],
                 mask=[ True, False,  True, False, False],
           fill_value=0)
    >>> ma.is_mask(m)
    False
    >>> ma.is_mask(m.mask)
    True
 
    Input must be an ndarray (or have similar attributes)
    for it to be considered a valid mask.
 
    >>> m = [False, True, False]
    >>> ma.is_mask(m)
    False
    >>> m = np.array([False, True, False])
    >>> m
    array([False,  True, False])
    >>> ma.is_mask(m)
    True
 
    Arrays with complex dtypes don't return True.
 
    >>> dtype = np.dtype({'names':['monty', 'pithon'],
    ...                   'formats':[bool, bool]})
    >>> dtype
    dtype([('monty', '|b1'), ('pithon', '|b1')])
    >>> m = np.array([(True, False), (False, True), (True, False)],
    ...              dtype=dtype)
    >>> m
    array([( True, False), (False,  True), ( True, False)],
          dtype=[('monty', '?'), ('pithon', '?')])
    >>> ma.is_mask(m)
    False
 
    FN)rr6rrA©rêrÃrÃrÄreÅs>cCs |jjdkr| ¡stS|SdS)z-
    Shrink a mask to nomask if possible
    N)rrr r’r›rÃrÃrÄÚ _shrink_mask    srœFcCsh|tkr tSt|ƒ}t|tƒr@|jjr@|tjkr@tj|j    |dStj
t |dƒ||dd}|rdt |ƒ}|S)aˆ
    Create a boolean mask from an array.
 
    Return `m` as a boolean mask, creating a copy if necessary or requested.
    The function can accept any sequence that is convertible to integers,
    or ``nomask``.  Does not require that contents must be 0s and 1s, values
    of 0 are interpreted as False, everything else as True.
 
    Parameters
    ----------
    m : array_like
        Potential mask.
    copy : bool, optional
        Whether to return a copy of `m` (True) or `m` itself (False).
    shrink : bool, optional
        Whether to shrink `m` to ``nomask`` if all its values are False.
    dtype : dtype, optional
        Data-type of the output mask. By default, the output mask has a
        dtype of MaskType (bool). If the dtype is flexible, each field has
        a boolean dtype. This is ignored when `m` is ``nomask``, in which
        case ``nomask`` is always returned.
 
    Returns
    -------
    result : ndarray
        A boolean mask derived from `m`.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> m = [True, False, True, True]
    >>> ma.make_mask(m)
    array([ True, False,  True,  True])
    >>> m = [1, 0, 1, 1]
    >>> ma.make_mask(m)
    array([ True, False,  True,  True])
    >>> m = [1, 0, 2, -3]
    >>> ma.make_mask(m)
    array([ True, False,  True,  True])
 
    Effect of the `shrink` parameter.
 
    >>> m = np.zeros(4)
    >>> m
    array([0., 0., 0., 0.])
    >>> ma.make_mask(m)
    False
    >>> ma.make_mask(m, shrink=False)
    array([False, False, False, False])
 
    Using a flexible `dtype`.
 
    >>> m = [1, 0, 1, 1]
    >>> n = [0, 1, 0, 0]
    >>> arr = []
    >>> for man, mouse in zip(m, n):
    ...     arr.append((man, mouse))
    >>> arr
    [(1, 0), (0, 1), (1, 0), (1, 0)]
    >>> dtype = np.dtype({'names':['man', 'mouse'],
    ...                   'formats':[np.int64, np.int64]})
    >>> arr = np.array(arr, dtype=dtype)
    >>> arr
    array([(1, 0), (0, 1), (1, 0), (1, 0)],
          dtype=[('man', '<i8'), ('mouse', '<i8')])
    >>> ma.make_mask(arr, dtype=dtype)
    array([(True, False), (False, True), (True, False), (True, False)],
          dtype=[('man', '|b1'), ('mouse', '|b1')])
 
    rT)r<rr?) r’rsr rrr•rórr•r¨r
rMrœ)rêr<Úshrinkrr1rÃrÃrÄrrsGcCs.|dkrtj|td}ntj|t|ƒd}|S)a&
    Return a boolean mask of the given shape, filled with False.
 
    This function returns a boolean ndarray with all entries False, that can
    be used in common mask manipulations. If a complex dtype is specified, the
    type of each field is converted to a boolean type.
 
    Parameters
    ----------
    newshape : tuple
        A tuple indicating the shape of the mask.
    dtype : {None, dtype}, optional
        If None, use a MaskType instance. Otherwise, use a new datatype with
        the same fields as `dtype`, converted to boolean types.
 
    Returns
    -------
    result : ndarray
        An ndarray of appropriate shape and dtype, filled with False.
 
    See Also
    --------
    make_mask : Create a boolean mask from an array.
    make_mask_descr : Construct a dtype description list from a given dtype.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> ma.make_mask_none((3,))
    array([False, False, False])
 
    Defining a more complex dtype.
 
    >>> dtype = np.dtype({'names':['foo', 'bar'],
    ...                   'formats':[np.float32, np.int64]})
    >>> dtype
    dtype([('foo', '<f4'), ('bar', '<i8')])
    >>> ma.make_mask_none((3,), dtype=dtype)
    array([(False, False), (False, False), (False, False)],
          dtype=[('foo', '|b1'), ('bar', '|b1')])
 
    Nr)rór½rrs)Únewshaperr1rÃrÃrÄrtls+cCsV|jj}|D]D}||}|jjdk    r:t|||||ƒq t |||||¡q dSrý)rrÚ_recursive_mask_orrTrp)Úm1Úm2ÚnewmaskrrZcurrent1rÃrÃrÄrŸžs  rŸcCsä|tks|dkr,t|dtƒ}t||||dS|tks<|dkrXt|dtƒ}t||||dS||krlt|ƒrl|St|ddƒt|ddƒ}}||kržtd||fƒ‚|jdk    rÎt t     ||¡j
|¡}t |||ƒ|Stt   ||¡||dS)a
    Combine two masks with the ``logical_or`` operator.
 
    The result may be a view on `m1` or `m2` if the other is `nomask`
    (i.e. False).
 
    Parameters
    ----------
    m1, m2 : array_like
        Input masks.
    copy : bool, optional
        If copy is False and one of the inputs is `nomask`, return a view
        of the other input mask. Defaults to False.
    shrink : bool, optional
        Whether to shrink the output to `nomask` if all its values are
        False. Defaults to True.
 
    Returns
    -------
    mask : output mask
        The result masks values that are masked in either `m1` or `m2`.
 
    Raises
    ------
    ValueError
        If `m1` and `m2` have different flexible dtypes.
 
    Examples
    --------
    >>> m1 = np.ma.make_mask([0, 1, 1, 0])
    >>> m2 = np.ma.make_mask([1, 0, 0, 0])
    >>> np.ma.mask_or(m1, m2)
    array([ True,  True,  True, False])
 
    Fr)r<rrNzIncompatible dtypes '%s'<>'%s'©r<r)r’ršrrrrer'rrórHÚ    broadcastr¨rŸrTrp)r r¡r<rrZdtype1Zdtype2r¢rÃrÃrÄru¨s %  
 csBdd„}‡fdd„‰t |¡}ˆ||ƒƒ}tjdd„|DƒtdS)a&
    Returns a completely flattened version of the mask, where nested fields
    are collapsed.
 
    Parameters
    ----------
    mask : array_like
        Input array, which will be interpreted as booleans.
 
    Returns
    -------
    flattened_mask : ndarray of bools
        The flattened input.
 
    Examples
    --------
    >>> mask = np.array([0, 0, 1])
    >>> np.ma.flatten_mask(mask)
    array([False, False,  True])
 
    >>> mask = np.array([(0, 0), (0, 1)], dtype=[('a', bool), ('b', bool)])
    >>> np.ma.flatten_mask(mask)
    array([False, False, False,  True])
 
    >>> mdtype = [('a', bool), ('b', [('ba', bool), ('bb', bool)])]
    >>> mask = np.array([(0, (0, 0)), (0, (0, 1))], dtype=mdtype)
    >>> np.ma.flatten_mask(mask)
    array([False, False, False, False, False,  True])
 
    cs*ˆjj}|dk    r"‡fdd„|DƒSˆSdS)zCFlatten the mask and returns a (maybe nested) sequence of booleans.Ncsg|]}tˆ|ƒ‘qSrÃ)rOrÿ©rDrÃrÄrøsz3flatten_mask.<locals>._flatmask.<locals>.<listcomp>©rr)rDZmnamesrÃr¥rÄÚ    _flatmaskszflatten_mask.<locals>._flatmaskc3sNz.|D]$}t|dƒr$ˆ|ƒEdHq|VqWntk
rH|VYnXdS)z.Generates a flattened version of the sequence.Ú__iter__N)r rÕ)ÚsequenceÚelement©Ú _flatsequencerÃrÄr¬s
 z#flatten_mask.<locals>._flatsequencecSsg|]}|‘qSrÃréröÚ_rÃrÃrÄrøsz flatten_mask.<locals>.<listcomp>r)rór/r
Úbool)rDr§Z    flattenedrÃr«rÄrOàs
 
 cCs6|tjkrind|i}|tk    r2|jfd|i|—ŽStS)z:Check whether there are masked values along the given axisÚkeepdimsrŠ)rór    r’r)rDrŠr°rwrÃrÃrÄÚ_check_mask_axissr±cCs¨t|dd}tj||dd}|j|j}}|rF||krFtd||fƒ‚t|dƒrft||jƒ}t|ƒ}nt    }| 
|¡}t |ƒ|_ |s¤t|dƒr¤t |ƒtkr¤|j 
¡|_|S)aé
    Mask an array where a condition is met.
 
    Return `a` as an array masked where `condition` is True.
    Any masked values of `a` or `condition` are also masked in the output.
 
    Parameters
    ----------
    condition : array_like
        Masking condition.  When `condition` tests floating point values for
        equality, consider using ``masked_values`` instead.
    a : array_like
        Array to mask.
    copy : bool
        If True (default) make a copy of `a` in the result.  If False modify
        `a` in place and return a view.
 
    Returns
    -------
    result : MaskedArray
        The result of masking `a` where `condition` is True.
 
    See Also
    --------
    masked_values : Mask using floating point equality.
    masked_equal : Mask where equal to a given value.
    masked_not_equal : Mask where `not` equal to a given value.
    masked_less_equal : Mask where less than or equal to a given value.
    masked_greater_equal : Mask where greater than or equal to a given value.
    masked_less : Mask where less than a given value.
    masked_greater : Mask where greater than a given value.
    masked_inside : Mask inside a given interval.
    masked_outside : Mask outside a given interval.
    masked_invalid : Mask invalid values (NaNs or infs).
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(4)
    >>> a
    array([0, 1, 2, 3])
    >>> ma.masked_where(a <= 2, a)
    masked_array(data=[--, --, --, 3],
                 mask=[ True,  True,  True, False],
           fill_value=999999)
 
    Mask array `b` conditional on `a`.
 
    >>> b = ['a', 'b', 'c', 'd']
    >>> ma.masked_where(a == 2, b)
    masked_array(data=['a', 'b', --, 'd'],
                 mask=[False, False,  True, False],
           fill_value='N/A',
                dtype='<U1')
 
    Effect of the `copy` argument.
 
    >>> c = ma.masked_where(a <= 2, a)
    >>> c
    masked_array(data=[--, --, --, 3],
                 mask=[ True,  True,  True, False],
           fill_value=999999)
    >>> c[0] = 99
    >>> c
    masked_array(data=[99, --, --, 3],
                 mask=[False,  True,  True, False],
           fill_value=999999)
    >>> a
    array([0, 1, 2, 3])
    >>> c = ma.masked_where(a <= 2, a, copy=False)
    >>> c[0] = 99
    >>> c
    masked_array(data=[99, --, --, 3],
                 mask=[False,  True,  True, False],
           fill_value=999999)
    >>> a
    array([99,  1,  2,  3])
 
    When `condition` or `a` contain masked values.
 
    >>> a = np.arange(4)
    >>> a = ma.masked_where(a == 2, a)
    >>> a
    masked_array(data=[0, 1, --, 3],
                 mask=[False, False,  True, False],
           fill_value=999999)
    >>> b = np.arange(4)
    >>> b = ma.masked_where(b == 0, b)
    >>> b
    masked_array(data=[--, 1, 2, 3],
                 mask=[ True, False, False, False],
           fill_value=999999)
    >>> ma.masked_where(a == 3, b)
    masked_array(data=[--, 1, --, --],
                 mask=[ True, False,  True,  True],
           fill_value=999999)
 
    F©rTr>zFInconsistent shape between the condition and the input (got %s and %s)rF)rrrór
r¨Ú
IndexErrorr rurFr6rrBrœrDrXr’)Ú    conditionr0r<ZcondZcshapeZashaper<r1rÃrÃrÄr…$s d  ÿ
 
 
 
 cCstt||ƒ||dS)aì
    Mask an array where greater than a given value.
 
    This function is a shortcut to ``masked_where``, with
    `condition` = (x > value).
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(4)
    >>> a
    array([0, 1, 2, 3])
    >>> ma.masked_greater(a, 2)
    masked_array(data=[0, 1, 2, --],
                 mask=[False, False, False,  True],
           fill_value=999999)
 
    r‡)r…rZ©rVÚvaluer<rÃrÃrÄryžscCstt||ƒ||dS)a
    Mask an array where greater than or equal to a given value.
 
    This function is a shortcut to ``masked_where``, with
    `condition` = (x >= value).
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(4)
    >>> a
    array([0, 1, 2, 3])
    >>> ma.masked_greater_equal(a, 2)
    masked_array(data=[0, 1, --, --],
                 mask=[False, False,  True,  True],
           fill_value=999999)
 
    r‡)r…r[rµrÃrÃrÄrz¸scCstt||ƒ||dS)aç
    Mask an array where less than a given value.
 
    This function is a shortcut to ``masked_where``, with
    `condition` = (x < value).
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(4)
    >>> a
    array([0, 1, 2, 3])
    >>> ma.masked_less(a, 2)
    masked_array(data=[--, --, 2, 3],
                 mask=[ True,  True, False, False],
           fill_value=999999)
 
    r‡)r…rirµrÃrÃrÄr}ÒscCstt||ƒ||dS)aû
    Mask an array where less than or equal to a given value.
 
    This function is a shortcut to ``masked_where``, with
    `condition` = (x <= value).
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(4)
    >>> a
    array([0, 1, 2, 3])
    >>> ma.masked_less_equal(a, 2)
    masked_array(data=[--, --, --, 3],
                 mask=[ True,  True,  True, False],
           fill_value=999999)
 
    r‡)r…rjrµrÃrÃrÄr~ìscCstt||ƒ||dS)aó
    Mask an array where `not` equal to a given value.
 
    This function is a shortcut to ``masked_where``, with
    `condition` = (x != value).
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(4)
    >>> a
    array([0, 1, 2, 3])
    >>> ma.masked_not_equal(a, 2)
    masked_array(data=[--, --, 2, --],
                 mask=[ True,  True, False,  True],
           fill_value=999999)
 
    r‡)r…r”rµrÃrÃrÄrscCstt||ƒ||d}||_|S)a¥
    Mask an array where equal to a given value.
 
    Return a MaskedArray, masked where the data in array `x` are
    equal to `value`. The fill_value of the returned MaskedArray
    is set to `value`.
 
    For floating point arrays, consider using ``masked_values(x, value)``.
 
    See Also
    --------
    masked_where : Mask where a condition is met.
    masked_values : Mask using floating point equality.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(4)
    >>> a
    array([0, 1, 2, 3])
    >>> ma.masked_equal(a, 2)
    masked_array(data=[0, 1, --, 3],
                 mask=[False, False,  True, False],
           fill_value=2)
 
    r‡)r…rJr+)rVr¶r<ÚoutputrÃrÃrÄrx scCs8||kr||}}t|ƒ}||k||k@}t|||dS)a“
    Mask an array inside a given interval.
 
    Shortcut to ``masked_where``, where `condition` is True for `x` inside
    the interval [v1,v2] (v1 <= x <= v2).  The boundaries `v1` and `v2`
    can be given in either order.
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Notes
    -----
    The array `x` is prefilled with its filling value.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> x = [0.31, 1.2, 0.01, 0.2, -0.4, -1.1]
    >>> ma.masked_inside(x, -0.3, 0.3)
    masked_array(data=[0.31, 1.2, --, --, -0.4, -1.1],
                 mask=[False, False,  True,  True, False, False],
           fill_value=1e+20)
 
    The order of `v1` and `v2` doesn't matter.
 
    >>> ma.masked_inside(x, 0.3, -0.3)
    masked_array(data=[0.31, 1.2, --, --, -0.4, -1.1],
                 mask=[False, False,  True,  True, False, False],
           fill_value=1e+20)
 
    r‡©rMr…©rVZv1Zv2r<Zxfr´rÃrÃrÄr{@s
!
cCs8||kr||}}t|ƒ}||k||kB}t|||dS)a
    Mask an array outside a given interval.
 
    Shortcut to ``masked_where``, where `condition` is True for `x` outside
    the interval [v1,v2] (x < v1)|(x > v2).
    The boundaries `v1` and `v2` can be given in either order.
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Notes
    -----
    The array `x` is prefilled with its filling value.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> x = [0.31, 1.2, 0.01, 0.2, -0.4, -1.1]
    >>> ma.masked_outside(x, -0.3, 0.3)
    masked_array(data=[--, --, 0.01, 0.2, --, --],
                 mask=[ True,  True, False, False,  True,  True],
           fill_value=1e+20)
 
    The order of `v1` and `v2` doesn't matter.
 
    >>> ma.masked_outside(x, 0.3, -0.3)
    masked_array(data=[--, --, 0.01, 0.2, --, --],
                 mask=[ True,  True, False, False,  True,  True],
           fill_value=1e+20)
 
    r‡r¸r¹rÃrÃrÄrhs
!
cCsVt|ƒrt |j|¡}|j}nt t |¡|¡}t}t|t    ||dƒ}t
||||dS)a©
    Mask the array `x` where the data are exactly equal to value.
 
    This function is similar to `masked_values`, but only suitable
    for object arrays: for floating point, use `masked_values` instead.
 
    Parameters
    ----------
    x : array_like
        Array to mask
    value : object
        Comparison value
    copy : {True, False}, optional
        Whether to return a copy of `x`.
    shrink : {True, False}, optional
        Whether to collapse a mask full of False to nomask
 
    Returns
    -------
    result : MaskedArray
        The result of masking `x` where equal to `value`.
 
    See Also
    --------
    masked_where : Mask where a condition is met.
    masked_equal : Mask where equal to a given value (integers).
    masked_values : Mask using floating point equality.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> food = np.array(['green_eggs', 'ham'], dtype=object)
    >>> # don't eat spoiled food
    >>> eat = ma.masked_object(food, 'green_eggs')
    >>> eat
    masked_array(data=[--, 'ham'],
                 mask=[ True, False],
           fill_value='green_eggs',
                dtype=object)
    >>> # plain ol` ham is boring
    >>> fresh_food = np.array(['cheese', 'ham', 'pineapple'], dtype=object)
    >>> eat = ma.masked_object(fresh_food, 'green_eggs')
    >>> eat
    masked_array(data=['cheese', 'ham', 'pineapple'],
                 mask=False,
           fill_value='green_eggs',
                dtype=object)
 
    Note that `mask` is set to ``nomask`` if possible.
 
    >>> eat
    masked_array(data=['cheese', 'ham', 'pineapple'],
                 mask=False,
           fill_value='green_eggs',
                dtype=object)
 
    r²©rDr<r+) rdrTrJr@rFrór/r’rurrrw)rVr¶r<rr´rDrÃrÃrÄr€s:çñh㈵øä>ç:Œ0âŽyE>c    CsZt||ƒ}t |jtj¡r.tj||||d}n t ||¡}t||||d}|rV|     ¡|S)aò
    Mask using floating point equality.
 
    Return a MaskedArray, masked where the data in array `x` are approximately
    equal to `value`, determined using `isclose`. The default tolerances for
    `masked_values` are the same as those for `isclose`.
 
    For integer types, exact equality is used, in the same way as
    `masked_equal`.
 
    The fill_value is set to `value` and the mask is set to ``nomask`` if
    possible.
 
    Parameters
    ----------
    x : array_like
        Array to mask.
    value : float
        Masking value.
    rtol, atol : float, optional
        Tolerance parameters passed on to `isclose`
    copy : bool, optional
        Whether to return a copy of `x`.
    shrink : bool, optional
        Whether to collapse a mask full of False to ``nomask``.
 
    Returns
    -------
    result : MaskedArray
        The result of masking `x` where approximately equal to `value`.
 
    See Also
    --------
    masked_where : Mask where a condition is met.
    masked_equal : Mask where equal to a given value (integers).
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> x = np.array([1, 1.1, 2, 1.1, 3])
    >>> ma.masked_values(x, 1.1)
    masked_array(data=[1.0, --, 2.0, --, 3.0],
                 mask=[False,  True, False,  True, False],
           fill_value=1.1)
 
    Note that `mask` is set to ``nomask`` if possible.
 
    >>> ma.masked_values(x, 2.1)
    masked_array(data=[1. , 1.1, 2. , 1.1, 3. ],
                 mask=False,
           fill_value=2.1)
 
    Unlike `masked_equal`, `masked_values` can perform approximate equalities. 
 
    >>> ma.masked_values(x, 2.1, atol=1e-1)
    masked_array(data=[1.0, 1.1, --, 1.1, 3.0],
                 mask=[False, False,  True, False, False],
           fill_value=2.1)
 
    )ÚatolÚrtolrº)
rMróÚ
issubdtyperÚfloatingÚiscloserTrJrwÚ shrink_mask)    rVr¶r¾r½r<rZxnewrDÚretrÃrÃrÄr„Ôs=
 cCsDtj|ddd}tt |¡||d}|jtkr@t|j|jƒ|_|S)aý
    Mask an array where invalid values occur (NaNs or infs).
 
    This function is a shortcut to ``masked_where``, with
    `condition` = ~(np.isfinite(a)). Any pre-existing mask is conserved.
    Only applies to arrays with a dtype where NaNs or infs make sense
    (i.e. floating point types), but accepts any array_like object.
 
    See Also
    --------
    masked_where : Mask where a condition is met.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.arange(5, dtype=float)
    >>> a[2] = np.NaN
    >>> a[3] = np.PINF
    >>> a
    array([ 0.,  1., nan, inf,  4.])
    >>> ma.masked_invalid(a)
    masked_array(data=[0.0, 1.0, --, --, 4.0],
                 mask=[False, False,  True,  True, False],
           fill_value=1e+20)
 
    FTr>r‡)    rór
r…rErFr’rtr¨r)r0r<ÚresrÃrÃrÄr|    s
 
c@sFeZdZdZdd„Zdd„Zdd„Zdd    „Zdd d „Zd d„Z    e    Z
dS)Ú_MaskedPrintOptionzN
    Handle the string used to represent missing data in a masked array.
 
    cCs||_d|_dS)z9
        Create the masked_print_option object.
 
        TN)Ú_displayÚ_enabled)rNÚdisplayrÃrÃrÄrOJ    sz_MaskedPrintOption.__init__cCs|jS)zA
        Display the string to print for masked values.
 
        ©rÆrgrÃrÃrÄrÈR    sz_MaskedPrintOption.displaycCs
||_dS)z=
        Set the string to print for masked values.
 
        NrÉ)rNrërÃrÃrÄÚ set_displayY    sz_MaskedPrintOption.set_displaycCs|jS)z;
        Is the use of the display value enabled?
 
        ©rÇrgrÃrÃrÄÚenabled`    sz_MaskedPrintOption.enabledrÅcCs
||_dS)z7
        Set the enabling shrink to `shrink`.
 
        NrË)rNrrÃrÃrÄÚenableg    sz_MaskedPrintOption.enablecCs
t|jƒSrý)rrÆrgrÃrÃrÄrhn    sz_MaskedPrintOption.__str__N)rÅ) rÀrÁrÂrÚrOrÈrÊrÌrÍrhÚ__repr__rÃrÃrÃrÄrÅD    s
rÅz--cCsL|jj}|dk    r8|D] }||}||}t|||ƒqntj|||ddS)zg
    Puts printoptions in result where mask is True.
 
    Private function allowing for recursion
 
    Nrs)rrÚ_recursive_printoptionrórt)r1rDZprintoptrrZcurdataZcurmaskrÃrÃrÄrÏw    srÏz•        masked_%(name)s(data =
         %(data)s,
        %(nlen)s        mask =
         %(mask)s,
        %(nlen)s  fill_value = %(fill)s)
        z¿        masked_%(name)s(data =
         %(data)s,
        %(nlen)s        mask =
         %(mask)s,
        %(nlen)s  fill_value = %(fill)s,
        %(nlen)s       dtype = %(dtype)s)
        zƒ        masked_%(name)s(data = %(data)s,
        %(nlen)s        mask = %(mask)s,
        %(nlen)s  fill_value = %(fill)s)
        z­        masked_%(name)s(data = %(data)s,
        %(nlen)s        mask = %(mask)s,
        %(nlen)s  fill_value = %(fill)s,
        %(nlen)s       dtype = %(dtype)s)
        )Zlong_stdZlong_flxZ    short_stdZ    short_flxcCsX|jj}|D]F}||}|jjdk    r:t|||||ƒq tj|||||dq dS)z2
    Recursively fill `a` with `fill_value`.
 
    Nrs)rrÚ_recursive_filledrórt)r0rDr+rrÚcurrentrÃrÃrÄrЫ    s  rÐcsº‡fdd„‰t |¡}|j}| ¡}t|tƒrrt ‡fdd„|jDƒ¡}| t¡}t ‡fdd„t    |ƒDƒ¡|_
nt ‡fdd„|Dƒ¡}t |ƒdkr¶t |jƒ}||d<t ˆ|ƒƒ|_|S)    a:
    Flatten a structured array.
 
    The data type of the output is chosen such that it can represent all of the
    (nested) fields.
 
    Parameters
    ----------
    a : structured array
 
    Returns
    -------
    output : masked array or ndarray
        A flattened masked array if the input is a masked array, otherwise a
        standard ndarray.
 
    Examples
    --------
    >>> ndtype = [('a', int), ('b', float)]
    >>> a = np.array([(1, 1), (2, 2)], dtype=ndtype)
    >>> np.ma.flatten_structured_array(a)
    array([[1., 1.],
           [2., 2.]])
 
    c3s2t|ƒD]$}t|dƒr&ˆ|ƒEdHq|VqdS)z;
        Flattens a compound of nested iterables.
 
        r¨N)Úiterr )ÚiterableÚelm©Úflatten_sequencerÃrÄrÖÔ    s 
z2flatten_structured_array.<locals>.flatten_sequencecsg|]}tˆ| ¡ƒƒ‘qSrérr!©rörxrÕrÃrÄrøã    sz,flatten_structured_array.<locals>.<listcomp>csg|]}tˆ| ¡ƒƒ‘qSrÃr×rØrÕrÃrÄrøå    sÿcsg|]}tˆ| ¡ƒƒ‘qSrÃr×rØrÕrÃrÄrøè    srÅr)rór.r¨rŸr rr
r@rBrYrFrrHr)r0ÚinishapeÚoutržrÃrÕrÄrP¹    s 
 
 
ÿ  
cs@‡‡fdd„}ttˆdƒp$ttˆdƒ}|dk    r6|j|_ˆ|_|S)a
    Return a class method wrapper around a basic array method.
 
    Creates a class method which returns a masked array, where the new
    ``_data`` array is the output of the corresponding basic method called
    on the original ``_data``.
 
    If `onmask` is True, the new mask is the output of the method called
    on the initial mask. Otherwise, the new mask is just a reference
    to the initial mask.
 
    Parameters
    ----------
    funcname : str
        Name of the function to apply on data.
    onmask : bool
        Whether the mask must be processed also (True) or left
        alone (False). Default is True. Make available as `_onmask`
        attribute.
 
    Returns
    -------
    method : instancemethod
        Class method wrapper of the specified basic array method.
 
    cs^t|jˆƒ||Ž}| t|ƒ¡}| |¡|j}ˆs@| |¡n|tk    rZt|ˆƒ||Ž|_|Srý)ršr@rBr6rurFÚ __setmask__r’)rNrvÚparamsr1rD©ÚfuncnameÚonmaskrÃrÄÚwrapped_method
s
 z$_arraymethod.<locals>.wrapped_methodN)ršrrórÚrÀ)rÞrßràZmethdocrÃrÝrÄÚ _arraymethodð    s  rác@s8eZdZdZdd„Zdd„Zdd„Zdd    „Zd
d „Zd S) ÚMaskedIteratora¿
    Flat iterator object to iterate over masked arrays.
 
    A `MaskedIterator` iterator is returned by ``x.flat`` for any masked array
    `x`. It allows iterating over the array as if it were a 1-D array,
    either in a for-loop or by calling its `next` method.
 
    Iteration is done in C-contiguous style, with the last index varying the
    fastest. The iterator can also be indexed using basic slicing or
    advanced indexing.
 
    See Also
    --------
    MaskedArray.flat : Return a flat iterator over an array.
    MaskedArray.flatten : Returns a flattened copy of an array.
 
    Notes
    -----
    `MaskedIterator` is not exported by the `ma` module. Instead of
    instantiating a `MaskedIterator` directly, use `MaskedArray.flat`.
 
    Examples
    --------
    >>> x = np.ma.array(arange(6).reshape(2, 3))
    >>> fl = x.flat
    >>> type(fl)
    <class 'numpy.ma.core.MaskedIterator'>
    >>> for item in fl:
    ...     print(item)
    ...
    0
    1
    2
    3
    4
    5
 
    Extracting more than a single element b indexing the `MaskedIterator`
    returns a masked array:
 
    >>> fl[2:4]
    masked_array(data = [2 3],
                 mask = False,
           fill_value = 999999)
 
    cCs0||_|jj|_|jtkr"d|_n
|jj|_dSrý)r…r@ÚflatÚdataiterrFr’Úmaskiter)rNr…rÃrÃrÄrOM
s
 
 
zMaskedIterator.__init__cCs|SrýrÃrgrÃrÃrÄr¨V
szMaskedIterator.__iter__cCsr|j |¡ t|jƒ¡}|jdk    rn|j |¡}t|tƒrH|j|_||_    n&t|t
j ƒrft |||jj dS|rntS|S)N©rDÚhardmask)räÚ __getitem__rBr6r…rår rr¨rFrór&rÚ    _hardmaskrv)rNÚindxr1rFrÃrÃrÄrèY
s
 
 zMaskedIterator.__getitem__cCs*t|ƒ|j|<|jdk    r&t|ƒ|j|<dSrý)rWrärårY)rNÚindexr¶rÃrÃrÄÚ __setitem__h
s
zMaskedIterator.__setitem__cCsHt|jƒ}|jdk    rDt|jƒ}t|tjƒr<t|||jjdS|rDt    S|S)aT
        Return the next value, or raise StopIteration.
 
        Examples
        --------
        >>> x = np.ma.array([3, 2], mask=[0, 1])
        >>> fl = x.flat
        >>> next(fl)
        3
        >>> next(fl)
        masked
        >>> next(fl)
        Traceback (most recent call last):
          ...
        StopIteration
 
        Nræ)
Únexträrår rór&rr…rérv)rNrxrêrÃrÃrÄÚ__next__m
s
 
 
 zMaskedIterator.__next__N)    rÀrÁrÂrÚrOr¨rèrìrîrÃrÃrÃrÄrâ
s /    râc szeZdZdZdZeZdZeZ    dZ
dZ dedddddddddf d    d
„Z d d „Z d d„Zdêdd„Zdëdd„Zdd„Zejddddd„ƒZe‡fdd„ƒZej‡fdd„ƒZe‡fdd„ƒZej‡fdd„ƒZdìdd „ZeZed!d"„ƒZejd#d"„ƒZed$d%„ƒZejd&d%„ƒZd'd(„Zd)d*„Zed+d,„ƒZd-d.„Z ed/d0„ƒZ!d1d2„Z"ed3d4„ƒZ#d5d6„Z$ee$d7Z%ee$d7Z&ed8d9„ƒZ'e'jd:d9„ƒZ'ed;d<„ƒZ(e(jdíd=d<„ƒZ(e(j)Z*e(j+Z,dîd>d?„Z-d@dA„Z.dïdBdC„Z/dDdE„Z0dFdG„Z1dHdI„Z2dJdK„Z3dLdM„Z4dNdO„Z5dPdQ„Z6dRdS„Z7dTdU„Z8dVdW„Z9dXdY„Z:dZd[„Z;d\d]„Z<d^d_„Z=d`da„Z>dbdc„Z?ddde„Z@dfdg„ZAdhdi„ZBdjdk„ZCdldm„ZDdndo„ZEdpdq„ZFdrds„ZGdtdu„ZHdvdw„ZIdxdy„ZJdzd{„ZKd|d}„ZLd~d„ZMd€d„ZNd‚dƒ„ZOd„d…„ZPed†d‡„ƒZQeQj)ZRedˆd‰„ƒZSeSj)ZTdejUfdŠd‹„ZVdðddŽ„ZWdd„ZXdñd‘d’„ZYdòd”d•„ZZd–d—„Z[d˜d™„Z\ddejUfdšd›„Z]ddejUfdœd„Z^dždŸ„Z_dó‡fd¡d¢„    Z`ej`je`_dôd£d¤„ZadddejUfd¥d¦„Zbdõd§d¨„ZcdddejUfd©dª„ZdedZedöd«d¬„ZfdddejUf‡fd­d®„    Zgd÷d¯d°„ZhddddejUf‡fd±d²„    Ziejijei_ddddejUfd³d´„Zjdødµd¶„ZkejUddddfd·d¸„ZldùejUd¹œdºd»„ZmdúejUd¹œd¼d½„Zndûd¿dÀ„ZodddejUfdÁd„ZpdddejUfdÃdĄZqdüdÅdƄZr‡fdÇdȄZs‡fdÉdʄZtdýdËd̄Zuevd̓Zwevd΃ZxevdσZyevdЃZzevdуZ{evd҃Z|edÓdԄd7Z}evdՃZ~dþdÖdׄZdÿdØdلZ€ddÚdۄZddÞd߄Z‚dàdá„ZƒeƒZ„‡fdâdã„Z…‡fdädå„Z†dædç„Z‡ddèdé„Zˆ‡Z‰S(raz
    An array class with possibly masked values.
 
    Masked values of True exclude the corresponding element from any
    computation.
 
    Construction::
 
      x = MaskedArray(data, mask=nomask, dtype=None, copy=False, subok=True,
                      ndmin=0, fill_value=None, keep_mask=True, hard_mask=None,
                      shrink=True, order=None)
 
    Parameters
    ----------
    data : array_like
        Input data.
    mask : sequence, optional
        Mask. Must be convertible to an array of booleans with the same
        shape as `data`. True indicates a masked (i.e. invalid) data.
    dtype : dtype, optional
        Data type of the output.
        If `dtype` is None, the type of the data argument (``data.dtype``)
        is used. If `dtype` is not None and different from ``data.dtype``,
        a copy is performed.
    copy : bool, optional
        Whether to copy the input data (True), or to use a reference instead.
        Default is False.
    subok : bool, optional
        Whether to return a subclass of `MaskedArray` if possible (True) or a
        plain `MaskedArray`. Default is True.
    ndmin : int, optional
        Minimum number of dimensions. Default is 0.
    fill_value : scalar, optional
        Value used to fill in the masked values when necessary.
        If None, a default based on the data-type is used.
    keep_mask : bool, optional
        Whether to combine `mask` with the mask of the input data, if any
        (True), or to use only `mask` for the output (False). Default is True.
    hard_mask : bool, optional
        Whether to use a hard mask or not. With a hard mask, masked values
        cannot be unmasked. Default is False.
    shrink : bool, optional
        Whether to force compression of an empty mask. Default is True.
    order : {'C', 'F', 'A'}, optional
        Specify the order of the array.  If order is 'C', then the array
        will be in C-contiguous order (last-index varies the fastest).
        If order is 'F', then the returned array will be in
        Fortran-contiguous order (first-index varies the fastest).
        If order is 'A' (default), then the returned array may be
        in any order (either C-, Fortran-contiguous, or even discontiguous),
        unless a copy is required, in which case it will be C-contiguous.
 
    Examples
    --------
 
    The ``mask`` can be initialized with an array of boolean values
    with the same shape as ``data``.
 
    >>> data = np.arange(6).reshape((2, 3))
    >>> np.ma.MaskedArray(data, mask=[[False, True, False],
    ...                               [False, False, True]])
    masked_array(
      data=[[0, --, 2],
            [3, 4, --]],
      mask=[[False,  True, False],
            [False, False,  True]],
      fill_value=999999)
 
    Alternatively, the ``mask`` can be initialized to homogeneous boolean
    array with the same shape as ``data`` by passing in a scalar
    boolean value:
 
    >>> np.ma.MaskedArray(data, mask=False)
    masked_array(
      data=[[0, 1, 2],
            [3, 4, 5]],
      mask=[[False, False, False],
            [False, False, False]],
      fill_value=999999)
 
    >>> np.ma.MaskedArray(data, mask=True)
    masked_array(
      data=[[--, --, --],
            [--, --, --]],
      mask=[[ True,  True,  True],
            [ True,  True,  True]],
      fill_value=999999,
      dtype=int64)
 
    .. note::
        The recommended practice for initializing ``mask`` with a scalar
        boolean value is to use ``True``/``False`` rather than
        ``np.True_``/``np.False_``. The reason is :attr:`nomask`
        is represented internally as ``np.False_``.
 
        >>> np.False_ is np.ma.nomask
        True
 
    éFédiÜNTrc s2tj|||| d|d‰t|dtˆƒƒ} t|tƒr@|jˆjkr@d}t||ƒrj|rjt|tƒsjt     ˆt|ƒ¡‰n t     ˆ|¡‰t
|dƒr’t|tƒs’|j ˆ_ t ˆj ƒ‰|tkrn|sÊ|
r¶tˆ_ ntjˆjˆdˆ_ n t|ttfƒr8z tj‡fdd„|Dƒˆd}Wntk
rt}YnXˆtkrj| ¡rj|ˆ_ dˆ_n2| ˆ_|rڈj  ¡ˆ_ t|ƒtk    rÚ|j|j _nl|dkr”ˆtkr”tjˆjˆd}nn|dkrºˆtkrºtjˆjˆd}nHztj||ˆd    }Wn2tk
rtj‡fd
d„|Dƒˆd}YnX|jˆjkrjˆj|j} }|d kr8t |ˆj¡}n.|| krRt |ˆj¡}nd }t|| |fƒ‚d}ˆj tkr†|ˆ_ | ˆ_nT|sœ|ˆ_ | ˆ_n>ˆj jd k    rćfdd„‰ˆˆj |ƒnt |ˆj ¡ˆ_ dˆ_|d krðt|dd ƒ}|d k    rt |ˆj ƒˆ_!|    d kr"t|ddƒˆ_"n|    ˆ_"| ˆ_#ˆS)z¢
        Create a new masked array from scratch.
 
        Notes
        -----
        A masked array can also be created by taking a .view(MaskedArray).
 
        T)rr<Úorderr?ÚndminÚ
_baseclassrFrcs g|]}ttj|ˆjdƒ‘qS)r)rYrór.r©rörê)r@rÃrÄrø+ sÿz'MaskedArray.__new__.<locals>.<listcomp>Fr%csg|]}t|gtˆƒƒ‘qSrérrrô©ÚmdtyperÃrÄrøH srÅz?Mask and data not compatible: data size is %i, mask size is %i.NcsD|jjD]6}||||}}|jjdk    r6ˆ||ƒq||O}qdS)z'do a|=b on each field of a, recursivelyNr¦)r0rÜrÚafZbf)Ú _recursive_orrÃrÄrù` s
   z*MaskedArray.__new__.<locals>._recursive_orÚ _fill_valueré)$rór
ršr6r rr¨r8rrBr rFrsrr’r½rrHr'rr Ú _sharedmaskr<rXr•rÕr«r£r¢rrrpr.rúréró)r<rCrDrr<r?ròr+Ú    keep_maskÚ    hard_maskrrñróZndÚnmÚmsgrÃ)r@rùr÷rÄÚ__new__ø
ÿ 
 
 
ÿþ
 
 ÿ 
 
 
 
     
 
 
zMaskedArray.__new__c    Cs¶t|tƒrt|ƒ}nt}i}| t|diƒ¡| t|diƒ¡t|tƒs\| t|diƒ¡tt|ddƒt|ddƒt|ddƒt|d    dƒt|d
|ƒ||d }|j |¡|j |¡dS) z9
        Copies some attributes of obj to self.
 
        Ú_optinfoÚ    _basedictÚ__dict__rúNréFrûÚ_isfieldró)rúrérûrrórr)r rr6Úupdateršrr5r)rNrÖrórÚ_dictrÃrÃrÄru| s&
 
 
 
 
 
 
ú  zMaskedArray._update_fromc    CsB| |¡t|tƒr¬|jjdk    r*t|ƒ}nt|ƒ}|tk    r¢|jdd|jddkr¢|j|jkrj|j}n
t    |jƒ}|j
j r‚d}n|j
j rd}nd}|  ||¡}q°| ¡}nt}||_|jtk    rz|j|j_Wn2tk
rêt|_Ynttfk
rYnX|jdk    r"t|j|jƒ|_n|jjdk    r>td|jƒ|_dS)z.
        Finalizes the masked array.
 
        NrCrÚCÚFÚK)rur rrrrYrXr’Z__array_interface__rsÚflagsÚ c_contiguousÚ f_contiguousÚastyperBrFr¨r'rÕrArúr.)rNrÖrFZ _mask_dtyperñrÃrÃrÄÚ__array_finalize__– s>
 
 
     ÿ 
 
 
 zMaskedArray.__array_finalize__c     CsN||kr|}n| t|ƒ¡}| |¡|dk    rJ|j ¡|_|\}}}|d|j…}ttdd„|Dƒƒ}t     |d¡}    |    dk    rt
j dddt |    |Ždƒ}
W5QRX|
  ¡rzt|d} Wn4tk
rÜt|} Yntk
rô|j} YnXt
j|| |
d|tkr|
}n||
B}||k    r>|jd    kr>|r>tS||_d
|_|S) zr
        Special hook for ufuncs.
 
        Wraps the numpy array and sets the mask according to context.
 
        NcSsg|] }t|ƒ‘qSrérY)röÚargrÃrÃrÄrø sz.MaskedArray.__array_wrap__.<locals>.<listcomp>rQrrTrÆrsrÃF)rBr6rurFr<ZninrrurmrrórSrMr rnrÕrr+rtr’r¨rvrû) rNrÖÚcontextr1ÚfuncrvZout_iZ
input_argsrêrlrxr+rÃrÃrÄÚ__array_wrap__ó s:
 
 
 
 
 
zMaskedArray.__array_wrap__cCsÜ|dkr*|dkrt |¡}qt ||¡}nf|dkr‚z,t|tƒrPt ||¡}d}n t ||¡}Wqtk
r~t ||¡}YqXnt |||¡}t|ƒtk    r¨|j ¡|_t|ddƒdk    rØ|dkrÒ|dkrÊqØd|_n||_    |S)a3
 
        Return a view of the MaskedArray data.
 
        Parameters
        ----------
        dtype : data-type or ndarray sub-class, optional
            Data-type descriptor of the returned view, e.g., float32 or int16.
            The default, None, results in the view having the same data-type
            as `a`. As with ``ndarray.view``, dtype can also be specified as
            an ndarray sub-class, which then specifies the type of the
            returned object (this is equivalent to setting the ``type``
            parameter).
        type : Python type, optional
            Type of the returned view, either ndarray or a subclass.  The
            default None results in type preservation.
        fill_value : scalar, optional
            The value to use for invalid entries (None by default).
            If None, then this argument is inferred from the passed `dtype`, or
            in its absence the original array, as discussed in the notes below.
 
        See Also
        --------
        numpy.ndarray.view : Equivalent method on ndarray object.
 
        Notes
        -----
 
        ``a.view()`` is used two different ways:
 
        ``a.view(some_dtype)`` or ``a.view(dtype=some_dtype)`` constructs a view
        of the array's memory with a different data-type.  This can cause a
        reinterpretation of the bytes of memory.
 
        ``a.view(ndarray_subclass)`` or ``a.view(type=ndarray_subclass)`` just
        returns an instance of `ndarray_subclass` that looks at the same array
        (same shape, dtype, etc.)  This does not cause a reinterpretation of the
        memory.
 
        If `fill_value` is not specified, but `dtype` is specified (and is not
        an ndarray sub-class), the `fill_value` of the MaskedArray will be
        reset. If neither `fill_value` nor `dtype` are specified (or if
        `dtype` is an ndarray sub-class), then the fill value is preserved.
        Finally, if `fill_value` is specified, but `dtype` is not, the fill
        value is set to the specified value.
 
        For ``a.view(some_dtype)``, if ``some_dtype`` has a different number of
        bytes per entry than the previous dtype (for example, converting a
        regular array to a structured array), then the behavior of the view
        cannot be predicted just from the superficial appearance of ``a`` (shown
        by ``print(a)``). It also depends on exactly how ``a`` is stored in
        memory. Therefore if ``a`` is C-ordered versus fortran-ordered, versus
        defined as a slice or transpose, etc., the view may give different
        results.
        Nrú)
rrBr9rÕrXr’rFršrúr+)rNrr6r+r·rÃrÃrÄrB+ s,8 
   zMaskedArray.viewcCs¤|j|}|j}dd„}dd„}|tk    r:||}||ƒ}n(t}||j|ƒ}|dkrb|t|ƒ|ƒ}|rÈt|tjƒr‚t|||jdS|j    j
tj krºt|tj ƒrº|t k    rº|r´t|ddS|Sn |rÂt S|SnØ| t
|ƒ¡}| |¡t|ƒr‚|jdk    r||j||_t|jtj ƒstd    ƒ‚|jjd
kr||j|jjd
k ¡sbtjd |›d |jd
›d dd|jjd
d…jd
d|_d|_|tk    r t||jƒ|_d|_|S)zi
        x.__getitem__(y) <==> x[y]
 
        Return the item described by i, as a masked array.
 
        cSst|tjƒ Srý)r rórr›rÃrÃrÄÚ
_is_scalar“ sz+MaskedArray.__getitem__.<locals>._is_scalarcSsHt|tjƒsdS|jjtjkr0|j|jk    rDdSnt|ƒjtjkrDdSdS)z 
            Return whether `elem` is a scalar result of indexing `arr`, or None
            if undecidable without promoting nomask to a full mask
            TFN)r rórrr6Úobject_rè)rÌÚelemrÃrÃrÄÚ_scalar_heuristic– s  z2MaskedArray.__getitem__.<locals>._scalar_heuristicNræTr¥zInternal NumPy error.rz&Upon accessing multidimensional field zi, need to keep dimensionality of fill_value at 0. Discarding heterogeneous fill_value and setting all to rérÈrÅ©rŠ)rCrFr’rYr rór&rrérr6rrrvrrBrurKrúÚ RuntimeErrorrrãrrÊrËr°rr¢r¨rû)rNrêZdoutrFrrZmoutZscalar_expectedrÃrÃrÄrè… s\
 
 
ÿþ 
 
      
ÿ
ú
 
zMaskedArray.__getitem__rQ)ZoverrGc Cs|tkrtdƒ‚|j}|j}t|tƒrZ|||<|tkrJt|j|j    ƒ|_}t
|ƒ||<dS|j    }|tkr²|tkr‚t|j|ƒ}|_|j dk    r¦t dgt |j ƒƒ||<nd||<dSt|d|ƒ}t
|ƒ}|j dk    rì|tkrìt dgt |j ƒƒ}|tkr$|||<|tk    rt|j|ƒ}|_|||<nà|jsbt|tƒrPt|tƒsP|||j<n|||<|||<n¢t|dƒr’|j    tkr’|t |¡}|||<nr|j dk    rªd}t|ƒ‚t|||dd}    |j|}
|
jd    krætj|
||    d
n|    tkrô|}
|
||<|    ||<dS) z‹
        x.__setitem__(i, y) <==> x[i]=y
 
        Set item described by index. If value is masked, masks those
        locations.
 
        z Cannot alter the masked element.NTr@Frz,Flexible 'hard' masks are not yet supported.r‡rÅrs)rvrr@rFr rr’rtr¨rrXrrrršrérwrCr rrTroÚNotImplementedErrorrur«rórt) rNrêr¶r@rFZ_dtypeÚdvalZmvalr-ZmindxZdindxrÃrÃrÄrì sb    
 
 
 
 
 ÿ 
 
 
 
zMaskedArray.__setitem__cstƒjSrý)rjrrgrorÃrÄrM szMaskedArray.dtypec    sbttt|ƒƒj ||¡|jtk    r^|j t|ƒt    ¡|_z|j
|j_
Wnt t fk
r\YnXdSrý) rjrr6rÚ__set__rFr’rBrsrr¨rArÕ)rNrrorÃrÄrQ s
cstƒjSrý)rjr¨rgrorÃrÄr¨] szMaskedArray.shapecs2ttt|ƒƒj ||¡t|ƒtk    r.|j|j_dSrý)rjrr6r¨rrXr’rF)rNr¨rorÃrÄr¨a s cs„|j}|j}|tkrd}|tkr>|tkr,dSt|j|ƒ}|_|jdkr€|jrX||O}n&t|t    t
t j t j fƒrx||d<n||_nð|j‰t j|dd}|jsÔ|jjdkrÈt jt| ¡gtˆƒƒˆd}n
| ˆ¡}nHzt j||ˆd}Wn2tk
rt j‡fd    d
„|Dƒˆd}YnX|jrH|jD]}||||O<q*n(t|t    t
t j t j fƒrj||d<n||_|jr€|j|_dS) z 
        Set the mask.
 
        TN.Fr‡rÜrr%csg|]}t|gtˆƒƒ‘qSrÃrõrôrörÃrÄrø› sz+MaskedArray.__setmask__.<locals>.<listcomp>)rrFrvr’rtr¨rrér Úintr_rórÚnumberrãr
rrrr!rr rÕ)rNrDr<ZidtypeZ current_maskÚnrÃrörÄrÛi sJ
 
 
 ÿ ÿ 
 
zMaskedArray.__setmask__cCs
|j ¡S)z Current mask. )rFrBrgrÃrÃrÄrD° szMaskedArray.maskcCs| |¡dSrý)rÛ)rNr¶rÃrÃrÄrDº scCs.|j t¡}|jjdkr|Stjt|ƒddS)aí
        Get or set the mask of the array if it has no named fields. For
        structured arrays, returns a ndarray of booleans where entries are
        ``True`` if **all** the fields are masked, ``False`` otherwise:
 
        >>> x = np.ma.array([(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)],
        ...         mask=[(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)],
        ...        dtype=[('a', int), ('b', int)])
        >>> x.recordmask
        array([False, False,  True, False, False])
        NrÆr)rFrBrrrrórrP)rNrFrÃrÃrÄÚ
recordmask¾ s  zMaskedArray.recordmaskcCs tdƒ‚dS)Nz*Coming soon: setting the mask per records!©r)rNrDrÃrÃrÄr!Ñ scCs
d|_|S)a
        Force the mask to hard, preventing unmasking by assignment.
 
        Whether the mask of a masked array is hard or soft is determined by
        its `~ma.MaskedArray.hardmask` property. `harden_mask` sets
        `~ma.MaskedArray.hardmask` to ``True`` (and returns the modified
        self).
 
        See Also
        --------
        ma.MaskedArray.hardmask
        ma.MaskedArray.soften_mask
 
        T©rérgrÃrÃrÄr\Õ szMaskedArray.harden_maskcCs
d|_|S)a¦
        Force the mask to soft (default), allowing unmasking by assignment.
 
        Whether the mask of a masked array is hard or soft is determined by
        its `~ma.MaskedArray.hardmask` property. `soften_mask` sets
        `~ma.MaskedArray.hardmask` to ``False`` (and returns the modified
        self).
 
        See Also
        --------
        ma.MaskedArray.hardmask
        ma.MaskedArray.harden_mask
 
        Fr#rgrÃrÃrÄr¬ç szMaskedArray.soften_maskcCs|jS)aü
        Specifies whether values can be unmasked through assignments.
 
        By default, assigning definite values to masked array entries will
        unmask them.  When `hardmask` is ``True``, the mask will not change
        through assignments.
 
        See Also
        --------
        ma.MaskedArray.harden_mask
        ma.MaskedArray.soften_mask
 
        Examples
        --------
        >>> x = np.arange(10)
        >>> m = np.ma.masked_array(x, x>5)
        >>> assert not m.hardmask
 
        Since `m` has a soft mask, assigning an element value unmasks that
        element:
 
        >>> m[8] = 42
        >>> m
        masked_array(data=[0, 1, 2, 3, 4, 5, --, --, 42, --],
                     mask=[False, False, False, False, False, False,
                           True, True, False, True],
               fill_value=999999)
 
        After hardening, the mask is not affected by assignments:
 
        >>> hardened = np.ma.harden_mask(m)
        >>> assert m.hardmask and hardened is m
        >>> m[:] = 23
        >>> m
        masked_array(data=[23, 23, 23, 23, 23, 23, --, --, 23, --],
                     mask=[False, False, False, False, False, False,
                           True, True, False, True],
               fill_value=999999)
 
        r#rgrÃrÃrÄrçù s*zMaskedArray.hardmaskcCs|jr|j ¡|_d|_|S)aY
        Copy the mask and set the `sharedmask` flag to ``False``.
 
        Whether the mask is shared between masked arrays can be seen from
        the `sharedmask` property. `unshare_mask` ensures the mask is not
        shared. A copy of the mask is only made if it was shared.
 
        See Also
        --------
        sharedmask
 
        F)rûrFr<rgrÃrÃrÄÚ unshare_mask%s  zMaskedArray.unshare_maskcCs|jS)z' Share status of the mask (read-only). )rûrgrÃrÃrÄÚ
sharedmask7szMaskedArray.sharedmaskcCst|jƒ|_|S)a
        Reduce a mask to nomask when possible.
 
        Parameters
        ----------
        None
 
        Returns
        -------
        None
 
        Examples
        --------
        >>> x = np.ma.array([[1,2 ], [3, 4]], mask=[0]*4)
        >>> x.mask
        array([[False, False],
               [False, False]])
        >>> x.shrink_mask()
        masked_array(
          data=[[1, 2],
                [3, 4]],
          mask=False,
          fill_value=999999)
        >>> x.mask
        False
 
        )rœrFrgrÃrÃrÄrÂ<s zMaskedArray.shrink_maskcCs|jS)z+ Class of the underlying data (read-only). )rórgrÃrÃrÄÚ    baseclass[szMaskedArray.baseclasscCst ||j¡S)aª
        Returns the underlying data, as a view of the masked array.
 
        If the underlying data is a subclass of :class:`numpy.ndarray`, it is
        returned as such.
 
        >>> x = np.ma.array(np.matrix([[1, 2], [3, 4]]), mask=[[0, 1], [1, 0]])
        >>> x.data
        matrix([[1, 2],
                [3, 4]])
 
        The type of the data can be accessed through the :attr:`baseclass`
        attribute.
        )rrBrórgrÃrÃrÄÚ    _get_data`szMaskedArray._get_data)ÚfgetcCst|ƒS)zF Return a flat iterator, or set a flattened version of self to value. )rârgrÃrÃrÄrãtszMaskedArray.flatcCs| ¡}||dd…<dSrý)rŸ)rNr¶ÚyrÃrÃrÄrãyscCs4|jdkrtd|jƒ|_t|jtƒr.|jdS|jS)a¥
        The filling value of the masked array is a scalar. When setting, None
        will set to a default based on the data type.
 
        Examples
        --------
        >>> for dt in [np.int32, np.int64, np.float64, np.complex128]:
        ...     np.ma.array([0, 1], dtype=dt).get_fill_value()
        ...
        999999
        999999
        1e+20
        (1e+20+0j)
 
        >>> x = np.ma.array([0, 1.], fill_value=-np.inf)
        >>> x.fill_value
        -inf
        >>> x.fill_value = np.pi
        >>> x.fill_value
        3.1415926535897931 # may vary
 
        Reset to default:
 
        >>> x.fill_value = None
        >>> x.fill_value
        1e+20
 
        NrÃ)rúr.rr rrgrÃrÃrÄr+~s
 
 
zMaskedArray.fill_valuecCsHt||jƒ}|jdks&tjdtdd|j}|dkr<||_n||d<dS)Nrz™Non-scalar arrays for the fill value are deprecated. Use arrays with scalar values instead. The filled function still supports any array as `fill_value`.rrÈrÃ)r.rrrÊrËÚDeprecationWarningrú)rNr¶r‰rúrÃrÃrÄr+§s 
üc    Cs|j}|tkr|jS|dkr$|j}n t||jƒ}|tkrBt |¡S|jj    dk    rj|j 
d¡}t ||j|ƒn¬|  ¡sx|jS|j 
d¡}ztj |||dWn|ttfk
rÖt|td}| t¡}t |||f¡}Yn@tk
r|jjrò‚n|r
tj||jd}n|j}YnX|S)a«
        Return a copy of self, with masked values filled with a given value.
        **However**, if there are no masked values to fill, self will be
        returned instead as an ndarray.
 
        Parameters
        ----------
        fill_value : array_like, optional
            The value to use for invalid entries. Can be scalar or non-scalar.
            If non-scalar, the resulting ndarray must be broadcastable over
            input array. Default is None, in which case, the `fill_value`
            attribute of the array is used instead.
 
        Returns
        -------
        filled_array : ndarray
            A copy of ``self`` with invalid entries replaced by *fill_value*
            (be it the function argument or the attribute of ``self``), or
            ``self`` itself as an ndarray if there are no invalid entries to
            be replaced.
 
        Notes
        -----
        The result is **not** a MaskedArray!
 
        Examples
        --------
        >>> x = np.ma.array([1,2,3,4,5], mask=[0,0,1,0,1], fill_value=-999)
        >>> x.filled()
        array([   1,    2, -999,    4, -999])
        >>> x.filled(fill_value=1000)
        array([   1,    2, 1000,    4, 1000])
        >>> type(x.filled())
        <class 'numpy.ndarray'>
 
        Subclassing is preserved. This means that if, e.g., the data part of
        the masked array is a recarray, `filled` returns a recarray:
 
        >>> x = np.array([(-1, 2), (-3, 4)], dtype='i8,i8').view(np.recarray)
        >>> m = np.ma.array(x, mask=[(True, False), (False, True)])
        >>> m.filled()
        rec.array([(999999,      2), (    -3, 999999)],
                  dtype=[('f0', '<i8'), ('f1', '<i8')])
        Nr    rsr)rFr’r@r+r.rrƒrór.rr<rÐr rtrÕrAÚnarrayr(r r4r³r¨r
)rNr+rêr1rxrÃrÃrÄrM¾s6- 
 
 zMaskedArray.filledcCs2t |j¡}|jtk    r.| t t |j¡¡¡}|S)aÛ
        Return all the non-masked data as a 1-D array.
 
        Returns
        -------
        data : ndarray
            A new `ndarray` holding the non-masked data is returned.
 
        Notes
        -----
        The result is **not** a MaskedArray!
 
        Examples
        --------
        >>> x = np.ma.array(np.arange(5), mask=[0]*2 + [1]*3)
        >>> x.compressed()
        array([0, 1])
        >>> type(x.compressed())
        <class 'numpy.ndarray'>
 
        )rrŸr@rFr’r7róro)rNrCrÃrÃrÄr8s 
zMaskedArray.compressedcCsX|j|j}}t |¡}|j|||d t|ƒ¡}| |¡|tk    rT|j||d|_|S)a+
        Return `a` where condition is ``True``.
 
        If condition is a `~ma.MaskedArray`, missing values are considered
        as ``False``.
 
        Parameters
        ----------
        condition : var
            Boolean 1-d array selecting which entries to return. If len(condition)
            is less than the size of a along the axis, then output is truncated
            to length of condition array.
        axis : {None, int}, optional
            Axis along which the operation must be performed.
        out : {None, ndarray}, optional
            Alternative output array in which to place the result. It must have
            the same shape as the expected output but the type will be cast if
            necessary.
 
        Returns
        -------
        result : MaskedArray
            A :class:`~ma.MaskedArray` object.
 
        Notes
        -----
        Please note the difference with :meth:`compressed` !
        The output of :meth:`compress` has a mask, the output of
        :meth:`compressed` does not.
 
        Examples
        --------
        >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
        >>> x
        masked_array(
          data=[[1, --, 3],
                [--, 5, --],
                [7, --, 9]],
          mask=[[False,  True, False],
                [ True, False,  True],
                [False,  True, False]],
          fill_value=999999)
        >>> x.compress([1, 0, 1])
        masked_array(data=[1, 3],
                     mask=[False, False],
               fill_value=999999)
 
        >>> x.compress([1, 0, 1], axis=1)
        masked_array(
          data=[[1, 3],
                [--, --],
                [7, 9]],
          mask=[[False, False],
                [ True,  True],
                [False, False]],
          fill_value=999999)
 
        ©rŠrÚr)    r@rFrór/r7rBr6rur’)rNr´rŠrÚr@rFZ_newrÃrÃrÄr7)s<
 
zMaskedArray.compressc    Csôt ¡rä|j}|tkr|j}qð|j}|jdkr4|jn|j}t|jƒD]z}|j    ||krD|d}t
j ||| f|d}t
j |d|df|d}t
j ||| f|d}t
j |d|df|d}qDt |jdƒ}| |¡}t||tƒn | |j¡}|S)zq
        Replace masked values with masked_print_option, casting all innermost
        dtypes to object.
        rÅrrrrà)r‚rÌrFr’r@rÚ _print_widthÚ_print_width_1dÚranger¨rórÐr9r™rr rÏrMr+)    rNrDrÄrCZ print_widthrŠÚindrÌÚrdtyperÃrÃrÄÚ_insert_masked_printqs(ÿ 
 z MaskedArray._insert_masked_printcCs t| ¡ƒSrý)rr2rgrÃrÃrÄrhszMaskedArray.__str__c s|jtjkrd}n|jj}tjj ¡dkrš|jdk}t|dt    |ƒt
|ƒt
|j ƒt
|j ƒt
|j ƒd}t|j jƒ}d |r~dnd|rˆd    nd
¡}t||Sd |›d }tjj |j ¡ pÌt |j¡pÌ|jd k}dddg}|ræ| d¡t dd„|jdd…Dƒ¡}    d‰|    rdi‰|ˆ|d <|dd…D]2}
t ˆt    ||d ƒt    |
ƒ¡} d| ˆ|
<q*d}n‡fdd„|Dƒ‰|d}i‰tj| ¡dˆddddˆd<tj|j dˆddddˆd<t|j ƒˆd<|rìtjj |j ¡ˆd<d  ‡‡fd!d„|Dƒ¡} || d"S)#z1
        Literal string representation.
 
        r
éqrÅú )rÚnlenrCrDrkrz{}_{}rÚshortZflxr±Zmasked_ú(rrCrDr+rcss|]}|dkVqdS)rÅNrÃ)röZdimrÃrÃrÄr¾sz'MaskedArray.__repr__.<locals>.<genexpr>NrÆrrÎcsi|]}|dˆ“qS)r4rÃrõ)Ú
min_indentrÃrÄÚ
<dictcomp>Ísz(MaskedArray.__repr__.<locals>.<dictcomp>Ú
z, zdata=ú,)Ú    separatorÚprefixÚsuffixzmask=z,
c3s$|]}d ˆ||ˆ|¡VqdS)z{}{}={}N)Úformatrõ)ÚindentsÚreprsrÃrÄrásÿú))rórórrÀÚcoreZ
arrayprintZ_get_legacy_print_moderr5rrrFr+rr¯rr?Ú_legacy_print_templatesZdtype_is_impliedrrDr«r!rIr¨r†Z array2stringr2ÚreprZdtype_short_reprrÓ) rNrZis_longÚ
parametersZ is_structuredÚkeyr=Z dtype_neededÚkeysZ
is_one_rowr÷r r1rÃ)r@r8rArÄrΓsv 
 
ú 
 
þ  
ÿý
 
  
ü
 
ü
þzMaskedArray.__repr__cCsHt|t|ƒƒrdSt|ddƒ}|dkr<t|ddƒ}|j|kS|dkSdS)NFZ__array_ufunc__Ú__array_priority__iÀ½ðÿ)r r6ršrI)rNÚotherZ array_ufuncZother_priorityrÃrÃrÄÚ_delegate_binopçs  
zMaskedArray._delegate_binopc     Csjt|ƒ}|j}t||dd}t|ƒ}|jjdk    r†|tjtjfkrDt    St
  ||¡j }t
j ||dd}||_| |¡}    |t
 d|j¡k}n|j}    ||    |ƒ}
t|
t
jtfƒr²|r®tS|
S|tk    rü|tjtjfkrüt
 ||||ƒ|
¡}
|j |
j krüt
  ||
j ¡ ¡}|
 t|ƒ¡}
|
 |¡||
_|
jdk    rfzt|
jt
jƒ} Wn&ttfk
r^tdt
jƒ} YnX| |
_|
S)aùCompare self with other using operator.eq or operator.ne.
 
        When either of the elements is masked, the result is masked as well,
        but the underlying boolean data are still set, with self and other
        considered equal if both are masked, and unequal otherwise.
 
        For structured arrays, all fields are combined, with masked values
        ignored. The result is masked if all fields were masked, with self
        and other considered equal only if both were fully masked.
        Tr‡N©r?rÃ) rXrDrurWrrÚoperatorÚeqÚneÚNotImplementedrór¤r¨Z broadcast_torFrMr•rCr rr¯rvr’r¼r<rBr6rurúr.rÕr') rNrJÚcompareZomaskZsmaskrDÚodataZbroadcast_shapeZ
sbroadcastZsdataÚcheckrkrÃrÃrÄÚ _comparisonõs<  
 
 
 zMaskedArray._comparisoncCs| |tj¡S)aìCheck whether other equals self elementwise.
 
        When either of the elements is masked, the result is masked as well,
        but the underlying boolean data are still set, with self and other
        considered equal if both are masked, and unequal otherwise.
 
        For structured arrays, all fields are combined, with masked values
        ignored. The result is masked if all fields were masked, with self
        and other considered equal only if both were fully masked.
        )rTrMrN©rNrJrÃrÃrÄÚ__eq__:s zMaskedArray.__eq__cCs| |tj¡S)aôCheck whether other does not equal self elementwise.
 
        When either of the elements is masked, the result is masked as well,
        but the underlying boolean data are still set, with self and other
        considered equal if both are masked, and unequal otherwise.
 
        For structured arrays, all fields are combined, with masked values
        ignored. The result is masked if all fields were masked, with self
        and other considered equal only if both were fully masked.
        )rTrMrOrUrÃrÃrÄÚ__ne__Gs zMaskedArray.__ne__cCs| |tj¡Srý)rTrMÚlerUrÃrÃrÄÚ__le__UszMaskedArray.__le__cCs| |tj¡Srý)rTrMÚltrUrÃrÃrÄÚ__lt__XszMaskedArray.__lt__cCs| |tj¡Srý)rTrMÚgerUrÃrÃrÄÚ__ge__[szMaskedArray.__ge__cCs| |tj¡Srý)rTrMÚgtrUrÃrÃrÄÚ__gt__^szMaskedArray.__gt__cCs| |¡rtSt||ƒS)zD
        Add self to other, and return a new masked array.
 
        )rKrPrrUrÃrÃrÄÚ__add__as
zMaskedArray.__add__cCs
t||ƒS)zD
        Add other to self, and return a new masked array.
 
        )rrUrÃrÃrÄÚ__radd__jszMaskedArray.__radd__cCs| |¡rtSt||ƒS)zK
        Subtract other from self, and return a new masked array.
 
        )rKrPr²rUrÃrÃrÄÚ__sub__ss
zMaskedArray.__sub__cCs
t||ƒS)zK
        Subtract self from other, and return a new masked array.
 
        )r²rUrÃrÃrÄÚ__rsub__|szMaskedArray.__rsub__cCs| |¡rtSt||ƒS)z6Multiply self by other, and return a new masked array.)rKrPrŽrUrÃrÃrÄÚ__mul__ƒs
zMaskedArray.__mul__cCs
t||ƒS)zI
        Multiply other by self, and return a new masked array.
 
        )rŽrUrÃrÃrÄÚ__rmul__‰szMaskedArray.__rmul__cCs| |¡rtSt||ƒS©zI
        Divide other into self, and return a new masked array.
 
        )rKrPrGrUrÃrÃrÄÚ__div__’s
zMaskedArray.__div__cCs| |¡rtSt||ƒSrf)rKrPrºrUrÃrÃrÄÚ __truediv__›s
zMaskedArray.__truediv__cCs
t||ƒS©zI
        Divide self into other, and return a new masked array.
 
        )rºrUrÃrÃrÄÚ __rtruediv__¤szMaskedArray.__rtruediv__cCs| |¡rtSt||ƒSrf)rKrPrRrUrÃrÃrÄÚ __floordiv__«s
zMaskedArray.__floordiv__cCs
t||ƒSri)rRrUrÃrÃrÄÚ __rfloordiv__´szMaskedArray.__rfloordiv__cCs| |¡rtSt||ƒS)zQ
        Raise self to the power other, masking the potential NaNs/Infs
 
        )rKrPr™rUrÃrÃrÄÚ__pow__»s
zMaskedArray.__pow__cCs
t||ƒS)zQ
        Raise other to the power self, masking the potential NaNs/Infs
 
        )r™rUrÃrÃrÄÚ__rpow__ÄszMaskedArray.__rpow__cCsˆt|ƒ}|jtkrB|tk    rX| ¡rXt|j|jƒ|_|j|7_n|tk    rX|j|7_t|ƒ}t     |j|j 
d¡|¡}|j   |¡|S)z.
        Add other to self in-place.
 
        r) rXrFr’r rtr¨rrWrór¼r6r@Ú__iadd__©rNrJrêÚ
other_datarÃrÃrÄroËs
 zMaskedArray.__iadd__cCsˆt|ƒ}|jtkrB|tk    rX| ¡rXt|j|jƒ|_|j|7_n|tk    rX|j|7_t|ƒ}t     |j|j 
d¡|¡}|j   |¡|S)z5
        Subtract other from self in-place.
 
        r) rXrFr’r rtr¨rrWrór¼r6r@Ú__isub__rprÃrÃrÄrrÝs
 zMaskedArray.__isub__cCsˆt|ƒ}|jtkrB|tk    rX| ¡rXt|j|jƒ|_|j|7_n|tk    rX|j|7_t|ƒ}t     |j|j 
d¡|¡}|j   |¡|S)z3
        Multiply self by other in-place.
 
        rÅ) rXrFr’r rtr¨rrWrór¼r6r@Ú__imul__rprÃrÃrÄrsîs
 zMaskedArray.__imul__cCsŒt|ƒ}tƒ |j|¡}t|ƒ}t||ƒ}| ¡rVttj    \}}t 
||j   |¡|¡}|j |O_ t 
|j |j   d¡|¡}|j |¡|S)z1
        Divide self by other in-place.
 
        rÅ)rWr]rWr@rXrur rnrórGr¼rr6rFÚ__idiv__©rNrJrqZdom_maskÚ
other_maskÚnew_maskr®r$rÃrÃrÄrtÿs
 
ÿ zMaskedArray.__idiv__cCsŒt|ƒ}tƒ |j|¡}t|ƒ}t||ƒ}| ¡rVttj    \}}t 
||j   |¡|¡}|j |O_ t 
|j |j   d¡|¡}|j |¡|S)z7
        Floor divide self by other in-place.
 
        rÅ)rWr]rWr@rXrur rnrórRr¼rr6rFÚ __ifloordiv__rurÃrÃrÄrxs
 
ÿ zMaskedArray.__ifloordiv__cCsŒt|ƒ}tƒ |j|¡}t|ƒ}t||ƒ}| ¡rVttj    \}}t 
||j   |¡|¡}|j |O_ t 
|j |j   d¡|¡}|j |¡|S)z6
        True divide self by other in-place.
 
        rÅ)rWr]rWr@rXrur rnrórºr¼rr6rFÚ __itruediv__rurÃrÃrÄry%s
 
ÿ zMaskedArray.__itruediv__c    Cs¸t|ƒ}t |j|j d¡|¡}t|ƒ}tjddd|j     |¡W5QRXt 
t  |j¡¡}|  ¡rœ|jt k    r‚|j|O_n||_tj|j|j|dt||ƒ}t|j|ƒ|_|S)z;
        Raise self to the power other, in place.
 
        rÅrQrrrs)rWrór¼rFrr6rXrSr@Ú__ipow__rorEr r’rtr+ru)rNrJrqrvrGrwrÃrÃrÄrz8s
 
zMaskedArray.__ipow__cCs:|jdkrtdƒ‚n|jr.tjdddtjSt| ¡ƒS)z$
        Convert to float.
 
        rÅú7Only length-1 arrays can be converted to Python scalarsz,Warning: converting a masked element to nan.rrÈ)    r«rÕrFrÊrËróÚnanr_r!rgrÃrÃrÄÚ    __float__Ms 
 
zMaskedArray.__float__cCs.|jdkrtdƒ‚n|jr"tdƒ‚t| ¡ƒS)z"
        Convert to int.
 
        rÅr{z.Cannot convert masked element to a Python int.)r«rÕrFrrr!rgrÃrÃrÄÚ__int__Zs
 
 
zMaskedArray.__int__cCs"|jj t|ƒ¡}| |j¡|S)aº
        The imaginary part of the masked array.
 
        This property is a view on the imaginary part of this `MaskedArray`.
 
        See Also
        --------
        real
 
        Examples
        --------
        >>> x = np.ma.array([1+1.j, -2j, 3.45+1.6j], mask=[False, True, False])
        >>> x.imag
        masked_array(data=[1.0, --, 1.6],
                     mask=[False,  True, False],
               fill_value=1e+20)
 
        )r@ÚimagrBr6rÛrF©rNr1rÃrÃrÄrfs zMaskedArray.imagcCs"|jj t|ƒ¡}| |j¡|S)a±
        The real part of the masked array.
 
        This property is a view on the real part of this `MaskedArray`.
 
        See Also
        --------
        imag
 
        Examples
        --------
        >>> x = np.ma.array([1+1.j, -2j, 3.45+1.6j], mask=[False, True, False])
        >>> x.real
        masked_array(data=[1.0, --, 3.45],
                     mask=[False,  True, False],
               fill_value=1e+20)
 
        )r@ÚrealrBr6rÛrFr€rÃrÃrÄrs zMaskedArray.realc    sZ|tjkrind|i}|j}t|jtjƒrT|tkrDtj|jtj    d}| 
t |jƒ¡}|tkr2|jdkr„|dkr€tj ||j d‚dS|dkr´| dd¡r®tj|jtj|j d    S|jSt||j ƒ‰d}ˆD]}||j|9}qÈ| dd¡rt|jƒ}ˆD] }d||<qøn‡fd
d „t|jƒDƒ}tj||tjdS|tkr@d S|jf|tjd œ|—ŽS)a
        Count the non-masked elements of the array along the given axis.
 
        Parameters
        ----------
        axis : None or int or tuple of ints, optional
            Axis or axes along which the count is performed.
            The default, None, performs the count over all
            the dimensions of the input array. `axis` may be negative, in
            which case it counts from the last to the first axis.
 
            .. versionadded:: 1.10.0
 
            If this is a tuple of ints, the count is performed on multiple
            axes, instead of a single axis or all the axes as before.
        keepdims : bool, optional
            If this is set to True, the axes which are reduced are left
            in the result as dimensions with size one. With this option,
            the result will broadcast correctly against the array.
 
        Returns
        -------
        result : ndarray or scalar
            An array with the same shape as the input array, with the specified
            axis removed. If the array is a 0-d array, or if `axis` is None, a
            scalar is returned.
 
        See Also
        --------
        ma.count_masked : Count masked elements in array or along a given axis.
 
        Examples
        --------
        >>> import numpy.ma as ma
        >>> a = ma.arange(6).reshape((2, 3))
        >>> a[1, :] = ma.masked
        >>> a
        masked_array(
          data=[[0, 1, 2],
                [--, --, --]],
          mask=[[False, False, False],
                [ True,  True,  True]],
          fill_value=999999)
        >>> a.count()
        3
 
        When the `axis` keyword is specified an array of appropriate size is
        returned.
 
        >>> a.count(axis=0)
        array([1, 1, 1])
        >>> a.count(axis=1)
        array([3, 0])
 
        r°rréNr)rŠrrÅNF)rròcsg|]\}}|ˆkr|‘qSrÃrÃ)rör rx©ÚaxesrÃrÄrøôsÿz%MaskedArray.count.<locals>.<listcomp>r©rŠr)rór    rFr rCZmatrixr’r½r¨rrBr6Z    AxisErrorrrr
r«ZintprrHÚ    enumeraterrvr³)    rNrŠr°rwrêÚitemsZaxZout_dimsr0rÃrƒrÄr@œs88
 
 
 
zMaskedArray.countrcCsn|dkr|jjjrdnd}tj|j|d t|ƒ¡}| |¡|jt    k    rdtj|j|d 
|j ¡|_nt    |_|S)af
        Returns a 1D version of self, as a view.
 
        Parameters
        ----------
        order : {'C', 'F', 'A', 'K'}, optional
            The elements of `a` are read using this index order. 'C' means to
            index the elements in C-like order, with the last axis index
            changing fastest, back to the first axis index changing slowest.
            'F' means to index the elements in Fortran-like index order, with
            the first index changing fastest, and the last index changing
            slowest. Note that the 'C' and 'F' options take no account of the
            memory layout of the underlying array, and only refer to the order
            of axis indexing.  'A' means to read the elements in Fortran-like
            index order if `m` is Fortran *contiguous* in memory, C-like order
            otherwise.  'K' means to read the elements in the order they occur
            in memory, except for reversing the data when strides are negative.
            By default, 'C' index order is used.
            (Masked arrays currently use 'A' on the data when 'K' is passed.)
 
        Returns
        -------
        MaskedArray
            Output view is of shape ``(self.size,)`` (or
            ``(np.ma.product(self.shape),)``).
 
        Examples
        --------
        >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
        >>> x
        masked_array(
          data=[[1, --, 3],
                [--, 5, --],
                [7, --, 9]],
          mask=[[False,  True, False],
                [ True, False,  True],
                [False,  True, False]],
          fill_value=999999)
        >>> x.ravel()
        masked_array(data=[1, --, 3, --, 5, --, 7, --, 9],
                     mask=[False,  True, False,  True, False,  True, False,  True,
                           False],
               fill_value=999999)
 
        ZkKaArr©rñ) r@r
ÚfncrrŸrBr6rurFr’r¢r¨)rNrñÚrrÃrÃrÄrŸÿs3
 
zMaskedArray.ravelcOsV|j| dd¡d|jj||Ž t|ƒ¡}| |¡|j}|tk    rR|j||Ž|_|S)aÏ
        Give a new shape to the array without changing its data.
 
        Returns a masked array containing the same data, but with a new shape.
        The result is a view on the original array; if this is not possible, a
        ValueError is raised.
 
        Parameters
        ----------
        shape : int or tuple of ints
            The new shape should be compatible with the original shape. If an
            integer is supplied, then the result will be a 1-D array of that
            length.
        order : {'C', 'F'}, optional
            Determines whether the array data should be viewed as in C
            (row-major) or FORTRAN (column-major) order.
 
        Returns
        -------
        reshaped_array : array
            A new view on the array.
 
        See Also
        --------
        reshape : Equivalent function in the masked array module.
        numpy.ndarray.reshape : Equivalent method on ndarray object.
        numpy.reshape : Equivalent function in the NumPy module.
 
        Notes
        -----
        The reshaping operation cannot guarantee that a copy will not be made,
        to modify the shape in place, use ``a.shape = s``
 
        Examples
        --------
        >>> x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1])
        >>> x
        masked_array(
          data=[[--, 2],
                [3, --]],
          mask=[[ True, False],
                [False,  True]],
          fill_value=999999)
        >>> x = x.reshape((4,1))
        >>> x
        masked_array(
          data=[[--],
                [2],
                [3],
                [--]],
          mask=[[ True],
                [False],
                [False],
                [ True]],
          fill_value=999999)
 
        rñrrˆ)    rrr@r¢rBr6rurFr’)rNrërwr1rDrÃrÃrÄr¢=s:
zMaskedArray.reshapecCsd}t|ƒ‚dS)av
        .. warning::
 
            This method does nothing, except raise a ValueError exception. A
            masked array does not own its data and therefore cannot safely be
            resized in place. Use the `numpy.ma.resize` function instead.
 
        This method is difficult to implement safely and may be deprecated in
        future releases of NumPy.
 
        zoA masked array does not own its data and therefore cannot be resized.
Use the numpy.ma.resize function instead.N)r')rNržZrefcheckrñÚerrmsgrÃrÃrÄr£s zMaskedArray.resizeÚraisecCsÐ|jrT|jtk    rT|j|}t|dd}t|ddd}| |j¡||}||}|jj|||d|jtkr€t|ƒtkr€dSt    |ƒ}t|ƒtkr¦|j|d|dn|j||j|dt
|ddd}||_dS)aD
        Set storage-indexed locations to corresponding values.
 
        Sets self._data.flat[n] = values[n] for each n in indices.
        If `values` is shorter than `indices` then it will repeat.
        If `values` has some masked values, the initial mask is updated
        in consequence, else the corresponding values are unmasked.
 
        Parameters
        ----------
        indices : 1-D array_like
            Target indices, interpreted as integers.
        values : array_like
            Values to place in self._data copy at target indices.
        mode : {'raise', 'wrap', 'clip'}, optional
            Specifies how out-of-bounds indices will behave.
            'raise' : raise an error.
            'wrap' : wrap around.
            'clip' : clip to the range.
 
        Notes
        -----
        `values` can be a scalar or length 1 array.
 
        Examples
        --------
        >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
        >>> x
        masked_array(
          data=[[1, --, 3],
                [--, 5, --],
                [7, --, 9]],
          mask=[[False,  True, False],
                [ True, False,  True],
                [False,  True, False]],
          fill_value=999999)
        >>> x.put([0,4,8],[10,20,30])
        >>> x
        masked_array(
          data=[[10, --, 3],
                [--, 20, --],
                [7, --, 30]],
          mask=[[False,  True, False],
                [ True, False,  True],
                [False,  True, False]],
          fill_value=999999)
 
        >>> x.put(4,999)
        >>> x
        masked_array(
          data=[[10, --, 3],
                [--, 999, --],
                [7, --, 30]],
          mask=[[False,  True, False],
                [ True, False,  True],
                [False,  True, False]],
          fill_value=999999)
 
        Fr‡Tr>©ÚmodeNr£) rérFr’r+r£r¨r@rrXrYrr)rNr`ÚvaluesrŽrDrêrÃrÃrÄr‘s"=
 
 
 zMaskedArray.putcCs,|jtkr|jjttƒfS|jj|jjjfS)a
        Return the addresses of the data and mask areas.
 
        Parameters
        ----------
        None
 
        Examples
        --------
        >>> x = np.ma.array([1, 2, 3], mask=[0, 1, 1])
        >>> x.ids()
        (166670640, 166659832) # may vary
 
        If the array has no mask, the address of `nomask` is returned. This address
        is typically not close to the data in memory:
 
        >>> x = np.ma.array([1, 2, 3])
        >>> x.ids()
        (166691080, 3083169284) # may vary
 
        )rFr’ÚctypesrCÚidrgrÃrÃrÄr_æs
zMaskedArray.idscCs
|jdS)aý
        Return a boolean indicating whether the data is contiguous.
 
        Parameters
        ----------
        None
 
        Examples
        --------
        >>> x = np.ma.array([1, 2, 3])
        >>> x.iscontiguous()
        True
 
        `iscontiguous` returns one of the flags of the masked array:
 
        >>> x.flags
          C_CONTIGUOUS : True
          F_CONTIGUOUS : True
          OWNDATA : False
          WRITEABLE : True
          ALIGNED : True
          WRITEBACKIFCOPY : False
 
        Z
CONTIGUOUS)r
rgrÃrÃrÄÚ iscontiguousszMaskedArray.iscontiguouscCs®|tjkrind|i}t|j|f|Ž}|dkrp| d¡jfd|i|—Ž t|ƒ¡}|jrd|     |¡n|rlt
S|S| d¡jf||dœ|—Žt |t ƒrª|js |rª|     |¡|S)aŽ
        Returns True if all elements evaluate to True.
 
        The output array is masked where all the values along the given axis
        are masked: if the output would have been a scalar and that all the
        values are masked, then the output is `masked`.
 
        Refer to `numpy.all` for full documentation.
 
        See Also
        --------
        numpy.ndarray.all : corresponding function for ndarrays
        numpy.all : equivalent function
 
        Examples
        --------
        >>> np.ma.array([1,2,3]).all()
        True
        >>> a = np.ma.array([1,2,3], mask=True)
        >>> (a.all() is np.ma.masked)
        True
 
        r°NTrŠr,) rór    r±rFrMrrBr6rrÛrvr r©rNrŠrÚr°rwrDrxrÃrÃrÄrs$ 
 
 
zMaskedArray.allcCs®|tjkrind|i}t|j|f|Ž}|dkrp| d¡jfd|i|—Ž t|ƒ¡}|jrd|     |¡n|rlt
}|S| d¡jf||dœ|—Žt |t ƒrª|js |rª|     |¡|S)aS
        Returns True if any of the elements of `a` evaluate to True.
 
        Masked values are considered as False during computation.
 
        Refer to `numpy.any` for full documentation.
 
        See Also
        --------
        numpy.ndarray.any : corresponding function for ndarrays
        numpy.any : equivalent function
 
        r°NFrŠr,) rór    r±rFrMr rBr6rrÛrvr rr“rÃrÃrÄr Cs$ 
 
 
zMaskedArray.anycCst| d¡dd ¡S)aü
 
        Return the indices of unmasked elements that are not zero.
 
        Returns a tuple of arrays, one for each dimension, containing the
        indices of the non-zero elements in that dimension. The corresponding
        non-zero values can be obtained with::
 
            a[a.nonzero()]
 
        To group the indices by element, rather than dimension, use
        instead::
 
            np.transpose(a.nonzero())
 
        The result of this is always a 2d array, with a row for each non-zero
        element.
 
        Parameters
        ----------
        None
 
        Returns
        -------
        tuple_of_arrays : tuple
            Indices of elements that are non-zero.
 
        See Also
        --------
        numpy.nonzero :
            Function operating on ndarrays.
        flatnonzero :
            Return indices that are non-zero in the flattened version of the input
            array.
        numpy.ndarray.nonzero :
            Equivalent ndarray method.
        count_nonzero :
            Counts the number of non-zero elements in the input array.
 
        Examples
        --------
        >>> import numpy.ma as ma
        >>> x = ma.array(np.eye(3))
        >>> x
        masked_array(
          data=[[1., 0., 0.],
                [0., 1., 0.],
                [0., 0., 1.]],
          mask=False,
          fill_value=1e+20)
        >>> x.nonzero()
        (array([0, 1, 2]), array([0, 1, 2]))
 
        Masked elements are ignored.
 
        >>> x[1, 1] = ma.masked
        >>> x
        masked_array(
          data=[[1.0, 0.0, 0.0],
                [0.0, --, 0.0],
                [0.0, 0.0, 1.0]],
          mask=[[False, False, False],
                [False,  True, False],
                [False, False, False]],
          fill_value=1e+20)
        >>> x.nonzero()
        (array([0, 2]), array([0, 2]))
 
        Indices can also be grouped by element.
 
        >>> np.transpose(x.nonzero())
        array([[0, 0],
               [2, 2]])
 
        A common use for ``nonzero`` is to find the indices of an array, where
        a condition is True.  Given an array `a`, the condition `a` > 3 is a
        boolean array and since False is interpreted as 0, ma.nonzero(a > 3)
        yields the indices of the `a` where the condition is true.
 
        >>> a = ma.array([[1,2,3],[4,5,6],[7,8,9]])
        >>> a > 3
        masked_array(
          data=[[False, False, False],
                [ True,  True,  True],
                [ True,  True,  True]],
          mask=False,
          fill_value=True)
        >>> ma.nonzero(a > 3)
        (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2]))
 
        The ``nonzero`` method of the condition array can also be called.
 
        >>> (a > 3).nonzero()
        (array([1, 1, 1, 2, 2, 2]), array([0, 1, 2, 0, 1, 2]))
 
        rFr‡)r+rMr“rgrÃrÃrÄr“as`zMaskedArray.nonzerorÅc    sZ|j}|tkr,tƒj||||d}| |¡S|j|||d}| |¡ d¡jd|dSdS)z8
        (this docstring should be overwritten)
        )ÚoffsetÚaxis1Úaxis2rÚ)r”r•r–rrÆr,N)rFr’rjr¸r rErMr³)    rNr”r•r–rrÚrêr1rèrorÃrÄr¸Ãs ÿ
zMaskedArray.tracecCst||||dS)a€
        a.dot(b, out=None)
 
        Masked dot product of two arrays. Note that `out` and `strict` are
        located in different positions than in `ma.dot`. In order to
        maintain compatibility with the functional version, it is
        recommended that the optional arguments be treated as keyword only.
        At some point that may be mandatory.
 
        .. versionadded:: 1.10.0
 
        Parameters
        ----------
        b : masked_array_like
            Inputs array.
        out : masked_array, optional
            Output argument. This must have the exact kind that would be
            returned if it was not used. In particular, it must have the
            right type, must be C-contiguous, and its dtype must be the
            dtype that would be returned for `ma.dot(a,b)`. This is a
            performance feature. Therefore, if these conditions are not
            met, an exception is raised, instead of attempting to be
            flexible.
        strict : bool, optional
            Whether masked data are propagated (True) or set to 0 (False)
            for the computation. Default is False.  Propagating the mask
            means that if a masked value appears in a row or column, the
            whole row or column is considered masked.
 
            .. versionadded:: 1.10.2
 
        See Also
        --------
        numpy.ma.dot : equivalent function
 
        )rÚÚstrict)Údot)rNrÜrÚr—rÃrÃrÄr˜Òs%zMaskedArray.dotc CsÖ|tjkrind|i}|j}t||f|Ž}|dkr„| d¡j|fd|i|—Ž}t|ddƒ}    |    rx| t|ƒ¡}|     |¡n|r€t
}|S| d¡j|f||dœ|—Ž}t |t ƒrÒt |ƒ}
|
tkrÌt|jƒ}
|_||
_|S)aW
        Return the sum of the array elements over the given axis.
 
        Masked elements are set to 0 internally.
 
        Refer to `numpy.sum` for full documentation.
 
        See Also
        --------
        numpy.ndarray.sum : corresponding function for ndarrays
        numpy.sum : equivalent function
 
        Examples
        --------
        >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
        >>> x
        masked_array(
          data=[[1, --, 3],
                [--, 5, --],
                [7, --, 9]],
          mask=[[False,  True, False],
                [ True, False,  True],
                [False,  True, False]],
          fill_value=999999)
        >>> x.sum()
        25
        >>> x.sum(axis=1)
        masked_array(data=[4, 5, 16],
                     mask=[False, False, False],
               fill_value=999999)
        >>> x.sum(axis=0)
        masked_array(data=[8, 5, 12],
                     mask=[False, False, False],
               fill_value=999999)
        >>> print(type(x.sum(axis=0, dtype=np.int64)[0]))
        <class 'numpy.int64'>
 
        r°Nrrr©rrÚ)rór    rFr±rMr³ršrBr6rÛrvr rrXr’rtr¨rã© rNrŠrrÚr°rwrFr¢r1ZrndimÚoutmaskrÃrÃrÄr³ùs&'  
zMaskedArray.sumcCsV| d¡j|||d}|dk    r8t|tƒr4| |j¡|S| t|ƒ¡}| |j¡|S)a
        Return the cumulative sum of the array elements over the given axis.
 
        Masked values are set to 0 internally during the computation.
        However, their position is saved, and the result will be masked at
        the same locations.
 
        Refer to `numpy.cumsum` for full documentation.
 
        Notes
        -----
        The mask is lost if `out` is not a valid :class:`ma.MaskedArray` !
 
        Arithmetic is modular when using integer types, and no error is
        raised on overflow.
 
        See Also
        --------
        numpy.ndarray.cumsum : corresponding function for ndarrays
        numpy.cumsum : equivalent function
 
        Examples
        --------
        >>> marr = np.ma.array(np.arange(10), mask=[0,0,0,1,1,1,0,0,0,0])
        >>> marr.cumsum()
        masked_array(data=[0, 1, 3, --, --, --, 9, 16, 24, 33],
                     mask=[False, False, False,  True,  True,  True, False, False,
                           False, False],
               fill_value=999999)
 
        r©rŠrrÚN)    rMrBr rrÛrDrBr6rF©rNrŠrrÚr1rÃrÃrÄrB7s 
  zMaskedArray.cumsumc CsÖ|tjkrind|i}|j}t||f|Ž}|dkr„| d¡j|fd|i|—Ž}t|ddƒ}    |    rx| t|ƒ¡}|     |¡n|r€t
}|S| d¡j|f||dœ|—Ž}t |t ƒrÒt |ƒ}
|
tkrÌt|jƒ}
|_||
_|S)aÖ
        Return the product of the array elements over the given axis.
 
        Masked elements are set to 1 internally for computation.
 
        Refer to `numpy.prod` for full documentation.
 
        Notes
        -----
        Arithmetic is modular when using integer types, and no error is raised
        on overflow.
 
        See Also
        --------
        numpy.ndarray.prod : corresponding function for ndarrays
        numpy.prod : equivalent function
        r°NrÅrrrr™)rór    rFr±rMršršrBr6rÛrvr rrXr’rtr¨rãršrÃrÃrÄrš`s&  
zMaskedArray.prodcCsV| d¡j|||d}|dk    r8t|tƒr4| |j¡|S| t|ƒ¡}| |j¡|S)a–
        Return the cumulative product of the array elements over the given axis.
 
        Masked values are set to 1 internally during the computation.
        However, their position is saved, and the result will be masked at
        the same locations.
 
        Refer to `numpy.cumprod` for full documentation.
 
        Notes
        -----
        The mask is lost if `out` is not a valid MaskedArray !
 
        Arithmetic is modular when using integer types, and no error is
        raised on overflow.
 
        See Also
        --------
        numpy.ndarray.cumprod : corresponding function for ndarrays
        numpy.cumprod : equivalent function
        rÅrœN)rMrAr rrÛrFrBr6rrÃrÃrÄrAŠs
  zMaskedArray.cumprodc sB|tjkrind|i}|jtkr>tƒjf||dœ|—Žd}n´d}|dkrŠt|jjt    j
t    j fƒrlt  d¡}nt|jjt    j ƒrŠt  d¡}d}|jf||dœ|—Ž}|jfd    |i|—Ž}    |    jdkrÌ|    d
krÌt}n&|ræ|j |d |    ¡}n |d |    }|dk    r>||_t|tƒr:t|ƒ}
|
tkr0t|jƒ}
|_t|ƒ|
_|S|S) a°
        Returns the average of the array elements along given axis.
 
        Masked entries are ignored, and result elements which are not
        finite will be masked.
 
        Refer to `numpy.mean` for full documentation.
 
        See Also
        --------
        numpy.ndarray.mean : corresponding function for ndarrays
        numpy.mean : Equivalent function
        numpy.ma.average : Weighted average.
 
        Examples
        --------
        >>> a = np.ma.array([1,2,3], mask=[False, False, True])
        >>> a
        masked_array(data=[1, 2, --],
                     mask=[False, False,  True],
               fill_value=999999)
        >>> a.mean()
        1.5
 
        r°r…rÃFNZf8Zf4TrŠrr“)rór    rFr’rjr‰r9rr6ÚntypesÚintegerrÚmuÚfloat16r³r@r¨rvrãr rrXrt) rNrŠrrÚr°rwr1Zis_float16_resultZdsumÚcntr›rorÃrÄr‰©s4
 
 
 
 
zMaskedArray.meancCs*| ||¡}|s||S|t||ƒSdS)a½
        Compute the anomalies (deviations from the arithmetic mean)
        along the given axis.
 
        Returns an array of anomalies, with the same shape as the input and
        where the arithmetic mean is computed along the given axis.
 
        Parameters
        ----------
        axis : int, optional
            Axis over which the anomalies are taken.
            The default is to use the mean of the flattened array as reference.
        dtype : dtype, optional
            Type to use in computing the variance. For arrays of integer type
             the default is float32; for arrays of float types it is the same as
             the array type.
 
        See Also
        --------
        mean : Compute the mean of the array.
 
        Examples
        --------
        >>> a = np.ma.array([1,2,3])
        >>> a.anom()
        masked_array(data=[-1.,  0.,  1.],
                     mask=False,
               fill_value=1e+20)
 
        N)r‰r)rNrŠrrêrÃrÃrÄràs zMaskedArray.anomc sŠ|tjkrind|i}|jtkrdtƒjf||||dœ|—Žd}|dk    r`t|tƒr\| t¡|S|S|j    fd|i|—Ž|}||j
||dd}    t |ƒr¨t   |    ¡d}    n|    |    9}    t|    j|f|Ž|ƒ t|ƒ¡}
|
jrüt|jj|f|Ž|d    kƒ|
_|
 |¡n^t|
ƒrZt}
|dk    rZt|tƒr2d    |_| d¡n$|jjd
krNd } t| ƒ‚ntj|_|S|dk    r†|
|_t|tƒr‚| |
j¡|S|
S) au
        Returns the variance of the array elements along given axis.
 
        Masked entries are ignored, and result elements which are not
        finite will be masked.
 
        Refer to `numpy.var` for full documentation.
 
        See Also
        --------
        numpy.ndarray.var : corresponding function for ndarrays
        numpy.var : Equivalent function
        r°)rŠrrÚÚddofrÃNrŠT©r°rrÚbiuú>Masked data information would be lost in one or more location.)rór    rFr’rjr»r rrÛr@r‰rrTrrGr³rBr6rrurrurXrvrãrrrr|rD) rNrŠrrÚr£r°rwrÃr¢ZdanomÚdvarr‹rorÃrÄr»sL
ÿÿ
 
 
 
 
 
  zMaskedArray.varcCs\|tjkrind|i}|j||||f|Ž}|tk    rX|dk    rPtj|d|dd|St|ƒ}|S)a>
        Returns the standard deviation of the array elements along given axis.
 
        Masked entries are ignored.
 
        Refer to `numpy.std` for full documentation.
 
        See Also
        --------
        numpy.ndarray.std : corresponding function for ndarrays
        numpy.std : Equivalent function
        r°Ngà?r©rÚr)rór    r»rvr™r¯)rNrŠrrÚr£r°rwr§rÃrÃrÄr±EszMaskedArray.stdcCsh|jj||d t|ƒ¡}|jdkr8|j|_| |¡n
|jrBt}|dkrN|St|t    ƒrd| 
|j¡|S)a
        Return each element rounded to the given number of decimals.
 
        Refer to `numpy.around` for full documentation.
 
        See Also
        --------
        numpy.ndarray.round : corresponding function for ndarrays
        numpy.around : equivalent function
        )ÚdecimalsrÚrN) r@r¥rBr6rrFrurvr rrÛ)rNr©rÚr1rÃrÃrÄr¥]s 
 
 zMaskedArray.roundcCsb|tjkrt|ƒ}|dkrH|r@t |jtj¡r6tj}qHt|ƒ}nt|ƒ}|     |¡}|j
|||dS)a!    
        Return an ndarray of indices that sort the array along the
        specified axis.  Masked values are filled beforehand to
        `fill_value`.
 
        Parameters
        ----------
        axis : int, optional
            Axis along which to sort. If None, the default, the flattened array
            is used.
 
            ..  versionchanged:: 1.13.0
                Previously, the default was documented to be -1, but that was
                in error. At some future date, the default will change to -1, as
                originally intended.
                Until then, the axis should be given explicitly when
                ``arr.ndim > 1``, to avoid a FutureWarning.
        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional
            The sorting algorithm used.
        order : list, optional
            When `a` is an array with fields defined, this argument specifies
            which fields to compare first, second, etc.  Not all fields need be
            specified.
        endwith : {True, False}, optional
            Whether missing values (if any) should be treated as the largest values
            (True) or the smallest values (False)
            When the array contains unmasked values at the same extremes of the
            datatype, the ordering of these values and the masked values is
            undefined.
        fill_value : scalar or None, optional
            Value used internally for the masked values.
            If ``fill_value`` is not None, it supersedes ``endwith``.
 
        Returns
        -------
        index_array : ndarray, int
            Array of indices that sort `a` along the specified axis.
            In other words, ``a[index_array]`` yields a sorted `a`.
 
        See Also
        --------
        ma.MaskedArray.sort : Describes sorting algorithms used.
        lexsort : Indirect stable sort with multiple keys.
        numpy.ndarray.sort : Inplace sort.
 
        Notes
        -----
        See `sort` for notes on the different sorting algorithms.
 
        Examples
        --------
        >>> a = np.ma.array([3,2,1], mask=[False, False, True])
        >>> a
        masked_array(data=[3, 2, --],
                     mask=[False, False,  True],
               fill_value=999999)
        >>> a.argsort()
        array([1, 0, 2])
 
        N©rŠrrñ) rór    rÍr¿rrÀr|rŒrˆrMr,)rNrŠrrñÚendwithr+rMrÃrÃrÄr,vs@
 
 
zMaskedArray.argsortr¤cCsF|dkrt|ƒ}| |¡ t¡}|tjkr.dnt|ƒ}|j|||dS)a<
        Return array of indices to the minimum values along the given axis.
 
        Parameters
        ----------
        axis : {None, integer}
            If None, the index is into the flattened array, otherwise along
            the specified axis
        fill_value : scalar or None, optional
            Value used to fill in the masked values.  If None, the output of
            minimum_fill_value(self._data) is used instead.
        out : {None, array}, optional
            Array into which the result can be placed. Its type is preserved
            and it must be of the right shape to hold the output.
 
        Returns
        -------
        ndarray or scalar
            If multi-dimension input, returns a new ndarray of indices to the
            minimum values along the given axis.  Otherwise, returns a scalar
            of index to the minimum values along the given axis.
 
        Examples
        --------
        >>> x = np.ma.array(np.arange(4), mask=[1,1,0,0])
        >>> x.shape = (2,2)
        >>> x
        masked_array(
          data=[[--, --],
                [2, 3]],
          mask=[[ True,  True],
                [False, False]],
          fill_value=999999)
        >>> x.argmin(axis=0, fill_value=-1)
        array([0, 0])
        >>> x.argmin(axis=0, fill_value=9)
        array([1, 1])
 
        NF©rÚr°)rŒrMrBrrór    r¯r+©rNrŠr+rÚr°rxrÃrÃrÄr+Æs
)zMaskedArray.argmincCsH|dkrt|jƒ}| |¡ t¡}|tjkr0dnt|ƒ}|j|||dS)aÏ
        Returns array of indices of the maximum values along the given axis.
        Masked values are treated as if they had the value fill_value.
 
        Parameters
        ----------
        axis : {None, integer}
            If None, the index is into the flattened array, otherwise along
            the specified axis
        fill_value : scalar or None, optional
            Value used to fill in the masked values.  If None, the output of
            maximum_fill_value(self._data) is used instead.
        out : {None, array}, optional
            Array into which the result can be placed. Its type is preserved
            and it must be of the right shape to hold the output.
 
        Returns
        -------
        index_array : {integer_array}
 
        Examples
        --------
        >>> a = np.arange(6).reshape(2,3)
        >>> a.argmax()
        5
        >>> a.argmax(0)
        array([1, 1, 1])
        >>> a.argmax(1)
        array([2, 2])
 
        NFr¬)    rˆr@rMrBrrór    r¯r*r­rÃrÃrÄr*õs
!
zMaskedArray.argmaxrÆcCsX|jtkr tj||||ddS|tkr,dS|j|||||d}tj|||d|d<dS)a
 
 
        Sort the array, in-place
 
        Parameters
        ----------
        a : array_like
            Array to be sorted.
        axis : int, optional
            Axis along which to sort. If None, the array is flattened before
            sorting. The default is -1, which sorts along the last axis.
        kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional
            The sorting algorithm used.
        order : list, optional
            When `a` is a structured array, this argument specifies which fields
            to compare first, second, and so on.  This list does not need to
            include all of the fields.
        endwith : {True, False}, optional
            Whether missing values (if any) should be treated as the largest values
            (True) or the smallest values (False)
            When the array contains unmasked values sorting at the same extremes of the
            datatype, the ordering of these values and the masked values is
            undefined.
        fill_value : scalar or None, optional
            Value used internally for the masked values.
            If ``fill_value`` is not None, it supersedes ``endwith``.
 
        Returns
        -------
        sorted_array : ndarray
            Array of the same type and shape as `a`.
 
        See Also
        --------
        numpy.ndarray.sort : Method to sort an array in-place.
        argsort : Indirect sort.
        lexsort : Indirect stable sort on multiple keys.
        searchsorted : Find elements in a sorted array.
 
        Notes
        -----
        See ``sort`` for notes on the different sorting algorithms.
 
        Examples
        --------
        >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
        >>> # Default
        >>> a.sort()
        >>> a
        masked_array(data=[1, 3, 5, --, --],
                     mask=[False, False, False,  True,  True],
               fill_value=999999)
 
        >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
        >>> # Put missing values in the front
        >>> a.sort(endwith=False)
        >>> a
        masked_array(data=[--, --, 1, 3, 5],
                     mask=[ True,  True, False, False, False],
               fill_value=999999)
 
        >>> a = np.ma.array([1, 2, 5, 4, 3],mask=[0, 1, 0, 1, 0])
        >>> # fill_value takes over endwith
        >>> a.sort(endwith=False, fill_value=3)
        >>> a
        masked_array(data=[1, --, --, 3, 5],
                     mask=[False,  True,  True, False, False],
               fill_value=999999)
 
        rªN)rŠrrñr+r«r.)rFr’rr®rvr,róZtake_along_axis)rNrŠrrñr«r+ZsidxrÃrÃrÄr®sG
 
ÿzMaskedArray.sortc Cs|tjkrind|i}|j}t||f|Ž}|dkr:t|ƒ}|dkrž| |¡jf||dœ|—Ž t|ƒ¡}|j    r’| 
|¡|j    rštj ||j |dn|ršt }|S| |¡jf||dœ|—Ž}t|tƒrìt|ƒ}    |    tkrät|jƒ}    |_||    _n,|jjdkrd}
t|
ƒ‚tj |tj|d|S)as    
        Return the minimum along a given axis.
 
        Parameters
        ----------
        axis : None or int or tuple of ints, optional
            Axis along which to operate.  By default, ``axis`` is None and the
            flattened input is used.
            .. versionadded:: 1.7.0
            If this is a tuple of ints, the minimum is selected over multiple
            axes, instead of a single axis or all the axes as before.
        out : array_like, optional
            Alternative output array in which to place the result.  Must be of
            the same shape and buffer length as the expected output.
        fill_value : scalar or None, optional
            Value used to fill in the masked values.
            If None, use the output of `minimum_fill_value`.
        keepdims : bool, optional
            If this is set to True, the axes which are reduced are left
            in the result as dimensions with size one. With this option,
            the result will broadcast correctly against the array.
 
        Returns
        -------
        amin : array_like
            New array holding the result.
            If ``out`` was specified, ``out`` is returned.
 
        See Also
        --------
        ma.minimum_fill_value
            Returns the minimum filling value for a given datatype.
 
        Examples
        --------
        >>> import numpy.ma as ma
        >>> x = [[1., -2., 3.], [0.2, -0.7, 0.1]]
        >>> mask = [[1, 1, 0], [0, 0, 1]]
        >>> masked_x = ma.masked_array(x, mask)
        >>> masked_x
        masked_array(
          data=[[--, --, 3.0],
                [0.2, -0.7, --]],
          mask=[[ True,  True, False],
                [False, False,  True]],
          fill_value=1e+20)
        >>> ma.min(masked_x)
        -0.7
        >>> ma.min(masked_x, axis=-1)
        masked_array(data=[3.0, -0.7],
                     mask=[False, False],
                fill_value=1e+20)
        >>> ma.min(masked_x, axis=0, keepdims=True)
        masked_array(data=[[0.2, -0.7, 3.0]],
                     mask=[[False, False, False]],
                fill_value=1e+20)
        >>> mask = [[1, 1, 1,], [1, 1, 1]]
        >>> masked_x = ma.masked_array(x, mask)
        >>> ma.min(masked_x, axis=0)
        masked_array(data=[--, --, --],
                     mask=[ True,  True,  True],
                fill_value=1e+20,
                    dtype=float64)
        r°Nr,rsr¥r¦)rór    rFr±rŒrMrŠrBr6rrÛrtr+rvr rrXr’rtr¨rãrrrr|© rNrŠrÚr+r°rwrFr¢r1r›r‹rÃrÃrÄrŠos@A ÿÿÿ
 
zMaskedArray.minc Cs|tjkrind|i}|j}t||f|Ž}|dkr:t|ƒ}|dkrž| |¡jf||dœ|—Ž t|ƒ¡}|j    r’| 
|¡|j    rštj ||j |dn|ršt }|S| |¡jf||dœ|—Ž}t|tƒrìt|ƒ}    |    tkrät|jƒ}    |_||    _n,|jjdkrd}
t|
ƒ‚tj |tj|d|S)aÚ    
        Return the maximum along a given axis.
 
        Parameters
        ----------
        axis : None or int or tuple of ints, optional
            Axis along which to operate.  By default, ``axis`` is None and the
            flattened input is used.
            .. versionadded:: 1.7.0
            If this is a tuple of ints, the maximum is selected over multiple
            axes, instead of a single axis or all the axes as before.
        out : array_like, optional
            Alternative output array in which to place the result.  Must
            be of the same shape and buffer length as the expected output.
        fill_value : scalar or None, optional
            Value used to fill in the masked values.
            If None, use the output of maximum_fill_value().
        keepdims : bool, optional
            If this is set to True, the axes which are reduced are left
            in the result as dimensions with size one. With this option,
            the result will broadcast correctly against the array.
 
        Returns
        -------
        amax : array_like
            New array holding the result.
            If ``out`` was specified, ``out`` is returned.
 
        See Also
        --------
        ma.maximum_fill_value
            Returns the maximum filling value for a given datatype.
 
        Examples
        --------
        >>> import numpy.ma as ma
        >>> x = [[-1., 2.5], [4., -2.], [3., 0.]]
        >>> mask = [[0, 0], [1, 0], [1, 0]]
        >>> masked_x = ma.masked_array(x, mask)
        >>> masked_x
        masked_array(
          data=[[-1.0, 2.5],
                [--, -2.0],
                [--, 0.0]],
          mask=[[False, False],
                [ True, False],
                [ True, False]],
          fill_value=1e+20)
        >>> ma.max(masked_x)
        2.5
        >>> ma.max(masked_x, axis=0)
        masked_array(data=[-1.0, 2.5],
                     mask=[False, False],
               fill_value=1e+20)
        >>> ma.max(masked_x, axis=1, keepdims=True)
        masked_array(
          data=[[2.5],
                [-2.0],
                [0.0]],
          mask=[[False],
                [False],
                [False]],
          fill_value=1e+20)
        >>> mask = [[1, 1], [1, 1], [1, 1]]
        >>> masked_x = ma.masked_array(x, mask)
        >>> ma.max(masked_x, axis=1)
        masked_array(data=[--, --, --],
                     mask=[ True,  True,  True],
               fill_value=1e+20,
                    dtype=float64)
        r°Nr,rsr¥r¦)rór    rFr±rˆrMr†rBr6rrÛrtr+rvr rrXr’rtr¨rãrrrr|r®rÃrÃrÄr†Òs@H ÿÿÿ
 
zMaskedArray.maxcCsj|dkr0|j|||d}||j|||d8}|S|j||||d|_|j|||d}tj|||dd|S)a´
 
        Return (maximum - minimum) along the given dimension
        (i.e. peak-to-peak value).
 
        .. warning::
            `ptp` preserves the data type of the array. This means the
            return value for an input of signed integers with n bits
            (e.g. `np.int8`, `np.int16`, etc) is also a signed integer
            with n bits.  In that case, peak-to-peak values greater than
            ``2**(n-1)-1`` will be returned as negative values. An example
            with a work-around is shown below.
 
        Parameters
        ----------
        axis : {None, int}, optional
            Axis along which to find the peaks.  If None (default) the
            flattened array is used.
        out : {None, array_like}, optional
            Alternative output array in which to place the result. It must
            have the same shape and buffer length as the expected output
            but the type will be cast if necessary.
        fill_value : scalar or None, optional
            Value used to fill in the masked values.
        keepdims : bool, optional
            If this is set to True, the axes which are reduced are left
            in the result as dimensions with size one. With this option,
            the result will broadcast correctly against the array.
 
        Returns
        -------
        ptp : ndarray.
            A new array holding the result, unless ``out`` was
            specified, in which case a reference to ``out`` is returned.
 
        Examples
        --------
        >>> x = np.ma.MaskedArray([[4, 9, 2, 10],
        ...                        [6, 9, 7, 12]])
 
        >>> x.ptp(axis=1)
        masked_array(data=[8, 6],
                     mask=False,
               fill_value=999999)
 
        >>> x.ptp(axis=0)
        masked_array(data=[2, 0, 5, 2],
                     mask=False,
               fill_value=999999)
 
        >>> x.ptp()
        10
 
        This example shows that a negative value can be returned when
        the input is an array of signed integers.
 
        >>> y = np.ma.MaskedArray([[1, 127],
        ...                        [0, 127],
        ...                        [-1, 127],
        ...                        [-2, 127]], dtype=np.int8)
        >>> y.ptp(axis=1)
        masked_array(data=[ 126,  127, -128, -127],
                     mask=False,
               fill_value=999999,
                    dtype=int8)
 
        A work-around is to use the `view()` method to view the result as
        unsigned integers with the same bit width:
 
        >>> y.ptp(axis=1).view(np.uint8)
        masked_array(data=[126, 127, 128, 129],
                     mask=False,
               fill_value=999999,
                    dtype=uint8)
        N)rŠr+r°)rŠrÚr+r°rr¨)r†rŠrãrór²)rNrŠrÚr+r°r1Z    min_valuerÃrÃrÄrœ=s Kÿ
ÿ
ÿÿzMaskedArray.ptpcs(tjd|jj›dddtƒj||ŽS)Nz3Warning: 'partition' will ignore the 'mask' of the rrrÈ)rÊrËrprÀrjÚ    partition©rNrvrwrorÃrÄr¯•sþzMaskedArray.partitioncs(tjd|jj›dddtƒj||ŽS)Nz6Warning: 'argpartition' will ignore the 'mask' of the rrrÈ)rÊrËrprÀrjÚ argpartitionr°rorÃrÄr±›sþzMaskedArray.argpartitionc
Csª|j|j}}t|ƒ}t|ƒ}|tk    r0| d¡}|dkrT|j|||dd |¡}ntj|||||dt    |t
ƒr¢|tkr€|}    n|j|||d}    |    |O}    |  |    ¡|dS)z    
        rN)rŠrŽ.)rŠrŽrÚrÃ) r@rFr6rXr’rMrµrBrór rrÛ)
rNr`rŠrÚrŽr@rFr<Z maskindicesr›rÃrÃrÄrµ¡s
 
 
zMaskedArray.taker<rEÚflattenr¡r°r´cCs| ¡Srý)r¹rgrÃrÃrÄÚ<lambda>ÂózMaskedArray.<lambda>r¹cCs´|j}|tkr|j ¡S|dk    r.| |¡ ¡S|jj}|rr|j dd„|Dƒ¡}|D]}d||||<qT| ¡S|tkr€dgS|j}t    j
|j  ¡t d}d||  ¡<||_| ¡S)aP
        Return the data portion of the masked array as a hierarchical Python list.
 
        Data items are converted to the nearest compatible Python type.
        Masked values are converted to `fill_value`. If `fill_value` is None,
        the corresponding entries in the output list will be ``None``.
 
        Parameters
        ----------
        fill_value : scalar, optional
            The value to use for invalid entries. Default is None.
 
        Returns
        -------
        result : list
            The Python list representation of the masked array.
 
        Examples
        --------
        >>> x = np.ma.array([[1,2,3], [4,5,6], [7,8,9]], mask=[0] + [1,0]*4)
        >>> x.tolist()
        [[1, None, 3], [None, 5, None], [7, None, 9]]
        >>> x.tolist(-999)
        [[1, -999, 3], [-999, 5, -999], [7, -999, 9]]
 
        NcSsg|] }|tf‘qSrÃ)r(r­rÃrÃrÄrøêsz&MaskedArray.tolist.<locals>.<listcomp>r) rFr’r@ÚtolistrMrrr r¨rór
rŸr()rNr+rFrr1r rÙrÃrÃrÄrµÅs$
 zMaskedArray.tolistcCstjdtdd|j||dS)z²
        A compatibility alias for `tobytes`, with exactly the same behavior.
 
        Despite its name, it returns `bytes` not `str`\ s.
 
        .. deprecated:: 1.19.0
        z0tostring() is deprecated. Use tobytes() instead.rrÈrˆ)rÊrËr*Útobytes©rNr+rñrÃrÃrÄÚtostringøs     þzMaskedArray.tostringcCs| |¡j|dS)a¸
        Return the array data as a string containing the raw bytes in the array.
 
        The array is filled with a fill value before the string conversion.
 
        .. versionadded:: 1.9.0
 
        Parameters
        ----------
        fill_value : scalar, optional
            Value used to fill in the masked values. Default is None, in which
            case `MaskedArray.fill_value` is used.
        order : {'C','F','A'}, optional
            Order of the data item in the copy. Default is 'C'.
 
            - 'C'   -- C order (row major).
            - 'F'   -- Fortran order (column major).
            - 'A'   -- Any, current order of array.
            - None  -- Same as 'A'.
 
        See Also
        --------
        numpy.ndarray.tobytes
        tolist, tofile
 
        Notes
        -----
        As for `ndarray.tobytes`, information about the shape, dtype, etc.,
        but also about `fill_value`, will be lost.
 
        Examples
        --------
        >>> x = np.ma.array(np.array([[1, 2], [3, 4]]), mask=[[0, 1], [1, 0]])
        >>> x.tobytes()
        b'\x01\x00\x00\x00\x00\x00\x00\x00?B\x0f\x00\x00\x00\x00\x00?B\x0f\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00'
 
        rˆ)rMr¶r·rÃrÃrÄr¶s&zMaskedArray.tobytesrÎú%scCs tdƒ‚dS)zè
        Save a masked array to a file in binary format.
 
        .. warning::
          This function is not implemented yet.
 
        Raises
        ------
        NotImplementedError
            When `tofile` is called.
 
        z)MaskedArray.tofile() not implemented yet.Nr")rNZfidÚsepr?rÃrÃrÄÚtofile/s zMaskedArray.tofilecCs\|j}|j}|dkr t|j|ƒ}|jj}tj|jd|fd|fgd}|j|d<|j|d<|S)a‹
        Transforms a masked array into a flexible-type array.
 
        The flexible type array that is returned will have two fields:
 
        * the ``_data`` field stores the ``_data`` part of the array.
        * the ``_mask`` field stores the ``_mask`` part of the array.
 
        Parameters
        ----------
        None
 
        Returns
        -------
        record : ndarray
            A new flexible-type `ndarray` with two fields: the first element
            containing a value, the second element containing the corresponding
            mask boolean. The returned record shape matches self.shape.
 
        Notes
        -----
        A side-effect of transforming a masked array into a flexible `ndarray` is
        that meta information (``fill_value``, ...) will be lost.
 
        Examples
        --------
        >>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
        >>> x
        masked_array(
          data=[[1, --, 3],
                [--, 5, --],
                [7, --, 9]],
          mask=[[False,  True, False],
                [ True, False,  True],
                [False,  True, False]],
          fill_value=999999)
        >>> x.toflex()
        array([[(1, False), (2,  True), (3, False)],
               [(4,  True), (5, False), (6,  True)],
               [(7, False), (8,  True), (9, False)]],
              dtype=[('_data', '<i8'), ('_mask', '?')])
 
        Nr@rF)r¨r)rrFrtr¨rórr@)rNZddtyperFr÷ÚrecordrÃrÃrÄÚtoflex>s- ÿ
 
zMaskedArray.toflexcs2d|jj}tƒ ¡d}|t|ƒ |¡|jfS)zWReturn the internal state of the masked array, for pickling
        purposes.
 
        ZCFr)r
r‰rjÚ
__reduce__rYr¶rú)rNÚcfZ
data_staterorÃrÄÚ __getstate__{s zMaskedArray.__getstate__c    sH|\}}}}}}}tƒ ||||f¡|j |t|ƒ||f¡||_dS)akRestore the internal state of the masked array, for
        pickling purposes.  ``state`` is typically the output of the
        ``__getstate__`` output, and is a 5-tuple:
 
        - class name
        - a tuple giving the shape of the data
        - a typecode for the data
        - a binary string for the data
        - a binary string for the mask.
 
        N)rjÚ __setstate__rFrsr+)    rNÚstater®ZshpÚtypZisfÚrawZmskZflvrorÃrÄrÁ„s zMaskedArray.__setstate__cCst|j|jddf| ¡fS)z6Return a 3-tuple for pickling a MaskedArray.
 
        )rrÜ)Ú_mareconstructrprórÀrgrÃrÃrÄr¾•sþzMaskedArray.__reduce__cCs`ddlm}tjt|ƒ|dd}|dkr,i}||t|ƒ<|j ¡D]\}}|||ƒ|j|<qB|S)Nr)ÚdeepcopyTr‡)r<rÆrrr6r‘rr‡)rNÚmemorÆÚcopiedr÷ÚvrÃrÃrÄÚ __deepcopy__s  zMaskedArray.__deepcopy__)N)NNN)F)N)N)NN)r)TF)rŒ)rrrÅNN)NF)NNN)NNN)NN)rN)NNN)NNN)rÆNNTN)NNNF)NNrŒ)N)Nr)Nr)rÎr¹)N)ŠrÀrÁrÂrÚrIr’Z _defaultmaskZ_defaulthardmaskrrór-r.rrurrrBrèrórSrìÚpropertyrÚsetterr¨rÛZ    _set_maskrDr!r\r¬rçr$r%rÂr&r'r@rCrãr+r(r2Úfsetr§rMr8r7r2rhrÎrKrTrVrWrYr[r]r_r`rarbrcrdrergrhrjrkrlrmrnrorrrsrtrxryrzr}r~rZget_imagrZget_realr    r@rŸr¢r£rr_r’rr r“r¸r˜r³rBršr›rAr‰rr»r±r¥r,r+r*r®rŠr†rœr¯r±rµrár<rEr²r¡r°r´ÚTr¹rµr¸r¶r»r½Z    torecordsrÀrÁr¾rÊr{rÃrÃrorÄr‰
s\dþ
]
8
Z 
F 
E
    
 
 
 
+
 
 
 
 
 
 
( 
P
HTE                                   
 
c
>B
 
U(b
 
'>
)(
7
%ÿ>
ÿ
 
ÿ
Pÿ /ÿ 'ÿ
Sck
X  
 
3
 ( :      cCs2t |||¡}t t|t|ƒ¡}|j||||dS)zbInternal function that builds a new MaskedArray from the
    information stored in a pickle.
 
    )rDr)rrrs)r
r&Z    baseshapeÚbasetyper@rFrÃrÃrÄrŨsrÅcs|eZdZdZedddddfdd„Ze‡fdd„ƒZd    d
„Zd d „Z    ‡fd d„Z
e
Z dd„Z dd„Z ddd„Zdd„Z‡ZS)rzN
    Fake a 'void' object to use for masked array with structured dtypes.
    NFTc
Cs’tj||||d}| |¡}||_|tk    r€t|tjƒr>||_nBzt |¡|_Wn0tk
r~t    |ƒ}    tj||    dd|_YnX|dk    rŽ||_
|S)N)r<r?rrrÃ) rór
rBrér’r r&rFrÕrsr+)
rNrCrDrr+rçr<r?r@r÷rÃrÃrÄr·s
 z mvoid.__new__cs tƒjdS)NrÃ)rjr@rgrorÃrÄr@Ësz mvoid._datacCsT|j}t||tƒr6t|j||||j||jdS|tk    rJ||rJtS|j|S)z!
        Get the index.
 
        )rCrDr+rý)    rFr rrwr@rúrér’rv)rNrêrêrÃrÃrÄrèÐsýzmvoid.__getitem__cCsB||j|<|jr,|j|t|ddƒO<nt|ddƒ|j|<dS)NrFF)r@rérFrš)rNrêr¶rÃrÃrÄrìæs
zmvoid.__setitem__csN|j}|tkrt|jƒSt|jjdƒ}tƒj}| |¡}t||jt    ƒt|ƒS)Nrà)
rFr’rr@r™rrjr rÏr‚)rNrêr1Zdata_arrrÄrorÃrÄrhís
 
z mvoid.__str__ccsL|j|j}}|tkr"|EdHn&t||ƒD]\}}|r@tVq,|Vq,dS)zDefines an iterator for mvoidN)r@rFr’rrv)rNr@rFrxrêrÃrÃrÄr¨ús zmvoid.__iter__cCs
|j ¡Srý)r@Ú__len__rgrÃrÃrÄrÐsz mvoid.__len__cCst|ƒ |¡dS)aA
        Return a copy with masked fields filled with a given value.
 
        Parameters
        ----------
        fill_value : array_like, optional
            The value to use for invalid entries. Can be scalar or
            non-scalar. If latter is the case, the filled array should
            be broadcastable over input array. Default is None, in
            which case the `fill_value` attribute is used instead.
 
        Returns
        -------
        filled_void
            A `np.void` object
 
        See Also
        --------
        MaskedArray.filled
 
        rÃ)r/rM)rNr+rÃrÃrÄrM    sz mvoid.filledcCsZ|j}|tkr|j ¡Sg}t|j|jƒD]&\}}|rB| d¡q*| | ¡¡q*t|ƒS)z¤
    Transforms the mvoid object into a tuple.
 
    Masked fields are replaced by None.
 
    Returns
    -------
    returned_tuple
        Tuple of fields
        N)rFr’r@rµrr!r!r)rNrFr1rxrêrÃrÃrÄrµ!s 
 z mvoid.tolist)N)rÀrÁrÂrÚr’rrËr@rèrìrhrÎr¨rÐrMrµr{rÃrÃrorÄr²s ÿ
 
cCs
t|tƒS)aú
    Test whether input is an instance of MaskedArray.
 
    This function returns True if `x` is an instance of MaskedArray
    and returns False otherwise.  Any object is accepted as input.
 
    Parameters
    ----------
    x : object
        Object to test.
 
    Returns
    -------
    result : bool
        True if `x` is a MaskedArray.
 
    See Also
    --------
    isMA : Alias to isMaskedArray.
    isarray : Alias to isMaskedArray.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.eye(3, 3)
    >>> a
    array([[ 1.,  0.,  0.],
           [ 0.,  1.,  0.],
           [ 0.,  0.,  1.]])
    >>> m = ma.masked_values(a, 0)
    >>> m
    masked_array(
      data=[[1.0, --, --],
            [--, 1.0, --],
            [--, --, 1.0]],
      mask=[[False,  True,  True],
            [ True, False,  True],
            [ True,  True, False]],
      fill_value=0.0)
    >>> ma.isMaskedArray(a)
    False
    >>> ma.isMaskedArray(m)
    True
    >>> ma.isMaskedArray([0, 1, 2])
    False
 
    )r r©rVrÃrÃrÄrd>s0cs®eZdZdZedd„ƒZdd„Z‡fdd„Zddd    „Zdd
d „Z    d d „Z
dd„Z dd„Z dd„Z dd„ZeZZZZZZ[dd„Zdd„Zdd„Z‡fdd„Z‡ZS) r8NcCs|jdk    ot|jƒ|kSrý)Ú_MaskedConstant__singletonr6)r<rÃrÃrÄZ__has_singletonyszMaskedConstant.__has_singletoncCsF| ¡s@t d¡}t d¡}d|j_d|j_t||d |¡|_|jS)Nr’TFr¥)Ú_MaskedConstant__has_singletonrór
r
Z    writeablerrBrÒ)r<rCrDrÃrÃrÄrs
 
zMaskedConstant.__new__cs6| ¡stƒ |¡S||jkr nt|_t ||¡dSrý)rÓrjrrÒrrp)rNrÖrorÃrÄr‘s  
z!MaskedConstant.__array_finalize__cCs| t¡ ||¡Srý)rBrÚ__array_prepare__©rNrÖrrÃrÃrÄrÔŸsz MaskedConstant.__array_prepare__cCs| t¡ ||¡Srý)rBrrrÕrÃrÃrÄr¢szMaskedConstant.__array_wrap__cCs
ttjƒSrý)rr‚rÆrgrÃrÃrÄrh¥szMaskedConstant.__str__cCs|tjkrdSt |¡SdS)Nrv)r8rÒr(rÎrgrÃrÃrÄrΨs
zMaskedConstant.__repr__cCsDzt ||¡WStk
r>tjdtddt |d¡YSXdS)NzjFormat strings passed to MaskedConstant are ignored, but in future may error or produce different behaviorrrÈrÎ)r(Ú
__format__rÕrÊrËÚ FutureWarning)rNÚ format_specrÃrÃrÄrÖ¯sýzMaskedConstant.__format__cCs
|jdfS)z.Override of MaskedArray's __reduce__.
        rÃrorgrÃrÃrÄr¾¾szMaskedConstant.__reduce__cCs|SrýrÃrUrÃrÃrÄÚ__iop__ÅszMaskedConstant.__iop__cOs|S)z: Copy is a no-op on the maskedconstant, as it is a scalar rÃr°rÃrÃrÄr<ÐszMaskedConstant.copycCs|SrýrÃrgrÃrÃrÄÚ__copy__ÖszMaskedConstant.__copy__cCs|SrýrÃ)rNrÇrÃrÃrÄrÊÙszMaskedConstant.__deepcopy__csD| ¡stƒ ||¡S||jkr2td|›dƒ‚ntƒ ||¡SdS)Nzattributes of z are not writeable)rÓrjÚ __setattr__rÒrA)rNÚattrr¶rorÃrÄrÛÜs
 
ÿzMaskedConstant.__setattr__)N)N)rÀrÁrÂrÒÚ classmethodrÓrrrÔrrhrÎrÖr¾rÙrorrrsrxryrzr<rÚrÊrÛr{rÃrÃrorÄr8us6
 
 
úÿþýr8c Cst|||||    ||||
||d S)z~
    Shortcut to MaskedArray.
 
    The options are in a different order for convenience and backwards
    compatibility.
 
    )
rDrr<r?rürýr+ròrrñ)r) rCrr<rñrDr+rürýrr?ròrÃrÃrÄr
ís
 
ýcCs$t|ƒ}|tkrdS| ¡r dSdS)a
    Determine whether input has masked values.
 
    Accepts any object as input, but always returns False unless the
    input is a MaskedArray containing masked values.
 
    Parameters
    ----------
    x : array_like
        Array to check for masked values.
 
    Returns
    -------
    result : bool
        True if `x` is a MaskedArray with masked values, False otherwise.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> x = ma.masked_equal([0, 1, 0, 2, 3], 0)
    >>> x
    masked_array(data=[--, 1, --, 2, 3],
                 mask=[ True, False,  True, False, False],
           fill_value=0)
    >>> ma.is_masked(x)
    True
    >>> x = ma.masked_equal([0, 1, 0, 2, 3], 42)
    >>> x
    masked_array(data=[0, 1, 0, 2, 3],
                 mask=False,
           fill_value=42)
    >>> ma.is_masked(x)
    False
 
    Always returns False if `x` isn't a MaskedArray.
 
    >>> x = [False, True, False]
    >>> ma.is_masked(x)
    False
    >>> x = 'a string'
    >>> ma.is_masked(x)
    False
 
    FT)rXr’r )rVrêrÃrÃrÄrfþs -cs>eZdZdZ‡fdd„Zdd„Zejfdd„Zdd    „Z    ‡Z
S)
Ú_extrema_operationzœ
    Generic class for maximum/minimum functions.
 
    .. note::
      This is the base class for `_maximum_operation` and
      `_minimum_operation`.
 
    cstƒ |¡||_||_dSrý)rjrOrQÚfill_value_func)rNrfrQr+rorÃrÄrOAs z_extrema_operation.__init__cCst| ||¡||ƒS)r\)r¼rQrMrÃrÃrÄrWFsz_extrema_operation.__call__cCsÞt|ddd}t|ƒ}|tjkrP|jdkrPtjd|j›d|j›dtdd    d
}|tjk    rft    |d }nt    ƒ}|t
kr†|j j |f|Ž}nT|  | |¡¡ t|ƒ¡}|j j |f|Ž}tjj |f|Ž}t|d ƒrÒ||_n|rÚt}|S) z#Reduce target along the given axis.FTr>rÅz!In the future the default for ma.z:.reduce will be axis=0, not the current None, to match np.z;.reduce. Explicitly pass 0 or None to silence this warning.rrÈNrrF)r+rXrór    rrÊrËrÀr¿r5r’rÞrrMrßrBr6rTrnr rFrv)rNr‰rŠrêrwrŒrÃrÃrÄrKs4ü
 ÿÿ
z_extrema_operation.reducecCsvt|ƒ}t|ƒ}|tkr&|tkr&t}nt|ƒ}t|ƒ}t ||¡}|j t|ƒt|ƒ¡}t|tƒsl|     t¡}||_
|S)z<Return the function applied to the outer product of a and b.) rXr’rYrpr—rÞrMr rrBrF)rNr0rÜr…r†rêr1rÃrÃrÄr—ks 
 
z_extrema_operation.outer) rÀrÁrÂrÚrOrWrór    rr—r{rÃrÃrorÄrÞ8s
  rÞc    Csj|tjkrind|i}z|jf|||dœ|—ŽWSttfk
rdt|ƒjf|||dœ|—ŽYSXdS©Nr°©rŠr+rÚ)rór    rŠrArÕr.©rÖrŠrÚr+r°rwrÃrÃrÄrŠ{sÿÿc    Csj|tjkrind|i}z|jf|||dœ|—ŽWSttfk
rdt|ƒjf|||dœ|—ŽYSXdSrà)rór    r†rArÕr.rârÃrÃrÄr†‡sÿÿc    Csj|tjkrind|i}z|j|f||dœ|—ŽWSttfk
rdt|ƒjf|||dœ|—ŽYSXdS)Nr°)rÚr+rá)rór    rœrArÕr.rârÃrÃrÄrœ”sÿÿc@s*eZdZdZd
dd„Zdd„Zdd„Zd    S) Ú _frommethodz›
    Define functions from existing MaskedArray methods.
 
    Parameters
    ----------
    methodname : str
        Name of the method to transform.
 
    FcCs||_| ¡|_||_dSrý)rÀÚgetdocrÚÚreversed)rNÚ
methodnamerårÃrÃrÄrO°s
z_frommethod.__init__cCsNtt|jdƒptt|jdƒ}|jt|ƒ}|dk    rJd|t|ddƒf}|SdS)ú<Return the doc of the function (from the doc of the method).Nz        %s
%srÚ)ršrrÀrórØ)rNÚmethÚ    signatureÚdocrÃrÃrÄräµs ÿ
ÿz_frommethod.getdoccOs`|jr t|ƒ}|d|}|d<t|ƒ}|j}tt|ƒ|dƒ}|dkrPtt|ƒ}||f|ž|ŽSr‚)rårHr.rÀršr6ró)rNr0rvrÜZmarrÚ method_nameÚmethodrÃrÃrÄrW¿s
z_frommethod.__call__N)F)rÀrÁrÂrÚrOrärWrÃrÃrÃrÄrã¥s
 
 
rã)rårÂrŒcCst|ƒ}|j||||dS)z
    )rŠrÚrŽ)rwrµ)r0r`rŠrÚrŽrÃrÃrÄrµësc     Csú|dk    rtdƒ‚t|ƒ}t|ƒ}t||ƒ}t|ƒ}t|ƒ}t|tƒrNt|ƒ}nt}tjddd"t     ||t
  ||¡¡  |¡}    W5QRX|      |¡t t |      t¡¡¡}
|tk    rÈ|    jsºtSt ||
¡|    _|
 ¡rö|    jsÚtS|    jtkrê|
|    _|    j|    j|
<|    S)aÌ
    Returns element-wise base array raised to power from second array.
 
    This is the masked array version of `numpy.power`. For details see
    `numpy.power`.
 
    See Also
    --------
    numpy.power
 
    Notes
    -----
    The *out* argument to `numpy.power` is not supported, `third` has to be
    None.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> x = [11.2, -3.973, 0.801, -1.41]
    >>> mask = [0, 0, 0, 1]
    >>> masked_x = ma.masked_array(x, mask)
    >>> masked_x
    masked_array(data=[11.2, -3.973, 0.801, --],
             mask=[False, False, False,  True],
       fill_value=1e+20)
    >>> ma.power(masked_x, 2)
    masked_array(data=[125.43999999999998, 15.784728999999999,
                   0.6416010000000001, --],
             mask=[False, False, False,  True],
       fill_value=1e+20)
    >>> y = [-0.5, 2, 0, 17]
    >>> masked_y = ma.masked_array(y, mask)
    >>> masked_y
    masked_array(data=[-0.5, 2.0, 0.0, --],
             mask=[False, False, False,  True],
       fill_value=1e+20)
    >>> ma.power(masked_x, masked_y)
    masked_array(data=[0.29880715233359845, 15.784728999999999, 1.0, --],
             mask=[False, False, False,  True],
       fill_value=1e+20)
 
    Nz3-argument power not supported.rQrr)rrXrurWr rr6rórSr¼rTr™rBrurorErr’rrvrprFr r+r@) r0rÜÚthirdr…r†rêÚfaÚfbrÏr1rGrÃrÃrÄr™òs2+
 
 
&
 
 cCsNt |¡}|tjkrt|ƒ}t|tƒr:|j|||||dS|j|||dSdS)z)Function version of the eponymous method.©rŠrrñr«r+rªN)rór.r    rÍr rr,©r0rŠrrñr«r+rÃrÃrÄr,Bs
 
 
 
ÿrÆcCsXtj|ddd}|dkr$| ¡}d}t|tƒrD|j|||||dn|j|||d|S)a
    Return a sorted copy of the masked array.
 
    Equivalent to creating a copy of the array
    and applying the  MaskedArray ``sort()`` method.
 
    Refer to ``MaskedArray.sort`` for the full documentation
 
    See Also
    --------
    MaskedArray.sort : equivalent method
    Tr>Nrrðrª)rór
r²r rr®rñrÃrÃrÄr®Qs 
 
ÿcCs t|ƒ ¡S)a
    Return all the non-masked data as a 1-D array.
 
    This function is equivalent to calling the "compressed" method of a
    `ma.MaskedArray`, see `ma.MaskedArray.compressed` for details.
 
    See Also
    --------
    ma.MaskedArray.compressed : Equivalent method.
 
    )r.r8rÑrÃrÃrÄr8ks cCsvt dd„|Dƒ|¡}t|Ž}| |¡}|D]}t|ƒtk    r,qFq,|St dd„|Dƒ|¡}| |j¡}t|ƒ|_    |S)aI
    Concatenate a sequence of arrays along the given axis.
 
    Parameters
    ----------
    arrays : sequence of array_like
        The arrays must have the same shape, except in the dimension
        corresponding to `axis` (the first, by default).
    axis : int, optional
        The axis along which the arrays will be joined. Default is 0.
 
    Returns
    -------
    result : MaskedArray
        The concatenated array with any masked entries preserved.
 
    See Also
    --------
    numpy.concatenate : Equivalent function in the top-level NumPy module.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = ma.arange(3)
    >>> a[1] = ma.masked
    >>> b = ma.arange(2, 5)
    >>> a
    masked_array(data=[0, --, 2],
                 mask=[False,  True, False],
           fill_value=999999)
    >>> b
    masked_array(data=[2, 3, 4],
                 mask=False,
           fill_value=999999)
    >>> ma.concatenate([a, b])
    masked_array(data=[0, --, 2, 2, 3, 4],
                 mask=[False,  True, False, False, False, False],
           fill_value=999999)
 
    cSsg|] }t|ƒ‘qSrÃ)rWr7rÃrÃrÄrø£szconcatenate.<locals>.<listcomp>cSsg|] }t|ƒ‘qSrÃrr7rÃrÃrÄrø­s)
rór9r=rBrXr’r¢r¨rœrF)r:rŠrxr;rCrVÚdmrÃrÃrÄr9zs)
 
cCs2t ||¡ t¡}t|ƒtk    r.t |j|¡|_|S)a
    Extract a diagonal or construct a diagonal array.
 
    This function is the equivalent of `numpy.diag` that takes masked
    values into account, see `numpy.diag` for details.
 
    See Also
    --------
    numpy.diag : Equivalent function for ndarrays.
 
    )rórDrBrrXr’rF)rÉr÷r·rÃrÃrÄrD¶s  cCsJt|ƒ}|tkr(t t|ƒ|¡}t|ƒSt t|dƒ|¡}t||dSdS)zÄ
    Shift the bits of an integer to the left.
 
    This is the masked array version of `numpy.left_shift`, for details
    see that function.
 
    See Also
    --------
    numpy.left_shift
 
    rr¥N)rXr’rTrhrMrw©r0r rêrxrÃrÃrÄrhÈs cCsJt|ƒ}|tkr(t t|ƒ|¡}t|ƒSt t|dƒ|¡}t||dSdS)zÇ
    Shift the bits of an integer to the right.
 
    This is the masked array version of `numpy.right_shift`, for details
    see that function.
 
    See Also
    --------
    numpy.right_shift
 
    rr¥N)rXr’rTr¤rMrwrórÃrÃrÄr¤Ýs cCsDz|j|||dWStk
r>t|ddj|||dYSXdS)zÈ
    Set storage-indexed locations to corresponding values.
 
    This function is equivalent to `MaskedArray.put`, see that method
    for details.
 
    See Also
    --------
    MaskedArray.put
 
    rFr‡N)rrAr+)r0r`rrŽrÃrÃrÄròs cCsÔt|tƒs| t¡}t|ƒt|ƒ}}t|ƒtkrd|tk    r¾d|_t|j|j    ƒ|_
t j |j
||dnZ|j rœ|tk    r¾|j
 ¡}t j |||d|j|O_n"|tkr¬t|ƒ}t j |j
||dt j |j||ddS)aQ
    Changes elements of an array based on conditional and input values.
 
    This is the masked array version of `numpy.putmask`, for details see
    `numpy.putmask`.
 
    See Also
    --------
    numpy.putmask
 
    Notes
    -----
    Using a masked array as `values` will **not** transform a `ndarray` into
    a `MaskedArray`.
 
    TrsN)r rrBrWrXr’rûrtr¨rrFrórtrér<rDrYr@)r0rDrZvaldataZvalmaskrêrÃrÃrÄržs$
 
 
cCs>z | |¡WStk
r8t|dd |¡ t¡YSXdS)aˆ
    Permute the dimensions of an array.
 
    This function is exactly equivalent to `numpy.transpose`.
 
    See Also
    --------
    numpy.transpose : Equivalent function in top-level NumPy module.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> x = ma.arange(4).reshape((2,2))
    >>> x[1, 1] = ma.masked
    >>> x
    masked_array(
      data=[[0, 1],
            [2, --]],
      mask=[[False, False],
            [False,  True]],
      fill_value=999999)
 
    >>> ma.transpose(x)
    masked_array(
      data=[[0, 2],
            [1, --]],
      mask=[[False, False],
            [False,  True]],
      fill_value=999999)
    Fr‡N)r¹rAr+rBr)r0r„rÃrÃrÄr¹,s  rcCsJz|j||dWStk
rDt|ddj||d}| t¡YSXdS)zË
    Returns an array containing the same data with a new shape.
 
    Refer to `MaskedArray.reshape` for full documentation.
 
    See Also
    --------
    MaskedArray.reshape : equivalent function
 
    rˆFr‡N)r¢rAr+rBr)r0Ú    new_shaperñZ_tmprÃrÃrÄr¢Rs
cCsBt|ƒ}|tk    rt ||¡}t ||¡ t|ƒ¡}|jr>||_|S)a
    Return a new masked array with the specified size and shape.
 
    This is the masked equivalent of the `numpy.resize` function. The new
    array is filled with repeated copies of `x` (in the order that the
    data are stored in memory). If `x` is masked, the new array will be
    masked, and the new mask will be a repetition of the old one.
 
    See Also
    --------
    numpy.resize : Equivalent function in the top level NumPy module.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = ma.array([[1, 2] ,[3, 4]])
    >>> a[0, 1] = ma.masked
    >>> a
    masked_array(
      data=[[1, --],
            [3, 4]],
      mask=[[False,  True],
            [False, False]],
      fill_value=999999)
    >>> np.resize(a, (3, 3))
    masked_array(
      data=[[1, 2, 3],
            [4, 1, 2],
            [3, 4, 1]],
      mask=False,
      fill_value=999999)
    >>> ma.resize(a, (3, 3))
    masked_array(
      data=[[1, --, 3],
            [4, 1, --],
            [3, 4, 1]],
      mask=[[False,  True, False],
            [False, False,  True],
            [False, False, False]],
      fill_value=999999)
 
    A MaskedArray is always returned, regardless of the input type.
 
    >>> a = np.array([[1, 2] ,[3, 4]])
    >>> ma.resize(a, (3, 3))
    masked_array(
      data=[[1, 2, 3],
            [4, 1, 2],
            [3, 4, 1]],
      mask=False,
      fill_value=999999)
 
    )rXr’rór£rBr=rrF)rVrôrêr1rÃrÃrÄr£es7 cCst t|ƒ¡S)z5
    maskedarray version of the numpy function.
 
    )rórrWr rÃrÃrÄr¥scCst t|ƒ¡S©ú*maskedarray version of the numpy function.)rór¨rWr rÃrÃrÄr¨¯scCst t|ƒ|¡Srõ)rór«rW)rÖrŠrÃrÃrÄr«µsc Cs|tk|tkf d¡}|dkr&tdƒ‚|dkr6t|ƒSt|dƒ}t|ƒ}t|ƒ}t|ƒ}t|ƒ}t|ƒ}    |tkrš|tk    rštj    d|j
d}tj d|    j
d}n0|tkrÊ|tk    rÊtj    d|j
d}tj d|j
d}    t  |||¡}
t  |||    ¡} t  |tj d| j
d| ¡} t | ƒ} t|
| dS)    a¡
    Return a masked array with elements from `x` or `y`, depending on condition.
 
    .. note::
        When only `condition` is provided, this function is identical to
        `nonzero`. The rest of this documentation covers only the case where
        all three arguments are provided.
 
    Parameters
    ----------
    condition : array_like, bool
        Where True, yield `x`, otherwise yield `y`.
    x, y : array_like, optional
        Values from which to choose. `x`, `y` and `condition` need to be
        broadcastable to some shape.
 
    Returns
    -------
    out : MaskedArray
        An masked array with `masked` elements where the condition is masked,
        elements from `x` where `condition` is True, and elements from `y`
        elsewhere.
 
    See Also
    --------
    numpy.where : Equivalent function in the top-level NumPy module.
    nonzero : The function that is called when x and y are omitted
 
    Examples
    --------
    >>> x = np.ma.array(np.arange(9.).reshape(3, 3), mask=[[0, 1, 0],
    ...                                                    [1, 0, 1],
    ...                                                    [0, 1, 0]])
    >>> x
    masked_array(
      data=[[0.0, --, 2.0],
            [--, 4.0, --],
            [6.0, --, 8.0]],
      mask=[[False,  True, False],
            [ True, False,  True],
            [False,  True, False]],
      fill_value=1e+20)
    >>> np.ma.where(x > 5, x, -3.1416)
    masked_array(
      data=[[-3.1416, --, -3.1416],
            [--, -3.1416, --],
            [6.0, --, 8.0]],
      mask=[[False,  True, False],
            [ True, False,  True],
            [False,  True, False]],
      fill_value=1e+20)
 
    TrÅz)Must provide both 'x' and 'y' or neither.rFrÃrr¥)r    r@r'r“rMrWrYrvrór½rr•r¼rœrw) r´rVr)Úmissingr¿ZxdZydÚcmZxmZymrCrDrÃrÃrÄr¼Às,8
c    s¬dd„‰dd„‰t|dƒ}‡fdd„|Dƒ}‡fdd„|Dƒ}tj|||d    }tt|t|ƒƒd
d d }tj||||d  t¡}|dk    ržt|tƒrš|     |¡|S|     |¡|S)aH
    Use an index array to construct a new array from a list of choices.
 
    Given an array of integers and a list of n choice arrays, this method
    will create a new array that merges each of the choice arrays.  Where a
    value in `index` is i, the new array will have the value that choices[i]
    contains in the same place.
 
    Parameters
    ----------
    indices : ndarray of ints
        This array must contain integers in ``[0, n-1]``, where n is the
        number of choices.
    choices : sequence of arrays
        Choice arrays. The index array and all of the choices should be
        broadcastable to the same shape.
    out : array, optional
        If provided, the result will be inserted into this array. It should
        be of the appropriate shape and `dtype`.
    mode : {'raise', 'wrap', 'clip'}, optional
        Specifies how out-of-bounds indices will behave.
 
        * 'raise' : raise an error
        * 'wrap' : wrap around
        * 'clip' : clip to the range
 
    Returns
    -------
    merged_array : array
 
    See Also
    --------
    choose : equivalent function
 
    Examples
    --------
    >>> choice = np.array([[1,1,1], [2,2,2], [3,3,3]])
    >>> a = np.array([2, 1, 0])
    >>> np.ma.choose(a, choice)
    masked_array(data=[3, 2, 1],
                 mask=False,
           fill_value=999999)
 
    cSs|tkr dSt|ƒS)z,Returns the filled array, or True if masked.T)rvrMrÑrÃrÃrÄÚfmaskHszchoose.<locals>.fmaskcSs|tkr dSt|ƒS)z:Returns the mask, True if ``masked``, False if ``nomask``.T)rvrXrÑrÃrÃrÄÚnmaskNszchoose.<locals>.nmaskrcsg|] }ˆ|ƒ‘qSrÃrérörV)rúrÃrÄrøVszchoose.<locals>.<listcomp>csg|] }ˆ|ƒ‘qSrÃrÃrû)rùrÃrÄrøWsrFTr£)rŽrÚN)
rMrór4rrrurXrBrr rÛ)    r`ÚchoicesrÚrŽrÝÚmasksrCZ
outputmaskrxrÃ)rùrúrÄr4s"-
ÿ
 
 
cCsD|dkrt |||¡St t|ƒ||¡t|dƒr<t|ƒ|_|SdS)aµ
    Return a copy of a, rounded to 'decimals' places.
 
    When 'decimals' is negative, it specifies the number of positions
    to the left of the decimal point.  The real and imaginary parts of
    complex numbers are rounded separately. Nothing is done if the
    array is not of float type and 'decimals' is greater than or equal
    to 0.
 
    Parameters
    ----------
    decimals : int
        Number of decimals to round to. May be negative.
    out : array_like
        Existing array to use for output.
        If not given, returns a default copy of a.
 
    Notes
    -----
    If out is given and does not have a mask attribute, the mask of a
    is lost!
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> x = [11.2, -3.973, 0.801, -1.41]
    >>> mask = [0, 0, 0, 1]
    >>> masked_x = ma.masked_array(x, mask)
    >>> masked_x
    masked_array(data=[11.2, -3.973, 0.801, --],
                 mask=[False, False, False, True],
        fill_value=1e+20)
    >>> ma.round_(masked_x)
    masked_array(data=[11.0, -4.0, 1.0, --],
                 mask=[False, False, False, True],
        fill_value=1e+20)
    >>> ma.round(masked_x, decimals=1)
    masked_array(data=[11.2, -4.0, 0.8, --],
                 mask=[False, False, False, True],
        fill_value=1e+20)
    >>> ma.round_(masked_x, decimals=-1)
    masked_array(data=[10.0, -0.0, 0.0, --],
                 mask=[False, False, False, True],
        fill_value=1e+20)
    NrF)rór¦rWr rXrF)r0r©rÚrÃrÃrÄr¦fs .
 
cCsŠt|dd}|jdkrtdƒ‚t|ƒ}|tks6| ¡s:|S| ¡}|j ¡|_|sdt    |t
  |d¡<|dkr†t    |dd…t
  |d¡f<|S)    aÞ
    Mask rows and/or columns of a 2D array that contain masked values.
 
    Mask whole rows and/or columns of a 2D array that contain
    masked values.  The masking behavior is selected using the
    `axis` parameter.
 
      - If `axis` is None, rows *and* columns are masked.
      - If `axis` is 0, only rows are masked.
      - If `axis` is 1 or -1, only columns are masked.
 
    Parameters
    ----------
    a : array_like, MaskedArray
        The array to mask.  If not a MaskedArray instance (or if no array
        elements are masked).  The result is a MaskedArray with `mask` set
        to `nomask` (False). Must be a 2D array.
    axis : int, optional
        Axis along which to perform the operation. If None, applies to a
        flattened version of the array.
 
    Returns
    -------
    a : MaskedArray
        A modified version of the input array, masked depending on the value
        of the `axis` parameter.
 
    Raises
    ------
    NotImplementedError
        If input array `a` is not 2D.
 
    See Also
    --------
    mask_rows : Mask rows of a 2D array that contain masked values.
    mask_cols : Mask cols of a 2D array that contain masked values.
    masked_where : Mask where a condition is met.
 
    Notes
    -----
    The input array's mask is modified by this function.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = np.zeros((3, 3), dtype=int)
    >>> a[1, 1] = 1
    >>> a
    array([[0, 0, 0],
           [0, 1, 0],
           [0, 0, 0]])
    >>> a = ma.masked_equal(a, 1)
    >>> a
    masked_array(
      data=[[0, 0, 0],
            [0, --, 0],
            [0, 0, 0]],
      mask=[[False, False, False],
            [False,  True, False],
            [False, False, False]],
      fill_value=1)
    >>> ma.mask_rowcols(a)
    masked_array(
      data=[[0, --, 0],
            [--, --, --],
            [0, --, 0]],
      mask=[[False,  True, False],
            [ True,  True,  True],
            [False,  True, False]],
      fill_value=1)
 
    FrLrz&mask_rowcols works for 2D arrays only.r)NrÅrÆNrÅ) r
rrrXr’r r“rFr<rvróÚunique)r0rŠrêZ    maskedvalrÃrÃrÄÚ mask_rowcols sI 
 rÿc    Cs|r,|jdkr,|jdkr,t|dƒ}t|dƒ}t|ƒ}t|ƒ}|dkr t t|dƒt|dƒ¡}t ||¡}|jdkr‚t |¡}| t||ƒ¡}|     |¡|St t|dƒt|dƒ|j
¡}|j j |j krÚt  |j t¡|_t |||j¡t |j|j¡|SdS)a•
    Return the dot product of two arrays.
 
    This function is the equivalent of `numpy.dot` that takes masked values
    into account. Note that `strict` and `out` are in different position
    than in the method version. In order to maintain compatibility with the
    corresponding method, it is recommended that the optional arguments be
    treated as keyword only.  At some point that may be mandatory.
 
    .. note::
      Works only with 2-D arrays at the moment.
 
 
    Parameters
    ----------
    a, b : masked_array_like
        Inputs arrays.
    strict : bool, optional
        Whether masked data are propagated (True) or set to 0 (False) for
        the computation. Default is False.  Propagating the mask means that
        if a masked value appears in a row or column, the whole row or
        column is considered masked.
    out : masked_array, optional
        Output argument. This must have the exact kind that would be returned
        if it was not used. In particular, it must have the right type, must be
        C-contiguous, and its dtype must be the dtype that would be returned
        for `dot(a,b)`. This is a performance feature. Therefore, if these
        conditions are not met, an exception is raised, instead of attempting
        to be flexible.
 
        .. versionadded:: 1.10.2
 
    See Also
    --------
    numpy.dot : Equivalent function for ndarrays.
 
    Examples
    --------
    >>> a = np.ma.array([[1, 2, 3], [4, 5, 6]], mask=[[1, 0, 0], [0, 0, 0]])
    >>> b = np.ma.array([[1, 2], [3, 4], [5, 6]], mask=[[1, 0], [0, 0], [0, 0]])
    >>> np.ma.dot(a, b)
    masked_array(
      data=[[21, 26],
            [45, 64]],
      mask=[[False, False],
            [False, False]],
      fill_value=999999)
    >>> np.ma.dot(a, b, strict=True)
    masked_array(
      data=[[--, --],
            [--, 64]],
      mask=[[ True,  True],
            [ True, False]],
      fill_value=999999)
 
    rrrÅN)rrÿrYrór˜rMr/rBr=rÛr@rDr¨rHrrFro)    r0rÜr—rÚÚamZbmrxrêrŠrÃrÃrÄr˜üs&;
 
 
 
 
 
 
r˜cCsFt|dƒ}t|dƒ}|jdkr$d|_|jdkr4d|_t ||¡ t¡S)zÛ
    Returns the inner product of a and b for arrays of floating point types.
 
    Like the generic NumPy equivalent the product sum is over the last dimension
    of a and b. The first argument is not conjugated.
 
    rrˆ)rMrr¨rórarBr)r0rÜrîrïrÃrÃrÄraNs
 
 
 
z Masked values are replaced by 0.cCsŒt|dƒ ¡}t|dƒ ¡}t ||¡}t|ƒ}t|ƒ}|tkrP|tkrPt|ƒSt|ƒ}t|ƒ}tdt d|d|¡dd}t||dS)rörrÅFr‡r¥)    rMrŸrór—rXr’rwrYrr)r0rÜrîrïrxr…r†rêrÃrÃrÄr—bs  cCsž|r`|t|ƒtjt |¡td|d|tjt |¡tdt|ƒ|dB}|t|ƒt|ƒ|d}n2|t|ƒt|ƒƒ}|t|dƒt|dƒ|d}t||dS)z:
    Helper function for ma.correlate and ma.convolve
    rrrr¥)rYrór•r¨r¯rWrMrw)rÞr0rÉrŽÚpropagate_maskrDrCrÃrÃrÄÚ_convolve_or_correlatets  ÿÿrÚvalidcCsttj||||ƒS)aä
    Cross-correlation of two 1-dimensional sequences.
 
    Parameters
    ----------
    a, v : array_like
        Input sequences.
    mode : {'valid', 'same', 'full'}, optional
        Refer to the `np.convolve` docstring.  Note that the default
        is 'valid', unlike `convolve`, which uses 'full'.
    propagate_mask : bool
        If True, then a result element is masked if any masked element contributes towards it.
        If False, then a result element is only masked if no non-masked element
        contribute towards it
 
    Returns
    -------
    out : MaskedArray
        Discrete cross-correlation of `a` and `v`.
 
    See Also
    --------
    numpy.correlate : Equivalent function in the top-level NumPy module.
    )rrór=©r0rÉrŽrrÃrÃrÄr=‡srcCsttj||||ƒS)aÊ
    Returns the discrete, linear convolution of two one-dimensional sequences.
 
    Parameters
    ----------
    a, v : array_like
        Input sequences.
    mode : {'valid', 'same', 'full'}, optional
        Refer to the `np.convolve` docstring.
    propagate_mask : bool
        If True, then if any masked element is included in the sum for a result
        element, then the result is masked.
        If False, then the result element is only masked if no non-masked cells
        contribute towards it
 
    Returns
    -------
    out : MaskedArray
        Discrete, linear convolution of `a` and `v`.
 
    See Also
    --------
    numpy.convolve : Equivalent function in the top-level NumPy module.
    )rrór;rrÃrÃrÄr;£scCs„tt|ƒt|ƒƒ}|tkr>t|ƒ}t|ƒ}t ||¡}| ¡S|r|t|ƒ}t|ƒ}t ||¡}t||dd}| d¡ d¡SdSdS)a
    Return True if all entries of a and b are equal, using
    fill_value as a truth value where either or both are masked.
 
    Parameters
    ----------
    a, b : array_like
        Input arrays to compare.
    fill_value : bool, optional
        Whether masked values in a or b are considered equal (True) or not
        (False).
 
    Returns
    -------
    y : bool
        Returns True if the two arrays are equal within the given
        tolerance, False otherwise. If either array contains NaN,
        then False is returned.
 
    See Also
    --------
    all, any
    numpy.ma.allclose
 
    Examples
    --------
    >>> a = np.ma.array([1e10, 1e-7, 42.0], mask=[0, 0, 1])
    >>> a
    masked_array(data=[10000000000.0, 1e-07, --],
                 mask=[False, False,  True],
           fill_value=1e+20)
 
    >>> b = np.array([1e10, 1e-7, -42.0])
    >>> b
    array([  1.00000000e+10,   1.00000000e-07,  -4.20000000e+01])
    >>> np.ma.allequal(a, b, fill_value=False)
    False
    >>> np.ma.allequal(a, b)
    True
 
    F)rDr<TN)    rurXr’rWrTrJrr
rM)r0rÜr+rêrVr)rxròrÃrÃrÄr¿s*  c Cs,t|dd}t|dd}|jjdkrHt |d¡}|j|krHt||dd}tt|ƒt|ƒƒ}t t|d|d¡ d¡}    t     |    tt |¡dƒk¡s’dSt 
|    ¡sÊtt t ||ƒ||t |ƒƒ|ƒ}
t     |
¡St     t||    ||    k|ƒ¡sêdS||    }||    }tt t ||ƒ||t |ƒƒ|ƒ}
t     |
¡S)aL
    Returns True if two arrays are element-wise equal within a tolerance.
 
    This function is equivalent to `allclose` except that masked values
    are treated as equal (default) or unequal, depending on the `masked_equal`
    argument.
 
    Parameters
    ----------
    a, b : array_like
        Input arrays to compare.
    masked_equal : bool, optional
        Whether masked values in `a` and `b` are considered equal (True) or not
        (False). They are considered equal by default.
    rtol : float, optional
        Relative tolerance. The relative difference is equal to ``rtol * b``.
        Default is 1e-5.
    atol : float, optional
        Absolute tolerance. The absolute difference is equal to `atol`.
        Default is 1e-8.
 
    Returns
    -------
    y : bool
        Returns True if the two arrays are equal within the given
        tolerance, False otherwise. If either array contains NaN, then
        False is returned.
 
    See Also
    --------
    all, any
    numpy.allclose : the non-masked `allclose`.
 
    Notes
    -----
    If the following equation is element-wise True, then `allclose` returns
    True::
 
      absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`))
 
    Return True if all elements of `a` and `b` are equal subject to
    given tolerances.
 
    Examples
    --------
    >>> a = np.ma.array([1e10, 1e-7, 42.0], mask=[0, 0, 1])
    >>> a
    masked_array(data=[10000000000.0, 1e-07, --],
                 mask=[False, False,  True],
           fill_value=1e+20)
    >>> b = np.ma.array([1e10, 1e-8, -42.0], mask=[0, 0, 1])
    >>> np.ma.allclose(a, b)
    False
 
    >>> a = np.ma.array([1e10, 1e-8, 42.0], mask=[0, 0, 1])
    >>> b = np.ma.array([1.00001e10, 1e-9, -42.0], mask=[0, 0, 1])
    >>> np.ma.allclose(a, b)
    True
    >>> np.ma.allclose(a, b, masked_equal=False)
    False
 
    Masked values are not compared directly.
 
    >>> a = np.ma.array([1e10, 1e-8, 42.0], mask=[0, 0, 1])
    >>> b = np.ma.array([1.00001e10, 1e-9, 42.0], mask=[0, 0, 1])
    >>> np.ma.allclose(a, b)
    True
    >>> np.ma.allclose(a, b, masked_equal=False)
    False
 
    Fr‡rêr“)rr<)r<rD) rwrrróZ result_typerurXÚisinfrMrr rjr) r0rÜrxr¾r½rVr)rrêZxinfrxrÃrÃrÄrùs.H    
 
ÿ
 
 
ÿcCs|pd}t||ddd|dS)aí
    Convert the input to a masked array of the given data-type.
 
    No copy is performed if the input is already an `ndarray`. If `a` is
    a subclass of `MaskedArray`, a base class `MaskedArray` is returned.
 
    Parameters
    ----------
    a : array_like
        Input data, in any form that can be converted to a masked array. This
        includes lists, lists of tuples, tuples, tuples of tuples, tuples
        of lists, ndarrays and masked arrays.
    dtype : dtype, optional
        By default, the data-type is inferred from the input data.
    order : {'C', 'F'}, optional
        Whether to use row-major ('C') or column-major ('FORTRAN') memory
        representation.  Default is 'C'.
 
    Returns
    -------
    out : MaskedArray
        Masked array interpretation of `a`.
 
    See Also
    --------
    asanyarray : Similar to `asarray`, but conserves subclasses.
 
    Examples
    --------
    >>> x = np.arange(10.).reshape(2, 5)
    >>> x
    array([[0., 1., 2., 3., 4.],
           [5., 6., 7., 8., 9.]])
    >>> np.ma.asarray(x)
    masked_array(
      data=[[0., 1., 2., 3., 4.],
            [5., 6., 7., 8., 9.]],
      mask=False,
      fill_value=1e+20)
    >>> type(np.ma.asarray(x))
    <class 'numpy.ma.core.MaskedArray'>
 
    rFT)rr<rür?rñ©rw)r0rrñrÃrÃrÄr/es
,
ÿcCs2t|tƒr |dks||jkr |St||ddddS)ae
    Convert the input to a masked array, conserving subclasses.
 
    If `a` is a subclass of `MaskedArray`, its class is conserved.
    No copy is performed if the input is already an `ndarray`.
 
    Parameters
    ----------
    a : array_like
        Input data, in any form that can be converted to an array.
    dtype : dtype, optional
        By default, the data-type is inferred from the input data.
    order : {'C', 'F'}, optional
        Whether to use row-major ('C') or column-major ('FORTRAN') memory
        representation.  Default is 'C'.
 
    Returns
    -------
    out : MaskedArray
        MaskedArray interpretation of `a`.
 
    See Also
    --------
    asarray : Similar to `asanyarray`, but does not conserve subclass.
 
    Examples
    --------
    >>> x = np.arange(10.).reshape(2, 5)
    >>> x
    array([[0., 1., 2., 3., 4.],
           [5., 6., 7., 8., 9.]])
    >>> np.ma.asanyarray(x)
    masked_array(
      data=[[0., 1., 2., 3., 4.],
            [5., 6., 7., 8., 9.]],
      mask=False,
      fill_value=1e+20)
    >>> type(np.ma.asanyarray(x))
    <class 'numpy.ma.core.MaskedArray'>
 
    NFT)rr<rür?)r rrrw)r0rrÃrÃrÄr.–s,rÎcCs tdƒ‚dS)Nz1fromfile() not yet implemented for a MaskedArray.r")Úfilerr@rºrÃrÃrÄÚfromfileÌsÿrcCst|d|ddS)aÕ
    Build a masked array from a suitable flexible-type array.
 
    The input array has to have a data-type with ``_data`` and ``_mask``
    fields. This type of array is output by `MaskedArray.toflex`.
 
    Parameters
    ----------
    fxarray : ndarray
        The structured input array, containing ``_data`` and ``_mask``
        fields. If present, other fields are discarded.
 
    Returns
    -------
    result : MaskedArray
        The constructed masked array.
 
    See Also
    --------
    MaskedArray.toflex : Build a flexible-type array from a masked array.
 
    Examples
    --------
    >>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[0] + [1, 0] * 4)
    >>> rec = x.toflex()
    >>> rec
    array([[(0, False), (1,  True), (2, False)],
           [(3,  True), (4, False), (5,  True)],
           [(6, False), (7,  True), (8, False)]],
          dtype=[('_data', '<i8'), ('_mask', '?')])
    >>> x2 = np.ma.fromflex(rec)
    >>> x2
    masked_array(
      data=[[0, --, 2],
            [--, 4, --],
            [6, --, 8]],
      mask=[[False,  True, False],
            [ True, False,  True],
            [False,  True, False]],
      fill_value=999999)
 
    Extra fields can be present in the structured array but are discarded:
 
    >>> dt = [('_data', '<i4'), ('_mask', '|b1'), ('field3', '<f4')]
    >>> rec2 = np.zeros((2, 2), dtype=dt)
    >>> rec2
    array([[(0, False, 0.), (0, False, 0.)],
           [(0, False, 0.), (0, False, 0.)]],
          dtype=[('_data', '<i4'), ('_mask', '?'), ('field3', '<f4')])
    >>> y = np.ma.fromflex(rec2)
    >>> y
    masked_array(
      data=[[0, 0],
            [0, 0]],
      mask=[[False, False],
            [False, False]],
      fill_value=999999,
      dtype=int32)
 
    r@rFr¥r)ZfxarrayrÃrÃrÄrUÑs=c@s6eZdZdZdZd dd„Zdd„Zdd„Zd    d
„ZdS) Ú _convert2maz
    Convert functions from numpy to numpy.ma.
 
    Parameters
    ----------
        _methodname : string
            Name of the method to transform.
 
    NcCs(tt|ƒ|_| ||¡|_|p i|_dSrý)ršróÚ_funcrärÚÚ_extras)rNrÞÚnp_retÚ    np_ma_retrÜrÃrÃrÄrO s z_convert2ma.__init__cCsJt|jddƒ}t|jƒ}|rF| |||¡}|r>d|jj|f}||}|S)rçrÚNz%s%s
)ršr
rØÚ_replace_return_typerÀ)rNr r rêr×rÃrÃrÄrä# s
z_convert2ma.getdocc CsD||kr8td|›d|›d|›d|jj›d|jj›d ƒ‚| ||¡S)a
        Replace documentation of ``np`` function's return type.
 
        Replaces it with the proper type for the ``np.ma`` function.
 
        Parameters
        ----------
        doc : str
            The documentation of the ``np`` method.
        np_ret : str
            The return type string of the ``np`` method that we want to
            replace. (e.g. "out : ndarray")
        np_ma_ret : str
            The return type string of the ``np.ma`` method.
            (e.g. "out : MaskedArray")
        zFailed to replace `z` with `z-`. The documentation string for return type, z(, is not found in the docstring for `np.z`. Fix the docstring for `np.z0` or update the expected string for return type.)rr
rÀÚreplace)rNrêr r rÃrÃrÄr/ s
*ÿz _convert2ma._replace_return_typecOst|j}t|ƒ |¡}|D]}| |¡||<q|jj||Ž t¡}d|krV| dd¡|_    d|krpt
| dd¡ƒ|_ |S)Nr+rçrýF) r ÚsetÚ intersectionÚpopr
rWrBrrr+r¯ré)rNrvrÜr Z common_paramsÚpr1rÃrÃrÄrWK sz_convert2ma.__call__)N)rÀrÁrÂrÚrOrärrWrÃrÃrÃrÄr     s     
 r    )r+rçzarange : ndarrayzarange : MaskedArray)rÜr r zclipped_array : ndarrayzclipped_array : MaskedArrayzdiff : ndarrayzdiff : MaskedArrayz out : ndarrayzout : MaskedArray)r r zout: MaskedArrayzfromfunction : anyzfromfunction: MaskedArrayz'grid : one ndarray or tuple of ndarraysz/grid : one MaskedArray or tuple of MaskedArrayszsqueezed : ndarrayzsqueezed : MaskedArraycCst||g|ƒS)aAppend values to the end of an array.
 
    .. versionadded:: 1.9.0
 
    Parameters
    ----------
    a : array_like
        Values are appended to a copy of this array.
    b : array_like
        These values are appended to a copy of `a`.  It must be of the
        correct shape (the same shape as `a`, excluding `axis`).  If `axis`
        is not specified, `b` can be any shape and will be flattened
        before use.
    axis : int, optional
        The axis along which `v` are appended.  If `axis` is not given,
        both `a` and `b` are flattened before use.
 
    Returns
    -------
    append : MaskedArray
        A copy of `a` with `b` appended to `axis`.  Note that `append`
        does not occur in-place: a new array is allocated and filled.  If
        `axis` is None, the result is a flattened array.
 
    See Also
    --------
    numpy.append : Equivalent function in the top-level NumPy module.
 
    Examples
    --------
    >>> import numpy.ma as ma
    >>> a = ma.masked_values([1, 2, 3], 2)
    >>> b = ma.masked_values([[4, 5, 6], [7, 8, 9]], 7)
    >>> ma.append(a, b)
    masked_array(data=[1, --, 3, 4, 5, 6, --, 8, 9],
                 mask=[False,  True, False, False, False, False,  True, False,
                       False],
           fill_value=999999)
    )r9)r0rÜrŠrÃrÃrÄr!¬ s()N)T)N)FT)T)T)T)T)T)T)T)T)T)TT)r»r¼TT)T)T)NNrŒ)N)rÆNNTN)r)r)rŒ)N)r)N)NrŒ)rN)N)FN)rT)rT)T)Tr»r¼)NN)N)N(rÚrIrÑrMrÊÚtextwraprÏÚ    functoolsrÚnumpyróZnumpy.core.umathrCrTZnumpy.core.numerictypesZ numerictypesržZ
numpy.corerr rrrrrr    r
r+Znumpy.lib.function_baser Z numpy.compatr r rrrrZnumpy.core.numericrÚ__all__rr’r×r¿rÍrÔrØr‚rrrrÉZ
datetime64Z timedelta64ZhalfZsingleÚdoubleZ
longdoubleZcsingleZcdoubleZ clongdoubleZfloat_types_listZ_minvalsrrZ_maxvalsrrþrrCrrŒrˆr r.r§r2r6rMr=rWÚget_datarNrKrmrnrLrYr]r`rdrerir|rrKr:r©r>r'r&rªr?r·rrrLr‘rQr3r¦r-ror¯rkrmrlr¶r%r#r$r)rr²rŽr(rJr”rjr[rirZrnrrpr­rqr0r1r2r]rGrºrRr rSrr”r™rsrXZget_maskrYrerœrrrtrŸrurOr±r…ryrzr}r~rrxr{rr€r„r|rÅr‚rÏr5ÚdedentrDrÐrPrárârrÅrrdrgrcr8rvrƒrwrfrÞrŠr†rœrãrrrr r7rArBr<rEr\r_r‡r‰r‹r“ršr›rŸr¡rÂr¬r±r³r´r¸r»r@rµr™r+r*r,r®r8r9rDrhr¤rržr¹r¢r£rr¨r«r¼r4r¥rÿr˜rarbr—r˜rr=r;rrr/r.r_rrUr    r"r5rFrHrIrTrVr^r`r•r–r°r½r¾r!rÃrÃrÃrÄÚ<module>s¨       ß$ø ÿ
733 ,A   9 3:
 
JL
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ÿ
ÿ
ÿ
ÿ
ÿ
 ÿ
 ÿ
ÿ
 ÿ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ÿÿÿ   
!
;
5
D
Y2
8
8 z ((DH(0
 
 
 
 
ë" 
7-l;

3t
þ 
:C
 
 
 
    
) 
M
 
<
 
 
'&
@
 
 
 
 
[K5\R
ÿ
ÿ :l16 @Jü
ü
ü
ü
ý
ý
ý
ü
ü
ü
ý
ü
ü
ý