aboutsummaryrefslogtreecommitdiff
path: root/julia/alignment-test.jl
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-12-19 16:30:31 +0100
committerThomas White <taw@physics.org>2024-02-06 16:59:34 +0100
commited473b7f099e949f189dcd41d69cfb33d945705a (patch)
tree4407af629e13d1168b3b1bfa0e0f04e4944a092a /julia/alignment-test.jl
parent1d9460ed7876112aa229cff5fc4062402f78c169 (diff)
Add plot routine for alignment test
Diffstat (limited to 'julia/alignment-test.jl')
-rw-r--r--julia/alignment-test.jl35
1 files changed, 31 insertions, 4 deletions
diff --git a/julia/alignment-test.jl b/julia/alignment-test.jl
index aecd3435..84e0f65d 100644
--- a/julia/alignment-test.jl
+++ b/julia/alignment-test.jl
@@ -1,5 +1,6 @@
using CrystFEL
using Random
+using Plots
# "Simulate" a diffraction pattern from the reflections
function sketch_pattern(image, cr)
@@ -20,7 +21,7 @@ function simulate_and_index(cell, image_true, dtempl_moved, mille, n)
indexer = Indexer("asdf", dtempl_moved, cell, retry=false, multilattice=false, refine=true)
- for _ in 1:n
+ for i in 1:n
cr = Crystal(rotatecell(cell))
peaklist = sketch_pattern(image_true, cr)
@@ -29,7 +30,11 @@ function simulate_and_index(cell, image_true, dtempl_moved, mille, n)
image_moved.peaklist = peaklist
index(image_moved, indexer, mille=mille)
- print(".")
+ if i % 100 == 0
+ print("*")
+ else
+ print(".")
+ end
end
println("")
@@ -41,5 +46,27 @@ dtempl_true = loaddatatemplate("julia/alignment-test.geom")
image_true = Image(dtempl_true)
cell = UnitCell(MonoclinicLattice, PrimitiveCell, 123, 45, 80, 90, 97, 90)
dtempl_moved = loaddatatemplate("julia/alignment-test-moved.geom")
-mille = Mille("mille.dat")
-simulate_and_index(cell, image_true, dtempl_moved, mille, 10)
+
+
+function plotresiduals(filename)
+
+ l = @layout([q0 q1; q2 q3])
+ a = collect(Iterators.flatten(t))
+
+ function ploth(n, offs, label)
+ histogram(map(x->x.residual,filter(x->in(n, keys(x.globalgradients)), a[offs:3:end])), label=label)
+ end
+
+ q0 = ploth(101, 1, "q0")
+ q1 = ploth(201, 1, "q1")
+ q2 = ploth(301, 1, "q2")
+ q3 = ploth(401, 1, "q3")
+ plot(q0, q1, q2, q3, layout=l, plot_title="Fast scan residual")
+
+ #q0 = ploth(102, 2, "q0")
+ #q1 = ploth(202, 2, "q1")
+ #q2 = ploth(302, 2, "q2")
+ #q3 = ploth(402, 2, "q3")
+ #plot(q0, q1, q2, q3, layout=l, plot_title="Slow scan residual", reuse=false)
+
+end