inprints script work

This commit is contained in:
2022-10-18 12:45:10 +02:00
parent 2c7fd3ffa6
commit 2134451874

View File

@ -28,13 +28,14 @@ pos = np.array([0,0])
# parameters
n_same_holes = 3
attenuations = np.logspace(-3,0,num=4)
attenuations = np.logspace(0,-3,num=4)
KBv_home = [1.5,1.7]
KBh_home = [1.6,1.8]
# Spacings
between_same_shots = 50
between_attenuations = 60
between_KB_settings = 200
KBvs =[[1,2],[1,3]]
KBhs = [[1,2],[1,2]]
@ -110,38 +111,81 @@ def move_y_rel(distance,testing=testing_flag,pos=pos):
attocube.Y.set_target_value(distance, relative=True)
def make_attenuations(attenuations,testing=testing_flag,pos=pos):
if testing == True:
original_position = pos
else:
original_position = [attocube.X.get_current_value(),attocube.Y.get_current_value()]
# Make all attenuations
for attenuation in attenuations:
print(f'Setting attenuation to: {attenuation}')
if testing_flag != True:
attenuator.trans1st(attenuation).wait()
print('Making same shots')
make_same_shots(n_same_holes,pos=pos)
pos = move_y_rel(between_attenuations,pos=pos)
# Return back to where you started
if testing == True:
pos = original_position
else:
attocube.X.set_target_value(original_position, relative=False)
return pos
def make_same_shots(n_same_holes,testing=testing_flag,pos=pos):
if testing == True:
original_position = pos
else:
original_position = attocube.X.get_current_value()
original_position = [attocube.X.get_current_value(),attocube.Y.get_current_value()]
# Make holes
for shot in range(n_same_holes):
shoot(pos=pos)
pos = move_x_rel(between_same_shots,pos=pos)
#plt.plot(pos,'o')
# Return back to where you started
if testing == True:
pos = original_position
else:
attocube.X.set_target_value(original_position, relative=True)
attocube.X.set_target_value(original_position, relative=False)
return pos
plt.figure()
# Get the starting x-position
if testing == True:
starting_x_pos = pos
else:
starting_x_pos = attocube.X.get_current_value()
for KBv in KBvs:
change_benders(KBv[0],KBv[1],KB = 'v')
for KBh in KBhs:
change_benders(KBh[0],KBh[1],KB = 'h')
for attenuation in attenuations:
print(f'Setting attenuation to: {attenuation}')
#attenuator.trans1st(attenuation)
print('Making same shots')
make_same_shots(n_same_holes,pos=pos)
pos = move_y_rel(between_attenuations,pos=pos)
make_attenuations(attenuations,pos=pos)
print('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,pos=pos)
print('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,pos=pos)
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),pos=pos)
# To do:
# Fix movement of the attocubes in real time
# Load lut files into the controller and check that x is x and y is y
# Finish movement in the final loop