gaussian

Gaussian summation for 2D scatter plots using python

你离开我真会死。 提交于 2019-12-24 03:30:53
问题 I am trying to establish what people would loosely refer to as a homemade KDE - I suppose. I am trying to evaluate a density of a rather huge set of datapoints. In particular, having many data points for a scatter, I want to indicate the density using a color gradient (see link below). For exemplification, I provide a random pair of (x,y) data below. The real data will be spread on different scales, hence the difference in X and Y grid point spacing. import numpy as np from matplotlib import

PCL Gaussian Kernal example

限于喜欢 提交于 2019-12-24 02:04:19
问题 I need help in applying a Gaussian Kernel on my points cloud to smooth the cloud. I could not figure out how I should write the code and I could not find any plain examples. Update: I am using Point Cloud Library (pcl): pcl::io::loadPCDFile ("/home/..../2240.pcd", *raw_cloud); Eigen::VectorXf horizontal; //Set up the Gaussian Kernel pcl::GaussianKernel<pcl::PointXYZRGB> gaussianKernel; gaussianKernel.compute(5,horizontal,40); pcl::filters::Convolution<pcl::PointXYZRGB> conv; conv

2d gaussian function does not produce correct results

落爺英雄遲暮 提交于 2019-12-24 00:52:16
问题 I would like to write a function that returns an np.array of size nx x ny that contains a centered gaussian distribution with mean mu and sd sig . The code below works in certain cases but in many not - what's wrong or what else should I write to get what I need? import matplotlib.pyplot as plt import numpy as np def create2dGaussian(mu, sigma, nx, ny): x, y = np.meshgrid(np.linspace(-nx / 2.0, +nx / 2.0, nx), np.linspace(-ny / 2.0, +ny / 2.0, ny)) d = np.sqrt(x * x + y * y) g = np.exp(-((d -

Numpy: Generating a 2D Sum of Gaussians pdf as an array

删除回忆录丶 提交于 2019-12-23 21:25:03
问题 I'm trying to generate a [600 x 600] numpy array that contains the sum of 10 Gaussian-like arrays (each with a randomly-generated center). I've tried using a Gaussian filter to generate the individual Gaussian-like arrays, then summing them up, but I'm sure there's a vectorized way to approach this. Even with num_centers=10 it's slow, and I might need to sum as many as 20 Gaussians. There is a similar question here, but it doesn't seem to have a good or conclusive answer and I'm not sure how

How to shuffle a list with Gaussian distribution

十年热恋 提交于 2019-12-23 19:23:03
问题 I want to simulate fault on a message (Eg: 1000010011 => 1010000011). Is there a way to implement this in Python? I tried the following, which works: import random a = "1011101101" b = [el for el in a] # b = ['1', '0', '1', '1', '1', '0', '1', '1', '0', '1'] random.shuffle(b) print b # b = ['0', '1', '1', '1', '0', '1', '1', '1', '1', '0'] random.shuffle(b, random.random) print b # b = ['1', '1', '0', '1', '1', '0', '1', '0', '1', '1'] I would like my reordering to be Normally/Gaussian

circularly symmetric Gaussian variables using matlab

荒凉一梦 提交于 2019-12-23 04:43:11
问题 any one can help me, i want to generate a matrix with elements being zero mean and unit variance independent and identically distributed (i.i.d.) circularly symmetric Gaussian variables using Matlab any one know the code for this and how to do it 回答1: It is easy to generate a matrix with elements being zero mean and unit variance by using this command in matlab: normrnd(mu, sigma) mu is the mean sigma is the standard deviation. More detail please help normrnd in MATLAB. 来源: https:/

Fitting Gaussian curve to data in python

你离开我真会死。 提交于 2019-12-23 03:34:18
问题 I'm trying to fit and plot a Gaussian curve to some given data. This is what I have so far: import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit # Generate data mu, sigma = 0, 0.1 y, xe = np.histogram(np.random.normal(mu, sigma, 1000)) x = .5 * (xe[:-1] + xe[1:]) def gauss (x, y): p = [x0, y0, sigma] return p[0] * np.exp(-(x-p[1])**2 / (2 * p[2]**2)) p0 = [1., 1., 1.] fit = curve_fit(gauss, x, y, p0=p0) plt.plot(gauss(x, y)) plt.show() When I run the code I

Plot scaled and rotated bivariate distribution using matplotlib

这一生的挚爱 提交于 2019-12-22 12:01:50
问题 I am trying to plot a bivariate gaussian distribution using matplotlib . I want to do this using the xy coordinates of two scatter points (Group A), (Group B). I want to adjust the distribution by adjusting the COV matrix to account for each Groups velocity and their distance to an additional xy coordinate used as a reference point. I've calculated the distance of each groups xy coordinate to that of the reference point. The distance is expressed as a radius , labelled [GrA_Rad] , [GrB_Rad] .

How to obtain a weighted gaussian filter

帅比萌擦擦* 提交于 2019-12-21 17:55:31
问题 I have a set of weighted x,y points, like shown below (the full set is here): # x y w -0.038 2.0127 0.71 0.058 1.9557 1 0.067 2.0016 0.9 0.072 2.0316 0.83 ... I need to find a smoothed line that adjusts these points according to the importance assigned to each, ie: more weight means the data point should have more relevance. This is the code I have so far, which basically applies a gaussian_filter1d to the data (I got the idea from this question: line smoothing algorithm in python?): import

How to implement the Gaussian mutation operator for a genetic algorithm in Java

拈花ヽ惹草 提交于 2019-12-21 07:18:08
问题 I try to learn and implement a simple genetic algorithm library for my project. At this time, evolution, selection of population is ready, and I'm trying to implement a simple good mutation operator like the Gaussian mutation operator (GMO) for my genetic evolution engine in Java and Scala. I find some information on Gaussian mutation operator (GMO) into the paper A mutation operator based on a Pareto ranking for multi-objective evolutionary algorithms (P.M. Mateo, I. Alberto), page 6 and 7.