1
0
Fork 0
mirror of https://gitlab.rlp.net/mobitar/ReCo.jl.git synced 2024-11-08 22:21:08 +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 return snapshot
end 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) bundles_info = ReCo.BundlesInfo(sim_dir)
wanted_snapshot_out_of_total = get_wanted_snapshot_number( wanted_snapshot_out_of_total = get_wanted_snapshot_number(
bundles_info.total_n_snapshots bundles_info.total_n_snapshots
@ -37,7 +39,20 @@ function plot_snapshot(sim_dir::String; show_center_of_mass::Bool=false)
init_cairomakie!() init_cairomakie!()
fig = gen_figure() fig = gen_figure()
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) ax, color_scheme = gen_axis_and_colorbar(fig, sim_consts)
end
particle_xs = Vector{Float64}(undef, sim_consts.n_particles) particle_xs = Vector{Float64}(undef, sim_consts.n_particles)
particle_ys = 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 if show_center_of_mass
center_of_mass = ReCo.center_of_mass(
view(bundle.c, :, bundle_snapshot), sim_consts.half_box_len
)
scatter!( scatter!(
ax, ax,
Point(center_of_mass); 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 * π)) return get(color_scheme, rem2pi(φ, RoundDown) / (2 * π))
end 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( ax = Axis(
fig[1, 1]; fig[1, 1];
limits=( limits=(
@ -16,6 +18,7 @@ function gen_axis_and_colorbar(fig, sim_consts::ReCo.SimConsts)
aspect=AxisAspect(1), aspect=AxisAspect(1),
xlabel=L"x", xlabel=L"x",
ylabel=L"y", ylabel=L"y",
title=axis_title,
) )
color_scheme = ColorSchemes.cyclic_mrybm_35_75_c68_n256_s25 color_scheme = ColorSchemes.cyclic_mrybm_35_75_c68_n256_s25