Skip to content

Commit

Permalink
add das scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Jul 27, 2024
1 parent 569ac33 commit 745e61c
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 30 deletions.
110 changes: 93 additions & 17 deletions miniDAS/acquire_composite_DB.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,83 @@
Adapted from Composite_DB_scan_LOOPS_60Hz_std.py by ESW, 2024-07-13
"""
import sys
import time
import argparse


sys.path.append('/home/controls/var/tmp/scripts')

import instrument

# Instrument configurations to acquire DBs for.
# This should be read from a scan.csv file.
SCAN = [[300000, {'BL4B:Chop:Gbl:WavelengthReq': 15, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0.6, 'tthd': 1.2, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1)],
[300000, {'BL4B:Chop:Gbl:WavelengthReq': 12.386, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0.6, 'tthd': 1.2, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1)],
[300000, {'BL4B:Chop:Gbl:WavelengthReq': 9.74, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0.6, 'tthd': 1.2, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1)],
[300000, {'BL4B:Chop:Gbl:WavelengthReq': 7.043, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0.6, 'tthd': 1.2, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1)],
[300000, {'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0.6, 'tthd': 1.2, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2)],
[300000, {'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 0.769, 'si:Y:Gap': 0.493, 's3:Y:Gap': 10, 'ths': 1.183, 'tthd': 2.366, 's1:X:Gap': 20, 'si:X:Gap': 20}, (4,4)],
[300000, {'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 1.523, 'si:Y:Gap': 0.976, 's3:Y:Gap': 20, 'ths': 2.343, 'tthd': 4.686, 's1:X:Gap': 20, 'si:X:Gap': 20}, (5,5)],
[300000, {'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 3.015, 'si:Y:Gap': 1.932, 's3:Y:Gap': 20, 'ths': 2.343, 'tthd': 4.686, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10)],
]
SCAN_60Hz = [[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 15, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB 60Hz 15A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 12.386, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB 60Hz 12.39A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 9.74, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB 60Hz 9.74A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 7.043, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB 60Hz 7.04A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 0.39, 'si:Y:Gap': 0.25, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB 60Hz 4.25A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 0.769, 'si:Y:Gap': 0.493, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (4,4), 'C-DB 60Hz 4.25A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 1.523, 'si:Y:Gap': 0.976, 's3:Y:Gap': 20, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (5,5), 'C-DB 60Hz 4.25A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.25, 's1:Y:Gap': 3.015, 'si:Y:Gap': 1.932, 's3:Y:Gap': 20, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB 60Hz 4.25A'],
]

SCAN_60Hz_New = [[1000, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 9.2, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB 60Hz-new 9.2A'],
[300, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 6.7, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB 60Hz-new 6.7A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 6.7, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB 60Hz-new 6.7A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (4,4), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.517, 'si:Y:Gap': 0.332, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.517, 'si:Y:Gap': 0.332, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (4,4), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.517, 'si:Y:Gap': 0.332, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (8,8), 'C-DB 60Hz-new 4.2A'],

[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 1.035, 'si:Y:Gap': 0.663, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (8,8), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 1.035, 'si:Y:Gap': 0.663, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 1.035, 'si:Y:Gap': 0.663, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (15,15), 'C-DB 60Hz-new 4.2A'],

[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 2.069, 'si:Y:Gap': 1.326, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (8,8), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 2.069, 'si:Y:Gap': 1.326, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB 60Hz-new 4.2A'],
[100, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 2.069, 'si:Y:Gap': 1.326, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (15,15), 'C-DB 60Hz-new 4.2A'],
]

SCAN_20Hz = [
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 0.205, 'si:Y:Gap': 0.205, 's3:Y:Gap': 10, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB 20Hz 6A'], # A1 DIV 0
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 0.205, 'si:Y:Gap': 0.205, 's3:Y:Gap': 10, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB 20Hz 6A'], # A1 DIV 0
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 0.205, 'si:Y:Gap': 0.205, 's3:Y:Gap': 10, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (3,3), 'C-DB 20Hz 6A'], # A1 DIV 0

[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 0.912, 'si:Y:Gap': 0.912, 's3:Y:Gap': 20, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (3,3), 'C-DB 20Hz 6A'], # A2 DIV 0
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 0.912, 'si:Y:Gap': 0.912, 's3:Y:Gap': 20, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (8,8), 'C-DB 20Hz 6A'], # A2 DIV 0
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 0.912, 'si:Y:Gap': 0.912, 's3:Y:Gap': 20, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB 20Hz 6A'], # A2 DIV 0

[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 3.624, 'si:Y:Gap': 0.725, 's3:Y:Gap': 10, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB 20Hz 6A'], # A2 DIV 5
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 3.624, 'si:Y:Gap': 0.725, 's3:Y:Gap': 10, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (20,20), 'C-DB 20Hz 6A'], # A2 DIV 5
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 5.769, 'si:Y:Gap': 0.577, 's3:Y:Gap': 20, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB 20Hz 6A'], # A2 DIV 10
[100, {'BL4B:Chop:Gbl:SpeedReq': 20, 'BL4B:Chop:Gbl:WavelengthReq': 6., 'thm':-0.272, 's1:Y:Gap': 5.769, 'si:Y:Gap': 0.577, 's3:Y:Gap': 20, 'ths': 0.0, 'tthd': 0.0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (20,20), 'C-DB 20Hz 6A'], # A2 DIV 10
]

SCAN_TO_RUN = [
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 9.2, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB A1 60Hz-new 9.2A'],

[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 6.7, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (1,1), 'C-DB A2 60Hz-new 6.7A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 6.7, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB A2 60Hz-new 6.7A'],

[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB A3 60Hz-new 4.2A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.259, 'si:Y:Gap': 0.166, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (4,4), 'C-DB A3 60Hz-new 4.2A'],

[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.517, 'si:Y:Gap': 0.332, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (2,2), 'C-DB A4 60Hz-new 4.2A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.517, 'si:Y:Gap': 0.332, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (4,4), 'C-DB A4 60Hz-new 4.2A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 0.517, 'si:Y:Gap': 0.332, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (8,8), 'C-DB A4 60Hz-new 4.2A'],

[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 1.035, 'si:Y:Gap': 0.663, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (8,8), 'C-DB A5 60Hz-new 4.2A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 1.035, 'si:Y:Gap': 0.663, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB A5 60Hz-new 4.2A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 1.035, 'si:Y:Gap': 0.663, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (15,15), 'C-DB A5 60Hz-new 4.2A'],

[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 2.069, 'si:Y:Gap': 1.326, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (8,8), 'C-DB A6 60Hz-new 4.2A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 2.069, 'si:Y:Gap': 1.326, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (10,10), 'C-DB A6 60Hz-new 4.2A'],
[200, {'BL4B:Chop:Gbl:SpeedReq': 60, 'BL4B:Chop:Gbl:WavelengthReq': 4.2, 's1:Y:Gap': 2.069, 'si:Y:Gap': 1.326, 's3:Y:Gap': 10, 'ths': 0., 'tthd': 0, 's1:X:Gap': 20, 'si:X:Gap': 20}, (15,15), 'C-DB A6 60Hz-new 4.2A'],

]


class DBCollector:
def __init__(self, db_list: list):
Expand All @@ -34,13 +97,18 @@ def collect(self):
"""
Collects the direct beams.
"""
self.lr.initialize_series()
self.lr.initialize_series(length=len(self.db_list))

for i, db in enumerate(self.db_list):
print("Direct beam configuration: ", i)
self.lr.increment_sequence()
si_width = self.db_list[i][1]['si:X:Gap']
s1_width = self.db_list[i][1]['s1:X:Gap']
div = s1_width/si_width
run_title = "%s: N=%sx%s Div=%g " % (self.db_list[i][3], self.db_list[i][2][0], self.db_list[i][2][1], div)

self.lr.increment_sequence(title=run_title)
try:
scanner = CompositeDBScanner(SCAN[i], grid_size=SCAN[i][2])
scanner = CompositeDBScanner(self.db_list[i], grid_size=self.db_list[i][2])
scanner.scan_centers()
except:
print("Error occurred while scanning direct beams", i)
Expand Down Expand Up @@ -77,36 +145,44 @@ def scan_centers(self):
Scans the centers of Si and S1.
"""
# Move to the nominal position for all motors
self.lr.move({'si:X:Center': 0, 's1:X:Center': 0})
self.lr.move(self.positions[1])

