Eigenvalue unfolding and spectral observable computation
Project description
Table of Contents
Introduction
A python library for investigating some of the basic / classical elements of Random Matrix Theory, including eigenvalue unfolding and computation and plotting of spectral observables.
Motivation
TODO.
Notes on Development
This libary is still undergoing major re-writes and development, and should be considered in pre-alpha at this point. Feel free to post issues or ask questions relating to the code, but keep in mind any bugs and/or issues are very likely to change in the near future.
Installation
As always, using a virtual environment is recommended for proper use.
However, you should be okay doing a global pip install empyricalRMT
to try out the library.
Using venv
(recommended)
Navigate to the project that you wish to use empyricalRMT in.
cd MyProject
Create and active the virtual environment. Replace "env" with whatever name you prefer.
python -m venv env && source env/bin/activate
pip
pip install empyricalRMT
Note that this will install the library "globally" if you haven't activated a virtual environment of some kind.
From source / repository
git clone https://github.com/stfxecutables/empyricalRMT
cd empyricalRMT
pip install -e .
Windows
The above should still all work on Windows, although you may have to follow modified instructions for setting up the venv.
If you run into issues specific to this library that you think might be Windows-related, please do report them, but keep in mind I currently can only test on Windows via virtual machine :(
Basic Usage
import empyricalRMT.observables.unfold as unfold
import empyricalRMT.plot as plot
from empyricalRMT.observables.levelvariance import level_number_variance
from empyricalRMT.observables.rigidty import spectralRigidity
from empyricalRMT.construct import generateGOEMatrix, generate_eigs
# generate a new matrix from the Gaussian Orthogonal Ensemble and extract
# its eigenvalues
eigs = generate_eigs(matsize=1000, kind="goe")
# eigs = generate_eigs(matsize=1000, kind="gue")
# eigs = generate_eigs(matsize=1000, kind="poisson")
# plot the eigenvalue distribution to confirm Wigner's Semicircle law
plot.rawEigDist(eigs, bins=100, title="Wigner Semicircle", block=True)
# plot the eigenvalue step function
plot.stepFunction(eigs, trim=False, block=True)
# plot the normalized spacings to inspect the Nearest Neighbors Spacing
# Distribution (NNSD) and compare it to those predicted by classical RMT
plot.spacings(eigs=eigs, kind="goe")
# unfold the spectrum with a polynomial fit
unfolded = unfold.polynomial(eigs, degree=11)
# Compute the spectral rigidity of the resultant unfolding
L, delta3 = spectralRigidity(unfolded, eigs, c_iters=200, L_grid_size=100, min_L=0.5, max_L=25)
# Plot the resultant values
df = pd.DataFrame({"L": L, "∆3(L)": delta3})
plot.spectralRigidity(unfolded, df, title="GOE Matrix Spectral Rigidity", mode="block")
# Compute the number level variance
L, sigma_sq = level_number_variance(eigs, unfolded, c_iters=1000, L_grid_size=100, min_L=0.5, max_L=20)
# Plot the resultant values
df = pd.DataFrame({"L": L_grid, "∑²(L)": sigma_sq})
plot.levelNumberVariance(unfolded, df, title=f"{kind.upper()} Matrix", mode="block")
Documentation
Be sure to read the documentation comments in the source code.
API Overview
Eigenvalues
- .trim()
Trimmed
- etc.
Development
Installation
Assuming you want your venv
virtual environment to be named "env":
git clone https://github.com/stfxecutables/empyricalRMT
cd empyricalRMT
python -m venv env
source env/bin/activate
python -m pip install -r requirements-dev.txt
pip install -e . # to make editable
Testing
To run all tests, run:
python -m pytest -v
There are a number of pytest marks labelling different testing aspects.
Brief descriptions can be found in pytest.ini
. However, likely most useful
will be running:
python -m pytest -v -m fast
which runs all tests that shouldn't take too long to execute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for empyricalRMT-0.2.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ab2c0ae4aa2e6bbfbc8bf9cea5ce551f5a44ef3ea1464cd9eef54b9e02e290f |
|
MD5 | ed589679e12088769e06a63f1adc5ab0 |
|
BLAKE2b-256 | 470731f067fb9ea89bf307a9983a5555c3ff719247c0b7bde5427480b628e48d |