Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ synchronization using start and `*OPC?`.
# fmt: off
--8<-- "src/tekhsi/tek_hsi_connect.py:any_horizontal_change"
```
## Transmitting an acquisition made before connecting
There are cases in which you might want to connect and transfer waveforms that you have already acquired on the scope.

To do this, we provide a the [`force_sequence()`][tekhsi.TekHSIConnect.force_sequence] method.

It is important to note that this is provided for the specific case when you establish the HSI connection AFTER acquiring the data.

```python
# fmt: off
--8<-- "examples/force_sequence.py"
```

## Mixing TekHSI and PyVISA

Expand Down
17 changes: 17 additions & 0 deletions examples/force_sequence.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""A script demonstrating a way to use force_sequence to save a wfm locally"""


from tm_data_types import AnalogWaveform, write_file
from tekhsi import TekHSIConnect

addr = "192.168.0.1" # Replace with the IP address of your instrument

# Connect to instrument
with TekHSIConnect(f"{addr}:5000") as connect:
# Save a single acquisition that was made prior to connecting
connect.force_sequence()
with connect.access_data():
wfm: AnalogWaveform = connect.get_data("ch1")

# Save the waveform to a file
write_file(f"{wfm.source_name}.csv", wfm)
20 changes: 17 additions & 3 deletions src/tekhsi/tek_hsi_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,25 @@ def done_with_data(self) -> None:
self._done_with_data_release_lock()

def force_sequence(self) -> None:
"""force_sequence asks the instrument to please give us access.

to the current acquisition data. This is useful when connecting to a stopped instrument to
"""force_sequence asks the instrument to please give us access to the already acquired data.
This is useful when connecting to a stopped instrument to
get access to the currently available data. Otherwise, the API will wait until the next
acquisition.

Examples:
from tm_data_types import AnalogWaveform, write_file
from tekhsi import TekHSIConnect

addr = "192.168.0.1" # Replace with the IP address of your instrument
with TekHSIConnect(f"{addr}:5000") as connect:
# Save a single acquisition that was made prior to connecting
connect.force_sequence()
with connect.access_data():
wfm: AnalogWaveform = connect.get_data("ch1")

# Save the waveform to a file
write_file(f"{wfm.source_name}.csv", wfm)

"""
_logger.debug("force_sequence")
request = ConnectRequest(name=self.clientname)
Expand Down
Loading