Seperate Julia file for exporting PMM data
This commit is contained in:
parent
b68887e822
commit
65d0f44b69
|
|
@ -0,0 +1,33 @@
|
||||||
|
using Roots, DelimitedFiles
|
||||||
|
|
||||||
|
include("../EC.jl")
|
||||||
|
include("../common.jl")
|
||||||
|
include("../p_space.jl")
|
||||||
|
|
||||||
|
μ = 0.5
|
||||||
|
V_system(c) = (p, q) -> c*(-5*g0(sqrt(3), p, q) + 2*g0(sqrt(10), p, q)) # ResonanceEC: Eq. (20)
|
||||||
|
|
||||||
|
# determining c0 with EC
|
||||||
|
temp_c = range(1.1, 0.9, 3)
|
||||||
|
p, w = get_mesh([0, 8], [256])
|
||||||
|
H0 = get_T_matrix(p, μ)
|
||||||
|
V = get_V_matrix(V_system(1), p, w)
|
||||||
|
EC = affine_EC(H0, V, w)
|
||||||
|
train!(EC, temp_c; ref_eval=-0.2, CAEC=false, verbose=false)
|
||||||
|
quick_extrapolate(c) = minimum(abs2, get_extrapolated_evals(EC.H0_EC, EC.H1_EC, EC.N_EC, c, 0))
|
||||||
|
c0 = find_zero(quick_extrapolate, 0.85)
|
||||||
|
|
||||||
|
training_c = range(1.2, 0.9, 9) # original: range(1.35, 0.9, 5)
|
||||||
|
extrapolating_c = range(0.78, 0.45, 7) # original: range(0.75, 0.40, 8)
|
||||||
|
|
||||||
|
data_c = vcat(training_c, extrapolating_c)
|
||||||
|
data_E = [quick_pole_E(V_system(c)) for c in data_c]
|
||||||
|
|
||||||
|
# export to CSV
|
||||||
|
file = "temp/2body_data.csv"
|
||||||
|
delim = ','
|
||||||
|
open(file, "w") do f
|
||||||
|
writedlm(f, ["c" "re_E" "im_E"], delim)
|
||||||
|
writedlm(f, [c0 0 0], delim) # first entry for the threshold
|
||||||
|
writedlm(f, hcat(data_c, real.(data_E), imag.(data_E)), delim)
|
||||||
|
end
|
||||||
|
|
@ -69,9 +69,3 @@ end
|
||||||
scatter(real.(data_E), imag.(data_E), label="training", title="PMM", xlabel="Re E", ylabel="Im E")
|
scatter(real.(data_E), imag.(data_E), label="training", title="PMM", xlabel="Re E", ylabel="Im E")
|
||||||
scatter!(real.(exact_E), imag.(exact_E), label="exact", m=:+)
|
scatter!(real.(exact_E), imag.(exact_E), label="exact", m=:+)
|
||||||
scatter!(real.(extrapolated_E), imag.(extrapolated_E), label="predicted", m=:x)
|
scatter!(real.(extrapolated_E), imag.(extrapolated_E), label="predicted", m=:x)
|
||||||
|
|
||||||
# export results
|
|
||||||
using DataFrames, CSV
|
|
||||||
df = DataFrame(c=all_c, re_E=real.(exact_E), im_E=imag.(exact_E))
|
|
||||||
#pushfirst!(df, (c0, 0, 0)) # add the threshold
|
|
||||||
CSV.write("temp/PMM.csv", df)
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@ import pandas as pd
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
#%%
|
#%%
|
||||||
df = pd.read_csv('../temp/PMM.csv')
|
df = pd.read_csv('../temp/2body_data.csv')
|
||||||
df['E'] = df['re_E'] + 1j * df['im_E']
|
df['E'] = df['re_E'] + 1j * df['im_E']
|
||||||
train_data = df[abs(df['im_E']) < 1e-5]
|
train_data = df[df['re_E'] < 0]
|
||||||
target_data = df[abs(df['im_E']) > 1e-5]
|
target_data = df[df['re_E'] > 0]
|
||||||
|
|
||||||
train_cs = torch.tensor(train_data['c'], dtype=torch.float64)
|
train_cs = torch.tensor(train_data['c'].to_numpy(), dtype=torch.float64)
|
||||||
train_Es = torch.tensor(train_data['E'], dtype=torch.complex128)
|
train_Es = torch.tensor(train_data['E'].to_numpy(), dtype=torch.complex128)
|
||||||
|
|
||||||
#%%
|
#%%
|
||||||
# hyperparameters
|
# hyperparameters
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue