¡@

Home 

python Programming Glossary: np.empty

Fitting a 3D array of data to a 1D function with numpy or scipy

http://stackoverflow.com/questions/15094619/fitting-a-3d-array-of-data-to-a-1d-function-with-numpy-or-scipy

y sz 100 # size z # creating the reference parameters tmp np.empty 4 sy sz tmp 0 1.2 0.8 np.random.random_sample sy sz 0.8 tmp.. tmp 2 np.ones sy sz tmp 3 np.ones sy sz np.pi 4 param_ref np.empty 4 sy sz sx # param_ref in this shape will allow an for i in..

numpy 3d to 2d transformation based on 2d mask array

http://stackoverflow.com/questions/15469302/numpy-3d-to-2d-transformation-based-on-2d-mask-array

as it import numpy as np def apply_mask field indices data np.empty indices.shape #It seems highly likely that there is a more numpy.. nicer import numpy as np def apply_mask field indices data np.empty indices.shape for idx_tup zidx in np.ndenumerate indices data..

ode integration in python versus mathematica results

http://stackoverflow.com/questions/16222302/ode-integration-in-python-versus-mathematica-results

.set_integrator 'dopri5' solver.set_initial_value u0 u np.empty len dt 6 u 0 u0 for ii in range 1 len dt u ii solver.integrate..

creating small arrays in cython takes a humongous amount of time

http://stackoverflow.com/questions/18410342/creating-small-arrays-in-cython-takes-a-humongous-amount-of-time

double ndim 1 u cdef np.ndarray np.int_t ndim 1 r np.empty u.shape 0 dtype int cdef int i j 0 for i in range u.shape 0.. 'test.UntypedWithLoop a u r ' sstr print time for just np.empty timeit.timeit 'numpy.empty 10 int ' sstr The binary search implementation.. inputs and doing N iterations 0.244267940521 time for just np.empty 1.0983929634 Why is the np.empty step taking so much time and..

With the Python Imaging Library (PIL), how does one compose an image with an alpha channel over another image?

http://stackoverflow.com/questions/3374878/with-the-python-imaging-library-pil-how-does-one-compose-an-image-with-an-alp

a 9166671 190597 src np.asarray src dst np.asarray dst out np.empty src.shape dtype 'float' alpha np.index_exp 3 rgb np.index_exp..

Numpy grouping using itertools.groupby performance

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

values idx np.concatenate np.where diff 0 len values index np.empty len idx 1 dtype 'u4 u2' index 'f0' values idx 1 index 'f1' np.diff..

Is it possible to specify your own distance function using Scikits.Learn K-Means Clustering?

http://stackoverflow.com/questions/5529625/is-it-possible-to-specify-your-own-distance-function-using-scikits-learn-k-means

2 issparse X issparse Y if sxy 0 return cdist X Y kwargs d np.empty X.shape 0 Y.shape 0 np.float64 if sxy 2 for j x in enumerate..

Use binary COPY table FROM with psycopg2

http://stackoverflow.com/questions/8144002/use-binary-copy-table-from-with-psycopg2

'i4' 'ts' 'i2' 's' str x 'f4' for x in range shape 0 data np.empty shape 1 shape 2 dtype data 'id' np.arange shape 1 shape 2 1.. field '_length' ' i4' field dtype.replace ' ' ' ' pgcopy np.empty dat.shape pgcopy_dtype pgcopy 'num_fields' len dat.dtype for..

Convert RGBA PNG to RGB with PIL

http://stackoverflow.com/questions/9166400/convert-rgba-png-to-rgb-with-pil

object front np.asarray front back np.asarray back result np.empty front.shape dtype 'float' alpha np.index_exp 3 rgb np.index_exp..

Performance comparison of OpenCV-Python interfaces, cv and cv2

http://stackoverflow.com/questions/9357696/performance-comparison-of-opencv-python-interfaces-cv-and-cv2

'sir.jpg' 0 width gray.shape 0 height gray.shape 1 h np.empty width height 3 t time.time for i in xrange width for j in xrange.. cv2.imread 'lena_full.jpg' 0 height width gray.shape h np.empty height width 3 np.uint8 t time.time for i in xrange height for..

Simple Digit Recognition OCR in OpenCV-Python

http://stackoverflow.com/questions/9413216/simple-digit-recognition-ocr-in-opencv-python

thresh cv2.RETR_LIST cv2.CHAIN_APPROX_SIMPLE samples np.empty 0 100 responses keys i for i in range 48 58 for cnt in contours..