¡@

Home 

python Programming Glossary: np.mgrid

Image transformation in OpenCV

http://stackoverflow.com/questions/10364201/image-transformation-in-opencv

import griddata import numpy as np grid_x grid_y np.mgrid 0 149 150j 0 149 150j destination np.array 0 0 0 49 0 99 0 149..

Shade 'cells' in polar plot with matplotlib

http://stackoverflow.com/questions/10837296/shade-cells-in-polar-plot-with-matplotlib

data to use pcolormesh if it's un ordered points theta r np.mgrid 0 2 np.pi 20j 0 1 10j z np.random.random theta.size .reshape..

Numpy: Sorting a multidimensional array by a multidimensional array

http://stackoverflow.com/questions/10921893/numpy-sorting-a-multidimensional-array-by-a-multidimensional-array

handy numpy function which generates i1 and i2 is called np.mgrid . I use np.ogrid in my answer which is equivalent in this case..

Python/matplotlib : plotting a 3d cube, a sphere and a vector?

http://stackoverflow.com/questions/11140163/python-matplotlib-plotting-a-3d-cube-a-sphere-and-a-vector

s e r 1 r 0 ax.plot3D zip s e color b #draw sphere u v np.mgrid 0 2 np.pi 20j 0 np.pi 10j x np.cos u np.sin v y np.sin u np.sin..

Adding water flow arrows to Matplotlib Contour Plot

http://stackoverflow.com/questions/16529892/adding-water-flow-arrows-to-matplotlib-contour-plot

3 10 # Interpolate these onto a regular grid xi yi np.mgrid 0 1 100j 0 1 100j func Rbf x y z function 'linear' zi func xi..

Integrate 2D kernel density estimate

http://stackoverflow.com/questions/17822282/integrate-2d-kernel-density-estimate

m2 # Perform a kernel density estimate KDE on the data x y np.mgrid xmin xmax 100j ymin ymax 100j positions np.vstack x.ravel y.ravel..

Fitting a line in 3D

http://stackoverflow.com/questions/2298390/fitting-a-line-in-3d

numpy as np # Generate some data that lies along a line x np.mgrid 2 5 120j y np.mgrid 1 9 120j z np.mgrid 5 3 120j data np.concatenate.. some data that lies along a line x np.mgrid 2 5 120j y np.mgrid 1 9 120j z np.mgrid 5 3 120j data np.concatenate x np.newaxis.. along a line x np.mgrid 2 5 120j y np.mgrid 1 9 120j z np.mgrid 5 3 120j data np.concatenate x np.newaxis y np.newaxis z np.newaxis..

How to sort my paws?

http://stackoverflow.com/questions/4502656/how-to-sort-my-paws

blank edges around the paw... mask paw 0.01 paw.max y x np.mgrid ny nx ymin ymax y mask .min y mask .max xmin xmax x mask .min..

How to extract an arbitrary line of values from a numpy array?

http://stackoverflow.com/questions/7878398/how-to-extract-an-arbitrary-line-of-values-from-a-numpy-array

matplotlib.pyplot as plt # Generate some data... x y np.mgrid 5 5 0.1 5 5 0.1 z np.sqrt x 2 y 2 np.sin x 2 y 2 # Extract the.. matplotlib.pyplot as plt # Generate some data... x y np.mgrid 5 5 0.1 5 5 0.1 z np.sqrt x 2 y 2 np.sin x 2 y 2 # Extract the.. matplotlib.pyplot as plt # Generate some data... x y np.mgrid 5 5 0.1 5 5 0.1 z np.sqrt x 2 y 2 np.sin x 2 y 2 # Extract the..

Smoothing Data in Contour Plot with Matlibplot

http://stackoverflow.com/questions/8055489/smoothing-data-in-contour-plot-with-matlibplot

as plt import scipy.ndimage as ndimage X Y np.mgrid 70 70 70 70 Z np.cos X 2 Y 2 200. np.random.normal size X.shape..

3D Contour plot from data using Mayavi / Python

http://stackoverflow.com/questions/9419451/3d-contour-plot-from-data-using-mayavi-python

R 2 .sum axis 1 # Create the grid to interpolate on X Y Z np.mgrid dx dx pts dx dx pts dx dx pts # Interpolate the data F griddata..