Tagged Questions

1
vote
1answer
24 views

conditional operation on numpy multidimensional array

I am a naive numpy user, need your help for the following problem: I want to replace some elements of a multidimensional array which are less than a second array by a third array; e.g.: x = ...
0
votes
0answers
18 views

Numpy nd.array, ctypes, multiprocessing

Multiprocessing newbie looking to work with numpy. I have a script which segments an image and creates a variable size block of the image as a numpy array. np_array = gdal.ReadAsArray() In the ...
2
votes
2answers
37 views

Fast 2D rigid body transformations in numpy/scipy

I want to apply rigid body transformations to a large set of 2D image matrices. Ideally, I'd like to be able to just supply an affine transformation matrix specifying both the translation and ...
0
votes
2answers
35 views

Multiply a 1d array x 2d array python

I have a 2d array and a 1d array and I need to multiply each element in the 1d array x each element in the 2d array columns. It's basically a matrix multiplication but numpy won't allow matrix ...
1
vote
1answer
40 views

combining numpy arrays and masking

i have the following problem. In know that with numpy i can read datafiles with genfromtext. I can then select the records from that with a mask(from the dictionary). >>> gln = a[a['AA2'] ...
1
vote
2answers
50 views

operations on lists using zip or array

I am wondering what is the best to do if I want to sum the elements (elements by elements) of two lists named l1 and l2: l3 = [i + j for i, j in zip(l1,l2)] or converting the lists as arrays and ...
2
votes
1answer
36 views

How to remove all rows in a numpy.ndarray that contain non-numeric values

Basically, I'm doing some data analysis. I read in a dataset as a numpy.ndarray and some of the values are missing (either by just not being there, being NaN, or by being a string written "NA"). I ...
0
votes
2answers
61 views

How to set the alpha value for each element of a numpy array

I want to populate an array and then show it like an image. I want to set two parameters for each array element: a "color value" and a "transparency value". I am using imshow from matplotlib, but I am ...
0
votes
0answers
31 views

Compiling numpy with OpenBLAS integration

I am trying to install numpy with OpenBLAS , however I am at loss as to how the site.cfg file needs to be written. When the installation procedure was followed the installation completed without ...
0
votes
1answer
24 views

numpy and scipy for preinstalled python 2.6.7 on mac OS Lion

Is there anyway to install numpy and scipy on python 2.6.7 that comes with Mac OS Lion? I am aware that Lion has Python 2.7 as well. But I need to stick with Python 2.6 cause I am using a module that ...
3
votes
1answer
46 views

Python package that supports weighted covariance computation

Is there a python statistical package that supports the computation of weighted covariance (i.e., each observation has a weight) ? Unfortuantely numpy.cov does not support weights. Preferably ...
1
vote
3answers
51 views

Parallelizing a Numpy vector operation

Let's use, for example, numpy.sin() The following code will return the value of the sine for each value of the array a: import numpy a = numpy.arange( 1000000 ) result = numpy.sin( a ) But my ...
0
votes
1answer
45 views

Compute divergence of vector field using python

Is there a function that could be used for calculation of the divergence of the vectorial field? (in matlab) I would expect it exists in numpy/scipy but I can not find it using google :(. I need to ...
1
vote
1answer
34 views

OpenCV: setting all pixels of specific BGR value to another BGR value

I am using OpenCV with Python. I have an image, and what I want to do is set all pixels of BGR value [0, 0, 255] to [0, 255, 255]. I asked a previous question on how to posterize an image, and from ...
1
vote
2answers
56 views

Polynomials with negative exponents in Python

Is there a library to work with polynomial arithmetic when polynomials can have negative exponents? I found the poly1d class in numpy, but I cannot figure out how I could represent a polynomial like ...

1 2 3 4 5 178
15 30 50 per page