Skip to content

Commit ed95e16

Browse files
Slight changes to merge into ASI Daq
1 parent 9cd9c1e commit ed95e16

File tree

1 file changed

+16
-19
lines changed
  • src/navigate/model/devices/galvo

1 file changed

+16
-19
lines changed

src/navigate/model/devices/galvo/asi.py

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(
7474
super().__init__(microscope_name, device_connection, configuration, device_id)
7575

7676
#: Any: Device connection.
77-
self.device_connection = device_connection
77+
self.galvo = device_connection
7878

7979
#: dict: Dictionary of microscope configuration parameters.
8080
self.configuration = configuration
@@ -90,9 +90,6 @@ def __init__(
9090
microscope_name
9191
]["daq"]["trigger_source"]
9292

93-
#: obj: NI DAQ device connection.
94-
# self.daq = device_connection
95-
9693
#: str: Name of the galvo.
9794
self.galvo_name = "Galvo " + str(device_id)
9895

@@ -239,16 +236,16 @@ def adjust(self, exposure_times, sweep_times):
239236
self.sawtooth(frequency, amplitude, offset)
240237

241238
elif self.galvo_waveform == "sine":
242-
frequency=galvo_frequency,
243-
amplitude=galvo_amplitude,
244-
offset=galvo_offset,
239+
frequency=galvo_frequency
240+
amplitude=galvo_amplitude
241+
offset=galvo_offset
245242

246243
self.sine_wave(frequency, amplitude, offset)
247244

248245
elif self.galvo_waveform == "halfsaw":
249-
frequency=galvo_frequency,
250-
amplitude=galvo_amplitude,
251-
offset=galvo_offset,
246+
frequency=galvo_frequency
247+
amplitude=galvo_amplitude
248+
offset=galvo_offset
252249

253250
self.half_saw(frequency, amplitude, offset)
254251
else:
@@ -278,8 +275,8 @@ def sawtooth(
278275
amplitude *= 1000
279276
offset *= 1000
280277

281-
self.device_connection.SA_waveform(self.axis, 0, amplitude, offset, period)
282-
self.device_connection.SAM(self.axis, 4)
278+
self.galvo.SA_waveform(self.axis, 128, amplitude, offset, period)
279+
self.galvo.SAM(self.axis, 4)
283280

284281
# need to adjust it so it only runs for the duration of the sweep time
285282
# do we want to do anything with duty cycle or phase, or accept that as a limitation
@@ -322,8 +319,8 @@ def sine_wave(
322319
amplitude *= 1000
323320
offset *= 1000
324321

325-
self.device_connection.SA_waveform(self.axis, 3, amplitude, offset, period)
326-
self.device_connection.SAM(self.axis, 4)
322+
self.galvo.SA_waveform(self.axis, 131, amplitude, offset, period)
323+
self.galvo.SAM(self.axis, 4)
327324

328325
# need to adjust it so it only runs for the duration of the sweep time
329326
# do we want to do anything with phase, or accept that as a limitation
@@ -360,23 +357,23 @@ def half_saw(
360357
amplitude *= 1000/2
361358
offset *= 1000
362359

363-
self.device_connection.SA_waveform(self.axis, 128, amplitude, offset, period)
360+
self.galvo.SA_waveform(self.axis, 128, amplitude, offset, period)
364361
time.sleep(1/frequency)
365-
self.device_connection.SAM(self.axis, 2)
362+
self.galvo.SAM(self.axis, 2)
366363

367364
def turn_off(self):
368365
"""Stops the galvo waveform"""
369-
self.device_connection.SAM(self.axis, 0)
366+
self.galvo.SAM(self.axis, 0)
370367

371368
def close(self):
372369
"""Close the ASI galvo serial port.
373370
374371
Stops the remote focus waveform and then closes the port.
375372
"""
376-
if self.device_connection.is_open():
373+
if self.galvo.is_open():
377374
self.turn_off()
378375
logger.debug("ASI Remote Focus - Closing Device.")
379-
self.device_connection.disconnect_from_serial()
376+
self.galvo.disconnect_from_serial()
380377

381378
def __del__(self):
382379
"""Destructor for the ASIGalvo class."""

0 commit comments

Comments
 (0)