1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-09-17 18:51:17 +00:00

Add snapshot plot documentation

This commit is contained in:
Mo8it 2022-02-08 22:18:44 +01:00
parent edd47999b3
commit 792fe7b437
3 changed files with 32 additions and 7 deletions

View file

@ -85,13 +85,20 @@ To generate an animation of a simulation, run the following:
animate(sim_dir)
----
The method's documentation includes all possible optional arguments.
The method's documentation includes all possible optional arguments and where the output can be found.
=== Snapshot plot
//TODO
To plot only one snapshot of a simulation, run the following:
== Run reinforcement learning
[source,julia]
----
plot_snapshot(sim_dir)
----
This will ask for the number of the snapshot to plot out of the total number of snapshots. The method's documentation includes all possible optional arguments and where the output can be found.
== Run reinforcement learning process
Run a reinforcement learning process and return the environment helper and the the path of the process directory relative to the directory `ReCo.jl`:
[source,julia]

View file

@ -156,11 +156,12 @@ Animate a simulation.
The output is `sim_dir/animation.mkv`.
# Arguments
- `sim_dir::String`: Simulation directory.
- `framerate::Int64=$DEFAULT_FRAMERATE`: Framerate
- `show_center_of_mass::Bool=$DEFAULT_SHOW_CENTER_OF_MASS`: Show center of mass as transparent white circle.
- `show_center_of_mass::Bool=$DEFAULT_SHOW_CENTER_OF_MASS`: Show the center of mass as transparent white circle.
- `show_interaction_circle::Bool=$DEFAULT_SHOW_INTERACTION_CIRCLE`: Show the interaction radius with a circle around every particle.
- `show_skin_circle::Bool=$DEFAULT_SHOW_SKIN_CIRCLE`: Show the skin radius with a circle around every particle.
- `show_frame_diff::Bool=$DEFAULT_SHOW_FRAME_DIFF`: Show translation of particles between two frames as lines connecting the old and new position. This is helpful to recognize unwanted jumps.
- `show_frame_diff::Bool=$DEFAULT_SHOW_FRAME_DIFF`: Show the translation of particles between two frames as lines connecting the old and new position. This is helpful to recognize unwanted jumps.
- `show_progress::Bool=$DEFAULT_SHOW_PROGRESS`: Show animation progress bar.
"""
function animate(

View file

@ -11,6 +11,9 @@ using ..ReCo: ReCo
include("common.jl")
include("common_CairoMakie.jl")
const DEFAULT_SHOW_CENTER_OF_MASS = false
const DEFAULT_SHOW_KAPPA = true
function get_wanted_snapshot_number(total_n_snapshots::Int64)
print("There are $total_n_snapshots snapshots. Enter the wanted snapshot number: ")
answer = readline()
@ -20,8 +23,22 @@ function get_wanted_snapshot_number(total_n_snapshots::Int64)
return snapshot
end
"""
plot_snapshot(sim_dir::String; <keyword arguments>)
Plot one snapshot of a simulation.
The method will ask for the number of the snapshot to plot out of the total number of snapshots. The output is `sim_dir/graphics/N.pdf` with `N` as the number of the chosen snapshot.
# Arguments
- `sim_dir::String`: Simulation directory.
- `show_center_of_mass::Bool=$DEFAULT_SHOW_CENTER_OF_MASS`: Show the center of mass as a transparent black circle.
- `show_κ::Bool=$DEFAULT_SHOW_KAPPA`: Show κ as the ratio of the eigenvalues of the gyration tensor.
"""
function plot_snapshot(
sim_dir::String; show_center_of_mass::Bool=false, show_eigvals_ratio::Bool=true
sim_dir::String;
show_center_of_mass::Bool=DEFAULT_SHOW_CENTER_OF_MASS,
show_κ::Bool=DEFAULT_SHOW_KAPPA,
)
bundles_info = ReCo.BundlesInfo(sim_dir)
wanted_snapshot_out_of_total = get_wanted_snapshot_number(
@ -42,7 +59,7 @@ function plot_snapshot(
cs_view = view(bundle.c, :, bundle_snapshot)
center_of_mass = ReCo.center_of_mass(cs_view, sim_consts.half_box_len)
if show_eigvals_ratio
if show_κ
eigvals_ratio = ReCo.gyration_tensor_eigvals_ratio(
cs_view, sim_consts.half_box_len, center_of_mass
)