Skip to content

Commit 5864fac

Browse files
committed
Remove unnecessary dependency on scipy
Fixes gh-8.
1 parent 4409a24 commit 5864fac

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

viscm/bezierbuilder.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"""
3535

3636
import numpy as np
37-
from scipy.special import binom
37+
from math import factorial
3838

3939
import matplotlib
4040
import matplotlib.pyplot as plt
@@ -173,6 +173,11 @@ def _refresh(self):
173173
self.bezier_curve.set_data(x, y)
174174
self.canvas.draw()
175175

176+
# We used to use scipy.special.binom here, but reimplementing it ourself lets
177+
# us avoid pulling in a dependency scipy just for that one function.
178+
def binom(n, k):
179+
return factorial(n) * 1.0 / (factorial(k) * factorial(n - k))
180+
176181
def Bernstein(n, k):
177182
"""Bernstein polynomial.
178183

0 commit comments

Comments
 (0)