interpolate 3D volume with numpy and or scipy

In scipy 0.14 or later, there is a new function scipy.interpolate.RegularGridInterpolator which closely resembles interp3. The MATLAB command Vi = interp3(x,y,z,V,xi,yi,zi) would translate to something like: from numpy import array from scipy.interpolate import RegularGridInterpolator as rgi my_interpolating_function = rgi((x,y,z), V) Vi = my_interpolating_function(array([xi,yi,zi]).T) Here is a full example demonstrating both; it will help you understand … Read more

How do I make angular.js reevaluate / recompile inner html?

You have to $compile your inner html like .directive(‘autotranslate’, function($interpolate, $compile) { return function(scope, element, attr) { var html = element.html(); debugger; html = html.replace(/\[\[(\w+)\]\]/g, function(_, text) { return ‘<span translate=”‘ + text + ‘”></span>’; }); element.html(html); $compile(element.contents())(scope); //<—- recompilation } })

Property binding vs attribute interpolation

Property binding like [trueValue]=”…” evaluates the expression “…” and assigns the value “true” evaluates to the value true “Y” is unknown. There is no internal Y value in TypeScript and no property in the component class instance, which is the scope of template binding. In this case you would want [trueValue]=”‘Y'” Note the additional quotes … Read more

AngularJS multiple expressions concatenating in interpolation with a URL

An alternative to @tasseKATT’s answer (which doesn’t require a controller function) is to use string concatenation directly in the expression a filter: angular.module(‘myApp’) .filter(‘youtubeEmbedUrl’, function ($sce) { return function(videoId) { return $sce.trustAsResourceUrl(‘http://www.youtube.com/embed/’ + videoId); }; }); <div ng-src=”https://stackoverflow.com/questions/23405162/{{ video.id.videoId” youtubeEmbedUrl }}”></div> I’ve found this particularly useful when using SVG icon sprites, which requires you to … Read more

Inverse Distance Weighted (IDW) Interpolation with Python

changed 20 Oct: this class Invdisttree combines inverse-distance weighting and scipy.spatial.KDTree. Forget the original brute-force answer; this is imho the method of choice for scattered-data interpolation. “”” invdisttree.py: inverse-distance-weighted interpolation using KDTree fast, solid, local “”” from __future__ import division import numpy as np from scipy.spatial import cKDTree as KDTree # http://docs.scipy.org/doc/scipy/reference/spatial.html __date__ = “2010-11-09 … Read more