Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit e12d866

Browse files
authored
Merge pull request #92 from yuehhua/burger_visualization
Reformat code
2 parents 9695c35 + 2e57a33 commit e12d866

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

example/Burgers/notebook/mno.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ dataset = Burgers.get_data(n = 1000);
88
m = Burgers.get_model();
99
input_data, ground_truth = dataset[1], dataset[2];
1010

11-
1211
i = 1
13-
plot(input_data[1,:,1],ground_truth[1, :, i], label = "ground_truth",title = " Burgers equation u(x,T_end)");
14-
p1 = plot!(input_data[1,:,1],m(view(input_data, :, :, i:i))[1, :, 1],label = "predict");
15-
plot(input_data[1,:,1],ground_truth[1, :, i + 1],label = "ground_truth");
16-
p2 = plot!(input_data[1,:,1],m(view(input_data, :, :, (i + 1):(i + 1)))[1, :, 1],label = "predict");
17-
i = 3
12+
plot(input_data[1, :, 1], ground_truth[1, :, i], label = "ground_truth",
13+
title = " Burgers equation u(x,T_end)");
14+
p1 = plot!(input_data[1, :, 1], m(view(input_data, :, :, i:i))[1, :, 1], label = "predict");
1815

19-
plot(input_data[1,:,1],ground_truth[1, :, i], label = "ground_truth");
20-
p3 = plot!(input_data[1,:,1],m(view(input_data, :, :, i:i))[1, :, 1],label = "predict");
21-
plot(input_data[1,:,1],ground_truth[1, :, i + 1], label = "ground_truth");
22-
p4 = plot!(input_data[1,:,1],m(view(input_data, :, :, (i + 1):(i + 1)))[1, :, 1], label = "predict");
23-
p = plot(p1, p2, p3, p4)
16+
plot(input_data[1, :, 1], ground_truth[1, :, i + 1], label = "ground_truth");
17+
p2 = plot!(input_data[1, :, 1], m(view(input_data, :, :, (i + 1):(i + 1)))[1, :, 1],
18+
label = "predict");
19+
i = 3
2420

21+
plot(input_data[1, :, 1], ground_truth[1, :, i], label = "ground_truth");
22+
p3 = plot!(input_data[1, :, 1], m(view(input_data, :, :, i:i))[1, :, 1], label = "predict");
2523

24+
plot(input_data[1, :, 1], ground_truth[1, :, i + 1], label = "ground_truth");
25+
p4 = plot!(input_data[1, :, 1], m(view(input_data, :, :, (i + 1):(i + 1)))[1, :, 1],
26+
label = "predict");
27+
p = plot(p1, p2, p3, p4)

example/Burgers/src/Burgers.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ function register_burgers()
1919
2020
* `a`: initial conditions u(x,0)
2121
* `u`: solutions u(x,t_end)
22-
""",
23-
24-
"http://www.med.cgu.edu.tw/NeuralOperators/Burgers_R10.zip",
22+
""", "http://www.med.cgu.edu.tw/NeuralOperators/Burgers_R10.zip",
2523
"9cbbe5070556c777b1ba3bacd49da5c36ea8ed138ba51b6ee76a24b971066ecd",
2624
post_fetch_method = unpack))
2725
end
@@ -114,7 +112,6 @@ function train_nomad(; n = 300, cuda = true, learning_rate = 0.001, epochs = 400
114112
return mean_diff
115113
end
116114

117-
118115
function get_model()
119116
model_path = joinpath(@__DIR__, "../model/")
120117
model_file = readdir(model_path)[end]

0 commit comments

Comments
 (0)