Skip to content

Commit

Permalink
fix: Disable waveform normalization completely
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Dec 26, 2024
1 parent 3055ac7 commit 4a6c0b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
17 changes: 0 additions & 17 deletions frontend/src/src/helpers/seismic/getNormalizedData.tsx

This file was deleted.

12 changes: 4 additions & 8 deletions frontend/src/src/views/History/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -190,24 +189,21 @@ 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) => [
timestamp + (1000 / filteredData.length) * index,
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
]);
})
Expand Down
7 changes: 2 additions & 5 deletions frontend/src/src/workers/handleSetCharts.worker.ts
Original file line number Diff line number Diff line change
@@ -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 };

Expand All @@ -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(
Expand All @@ -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) };
}
};
Expand Down

0 comments on commit 4a6c0b1

Please sign in to comment.