diff --git a/frontend/src/src/helpers/seismic/getNormalizedData.tsx b/frontend/src/src/helpers/seismic/getNormalizedData.tsx deleted file mode 100644 index 6f43a130..00000000 --- a/frontend/src/src/helpers/seismic/getNormalizedData.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import BigNumber from "bignumber.js"; - -export const getNormalizedData = (data: number[], center: number) => { - const arrSum = data.reduce((sum, val) => { - const bigSum = new BigNumber(sum); - const bigVal = new BigNumber(val); - return bigSum.plus(bigVal).toNumber(); - }); - - const avg = new BigNumber(arrSum).dividedBy(data.length).toNumber(); - return data.map((item) => { - const bigItem = new BigNumber(item); - const bigAvg = new BigNumber(avg); - const bigCenter = new BigNumber(center); - return bigItem.minus(bigAvg).plus(bigCenter).toNumber(); - }); -}; diff --git a/frontend/src/src/views/History/index.tsx b/frontend/src/src/views/History/index.tsx index 2af7ebb4..9f42ad37 100644 --- a/frontend/src/src/views/History/index.tsx +++ b/frontend/src/src/views/History/index.tsx @@ -23,7 +23,6 @@ import { sendPromiseAlert } from "../../helpers/interact/sendPromiseAlert"; import { sendUserAlert } from "../../helpers/interact/sendUserAlert"; import { requestRestApi } from "../../helpers/request/requestRestApi"; import { FilterPassband, getFilteredCounts } from "../../helpers/seismic/getFilteredCounts"; -import { getNormalizedData } from "../../helpers/seismic/getNormalizedData"; import { asyncSleep } from "../../helpers/utils/asyncSleep"; import { CircularQueue2D } from "../../helpers/utils/CircularQueue2D"; import { getTimeString } from "../../helpers/utils/getTimeString"; @@ -190,15 +189,12 @@ const History = ({ locale }: RouterComponentProps) => { .map((item) => { const timestamp = item[0]; const channelData = item.slice(1); - const normalizedData = Float32Array.from( - getNormalizedData(Array.from(channelData), 0) - ); if (filterEnabled) { - const filteredData = getFilteredCounts(normalizedData, { + const filteredData = getFilteredCounts(Float32Array.from(channelData), { poles: 4, lowFreqCorner, highFreqCorner, - sampleRate: normalizedData.length, + sampleRate: channelData.length, passbandType: FilterPassband.BAND_PASS }); return Array.from(filteredData).map((value, index) => [ @@ -206,8 +202,8 @@ const History = ({ locale }: RouterComponentProps) => { value ]); } - return Array.from(normalizedData).map((value, index) => [ - timestamp + (1000 / normalizedData.length) * index, + return Array.from(channelData).map((value, index) => [ + timestamp + (1000 / channelData.length) * index, value ]); }) diff --git a/frontend/src/src/workers/handleSetCharts.worker.ts b/frontend/src/src/workers/handleSetCharts.worker.ts index 8056c88f..301a80fd 100644 --- a/frontend/src/src/workers/handleSetCharts.worker.ts +++ b/frontend/src/src/workers/handleSetCharts.worker.ts @@ -1,7 +1,6 @@ import { expose } from "comlink"; import { FilterPassband, getFilteredCounts } from "../helpers/seismic/getFilteredCounts"; -import { getNormalizedData } from "../helpers/seismic/getNormalizedData"; export default {} as typeof Worker & { new (): Worker }; @@ -16,7 +15,6 @@ export const api = { ) => { const timestamp = bufferData[0]; const channelData = Array.from(bufferData).slice(1); - // const normalizedData = getNormalizedData(channelData, 0); if (filterEnabled) { return Array.from( @@ -37,9 +35,8 @@ export const api = { for (const data of bufferData) { channelData.push(...Array.from(data).slice(1)); } - const normalizedData = getNormalizedData(channelData, 0); - const max = Math.max(...normalizedData); - const min = Math.min(...normalizedData); + const max = Math.max(...channelData); + const min = Math.min(...channelData); return { max: max.toFixed(0), min: min.toFixed(0) }; } };