¡@

Home 

python Programming Glossary: np.random.randint

Using numpy.take for faster fancy indexing

http://stackoverflow.com/questions/14491480/using-numpy-take-for-faster-fancy-indexing

img are the following planes rows cols n 3 4000 4000 4 lut np.random.randint 2 31 2 31 1 size planes 256 n 4 .view 'uint8' lut lut.reshape.. 256 n 4 .view 'uint8' lut lut.reshape planes 256 n img np.random.randint 2 31 2 31 1 size planes rows cols 4 .view 'uint8' img img.reshape.. numpy as np num 4000 planes rows cols n 3 num num 4 lut np.random.randint 2 31 2 31 1 size planes 256 n 4 .view 'uint8' lut lut.reshape..

Fast Way to slice image into overlapping patches and merge patches to image

http://stackoverflow.com/questions/16774148/fast-way-to-slice-image-into-overlapping-patches-and-merge-patches-to-image

here e.g. with a random image if __name__ '__main__' img np.random.randint 255 size 100 100 sImg img.shape sP np.array 39 39 # size of..

Find unique rows in numpy.array

http://stackoverflow.com/questions/16970982/find-unique-rows-in-numpy-array

wise it is on par or even better than the lexsort method a np.random.randint 2 size 10000 6 timeit np.unique a.view np.dtype np.void a.dtype.itemsize.. 1 a ind 1 axis 1 100 loops best of 3 5.93 ms per loop a np.random.randint 2 size 10000 100 timeit np.unique a.view np.dtype np.void a.dtype.itemsize..

Resampling irregularly spaced data to a regular grid in Python

http://stackoverflow.com/questions/3864899/resampling-irregularly-spaced-data-to-a-regular-grid-in-python

xmin xmax 8 8 ymin ymax 380 2428 # Generate random data x np.random.randint xmin xmax ndata y np.random.randint ymin ymax ndata z np.random.random.. Generate random data x np.random.randint xmin xmax ndata y np.random.randint ymin ymax ndata z np.random.random ndata # Plot the random data..

Numpy grouping using itertools.groupby performance

http://stackoverflow.com/questions/4651683/numpy-grouping-using-itertools-groupby-performance

numpy as np from itertools import groupby values np.array np.random.randint 0 1 32 size 35000000 dtype 'u4' values.sort groups k len list.. numpy as np from itertools import groupby values np.array np.random.randint 0 1 32 size 35000000 dtype 'u4' values.sort groups k len list.. numpy as np from itertools import groupby values np.array np.random.randint 0 1 32 size 35000000 dtype 'u4' values.sort groups k sum 1 for..

Matplotlib: simultaneous plotting in multiple threads

http://stackoverflow.com/questions/4659680/matplotlib-simultaneous-plotting-in-multiple-threads

def main pool multiprocessing.Pool num_figs 20 input zip np.random.randint 10 1000 num_figs range num_figs pool.map plot input def plot..

How do I pass large numpy arrays between python subprocesses without saving to disk?

http://stackoverflow.com/questions/5033799/how-do-i-pass-large-numpy-arrays-between-python-subprocesses-without-saving-to-d

##Fake data. In real life get data from hardware. rnd np.random.randint 100 print 'rnd 0 '.format rnd arr rnd q.task_done if __name__..

NumPy: calculate averages with NaNs removed

http://stackoverflow.com/questions/5480694/numpy-calculate-averages-with-nans-removed

nanmean dat np.random.normal size 1000 1000 ii np.ix_ np.random.randint 0 99 size 50 np.random.randint 0 99 size 50 dat ii np.nan method1.. size 1000 1000 ii np.ix_ np.random.randint 0 99 size 50 np.random.randint 0 99 size 50 dat ii np.nan method1 mdat np.ma.masked_array dat..

Filling gaps in a numpy array

http://stackoverflow.com/questions/5551286/filling-gaps-in-a-numpy-array

np.zeros shape dtype bool t_ct int data.size 5 flag.flat np.random.randint 0 flag.size t_ct True # True flags the data # end setup slcs..

Consistenly create same random numpy array

http://stackoverflow.com/questions/5836335/consistenly-create-same-random-numpy-array

and unpickle it but wondering if there's another way. r np.random.randint 3 size 100 2000 1 python random numpy share improve this..

SQLite Performance Benchmark — why is :memory: so slow…only 1.5X as fast as disk?

http://stackoverflow.com/questions/764710/sqlite-performance-benchmark-why-is-memory-so-slow-only-1-5x-as-fast-as-d

uniques in 2nd col mat np.zeros nn 3 dtype 'object' mat 0 np.random.randint 0 cmax nn mat 1 np.random.randint 0 gmax nn mat 2 np.random.uniform.. 3 dtype 'object' mat 0 np.random.randint 0 cmax nn mat 1 np.random.randint 0 gmax nn mat 2 np.random.uniform 0 1 nn #2 Load it into both.. kind results np.zeros numqs 3 for qq in range numqs qsize np.random.randint 1 numqrows 1 id1a np.sort np.random.permutation np.arange cmax..