aboutsummaryrefslogtreecommitdiff
path: root/julia/make-indexed.jl
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2024-01-18 17:55:45 +0100
committerThomas White <taw@physics.org>2024-02-06 16:59:35 +0100
commit1b4fdfa5cc1ab4fe9a1cdcbb0bf1602834eaec13 (patch)
tree03061175385337244c7605c5810db1d6affcd779 /julia/make-indexed.jl
parentff89f33377133352838f27057525701e71c9df7c (diff)
Julia: MM semantics for Image.crystals
Diffstat (limited to 'julia/make-indexed.jl')
-rw-r--r--julia/make-indexed.jl26
1 files changed, 26 insertions, 0 deletions
diff --git a/julia/make-indexed.jl b/julia/make-indexed.jl
new file mode 100644
index 00000000..7a24f606
--- /dev/null
+++ b/julia/make-indexed.jl
@@ -0,0 +1,26 @@
+using CrystFEL
+using Random
+
+# "Simulate" a diffraction pattern from the reflections
+function sketch_pattern(image, cr)
+ reflist = predictreflections(cr, image)
+ peaklist = PeakList()
+ for refl in reflist
+ if randn() > 0
+ let dpos = refl.detectorposition
+ push!(peaklist, dpos.fs, dpos.ss, dpos.panelnumber, 100.0)
+ end
+ end
+ end
+ return peaklist
+end
+
+
+dtempl = loaddatatemplate("julia/alignment-test.geom")
+cell = UnitCell(MonoclinicLattice, PrimitiveCell, 123, 45, 80, 90, 97, 90)
+indexer = Indexer("asdf", dtempl, cell, retry=false, multilattice=false, refine=true)
+
+image = Image(dtempl)
+cr = Crystal(rotatecell(cell))
+image.peaklist = sketch_pattern(image, cr)
+index(image, indexer)