pycall 1.0.1-x86-mingw32

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 (71) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +41 -0
  5. data/CHANGES.md +39 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +91 -0
  9. data/Rakefile +29 -0
  10. data/appveyor.yml +138 -0
  11. data/bin/console +10 -0
  12. data/bin/guard +17 -0
  13. data/bin/rspec +17 -0
  14. data/bin/runner +6 -0
  15. data/bin/setup +8 -0
  16. data/config/Guardfile +30 -0
  17. data/docker/Dockerfile +191 -0
  18. data/docker/Gemfile +12 -0
  19. data/docker/README.md +22 -0
  20. data/examples/classifier_comparison.rb +135 -0
  21. data/examples/datascience_rb_20170519.ipynb +4836 -0
  22. data/examples/hist.rb +32 -0
  23. data/examples/notebooks/classifier_comparison.ipynb +226 -0
  24. data/examples/notebooks/forest_importances.ipynb +238 -0
  25. data/examples/notebooks/iruby_integration.ipynb +183 -0
  26. data/examples/notebooks/lorenz_attractor.ipynb +214 -0
  27. data/examples/notebooks/polar_axes.ipynb +209 -0
  28. data/examples/notebooks/sum_benchmarking.ipynb +374 -0
  29. data/examples/notebooks/xkcd_style.ipynb +149 -0
  30. data/examples/plot_forest_importances_faces.rb +46 -0
  31. data/examples/sum_benchmarking.rb +49 -0
  32. data/ext/pycall/extconf.rb +3 -0
  33. data/ext/pycall/gc.c +74 -0
  34. data/ext/pycall/libpython.c +217 -0
  35. data/ext/pycall/pycall.c +2184 -0
  36. data/ext/pycall/pycall_internal.h +700 -0
  37. data/ext/pycall/range.c +69 -0
  38. data/ext/pycall/ruby_wrapper.c +432 -0
  39. data/lib/2.1/pycall.so +0 -0
  40. data/lib/2.2/pycall.so +0 -0
  41. data/lib/2.3/pycall.so +0 -0
  42. data/lib/2.4/pycall.so +0 -0
  43. data/lib/pycall/conversion.rb +173 -0
  44. data/lib/pycall/dict.rb +48 -0
  45. data/lib/pycall/error.rb +10 -0
  46. data/lib/pycall/gc_guard.rb +84 -0
  47. data/lib/pycall/import.rb +120 -0
  48. data/lib/pycall/init.rb +55 -0
  49. data/lib/pycall/iruby_helper.rb +40 -0
  50. data/lib/pycall/libpython/finder.rb +170 -0
  51. data/lib/pycall/libpython/pyobject_struct.rb +30 -0
  52. data/lib/pycall/libpython/pytypeobject_struct.rb +273 -0
  53. data/lib/pycall/libpython.rb +12 -0
  54. data/lib/pycall/list.rb +45 -0
  55. data/lib/pycall/pretty_print.rb +9 -0
  56. data/lib/pycall/pyerror.rb +30 -0
  57. data/lib/pycall/pyobject_wrapper.rb +212 -0
  58. data/lib/pycall/python/PyCall/__init__.py +1 -0
  59. data/lib/pycall/python/PyCall/six.py +23 -0
  60. data/lib/pycall/python/investigator.py +7 -0
  61. data/lib/pycall/pytypeobject_wrapper.rb +90 -0
  62. data/lib/pycall/set.rb +19 -0
  63. data/lib/pycall/slice.rb +8 -0
  64. data/lib/pycall/tuple.rb +46 -0
  65. data/lib/pycall/version.rb +3 -0
  66. data/lib/pycall/wrapper_object_cache.rb +61 -0
  67. data/lib/pycall.rb +91 -0
  68. data/pycall.gemspec +40 -0
  69. data/tasks/docker.rake +21 -0
  70. data/tasks/pycall.rake +7 -0
  71. metadata +228 -0
data/examples/hist.rb ADDED
@@ -0,0 +1,32 @@
1
+ require 'pycall/import'
2
+ include PyCall::Import
3
+
4
+ pyimport 'numpy', as: 'np'
5
+
6
+ # FIXME: MacOSX backend is not usable through pycall. I want to fix this issue but the reason is unclear.
7
+ pyimport 'matplotlib', as: :mp
8
+ mp.rcParams[:backend] = 'TkAgg' if mp.rcParams[:backend] == 'MacOSX'
9
+
10
+ pyimport 'matplotlib.mlab', as: 'mlab'
11
+ pyimport 'matplotlib.pyplot', as: 'plt'
12
+
13
+ np.random.seed(0)
14
+
15
+ mu = 100
16
+ sigma = 15
17
+ x = mu + sigma * np.random.randn(437)
18
+
19
+ num_bins = 50
20
+
21
+ fig, ax = *plt.subplots
22
+
23
+ n, bins, patches = *ax.hist(x, num_bins, normed: 1)
24
+
25
+ y = mlab.normpdf(bins, mu, sigma)
26
+ ax.plot(bins, y, '--')
27
+ ax.set_xlabel('Smarts')
28
+ ax.set_ylabel('Probability density')
29
+ ax.set_title('Histogram of IQ: $\mu=100$, $\sigma=15$')
30
+
31
+ fig.tight_layout()
32
+ plt.show()