Q3D-Calibration/main.py

34 lines
814 B
Python
Raw Normal View History

2022-07-08 21:21:48 +08:00
import os
import re
import numpy as np
from tqdm import tqdm
from qdx import BindFilter, Bind
binds = []
BF = BindFilter()
path = 'result/bind'
file_list = os.listdir(path)
2022-07-11 09:18:23 +08:00
reg = re.compile(r'(([0-9]{4})-([0-9])-([0-9])).txt')
2022-07-08 21:21:48 +08:00
pbar = tqdm(desc="Gaussian Mixture Bind Filter", total=len(file_list))
for file in file_list:
name, E, n, m = reg.match(file).groups()
file = os.path.join(path, file)
2022-07-11 09:18:23 +08:00
BF.filter(file)
# BF.draw('result/GMM/' + name + '.png')
# np.savetxt('result/bind-GMM/' + name + '.txt', BF.fit_data, fmt='%d')
2022-07-08 21:21:48 +08:00
binds.append(Bind(int(E), int(n), int(m), BF.fit_data))
pbar.update(1)
2022-07-11 09:18:23 +08:00
pbar.close()
2022-07-08 21:21:48 +08:00
2022-07-11 09:18:23 +08:00
pbar = tqdm(desc="Bind Linear Fit", total=len(binds))
for bind in binds:
bind.fit()
bind.draw('result/L-FIT/' + bind.name + '.png')
pbar.update(1)
2022-07-08 21:21:48 +08:00
pbar.close()