Created
December 17, 2021 12:13
-
-
Save ialexpovad/68833b1dc5933deb0347ccb42c228d33 to your computer and use it in GitHub Desktop.
[GranScannerMeanSTD.py] Алгоритм позволяет определить среднее значение изменяющегося положения пика и СКО полученного массива данных.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path = r'd:\ATOMTEX\trash' | |
import statistics | |
from chardet.universaldetector import UniversalDetector | |
namefile = 'GranScannerWebViewer.txt' | |
enc = UniversalDetector() | |
with open(path + f'\{namefile}', 'rb') as flop: | |
for line in flop: | |
enc.feed(line) | |
if enc.done: | |
break | |
enc.close() | |
granscan = open(path + f'\{namefile}', 'r', encoding='utf-8') | |
# data = file.read() | |
lines = granscan.readlines() | |
result = [] | |
for x in lines: | |
result.append(x.split(' ')) | |
granscan.close() | |
Lisdata = [] | |
peack = [] | |
for index in range(len(result)): | |
if index >= 9: | |
if index == 609: | |
break | |
Lisdata.append(result[index]) | |
for item in Lisdata: | |
peack.append(int(item[4])) | |
Mean = statistics.mean(peack) | |
CKO = statistics.stdev(peack) | |
if __name__ == '__main__': | |
print('Среднее значение ПП =', | |
round(statistics.mean(peack), 3)) | |
print("СКО =", | |
round(statistics.stdev(peack), 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment