smoothing

Scipy implementation of Savitzky-Golay filter

不羁岁月 提交于 2019-12-01 23:21:34
I was looking at the scipy cookbook implementation of the Savitzky-Golay algorithm : #!python def savitzky_golay(y, window_size, order, deriv=0, rate=1): r"""Smooth (and optionally differentiate) data with a Savitzky-Golay filter. The Savitzky-Golay filter removes high frequency noise from data. It has the advantage of preserving the original shape and features of the signal better than other types of filtering approaches, such as moving averages techniques. Parameters ---------- y : array_like, shape (N,) the values of the time history of the signal. window_size : int the length of the window

R : confidence interval being partially displayed with ggplot2 (using geom_smooth())

大憨熊 提交于 2019-12-01 21:34:13
问题 I have the following simple R code: disciplines <- c("A","C","B","D","E") # To stop ggplot from imposing alphabetical ordering on x-axis disciplines <- factor(disciplines, levels=disciplines, ordered=T) d1 <- c(0.498, 0.521, 0.332, 0.04, 0.04) d2 <- c(0.266, 0.202, 0.236, 0.06, 0.06) d3 <- c(0.983, 0.755, 0.863, 0.803, 0.913) d4 <- c(0.896, 0.802, 0.960, 0.611, 0.994) df <- data.frame(disciplines, d1, d2, d3, d4) df.m <- melt(df) graph <- ggplot(df.m, aes(group=1,disciplines,value,colour

R : confidence interval being partially displayed with ggplot2 (using geom_smooth())

南楼画角 提交于 2019-12-01 19:47:58
I have the following simple R code: disciplines <- c("A","C","B","D","E") # To stop ggplot from imposing alphabetical ordering on x-axis disciplines <- factor(disciplines, levels=disciplines, ordered=T) d1 <- c(0.498, 0.521, 0.332, 0.04, 0.04) d2 <- c(0.266, 0.202, 0.236, 0.06, 0.06) d3 <- c(0.983, 0.755, 0.863, 0.803, 0.913) d4 <- c(0.896, 0.802, 0.960, 0.611, 0.994) df <- data.frame(disciplines, d1, d2, d3, d4) df.m <- melt(df) graph <- ggplot(df.m, aes(group=1,disciplines,value,colour=variable,shape=variable)) + geom_point() + geom_smooth(stat="smooth", method=loess, level=0.95) + scale_x

smooth.spline(): fitted model does not match user-specified degree of freedom

折月煮酒 提交于 2019-12-01 18:36:34
问题 Here is the code I ran fun <- function(x) {1 + 3*sin(4*pi*x-pi)} set.seed(1) num.samples <- 1000 x <- runif(num.samples) y <- fun(x) + rnorm(num.samples) * 1.5 fit <- smooth.spline(x, y, all.knots=TRUE, df=3) Despite df=3 , when I checked the fitted model, the output was Call: smooth.spline(x = x, y = y, df = 3, all.knots = TRUE) Smoothing Parameter spar= 1.499954 lambda= 0.002508571 (26 iterations) Equivalent Degrees of Freedom (Df): 9.86422 Could someone please help? Thanks! 回答1: Note that

smooth.spline(): fitted model does not match user-specified degree of freedom

非 Y 不嫁゛ 提交于 2019-12-01 18:17:10
Here is the code I ran fun <- function(x) {1 + 3*sin(4*pi*x-pi)} set.seed(1) num.samples <- 1000 x <- runif(num.samples) y <- fun(x) + rnorm(num.samples) * 1.5 fit <- smooth.spline(x, y, all.knots=TRUE, df=3) Despite df=3 , when I checked the fitted model, the output was Call: smooth.spline(x = x, y = y, df = 3, all.knots = TRUE) Smoothing Parameter spar= 1.499954 lambda= 0.002508571 (26 iterations) Equivalent Degrees of Freedom (Df): 9.86422 Could someone please help? Thanks! Note that from R-3.4.0 (2017-04-21), smooth.spline can accept direct specification of λ by a newly added argument

r calculating rolling average with window based on value (not number of rows or date/time variable)

为君一笑 提交于 2019-12-01 17:59:03
I'm quite new to all the packages meant for calculating rolling averages in R and I hope you can show me in the right direction. I have the following data as an example: ms <- c(300, 300, 300, 301, 303, 305, 305, 306, 308, 310, 310, 311, 312, 314, 315, 315, 316, 316, 316, 317, 318, 320, 320, 321, 322, 324, 328, 329, 330, 330, 330, 332, 332, 334, 334, 335, 335, 336, 336, 337, 338, 338, 338, 340, 340, 341, 342, 342, 342, 342) correct <- c(1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0) df <-

Smooth edges of non-rectangular form in .NET

核能气质少年 提交于 2019-12-01 16:53:53
I've created a form with rounded corners using Form.Region. It works, but unfortunately the rounding appears rough. Are there any tricks for smoothing such shaped form corners? I know many applications support this, just not sure how to make it in .NET. Thanks guys. There is no good fix for this, regions cannot be anti-aliased. This is inevitable, anti-aliasing only works when you know the background colors so you can blend properly. That's not an option for windows, the background is by design unpredictable. If this is a splash screen then you can fake it by taking a screen shot of the

Smooth edges of non-rectangular form in .NET

柔情痞子 提交于 2019-12-01 16:00:44
问题 I've created a form with rounded corners using Form.Region. It works, but unfortunately the rounding appears rough. Are there any tricks for smoothing such shaped form corners? I know many applications support this, just not sure how to make it in .NET. Thanks guys. 回答1: There is no good fix for this, regions cannot be anti-aliased. This is inevitable, anti-aliasing only works when you know the background colors so you can blend properly. That's not an option for windows, the background is by

Smooth cone normals

谁都会走 提交于 2019-12-01 13:27:28
I'm trying to calculate smooth normals for a cone. In looking around for code samples and explanations, I consistently come across directions for face normals. I've posted a couple pictures below of what I'm doing. The first -- which basically just normalizes the vertex position -- gives me decently smooth shading, but the edges are "missing" and the bottom face isn't solid. The second has edges, but the shading is flat (face normals) and my light isn't reflecting off of them correctly. The cone is built out of GL_TRIANGLES. Click the images for larger versions. (source: bantherewind.com )

Making a SVG path like a smooth line instead of being ragged

天大地大妈咪最大 提交于 2019-12-01 04:04:48
Well in my project I create river lines from pathes . And due to my kind of big stroke-width it is very ragged : I already searched around. But the only thing I found was stroke-linejoin: round; . As you can see here: it is way better but I'm still not satisfied. Is there any way to get a really smooth line. Or let's say too have a even "rounder" linejoin ? Hugolpz An interesting direction is to leverage d3.svg.line to generate paths from the coordinates of your geoJSON feature, at which point you would be able to use D3's interpolate methods. See D3js-Topojson : how to move from pixelized to