Generates site percolation data and illustrations.
Project description
pycolate :coffee:
A python implementation of site percolation, generates datasets and illustrations.
Aims.
This project primarily generates datasets and illustrations from square lattice site percolation. There is an auxillary program which carries out critical probability estimation using coarse graining with possible interactions.
How to.
- Install the latest version of pycolate:
pip install pycolate
2.Import pycolate into your python file:
import pycolate
Creating illustrations.
The pycolate.Percolation
class is used for creating a single instance of percolation. It takes the following arguments:
Perc = Percolation(width, height, occupation probability)
We display the illustration in a window as so:
...
Perc.display()
To save the illsutration we run:
...
Perc.save()
So to generate an illustration of a 50x50 grid where each square has a 0.6 chance of being occupied:
import pycolate
perc = pycolate.Percolation(50,50,0.6)
perc.display()
perc.save('PATH')
The default size for a square is 10 by 10 pixels. To adjust this one can change the Percolation.site_size
prior to running Percolation.display()
.
If we were running a large simulation we may want the sites to only be 1 pixel each, so we would run the following:
import pycolate
perc = pycolate.Percolation(1000,1000,0.6)
perc.site_site = 1
perc.display()
perc.save('PATH')
Running experiments.
One may not be interested in illustrations and just want numeric data. We can compute many different properties by running the Percolation.cluster_find()
method. One should note that Percolation.display()
also runs this method behind the scenes. Once this has been run there are many properties one can ask for:
Properties of the Percolation class.
Property | Explanation |
---|---|
mean_cluster_size | The mean cluster size, excluding the percolating cluster. |
sizes | A list of all the cluster sizes, excluding the percolating cluster. |
percolated_size | The size of the percolating cluster. |
percolated | A boolean. True if a percolating cluster formed. False if not |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for pycolate-0.0.32-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ee78c53543578d6db6456e84c1941a8940093a93449da73add538cb3fbf637c |
|
MD5 | f4677344add7bc8b8cedf3f101a44780 |
|
BLAKE2b-256 | 064c91534140aae23f20314d95c65ec49c0bd0accbb99e7762b2d1c81fc37b7b |