Skip to content

Commit

Permalink
remove output load deprecation warning, fix logging getting stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
slwatkins committed May 7, 2024
1 parent 1e95476 commit f8acc16
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/splendaq/daq/_log_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __exit__(self, type, value, traceback):
chan_list = [1, 2]

for chan in chan_list:
self.DL.enable_input(chan, False) # disable inputs
self.DL.generate_waveform(chan, 'Off') # disable outputs

self.DL.relinquish_ownership()
Expand Down Expand Up @@ -162,8 +163,9 @@ def set_input_channels(self, channels, impedance="1MOhm", coupling="DC",

disable_chans = [chan not in channels for chan in chan_list]
for chan, disable in zip(chan_list, disable_chans):
if not disable:
self.DL.enable_input(chan)
if disable:
self.DL.enable_input(chan, False)
else:
ind = channels.index(chan)
self.DL.set_frontend(
channel=chan,
Expand Down Expand Up @@ -403,7 +405,7 @@ def dc_settings(dc_level=0):
'dc_level': dc_level,
}

def set_output_channel(self, channel, waveformtype, load="1MOhm",
def set_output_channel(self, channel, waveformtype, load="HiZ",
**settings):
"""
Method to turn on an output channel and generate the speicified
Expand All @@ -421,19 +423,19 @@ def set_output_channel(self, channel, waveformtype, load="1MOhm",
The waveform type to generate, must be one of 'Sine',
'Square', 'Ramp', 'Pulse', 'DC'. Can also be set to 'Off'
to turn the channel off.
load : str, optional
The load impedance to use for the output channel. For a
Moku:Pro or Moku:Lab, this must be one of '1MOhm' or
'50Ohm'. For a Moku:Go, this can only be '1MOhm'. Default
is '1MOhm'.
termination : str, optional
The waveform termination to use for the output channel.
For a Moku:Pro or Moku:Lab, this must be one of 'HiZ' or
'50Ohm'. For a Moku:Go, this can only be 'HiZ'. Default
is 'HiZ'.
settings : dict
The dictionary containing all of the settings needed for
the specified waveform type.
"""

if self._device in ["Moku:Pro", "Moku:Lab"]:
self.DL.set_output_load(channel, load)
self.DL.set_output_termination(channel, load)
self.DL.generate_waveform(
channel,
waveformtype,
Expand Down Expand Up @@ -487,12 +489,9 @@ def log_data(self, duration, savepath='./', comments='',
# Wait for the logging session to progress by sleeping 0.5sec
time.sleep(0.5)
# Get current progress percentage and check if it's complete
try:
progress = self.DL.logging_progress()
remaining_time = progress['time_remaining']
is_logging = remaining_time >= 0
except:
is_logging = False
progress = self.DL.logging_progress()
remaining_time = progress['time_remaining']
is_logging = remaining_time > 0

filenames.append(logfile['file_name'])

Expand Down

0 comments on commit f8acc16

Please sign in to comment.