examples/a121/record_data/barebones.py

examples/a121/record_data/barebones.py#

 1# Copyright (c) Acconeer AB, 2022-2023
 2# All rights reserved
 3
 4from acconeer.exptool import a121
 5
 6
 7# Client creation
 8client = a121.Client.open(ip_address="192.168.0.1")
 9
10# Session setup, just like the other examples.
11config = a121.SessionConfig()
12client.setup_session(config)
13
14
15# Here we specify the file name for the H5Recorder.
16# The H5Recorder is an object that saves frames directly to a H5-file.
17filename = "data.h5"
18
19# Here we create and attach a H5Recorder to the Client.
20# The H5Recorder will sample all frames retrieved in the client.
21# Once the "with"-block have been exited, the H5Recorder will
22# wrap up and close the file.
23with a121.H5Recorder(filename, client):
24    client.start_session()
25
26    n = 10
27    for i in range(n):
28        # Client will send its Results to the H5Recorder.
29        client.get_next()
30        print(f"Result {i + 1}/{n} was sampled")
31
32    client.stop_session()
33
34client.close()
35
36with a121.open_record(filename) as record:
37    print(record)

View this example on GitHub: acconeer/acconeer-python-exploration