¡@

Home 

python Programming Glossary: a.shape

Python hashable dicts

http://stackoverflow.com/questions/1151658/python-hashable-dicts

Find unique rows in numpy.array

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

a .view np.dtype np.void a.dtype.itemsize a.shape 1 _ idx np.unique b return_index True unique_a a idx unique_a.. by doing unique_a np.unique b .view a.dtype .reshape 1 a.shape 1 Also at least on my system performance wise it is on par or.. timeit np.unique a.view np.dtype np.void a.dtype.itemsize a.shape 1 .view a.dtype .reshape 1 a.shape 1 100 loops best of 3 3.17..

Simple Python Challenge: Fastest Bitwise XOR on Data Buffers

http://stackoverflow.com/questions/2119761/simple-python-challenge-fastest-bitwise-xor-on-data-buffers

b numpy.fromstring bb dtype numpy.uint64 arr_size a.shape 0 weave.inline code a b arr_size headers ' emmintrin.h ' return..

Efficient Numpy 2D array construction from 1D array

http://stackoverflow.com/questions/4923617/efficient-numpy-2d-array-construction-from-1d-array

1 raise ValueError `window` must be at least 1. if window a.shape 1 raise ValueError `window` is too long. shape a.shape 1 a.shape.. a.shape 1 raise ValueError `window` is too long. shape a.shape 1 a.shape 1 window 1 window strides a.strides a.strides 1 return.. 1 raise ValueError `window` is too long. shape a.shape 1 a.shape 1 window 1 window strides a.strides a.strides 1 return np.lib.stride_tricks.as_strided..

Using strides for an efficient moving average filter

http://stackoverflow.com/questions/4936620/using-strides-for-an-efficient-moving-average-filter

2 1 i 0 filtered numpy.sum b 1 pow filtsize 2 .reshape a.shape 0 a.shape 1 scipy.misc.imsave average.jpg filtered EDIT Clarification.. 0 filtered numpy.sum b 1 pow filtsize 2 .reshape a.shape 0 a.shape 1 scipy.misc.imsave average.jpg filtered EDIT Clarification.. 1 raise ValueError `window` must be at least 1. if window a.shape 1 raise ValueError `window` is too long. shape a.shape 1 a.shape..

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

proc.stdout.readline .rstrip a numpy.load 'data.pkl' print a.shape proc.stdin.write 'done n' This creates a subprocess which generates.. proc.stdout.readline .rstrip dtype numpy.uint8 print a.shape proc.stdin.write 'done n' This is extremely slow much slower..

Using Numpy stride_tricks to get non-overlapping array blocks

http://stackoverflow.com/questions/8070349/using-numpy-stride-tricks-to-get-non-overlapping-array-blocks

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 sz a.itemsize h w a.shape bh bw 2 2 shape h bh w bw bh bw strides w sz sz w sz sz blocks.. 8 9 10 # 11 12 13 14 15 # 16 17 18 19 20 sz a.itemsize h w a.shape bh bw 2 2 shape h bh w bw bh bw print shape # 2 2 2 2 strides..