Channel list cleanup and split to bs_channels and pv_channels
This commit is contained in:
@ -6,6 +6,7 @@ import numpy as np
|
||||
#from slic.devices.general.motor import Motor
|
||||
import matplotlib.pyplot as plt
|
||||
import epics
|
||||
from cristallina import attocube, attenuator
|
||||
|
||||
from slic.devices.xoptics.aramis_attenuator import Attenuator
|
||||
attenuator = Attenuator("SAROP31-OATA150", description="Cristallina attenuator OATA150")
|
||||
@ -38,7 +39,7 @@ between_KB_settings = 500
|
||||
KBvs = [[1,2],[1,3],[1,2],[1,3],[1,2]]
|
||||
KBhs = [[1,2],[1,2],[1,2],[1,3],[1,2]]
|
||||
|
||||
# Time estimates for total time calculation
|
||||
# Time estimates for total time calculation (time in seconds)
|
||||
t_kb_change = 30
|
||||
t_shot = 5
|
||||
t_atten_change = 20
|
||||
@ -48,8 +49,9 @@ def shoot(pos=pos,testing=testing_flag):
|
||||
print(f'Shot at: {pos}')
|
||||
return pos
|
||||
else:
|
||||
epics.caput("SAR-CCTA-ESC:seq0Ctrl-Start-I",1)
|
||||
|
||||
print(f'Shot at: {pos}')
|
||||
#epics.caput("SAR-CCTA-ESC:seq0Ctrl-Start-I",1)
|
||||
pass
|
||||
|
||||
def change_benders(bender_1,bender_2,KB = None,do_not_move_benders = do_not_move_benders):
|
||||
check_KB_value(KB)
|
||||
@ -104,6 +106,8 @@ def move_x_rel(distance,testing=testing_flag,pos=pos):
|
||||
return pos
|
||||
else:
|
||||
attocube.X.set_target_value(distance, relative=True).wait()
|
||||
pos = pos + np.array([distance,0])
|
||||
return pos
|
||||
|
||||
def move_y_rel(distance,testing=testing_flag,pos=pos):
|
||||
if testing == True:
|
||||
@ -111,6 +115,8 @@ def move_y_rel(distance,testing=testing_flag,pos=pos):
|
||||
return pos
|
||||
else:
|
||||
attocube.Y.set_target_value(distance, relative=True).wait()
|
||||
pos = pos + np.array([0,distance])
|
||||
return pos
|
||||
|
||||
def move_x(value,testing=testing_flag,pos=pos):
|
||||
if testing == True:
|
||||
@ -149,7 +155,7 @@ def make_attenuations(attenuations,testing=testing_flag,pos=pos):
|
||||
attenuator.trans1st(attenuation).wait()
|
||||
print('Making same shots')
|
||||
make_same_shots(n_same_holes,pos=pos)
|
||||
pos = move_y_rel(between_attenuations,pos=pos)
|
||||
pos = move_y_rel(between_attenuations,pos=pos,testing=testing)
|
||||
|
||||
# Return back to where you started
|
||||
if testing == True:
|
||||
@ -163,18 +169,21 @@ def make_same_shots(n_same_holes,testing=testing_flag,pos=pos):
|
||||
original_position = pos
|
||||
else:
|
||||
original_position = [attocube.X.get_current_value(),attocube.Y.get_current_value()]
|
||||
|
||||
|
||||
# Make holes
|
||||
for shot in range(n_same_holes):
|
||||
sleep(1)
|
||||
shoot(pos=pos)
|
||||
pos = move_x_rel(between_same_shots,pos=pos)
|
||||
pos = move_x_rel(between_same_shots,pos=pos,testing=testing)
|
||||
|
||||
# Return back to where you started
|
||||
move(original_position)
|
||||
|
||||
|
||||
# Estimate total time
|
||||
total_time = len(KBhs)*len(KBvs)*(t_kb_change+len(attenuations)*(t_atten_change+n_same_holes*t_shot) )
|
||||
def estimate_total_time(KBhs=KBhs,KBvs=KBvs,attenuations=attenuations,n_same_holes=n_same_holes,t_kb_change=t_kb_change,t_atten_change=t_atten_change,t_shot=t_shot):
|
||||
total_time = len(KBhs)*len(KBvs)*(t_kb_change+len(attenuations)*(t_atten_change+n_same_holes*t_shot) )
|
||||
print(f'Total time estimate: {(total_time/60):.1f} minutes or {(total_time/60/60):.1f} hours')
|
||||
return total_time
|
||||
|
||||
# Get the starting x-position
|
||||
if testing_flag == True:
|
||||
@ -182,34 +191,37 @@ if testing_flag == True:
|
||||
else:
|
||||
starting_x_pos = attocube.X.get_current_value()
|
||||
|
||||
# The actual loop to make inprints
|
||||
for i,KBv in enumerate(KBvs):
|
||||
change_benders(KBv[0],KBv[1],KB = 'v')
|
||||
|
||||
for ind,KBh in enumerate(KBhs):
|
||||
change_benders(KBh[0],KBh[1],KB = 'h')
|
||||
|
||||
print(f'Progress so far: KBv loop: {i+1}/{len(KBvs)}. KBh loop:{ind+1}/{len(KBhs)}')
|
||||
make_attenuations(attenuations,pos=pos)
|
||||
|
||||
print(f'Moving to a new KBh setting')
|
||||
def make_everything(KBvs,KBhs,attenuations,n_same_holes,testing=testing_flag,pos=pos):
|
||||
# The actual loop to make inprints
|
||||
for i,KBv in enumerate(KBvs):
|
||||
change_benders(KBv[0],KBv[1],KB = 'v')
|
||||
|
||||
for ind,KBh in enumerate(KBhs):
|
||||
change_benders(KBh[0],KBh[1],KB = 'h')
|
||||
|
||||
print(f'Progress so far: KBv loop: {i+1}/{len(KBvs)}. KBh loop:{ind+1}/{len(KBhs)}')
|
||||
make_attenuations(attenuations,pos=pos)
|
||||
|
||||
print(f'Moving to a new KBh setting')
|
||||
# Move to the last shot of the same shot + the spacing between KB settings
|
||||
pos = move_x_rel(between_KB_settings+between_same_shots*(n_same_holes-1),pos=pos)
|
||||
|
||||
print('KBh set done, returning to starting_x_pos')
|
||||
# Move to the last shot of the same shot + the spacing between KB settings
|
||||
pos = move_x_rel(between_KB_settings+between_same_shots*(n_same_holes-1),pos=pos)
|
||||
|
||||
print('KBh set done, returning to starting_x_pos')
|
||||
# Move to the last shot of the same shot + the spacing between KB settings
|
||||
pos = move_x(starting_x_pos,pos=pos)
|
||||
|
||||
pos = move_x(starting_x_pos,pos=pos)
|
||||
print('#################################################################################')
|
||||
print('Moving to a new KBv setting')
|
||||
# Move to the last shot of the same shot + the spacing between KB settings
|
||||
|
||||
print('#################################################################################')
|
||||
print('Moving to a new KBv setting')
|
||||
# Move to the last shot of the same shot + the spacing between KB settings
|
||||
|
||||
pos = move_y_rel(between_KB_settings+between_attenuations*(len(attenuations)-1),pos=pos)
|
||||
pos = move_y_rel(between_KB_settings+between_attenuations*(len(attenuations)-1),pos=pos)
|
||||
|
||||
|
||||
print('Inprints are done')
|
||||
print(f'Total time estimate: {(total_time/60):.1f} minutes or {(total_time/60/60):.1f} hours')
|
||||
print('Inprints are done')
|
||||
print(f'Total time estimate: {(total_time/60):.1f} minutes or {(total_time/60/60):.1f} hours')
|
||||
|
||||
# To do:
|
||||
# Fix movement of the attocubes in real time
|
||||
|
Reference in New Issue
Block a user