(meta: SigMFMetadata, signal: AbortSignal)
| 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, |
nothing calls this directly
no test coverage detected