aboutsummaryrefslogtreecommitdiff
path: root/julia
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-11-16 14:11:48 +0100
committerThomas White <taw@physics.org>2024-02-06 16:59:34 +0100
commit3e467fb7f9ed331212ee2434eee8afd0355b96ff (patch)
tree68495ffffc0010161953e41785d05d30898a061e /julia
parent1fa4821361cb47e689f5622bb1e6f8ab9b17bf54 (diff)
Update alignment-test.jl
Diffstat (limited to 'julia')
-rw-r--r--julia/alignment-test.jl33
1 files changed, 26 insertions, 7 deletions
diff --git a/julia/alignment-test.jl b/julia/alignment-test.jl
index 0779b8db..345c7d77 100644
--- a/julia/alignment-test.jl
+++ b/julia/alignment-test.jl
@@ -10,16 +10,35 @@ cell = UnitCell(MonoclinicLattice, PrimitiveCell, 123, 45, 80, 90, 97, 90)
cr = Crystal(cell) # FIXME: Random rotation
truth = predictreflections(cr, image)
-# Sketch a diffraction pattern
-image.peaklist = PeakList()
-for refl in truth
- if randn() > 3
- let dpos = refl.detectorposition
- push!(image.peaklist, dpos.fs, dpos.ss, dpos.panelnumber, 100.0)
+# "Simulate" a diffraction pattern from the reflections
+function sketch_pattern(reflist)
+ peaks = PeakList()
+ for refl in reflist
+ if randn() > 0
+ let dpos = refl.detectorposition
+ push!(peaks, dpos.fs, dpos.ss, dpos.panelnumber, 100.0)
+ end
end
end
+ return peaks
end
+image.peaklist = sketch_pattern(truth)
+
# Index the pattern
-indexer = Indexer("asdf-cell", dtempl, cell, retry=false, multilattice=false, refine=true)
+indexer = Indexer("asdf", dtempl, cell, retry=false, multilattice=false, refine=true)
index(image, indexer)
+
+
+# Utility routine for visualising peaks
+function plotpanel(image, pn)
+ x = []
+ y = []
+ for pk in image.peaklist
+ if pk.panelnumber == pn
+ push!(x, pk.fs)
+ push!(y, pk.ss)
+ end
+ end
+ scatter(x, y)
+end