3333import threading
3434import time
3535import logging
36- from typing import Union
3736
3837# Third Party Imports
3938from serial import Serial
@@ -923,7 +922,7 @@ def change_filter_wheel_speed(self, speed: int = 0) -> None:
923922 self .send_filter_wheel_command (f"SV { speed } " )
924923 self .read_response ()
925924
926- def halt_filter_wheel (self ):
925+ def halt_filter_wheel (self ) -> None :
927926 """Halt filter wheel"""
928927 self .send_filter_wheel_command ("HA" )
929928 self .read_response ()
@@ -947,7 +946,7 @@ def move_dichroic(self, dichroic_id: str, dichroic_position: int = 0) -> None:
947946 def square_wave (self , on_time : int , delay_time : int ) -> None :
948947 """Square wave modulation.
949948
950- For testing only.
949+ For testing only. Can be used to implement precise laser control.
951950
952951 Parameters
953952 ----------
@@ -1013,28 +1012,64 @@ def logic_card_off(self, axis: str):
10131012 self .send_command (f"6 CCA Z=0\r " )
10141013 self .read_response ()
10151014
1015+ def logic_cell_on (self , axis : str ):
1016+ """Turn on internal logic cell
1017+
1018+ Parameters
1019+ ----------
1020+ axis : str
1021+ The axis of the internal logic cell
1022+ """
1023+ self .send_command (f'6 M E = { axis } \r ' )
1024+ self .read_response ()
1025+ self .send_command (f'6 CCA Z=1\r ' )
1026+ self .read_response ()
1027+
1028+ def logic_cell_off (self , axis :str ):
1029+ """Turn off internal logic cell
1030+
1031+ Parameters
1032+ ----------
1033+ axis : str
1034+ The axis of the internal logic cell
1035+ """
1036+ self .send_command (f'6 M E = { axis } \r ' )
1037+ self .read_response ()
1038+ self .send_command (f'6 CCA Z=0\r ' )
1039+ self .read_response ()
1040+
10161041 def SA_waveform (
1017- self , axis : str , waveform : int = 0 , amplitude : int = 1000 , offset : int = 500
1042+ self , axis : str , waveform : int = 0 , amplitude : int = 1000 , offset : int = 500 , period : int = 10
10181043 ) -> None :
1019- """Programs the analog waveforms using SAA, SAO, and SAP
1020- Default waveform is a sawtooth waveform with an amplitude of 1V with an offset of 0.5V
1044+ """Programs the analog waveforms using SAA, SAO, SAP, and SAF
1045+ Default waveform is a sawtooth waveform with an amplitude of 1V, an offset of 0.5V and period of 10 ms
10211046
10221047 Parameters
10231048 ----------
10241049 axis: str
1025- Laser axis
1050+ Tiger Controller axis
10261051 waveform: int
10271052 Type of waveform pattern according to https://asiimaging.com/docs/commands/sap
10281053 amplitude: int
1029- amplitude of the waveform
1054+ amplitude of the waveform in mV
10301055 offset: int
1031- sets the center position of the waveform
1056+ sets the center position of the waveform in mV
1057+ period: int
1058+ sets the period of the waveform in ms
10321059 """
1033- self .send_command (f"SAP { axis } ={ waveform } " )
1060+ print (f"Period (ms): { period } " )
1061+ # takes amplitude and offset from navigate and modifies them to how the TG-1000 takes them
1062+ if (waveform % 128 == 3 ):
1063+ offset = .5 * (offset + amplitude )
1064+ amplitude = amplitude * 2
1065+ # TODO: 3 is the address of the GALVO DAC. May need to make this configurable.
1066+ self .send_command (f"3 SAP { axis } ={ waveform } " )
1067+ self .read_response ()
1068+ self .send_command (f"3 SAA { axis } ={ amplitude } " )
10341069 self .read_response ()
1035- self .send_command (f"SAA { axis } ={ amplitude } " )
1070+ self .send_command (f"3 SAO { axis } ={ offset } " )
10361071 self .read_response ()
1037- self .send_command (f"SAO { axis } ={ offset } " )
1072+ self .send_command (f"3 SAF { axis } ={ period } " )
10381073 self .read_response ()
10391074
10401075 def SAM (self , axis : str , mode : int ) -> None :
@@ -1053,7 +1088,7 @@ def SAM(self, axis: str, mode: int) -> None:
10531088 mode: int
10541089 Integer code.
10551090 """
1056- self .send_command (f"SAM { axis } ={ mode } " )
1091+ self .send_command (f"3 SAM { axis } ={ mode } " )
10571092 self .read_response ()
10581093
10591094 def setup_control_loop (
0 commit comments