1
vote
0answers
9 views

Slicing a scipy sparse matrix using a boolean mask

I have encountered a difference in how slicing a scipy sparse matrix works in 0.10.0 and 0.10.1. Consider the following piece of code: from numpy import array, ravel from scipy.sparse import ...
0
votes
0answers
9 views

anyone has install scipy on aws free tier?

I've got problem when pip install scipy on aws micro instance, which has only 512 MB memory. lapack-devel, blas-devel, and numpy already installed. some one said the memory is too small to build c++ ...
1
vote
2answers
39 views

scipy.optimize solution using python for the following equation

I am very new to scipy and doing data analysis in python. I am trying to solve the following regularized optimization problem and unfortunately I haven't been able to make too much sense from the ...
3
votes
3answers
49 views

Efficiently Subtract Vector from Matrix (Scipy)

I've got a large matrix stored as a scipy.sparse.csc_matrix and want to subtract a column vector from each one of the columns in the large matrix. This is a pretty common task when you're doing things ...
1
vote
1answer
46 views

Optmizing a function scipy.optimize

I am new to python and statistical programming. For a class assignment we've been asked to implement python lasso L1 regression. This involves using a QP solver to solve . 0.5 *(x^t * H * x) + f^t * ...
0
votes
1answer
48 views

Interpolate on a logarithmic scale in python

To interpolate my data I currently use this function: def myinterp(x, y, der = 0, s = 0): tck = interpolate.splrep(x, y, s = sigma) xnew = np.arange(x[0], x[-1], (x[-1]-x[0])/x.size) ynew ...
0
votes
0answers
28 views

scipy.signal.resample behaves strangely

I am currently working on some signal processing (using scipy), but I encountered a strange problem and can't figure out what's wrong. Namely, I am reading some audio data from a .wav file, but have ...
2
votes
1answer
61 views

Scipy - how to further optimize sparse matrix code for stochastic gradient descent

I'm working on implementing the stochastic gradient descent algorithm for recommender systems using sparse matrices with Scipy. This is how a first basic implementation looks like: N = ...
4
votes
2answers
51 views

Summing each 3x3 window of a M*N matrix, into a M/3*N/3 matrix with numpy

I'm trying to implement a function that would sum (or eventually average) Each 3x3 window of a given matrix, and create a matrix 9x smaller with the result of each window. I can't figure out an ...
1
vote
0answers
39 views

How to visualize 3D delaunay triangulation in Python?

I have a set of 3D points which I've used scipy.spatial.Delaunay to do the triangulation / tetrahedralization. I now have a set of unique faces of all of the tetrahedra, and would like to visualize ...
3
votes
1answer
19 views

update an artiste (Line2D) on a figure without re-drawing the whole figure - axes.draw_artist() crashes

I want a line (Line2D) object to move with the current cursor position on several axes of a figure. The way I'm doing it now is to re-draw the whole figure each time the cursor moves, by calling ...
7
votes
5answers
126 views

python counting number of presence and absence of substrings in list of sequences

you can get the data here! 2shared the bottom download I'm analyzing biological data with python. I've written down a code to find matching substrings within a list of lists of long strings. The ...
0
votes
2answers
39 views

How to solve this differential equation using scipy odeint?

I am trying to solve the following differential equation using scipy odeint without much success: import numpy as np from scipy.misc import derivative from scipy.integrate import odeint Imag = ...
2
votes
1answer
36 views

scipy.optimize.leastsq : not a proper array of floats

I tried to solve a small toy problem import numpy as np import scipy.optimize as opt def f(a): return np.array([a+.2,a-.1]) opt.leastsq(f,2) However, it gives me an error ...
2
votes
2answers
87 views

Plot Normal distribution with Matplotlib

