Questions tagged [scipy]

SciPy is an open source library of algorithms and mathematical tools for the Python programming language.

SciPy is an open-source library for the programming language consisting of mathematical algorithms and functions for manipulating and visualizing data, often used in science and engineering. SciPy includes algorithms and tools for tasks such as optimization, clustering, discrete Fourier transforms, linear algebra, signal processing and multi-dimensional image processing.

SciPy is closely related to NumPy and depends on many functions, including a multidimensional array that is used as the basic data structure in SciPy.

SciPy is currently distributed under the BSD license.

Latest stable version:

1.7.3 (2021-11-25)

Documentation:

https://docs.scipy.org/doc/scipy/reference/

21123 questions
44
votes
5 answers

Trouble installing scipy in virtualenv on a amazon ec2 linux micro instance

I have successfully installed scipy in the default python compiler on an amazon ec2 micro instance (Ubuntu 13.04). However i am not able to install scipy in a virtualenv. pip install scipy ends with this error scipy/sparse/sparsetools/csr_wrap.cxx:…
44
votes
4 answers

Scipy.optimize: how to restrict argument values

I'm trying to use scipy.optimize functions to find a global minimum of a complicated function with several arguments. scipy.optimize.minimize seems to do the job best of all, namely, the 'Nelder-Mead' method. However, it tends to go to the areas out…
44
votes
7 answers

Ctrl-C crashes Python after importing scipy.stats

I'm running 64-bit Python 2.7.3 on Win7 64-bit. I can reliably crash the Python interpreter by doing this: >>> from scipy import stats >>> import time >>> time.sleep(3) and pressing Control-C during the sleep. A KeyboardInterrupt is not raised;…
BrenBarn
  • 242,874
  • 37
  • 412
  • 384
44
votes
5 answers

Plotting power spectrum in python

I have an array with 301 values, which were gathered from a movie clip with 301 frames. This means 1 value from 1 frame. The movie clip is running at 30 fps, so is in fact 10 sec long Now I would like to get the power spectrum of this "signal" (…
Olivier_s_j
  • 5,490
  • 24
  • 80
  • 126
44
votes
4 answers

build scipy error cythonize failed

I'm trying to build scipy and I get a RuntimeError: $sudo python setup.py build Processing scipy/cluster/_vq_rewrite.pyx Traceback (most recent call last): File "tools/cythonize.py", line 172, in main() File "tools/cythonize.py",…
Liatz
  • 4,997
  • 7
  • 28
  • 33
44
votes
7 answers

Fitting only one parameter of a function with many parameters in python

In python I have a function which has many parameters. I want to fit this function to a data set, but using only one parameter, the rest of the parameters I want to supply on on my own. Here is an example: def func(x,a,b): return a*x*x + b for b…
lovespeed
  • 4,835
  • 15
  • 41
  • 54
43
votes
10 answers

Where can I find mad (mean absolute deviation) in scipy?

It seems scipy once provided a function mad to calculate the mean absolute deviation for a set of numbers: http://projects.scipy.org/scipy/browser/trunk/scipy/stats/models/utils.py?rev=3473 However, I can not find it anywhere in current versions of…
Ton van den Heuvel
  • 10,157
  • 6
  • 43
  • 82
43
votes
1 answer

Out-of-core processing of sparse CSR arrays

How can one apply some function in parallel on chunks of a sparse CSR array saved on disk using Python? Sequentially this could be done e.g. by saving the CSR array with joblib.dump opening it with joblib.load(.., mmap_mode="r") and processing the…
rth
  • 10,680
  • 7
  • 53
  • 77
43
votes
6 answers

sorting points to form a continuous line

I have a list of (x,y)-coordinates that represent a line skeleton. The list is obtained directly from a binary image: import numpy as np list=np.where(img_skeleton>0) Now the points in the list are sorted according to their position in the…
jlarsch
  • 2,217
  • 4
  • 22
  • 44
43
votes
3 answers

How do I transform a "SciPy sparse matrix" to a "NumPy matrix"?

I am using a python function called "incidence_matrix(G)", which returns the incident matrix of graph. It is from Networkx package. The problem that I am facing is the return type of this function is "Scipy Sparse Matrix". I need to have the…
Mr.Boy
  • 615
  • 1
  • 7
  • 13
42
votes
2 answers

Is there a test suite for numpy / scipy?

I'm about to reinstall numpy and scipy on my Ubuntu Lucid. As these things carry quite a few dependencies, I'm wondering if there is a comprehensive test suite to check if the new install really works. Of course, I can just take a bunch of my…
ev-br
  • 24,968
  • 9
  • 65
  • 78
42
votes
2 answers

Python Scipy FFT wav files

I have a handful of wav files. I'd like to use SciPy FFT to plot the frequency spectrum of these wav files. How would I go about doing this?
user1802143
  • 14,662
  • 17
  • 46
  • 55
42
votes
6 answers

Pythonic way to create a numpy array from a list of numpy arrays

I generate a list of one dimensional numpy arrays in a loop and later convert this list to a 2d numpy array. I would've preallocated a 2d numpy array if i knew the number of items ahead of time, but I don't, therefore I put everything in a list. The…
AnalyticsBuilder
  • 4,111
  • 4
  • 24
  • 36
42
votes
5 answers

Quadratic Program (QP) Solver that only depends on NumPy/SciPy?

I would like students to solve a quadratic program in an assignment without them having to install extra software like cvxopt etc. Is there a python implementation available that only depends on NumPy/SciPy?
flxb
  • 4,235
  • 3
  • 16
  • 11
42
votes
3 answers

Getting standard errors on fitted parameters using the optimize.leastsq method in python

I have a set of data (displacement vs time) which I have fitted to a couple of equations using the optimize.leastsq method. I am now looking to get error values on the fitted parameters. Looking through the documentation the matrix outputted is the…
Phil
  • 581
  • 1
  • 7
  • 11