High-level Scientific Computing: SciPy


Bikash Santra

Indian Statistical Institute, Kolkata


SciPy

Scipy is composed of task-specific sub-modules:

scipy.io - Data input and output
scipy.linalg - Linear algebra routines
scipy.interpolate - Interpolation
scipy.optimize - Optimization
scipy.stats - Statistics

scipy.cluster - Vector quantization / Kmeans
scipy.constants - Physical and mathematical constants
scipy.fftpack - Fourier transform
scipy.integrate - Integration routines
scipy.ndimage - n-dimensional image package
scipy.odr - Orthogonal distance regression
scipy.signal - Signal processing
scipy.sparse - Sparse matrices
scipy.spatial - Spatial data structures and algorithms
scipy.special - Any special mathematical functions

They all depend on numpy, but are mostly independent of each other. The standard way of importing Numpy and these Scipy modules is:
import numpy as np
from scipy import stats

File input/output: scipy.io

Linear algebra operations: scipy.linalg

Determinant of matrices
Matrix inverse
Singular-value decomposition (SVD)

Interpolation: scipy.interpolate

Optimization and fit: scipy.optimize

Curve fitting
Finding the minimum of a smooth function
Finding the roots of a scalar function

Statistics and random numbers: scipy.stats

Statistical Analysis using Python

1) pandas, statsmodels, seaborn: https://www.scipy-lectures.org/packages/statistics/index.html#statistics
2) pyMC (for Baysian statistics): http://pymc-devs.github.io/pymc/tutorial.html

Distributions: histogram and probability density function
Mean, median and percentiles
Comparing 2 sets of samples from Gaussians

References

a) https://docs.scipy.org/doc/scipy/reference/tutorial/index.html
b) https://github.com/kuleshov/cs228-material/blob/master/tutorials/python/cs228-python-tutorial.ipynb
c) https://www.scipy-lectures.org/intro/scipy.html#scipy
d) https://www.scipy-lectures.org/