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

Method getMinimapIQ

client/src/api/iqdata/LocalClient.ts:14–43  ·  view source on GitHub ↗
(meta: SigMFMetadata, signal: AbortSignal)

Source from the content-addressed store, hash-verified

12 this.files = files;
13 }
14 async getMinimapIQ(meta: SigMFMetadata, signal: AbortSignal): Promise<Float32Array[]> {
15 const localDirectory: FileWithDirectoryAndFileHandle[] = this.files;
16 if (!localDirectory) {
17 return Promise.reject('No local directory found');
18 }
19 const skipNFfts = Math.floor(meta.getTotalSamples() / (1000 * MINIMAP_FFT_SIZE)); // sets the decimation rate (manually tweaked)
20 const numFfts = Math.floor(meta.getTotalSamples() / MINIMAP_FFT_SIZE / (skipNFfts + 1));
21 let dataRange = [];
22 for (let i = 0; i < numFfts; i++) {
23 dataRange.push(i * skipNFfts);
24 }
25 const { file_path } = meta.getOrigin();
26 const dataFile = localDirectory.find((file) => {
27 return file.webkitRelativePath === file_path + '.sigmf-data' || file.name === file_path + '.sigmf-data';
28 });
29 if (!dataFile) {
30 return Promise.reject('No data file found');
31 }
32 const result: Float32Array[] = [];
33 for (const index of dataRange) {
34 const bytesPerSample = meta.getBytesPerIQSample();
35 const offsetBytes = index * MINIMAP_FFT_SIZE * bytesPerSample;
36 const countBytes = MINIMAP_FFT_SIZE * bytesPerSample;
37 const slice = dataFile.slice(offsetBytes, offsetBytes + countBytes);
38 const buffer = await slice.arrayBuffer();
39 const iqArray = convertToFloat32(buffer, meta.getDataType());
40 result.push(iqArray);
41 }
42 return result;
43 }
44
45 getIQDataBlocks(
46 meta: SigMFMetadata,

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected