Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_reset(session):
deault_fetch_relative_to = session._fetch_relative_to
assert deault_fetch_relative_to == niscope.FetchRelativeTo.PRETRIGGER
session._fetch_relative_to = niscope.FetchRelativeTo.READ_POINTER
non_default_acqusition_type = session._fetch_relative_to
assert non_default_acqusition_type == niscope.FetchRelativeTo.READ_POINTER
session.reset()
assert session._fetch_relative_to == niscope.FetchRelativeTo.PRETRIGGER
def test_reset(session):
deault_fetch_relative_to = session._fetch_relative_to
assert deault_fetch_relative_to == niscope.FetchRelativeTo.PRETRIGGER
session._fetch_relative_to = niscope.FetchRelativeTo.READ_POINTER
non_default_acqusition_type = session._fetch_relative_to
assert non_default_acqusition_type == niscope.FetchRelativeTo.READ_POINTER
session.reset()
assert session._fetch_relative_to == niscope.FetchRelativeTo.PRETRIGGER
# 3. Configuring
session.configure_horizontal_timing(min_sample_rate=sample_rate_in_hz, min_num_pts=1, ref_position=0.0, num_records=1, enforce_realtime=True)
session.channels[channel_list].configure_vertical(voltage, coupling=niscope.VerticalCoupling.DC, enabled=True)
# Configure software trigger, but never send the trigger.
# This starts an infinite acquisition, until you call session.abort() or session.close()
session.configure_trigger_software()
current_pos = 0
# 4. initiating
with session.initiate():
while current_pos < total_samples:
# We fetch each channel at a time so we don't have to de-interleave afterwards
# We do not keep the wfm_info returned from fetch_into
for channel, waveform in zip(channel_list, waveforms):
# 5. fetching - we return the slice of the waveform array that we want to "fetch into"
session.channels[channel].fetch_into(waveform[current_pos:current_pos + samples_per_fetch], relative_to=niscope.FetchRelativeTo.READ_POINTER,
offset=0, record_number=0, num_records=1, timeout=hightime.timedelta(seconds=5.0))
current_pos += samples_per_fetch