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

31 lines
714 B
Julia
Raw Normal View History

2023-08-02 15:38:44 +00:00
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()