Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include versioneer.py
include pyxray/_version.py
include pyxray/data/*.asc
include pyxray/data/*.csv
include pyxray/data/*.txt
recursive-include tests *.py
exclude pyxray/data/cache
exclude pyxray/data/*.sql
16,364 changes: 16,364 additions & 0 deletions pyxray/data/ElamDB12.txt

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions pyxray/data/shelldata.csv

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions pyxray/parser/chantler2005.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env python
"""
Parser for the NIST FFAST database compiled by Chantler C. T., et.al.
"""

# Standard library modules.
import logging
import os
import pkgutil

# Third party modules.


# Local modules.
import pyxray.parser.base as base
from pyxray.descriptor import Reference, Element
from pyxray.property import (
ElementAtomicWeight,
ElementMassDensity,
AtomicSubshellBindingEnergy,
)

# Globals and constants variables.
logger = logging.getLogger(__name__)

CHANTLER2005 = Reference(
"chantler2005",
author="Chantler, C.T. and Olsen, K. and Dragoset, R.A. and Chang, J. and Kishore, A.R. and Kotochigova, S.A. and "
"Zucker, D.S.",
year="2005",
title="X-Ray Form Factor, Attenuation, and Scattering Tables (version 2.1)",
publisher="National Institute of Standards and Technology, Gaithersburg, MD, USA",
doi="10.18434/T4HS32",
howpublished="Online",
url="http://physics.nist.gov/ffast",
)

_SUBSHELLS = [
base.K,
base.L1,
base.L2,
base.L3,
base.M1,
base.M2,
base.M3,
base.M4,
base.M5,
base.N1,
base.N2,
base.N3,
base.N4,
base.N5,
base.N6,
base.N7,
base.O1,
base.O2,
base.O3,
base.O4,
base.O5,
base.P1,
base.P2,
base.P3,
]

_NUM_SUBSHELLS = 24


class Chantler2005Parser(base._Parser):
def __iter__(self):
relpath = os.path.join("..", "data", "shelldata.csv")
content = pkgutil.get_data(__name__, relpath).decode("utf8")

rows = content.splitlines()
n_rows = len(rows)

for z in range(1, len(rows)):
row = [item.strip() for item in rows[z].split(",")]
element = Element(z)

prop = ElementAtomicWeight(CHANTLER2005, element, float(row[0]))
logger.debug(f"Parsed: {prop}")
yield prop

prop = ElementMassDensity(CHANTLER2005, element, float(row[2]) * 1e3)
logger.debug(f"Parsed: {prop}")
yield prop

for i in range(_NUM_SUBSHELLS):
value = row[i + 7]
if value:
prop = AtomicSubshellBindingEnergy(
CHANTLER2005, element, _SUBSHELLS[i], float(value)
)
logger.debug(f"Parsed: {prop}")
yield prop

self.update(int(z / n_rows * 100))
Loading