interpolation

Shift interpolation does not give expected behaviour

巧了我就是萌 提交于 2019-12-07 01:37:17
问题 When using scipy.ndimage.interpolation.shift to shift a numpy data array along one axis with periodic boundary treatment ( mode = 'wrap' ), I get an unexpected behavior. The routine tries to force the first pixel ( index 0 ) to be identical to the last one ( index N-1 ) instead of the "last plus one ( index N )". Minimal example: # module import import numpy as np from scipy.ndimage.interpolation import shift import matplotlib.pyplot as plt # print scipy.__version__ # 0.18.1 a = range(10) plt

Angular $compile template for dynamic email

随声附和 提交于 2019-12-07 01:35:50
问题 I am trying to load a html template with ng-repeats in it and then use the $compile service to compile it and use the compiled html in an email. The problem.... Ok before asking let me set terminology... binding placeholder: {{customer.name}} binding value: 'john doe' Using $interpolate i get the actual binding values but does not work with ng-repeats. Example: var html = $interpolate('<p>{{customer.name}}</p>')($scope) Returns: '<p>john doe</p>' Ng-repeats do not work Using $compile i get

Cubic spline memory error

若如初见. 提交于 2019-12-06 19:43:48
问题 On a computer with 4GB of memory this simple interpolation leads to a memory error: (based on: http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html) import numpy as np from scipy.interpolate import interp1d x = np.linspace(0, 10, 80000) y = np.cos(-x**2/8.0) f2 = interp1d(x, y, kind='cubic') I thought about cutting the data into chunks, but is there a way I can perform this cubic spline interpolation without requiring so much memory? Why does it even get in trouble? 回答1: If you

Draw heat map (or similar) of 2D population distribution

老子叫甜甜 提交于 2019-12-06 16:44:33
I am wondering how I can draw an image of the population proportion (pop.prop) at these locations (x and y) so that I can see the population distribution clearly? The data is shown below: pts.pr = pts.cent[pts.cent$PIDS==3, ] pop = rnorm(nrow(pts.pr), 0, 1) pop.prop = exp(pop)/sum(exp(pop)) pts.pr.data = as.data.frame(cbind(pts.pr@coords, cbind(pop.prop))) x y pop.prop 3633 106.3077 38.90931 0.070022855 3634 106.8077 38.90931 0.012173106 3756 106.3077 38.40931 0.039693085 3878 105.8077 37.90931 0.034190747 3879 106.3077 37.90931 0.057981214 3880 106.8077 37.90931 0.089484103 3881 107.3077 37

MATLAB - interpolating a 2D curve with multiple Y's per X

有些话、适合烂在心里 提交于 2019-12-06 16:29:40
问题 I would like to interpolate a data set, but a given X can have multiple Y's, example given below: A(:,1:2,1)= 95.2343 70.6159 96.4501 71.5573 97.4430 72.7315 98.9743 72.8699 100.0470 71.7690 100.3872 70.2699 100.7797 68.7837 102.1478 68.0814 103.6851 68.0521 105.0307 68.7966 105.8972 70.0666 106.7177 71.3665 107.7095 72.5416 108.9175 73.4924 110.3574 74.0309 111.8943 73.9859 113.3936 73.6446 114.6645 72.7794 115.5911 71.5522 116.2426 70.1591 116.3922 68.6286 116.3503 67.0914 116.7771 65.6147

Image Processing Issue: Fill NaNs in image, which mostly consists of NaNs

僤鯓⒐⒋嵵緔 提交于 2019-12-06 13:41:57
问题 I have a dataset / image DD like the one in this image: (by the way: is there a way of uploading small data sets here, so that you can actually work with the same data I use, without having to put them in the code?) Colored pixels in the image represent height/depth ranging from 0 to about 400 meters. Blue pixels are NaN . Now what I need to do is to interpolate the pixel values WITHIN the displayed object, but without interpolating the whole image. I tried using the function inpaint_nans

Matplotlib: Data cubic interpolation (or FIT) for Contour plot

谁都会走 提交于 2019-12-06 12:49:11
问题 I have a series of data from device. How can i make cubic interpolation or FIT for this plot? import matplotlib.pyplot as plt a = [[1,1,1],[2,2,2],[3,3,3]] b = [[1,2,3],[1,2,3],[1,2,3]] c = [[3,2,1],[1,4,2],[4,5,1]] fig1 = plt.figure() ax1 = fig1.add_subplot(111) fig1.set_size_inches(3.54,3.54) #Create Contour plot contour=ax1.contour(a,b,c) plt.show() 回答1: You can adapt @Joe Kington's suggestion and use scipy.ndimage.zoom which for your case of a cubic interpolation fits perfectly: import

Fix interpolated polar contour plot function to works with current R and (possibly) use ggplot

梦想的初衷 提交于 2019-12-06 12:29:45
问题 The question R interpolated polar contour plot shows an excellent way to produce interpolated polar plots in R. I include the very slightly modified version I'm using: PolarImageInterpolate <- function( ### Plotting data (in cartesian) - will be converted to polar space. x, y, z, ### Plot component flags contours=TRUE, # Add contours to the plotted surface legend=TRUE, # Plot a surface data legend? axes=TRUE, # Plot axes? points=TRUE, # Plot individual data points extrapolate=FALSE, # Should

Akima interpolation algorithm [duplicate]

风格不统一 提交于 2019-12-06 11:35:43
This question already has answers here : Closed 8 years ago . Possible Duplicate: Akima interpolation of an array of doubles I'm searching for an algorithm for Akima interpolation, but I can't find one after googling for a while. I write my application in Objective-C, but the programming language doesn't matter. It would be very kind if you can provide any code or links. Thanks Handcraftsman edit: see this SO answer for an updated version of the list below. original answer: Akima's original paper http://student.ndhu.edu.tw/~u9111023/akima.pdf C# implementation https://github.com/mathnet

Angular Interpolation is not working properly?

六月ゝ 毕业季﹏ 提交于 2019-12-06 11:15:53
问题 I have one sample with interpolation. It shows drop-down values correctly when is use any one event like below: sample: click me code snippet: Here i have added event (open)="onOpen()" <ejs-dropdownlist (open)="onOpen()" required id="ddlApp" name="ddlApp" [dataSource]='appDataSource' [allowFiltering]='true' [itemTemplate]="itemTemplate" [valueTemplate]="valueTemplate" [(ngModel)]="dropdownlApp" #ddlApp="ngModel" [placeholder]='ddlAppText' [fields]='fields'> sample 2: click me In this sample i