# Determine positions to raster over
si_width = self.positions[1]['si:X:Gap']
s1_width = self.positions[1]['s1:X:Gap']
self.lr.move({'si:X:Gap': si_width/self.grid_size[0], 's1:X:Gap': s1_width/self.grid_size[1]})

# The starting center should half a step from the left-most position
si_start = si_width * (-1 + 1 / self.grid_size[0]) / 2
s1_start = si_width * (-1 + 1 / self.grid_size[0]) / 2
s1_start = si_width * (-1 + 1 / self.grid_size[1]) / 2

si_positions = [si_start + i * si_width / self.grid_size[0] for i in range(self.grid_size[0])]
s1_positions = [s1_start + i * s1_width / self.grid_size[1] for i in range(self.grid_size[1])]


charge_to_acquire_per_point = self.positions[0] / (self.grid_size[0] * self.grid_size[1])
print("Charge to acquire per configuration:", charge_to_acquire_per_point)

# Iterate over Si
for si in si_positions:
# Iterate over S1
for s1 in s1_positions:
print(f"Si X center: {si}\tS1 X center: {s1}")
# Move motors to the specified positions
self.lr.move({'si:X:Center': si, 's1:X:Gap': s1})

self.lr.move({'si:X:Center': si, 's1:X:Center': s1})
time.sleep(0.5)
# Acquire neutrons
self.lr.start_or_resume(self.positions[0])
self.lr.start_or_resume(charge=charge_to_acquire_per_point)

# Pause to allow the next move
self.lr.pause()

rate = self.lr.get_rate()
print(f" Rate: {rate}")
time.sleep(0.5)
self.lr.stop()
time.sleep(2)

# Example usage
if __name__ == "__main__":
Expand All @@ -116,5 +192,5 @@ def scan_centers(self):
parser.add_argument("--title", help="The title of the scan [like the medium].")
args = parser.parse_args()

collector = DBCollector(SCAN)
collector = DBCollector(SCAN_TO_RUN)
collector.collect()
Loading

0 comments on commit 745e61c

Please sign in to comment.