please help me to plot the normal distribution of the folowing data: DATA: import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm h = [186, 176, 158, 180, 186, 168, 168, ...
0
votes
2answers
78 views

Fitting a Normal distribution to 1D data

I have a 1 Dimentional array and I can compute the "mean" and "standard deviation" of this sample and plot the "Normal distribution" but I have a problems: I want to plot the data and Normal ...
0
votes
1answer
18 views

sklearn GMM raises “ValueError: setting an array element with a sequence.” on sparse matrix

I am attempting to cluster a set of data points that are represented as a sparse scipy matrix, X. That is, >>> print type(X) <class 'scipy.sparse.csr.csr_matrix'> >>> ...
0
votes
0answers
46 views

Problems building SciPy 0.13.0 using Numpy 1.8.0 built with ATLAS 3.10.1 / LAPACK 3.4.2

I am running into problems to compile SciPy 0.13.0. On a CentOS 6.4 machine, my installation order is: 0-1 Build GCC 4.8.2 from source using gmp 5.1.3, mpc 1.0.1, and mpfr 3.1.2 0-2 Build ...
3
votes
2answers
144 views
+200

Efficient density function computation

I have a large image in numpy array form (opencv returns it as a 2d array of 3 uint8 values) and want to compute a sum of gaussian kernels for each pixel, i.e. (there's still no LaTeX support in SO is ...
1
vote
1answer
41 views

scipy.io.wavfile.read cannot read 24-bits .wav files

It seems that scipy.io.wavfile.read cannot read 24-bits .wav files. Do you have an idea on how to handle them ?
2
votes
2answers
84 views

What are the workaround options for python out of memory error?

I am reading a x,y,z point file (LAS) into python and have run into memory errors. I am interpolating unknown points between known points for a project I am working on. I began working with small ...
2
votes
1answer
55 views

Fit a curve for data made up of two distinct regimes

I'm looking for a way to plot a curve through some experimental data. The data shows a small linear regime with a shallow gradient, followed by a steep linear regime after a threshold value. My data ...
2
votes
0answers
33 views

Adding new words to text vectorizer in scikit-learn

Scikit-learn CountVectorizer for bag-of-words approach currently gives two sub-options: (a) use a custom vocabulary (b) if custom vocabulary is unavailable, then it makes a vocabulary based on all the ...
0
votes
1answer
21 views

Scipy installation issues from source?

I'm trying to install scipy numpy from source for installing scikit learn from source. I managed to do it for numpy and scikit but for scipy I get an error, ImportError: No module named ...
3
votes
1answer
40 views

python cross section curve fitting

I have a set of points describing a cross section of a simple surface cavity/bulge. Polynomial approximation would be enough, but numpy.polyfit needs a certain degree. I thought of several iterations ...
0
votes
1answer
19 views

Trouble installing scipy despite having python2.7 and numpy installed already

I'm having trouble installing scipy via the binaries provided at http://sourceforge.net/projects/scipy/files/scipy/ Double clicking on the mpkg file after mounting the dmg installer gives the ...
-2
votes
0answers
19 views

HE-VED (Histogram Equalization with variable enhancement degree)

I'm using Python 2.7 with PIL, Numpy, Scipy and matplotlib. I performed histogram equalization on a H S I image on the intensity parameter. Obviously the results in some cases are not acceptable at ...
4
votes
1answer
71 views

Python/Scipy: Find “bounded” min/max of a matrix

I think it is easiest to specify my problem, the generalized case is difficult to explain. Say I have a matrix a with dimensions NxMxT, where one can think about T as a time-dimension (to make ...
3
votes
2answers
49 views

Is there a Python equivalent to MATLAB's pearsrnd function?

I would like to generate random numbers with a given mean, variance, skewness, and kurtosis from the Pearson system. I can do this in MATLAB using "pearsrnd" -- does scipy, statsmodels, or any other ...
1
vote
2answers
41 views

scipy odeint with complex initial values

I need to solve a complex-domain-defined ODE system, with complex initial values. scipy.integrate.odeint does not work on complex systems. I rod about cutting my system in real and imaginary part and ...
1
vote
1answer
39 views

Histogram Equalization based on HSI model

I am using Python 2.7 on Debian Linux along with matplotlib, Numpy and Scipy and PIL. I am able to generate a histogram for the H S and I parameters of an image using the code mentioned. I intend to ...
1
vote
1answer
43 views

Resample a pandas dataframe by an arbitrary factor

Pandas resampling is really convenient if your indices use datetime indexing, but I haven't found an easy implementation to resample by an arbitrary factor. E.g., just treat each index as an ...
1
vote
1answer
47 views

Index of multidimensional array

I have a problem using multi-dimensional vectors as indices for multi-dimensional vectors. Say I have C.ndim == idx.shape[0], then I want C[idx] to give me a single element. Allow me to explain with a ...
0
votes
2answers
49 views

Read and write stereo .wav file with python + metadatas

What's the easiest way to read and write a stereo .wav file in Python ? Should I use scipy.io.wavfile.read ? Should I use a 2-dimension array (how ?) in order to have x[n,j] where j is the channel ...
0
votes
0answers
32 views

scipy.ndimage.zoom does not work with masked numpy arrays

applying scipy.ndimage.zoom to an arbitrary masked array results in a new array which is filled with NaNs. This seems to be related to this older bug report. I tried a recent version of scipy and it ...
1
vote
1answer
24 views

Store values of levels in contour plot

I'm coming from this question Find most distant points in contour curve where the answer given allows me to produce a contour plot like the one shown below, using the code that is farther down. ...
3
votes
2answers
51 views

Hstacking features somehow causes an extra slowdown in prediction

When I use scipy.sparse.hstack of some sparse matrices produced by CountVectorizer and the like, and I want to merge them for use in a regression, but somehow they are slower: X1 has 10000 features ...
2
votes
1answer
30 views

Framing the least squares function using fmin_slsqp

I am new to optimization. I am trying to solve a linear least-squares problem using the fmin_slsqp function in scipy.optimize. I have the objective function as frobenius norm of |q0_T*P-q1_T| ...
2
votes
1answer
54 views

Find most distant points in contour curve

I have some x,y data for which I obtain a gaussian kernel density estimator (KDE) using the scipy.stats.gaussian_kde function. I can plot this so as to display the contour density curves shown below ...
0
votes
3answers
31 views

Issues with python quad limit option

I am using scipy quad and I am clearly misunderstanding the documentation associated with the limit options. I want to limit the number subintervals my function is evaluated on in order to decrease by ...
3
votes
1answer
39 views

Structure of inputs to scipy minimize function

I have inherited some code that is trying to minimize a function using scipy.optimize.minimize. I am having trouble understanding some of the inputs to the fun and jac arguments The call to minimize ...
2
votes
2answers
19 views

Passing arguments to fsolve

I'm solving a nonlinear equation with many constants. I created a function for solving like: def terminalV(Vt, data): from numpy import sqrt ro_p, ro, D_p, mi, g = (i for i in data) y = ...
1
vote
1answer
41 views

polyfit() got an unexpected keyword argument 'w'

I'm trying to use np.polyfit and I keep getting the error: TypeError: polyfit() got an unexpected keyword argument 'w' The documentation on that function clearly mentions this argument so I'm not ...
2
votes
1answer
25 views

Parameter error estimate with optimize.fmin_l_bfgs_b

Is there a way to estimate the error of the estimated optimization parameters as calculated with scipy.optimize.fmin_l_bfgs_b (or any of the other bounded optimization routines in the scipy.optimize ...
14
votes
2answers
271 views

Interpolating a 3D surface known by its corner nodes and coloring it with a colormap

I want to construct a 3D representation of experimental data to track the deformation of a membrane. Experimentally, only the corner nodes are known. However I want to plot the deformaiton of the ...
1
vote
1answer
53 views

Contour plot of image gives: TypeError Input must be 2D array error

I am using Debian Linux and python 2.7. I am reading an image and trying to process it but I am being shown the following error. Can someone please tell me what i'm doing wrong? import Image import ...
0
votes
0answers
24 views

2D Kernel Density Estimate with .net like scipy.stats.gaussian_kde

I am looking for a .net implementation of scipy.stats.gaussian_kde or fast_kde. Or any pointer how can I implement it. I already tried to port this code into .net with IronPython, but scipy and numpy ...
1
vote
1answer
32 views

Error using ConvexHull from scipy

I'm running a Debian based OS, on which I have python installed. I installed scipy using apt-get, however when I try to use the ConvexHull function from scipy.spatial, though scipy.spatial is imported ...
3
votes
1answer
52 views

scipy.optimize + kmeans clustering

I have the following setup for kmeans clustering algorithm that I am implementing for a project: import numpy as np import scipy import sys import random import matplotlib.pyplot as plt import ...
2
votes
1answer
44 views

How to filter numpy array by list of indices?

I am relatively new to python and have been trying to learn how to use numpy and scipy. I have a numpy array comprised of LAS data [x, y, z, intensity, classification]. I have created a cKDTree of ...

15 30 50 per page