matplotlib-rs 0.0.8__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. docs/releases/0.0.1.md +268 -0
  2. docs/releases/0.0.2.md +69 -0
  3. docs/releases/0.0.3.md +80 -0
  4. docs/releases/0.0.4.md +73 -0
  5. docs/releases/0.0.5.md +24 -0
  6. docs/releases/0.0.6.md +24 -0
  7. docs/releases/0.0.7.md +24 -0
  8. docs/releases/0.0.8.md +16 -0
  9. licenses/LICENSE_CONTOURPY +29 -0
  10. licenses/LICENSE_CYCLER +27 -0
  11. licenses/LICENSE_DATEUTIL +54 -0
  12. licenses/LICENSE_KIWISOLVER +71 -0
  13. licenses/LICENSE_LIBWEBP +56 -0
  14. licenses/LICENSE_MATPLOTLIB +1253 -0
  15. licenses/LICENSE_PYPARSING +20 -0
  16. licenses/LICENSE_QHULL +39 -0
  17. licenses/LICENSE_SIX +18 -0
  18. matplotlib_rs/__init__.py +1683 -0
  19. matplotlib_rs/__main__.py +27 -0
  20. matplotlib_rs/_afm.py +500 -0
  21. matplotlib_rs/_animation_data.py +263 -0
  22. matplotlib_rs/_api/__init__.py +495 -0
  23. matplotlib_rs/_api/deprecation.py +534 -0
  24. matplotlib_rs/_axis_py.py +2991 -0
  25. matplotlib_rs/_blocking_input.py +31 -0
  26. matplotlib_rs/_cm.py +1500 -0
  27. matplotlib_rs/_cm_bivar.py +1289 -0
  28. matplotlib_rs/_cm_listed.py +2848 -0
  29. matplotlib_rs/_cm_multivar.py +167 -0
  30. matplotlib_rs/_color_data.py +1142 -0
  31. matplotlib_rs/_colormap.py +132 -0
  32. matplotlib_rs/_constrained_layout.py +825 -0
  33. matplotlib_rs/_contour.py +108 -0
  34. matplotlib_rs/_doc_cache.py +12214 -0
  35. matplotlib_rs/_docstring.py +142 -0
  36. matplotlib_rs/_enums.py +178 -0
  37. matplotlib_rs/_figure_rs.py +294 -0
  38. matplotlib_rs/_fontconfig_pattern.py +129 -0
  39. matplotlib_rs/_foreign.py +220 -0
  40. matplotlib_rs/_hook.py +94 -0
  41. matplotlib_rs/_image.py +160 -0
  42. matplotlib_rs/_imageio.py +229 -0
  43. matplotlib_rs/_internal_utils.py +65 -0
  44. matplotlib_rs/_kiwi.py +484 -0
  45. matplotlib_rs/_layoutgrid.py +549 -0
  46. matplotlib_rs/_live.py +192 -0
  47. matplotlib_rs/_mathtext.py +3103 -0
  48. matplotlib_rs/_mathtext_data.py +1811 -0
  49. matplotlib_rs/_mplrs.cp313-win_amd64.pyd +0 -0
  50. matplotlib_rs/_path.py +25 -0
  51. matplotlib_rs/_png.py +162 -0
  52. matplotlib_rs/_pylab_helpers.py +137 -0
  53. matplotlib_rs/_qhull.py +66 -0
  54. matplotlib_rs/_rcpush.py +84 -0
  55. matplotlib_rs/_spines_rs.py +108 -0
  56. matplotlib_rs/_style_helpers.py +52 -0
  57. matplotlib_rs/_text_helpers.py +51 -0
  58. matplotlib_rs/_tight_bbox.py +85 -0
  59. matplotlib_rs/_tight_layout.py +302 -0
  60. matplotlib_rs/_tri.py +140 -0
  61. matplotlib_rs/_type1font.py +1228 -0
  62. matplotlib_rs/_vendor/__init__.py +8 -0
  63. matplotlib_rs/_vendor/cycler.py +574 -0
  64. matplotlib_rs/_vendor/dateutil/__init__.py +27 -0
  65. matplotlib_rs/_vendor/dateutil/_common.py +44 -0
  66. matplotlib_rs/_vendor/dateutil/_tzdata_impl.py +148 -0
  67. matplotlib_rs/_vendor/dateutil/_version.py +5 -0
  68. matplotlib_rs/_vendor/dateutil/easter.py +90 -0
  69. matplotlib_rs/_vendor/dateutil/parser/__init__.py +62 -0
  70. matplotlib_rs/_vendor/dateutil/parser/_parser.py +1614 -0
  71. matplotlib_rs/_vendor/dateutil/parser/isoparser.py +417 -0
  72. matplotlib_rs/_vendor/dateutil/relativedelta.py +597 -0
  73. matplotlib_rs/_vendor/dateutil/rrule.py +1765 -0
  74. matplotlib_rs/_vendor/dateutil/tz/__init__.py +61 -0
  75. matplotlib_rs/_vendor/dateutil/tz/_common.py +420 -0
  76. matplotlib_rs/_vendor/dateutil/tz/_factories.py +81 -0
  77. matplotlib_rs/_vendor/dateutil/tz/_tzfile.py +1429 -0
  78. matplotlib_rs/_vendor/dateutil/tz/_tzpath.py +105 -0
  79. matplotlib_rs/_vendor/dateutil/tz/tz.py +1473 -0
  80. matplotlib_rs/_vendor/dateutil/tz/win.py +371 -0
  81. matplotlib_rs/_vendor/dateutil/tzwin.py +3 -0
  82. matplotlib_rs/_vendor/dateutil/utils.py +72 -0
  83. matplotlib_rs/_vendor/dateutil/zoneinfo/__init__.py +234 -0
  84. matplotlib_rs/_vendor/pyparsing/__init__.py +414 -0
  85. matplotlib_rs/_vendor/pyparsing/actions.py +265 -0
  86. matplotlib_rs/_vendor/pyparsing/common.py +571 -0
  87. matplotlib_rs/_vendor/pyparsing/core.py +6973 -0
  88. matplotlib_rs/_vendor/pyparsing/exceptions.py +354 -0
  89. matplotlib_rs/_vendor/pyparsing/helpers.py +1770 -0
  90. matplotlib_rs/_vendor/pyparsing/results.py +929 -0
  91. matplotlib_rs/_vendor/pyparsing/testing.py +399 -0
  92. matplotlib_rs/_vendor/pyparsing/unicode.py +357 -0
  93. matplotlib_rs/_vendor/pyparsing/util.py +515 -0
  94. matplotlib_rs/_vendor/pyparsing/warnings.py +11 -0
  95. matplotlib_rs/_vendor/six.py +1004 -0
  96. matplotlib_rs/animation.py +1843 -0
  97. matplotlib_rs/artist.py +2302 -0
  98. matplotlib_rs/axes/__init__.py +19 -0
  99. matplotlib_rs/axes/_axes.py +9402 -0
  100. matplotlib_rs/axes/_bar.py +185 -0
  101. matplotlib_rs/axes/_base.py +5236 -0
  102. matplotlib_rs/axes/_base_rs.py +727 -0
  103. matplotlib_rs/axes/_boxplot.py +391 -0
  104. matplotlib_rs/axes/_hist.py +99 -0
  105. matplotlib_rs/axes/_secondary_axes.py +357 -0
  106. matplotlib_rs/axis.py +1963 -0
  107. matplotlib_rs/backend_bases.py +3760 -0
  108. matplotlib_rs/backend_managers.py +388 -0
  109. matplotlib_rs/backend_tools.py +1002 -0
  110. matplotlib_rs/backends/__init__.py +6 -0
  111. matplotlib_rs/backends/_backend_pdf_ps.py +451 -0
  112. matplotlib_rs/backends/backend_agg.py +552 -0
  113. matplotlib_rs/backends/backend_mixed.py +123 -0
  114. matplotlib_rs/backends/backend_pdf.py +2711 -0
  115. matplotlib_rs/backends/backend_pgf.py +1031 -0
  116. matplotlib_rs/backends/backend_ps.py +1491 -0
  117. matplotlib_rs/backends/backend_svg.py +1395 -0
  118. matplotlib_rs/backends/backend_template.py +214 -0
  119. matplotlib_rs/backends/registry.py +423 -0
  120. matplotlib_rs/bezier.py +691 -0
  121. matplotlib_rs/category.py +236 -0
  122. matplotlib_rs/cbook.py +2762 -0
  123. matplotlib_rs/cm.py +251 -0
  124. matplotlib_rs/collections.py +2711 -0
  125. matplotlib_rs/colorbar.py +1586 -0
  126. matplotlib_rs/colorizer.py +909 -0
  127. matplotlib_rs/colors.py +4278 -0
  128. matplotlib_rs/container.py +256 -0
  129. matplotlib_rs/contour.py +1756 -0
  130. matplotlib_rs/dates.py +1847 -0
  131. matplotlib_rs/dviread.py +1386 -0
  132. matplotlib_rs/figure.py +3815 -0
  133. matplotlib_rs/font_manager.py +1855 -0
  134. matplotlib_rs/ft2font.py +515 -0
  135. matplotlib_rs/gridspec.py +808 -0
  136. matplotlib_rs/hatch.py +244 -0
  137. matplotlib_rs/image.py +1863 -0
  138. matplotlib_rs/inset.py +291 -0
  139. matplotlib_rs/layout_engine.py +310 -0
  140. matplotlib_rs/legend.py +1480 -0
  141. matplotlib_rs/legend_handler.py +812 -0
  142. matplotlib_rs/lines.py +1886 -0
  143. matplotlib_rs/markers.py +908 -0
  144. matplotlib_rs/mathtext.py +141 -0
  145. matplotlib_rs/mlab.py +959 -0
  146. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf +0 -0
  147. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf +0 -0
  148. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf +0 -0
  149. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSans.ttf +0 -0
  150. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf +0 -0
  151. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf +0 -0
  152. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf +0 -0
  153. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf +0 -0
  154. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSansMono.ttf +0 -0
  155. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf +0 -0
  156. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf +0 -0
  157. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf +0 -0
  158. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerif.ttf +0 -0
  159. matplotlib_rs/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf +0 -0
  160. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_DEJAVU +99 -0
  161. matplotlib_rs/mpl-data/fonts/ttf/LICENSE_STIX +124 -0
  162. matplotlib_rs/mpl-data/fonts/ttf/LastResortHE-Regular.ttf +0 -0
  163. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneral.ttf +0 -0
  164. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBol.ttf +0 -0
  165. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf +0 -0
  166. matplotlib_rs/mpl-data/fonts/ttf/STIXGeneralItalic.ttf +0 -0
  167. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUni.ttf +0 -0
  168. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBol.ttf +0 -0
  169. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf +0 -0
  170. matplotlib_rs/mpl-data/fonts/ttf/STIXNonUniIta.ttf +0 -0
  171. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf +0 -0
  172. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf +0 -0
  173. matplotlib_rs/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf +0 -0
  174. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf +0 -0
  175. matplotlib_rs/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf +0 -0
  176. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf +0 -0
  177. matplotlib_rs/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf +0 -0
  178. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf +0 -0
  179. matplotlib_rs/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf +0 -0
  180. matplotlib_rs/mpl-data/fonts/ttf/cmb10.ttf +0 -0
  181. matplotlib_rs/mpl-data/fonts/ttf/cmex10.ttf +0 -0
  182. matplotlib_rs/mpl-data/fonts/ttf/cmmi10.ttf +0 -0
  183. matplotlib_rs/mpl-data/fonts/ttf/cmr10.ttf +0 -0
  184. matplotlib_rs/mpl-data/fonts/ttf/cmss10.ttf +0 -0
  185. matplotlib_rs/mpl-data/fonts/ttf/cmsy10.ttf +0 -0
  186. matplotlib_rs/mpl-data/fonts/ttf/cmti10.ttf +0 -0
  187. matplotlib_rs/mpl-data/fonts/ttf/cmtt10.ttf +0 -0
  188. matplotlib_rs/mpl-data/images/back-symbolic.svg +46 -0
  189. matplotlib_rs/mpl-data/images/back.pdf +0 -0
  190. matplotlib_rs/mpl-data/images/back.png +0 -0
  191. matplotlib_rs/mpl-data/images/back.svg +46 -0
  192. matplotlib_rs/mpl-data/images/back_large.png +0 -0
  193. matplotlib_rs/mpl-data/images/filesave-symbolic.svg +68 -0
  194. matplotlib_rs/mpl-data/images/filesave.pdf +72 -0
  195. matplotlib_rs/mpl-data/images/filesave.png +0 -0
  196. matplotlib_rs/mpl-data/images/filesave.svg +68 -0
  197. matplotlib_rs/mpl-data/images/filesave_large.png +0 -0
  198. matplotlib_rs/mpl-data/images/forward-symbolic.svg +46 -0
  199. matplotlib_rs/mpl-data/images/forward.pdf +0 -0
  200. matplotlib_rs/mpl-data/images/forward.png +0 -0
  201. matplotlib_rs/mpl-data/images/forward.svg +46 -0
  202. matplotlib_rs/mpl-data/images/forward_large.png +0 -0
  203. matplotlib_rs/mpl-data/images/hand.pdf +0 -0
  204. matplotlib_rs/mpl-data/images/hand.png +0 -0
  205. matplotlib_rs/mpl-data/images/hand.svg +130 -0
  206. matplotlib_rs/mpl-data/images/help-symbolic.svg +52 -0
  207. matplotlib_rs/mpl-data/images/help.pdf +71 -0
  208. matplotlib_rs/mpl-data/images/help.png +0 -0
  209. matplotlib_rs/mpl-data/images/help.svg +52 -0
  210. matplotlib_rs/mpl-data/images/help_large.png +0 -0
  211. matplotlib_rs/mpl-data/images/home-symbolic.svg +59 -0
  212. matplotlib_rs/mpl-data/images/home.pdf +0 -0
  213. matplotlib_rs/mpl-data/images/home.png +0 -0
  214. matplotlib_rs/mpl-data/images/home.svg +59 -0
  215. matplotlib_rs/mpl-data/images/home_large.png +0 -0
  216. matplotlib_rs/mpl-data/images/matplotlib.pdf +0 -0
  217. matplotlib_rs/mpl-data/images/matplotlib.png +0 -0
  218. matplotlib_rs/mpl-data/images/matplotlib.svg +3171 -0
  219. matplotlib_rs/mpl-data/images/matplotlib_large.png +0 -0
  220. matplotlib_rs/mpl-data/images/move-symbolic.svg +73 -0
  221. matplotlib_rs/mpl-data/images/move.pdf +0 -0
  222. matplotlib_rs/mpl-data/images/move.png +0 -0
  223. matplotlib_rs/mpl-data/images/move.svg +73 -0
  224. matplotlib_rs/mpl-data/images/move_large.png +0 -0
  225. matplotlib_rs/mpl-data/images/qt4_editor_options.pdf +0 -0
  226. matplotlib_rs/mpl-data/images/qt4_editor_options.png +0 -0
  227. matplotlib_rs/mpl-data/images/qt4_editor_options.svg +48 -0
  228. matplotlib_rs/mpl-data/images/qt4_editor_options_large.png +0 -0
  229. matplotlib_rs/mpl-data/images/subplots-symbolic.svg +81 -0
  230. matplotlib_rs/mpl-data/images/subplots.pdf +0 -0
  231. matplotlib_rs/mpl-data/images/subplots.png +0 -0
  232. matplotlib_rs/mpl-data/images/subplots.svg +81 -0
  233. matplotlib_rs/mpl-data/images/subplots_large.png +0 -0
  234. matplotlib_rs/mpl-data/images/zoom_to_rect-symbolic.svg +40 -0
  235. matplotlib_rs/mpl-data/images/zoom_to_rect.pdf +69 -0
  236. matplotlib_rs/mpl-data/images/zoom_to_rect.png +0 -0
  237. matplotlib_rs/mpl-data/images/zoom_to_rect.svg +40 -0
  238. matplotlib_rs/mpl-data/images/zoom_to_rect_large.png +0 -0
  239. matplotlib_rs/mpl-data/kpsewhich.lua +4 -0
  240. matplotlib_rs/mpl-data/matplotlibrc +849 -0
  241. matplotlib_rs/mpl-data/plot_directive/plot_directive.css +16 -0
  242. matplotlib_rs/mpl-data/sample_data/Minduka_Present_Blue_Pack.png +0 -0
  243. matplotlib_rs/mpl-data/sample_data/README.txt +2 -0
  244. matplotlib_rs/mpl-data/sample_data/Stocks.csv +526 -0
  245. matplotlib_rs/mpl-data/sample_data/axes_grid/bivariate_normal.npy +0 -0
  246. matplotlib_rs/mpl-data/sample_data/data_x_x2_x3.csv +11 -0
  247. matplotlib_rs/mpl-data/sample_data/eeg.dat +0 -0
  248. matplotlib_rs/mpl-data/sample_data/embedding_in_wx3.xrc +65 -0
  249. matplotlib_rs/mpl-data/sample_data/goog.npz +0 -0
  250. matplotlib_rs/mpl-data/sample_data/grace_hopper.jpg +0 -0
  251. matplotlib_rs/mpl-data/sample_data/jacksboro_fault_dem.npz +0 -0
  252. matplotlib_rs/mpl-data/sample_data/logo2.png +0 -0
  253. matplotlib_rs/mpl-data/sample_data/membrane.dat +0 -0
  254. matplotlib_rs/mpl-data/sample_data/msft.csv +66 -0
  255. matplotlib_rs/mpl-data/sample_data/s1045.ima.gz +0 -0
  256. matplotlib_rs/mpl-data/sample_data/topobathy.npz +0 -0
  257. matplotlib_rs/mpl-data/stylelib/Solarize_Light2.mplstyle +53 -0
  258. matplotlib_rs/mpl-data/stylelib/_classic_test_patch.mplstyle +8 -0
  259. matplotlib_rs/mpl-data/stylelib/_mpl-gallery-nogrid.mplstyle +19 -0
  260. matplotlib_rs/mpl-data/stylelib/_mpl-gallery.mplstyle +19 -0
  261. matplotlib_rs/mpl-data/stylelib/bmh.mplstyle +27 -0
  262. matplotlib_rs/mpl-data/stylelib/classic.mplstyle +491 -0
  263. matplotlib_rs/mpl-data/stylelib/dark_background.mplstyle +26 -0
  264. matplotlib_rs/mpl-data/stylelib/fast.mplstyle +11 -0
  265. matplotlib_rs/mpl-data/stylelib/fivethirtyeight.mplstyle +37 -0
  266. matplotlib_rs/mpl-data/stylelib/ggplot.mplstyle +39 -0
  267. matplotlib_rs/mpl-data/stylelib/grayscale.mplstyle +29 -0
  268. matplotlib_rs/mpl-data/stylelib/petroff10.mplstyle +5 -0
  269. matplotlib_rs/mpl-data/stylelib/petroff6.mplstyle +5 -0
  270. matplotlib_rs/mpl-data/stylelib/petroff8.mplstyle +5 -0
  271. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-bright.mplstyle +3 -0
  272. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-colorblind.mplstyle +3 -0
  273. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark-palette.mplstyle +3 -0
  274. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-dark.mplstyle +30 -0
  275. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-darkgrid.mplstyle +30 -0
  276. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-deep.mplstyle +3 -0
  277. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-muted.mplstyle +3 -0
  278. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-notebook.mplstyle +21 -0
  279. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-paper.mplstyle +21 -0
  280. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-pastel.mplstyle +3 -0
  281. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-poster.mplstyle +21 -0
  282. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-talk.mplstyle +21 -0
  283. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-ticks.mplstyle +30 -0
  284. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-white.mplstyle +30 -0
  285. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8-whitegrid.mplstyle +30 -0
  286. matplotlib_rs/mpl-data/stylelib/seaborn-v0_8.mplstyle +57 -0
  287. matplotlib_rs/mpl-data/stylelib/tableau-colorblind10.mplstyle +3 -0
  288. matplotlib_rs/mpl_toolkits/__init__.py +3 -0
  289. matplotlib_rs/mpl_toolkits/axes_grid1/__init__.py +11 -0
  290. matplotlib_rs/mpl_toolkits/axes_grid1/anchored_artists.py +415 -0
  291. matplotlib_rs/mpl_toolkits/axes_grid1/axes_divider.py +619 -0
  292. matplotlib_rs/mpl_toolkits/axes_grid1/axes_grid.py +565 -0
  293. matplotlib_rs/mpl_toolkits/axes_grid1/axes_rgb.py +158 -0
  294. matplotlib_rs/mpl_toolkits/axes_grid1/axes_size.py +272 -0
  295. matplotlib_rs/mpl_toolkits/axes_grid1/inset_locator.py +525 -0
  296. matplotlib_rs/mpl_toolkits/axes_grid1/mpl_axes.py +129 -0
  297. matplotlib_rs/mpl_toolkits/axes_grid1/parasite_axes.py +261 -0
  298. matplotlib_rs/mpl_toolkits/axisartist/__init__.py +15 -0
  299. matplotlib_rs/mpl_toolkits/axisartist/angle_helper.py +396 -0
  300. matplotlib_rs/mpl_toolkits/axisartist/axes_divider.py +3 -0
  301. matplotlib_rs/mpl_toolkits/axisartist/axis_artist.py +1148 -0
  302. matplotlib_rs/mpl_toolkits/axisartist/axisline_style.py +193 -0
  303. matplotlib_rs/mpl_toolkits/axisartist/axislines.py +475 -0
  304. matplotlib_rs/mpl_toolkits/axisartist/floating_axes.py +265 -0
  305. matplotlib_rs/mpl_toolkits/axisartist/grid_finder.py +329 -0
  306. matplotlib_rs/mpl_toolkits/axisartist/grid_helper_curvelinear.py +353 -0
  307. matplotlib_rs/mpl_toolkits/axisartist/parasite_axes.py +8 -0
  308. matplotlib_rs/mpl_toolkits/mplot3d/__init__.py +4 -0
  309. matplotlib_rs/mpl_toolkits/mplot3d/art3d.py +1758 -0
  310. matplotlib_rs/mpl_toolkits/mplot3d/axes3d.py +4462 -0
  311. matplotlib_rs/mpl_toolkits/mplot3d/axis3d.py +807 -0
  312. matplotlib_rs/mpl_toolkits/mplot3d/proj3d.py +270 -0
  313. matplotlib_rs/offsetbox.py +1726 -0
  314. matplotlib_rs/patches.py +5049 -0
  315. matplotlib_rs/path.py +1147 -0
  316. matplotlib_rs/patheffects.py +512 -0
  317. matplotlib_rs/projections/__init__.py +126 -0
  318. matplotlib_rs/projections/geo.py +512 -0
  319. matplotlib_rs/projections/polar.py +1518 -0
  320. matplotlib_rs/pylab.py +68 -0
  321. matplotlib_rs/pyplot.py +4834 -0
  322. matplotlib_rs/quiver.py +1236 -0
  323. matplotlib_rs/rcsetup.py +3435 -0
  324. matplotlib_rs/sankey.py +815 -0
  325. matplotlib_rs/scale.py +1002 -0
  326. matplotlib_rs/spines.py +618 -0
  327. matplotlib_rs/stackplot.py +144 -0
  328. matplotlib_rs/streamplot.py +768 -0
  329. matplotlib_rs/style/__init__.py +269 -0
  330. matplotlib_rs/style/core.py +28 -0
  331. matplotlib_rs/table.py +860 -0
  332. matplotlib_rs/texmanager.py +375 -0
  333. matplotlib_rs/text.py +2412 -0
  334. matplotlib_rs/textpath.py +377 -0
  335. matplotlib_rs/ticker.py +3111 -0
  336. matplotlib_rs/transforms.py +3069 -0
  337. matplotlib_rs/tri/__init__.py +24 -0
  338. matplotlib_rs/tri/_triangulation.py +248 -0
  339. matplotlib_rs/tri/_tricontour.py +271 -0
  340. matplotlib_rs/tri/_trifinder.py +97 -0
  341. matplotlib_rs/tri/_triinterpolate.py +1575 -0
  342. matplotlib_rs/tri/_tripcolor.py +170 -0
  343. matplotlib_rs/tri/_triplot.py +87 -0
  344. matplotlib_rs/tri/_trirefine.py +308 -0
  345. matplotlib_rs/tri/_tritools.py +264 -0
  346. matplotlib_rs/typing.py +597 -0
  347. matplotlib_rs/units.py +196 -0
  348. matplotlib_rs/widgets.py +4455 -0
  349. matplotlib_rs-0.0.8.dist-info/METADATA +392 -0
  350. matplotlib_rs-0.0.8.dist-info/RECORD +352 -0
  351. matplotlib_rs-0.0.8.dist-info/WHEEL +4 -0
  352. matplotlib_rs-0.0.8.dist-info/sboms/matplotlib-rs.cyclonedx.json +4390 -0
