diff options
author | Thomas White <taw@physics.org> | 2024-06-21 16:33:25 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-06-21 17:11:25 +0200 |
commit | 9bad30dcf4faa58cded5cbbf7740dd83c3673526 (patch) | |
tree | cde761bd5a877c106a53c23e4fa6ca6b69741d43 | |
parent | 78ede74065b8a13b9e5cb611e36f57c93525a19b (diff) |
plot-geom.jl: Add routine to load eigenvector files from Millepede
-rw-r--r-- | julia/plot-geom.jl | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/julia/plot-geom.jl b/julia/plot-geom.jl index f5841064..754111e0 100644 --- a/julia/plot-geom.jl +++ b/julia/plot-geom.jl @@ -2,14 +2,43 @@ using CrystFEL using GLMakie function readmillepede(filename) - motions = let fh = open(filename, "r") - readline(fh) # discard header line - motions = map(eachline(fh)) do line - sgroupser,sdelta,_ = split(line) - (parse(Int,sgroupser), parse(Float64,sdelta)) + fh = open(filename, "r") + readline(fh) # discard header line + motions = map(eachline(fh)) do line + sgroupser,sdelta,_ = split(line) + (parse(Int,sgroupser), parse(Float64,sdelta)) + end + return motions +end + +function findeigenvector(fh, num) + while !eof(fh) + l = readline(fh) + bits = split(l) + if length(bits) == 5 + if bits[1] == "Eigenvector" + if parse(Int, bits[2]) == num + return + end + end + end + end + error("Eigenvector not found") +end + +function readeigenvector(filename, num) + fh = open(filename, "r") + findeigenvector(fh, num) + motions = [] + while !eof(fh) + l = readline(fh) + length(l) < 3 && return motions + bits = split(l) + for i in 1:2:length(bits) + push!(motions, (parse(Int,bits[i]), parse(Float64,bits[i+1]))) end - motions end + return motions end function translate!(panel::DetGeomPanel, vec) |