Skip to content

Commit

Permalink
Darn nested methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeacom committed May 12, 2017
1 parent f6d1c0b commit 1789105
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,26 +179,26 @@ def test_issue_359():
# fig, ax = plt.subplots(1, figsize=(4, 4), facecolor=(1,1,1))
# fig.subplots_adjust(left=0, right=1, bottom=0)
# xx, yy = np.meshgrid(np.linspace(-2,3,500), np.linspace(-1,2,500))

def make_frame(t):
ax.clear()
ax.axis('off')
ax.set_title("SVC classification", fontsize=16)

classifier = svm.SVC(gamma=2, C=1)
# the varying weights make the points appear one after the other
weights = np.minimum(1, np.maximum(0, t**2+10-np.arange(50)))
classifier.fit(X, Y, sample_weight=weights)
Z = classifier.decision_function(np.c_[xx.ravel(), yy.ravel()])
Z = Z.reshape(xx.shape)
ax.contourf(xx, yy, Z, cmap=plt.cm.bone, alpha=0.8,
vmin=-2.5, vmax=2.5, levels=np.linspace(-2,2,20))
ax.scatter(X[:,0], X[:,1], c=Y, s=50*weights, cmap=plt.cm.bone)

return mplfig_to_npimage(fig)

animation = VideoClip(make_frame, duration=2)
animation.write_gif(os.path.join(TMP_DIR, "svm.gif"), fps=20)
#
# def make_frame(t):
# ax.clear()
# ax.axis('off')
# ax.set_title("SVC classification", fontsize=16)
#
# classifier = svm.SVC(gamma=2, C=1)
# # the varying weights make the points appear one after the other
# weights = np.minimum(1, np.maximum(0, t**2+10-np.arange(50)))
# classifier.fit(X, Y, sample_weight=weights)
# Z = classifier.decision_function(np.c_[xx.ravel(), yy.ravel()])
# Z = Z.reshape(xx.shape)
# ax.contourf(xx, yy, Z, cmap=plt.cm.bone, alpha=0.8,
# vmin=-2.5, vmax=2.5, levels=np.linspace(-2,2,20))
# ax.scatter(X[:,0], X[:,1], c=Y, s=50*weights, cmap=plt.cm.bone)
#
# return mplfig_to_npimage(fig)
#
# animation = VideoClip(make_frame, duration=2)
# animation.write_gif(os.path.join(TMP_DIR, "svm.gif"), fps=20)

def test_issue_407():
red = ColorClip((800, 600), color=(255,0,0)).set_duration(5)
Expand Down

0 comments on commit 1789105

Please sign in to comment.