0
votes
0answers
32 views

Convert Str to Float in csv

I'm running into a little error where I open up a csv file set up as 10 columns by 100 rows. I want to first convert all the numbers in it from str into floats. Then turn each column of numbers into ...
0
votes
1answer
20 views

Numpy inverse mask

I want to inverse the true/false value in my numpy masked array. So in the example below i don't want to mask out the second value in the data array, I want to mask out the first and third value. ...
3
votes
2answers
82 views

Is convolution slower in Numpy than in Matlab?

Convolution in Matlab appears to be twice as fast as convolution in Numpy. Python code (takes 19 seconds on my machine): import numpy as np from scipy import ndimage import time img = ...
0
votes
0answers
17 views

How to read and write 24-bit wav file using scipy or common alternative?

Frequently, wav files are or need to be 24-bit yet I do not see a way to write or read 24-bit wav files using scipy module. The documentation for wavfile.write() states that the resolution of the wav ...
3
votes
2answers
43 views

Numpy to check if a solution exists such that each row is < 0?

Consider the following code X=np.matrix([[1,-1,1],[-1,0,1]]) print X.T ''' [[ 1 -1] [-1 0] [ 1 1]] ''' I want to check if a solution exists where the transpose has a <0 solution. For ...
1
vote
1answer
28 views

How to iterate over the first dimension of each operand using nditer?

Given: import numpy as np a = np.arange(6) b = np.arange(24).reshape(6,4) I want something like this: for i in xrange(len(a)): v1 = a[i] v2 = b[i,...] but I can't figure out how to do it ...
0
votes
2answers
38 views

Performance issues using nested for loops for image processing

I have code, shown here, that makes a computer generated hologram given an initial image. The image that the program is currently using can be found in the in the image directory. My program takes ...
1
vote
1answer
79 views

Make array iteration faster using views

If I have a large numpy array x I can speed up many iterative operations, like instead of writing x[1:-1] = 5*x[1:-1] I can use x[1:-1] *= 5 which is faster, because in contrast to the first ...
7
votes
2answers
43 views

Indexes of fixed size sub-matrices of numpy array

I am implementing an algorithm which requires me to look at non-overlapping consecutive submatrices within a (strictly two dimensional) numpy array. eg, for the 12 by 12 >>> a = ...
-2
votes
3answers
60 views

Converting plain text list into array in python program [closed]

The TextFile.txt file contains: 1 one 2 two 3 three 4 four 5 five The python program: file = open ("x.txt", "r") for item in file: x = item.split ('\s') import numpy as np ...
1
vote
1answer
21 views

Get a value from a numpy matrix

If I have a numpy matrix: >>> S matrix([[ 0.66581073+0.00033919j], [ 0.81568896-0.03291265j], [ 0.99884785+0.00045446j]]) How do I get an element, without the matrix ...
0
votes
1answer
48 views

Plotting color pattern graph

I know Stack Overflow is not a code writing service, but I am really stuck with this one and I have no clue how I can draw a map like this: Where the color code is based on the p-value; the smaller ...
0
votes
0answers
47 views

how to get index in numpy using ufunc

numpy is great,and ufunc and use to calculate on every item. I want to calculate some data on the item,the calculate based on the neighbor of the item,so I want to get the item value and the ...
2
votes
1answer
23 views

Numpy - Dot Product of a Vector of Matrices with a Vector of Scalars

I have a 3 dimensional data set that I am trying to manipulate in the following way. data.shape = (643, 2890, 10) vector.shape = (643,) I would like numpy to see data as a 643 length 1-D array of ...
4
votes
1answer
51 views

What is the difference between cholesky in numpy and scipy?

I use Cholesky decomposition to sample random variables from multi-dimension Gaussian, and calculate the power spectrum of the random variables. The result I get from numpy.linalg.cholesky always has ...

1 2 3 4 5 351
15 30 50 per page