measurehead 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: measurehead
3
+ Version: 0.1.0
4
+ Summary: Analizing measurement data easily
5
+ License-Expression: MIT
6
+ Author: Chuck Wheeler
7
+ Author-email: archdoodle@gmail.com
8
+ Requires-Python: >=3.15
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.15
@@ -0,0 +1,77 @@
1
+ class Measures:
2
+ from typing import Collection
3
+ def __init__(self, data:Collection[float], tool_precision:float ,title:str = "Measures", unit:str = '', index:int = 1, tab_a_title:str = '', tab_b_title:str='') -> None:
4
+ from statistics import mean, pstdev
5
+ import math
6
+ self.title = title
7
+ self.data = data
8
+ self.unit = unit
9
+ self.index = index
10
+ self.tab_a_title = tab_a_title
11
+ self.tab_b_title = tab_b_title
12
+
13
+ self.n = len(data)
14
+ self.m = mean(data)
15
+ self.s = pstdev(data)
16
+ self.d = [x - self.m for x in data]
17
+ self.ua = self.s / math.sqrt(self.n)
18
+ self.ub = tool_precision / math.sqrt(3)
19
+ self.uc = math.sqrt(self.ua ** 2 + self.ub ** 2)
20
+
21
+ def md(self):
22
+ md = f"""
23
+ ###### Tab. {self.index}a - {self.title}{f" - {self.tab_a_title}" if self.tab_a_title else ''}
24
+ """
25
+
26
+ md += """
27
+ | No. | x | d |
28
+ | -------- | -------- | -------- |
29
+ """
30
+
31
+ for i, x, d in zip(range(1,self.n+1), self.data, self.d):
32
+ md += f"| {str(i)[:8].ljust(8)} | {str(x)[:8].ljust(8)} | {str(d)[:8].ljust(8)} |\n "
33
+ md += f"""
34
+
35
+ ###### Tab. {self.index}b - {self.title}{f" - {self.tab_b_title}" if self.tab_b_title else ''}
36
+
37
+ | n | m | s | ua | ub | uc |
38
+ | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- |
39
+ |"""
40
+
41
+ md += f' {str(self.n)[:10].ljust(10)} |'
42
+ md += f' {str(self.m)[:10].ljust(10)} |'
43
+ md += f' {str(self.s)[:10].ljust(10)} |'
44
+ md += f' {str(self.ua)[:10].ljust(10)} |'
45
+ md += f' {str(self.ub)[:10].ljust(10)} |'
46
+ md += f' {str(self.uc)[:10].ljust(10)} |'
47
+
48
+ md += '''
49
+
50
+
51
+
52
+ ---
53
+
54
+
55
+ '''
56
+
57
+ md = "\n".join([line.strip() for line in md.split('\n')])
58
+ return md
59
+
60
+ def log(self):
61
+ print(self.md())
62
+
63
+ def export(self, **kwargs):
64
+ ex = self.md()
65
+ ex = ex.replace('No. ','\\(No.\\)')
66
+ ex = ex.replace('x ','\\(x\\)')
67
+ ex = ex.replace('d ','\\(d\\)')
68
+ ex = ex.replace('n ','\\(n\\)')
69
+ ex = ex.replace('m ','\\(\\bar x\\)')
70
+ ex = ex.replace('s ','\\(s\\)')
71
+ ex = ex.replace('ua ','\\(u_A\\)')
72
+ ex = ex.replace('ub ','\\(u_B\\)')
73
+ ex = ex.replace('uc ','\\(u_c\\)')
74
+ print(ex, **kwargs)
75
+
76
+ # def __dict__(self):
77
+ # pass
@@ -0,0 +1,16 @@
1
+ [project]
2
+ name = "measurehead"
3
+ version = "0.1.0"
4
+ description = "Analizing measurement data easily"
5
+ authors = [
6
+ {name = "Chuck Wheeler",email = "archdoodle@gmail.com"}
7
+ ]
8
+ license = "MIT"
9
+ requires-python = ">=3.15"
10
+ dependencies = [
11
+ ]
12
+
13
+
14
+ [build-system]
15
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
16
+ build-backend = "poetry.core.masonry.api"