Skip to content

Commit

Permalink
DMD fiber sweep + new movement method added
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihir-DG committed Jun 26, 2024
1 parent 6bc4a32 commit a03eac7
Showing 1 changed file with 71 additions and 22 deletions.
93 changes: 71 additions & 22 deletions LabExT/Movement/Stages/DMD.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from LabExT.Movement.Stage import Stage, StageError, assert_stage_connected, assert_driver_loaded
from LabExT.Utils import get_configuration_file_path, try_to_lift_window
from LabExT.View.Controls.DriverPathDialog import DriverPathDialog
import numpy as np
import time

#!/usr/bin/env python3
Expand Down Expand Up @@ -199,9 +200,15 @@ def move_absolute(self,
resp = self.motors.query(f'3MD?')
while resp[0] == '0':
resp = self.motors.query(f'3MD?')
return None

return None

def move_absolute_by_axis(self, axis, pos):
self.motors.write(f'{axis}PA{pos}')
resp = self.motors.query(f'{axis}MD?')
while resp[0] == '0':
resp = self.motors.query(f'{axis}MD?')
return None

def goHome(self) -> list:
# Defining home
self.motors.write(f'1DH0')
Expand Down Expand Up @@ -252,7 +259,6 @@ def beam_profile(self) -> list:
step = 0.001
self.move_absolute(-0.6,0,0)
self.line(1,-0.6,start,step)

# measurement loop
for i in range(start,stop,step):
self.move_absolute(i,0,0)
Expand Down Expand Up @@ -305,10 +311,6 @@ def edges(self,
up: float,
down: float) -> dict:
powerOuts = {}
"""left = str(left)
right = str(right)
up = str(up)
down = str(down)"""
epsilon = 0.01
self.goHome()
center_current = self.multi.query('MEASure:CURRent:DC? DEF,DEF')
Expand Down Expand Up @@ -339,18 +341,73 @@ def edges(self,
powerOuts['pcenter2'] = center2_current
return powerOuts



def fiber_sweep(self) -> np.ndarray:
self.resetInstruments()
left = -0.03
right = 0.03
up = 0.03
down = -0.03
step = 0.003
dim = len(range(left,right,step))
dat = np.empty((dim,dim))
p = dim
q = 1
for i in range(down,up,step):
if i == down:
self.move_absolute_by_axis(2,down-2*step)
self.line(2,down-2*step,down,0.001)
self.move_absolute_by_axis(2,i)
for j in range(left,right,step):
if j == left:
self.move_absolute_by_axis(1,left-2*step)
self.line(1,left-2*step,left,0.001)
self.move_absolute_by_axis(1,j)
x = self.motors.query(f'1TP?')
y = self.motors.query(f'2TP?')
pow = self.multi.query('MEASure:CURRent:DC? DEF,DEF')
dat[q][p] = [j,i,x,y,pow]
q += 1
q = 1
p -= 1
return dat






"""left = -0.01
right = 0.01
down = -0.01
up = 0.01
step = 0.001
def initializeAxis(self, axis) -> bool:
self.motors.write(f'{axis}PA0')
resp = self.motors.query(f'{axis}MD?')
while resp[0] == '0':
resp = self.motors.query(f'{axis}MD?')
return True
def measureAxis(self,
axis: float,
start: float = 0,
stop: float = 0,
step: float = 0.001) -> list:
profile = []
positions = range(start, stop, step)
self.move_absolute_by_axis(axis, start - 2 * step)
self.move_absolute_by_axis(axis, start - step)
for pos in positions:
self.move_absolute_by_axis(axis, pos)
p = self.multi.query('MEASure:CURRent:DC? DEF,DEF')
profile.append(p)
return profile


initializeAxis(1)
initializeAxis(2)
vp = measureAxis(2,down,up,step)
self.move_absolute_by_axis(2,0)
hp = measureAxis(1,left,right,step)
self.move_absolute_by_axis(1,0)"""



Expand All @@ -359,14 +416,6 @@ def edges(self,















0 comments on commit a03eac7

Please sign in to comment.