diff --git a/gstlal-inspiral/python/stats/inspiral_intrinsics.py b/gstlal-inspiral/python/stats/inspiral_intrinsics.py index 21cf65479f4c72c4f205d38f6f6d16a5ff421b1b..38771ab046d3cfaa8c5494152252232ebf8e566e 100644 --- a/gstlal-inspiral/python/stats/inspiral_intrinsics.py +++ b/gstlal-inspiral/python/stats/inspiral_intrinsics.py @@ -28,7 +28,22 @@ import h5py import math import numpy import os -#from scipy.interpolate import PPoly +try: + from scipy.interpolate import PPoly +except ImportError: + # argh, scipy too old + # FIXME: delete this when we can rely on LDG sites having a + # new-enough scipy + from lal.rate import IrregularBins + class PPoly(object): + def __init__(self, c, x): + self.intervals = IrregularBins(x) + self.coeffs = c + self.x0 = x + + def __call__(self, x): + i = self.intervals[x] + return numpy.poly1d(self.coeffs[:,i].squeeze())(x - self.x0[i]), from gstlal import stats as gstlalstats