-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataset.jl
84 lines (73 loc) · 1.59 KB
/
dataset.jl
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
gas = CreateSolution("./mechanism/JP10skeletal_core.yaml")
const MW = gas.MW
varnames = [
"C10H16",
"H",
"H2",
"CH3",
"CH4",
"aC3H5",
"C2H4",
"C3H6",
"C5H6",
"C6H6",
"C6H5CH3",
"OH",
"HO2",
"H2O2",
"O",
"O2",
"H2O",
];
varnames_obs = [
"C10H16",
"H",
"H2",
"CH3",
"CH4",
"aC3H5",
"C2H4",
"C3H6",
"C5H6",
"C6H6",
"C6H5CH3",
"OH",
"HO2",
"H2O2",
"O",
"O2",
"H2O",
]
ind_crnn = []
for var in varnames
push!(ind_crnn, species_index(gas, var))
end
ind_obs = []
for var in varnames_obs
push!(ind_obs, species_index(gas, var))
end
ind_N2 = species_index(gas, "N2")
ns = length(ind_obs);
E_ = gas.ele_matrix[:, ind_crnn];
E_null = nullspace(E_)';
nse = size(E_null)[1];
yall = zeros(n_exp, ns + 3, ntotal);
for i_exp = 1:n_exp
rawdata = readdlm("data/data_$i_exp")'
ts = rawdata[1, :]
tend = ts[end]
_ts = 10 .^ range(log10(tend / 1e4), log10(tend / 1.01), length = ntotal)
_ts[1] = 0.0
_ylabel = zeros(ns + 2, ntotal)
for i = 1:ns+2
itp = LinearInterpolation(ts, rawdata[i+1, :])
ode_data = itp.(_ts)
_ylabel[i, :] .= clamp.(ode_data .+
randn(size(ode_data)) .* ode_data .* noise, 0, Inf)
end
yall[i_exp, 1, :] .= _ts
yall[i_exp, 2:end, :] .= _ylabel
end
yalls = yall[:, 4:end, :];
# yscale = (maximum(yalls, dims=[1, 3]) - minimum(yalls, dims=[1, 3]) .+ lb)[1, :, 1];
println("include ", @__FILE__)