19 lines
718 B
Python
19 lines
718 B
Python
from pathlib import Path
|
|
import pandas as pd
|
|
import numpy as np
|
|
|
|
samp_np = 10395
|
|
missing_second = 11495+11463-6300
|
|
missing_length = 17.29-2.81
|
|
fs = 500
|
|
missging_bcg = Path(rf"E:\code\DataCombine2023\ZD5Y2\OrgBCG_Text\{samp_np}\OrgBCG_Raw_500.txt")
|
|
|
|
bcg_data = pd.read_csv(missging_bcg, header=None).to_numpy().reshape(-1)
|
|
miss_start = int(missing_second * fs)
|
|
bcg_data_filled = np.concatenate([bcg_data[:miss_start],
|
|
np.full(int(missing_length * fs), np.mean(bcg_data)),
|
|
bcg_data[miss_start:]])
|
|
|
|
output_path = Path(rf"E:\code\DataCombine2023\ZD5Y2\OrgBCG_Text\{samp_np}\OrgBCG_Raw_500_filled.txt")
|
|
np.savetxt(output_path, bcg_data_filled, fmt="%d")
|