comb-model: A package to simulate Fractional Brownian walks on a comb-like structure.
This package simulate trajectories of the comb model via Langevin equations driven by fractional Gaussian noises (long-range correlated).
If you have used comb-model in a scientific publication, we would appreciate citations to the following reference 1:
Haroldo V. Ribeiro, Angel A. Tateishi, Luiz G. A. Alves, Rafael S. Zola, Ervin K Lenzi (2014). Investigating the interplay between mechanisms of anomalous diffusion via fractional Brownian walks on a comb-like structure. New Journal of Physics 16, 093050
For more detailed information about the functions implemented in comb-model, please
consult its documentation.
Installation
The comb-model package is available on pypi and can be installed using pip
pip install comb-model
Dependencies
numpystochastictdqm
Processes
This package offers functions to simulate Fractional Brownian walks on a plane or Comb-like structures via via Langevin equations.
# Fractional Brownian walks on a plane
import matplotlib.pyplot as plt
from combmodel import langevin_fbn
x,y=langevin_fbn(x0=0,y0=0,betax=1,betay=1,hurstx=0.5,hursty=0.5,tmax=1000,disable_tqdm=True)
f, ax = plt.subplots(nrows=1, ncols=1, figsize=(9.1,7))
ax.plot(x,y,color='#D62728',markersize=0,linewidth=2)
ax.set_xlabel(r'Position, $x(t)$')
ax.set_ylabel(r'Position, $y(t)$')
# Fractional Brownian walks on a Comb-like structure
import matplotlib.pyplot as plt
from combmodel import comb_model
x, y = comb_model(x0=0,y0=0,betax=1,betay=1,hurstx=0.5,hursty=0.5,tmax=5000,eps=1,disable_tqdm=True)
f, ax = plt.subplots(nrows=1, ncols=1, figsize=(9.1,7))
ax.plot(x,y,color='#D62728',markersize=0,linewidth=2)
ax.set_xlabel(r'Position, $x(t)$')
ax.set_ylabel(r'Position, $y(t)$')
List of functions
- combmodel.generate_noise(hurstx, hursty, tmax)
Generate sequences of fractional Gaussian noise.
- hurstx: float
Hurst exponent in the x-direction. Vales must be in the range (0,1).
- hursty: float
Hurst exponent in the y-direction. Vales must be in the range (0,1).
- tmax: int
Maximum number of time-step simulated.
- noisex: np.array
Simulated noise in the x-axis.
- noisey: np.array
Simulated noise in the y-axis.
>>> from combmodel import generate_noise >>> generate_noise(hurstx=0.5,hursty=0.5,tmax=5) (array([ 0.25768888, 0.26578568, -0.5264168 , -0.22897338, 1.5653223 ]), array([ 0.07702825, -0.76531544, 1.30514932, -1.88840645, 0.12964754]))
>>> from combmodel import generate_noise >>> generate_noise(hurstx=0.05,hursty=0.99,tmax=5) (array([ 0.86985584, -0.06461844, -1.14352549, -0.58317815, -1.46406803]), array([-1.70277230e-01, -3.01093568e-01, -3.67460604e-01, 2.79234304e-04,-1.12502245e-01]))
- combmodel.langevin_fbn(x0, y0, betax, betay, hurstx, hursty, tmax, disable_tqdm=False)
Compute fractional Brownian motion trajectory.
- x0: float
Initial position in the x-axis.
- y0: float
Initial position in the y-axis.
- betax: float
Constant related to diffusion coefficient in the x-direction.
- betay: float
Constant related to diffusion coefficient in the y-direction.
- hurstx: float
Hurst exponent in the x-direction. Vales must be in the range (0,1).
- hursty: float
Hurst exponent in the y-direction. Vales must be in the range (0,1).
- tmax: int
Maximum number of time-step simulated.
- disable_tqdm: boolean
If False, shows progressbar. If True disable progressbar.
- x: np.array
Simulated positions in the x-axis.
- y: np.array
Simulated positions in the y-axis.
>>> from combmodel import langevin_fbn >>> langevin_fbn(x0=0,y0=0,betax=1,betay=1,hurstx=0.5,hursty=0.5,tmax=10,disable_tqdm=False) 100%|███████████████████████████████████████████████████████████████| 9/9 [00:00<00:00, 219469.40it/s] (array([ 0. , 0.31802743, -0.83832619, -0.27312321, 0.04191725, 0.23666782, -1.75041569, -0.14763177, -0.50695669, 0.152747 ]), array([ 0. , -1.33455269, -0.76376196, 0.10190015, 0.54170037, 1.03303179, -0.310934 , 0.92504652, 1.77317527, 0.68204445]))
>>> from combmodel import langevin_fbn >>> langevin_fbn(x0=0,y0=0,betax=1,betay=1,hurstx=0.05,hursty=0.95,tmax=10,disable_tqdm=True) (array([ 0. , -1.06714954, -2.42275827, -2.15268094, -1.94348332, -2.83243755, -3.12425033, -3.72050659, -2.4537888 , -1.05256446]), array([ 0. , -1.65366648, -3.24551102, -2.65525154, -3.31656122, -2.50457923, -2.05895687, -0.73025872, -0.64509908, -0.09122725])))
- combmodel.comb_model(x0, y0, betax, betay, hurstx, hursty, tmax, eps, disable_tqdm=False)
Compute Comb-model trajectory using fractional Brownian noise.
- x0: float
Initial position in the x-axis.
- y0: float
Initial position in the y-axis.
- betax: float
Constant related to diffusion coefficient in the x-direction.
- betay: float
Constant related to diffusion coefficient in the y-direction.
- hurstx: float
Hurst exponent in the x-direction. Vales must be in the range (0,1).
- hursty: float
Hurst exponent in the y-direction. Vales must be in the range (0,1).
- tmax: int
Maximum number of time-step simulated.
- eps: float
Width of band where movement in the x-direction is allowed.
- disable_tqdm: boolean
If False, shows progressbar. If True disable progressbar.
- x: np.array
Simulated positions in the x-axis.
- y: np.array
Simulated positions in the y-axis.
>>> from combmodel import comb_model >>> comb_model(x0=0,y0=0,betax=0.1,betay=0.1,hurstx=0.5,hursty=0.5,tmax=10,eps=0.1,disable_tqdm=False) 100%|███████████████████████████████████████████████████████████████| 9/9 [00:00<00:00, 142987.64it/s] (array([ 0. , 0.06893574, -0.18618081, -0.16402136, -0.08273242, -0.10966074, -0.10966074, -0.08535346, -0.05060382, 0.03196749]), array([ 0. , -0.07952973, -0.0537798 , -0.02380105, 0.0382455 , 0.10637735, -0.05516008, 0.02736965, 0.04563519, 0.16306934]))
>>> from combmodel import comb_model >>> comb_model(x0=0,y0=0,betax=1,betay=1,hurstx=0.5,hursty=0.99,tmax=10,eps=1,disable_tqdm=True) (array([ 0. , -1.68859052, -1.77776905, -2.71815718, -2.35059768, -2.35059768, -2.35059768, -2.35059768, -2.35059768, -2.35059768]), array([ 0. , -0.59174592, -0.69523766, 0.30401518, 1.20541352, 2.86754674, 3.40154263, 3.12629311, 2.44392253, 0.86665015]))
References
- 1
Haroldo V. Ribeiro, Angel A. Tateishi, Luiz G. A. Alves, Rafael S. Zola, Ervin K Lenzi (2014). Investigating the interplay between mechanisms of anomalous diffusion via fractional Brownian walks on a comb-like structure. New Journal of Physics 16, 093050