0
votes
0answers
24 views
Is there any documentation of numpy numerical stability?
I looked around for some documentation of how numpy/scipy functions behave in terms of numerical stability, e.g. are any means taken to improve numerical stability or are there alternative stable ...
0
votes
0answers
28 views
Python Scipy gaussian_filter?
size = (512, 512)
h = -0.5
sigma = 1
activity = numpy.random.random(size) + h
excitement = numpy.zeros(size)
gaussian_filter(activity, sigma, 0, excitement, "wrap")
excitement - will be ...
1
vote
2answers
15 views
Select range of rows from record ndarray
I obtained a NumPy record ndarray from a CSV file using
data = matplotlib.mlab.csv2rec('./data.csv', delimiter=b',')
The data set is structured as:
date,a0,a1,a2,a3, b0, b1, b2, b3,[...], b9
...
0
votes
0answers
16 views
'numpy.float64' object is not iterable
I'm trying to iterate an array of values generated with numpy.linspace:
slX = numpy.linspace(obsvX, flightX, numSPts)
slY = np.linspace(obsvY, flightY, numSPts)
for index,point in slX:
yPoint = ...
0
votes
0answers
30 views
Video Manipulation
Before a couple days ago I had never used OpenCV or done any video processing. I've been asked to computationally overlay a video based upon some user inputs and build a new video with the overlays ...
2
votes
4answers
32 views
Slice 2d array into smaller 2d arrays
Is there a way to slice a 2d array in numpy into smaller 2d arrays?
Example
[[1,2,3,4], -> [[1,2] [3,4]
[5,6,7,8]] [5,6] [7,8]]
So I basically want to cut down a 2x4 array ...
6
votes
4answers
43 views
Is there a MATLAB accumarray equivalent in numpy?
I'm looking for a fast solution to MATLAB's accumarray in numpy. The accumarray accumulates the elements of an array which belong to the same index. An example:
a = np.arange(1,11)
# array([ 1, 2, ...
1
vote
4answers
45 views
Select values in arrays
I have two arrays of the same length:
x = [2,3,6,100,2,3,5,8,100,100,5]
y = [2,3,4,5,5,5,2,1,0,2,4]
I selected the position where x==100 in this way:
How is possible to have the value of y where ...
0
votes
0answers
25 views
Plot a graph in NetworkX
I try to plot a simple graph in networkx, but this error message appears:
RuntimeError: module compiled against API version 6 but this version of numpy is 4
Traceback (most recent call last):
File ...
3
votes
1answer
34 views
memory leak in matplotlib histogram
Running the following code will result in memory usage rapidly creeping up.
import numpy as np
import pylab as p
mu, sigma = 100, 15
x = mu + sigma*np.random.randn(100000)
for i in range(100):
...
2
votes
1answer
31 views
Theano: Why does indexing fail in this case?
I'm trying to get the max of a vector given a boolean value.
With Numpy:
>>> this = np.arange(10)
>>> this[~(this>=5)].max()
4
But with Theano:
>>> that = ...
1
vote
0answers
41 views
Solve system of ODEs in Python where each ODE is of sympy.core.add.ADD type
I am using a Python based framework to do some biological modeling of chemical kinetics, and I'm running into an issue with SymPy and scipy.integrate.odeint.
Essentially, I have a system of coupled ...
1
vote
1answer
32 views
Numpy data alignment when slicing
I do the following:
from numpy import genfromtxt
x = genfromtxt('foo.csv',delimiter=',',usecols=(0,1))
y = genfromtxt('foo.csv',delimiter=',',usecols=(2),dtype=str)
Then I enter:
x[y=='y1Out',0] ...
0
votes
0answers
36 views
Find the columnwise indices of the minimum values of a generator in Python + Numpy
I have a series of generators that creates a vector such as:
vector = ( remainder(v, PRIME_NUMBER) for v in list_of_vectors)
and I want to generate a vector containing the row indices of the ...
0
votes
1answer
32 views
How to read NetCDF variable float data into a Numpy array with the same precision and scale as the original NetCDF float values?
I have a NetCDF file which contains a variable with float values with precision/scale == 7/2, i.e. there are possible values from -99999.99 to 99999.99.
When I take a slice of the values from the ...