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

Method getIQDataBlockFromBlob

client/src/api/iqdata/BlobClient.ts:72–96  ·  view source on GitHub ↗
(
    blobClient: AzureBlobClient,
    meta: SigMFMetadata,
    index: number,
    count: number,
    blockSize: number,
    signal: AbortSignal
  )

Source from the content-addressed store, hash-verified

70 }
71
72 async getIQDataBlockFromBlob(
73 blobClient: AzureBlobClient,
74 meta: SigMFMetadata,
75 index: number,
76 count: number,
77 blockSize: number,
78 signal: AbortSignal
79 ): Promise<IQDataSlice[]> {
80 const bytesPerSample = meta.getBytesPerIQSample();
81 const offsetBytes = index * blockSize * bytesPerSample;
82 const countBytes = blockSize * count * bytesPerSample;
83 // This is ugly but it is the only way to get the blob as an ArrayBuffer
84 const download = await blobClient.download(offsetBytes, countBytes, {
85 abortSignal: signal,
86 });
87 const blobBody = await (await download.blobBody).arrayBuffer();
88 const iqArray = convertToFloat32(blobBody, meta.getDataType());
89 const iqBlocks: IQDataSlice[] = [];
90 for (let i = 0; i < count; i++) {
91 const offset = i * blockSize * 2;
92 const iqBlock = iqArray.slice(offset, offset + blockSize * 2);
93 iqBlocks.push({ index: index + i, iqArray: iqBlock });
94 }
95 return iqBlocks;
96 }
97}

Callers 1

getIQDataBlocksMethod · 0.95

Calls 3

convertToFloat32Function · 0.90
getBytesPerIQSampleMethod · 0.80
getDataTypeMethod · 0.80

Tested by

no test coverage detected