changeset 43:7ba7207df078

Manually range check, older scipy's don't have bound_error.
author Daniel O'Connor <darius@dons.net.au>
date Wed, 28 Sep 2011 17:14:30 +0930
parents 184ea77c10e7
children c93d6d4cb04b
files sitesurvey.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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'''