Skip to main content

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:

  1. Define an initial series of points, and evaluate the phase function at those points.
  2. Compute the Delaunay triangulation of this grid.
  3. For every triangle with disagreeing edges, add an extra point in its centre.
  4. Repeat.

This is defined for both 2D phase digrams, and for 3D unit sphere projections where 3 competing parameters are normalised, e.g. to an overall energy scale.

Baisc usage (phaseplane)

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.3.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

PhaseDiagram-0.3.3-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file PhaseDiagram-0.3.3.tar.gz.

File metadata

  • Download URL: PhaseDiagram-0.3.3.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for PhaseDiagram-0.3.3.tar.gz
Algorithm Hash digest
SHA256 4605681db061ea2139eb490e0fb5323704d7bcde57ac24b033935d6d8b737d11
MD5 ea487b02b384536268ffd5c460e048c6
BLAKE2b-256 1f0a6a3126b8390d9431b2e4daad91317689e48c64f7cb13f750ac7eebc62a98

See more details on using hashes here.

File details

Details for the file PhaseDiagram-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: PhaseDiagram-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6

File hashes

Hashes for PhaseDiagram-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4447fae63c0917f4c263c5072ff80d2811277e40a48c079dcc28355bfe7f2870
MD5 a0d420c1c1c119bda47ce1faefef6f10
BLAKE2b-256 88609fe477f2a8ecbbe19c8c9baeb65d4c15adcc23d380110ffa646eedb6563a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page