Skip to content

Commit

Permalink
Reducing image size in documentation via DisplayAs package.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuellujan committed Jun 14, 2024
1 parent 4e52ecc commit e4dd992
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Determinantal = "2673d5e8-682c-11e9-2dfd-471b09c6c819"
DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
Expand Down
1 change: 1 addition & 0 deletions examples/ACE-aHfO2/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
9 changes: 5 additions & 4 deletions examples/ACE-aHfO2/fit-ace-aHfO2.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AtomsBase, InteratomicPotentials, PotentialLearning
using Unitful, UnitfulAtomic
using LinearAlgebra, Random
using DisplayAs

path = joinpath(dirname(pathof(PotentialLearning)), "../examples/ACE-aHfO2")

Expand Down Expand Up @@ -110,13 +111,13 @@ test_metrics
e_plot = plot_energy(e_train, e_train_pred,
e_test, e_test_pred)
@save_fig path e_plot
e_plot
DisplayAs.PNG(e_plot)

# Plot and save force results
f_plot = plot_forces(f_train, f_train_pred,
f_test, f_test_pred)
@save_fig path f_plot
f_plot
DisplayAs.PNG(f_plot)

# Plot and save training force cosine
e_train_plot = plot_energy(e_train, e_train_pred)
Expand All @@ -125,7 +126,7 @@ f_train_cos = plot_cos(f_train, f_train_pred)
@save_fig path e_train_plot
@save_fig path f_train_plot
@save_fig path f_train_cos
f_train_cos
DisplayAs.PNG(f_train_cos)

# Plot and save test force cosine
e_test_plot = plot_energy(e_test, e_test_pred)
Expand All @@ -134,5 +135,5 @@ f_test_cos = plot_cos(f_test, f_test_pred)
@save_fig path e_test_plot
@save_fig path f_test_plot
@save_fig path f_test_cos
f_test_cos
DisplayAs.PNG(f_test_cos)

2 changes: 1 addition & 1 deletion examples/DPP-ACE-Na/fit-dpp-ace-na.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ println("MAE: $e_mae, RMSE: $e_rmse, RSQ: $e_rsq")
# Plot energy error scatter
e_err_train, e_err_test = (e_train_pred - e_train), (e_test_pred - e_test)
dpp_inds2 = get_random_subset(dpp; batch_size = 20)
scatter( e_train, e_err_train, label = "Training", color = :blue,
p = scatter( e_train, e_err_train, label = "Training", color = :blue,
markersize = 1.5, markerstrokewidth=0)
scatter!(e_test, e_err_test, label = "Test", color = :yellow,
markersize = 1.5, markerstrokewidth=0)
Expand Down
1 change: 1 addition & 0 deletions examples/LJ-Ar/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
AtomsBase = "a963bdd2-2df7-4f54-a1ee-49d51e6be12a"
DisplayAs = "0b91fe84-8a4c-11e9-3e1d-67c38462b6d6"
InteratomicPotentials = "a9efe35a-c65d-452d-b8a8-82646cd5cb04"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Expand Down
14 changes: 7 additions & 7 deletions examples/LJ-Ar/lennard-jones-ar.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Unitful, UnitfulAtomic
using AtomsBase, InteratomicPotentials, PotentialLearning
using LinearAlgebra, Plots
using LinearAlgebra, Plots, DisplayAs

# Load dataset: Lennard-Jones + Argon
path = joinpath(dirname(pathof(PotentialLearning)), "../examples/LJ-Ar")
Expand All @@ -24,11 +24,11 @@ p = plot(xlabel = "τ | ps",
for i = 1:n_atoms
plot!(time_range, map(x->x[i], dists_origin), label="")
end
p
DisplayAs.PNG(p)

# Plot LJ energies vs time
plot(time_range, energies,
xlabel = "τ | ps",
ylabel = "Lennard Jones energy | eV",
dpi = 300, fontsize = 12)

p = plot(time_range, energies,
xlabel = "τ | ps",
ylabel = "Lennard Jones energy | eV",
dpi = 300, fontsize = 12)
DisplayAs.PNG(p)

0 comments on commit e4dd992

Please sign in to comment.