Adaptive-grid phase diagram calculation and plotting routines
Project description
PhaseDiagram
Adaptive-grid phase diagram calculation and plotting routines
2D phase diagrams
A small piece of code for plotting integer-valued functions over strangely shaped regions.
The general idea:
- Define an initial series of points, and evaluate the phase function at those points.
- Compute the Delaunay triangulation of this grid.
- For every triangle with disagreeing edges, add an extra point in its centre.
- Repeat.
This is defined for both 2D phase digrams, and for 3D unit sphere projections where 3 competing parameters are show normalised, e.g. to an overall energy scale.
##Example usage
import numpy as np
import matplotlib.pyplot as plt
from PhaseDiagram import PhasePlane
def phase(X, Y):
return np.where(X**2 + 4*Y**2 > 1, 1, 0) + np.where(X + Y > 0, 1, 0)
p = PhasePlane(phase, ['A','B','C'], ['x1','x2'])
p.set_initpts(np.linspace(-1.5,1.5,10),np.linspace(-1.5,1.5,10))
p.refine(6)
p.plot()
plt.show()
p.refine()
may be called any number of times. This is particularly useful in e.g. jupyter notebooks or ipython.
More examples are present in te examples
folder, which I will gradually add to.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PhaseDiagram-0.3.2.tar.gz
(18.4 kB
view hashes)
Built Distribution
Close
Hashes for PhaseDiagram-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceb7f99a3df5d8d60ab31bfb7d7d21c9aae727b4e3b6c06e8d92f7e8b0307447 |
|
MD5 | d0e4af663d7b618ac1d983c8e2fd9052 |
|
BLAKE2b-256 | a701ca3664cc8365a56486306c2ae818e2e2e46c408e5edcd6c643ea44a6817f |