Commits

Matthew Turk committed 833137d

Adding max_r argument to interpolator.

Comments (0)

Files changed (2)

     print i
     #pb.update(i+1)
     #print g.LeftEdge, g.RightEdge
-    QT.interp(g.LeftEdge, g.RightEdge, g["Perturbation"], values)
+    QT.interp(g.LeftEdge, g.RightEdge, g["Perturbation"], values,
+              ma)
 #pb.finish()
 p = SlicePlot(pf, "x", "Perturbation")
 p.save()
                np.ndarray[np.float64_t, ndim=1] LE,
                np.ndarray[np.float64_t, ndim=1] RE,
                np.ndarray[np.float64_t, ndim=3] dest,
-               np.ndarray[np.float64_t, ndim=1] values):
+               np.ndarray[np.float64_t, ndim=1] values,
+               np.float64_t max_r = -1.0):
         # First we get the bounds of our grid in x, y plane.
         cdef np.float64_t pos[3], cpos[2]
         cdef qnode *node
         cdef int i, j, k
-        cdef np.float64_t dds[3]
+        cdef np.float64_t dds[3], r
+        if max_r > 0:
+            max_r = max_r * max_r
         cdef np.int64_t ind
         for i in range(3):
             dds[i] = (RE[i]-LE[i])/dest.shape[i]
                     cpos[0] = (pos[0]*pos[0] + pos[1]*pos[1])**0.5
                     cpos[1] = pos[2]
                     node = self.find(cpos)
+                    if max_r >0:
+                        r = pos[0]*pos[0] + pos[1]*pos[1] + pos[2]*pos[2]
+                        if r > max_r: continue
                     if node.n == 0:
                         # We have nothing to interpolate
                         continue
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.