What is Numpy: Definition and 15 Discussions

NumPy (pronounced (NUM-py) or sometimes (NUM-pee)) is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. The ancestor of NumPy, Numeric, was originally created by Jim Hugunin with contributions from several other developers. In 2005, Travis Oliphant created NumPy by incorporating features of the competing Numarray into Numeric, with extensive modifications. NumPy is open-source software and has many contributors.

View More On Wikipedia.org
  1. ergospherical

    How to store a large data-set in a "grid" in Python/NumPy

    Say I have n parameters X1, X2, ..., Xn, and to each "grid-point" X = (X1, X2, ..., Xn) I want to associate a value f(X). So in the end I will have a structure like an n-dimensional matrix. Assume this data-set is going to be very large, i.e. each parameter Xi ranges over hundreds or thousands...
  2. F

    Why are new dimensions added to the left in numpy arrays?

    Hello, I am clear on 1D and 2D Numpy arrays, how to create them and address them). 1D array: single list 2D array: list containing multiple lists as elements 3D array: list containing lists which contain lists as elements Array elements can be address using indices as a[], a[][], a[][][]...
  3. S

    Python 4D array with elements only on one side of the diagonal

    Given the parameters ##n## and ##m##, I'd like to initialize a ##n \times n ## 4D array where each entry is an ##m \times m ## matrix, and where each column of the matrix is an array of type numpy.linspace(0,1,m). Furthermore, I'd only like to have entries on the diagonal and above it, or only...
  4. V

    Comp Sci Optimizing Numpy Arrays for Efficient Data Manipulation

    I feel like I have over complicated this question but here is the code I wrote out for it, I wrote it as a function but when I printed my values I realized I did not need a function to do so. So would I just use my second code to answer the question. import numpy as np def array_zero(n)...
  5. N

    Numpy multidimensional array assigment unknown logic error

    I'm confused as to why this bubble sort I'm implementing is setting _all_ items to one of the items (I have no idea which one as array is too big) the data type is of ... [[1128 1026 1192 1023]] [[ 771 195 858 196]] [[ 953 1799 955 1738]]] when I have an array of int, this same algorithm...
  6. Abimbola1987

    MATLAB How can attenuation be removed using SCIPY or MATLAB?

    Dear Sirs, I have a signal which has an attenuation of 20dB per decade, how do I remove this attenuation using SCIPY? Alternatively how to do it in MATLAB if there are no SCIPY users here? I'm a SCIPY/MATLAB novice fyg. Thank you for your kind assistance Abim
  7. K

    Perform an image deconvolution using FFTs and Python

    Homework Statement [/B] This problem is from Mark Newman's Computational Physics, problem 7.9, found at http://www-personal.umich.edu/~mejn/cp/exercises.html. The problem gives us a blurry convolved image, according to a Gaussian point spread function and our objective is to deconvolve it to...
  8. X

    Numpy correlate, Monte Carlo

    I'm creating a Monte Carlo simulation of the 2D Ising Model for a graduate course in computational materials science. Part of the assignment is to calculate the uncertainty in the calculation of the average magnetization per spin. To do so, we are told to find the correlation time for our data...
  9. Avatrin

    Python How to Import and Manipulate Data from a Text File in Python?

    Hi Lets say I have a txt file with m rows with n columns of numbers of the form: Lets say I want to take every p'th row and take the second and third columns and turn it into a \frac{m}{p}\times 2 matrix. How would I go about doing that?
  10. P

    Spatial Filtering 2d numpy array with a 3x3 mask

    I have large 2d matrices from dicom files that i wish to filter with a 3x3 mask. the image arrays are of varying size and are padded with one border of zeros for the edge handling of the mask. i need to iterate over every element in the array and multiply it by the mask. I've done it in SciLab...
  11. D

    [Python] Importing csv files and creating numpy arrays

    So I am fairly new to Python and feel somewhat comfortable with it. I am trying to do something what I think seems kind of simple however am not too experienced with loading files into Python (or any programming language for that matter). What I am trying to do is I have csv files that contain...
  12. F

    PDF of multimodal circular data

    Hi, I have a data vector that consists of directions measured in an experiment. I wish to create a probability density function. As the data is circular and multimodal I use a kernel density estimate with von Mises distribution (essentially a Gaussian on the unit circle) as the basis function. I...
  13. M

    Interpolation and linear algebra

    Homework Statement As a string in my program. Homework Equations Solving a system with the forward phase of row echelon reduction and a consecutive back substitution. All done by numpy here. (The book suggested MATLAB, etc). The Attempt at a Solution import numpy """ In a wind tunnel...
  14. C

    Exploring Chaotic Billiards: A Simulation and Analysis

    What am I trying to do? I'm trying to implement a simulation of a chaotic billiard system, following the algorithm in this excerpt. How am I trying it? Using numpy and matplotlib, I implemented the following code What is the problem? When calculating phi_new, the equation has two solutions...
  15. T

    Python (Numpy) Non-Elementwise Array Operations

    Python (numpy) question: I have two 2D numpy arrays, A[i,j] and B[k,l], but the indexes are unrelated to each other (A and B won't even have the same dimensions in general). I want to be able to add/multiply these two together to get a 4D matrix: C[i,j,k,l] = A[i,j] + B[k,l] or C[i,j,k,l] =...