Deborah.Rahab.CorrPlot
Deborah.Rahab.CorrPlot.build_observables — Methodbuild_observables(
keys::AbstractVector{<:AbstractString},
key_doc::AbstractVector{<:AbstractString},
raw_path::AbstractString;
real_col::Integer=1,
file_ext::AbstractString=".dat"
) -> Matrix{Float64}Read per-key data files from raw_path named as <key><file_ext> and extract column real_col (default: 1). Stack them so that each row corresponds to one key, preserving the order of keys. Returns only the matrix mat::Matrix{Float64}.
Arguments
keys: basenames like["pbp", "trdinv2",...].key_doc: doc strings (must be same length/order askeys).raw_path: directory containing the files.real_col: $1$-based column index to read (default:1).file_ext: file extension including dot (default:".dat").
Throws
AssertionErroriflength(keys) != length(key_doc)or if sample lengths differ.ArgumentErrorif a file is missing orreal_colis out of bounds.
Deborah.Rahab.CorrPlot.corrmat_plot — Methodcorrmat_plot(
mat::AbstractMatrix{<:Real},
key_doc::Vector{String},
ensemble::String,
figs_dir::String;
save_file::Bool=false
) -> NothingRender and (optionally) save a heatmap of the absolute correlation matrix computed across the rows of mat (Statistics.cor(mat, dims=2)). Each row is treated as a variable and each column as a sample.
Arguments
mat: Real-valued data matrix of shape(n_vars$\times$n_samples); rows are variables, columns are samples.key_doc: Tick labels for variables (length must equalsize(mat, 1)). Labels may includemathtext/$\LaTeX$-like strings (e.g.,"$\mathrm{Tr} M^{-1}$").ensemble: Identifier used to construct the output filename (e.g.,"L8T4b1.60k13570"→corr_L8T4b1.60k13570.pdf).figs_dir: Directory where the PDF is written ifsave_file=true.
Keyword Arguments
save_file::Bool=false: Whentrue, saves a PDF tofigs_dir. Ifpdfcropis available on the systemPATH, a cropped version is produced and overwrites the original.
Behavior
- Computes
cormat = abs.(Statistics.cor(mat, dims=2)). - Draws a heatmap with
vmin=0.0,vmax=1.0, and colormap"autumn_r". - Annotates each cell with its value (rounded to 3 digits) and chooses black/white text based on a fixed threshold (
0.4) for contrast. - Sets both axes ticks to
0:(n_vars-1)with labels fromkey_doc, rotates $x$-tick labels by 60°, sets square cells viaax.set_aspect(1), callstight_layout(), and displays the figure. - If
save_file=true, writes<figs_dir>/corr_$(ensemble).pdfand, when available, runspdfcropand replaces the original with the cropped output.
Notes
- If labels include $\LaTeX$ commands unsupported by
Matplotlib's mathtext (e.g.,\textrm), prefer mathtext-friendly forms (e.g.,\mathrm) or enableusetex=trueglobally if you need full $\LaTeX$.
Returns
Nothing.