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

Method getIQDataBlocks

client/src/api/iqdata/LocalClient.ts:45–74  ·  view source on GitHub ↗
(
    meta: SigMFMetadata,
    indexes: number[],
    blockSize: number,
    signal: AbortSignal
  )

Source from the content-addressed store, hash-verified

43 }
44
45 getIQDataBlocks(
46 meta: SigMFMetadata,
47 indexes: number[],
48 blockSize: number,
49 signal: AbortSignal
50 ): Promise<IQDataSlice[]> {
51
52 const localDirectory: FileWithDirectoryAndFileHandle[] = this.files;
53 if (!localDirectory) {
54 return Promise.reject('No local directory found');
55 }
56
57 const filePath = meta.getOrigin().file_path;
58 const dataFile = localDirectory.find((file) => {
59 return file.webkitRelativePath === filePath + '.sigmf-data' || file.name === filePath + '.sigmf-data';
60 });
61 if (!dataFile) {
62 return Promise.reject('No data file found');
63 }
64
65 return Promise.all(indexes.map(async (index) => {
66 const bytesPerIQSample = meta.getBytesPerIQSample();
67 const countBytes = blockSize * bytesPerIQSample;
68 const offsetBytes = index * countBytes;
69 const slice = dataFile.slice(offsetBytes, offsetBytes + countBytes);
70 const buffer = await slice.arrayBuffer();
71 const iqArray = convertToFloat32(buffer, meta.getDataType());
72 return { index, iqArray };
73 }));
74 }
75}

Callers

nothing calls this directly

Calls 4

convertToFloat32Function · 0.90
getOriginMethod · 0.80
getBytesPerIQSampleMethod · 0.80
getDataTypeMethod · 0.80

Tested by

no test coverage detected