This is a package for simulating super Brownian motions.
Project description
Super Brownian Motion Simulation
Introduction
This Python script simulates super Brownian Motion (SBm) in R, a stochastic process where particles move randomly and branch under certain conditions. The script offers functionalities to simulate the motion, plot the paths, export the data, and generate an animation of the process.
- Currently, all paths will update every 100 steps. More flexibility will be added in the future.
- At each 100 steps, each path will branch to two or die with the prescribed probability.
Requirements
- Python 3
- NumPy
- Matplotlib
Installation
Ensure you have Python 3 installed. You can install the required packages using pip:
pip install git+https://github.com/yourusername/mypackage.git
or
pip install simulation-super-brownian-motions
Usage
To run the simulation with default parameters, simply execute the script:
SuperBm --help
Command Line Arguments
You can customize the simulation using the following command line arguments:
-s
or--seed
: Random seed (default: 42), set to-1
for random seed based on current time (for random outcome)-n
or--num-steps
: Number of steps in the simulation (default: 301)-u
or--update-steps
: Number of steps between branching events (default: 100)-p
or--branching-prob
: Probability of branching at each step (default: 0.5)-c
or--scale
: Scale of the Brownian motion (default: 10.0)-d
or--dpi
: DPI parameter for the animation (default: 150)-a
or--save-animation
: Save the animation as a GIF
Example
SuperBm --num-steps 500 --branching-prob 0.7 --scale 15
This command runs the simulation with 500 steps, a branching probability of 0.7, a Brownian motion scale of 15, and with default values for the other parameters. The animation won't be saved as a GIF.
If you want the animation, run the following command:
SuperBm --num-steps 500 --branching-prob 0.7 --scale 15 --save-animation
Output
- The script will plot the paths of the Brownian motion.
- Paths will be exported as a CSV file named
positions_transposed.csv
. - With additional argument
--save-animation
, the script will generate an animation of the process and save it as a GIF file.
Contributing
Contributions to this project are welcome! Please feel free to submit pull requests or open issues to discuss potential improvements or features.
Acknowledgments
Thanks for helpful discussions with Yumin Zhong and Panqiu Xia from Auburn University.
License
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
Built Distribution
Hashes for simulation_super_brownian_motions-1.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c66eb0bfdafa89d52c20d5468802e111684d8f6657c5e593a32160d07af28e0f |
|
MD5 | 8c596f653eea448022eb28b8eb4b7c17 |
|
BLAKE2b-256 | d9a09abbac3990d34c39aa1d999a924de347e0527b12908379c9aa1450b8b150 |
Hashes for simulation_super_brownian_motions-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 808e829891cd5a2f0b1b507056f7febee8e8067197ff530a12c1e07af4ac24b5 |
|
MD5 | 6a67391410bc038ba90042f82dc7c7d4 |
|
BLAKE2b-256 | 60bdd473a683464e59af8d8c01dd2658a7b9732d93597d234c4f971cbf98a91a |