Skip to content

Commit 0e86e05

Browse files
More packaging adjustments
1 parent 81eacf1 commit 0e86e05

File tree

3 files changed

+2
-522
lines changed

3 files changed

+2
-522
lines changed

src/navigate/model/device_startup_functions.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def start_device(
492492
device_not_found(microscope_name, device_category, device_type, device_id)
493493

494494

495-
def start_daq(configuration: Dict[str, Any], device_type: str = "NI", name: str = "name") -> DAQBase:
495+
def start_daq(configuration: Dict[str, Any], device_type: str = "NI") -> DAQBase:
496496
"""Initializes the data acquisition (DAQ) class on a dedicated thread.
497497
498498
Load daq information from the configuration file. Proper daq types include NI and
@@ -516,12 +516,6 @@ def start_daq(configuration: Dict[str, Any], device_type: str = "NI", name: str
516516

517517
return NIDAQ(configuration)
518518

519-
elif device_type == "asi.ASI":
520-
# from navigate.model.devices.daq.asi import ASIDaq
521-
# name = "Microscope-0"
522-
return start_device(name, configuration, "daq")
523-
524-
525519
elif device_type.lower().startswith("synthetic"):
526520
from navigate.model.devices.daq.synthetic import SyntheticDAQ
527521

@@ -600,10 +594,6 @@ def load_devices(
600594
]["hardware"]["type"]
601595

602596
if device_type not in devices_dict["daq"]:
603-
print(device_type)
604-
if (device_type == "asi.ASI"):
605-
devices_dict["daq"][device_type] = start_daq(configuration, device_type, microscope_name)
606-
else:
607-
devices_dict["daq"][device_type] = start_daq(configuration, device_type)
597+
devices_dict["daq"][device_type] = start_daq(configuration, device_type)
608598

609599
return devices_dict

src/navigate/model/devices/APIs/asi/asi_tiger_controller.py

Lines changed: 0 additions & 229 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,232 +1077,3 @@ def SAM(self, axis: str, mode: int):
10771077

10781078
self.send_command(f"3 SAM {axis}={mode}")
10791079
self.read_response()
1080-
1081-
def setup_control_loop(self,delays,camera_delay,rfvc_delay,sweep_time : float, analog_outputs : dict): # delay (ms), sweep_time (ms)
1082-
# def setup_control_loop(self, analog_outputs: dict):
1083-
"""
1084-
Sets up the control loop
1085-
1086-
Arguments: self, waveform type dict (axis, waveform)
1087-
1088-
If/Else statements: send the right loop
1089-
1090-
"""
1091-
# channels = analog_outputs.keys()
1092-
TTLs = {'A': 42, 'B': 44, 'C': 46}
1093-
# if channels:
1094-
start_delay = int(delays[0]*4) #- int(round(period))
1095-
if len(delays) > 1:
1096-
galvo2_delay = int((delays[0] - delays[1])*4)
1097-
galvo1_axis = analog_outputs["galvo 0"]
1098-
galvo2_axis = analog_outputs["galvo 1"]
1099-
elif len(delays) == 1:
1100-
galvo1_axis = analog_outputs["galvo 0"]
1101-
galvo2_delay = 0
1102-
else:
1103-
galvo2_delay = 0
1104-
rfvc_axis = analog_outputs["remote_focus"]
1105-
1106-
1107-
1108-
sweep_time = int(sweep_time*4) - 2
1109-
1110-
if rfvc_delay > camera_delay + 2:
1111-
camera_output = 6
1112-
rfvc_output = 12
1113-
start_delay += int((camera_delay + 2) * 4)
1114-
difference_delay = int((rfvc_delay - (camera_delay + 2)) * 4)
1115-
elif rfvc_delay < camera_delay + 2:
1116-
camera_output = 12
1117-
rfvc_output = 6
1118-
start_delay += int((rfvc_delay) * 4)
1119-
difference_delay = int(((camera_delay + 2) - rfvc_delay) * 4)
1120-
elif rfvc_delay == camera_delay + 2:
1121-
camera_output = 6
1122-
rfvc_output = 6
1123-
start_delay += int((camera_delay + 2) * 4)
1124-
difference_delay = int((rfvc_delay - (camera_delay + 2)) * 4)
1125-
1126-
1127-
print(f"Delays: {delays}, RFVC Delay: {rfvc_delay}, Camera Delay: {camera_delay}")
1128-
1129-
print(f"Camera: {camera_output}, RFVC: {rfvc_output}")
1130-
1131-
print(f'Sweep Time Cycles: {sweep_time}')
1132-
print(f"Start Delay: {start_delay}, Difference Delay: {difference_delay}")
1133-
print(f"Galvo2_delay: {galvo2_delay}")
1134-
1135-
commands = [
1136-
'6 CCA X=0',
1137-
1138-
# Set cell 2 to one shot to trigger TTL for galvo, For I am the LORD
1139-
'6 m e = 2',
1140-
'6 cca y = 8',
1141-
'6 cca z = 10',
1142-
'6 ccb x = 1',
1143-
'6 ccb y = 192',
1144-
# Set cell 3 to delay cell to give time to send serial commands, For I am the LORD
1145-
'6 m e = 3',
1146-
'6 cca y = 9',
1147-
f'6 cca z = {start_delay}',
1148-
'6 ccb x = 1',
1149-
'6 ccb y = 192',
1150-
# Set cell 4 to JK-Flop, to trigger & cell, For I am the LORD
1151-
'6 m e = 4',
1152-
'6 cca y = 13',
1153-
'6 ccb x = 3',
1154-
'6 ccb y = 8',
1155-
'6 ccb z = 192',
1156-
# Set cell 5 to & cell for loop, For I am the LORD
1157-
'6 m e = 5',
1158-
'6 cca y = 5',
1159-
'6 ccb x = 4',
1160-
'6 ccb y = 71',
1161-
# Set cell 6 to one-shot to trigger TTL for RFVC repeatedly and to trigger CT, For I am the LORD
1162-
'6 m e = 6',
1163-
'6 cca y = 8',
1164-
'6 cca z = 10',
1165-
'6 ccb x = 5',
1166-
'6 ccb y = 192',
1167-
# Set cell 7 to delay cell for loop, For I am the LORD
1168-
'6 m e = 7',
1169-
'6 cca y = 9',
1170-
f'6 cca z= {sweep_time}',
1171-
'6 ccb x = 6',
1172-
'6 ccb y = 192',
1173-
#Sets cell 9 to a delay cell to account for the second galvo
1174-
'6 m e = 9',
1175-
'6 cca y = 9',
1176-
f'6 cca z = {galvo2_delay}',
1177-
'6 ccb x = 2',
1178-
'6 ccb y = 192',
1179-
#Sets cell 10 to a one shot to trigger Galvo 2
1180-
'm e = 10',
1181-
'cca y = 8',
1182-
'cca z = 10',
1183-
'ccb x = 9',
1184-
'ccb y = 192',
1185-
#Sets cell 11 to a delay reading the output of cell 6
1186-
'6 m e = 11',
1187-
'6 cca y = 9',
1188-
f'6 cca z = {difference_delay}',
1189-
'6 ccb x = 6',
1190-
'6 ccb y = 192',
1191-
#Sets cell 12 to one shot to trigger camera
1192-
'm e = 12',
1193-
'cca y = 8',
1194-
'cca z = 10',
1195-
'ccb x = 11',
1196-
'ccb y = 192',
1197-
#Sets TTL2 to output from the RFVC cell in this case , For I am the LORD
1198-
f'6 m e = {TTLs[rfvc_axis]+1}',
1199-
'6 cca y = 1',
1200-
f'6 cca z = {rfvc_output}',
1201-
#Sets TTL1 to output the same thing as TTL0, For I am the LORD
1202-
f'6 m e = {TTLs[rfvc_axis]}',
1203-
'6 cca y = 1',
1204-
f'6 cca z = {TTLs[rfvc_axis]+1}',
1205-
#Sets PLC output 3 to cell 6
1206-
'6 m e = 33',
1207-
f'6 cca z = {camera_output}',
1208-
]
1209-
# if galvos exist
1210-
galvo_commands = []
1211-
if len(delays) > 0:
1212-
galvo_commands = [
1213-
#Sets TTL4 to output for the first Galvo, For I am the LORD
1214-
f'6 m e = {TTLs[galvo1_axis]+1}',
1215-
'6 cca y = 1',
1216-
'6 cca z = 2',
1217-
#Sets TTL3 to output the same thing as TTL2
1218-
f'6 m e = {TTLs[galvo1_axis]}',
1219-
'cca y = 1',
1220-
f'cca z = {TTLs[galvo1_axis]+1}',
1221-
]
1222-
1223-
if len(delays) > 1:
1224-
galvo_commands = [
1225-
#Sets TTL4 to output for the first Galvo, For I am the LORD
1226-
f'6 m e = {TTLs[galvo1_axis]+1}',
1227-
'6 cca y = 1',
1228-
'6 cca z = 2',
1229-
#Sets TTL3 to output the same thing as TTL2
1230-
f'6 m e = {TTLs[galvo1_axis]}',
1231-
'cca y = 1',
1232-
f'cca z = {TTLs[galvo1_axis]+1}',
1233-
#Sets TTL4 to output for the first Galvo, For I am the LORD
1234-
f'6 m e = {TTLs[galvo2_axis]+1}',
1235-
'6 cca y = 1',
1236-
'6 cca z = 10',
1237-
#Sets TTL3 to output the same thing as TTL2
1238-
f'6 m e = {TTLs[galvo2_axis]}',
1239-
'cca y = 1',
1240-
f'cca z = {TTLs[galvo2_axis]+1}',
1241-
]
1242-
print(galvo_commands)
1243-
1244-
print(analog_outputs)
1245-
print(f"{TTLs[galvo1_axis]+ 1}")
1246-
for command in commands:
1247-
# Send data
1248-
self.send_command(f'{command}\r')
1249-
self.read_response()
1250-
for command in galvo_commands:
1251-
self.send_command(f'{command}\r')
1252-
self.read_response()
1253-
1254-
def tweak_control_loop(self, delays, sweep_time):
1255-
1256-
start_delay = int(delays[0]*4) #- int(round(period))
1257-
if len(delays) > 1:
1258-
galvo2_delay = int((delays[0] - delays[1])*4)
1259-
else:
1260-
galvo2_delay = 0
1261-
1262-
sweep_time = int(sweep_time*4) - 2
1263-
1264-
print(f'Sweep Time Cycles: {sweep_time}')
1265-
1266-
commands = [
1267-
# Set cell 3 to delay cell to give time to send serial commands, For I am the LORD
1268-
'6 m e = 3',
1269-
'6 cca y = 9'
1270-
f'6 cca z = {start_delay}',
1271-
'6 ccb x = 1',
1272-
'6 ccb y = 192',
1273-
# Set cell 7 to delay cell for loop, For I am the LORD
1274-
'6 m e = 7',
1275-
'6 cca y = 9'
1276-
f'6 cca z= {sweep_time}',
1277-
'6 ccb x = 6',
1278-
'6 ccb y = 192',
1279-
#Sets cell 9 to a delay cell to account for the second galvo
1280-
'6 m e = 9',
1281-
'6 cca y = 9'
1282-
f'6 cca z = {galvo2_delay}',
1283-
'6 ccb x = 2',
1284-
'6 ccb y = 192',
1285-
]
1286-
for command in commands:
1287-
# Send data
1288-
self.send_command(f'{command}\r')
1289-
self.read_response()
1290-
1291-
def send_ttl_pulse(self, channel: int, pulse_width_ms: int, delay_ms: int) -> str:
1292-
1293-
command = f"TTL X={channel} P={pulse_width_ms} D={delay_ms}"
1294-
self.send_command(command)
1295-
response = self.read_response()
1296-
return response
1297-
1298-
# def trigger_acquisition(self):
1299-
# commands = [
1300-
# #Changes the TTL input from cell 2 to cell 6, For I am the LORD
1301-
# '6 m e = 43',
1302-
# '6 cca z = 6',
1303-
# ]
1304-
# for command in commands:
1305-
# # Send data
1306-
# self.send_command(f'{command}\r')
1307-
# self.read_response()
1308-

0 commit comments

Comments
 (0)