Client¶
The Mef3Client provides a high-level, Pythonic interface to the MEF3 gRPC
server. For a task-oriented walkthrough see the
Python client guide.
mef3io_server.client ¶
Mef3Client ¶
Mef3Client(address='localhost:50052')
Client for interacting with the MEF3 gRPC server.
Every data call is oriented purely in channels and time: open a file,
inspect its metadata (channel names, per-channel sampling rates and
per-channel start/end timestamps via :meth:get_file_info), then read any
channels over any [start_uutc, end_uutc) window with
:meth:get_signal_range.
Example::
client = Mef3Client("localhost:50052")
client.open_file("/path/to/file.mefd")
info = client.get_file_info("/path/to/file.mefd")
data = client.get_signal_range("/path/to/file.mefd",
info["channel_names"][:4],
info["start_uutc"],
info["start_uutc"] + 60_000_000)
client.shutdown()
Initialize the Mef3Client and connect to the gRPC server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
Address of the gRPC server (default: "localhost:50052"). |
'localhost:50052'
|
open_file ¶
open_file(file_path)
Open a MEF3 file on the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the MEF3 file. |
required |
Returns: dict: File info including file_path, file_opened, number_of_channels, channel_names, etc.
close_file ¶
close_file(file_path)
Close a MEF3 file on the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the MEF3 file. |
required |
Returns: dict: Contains file_path and file_opened status.
get_file_info ¶
get_file_info(file_path)
Get metadata for an open MEF3 file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the MEF3 file. |
required |
Returns:
dict: File metadata -- channel_names, channel_sampling_rates,
channel_start_uutc and channel_end_uutc (parallel per-channel
lists), plus the global start_uutc/end_uutc/duration_s.
get_signal_range ¶
get_signal_range(file_path, channels, start_uutc, end_uutc)
Read arbitrary channels over an arbitrary [start_uutc, end_uutc) window.
This is the server's data-access method -- every read is oriented in channels and time. The server serves the data from its per-channel tile cache (reading only what is missing, decoding missing tiles in parallel across worker processes) and prefetches neighboring windows for smooth forward/backward paging.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the MEF3 file. |
required |
channels
|
list[str] or None
|
Channels to read. |
required |
start_uutc
|
int
|
Inclusive window start in microseconds (uUTC). |
required |
end_uutc
|
int
|
Exclusive window end in microseconds (uUTC). |
required |
Returns:
| Type | Description |
|---|---|
dict
|
A dict with keys |
list_open_files ¶
list_open_files()
List all currently open MEF3 files on the server.
Returns:
| Type | Description |
|---|---|
list
|
List of file paths for open files. |