aboutsummaryrefslogtreecommitdiff
path: root/julia/alignment-test.jl
blob: 0779b8db122208813e4484a86ca14205c21d41b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using CrystFEL
using Random

# Create empty image for simulation purposes
dtempl = loaddatatemplate("julia/alignment-test.geom")
image = Image(dtempl)

# Create a crystal and calculate its reflections
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)
        end
    end
end

# Index the pattern
indexer = Indexer("asdf-cell", dtempl, cell, retry=false, multilattice=false, refine=true)
index(image, indexer)