aboutsummaryrefslogtreecommitdiff
path: root/julia/make-indexed.jl
blob: 7a24f6060d561b6ba3b7946f741650adda6fe73e (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
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)