inprints script work
This commit is contained in:
@ -28,13 +28,14 @@ pos = np.array([0,0])
|
|||||||
|
|
||||||
# parameters
|
# parameters
|
||||||
n_same_holes = 3
|
n_same_holes = 3
|
||||||
attenuations = np.logspace(-3,0,num=4)
|
attenuations = np.logspace(0,-3,num=4)
|
||||||
KBv_home = [1.5,1.7]
|
KBv_home = [1.5,1.7]
|
||||||
KBh_home = [1.6,1.8]
|
KBh_home = [1.6,1.8]
|
||||||
|
|
||||||
# Spacings
|
# Spacings
|
||||||
between_same_shots = 50
|
between_same_shots = 50
|
||||||
between_attenuations = 60
|
between_attenuations = 60
|
||||||
|
between_KB_settings = 200
|
||||||
KBvs =[[1,2],[1,3]]
|
KBvs =[[1,2],[1,3]]
|
||||||
KBhs = [[1,2],[1,2]]
|
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)
|
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):
|
def make_same_shots(n_same_holes,testing=testing_flag,pos=pos):
|
||||||
if testing == True:
|
if testing == True:
|
||||||
original_position = pos
|
original_position = pos
|
||||||
else:
|
else:
|
||||||
original_position = attocube.X.get_current_value()
|
original_position = [attocube.X.get_current_value(),attocube.Y.get_current_value()]
|
||||||
|
|
||||||
# Make holes
|
# Make holes
|
||||||
for shot in range(n_same_holes):
|
for shot in range(n_same_holes):
|
||||||
shoot(pos=pos)
|
shoot(pos=pos)
|
||||||
pos = move_x_rel(between_same_shots,pos=pos)
|
pos = move_x_rel(between_same_shots,pos=pos)
|
||||||
#plt.plot(pos,'o')
|
|
||||||
# Return back to where you started
|
# Return back to where you started
|
||||||
if testing == True:
|
if testing == True:
|
||||||
pos = original_position
|
pos = original_position
|
||||||
else:
|
else:
|
||||||
attocube.X.set_target_value(original_position, relative=True)
|
attocube.X.set_target_value(original_position, relative=False)
|
||||||
return pos
|
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:
|
for KBv in KBvs:
|
||||||
change_benders(KBv[0],KBv[1],KB = 'v')
|
change_benders(KBv[0],KBv[1],KB = 'v')
|
||||||
|
|
||||||
for KBh in KBhs:
|
for KBh in KBhs:
|
||||||
change_benders(KBh[0],KBh[1],KB = 'h')
|
change_benders(KBh[0],KBh[1],KB = 'h')
|
||||||
|
|
||||||
for attenuation in attenuations:
|
make_attenuations(attenuations,pos=pos)
|
||||||
print(f'Setting attenuation to: {attenuation}')
|
|
||||||
#attenuator.trans1st(attenuation)
|
print('Moving to a new KBh setting')
|
||||||
print('Making same shots')
|
# Move to the last shot of the same shot + the spacing between KB settings
|
||||||
make_same_shots(n_same_holes,pos=pos)
|
pos = move_x_rel(between_KB_settings+between_same_shots*n_same_holes,pos=pos)
|
||||||
pos = move_y_rel(between_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 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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user