pycall 1.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +41 -0
- data/CHANGES.md +39 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +91 -0
- data/Rakefile +29 -0
- data/appveyor.yml +138 -0
- data/bin/console +10 -0
- data/bin/guard +17 -0
- data/bin/rspec +17 -0
- data/bin/runner +6 -0
- data/bin/setup +8 -0
- data/config/Guardfile +30 -0
- data/docker/Dockerfile +191 -0
- data/docker/Gemfile +12 -0
- data/docker/README.md +22 -0
- data/examples/classifier_comparison.rb +135 -0
- data/examples/datascience_rb_20170519.ipynb +4836 -0
- data/examples/hist.rb +32 -0
- data/examples/notebooks/classifier_comparison.ipynb +226 -0
- data/examples/notebooks/forest_importances.ipynb +238 -0
- data/examples/notebooks/iruby_integration.ipynb +183 -0
- data/examples/notebooks/lorenz_attractor.ipynb +214 -0
- data/examples/notebooks/polar_axes.ipynb +209 -0
- data/examples/notebooks/sum_benchmarking.ipynb +374 -0
- data/examples/notebooks/xkcd_style.ipynb +149 -0
- data/examples/plot_forest_importances_faces.rb +46 -0
- data/examples/sum_benchmarking.rb +49 -0
- data/ext/pycall/extconf.rb +3 -0
- data/ext/pycall/gc.c +74 -0
- data/ext/pycall/libpython.c +217 -0
- data/ext/pycall/pycall.c +2184 -0
- data/ext/pycall/pycall_internal.h +700 -0
- data/ext/pycall/range.c +69 -0
- data/ext/pycall/ruby_wrapper.c +432 -0
- data/lib/2.1/pycall.so +0 -0
- data/lib/2.2/pycall.so +0 -0
- data/lib/2.3/pycall.so +0 -0
- data/lib/2.4/pycall.so +0 -0
- data/lib/pycall/conversion.rb +173 -0
- data/lib/pycall/dict.rb +48 -0
- data/lib/pycall/error.rb +10 -0
- data/lib/pycall/gc_guard.rb +84 -0
- data/lib/pycall/import.rb +120 -0
- data/lib/pycall/init.rb +55 -0
- data/lib/pycall/iruby_helper.rb +40 -0
- data/lib/pycall/libpython/finder.rb +170 -0
- data/lib/pycall/libpython/pyobject_struct.rb +30 -0
- data/lib/pycall/libpython/pytypeobject_struct.rb +273 -0
- data/lib/pycall/libpython.rb +12 -0
- data/lib/pycall/list.rb +45 -0
- data/lib/pycall/pretty_print.rb +9 -0
- data/lib/pycall/pyerror.rb +30 -0
- data/lib/pycall/pyobject_wrapper.rb +212 -0
- data/lib/pycall/python/PyCall/__init__.py +1 -0
- data/lib/pycall/python/PyCall/six.py +23 -0
- data/lib/pycall/python/investigator.py +7 -0
- data/lib/pycall/pytypeobject_wrapper.rb +90 -0
- data/lib/pycall/set.rb +19 -0
- data/lib/pycall/slice.rb +8 -0
- data/lib/pycall/tuple.rb +46 -0
- data/lib/pycall/version.rb +3 -0
- data/lib/pycall/wrapper_object_cache.rb +61 -0
- data/lib/pycall.rb +91 -0
- data/pycall.gemspec +40 -0
- data/tasks/docker.rake +21 -0
- data/tasks/pycall.rake +7 -0
- 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()
|