Skip to content

Commit

Permalink
Merge pull request #78 from ispielma/master
Browse files Browse the repository at this point in the history
Update to fix AI error that sometimes appears in nidaqmx.
  • Loading branch information
dihm authored Nov 8, 2021
2 parents 737c37b + 68fc0a8 commit db02508
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions labscript_devices/NI_DAQmx/blacs_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,16 @@ def extract_measurements(self, raw_data, waits_in_use):
# We want np.floor(x) to yield the largest integer < x (not <=):
if t_end - t0 - i_end / self.buffered_rate < 2e-16:
i_end -= 1
# IBS: we sometimes find that t_end (with waits) gives a time
# after the end of acquisition. The following line
# will produce return a shorter than expected array if i_end
# is larger than the length of the array.
values = raw_data[connection][i_start : i_end + 1]
i_end = i_start + len(values) - 1 # re-measure i_end

t_i = t0 + i_start / self.buffered_rate
t_f = t0 + i_end / self.buffered_rate
times = np.linspace(t_i, t_f, i_end - i_start + 1, endpoint=True)
values = raw_data[connection][i_start : i_end + 1]
times = np.linspace(t_i, t_f, len(values), endpoint=True)
dtypes = [('t', np.float64), ('values', np.float32)]
data = np.empty(len(values), dtype=dtypes)
data['t'] = times
Expand Down

0 comments on commit db02508

Please sign in to comment.