Skip to content

Commit 3d33770

Browse files
ratalclaude
andcommitted
fix: make scipy import lazy so mdfreader imports without scipy installed
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 8c05c44 commit 3d33770

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mdfreader/mdfreader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
from numpy import arange, linspace, interp, all, diff, mean, vstack, float64, float32
3939
from numpy import nan, datetime64, array, searchsorted, clip, empty
4040
from numpy.ma import MaskedArray, masked, empty as ma_empty
41-
from scipy.interpolate import interp1d
4241
from .mdf3reader import Mdf3
4342
from .mdf4reader import Mdf4
4443
from .mdf import _open_mdf, dataField, descriptionField, unitField, masterField, masterTypeField, idField
@@ -766,6 +765,7 @@ def interpolate(new_x, x, y, interpolation_kind):
766765
elif interpolation_kind == 'next':
767766
return y[interp_close_point(x, new_x, 'right')]
768767
elif y.dtype.kind not in ('U', 'S'):
768+
from scipy.interpolate import interp1d
769769
f = interp1d(x, y, kind=interpolation_kind,
770770
fill_value="extrapolate")
771771
return f(new_x)

0 commit comments

Comments
 (0)