MCPcopy Create free account
hub / github.com/IQEngine/IQEngine / get_from_samples_cloud

Function get_from_samples_cloud

plugins/src/samples.py:47–72  ·  view source on GitHub ↗
(samples_cloud: SamplesCloud)

Source from the content-addressed store, hash-verified

45
46
47async def get_from_samples_cloud(samples_cloud: SamplesCloud) -> np.ndarray:
48 blob_client = get_blob(
49 samples_cloud.account_name,
50 samples_cloud.container_name,
51 samples_cloud.file_path,
52 samples_cloud.sas_token,
53 )
54
55 if samples_cloud.byte_length:
56 download_stream = await asyncio.to_thread(
57 blob_client.download_blob,
58 samples_cloud.byte_offset,
59 samples_cloud.byte_length,
60 )
61 else:
62 # TODO: This is timing out, we need to find an asychronus way of
63 # processing the file without blocking a successful response
64 download_stream = await asyncio.to_thread(blob_client.download_blob)
65
66 buffer = np.frombuffer(
67 io.BytesIO(download_stream.readall()).read(),
68 dtype=data_mapping[samples_cloud.data_type],
69 )
70 buffer = get_float32_buffer(buffer)
71
72 return buffer.view(dtype=np.complex64)
73
74
75def get_float32_buffer(buffer: np.ndarray):

Callers 1

runFunction · 0.90

Calls 3

get_blobFunction · 0.85
get_float32_bufferFunction · 0.85
readallMethod · 0.80

Tested by

no test coverage detected