smoothing

Gaussian Smoothing an image in python

[亡魂溺海] 提交于 2019-12-20 18:07:37
问题 I am very new to programming in python, and im still trying to figure everything out, but I have a problem trying to gaussian smooth or convolve an image. This is probably an easy fix, but I've spent so much time trying to figure it out im starting to go crazy. I have a 3d .fits file of a group of galaxies and have cut out a certain one and saved it to a png with aplpy. Basically, it needs to be smoothed as a gaussian to a larger beam size (i.e. make the whole thing larger by expanding out

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

蹲街弑〆低调 提交于 2019-12-19 19:54:19
问题 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,

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

跟風遠走 提交于 2019-12-19 19:54:08
问题 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,

R smooth.spline(): smoothing spline is not smooth but overfitting my data

丶灬走出姿态 提交于 2019-12-18 16:54:29
问题 I have several data points which seem suitable for fitting a spline through them. When I do this, I get a rather bumpy fit, like overfitting, which is not what I understand as smoothing. Is there a special option / parameter for getting back the function of a really smooth spline like here. The usage of the penalty parameter for smooth.spline didn't have any visible effect. Maybe I did it wrong? Here are data and code: results <- structure( list( beta = c( 0.983790622281964, 0.645152464354322

Why can't DirectX/DirectWrite/Direct2D text rendering be as sharp as GDI?

随声附和 提交于 2019-12-17 22:43:02
问题 I already know that sub-pixel positioning causes DirectWrite text rendering to be blurry compared to GDI. However, my question is a bit more fundamental: Why can't DirectWrite (and related methods) be made to render text as sharply as GDI? In other words: What prevents DirectWrite from being able to snap text to the nearest pixel, the way GDI can? Is it, for example, a hardware issue? A driver architecture issue? Is it simply not implemented? Or something else? Smaller sample: Larger samples:

smooth peaks in gnuplot

不问归期 提交于 2019-12-17 20:15:27
问题 I have datapoints f(x_i) at points x_i (function f not known, only numerically) with f(0) = 0. The data show a peaklike structure at small x, to be followed by a slow shoulder-falloff at larger x that sets in half-way down from the maximum. I want to plot smoothed lines through these data points. If I use bezier then indeed f(0)=0 is ok, but the peak is significantly (by about 25%), lowered. If I use acsplines then the peak looks somewhat better, but f(0) = 0 is not maintained. How can I

How to fit a smooth hysteresis in a poorly distributed data set?

萝らか妹 提交于 2019-12-14 02:46:02
问题 This is a follow up question to How can I fit a smooth hysteresis in R?. A straightforward application of smooth.spline fits my actual poorly, although it proved a useful generic idea for this type of problem and had worked well on my simulated toy dataset. I uploaded an example of my dataset here. Following image is created by the code at the end. Thysteresis is not fully closed - but that's not an issue. Applying smooth.spline produces a way too messy output (red). Using argument spar in

How does the sgolay function work in Matlab R2013a?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-14 02:07:32
问题 I have a question about the sgolay function in Matlab R2013a. My database has 165 spectra with 2884 variables and I would like to take the first and second derivatives of them. How might I define the inputs K and F to sgolay ? Below is an example: sgolay is used to smooth a noisy sinusoid and compare the resulting first and second derivatives to the first and second derivatives computed using diff . Notice how using diff amplifies the noise and generates useless results. K = 4; % Order of

Weighted smoothing of a 1D array - Python

孤者浪人 提交于 2019-12-13 12:35:44
问题 I am quite new to Python and I have an array of some parameter detections, some of the values were detected incorrectly and (like 4555555): array = [1, 20, 55, 33, 4555555, 1] And I want to somehow smooth it. Right now I'm doing that with a weighted mean: def smoothify(array): for i in range(1, len(array) - 2): array[i] = 0.7 * array[i] + 0.15 * (array[i - 1] + array[i + 1]) return array But it works pretty bad, of course, we can take a weighted mean of more than 3 elements, but it results in

smooth scrolling for all links and buttons on a page

限于喜欢 提交于 2019-12-13 06:29:14
问题 The first 26 lines give me smooth scrolling for all links in my navbar and my logo, but I don't know how to combine it with the scroll up button that I've got from another tutorial. Is there a way to make all links scroll in the first piece of code and not only elements in the navbar? $(document).ready(function(){ // Add scrollspy to <body> $('body').scrollspy({target: ".navbar", offset: 50}); // Add smooth scrolling on all links inside the navbar $("a").on('click', function(event) { // Make