Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions ILL/IDF/salsa_generateIDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
validFrom = "1901-01-01 00:00:00"

# source
zSource = -2
zSource = -2.0

# monitor
zMonitor = -1
zMonitor = -1.0

# detector
zDetector = 1.25
detectorHeight = 0.25
detectorWidth = 0.25

Expand All @@ -28,24 +27,17 @@
x = pixelWidth / 2.0
y = pixelHeight / 2.0
z = pixelThickness / 2.0
xstart = repr(pixelWidth * (nPixelsHorizontal - 1) / 2)
xstep = repr(-pixelWidth)
xpixels = repr(nPixelsHorizontal)
ystart = repr(-pixelHeight * (nPixelsVertical - 1) / 2)
ystep = repr(pixelHeight)
ypixels = repr(nPixelsVertical)

# identification numbers
id0 = repr(0)
xstart = -pixelWidth * (nPixelsHorizontal - 1) / 2
xstep = pixelWidth
xpixels = nPixelsHorizontal
ystart = -pixelHeight * (nPixelsVertical - 1) / 2
ystep = pixelHeight
ypixels = nPixelsVertical

# rectangular detector

FF = "n" # idfillbyfirst
SR = repr(nPixelsVertical) # idstepbyrow

# detector name
detector0 = "detector"

# introductory comment
comment = """
This is the instrument definition file of the
Expand Down Expand Up @@ -75,8 +67,11 @@
salsa.addMonitorIds([repr(256*256)])

salsa.addComment("DETECTOR")
salsa.addRectangularDetector(detector0, pixelName, xstart, xstep, xpixels, ystart, ystep, ypixels)
salsa.addComponentRectangularDetector(detector0, 0., 0., zDetector, idstart=id0, idfillbyfirst=FF, idstepbyrow=SR)
salsa.addComponentILL("detector", 0., 0., 0.)
detector = salsa.makeTypeElement("detector")
for i in range(256):
salsa.addRectangularDetector("channel_" + str(i), pixelName, xstart, xstep, xpixels, 0, ystep, 1)
salsa.addComponentRectangularDetector("channel_" + str(i), 0., -detectorHeight/2 + i * xstep, 0., idstart=str(0 + i * 256), idfillbyfirst="n", idstepbyrow=SR, root=detector)

salsa.addComment("PIXEL, EACH PIXEL IS A DETECTOR")
salsa.addCuboidPixel(pixelName, [-x, -y, z],
Expand Down