python Programming Glossary: sigma
python pylab plot normal distribution http://stackoverflow.com/questions/10138085/python-pylab-plot-normal-distribution as np import matplotlib.mlab as mlab mean 0 variance 1 sigma sqrt variance x np.linspace 3 3 100 plt.plot x mlab.normpdf..
Fit a gaussian function http://stackoverflow.com/questions/11507028/fit-a-gaussian-function to be used to fit to the data above def gauss x p A mu sigma p return A numpy.exp x mu 2 2. sigma 2 # p0 is the initial guess.. def gauss x p A mu sigma p return A numpy.exp x mu 2 2. sigma 2 # p0 is the initial guess for the fitting coefficients A mu.. is the initial guess for the fitting coefficients A mu and sigma above p0 1. 0. 1. coeff var_matrix curve_fit gauss bin_centres..
multidimensional confidence intervals http://stackoverflow.com/questions/12301071/multidimensional-confidence-intervals improve this question It sounds like you just want the 2 sigma ellipse of the scatter of points If so consider something like.. points nstd 2 ax None kwargs Plots an `nstd` sigma ellipse based on the mean and covariance of a point cloud points.. cov pos nstd 2 ax None kwargs Plots an `nstd` sigma error ellipse based on the specified covariance matrix `cov`..
Python finite difference functions? http://stackoverflow.com/questions/18991408/python-finite-difference-functions dx cf np.convolve f 1 1 dx gf ndimage.gaussian_filter1d f sigma 1 order 1 mode 'wrap' dx #Second derivatives ddf np.diff f 2.. np.convolve f 1 2 1 dxdx ggf ndimage.gaussian_filter1d f sigma 1 order 2 mode 'wrap' dxdx #Plotting plt.figure plt.plot x f.. x im sine sine ... None d1 ndimage.gaussian_filter im sigma 5 order 1 mode 'wrap' d2 ndimage.gaussian_filter im sigma 5..
Histogram Matplotlib http://stackoverflow.com/questions/5328556/histogram-matplotlib import matplotlib.pyplot as plt import numpy as np mu sigma 100 15 x mu sigma np.random.randn 10000 hist bins np.histogram.. as plt import numpy as np mu sigma 100 15 x mu sigma np.random.randn 10000 hist bins np.histogram x bins 50 width..
confidence interval with leastsq fit in scipy python http://stackoverflow.com/questions/5811043/confidence-interval-with-leastsq-fit-in-scipy-python interval print mu mean_params 0 std_params 0 1.95996 print sigma mean_params 1 std_params 1 1.95996 share improve this answer..
Smoothing Data in Contour Plot with Matlibplot http://stackoverflow.com/questions/8055489/smoothing-data-in-contour-plot-with-matlibplot 200. np.random.normal size X.shape # Increase the value of sigma to increase the amount of blurring. # order 0 means gaussian.. order 0 means gaussian kernel Z2 ndimage.gaussian_filter Z sigma 1.0 order 0 fig plt.figure ax fig.add_subplot 1 2 1 ax.imshow..
scipy, lognormal distribution - parameters http://stackoverflow.com/questions/8747761/scipy-lognormal-distribution-parameters loc 10 scale 3 size 1000 # logsample ~ N mu 10 sigma 3 In 59 sample np.exp logsample # sample ~ lognormal 10 3 In.. 0 21318.029350592606 In 62 np.log scale shape # mu sigma Out 62 9.9673084420467362 2.9212650122639419 share improve..
|