Classify reference materials into their own division
Browse filesReference rows carry a formula string but no composition dictionary, so they all fell into other and never appeared beside the submissions they are meant to calibrate. The formula is now parsed with pymatgen, which handles bracketed notation that a regular expression gets wrong.
app.py
CHANGED
|
@@ -317,10 +317,27 @@ def _anchors(season):
|
|
| 317 |
"tier": a.get("tier", 1),
|
| 318 |
"axes": {k: v["points"] for k, v in (a.get("axes") or {}).items()},
|
| 319 |
"detail": {k: v["detail"] for k, v in (a.get("axes") or {}).items()},
|
|
|
|
| 320 |
"note": a.get("note", "")})
|
| 321 |
return out
|
| 322 |
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
# ์์ด์จ ๊ณจ๊ฒฉ์ด ๋ฌผ์ง์ ์ฑ์ง์ ํฌ๊ฒ ๊ฐ๋ฅธ๋ค. ๊ฐ์ ๊ณ์ด๋ผ๋ฆฌ ๊ฒฌ์ฃผ์ด์ผ ํ๋ณด์ ์์น๊ฐ ์ฝํ๋ค.
|
| 325 |
# ๋ถ๋ฌธ์ ๋๋๋ **์ ์๋ ๊ทธ๋๋ก ๋๋ค** - ์ด๋ค ์ ์ถ๋ ๋ฌดํจ๊ฐ ๋์ง ์๋๋ค.
|
| 326 |
_ANION_ORDER = ["F", "Cl", "Br", "I", "S", "Se", "O", "N", "P", "H"]
|
|
|
|
| 317 |
"tier": a.get("tier", 1),
|
| 318 |
"axes": {k: v["points"] for k, v in (a.get("axes") or {}).items()},
|
| 319 |
"detail": {k: v["detail"] for k, v in (a.get("axes") or {}).items()},
|
| 320 |
+
"division": _division_from_formula(a.get("formula", "")),
|
| 321 |
"note": a.get("note", "")})
|
| 322 |
return out
|
| 323 |
|
| 324 |
|
| 325 |
+
def _division_from_formula(f):
|
| 326 |
+
"""๊ธฐ์ค๋ฌผ์ง์๋ ์กฐ์ฑ ์ฌ์ ์ด ์๊ณ ํํ์ ๋ฌธ์์ด๋ง ์๋ค.
|
| 327 |
+
|
| 328 |
+
์ง์ ํ์ฑํ์ง ์๋๋ค - Li10Ge(PS6)2 ๊ฐ์ ๊ดํธ ํ๊ธฐ์์ ์์งํ ์ ๊ท์์ P1S6 ์
|
| 329 |
+
๋ด๋๋๋ค. ๊ทธ๋ฌ๋ฉด ์ด ๋ฌผ์ง์ด ํฉํ๋ฌผ์ด ์๋ ๊ฒ์ผ๋ก ๋ถ๋ฅ๋๋ค.
|
| 330 |
+
"""
|
| 331 |
+
if not f:
|
| 332 |
+
return "other"
|
| 333 |
+
try:
|
| 334 |
+
from pymatgen.core import Composition
|
| 335 |
+
return division_of({str(el): n for el, n
|
| 336 |
+
in Composition(f).get_el_amt_dict().items()})
|
| 337 |
+
except Exception:
|
| 338 |
+
return "other"
|
| 339 |
+
|
| 340 |
+
|
| 341 |
# ์์ด์จ ๊ณจ๊ฒฉ์ด ๋ฌผ์ง์ ์ฑ์ง์ ํฌ๊ฒ ๊ฐ๋ฅธ๋ค. ๊ฐ์ ๊ณ์ด๋ผ๋ฆฌ ๊ฒฌ์ฃผ์ด์ผ ํ๋ณด์ ์์น๊ฐ ์ฝํ๋ค.
|
| 342 |
# ๋ถ๋ฌธ์ ๋๋๋ **์ ์๋ ๊ทธ๋๋ก ๋๋ค** - ์ด๋ค ์ ์ถ๋ ๋ฌดํจ๊ฐ ๋์ง ์๋๋ค.
|
| 343 |
_ANION_ORDER = ["F", "Cl", "Br", "I", "S", "Se", "O", "N", "P", "H"]
|