|
3 | 3 | import argparse |
4 | 4 | import subprocess |
5 | 5 | import pandas as pd |
| 6 | +from sympy import deg |
6 | 7 |
|
7 | 8 |
|
8 | 9 | def judgeValue(value: str): |
9 | 10 | ret = None |
10 | 11 | fl = re.compile('[0-9]+\.[0-9]+') |
11 | | - hkl = re.compile('[0-9]+\s[0-9]+\s[0-9]') |
| 12 | + hkl = re.compile('-?[0-9]+\s-?[0-9]+\s-?[0-9]') |
12 | 13 | if fl.match(value): |
13 | 14 | ret = 'float' |
14 | 15 | elif hkl.match(value): |
@@ -57,7 +58,7 @@ def pdf2csv(pdfpath: str, outpath: str, zeroPadding: bool): |
57 | 58 | outputName = os.path.join(outpath, basenameWoExt + '.csv') |
58 | 59 |
|
59 | 60 | passExpressions = re.compile( |
60 | | - '^[0-9]+\.[0-9]+$|^[0-9]+$|^[0-9]+\s[0-9]+\s[0-9]+$') |
| 61 | + '^[0-9]+\.[0-9]+$|^[0-9]+$|^-?[0-9]+\s-?[0-9]+\s-?[0-9]+$') |
61 | 62 | values = sub.stdout.decode('utf-8').split('\n') |
62 | 63 | values = filter(lambda x: passExpressions.match(x), values) |
63 | 64 | values = list(map(lambda x: [x, judgeValue(x)], values)) |
@@ -97,6 +98,8 @@ def pdf2csv(pdfpath: str, outpath: str, zeroPadding: bool): |
97 | 98 | intensities = list(map(lambda x: float(x[0]), intensities)) |
98 | 99 | hkls = list(map(lambda x: x[0], hkls)) |
99 | 100 | data = [] |
| 101 | + print(len(degrees), len(dValues), len(intensities), len(hkls)) |
| 102 | + print(hkls) |
100 | 103 | for i in range(len(degrees)): |
101 | 104 | data.append([degrees[i], dValues[i], intensities[i], hkls[i]]) |
102 | 105 |
|
|
0 commit comments