From ee815fdae034e3f9219ab5b09fd000fc89f7ed7a Mon Sep 17 00:00:00 2001 From: Mo8it Date: Sun, 30 Jan 2022 15:30:59 +0100 Subject: [PATCH] Added kappa to title of snapshot plots --- src/Visualization/SnapshotPlot.jl | 22 +++++++++++++++++----- src/Visualization/common.jl | 5 ++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/Visualization/SnapshotPlot.jl b/src/Visualization/SnapshotPlot.jl index 57ff885..dfa0f48 100644 --- a/src/Visualization/SnapshotPlot.jl +++ b/src/Visualization/SnapshotPlot.jl @@ -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); diff --git a/src/Visualization/common.jl b/src/Visualization/common.jl index 41070ba..29c589a 100644 --- a/src/Visualization/common.jl +++ b/src/Visualization/common.jl @@ -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