interpolation

Plot smooth curves of Pandas Series data

回眸只為那壹抹淺笑 提交于 2019-11-28 01:14:53
问题 My data is: >>> ts = pd.TimeSeries(data,indexconv) >>> tsgroup = ts.resample('t',how='sum') >>> tsgroup 2014-11-08 10:30:00 3 2014-11-08 10:31:00 4 2014-11-08 10:32:00 7 [snip] 2014-11-08 10:54:00 5 2014-11-08 10:55:00 2 Freq: T, dtype: int64 >>> tsgroup.plot() >>> plt.show() indexconv are strings converted using datetime.strptime . The plot is very edgy like this (these aren't my actual plots): How can I smooth it out like this: I know about scipy.interpolate mentioned in this article (which

resampling, interpolating matrix

Deadly 提交于 2019-11-28 00:00:59
问题 I'm trying to interpolate some data for the purpose of plotting. For instance, given N data points, I'd like to be able to generate a "smooth" plot, made up of 10*N or so interpolated data points. My approach is to generate an N-by-10*N matrix and compute the inner product the original vector and the matrix I generated, yielding a 1-by-10*N vector. I've already worked out the math I'd like to use for the interpolation, but my code is pretty slow. I'm pretty new to Python, so I'm hopeful that

Pandas interpolate within a groupby

◇◆丶佛笑我妖孽 提交于 2019-11-27 23:06:27
I've got a dataframe with the following information: filename val1 val2 t 1 file1.csv 5 10 2 file1.csv NaN NaN 3 file1.csv 15 20 6 file2.csv NaN NaN 7 file2.csv 10 20 8 file2.csv 12 15 I would like to interpolate the values in the dataframe based on the indices, but only within each file group . To interpolate, I would normally do df = df.interpolate(method="index") And to group, I do grouped = df.groupby("filename") I would like the interpolated dataframe to look like this: filename val1 val2 t 1 file1.csv 5 10 2 file1.csv 10 15 3 file1.csv 15 20 6 file2.csv NaN NaN 7 file2.csv 10 20 8 file2

OpenGL Colour Interpolation

吃可爱长大的小学妹 提交于 2019-11-27 21:34:14
I'm currently working on an little project in C++ and OpenGL and am trying to implement a colour selection tool similar to that in photoshop, as below. However I am having trouble with interpolation of the large square. Working on my desktop computer with a 8800 GTS the result was similar but the blending wasn't as smooth. This is the code I am using: GLfloat swatch[] = { 0,0,0, 1,1,1, mR,mG,mB, 0,0,0 }; GLint swatchVert[] = { 400,700, 400,500, 600,500, 600,700 }; glVertexPointer(2, GL_INT, 0, swatchVert); glColorPointer(3, GL_FLOAT, 0, swatch); glDrawArrays(GL_QUADS, 0, 4); Moving onto my

Best way to interpolate values in SQL

懵懂的女人 提交于 2019-11-27 21:16:30
问题 I have a table with rate at certain date : Rates Id | Date | Rate ----+---------------+------- 1 | 01/01/2011 | 4.5 2 | 01/04/2011 | 3.2 3 | 04/06/2011 | 2.4 4 | 30/06/2011 | 5 I want to get the output rate base on a simple linear interpolation. So if I enter 17/06/2011: Date Rate ---------- ----- 01/01/2011 4.5 01/04/2011 3.2 04/06/2011 2.4 17/06/2011 30/06/2011 5.0 the linear interpolation is (5 + 2,4) / 2 = 3,7 Is there a way to do a simple query (SQL Server 2005), or this kind of stuff

Property binding vs attribute interpolation

守給你的承諾、 提交于 2019-11-27 20:31:29
I have read an article about difference between property and attribute bindings. From what I understood, most of the time, Angular2 prefers property bindings, because after each change in data, the DOM would be updated. (If I am mistaken, please correct me). I have a custom component and use it from the parent component. In it, I have an @Input named truevalue . when I initiate truevalue from the parent via property binding, sometimes, it does not change. I used following code: <my-checkbox [(ngModel)]="chkItems" [disabled]="!editMode" [trueValue]="Y"></my-checkbox> If I send true or "1" into

Akima interpolation of an array of doubles

一个人想着一个人 提交于 2019-11-27 20:29:14
问题 Assuming I have an array of doubles, what's a good algorithm to sample this series using Akima interpolation? I'm too stupid to translate that mathematical description into code. // values is an array of doubles // idx is the index of the left-hand value for the current interpolation // t is the normalized parameter between values[idx] and values[idx+1] // Don't worry about array bounds, I'll handle that separately. public double InterpolateAkima(double[] values, int idx, double t) { ...? }

Ternary plot and filled contour

穿精又带淫゛_ 提交于 2019-11-27 20:15:36
Users, I'd like to have some tips for a ternaryplot ("vcd"). I have this dataframe: a <- c(0.1, 0.5, 0.5, 0.6, 0.2, 0, 0, 0.004166667, 0.45) b <- c(0.75,0.5,0,0.1,0.2,0.951612903,0.918103448,0.7875,0.45) c <- c(0.15,0,0.5,0.3,0.6,0.048387097,0.081896552,0.208333333,0.1) d <- c(500,2324.90,2551.44,1244.50, 551.22,-644.20,-377.17,-100, 2493.04) df <- data.frame(a, b, c, d) and I'm building a ternary plot: ternaryplot(df[,1:3], df$d) How can I map the continuous variable d , obtaining a result similar to this one? This is probably not the most elegant way to do this but it works (from scratch and

How to perform bilinear interpolation in Python

人盡茶涼 提交于 2019-11-27 20:07:33
I would like to perform blinear interpolation using python. Example gps point for which I want to interpolate height is: B = 54.4786674627 L = 17.0470721369 using four adjacent points with known coordinates and height values: n = [(54.5, 17.041667, 31.993), (54.5, 17.083333, 31.911), (54.458333, 17.041667, 31.945), (54.458333, 17.083333, 31.866)] z01 z11 z z00 z10 and here's my primitive attempt: import math z00 = n[0][2] z01 = n[1][2] z10 = n[2][2] z11 = n[3][2] c = 0.016667 #grid spacing x0 = 56 #latitude of origin of grid y0 = 13 #longitude of origin of grid i = math.floor((L-y0)/c) j =

Conversion between RGB and RYB color spaces

混江龙づ霸主 提交于 2019-11-27 19:54:10
I am currently trying to convert colours between RGB (red, green, blue) colour space and RYB (red, yellow, blue) colour space and back again. Based on the details in the following paper, I am able to convert from RYB to RGB using trilinear interpolation - where the parametric weightings (s,t,u) are the RYB colors, and the vertices of the cube are 3d points in RGB space. Paint Inspired Color Mixing and Compositing for Visualisation - Gossett and Chen - Section 2.1 - Realization Details My difficulties are in reversing the conversion process. A second paper references the use of this technique