No project description provided
Project description
PyVicsek
This is a Python library used to simulate systems using the Vicsek model. It currently has support for non periodic-boundary conditions, $N$-dimensional space, as well as particle heterogeneity.
Dependencies and Installation
VicsekPy is best run on Python 3.9+ and is supported by numpy, scipy, matplotlib, and tqdm. Additionally, unit tests are made with pytest. These packages are automatically included in requirements.txt.
To download VicsekPy, run the following commands in a UNIX terminal:
pip install pyvicsek
Examples
Here is a basic script to initialize and create a 2-D homogenous Vicsek system.
import vicsek as vs
N = 1024
L = 16
v = 0.03
particles = vs.initialize_random_particles(
n_particles=N,
box_length=L,
speed=v,
n_dimensions=2,
particle_type='standard'
)
vicsek = vs.Vicsek(
particles=particles,
length=L,
interaction_range=1.0,
speed=v,
base_noise=0.5,
)
anim = vicsek.animate(frames=200)
anim.save(filename='example.gif')
Here is another example to initialize a 2-D heterogeneous Vicsek system.
import vicsek as vs
N = 1024
L = 16
v = 0.03
particles_A = vs.initialize_random_particles(
n_particles=round(N * 0.5),
box_length=L,
speed=v,
n_dimensions=2,
particle_type='A'
)
particles_B = vs.initialize_random_particles(
n_particles=round(N * 0.5),
box_length=L,
speed=v,
n_dimensions=2,
particle_type='B'
)
particles = particles_A + particles_B
alignment_weights = {
('A', 'A'): 1.0,
('B', 'B'): 1.0,
('A', 'B'): -1.0,
('B', 'A'): -1.0,
}
noise_weights = {
('A', 'A'): 0.5, # low noise within groups
('B', 'B'): 0.5,
('A', 'B'): 2.0, # high noise between groups
('B', 'A'): 2.0,
}
legend = {
'A': 'red',
'B': 'blue',
}
vicsek = vs.HeterogeneousVicsek(
particles=particles,
length=L,
interaction_range=1.0,
speed=v,
base_noise=0.5,
alignment_weights=alignment_weights,
noise_weights=noise_weights
)
anim = vicsek.animate(frames=200, legend=legend)
anim.save(filename='hetero_example.gif')
You can find more information on the Vicsek class as well as other classes in the doc-strings located in the files of the vicsek directory. You can also find further examples in the scripts directory, where they are organized by system type.
Roadmap
If given more time, we would like to spend some time working on the following things for this library:
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvicsek-0.1.2.tar.gz.
File metadata
- Download URL: pyvicsek-0.1.2.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4e790f7b53958755cc01468729ea28735a1f4a4c48f84846103dd2c04048ba4
|
|
| MD5 |
abff69a8a65d0d28f9645aa6ca0d3549
|
|
| BLAKE2b-256 |
230cd43670ef9877e21f840f5623f55335b5b0bc110d6c3ef7c60ebec0db3ac4
|
File details
Details for the file pyvicsek-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyvicsek-0.1.2-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c36642c96eebc7e929e8cb806d673e4638db40b919ead9e81cb59700c630216d
|
|
| MD5 |
d19712232409e703d0d16a74a26667d5
|
|
| BLAKE2b-256 |
9ef15314016e7852a48c103e28272a48cbc0100758767f3ccb059064e9cc7bc2
|