@@ -0,0 +1,129 @@
1
+ # Vendored from matplotlib 3.11 (see licenses/LICENSE_MATPLOTLIB), with the
2
+ # pyparsing grammar replaced by an equivalent hand-written parser.
3
+ """
4
+ A module for parsing and generating `fontconfig patterns`_.
5
+
6
+ .. _fontconfig patterns:
7
+ https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
8
+ """
9
+
10
+ from functools import lru_cache, partial
11
+ import re
12
+
13
+
14
+ _family_punc = r'\\\-:,'
15
+ _family_unescape = partial(re.compile(r'\\(?=[%s])' % _family_punc).sub, '')
16
+ _family_escape = partial(re.compile(r'(?=[%s])' % _family_punc).sub, r'\\')
17
+ _value_punc = r'\\=_:,'
18
+ _value_unescape = partial(re.compile(r'\\(?=[%s])' % _value_punc).sub, '')
19
+ _value_escape = partial(re.compile(r'(?=[%s])' % _value_punc).sub, r'\\')
20
+
21
+
22
+ _CONSTANTS = {
23
+ 'thin': ('weight', 'light'),
24
+ 'extralight': ('weight', 'light'),
25
+ 'ultralight': ('weight', 'light'),
26
+ 'light': ('weight', 'light'),
27
+ 'book': ('weight', 'book'),
28
+ 'regular': ('weight', 'regular'),
29
+ 'normal': ('weight', 'normal'),
30
+ 'medium': ('weight', 'medium'),
31
+ 'demibold': ('weight', 'demibold'),
32
+ 'semibold': ('weight', 'semibold'),
33
+ 'bold': ('weight', 'bold'),
34
+ 'extrabold': ('weight', 'extra bold'),
35
+ 'black': ('weight', 'black'),
36
+ 'heavy': ('weight', 'heavy'),
37
+ 'roman': ('slant', 'normal'),
38
+ 'italic': ('slant', 'italic'),
39
+ 'oblique': ('slant', 'oblique'),
40
+ 'ultracondensed': ('width', 'ultra-condensed'),
41
+ 'extracondensed': ('width', 'extra-condensed'),
42
+ 'condensed': ('width', 'condensed'),
43
+ 'semicondensed': ('width', 'semi-condensed'),
44
+ 'expanded': ('width', 'expanded'),
45
+ 'extraexpanded': ('width', 'extra-expanded'),
46
+ 'ultraexpanded': ('width', 'ultra-expanded'),
47
+ }
48
+
49
+
50
+
51
+ _FAMILY_RE = re.compile(fr"([^{_family_punc}]|(\\[{_family_punc}]))*")
52
+ _SIZE_RE = re.compile(r"([0-9]+\.?[0-9]*|\.[0-9]+)")
53
+ _NAME_RE = re.compile(r"[a-z]+")
54
+ _VALUE_RE = re.compile(fr"([^{_value_punc}]|(\\[{_value_punc}]))*")
55
+ _CONST_RE = re.compile("|".join(sorted(map(re.escape, _CONSTANTS), key=len, reverse=True)))
56
+
57
+
58
+ def _parse(pattern):
59
+ pos = 0
60
+ n = len(pattern)
61
+ families = sizes = None
62
+ props = []
63
+
64
+ def comma(regex, pos):
65
+ m = regex.match(pattern, pos)
66
+ if m is None:
67
+ return None, pos
68
+ out = [m.group()]
69
+ pos = m.end()
70
+ while pos < n and pattern[pos] == ",":
71
+ m = regex.match(pattern, pos + 1)
72
+ if m is None:
73
+ break
74
+ out.append(m.group())
75
+ pos = m.end()
76
+ return out, pos
77
+
78
+ families, pos = comma(_FAMILY_RE, pos)
79
+ if pos < n and pattern[pos] == "-":
80
+ sizes, p2 = comma(_SIZE_RE, pos + 1)
81
+ if sizes is None:
82
+ raise ValueError(f"Invalid fontconfig pattern {pattern!r}")
83
+ pos = p2
84
+ while pos < n and pattern[pos] == ":":
85
+ pos += 1
86
+ m = _NAME_RE.match(pattern, pos)
87
+ if m and m.end() < n and pattern[m.end()] == "=":
88
+ vals, pos = comma(_VALUE_RE, m.end() + 1)
89
+ props.append([m.group(), *vals])
90
+ continue
91
+ m = _CONST_RE.match(pattern, pos)
92
+ if m is None:
93
+ raise ValueError(f"Invalid fontconfig pattern {pattern!r}")
94
+ props.append([m.group()])
95
+ pos = m.end()
96
+ if pos != n:
97
+ raise ValueError(f"Invalid fontconfig pattern {pattern!r}")
98
+ return families, sizes, props
99
+
100
+
101
+ @lru_cache
102
+ def parse_fontconfig_pattern(pattern):
103
+ """
104
+ Parse a fontconfig *pattern* into a dict that can initialize a
105
+ `.font_manager.FontProperties` object.
106
+ """
107
+ families, sizes, properties = _parse(pattern)
108
+ props = {}
109
+ if families is not None:
110
+ props["family"] = [*map(_family_unescape, families)]
111
+ if sizes is not None:
112
+ props["size"] = [*sizes]
113
+ for prop in properties:
114
+ if len(prop) == 1:
115
+ prop = _CONSTANTS[prop[0]]
116
+ k, *v = prop
117
+ props.setdefault(k, []).extend(map(_value_unescape, v))
118
+ return props
119
+
120
+
121
+ def generate_fontconfig_pattern(d):
122
+ """Convert a `.FontProperties` to a fontconfig pattern string."""
123
+ kvs = [(k, getattr(d, f"get_{k}")())
124
+ for k in ["style", "variant", "weight", "stretch", "file", "size"]]
125
+ # Families is given first without a leading keyword. Other entries (which
126
+ # are necessarily scalar) are given as key=value, skipping Nones.
127
+ return (",".join(_family_escape(f) for f in d.get_family())
128
+ + "".join(f":{k}={_value_escape(str(v))}"
129
+ for k, v in kvs if v is not None))
@@ -0,0 +1,220 @@
1
+ """Drawing into renderers other than the Rust Agg one (matplotlib's vector
2
+ backends, or any third-party renderer).
3
+
4
+ The Rust core draws its artists by calling these functions with plain data;
5
+ they rebuild the objects matplotlib's artists would pass (graphics context,
6
+ `Path`, `Affine2D`, `FontProperties`) and call the renderer.
7
+ """
8
+ import contextlib
9
+
10
+ import numpy as np
11
+
12
+ from . import _mplrs
13
+ from ._enums import CapStyle, JoinStyle
14
+ from .font_manager import FontProperties
15
+ from .path import Path
16
+ from .transforms import Affine2D, Bbox, TransformedPath
17
+
18
+
19
+ def warn_missing_glyphs():
20
+ """Issue the "Glyph ... missing" warnings of text laid out by the Rust core."""
21
+ missing = _mplrs.take_missing_glyphs()
22
+ if missing:
23
+ from ._text_helpers import warn_on_missing_glyph
24
+ for codepoint, fonts in missing:
25
+ warn_on_missing_glyph(codepoint, fonts)
26
+
27
+
28
+ def is_foreign(renderer):
29
+ """Whether *renderer* is not backed by the Rust Agg renderer."""
30
+ return renderer is not None and not isinstance(
31
+ getattr(renderer, "_renderer", None), _mplrs.RendererAgg)
32
+
33
+
34
+ @contextlib.contextmanager
35
+ def metrics(renderer):
36
+ """Use *renderer*'s text metrics for layout done by the Rust core."""
37
+ if not is_foreign(renderer):
38
+ yield
39
+ return
40
+ _mplrs.push_foreign(renderer)
41
+ try:
42
+ yield
43
+ finally:
44
+ _mplrs.pop_foreign()
45
+
46
+
47
+ def _path(verts, codes, should_simplify, simplify_threshold):
48
+ p = Path(verts, codes)
49
+ p._should_simplify = should_simplify
50
+ p._simplify_threshold = simplify_threshold
51
+ return p
52
+
53
+
54
+ def _gc(renderer, state, clip_cache):
55
+ (alpha, forced_alpha, antialiased, capstyle, joinstyle, cliprect, clippath,
56
+ dashes, linewidth, rgb, snap, sketch, hatch, url) = state
57
+ gc = renderer.new_gc()
58
+ gc._alpha = alpha
59
+ gc._forced_alpha = forced_alpha
60
+ gc._antialiased = int(antialiased)
61
+ gc._capstyle = CapStyle(capstyle)
62
+ gc._joinstyle = JoinStyle(joinstyle)
63
+ if cliprect is not None:
64
+ bb = clip_cache.get(cliprect)
65
+ if bb is None:
66
+ bb = clip_cache[cliprect] = Bbox.from_extents(*cliprect[1])
67
+ gc._cliprect = bb
68
+ if isinstance(clippath, tuple):
69
+ key, verts, codes, ss, st, matrix = clippath
70
+ tp = clip_cache.get(key)
71
+ if tp is None:
72
+ tp = clip_cache[key] = TransformedPath(_path(verts, codes, ss, st), Affine2D(matrix))
73
+ gc._clippath = tp
74
+ elif clippath is not None:
75
+ gc._clippath = clippath
76
+ gc._dashes = dashes
77
+ gc._linewidth = linewidth
78
+ gc._rgb = rgb
79
+ gc._snap = snap
80
+ gc._sketch = sketch
81
+ gc._url = url
82
+ if hatch is not None:
83
+ pattern, gc._hatch_color, gc._hatch_linewidth, is_np = hatch
84
+ gc._hatch = np.str_(pattern) if is_np else pattern
85
+ return gc
86
+
87
+
88
+ _FONTPROPS = {}
89
+
90
+
91
+ def _fontprops(t):
92
+ key = (tuple(t[0]), *t[1:])
93
+ fp = _FONTPROPS.get(key)
94
+ if fp is None:
95
+ fam, style, variant, weight, stretch, size, fname, mff = t
96
+ fp = _FONTPROPS[key] = FontProperties(
97
+ family=fam, style=style, variant=variant, weight=weight,
98
+ stretch=stretch, size=size, fname=fname, math_fontfamily=mff)
99
+ return fp
100
+
101
+
102
+ class _MText:
103
+ """What renderers use of the `Text` passed as *mtext*, for texts owned by
104
+ the Rust core (tick labels, ...)."""
105
+
106
+ def __init__(self, x, y, ha, va, rotation_mode):
107
+ self._xy = (x, y)
108
+ self._ha, self._va, self._rotation_mode = ha, va, rotation_mode
109
+
110
+ def get_transform(self):
111
+ from .transforms import IdentityTransform
112
+ return IdentityTransform()
113
+
114
+ def get_unitless_position(self):
115
+ return self._xy
116
+
117
+ def get_ha(self):
118
+ return self._ha
119
+
120
+ get_horizontalalignment = get_ha
121
+
122
+ def get_va(self):
123
+ return self._va
124
+
125
+ get_verticalalignment = get_va
126
+
127
+ def get_rotation_mode(self):
128
+ return self._rotation_mode
129
+
130
+ def get_fontfeatures(self):
131
+ return None
132
+
133
+ def get_language(self):
134
+ return None
135
+
136
+
137
+ class Target:
138
+ """The renderer the Rust core forwards to, with per-draw caches."""
139
+
140
+ def __init__(self, renderer):
141
+ self.renderer = renderer
142
+ self.clip_cache = {}
143
+
144
+ def draw_path(self, gc, path, matrix, face):
145
+ r = self.renderer
146
+ gc = _gc(r, gc, self.clip_cache)
147
+ r.draw_path(gc, _path(*path), Affine2D(matrix), face)
148
+ gc.restore()
149
+
150
+ def draw_markers(self, gc, marker, marker_matrix, path, matrix, face):
151
+ r = self.renderer
152
+ gc = _gc(r, gc, self.clip_cache)
153
+ r.draw_markers(gc, _path(*marker), Affine2D(marker_matrix), _path(*path),
154
+ Affine2D(matrix), face)
155
+ gc.restore()
156
+
157
+ def draw_path_collection(self, gc, master, paths, transforms, offsets, offset_matrix,
158
+ facecolors, edgecolors, linewidths, linestyles, antialiaseds):
159
+ r = self.renderer
160
+ gc = _gc(r, gc, self.clip_cache)
161
+ r.draw_path_collection(
162
+ gc, Affine2D(master), [_path(*p) for p in paths],
163
+ [np.asarray(t) for t in transforms], np.asarray(offsets).reshape(-1, 2),
164
+ Affine2D(offset_matrix), facecolors, edgecolors, linewidths, linestyles,
165
+ antialiaseds, [None], "screen")
166
+ gc.restore()
167
+
168
+ def draw_image(self, gc, x, y, im):
169
+ r = self.renderer
170
+ gc = _gc(r, gc, self.clip_cache)
171
+ r.draw_image(gc, x, y, im)
172
+ gc.restore()
173
+
174
+ def draw_text(self, gc, x, y, s, prop, angle, ismath, owner, anchor):
175
+ r = self.renderer
176
+ gc = _gc(r, gc, self.clip_cache)
177
+ mtext = owner() if owner is not None else None
178
+ if mtext is None and anchor is not None:
179
+ mtext = _MText(*anchor)
180
+ r.draw_text(gc, x, y, s, _fontprops(prop), angle, ismath=ismath, mtext=mtext)
181
+ gc.restore()
182
+
183
+ def text_metrics(self, s, prop, ismath):
184
+ w, h, d = self.renderer.get_text_width_height_descent(s, _fontprops(prop), ismath)
185
+ return float(w), float(h), float(d)
186
+
187
+ def open_group(self, name, gid):
188
+ self.renderer.open_group(name, gid=gid)
189
+
190
+ def close_group(self, name):
191
+ self.renderer.close_group(name)
192
+
193
+ def artist_start(self):
194
+ r = self.renderer
195
+ if r._raster_depth == 0 and r._rasterizing:
196
+ r.stop_rasterizing()
197
+ r._rasterizing = False
198
+
199
+ def raster_begin(self):
200
+ r = self.renderer
201
+ if r._raster_depth == 0 and not r._rasterizing:
202
+ r.start_rasterizing()
203
+ r._rasterizing = True
204
+ r._raster_depth += 1
205
+ # (a MixedModeRenderer sets the figure dpi to its raster dpi)
206
+ fig = getattr(r, "figure", None)
207
+ return None if fig is None else float(fig.dpi)
208
+
209
+ def raster_end(self):
210
+ r = self.renderer
211
+ r._raster_depth -= 1
212
+ fig = getattr(r, "figure", None) # (a MixedModeRenderer's)
213
+ if r._rasterizing and fig is not None and fig.suppressComposite:
214
+ # restart rasterizing to prevent merging
215
+ r.stop_rasterizing()
216
+ r.start_rasterizing()
217
+
218
+ def flip(self):
219
+ r = self.renderer
220
+ return bool(r.flipy()), float(r.get_canvas_width_height()[1])
matplotlib_rs/_hook.py ADDED
@@ -0,0 +1,94 @@
1
+ """Import hook making ``import matplotlib`` resolve to ``matplotlib_rs`` (and
2
+ ``import mpl_toolkits`` to its vendored copy, ``matplotlib_rs.mpl_toolkits``)."""
3
+ import importlib
4
+ import importlib.abc
5
+ import importlib.util
6
+ import sys
7
+
8
+ _PREFIX = "matplotlib"
9
+ _TARGET = "matplotlib_rs"
10
+ # (imported name prefix, replacement)
11
+ _ALIASES = (("matplotlib", "matplotlib_rs"), ("mpl_toolkits", "matplotlib_rs.mpl_toolkits"))
12
+
13
+
14
+ class _AliasLoader(importlib.abc.Loader):
15
+ def __init__(self, target):
16
+ self.target = target
17
+
18
+ def create_module(self, spec):
19
+ return importlib.import_module(self.target)
20
+
21
+ def exec_module(self, module):
22
+ pass
23
+
24
+
25
+ class _Finder(importlib.abc.MetaPathFinder):
26
+ def find_spec(self, fullname, path=None, target=None):
27
+ for prefix, repl in _ALIASES:
28
+ if fullname == prefix or fullname.startswith(prefix + "."):
29
+ tname = repl + fullname[len(prefix):]
30
+ break
31
+ else:
32
+ return None
33
+ try:
34
+ tspec = importlib.util.find_spec(tname)
35
+ except (ImportError, ValueError):
36
+ tspec = None
37
+ if tspec is None:
38
+ return None
39
+ spec = importlib.util.spec_from_loader(fullname, _AliasLoader(tname),
40
+ is_package=tspec.submodule_search_locations is not None)
41
+ return spec
42
+
43
+
44
+ class _FallbackFinder(_Finder):
45
+ """Resolves matplotlib's pure-Python dependencies that are not installed
46
+ (consulted last) to the copies vendored in ``matplotlib_rs._vendor``, so
47
+ that scripts written for matplotlib can import them."""
48
+
49
+ def find_spec(self, fullname, path=None, target=None):
50
+ for prefix, repl in _FALLBACKS:
51
+ if fullname == prefix or fullname.startswith(prefix + "."):
52
+ tname = repl + fullname[len(prefix):]
53
+ break
54
+ else:
55
+ return None
56
+ tspec = importlib.util.find_spec(tname)
57
+ if tspec is None:
58
+ return None
59
+ return importlib.util.spec_from_loader(
60
+ fullname, _AliasLoader(tname), is_package=tspec.submodule_search_locations is not None)
61
+
62
+
63
+ _FALLBACKS = (("cycler", "matplotlib_rs._vendor.cycler"),
64
+ ("dateutil", "matplotlib_rs._vendor.dateutil"))
65
+ _finder = _Finder()
66
+ _fallback_finder = _FallbackFinder()
67
+
68
+
69
+ def install():
70
+ """Make ``import matplotlib`` (and submodules) use matplotlib_rs."""
71
+ if _finder not in sys.meta_path:
72
+ for name in list(sys.modules):
73
+ for prefix, _ in _ALIASES:
74
+ if name == prefix or name.startswith(prefix + "."):
75
+ mod = sys.modules[name]
76
+ if not getattr(mod, "__name__", "").startswith(_TARGET):
77
+ raise RuntimeError(
78
+ f"{prefix} was already imported; call matplotlib_rs.install() "
79
+ f"before importing {prefix}")
80
+ sys.meta_path.insert(0, _finder)
81
+ sys.meta_path.append(_fallback_finder)
82
+ sys.modules[_PREFIX] = sys.modules[_TARGET]
83
+
84
+
85
+ def uninstall():
86
+ if _finder in sys.meta_path:
87
+ sys.meta_path.remove(_finder)
88
+ if _fallback_finder in sys.meta_path:
89
+ sys.meta_path.remove(_fallback_finder)
90
+ for name in list(sys.modules):
91
+ for prefix, _ in _ALIASES:
92
+ if name == prefix or name.startswith(prefix + "."):
93
+ if getattr(sys.modules[name], "__name__", "").startswith(_TARGET):
94
+ del sys.modules[name]
@@ -0,0 +1,160 @@
1
+ """
2
+ Replacement for matplotlib's ``_image`` extension module: image resampling
3
+ by the Rust port of matplotlib's Agg resampler.
4
+ """
5
+
6
+ import numpy as np
7
+
8
+ from . import _mplrs
9
+
10
+ NEAREST = 0
11
+ BILINEAR = 1
12
+ BICUBIC = 2
13
+ SPLINE16 = 3
14
+ SPLINE36 = 4
15
+ HANNING = 5
16
+ HAMMING = 6
17
+ HERMITE = 7
18
+ KAISER = 8
19
+ QUADRIC = 9
20
+ CATROM = 10
21
+ GAUSSIAN = 11
22
+ BESSEL = 12
23
+ MITCHELL = 13
24
+ SINC = 14
25
+ LANCZOS = 15
26
+ BLACKMAN = 16
27
+
28
+ _KINDS = {
29
+ np.dtype(np.uint8): "u1", np.dtype(np.int8): "u1",
30
+ np.dtype(np.uint16): "u2", np.dtype(np.int16): "u2",
31
+ np.dtype(np.float32): "f4", np.dtype(np.float64): "f8",
32
+ }
33
+
34
+
35
+ def _transform_mesh(transform, out_h, out_w):
36
+ """For each output pixel center, the input coordinates it maps from."""
37
+ inverse = transform.inverted()
38
+ y, x = np.mgrid[:out_h, :out_w]
39
+ mesh = np.empty((out_h * out_w, 2))
40
+ mesh[:, 0] = x.ravel() + 0.5
41
+ mesh[:, 1] = y.ravel() + 0.5
42
+ out = np.ascontiguousarray(inverse.transform(mesh), dtype=np.float64)
43
+ if out.ndim != 2:
44
+ raise RuntimeError(
45
+ f"Inverse transformed mesh array should be 2D not {out.ndim}D")
46
+ if out.shape != mesh.shape:
47
+ raise RuntimeError(
48
+ f"Inverse transformed mesh array should have shape {mesh.shape} "
49
+ f"not {out.shape}")
50
+ return out
51
+
52
+
53
+ def resample(input_array, output_array, transform, interpolation=NEAREST,
54
+ resample=False, alpha=1, norm=False, radius=1):
55
+ """
56
+ Resample input_array, blending it in-place into output_array, using an
57
+ affine transform.
58
+ """
59
+ input_array = np.asarray(input_array)
60
+ ndim = input_array.ndim
61
+ if ndim not in (2, 3):
62
+ raise ValueError("Input array must be a 2D or 3D array")
63
+ if ndim == 3 and input_array.shape[2] != 4:
64
+ raise ValueError(
65
+ "3D input array must be RGBA with shape (M, N, 4), has trailing "
66
+ f"dimension of {input_array.shape[2]}")
67
+ input_array = np.ascontiguousarray(input_array)
68
+ out_ndim = output_array.ndim
69
+ if out_ndim != ndim:
70
+ raise ValueError(
71
+ f"Input ({ndim}D) and output ({out_ndim}D) arrays have different "
72
+ "dimensionalities")
73
+ if out_ndim == 3 and output_array.shape[2] != 4:
74
+ raise ValueError(
75
+ "3D output array must be RGBA with shape (M, N, 4), has trailing "
76
+ f"dimension of {output_array.shape[2]}")
77
+ if output_array.dtype != input_array.dtype:
78
+ raise ValueError("Input and output arrays have mismatched types")
79
+ if not output_array.flags.c_contiguous:
80
+ raise ValueError("Output array must be C-contiguous")
81
+ if not output_array.flags.writeable:
82
+ raise ValueError("Output array must be writeable")
83
+ kind = _KINDS.get(input_array.dtype)
84
+ out_h, out_w = output_array.shape[:2]
85
+ if transform is None:
86
+ affine, mesh = np.eye(3), None
87
+ elif transform.is_affine:
88
+ affine, mesh = np.ascontiguousarray(transform, dtype=np.float64), None
89
+ else:
90
+ affine, mesh = None, _transform_mesh(transform, out_h, out_w)
91
+ if kind is None:
92
+ raise ValueError(
93
+ "arrays must be of dtype byte, short, float32 or float64")
94
+ in_h, in_w = input_array.shape[:2]
95
+ if input_array.size == 0 or output_array.size == 0:
96
+ return
97
+ _mplrs.image_resample(
98
+ input_array.reshape(-1).view(np.uint8),
99
+ output_array.reshape(-1).view(np.uint8),
100
+ kind, 1 if ndim == 2 else 4, in_w, in_h, out_w, out_h,
101
+ affine, mesh, int(interpolation), bool(resample),
102
+ float(np.float32(alpha)), bool(norm), float(np.float32(radius)))
103
+
104
+
105
+
106
+ def resample_indexed(indices, lut, output_array, transform, interpolation=NEAREST,
107
+ resample=False, alpha=1, norm=False, radius=1):
108
+ """
109
+ `resample` of the float64 RGBA image ``lut[indices]`` (*indices*: 2D
110
+ array of rows of the (K, 4) float64 *lut*) into the float64 RGBA
111
+ *output_array*, without making that image. (matplotlib_rs)
112
+ """
113
+ indices = np.ascontiguousarray(indices, dtype=np.uint32)
114
+ lut = np.ascontiguousarray(lut, dtype=np.float64)
115
+ if indices.ndim != 2 or lut.ndim != 2 or lut.shape[1] != 4:
116
+ raise ValueError("indices must be 2D and lut (K, 4)")
117
+ if (output_array.ndim != 3 or output_array.shape[2] != 4
118
+ or output_array.dtype != np.float64):
119
+ raise ValueError("output must be a float64 RGBA array")
120
+ if not output_array.flags.c_contiguous:
121
+ raise ValueError("Output array must be C-contiguous")
122
+ if not output_array.flags.writeable:
123
+ raise ValueError("Output array must be writeable")
124
+ out_h, out_w = output_array.shape[:2]
125
+ if transform is None:
126
+ affine, mesh = np.eye(3), None
127
+ elif transform.is_affine:
128
+ affine, mesh = np.ascontiguousarray(transform, dtype=np.float64), None
129
+ else:
130
+ affine, mesh = None, _transform_mesh(transform, out_h, out_w)
131
+ in_h, in_w = indices.shape
132
+ if indices.size == 0 or output_array.size == 0:
133
+ return
134
+ _mplrs.image_resample_indexed(
135
+ indices.reshape(-1), lut, output_array.reshape(-1),
136
+ in_w, in_h, out_w, out_h,
137
+ affine, mesh, int(interpolation), bool(resample),
138
+ float(np.float32(alpha)), bool(norm), float(np.float32(radius)))
139
+
140
+
141
+ def calculate_rms_and_diff(expected_image, actual_image):
142
+ """RMS of the difference of two images and a difference image."""
143
+ from .testing.exceptions import ImageComparisonFailure
144
+ for image, name in ((expected_image, "Expected"), (actual_image, "Actual")):
145
+ if image.ndim != 3:
146
+ raise ImageComparisonFailure(
147
+ f"{name} image must be 3-dimensional, but is "
148
+ f"{image.ndim}-dimensional")
149
+ height, width, depth = expected_image.shape
150
+ if depth not in (3, 4):
151
+ raise ImageComparisonFailure(
152
+ f"Image must be RGB or RGBA but has depth {depth}")
153
+ if expected_image.shape != actual_image.shape:
154
+ raise ImageComparisonFailure(
155
+ f"Image sizes do not match expected size: {expected_image.shape} "
156
+ f"actual size {actual_image.shape}")
157
+ diff = expected_image.astype(np.float64) - actual_image.astype(np.float64)
158
+ rms = np.sqrt((diff ** 2).sum() / (width * height * depth))
159
+ diff_image = np.clip(np.abs(diff[..., :3]) * 10, 0, 255).astype(np.uint8)
160
+ return rms, diff_image