Toolbox for working with Numpy arrays.
Various utilities for computing things with information contained in Numpy arrays.
You can find code and dowloads at the Launchpad page or the PyPI page
Any of the standard incantations works:
- pip gsn_numpy_util
- easy_install gsn_numpy_util
- python setup.py install
- scipy (http://www.scipy.org)
The module name is rather verbose to avoid name clashes since many people out there will have personal modules called numpy_util or something similar. When I use the package I always import it as:
import gsn_numpy_util as nu
All of the symbols defined in numpy_util are imported into the gsn_numpy_util module, so these symbols are accessible via:
>>> import gsn_numpy_util as nu >>> nu.y(2,1,pi/2, 3*pi/2)
- real and complex spherical harmonics (y, ry)
- functions to remove inf and nan from arrays (all_good, good_data, clipOdd)
- fortran unformatted i/o (write_fortran, read_fortran, read_fortran_inplace, skip_fortran)
- Making coordinate grids (grid_nd, make_grid)
- Binning particle positions in N dimensions (image, flattenMap, unflattenMap, histo, histo2d, partition)
- Elaborations of Fourier transforms–sin transform, cosine transform, etc. (power_spectrum, sine_transform, cosine_transform, fst, ifst, fct, ifct transform_n, fstn, ifstn, fctn, ifctn, trig_freq, rdct, irdct, rdst, irdst, dct, idct, dst, idst rdstfreq, rdctfreq)
- Poisson solver using various FFT-based methods (poisson, poisson_fft, poisson_fst, poisson_fct, big_poisson, big_poisson_fft, big_poisson_fst, big_poisson_fct)
- An implementation of large, disk-based arrays (BigArray) along with transformations on those arrays (e.g. big_fftn)
- Properties of time-series information crossing a threshold (seq_transitions, seq_transitions_idx, seq_length, seq_length_above, seq_length_below)
- Averaging and rebinning arrays (rebin, ave, lave)
- vector calculus, (div, grad, curl, laplacian)
- bit and boolean arrays (boolmat, bitmat, boolarr, bitarr)
- Random deviates (randp, randlog)
- coordinate systems and transformations (cartesian, spherical, graham_schmidt)
- Weighted mean, standard deviation, geometric mean, etc (weighted_mean, weighted_std, geometric_mean, rms)
- Getting unique values and determining set membership with arrays. Note that numpy has a setmember1d function, but years ago it got confused with when there were duplicate elements in the array. (unique1d, setmember1d)
Calculate properties of particle distributions.
>>> import gsn_numpy_util as nu >>> nu.particles.ellipticity(rs, ms)
- basic transformations: rotations, affine transforms, etc.
- basic vector operations: magnitude, inner product, etc.
- properties of particle distributions: center of mass, angular momentum
- shape of particle distributions calculated by diagonalizing moment of inertia tensor
- shape of particle distributions by minimizing dipole and quadrupole moments of distribution
- Calculation of higher order (octupole, etc) Fourier coefficients
- mass profile, density profile, velocity dispersion profile
- find center of particle dist by various algorithms
- implementations of friend-of-friends (transitive closure) algorithms
- find particle groups via bound-density-maximum algorithm from Anatoly Klypin
- Coordinate transformations spherical, cylindrical,
- binning particles into grids in N dimensions
Simple implementation of graphs and functions to compute a few properties.
>>> import gsn_numpy_util as nu >>> nu.graph.dfs(graph)
- Graph class
- Equivalence class class
- Several implementations of transitive closure
- breadth first search, depth first search
To run the tests:
python -m unittest gsn_numpy_util.test.test_numpy_util
python -m unittest gsn_numpy_util.test.test_particles
python -m unittest gsn_numpy_util.test.test_graph
The code is released under the MIT license, so you should be able to do whatever you want with it.
If you incorporate this code into a larger project, I would appreciate it if you send me a note at email@example.com
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size gsn_numpy_util-0.1.0.tar.gz (56.2 kB)||File type Source||Python version None||Upload date||Hashes View|