-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess.py
58 lines (48 loc) · 1.9 KB
/
process.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
This script loads and makes basic analysis of the simulation logs.
Monte-Carlo iterations represent the system 'time' evolution.
Functionality is similar to the accompanying jupyter notebook.
"""
from pathlib import Path
from common import import_log_files
if __name__ == '__main__':
# Set the directory to the log files and
# the min, max Monte Carlo run indexes:
path = Path(__file__).parent.parent.parent / 'examples/example2/'
run_first = 0
run_last = 1
# Import data from the files:
ravg, pat = import_log_files(path, [run_first, run_last])
# 'ravg' contains the averages over [run_first : run_last].
# Fit the time coarse of the number of aggregates present in the
# system and plot the result along with the original data.
# Decreasing exponential function
# $$y(x) = a e^{-x/b} + c$$
# approximates the aggregation progression.
# The initial guess is [a, b, c].
ravg.fit_num_sc([65, 100, 56])
ravg.plot_timedata(
'number of aggregates: runs ' + pat,
ravg.inds, ravg.num_sc['raw'],
ravg.num_sc['pars'],
ravg.num_sc['fit'],
colors=['b--', 'r']
)
# Fit the time coarse for the aggregare masses
# and plot the result along with the original data.
# Growing exponential function
# $$y(x) = a(1 - e^{-x/b}) + c$$
# approximates the progression.
# The initial guess [a, b, c] is supplied for each
# of the 5 mass components.
ravg.fit_masses([[1., 50, 2.],
[0.2, 50, 2.],
[0.15, 50, 0.25],
[0.15, 50, 0.25],
[0.5, 50, 1.]])
ravg.plot_aggregate_mass(pat, with_fit=True)
print('Optimal parameters for the masses:')
for i, p in enumerate(ravg.sc_mean_mass['pars']):
print(f'Component {i} : {p}')
# Plot time evolution of the interparticle connectivity:
ravg.plot_connectivity(pat)