# HG changeset patch # User Daniel O'Connor # Date 1317195870 -34200 # Node ID 7ba7207df0783b1c8e287c8f48fed20e8c086d5c # Parent 184ea77c10e7259764bd38833491301f8cc19858 Manually range check, older scipy's don't have bound_error. diff -r 184ea77c10e7 -r 7ba7207df078 sitesurvey.py --- a/sitesurvey.py Wed Sep 28 14:38:23 2011 +0930 +++ b/sitesurvey.py Wed Sep 28 17:14:30 2011 +0930 @@ -88,8 +88,13 @@ self.calgains = gains # Create interpolation function - self.interp = scipy.interpolate.interp1d(self.calfreqs, self.calgains, bound_error = True) + self._interp = scipy.interpolate.interp1d(self.calfreqs, self.calgains) + def interp(self, freqs): + if numpy.any(freqs < self.calfreqs[0]) or numpy.any(freqs > self.calfreqs[-1]): + raise exceptions.SyntaxError("Frequency out of range of calibration %f - %f" % (calfreqs[0], calfreqs[-1])) + return self._interp(freqs) + def getexpt(sequence): '''Given a sequence return the experiment which should be run next and how long until it should start'''