Archived
1
0
Fork 0
This repository has been archived on 2024-06-16. You can view files and clone it, but cannot push or open issues or pull requests.
pivot-saw/crates/analysis/main.jl
2023-08-02 17:38:44 +02:00

30 lines
714 B
Julia
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DelimitedFiles
using Plots
using LsqFit
@. model(N, p) = N^(2 * p[1])
function main()
data = readdlm("analysis.csv", ',')
ns = view(data, :, 1)
squared_r_ees = view(data, :, 2)
expected_ν = 0.588
expected(N) = N^(2 * expected_ν)
p0 = [expected_ν]
fit = curve_fit(model, ns, squared_r_ees, p0)
simulation_ν = fit.param[1]
p = plot(; xlabel="N", ylabel="<Rₑₑ²>", xscale=:log10, yscale=:log10, title="10⁵ steps", dpi=300)
plot!(p, ns, squared_r_ees; label="Simulation ν = $(round(simulation_ν; digits=3))")
plot!(p, ns, map(N -> expected(N), ns); label="Expected ν = $expected_ν")
savefig(p, "analysis.png")
return nothing
end
main()