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

Added kappa to title of snapshot plots

This commit is contained in:
Mo8it 2022-01-30 15:30:59 +01:00
parent 78a9e96e9d
commit ee815fdae0
2 changed files with 21 additions and 6 deletions

View file

@ -20,7 +20,9 @@ function get_wanted_snapshot_number(total_n_snapshots::Int64)
return snapshot
end
function plot_snapshot(sim_dir::String; show_center_of_mass::Bool=false)
function plot_snapshot(
sim_dir::String; show_center_of_mass::Bool=false, show_eigvals_ratio::Bool=true
)
bundles_info = ReCo.BundlesInfo(sim_dir)
wanted_snapshot_out_of_total = get_wanted_snapshot_number(
bundles_info.total_n_snapshots
@ -37,7 +39,20 @@ function plot_snapshot(sim_dir::String; show_center_of_mass::Bool=false)
init_cairomakie!()
fig = gen_figure()
ax, color_scheme = gen_axis_and_colorbar(fig, sim_consts)
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
eigvals_ratio = ReCo.gyration_tensor_eigvals_ratio(
cs_view, sim_consts.half_box_len, center_of_mass
)
κ = round(eigvals_ratio; digits=2)
title = L"\kappa = %"
ax, color_scheme = gen_axis_and_colorbar(fig, sim_consts; axis_title=title)
else
ax, color_scheme = gen_axis_and_colorbar(fig, sim_consts)
end
particle_xs = Vector{Float64}(undef, sim_consts.n_particles)
particle_ys = Vector{Float64}(undef, sim_consts.n_particles)
@ -64,9 +79,6 @@ function plot_snapshot(sim_dir::String; show_center_of_mass::Bool=false)
)
if show_center_of_mass
center_of_mass = ReCo.center_of_mass(
view(bundle.c, :, bundle_snapshot), sim_consts.half_box_len
)
scatter!(
ax,
Point(center_of_mass);

View file

@ -4,7 +4,9 @@ function angle_color(φ::Float64, color_scheme::ColorSchemes.ColorScheme)
return get(color_scheme, rem2pi(φ, RoundDown) / (2 * π))
end
function gen_axis_and_colorbar(fig, sim_consts::ReCo.SimConsts)
function gen_axis_and_colorbar(
fig, sim_consts::ReCo.SimConsts; axis_title::AbstractString=""
)
ax = Axis(
fig[1, 1];
limits=(
@ -16,6 +18,7 @@ function gen_axis_and_colorbar(fig, sim_consts::ReCo.SimConsts)
aspect=AxisAspect(1),
xlabel=L"x",
ylabel=L"y",
title=axis_title,
)
color_scheme = ColorSchemes.cyclic_mrybm_35_75_c68_n256_s25