forked from PMEAL/pytrax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrey.py
32 lines (29 loc) · 822 Bytes
/
grey.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 8 17:07:13 2019
@author: Tom
"""
import porespy as ps
import pytrax as pt
import numpy as np
import matplotlib.pyplot as plt
import scipy.ndimage as spim
if __name__ == '__main__':
im = ps.generators.blobs(shape=[200, 200], porosity=0.5).astype(int)
plt.figure()
plt.imshow(im)
dt = spim.distance_transform_edt(im)
grey = dt.copy()/dt.max()
# Number of time steps and walkers
num_t = 100000
num_w = None
stride = 10
for case in [im]:
rw = pt.RandomWalk(case, seed=False)
rw.run(num_t, num_w, same_start=False, stride=stride, num_proc=10)
# Plot mean square displacement
rw.plot_msd()
# rw.plot_walk_2d()
rw.colour_sq_disp()
plt.figure()
plt.imshow(rw.im_sq_disp)