Skip to content

Commit 8bf046c

Browse files
committed
Enable test_hydrogenic_phixs()
1 parent b69797b commit 8bf046c

File tree

1 file changed

+48
-58
lines changed

1 file changed

+48
-58
lines changed

artisatomic/test_artisatomic.py

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -47,61 +47,51 @@ def test_score_config_match():
4747
assert score_config_match("3d5 (2D ) 4p v3Po", "3d5(b2D)4p_3Po") == 98
4848

4949

50-
def get_maxabs_elratio(a1, a2):
51-
ratio = np.divide(a1, a2)
52-
maxabsratio = ratio.max() - 1.0
53-
maxabsratio = max(maxabsratio, 1 - ratio.min())
54-
return maxabsratio
55-
56-
57-
# tests below are disabled because the atomic data needs to be downloaded and extracted somehow
58-
59-
# def test_hydrogenic_phixs():
60-
# import artisatomic.readhillierdata as rhd
61-
# rhd.read_hyd_phixsdata()
62-
#
63-
# lambda_angstrom = rhd.hc_in_ev_angstrom / (1.0 * u.rydberg.to('eV'))
64-
# expected_n1 = np.array([
65-
# [1.0, 6.30341644],
66-
# [1.1, 4.88284569],
67-
# [1.21, 3.77314939],
68-
# [1.331, 2.90845266],
69-
# [1.4641, 2.23644386],
70-
# [1.61051, 1.71560775],
71-
# [1.771561, 1.31303106],
72-
# [1.9487171, 1.00268611],
73-
# [2.1435888, 0.76405918],
74-
# [2.35794768, 0.58102658]])
75-
#
76-
# phixstable_nl = rhd.get_hydrogenic_nl_phixstable(lambda_angstrom, 1, 0, 0)
77-
# assert get_maxabs_elratio(expected_n1, phixstable_nl[:10]) <= 0.01
78-
#
79-
# phixstable_n = rhd.get_hydrogenic_n_phixstable(lambda_angstrom, 1)
80-
# assert get_maxabs_elratio(expected_n1, phixstable_n[:10]) <= 0.01
81-
#
82-
# lambda_angstrom = rhd.hc_in_ev_angstrom / (5 ** 2 * u.rydberg.to('eV'))
83-
# expected_n5 = np.array([
84-
# [2.50000000e+01, 5.91880525e-02],
85-
# [2.75000000e+01, 4.48991991e-02],
86-
# [3.02500000e+01, 3.40407216e-02],
87-
# [3.32750000e+01, 2.57948374e-02],
88-
# [3.66024999e+01, 1.95370282e-02],
89-
# [4.02627499e+01, 1.47907913e-02],
90-
# [4.42890249e+01, 1.11930170e-02],
91-
# [4.87179274e+01, 8.46718091e-03],
92-
# [5.35897201e+01, 6.40292666e-03],
93-
# [5.89486921e+01, 4.84036618e-03]])
94-
# phixstable_nl = rhd.get_hydrogenic_nl_phixstable(lambda_angstrom, 5, 0, 4)
95-
# assert get_maxabs_elratio(expected_n5, phixstable_nl[:10]) <= 0.01
96-
#
97-
# phixstable_n = rhd.get_hydrogenic_n_phixstable(lambda_angstrom, 5)
98-
# assert get_maxabs_elratio(expected_n5, phixstable_n[:10]) <= 0.01
99-
100-
# def test_artisatomic():
101-
# artisatomic.main(output_folder='testoutput', nophixs=True)
102-
103-
104-
# if __name__ == "__main__":
105-
# print('3d7b2Fe', interpret_configuration('3d7b2Fe'))
106-
# print(reduce_configuration('3d6_3P2e'))
107-
# test_hydrogenic_phixs()
50+
def test_hydrogenic_phixs():
51+
ryd_to_ev = 13.605693122994232
52+
import artisatomic.readhillierdata as rhd
53+
54+
rhd.read_hyd_phixsdata()
55+
56+
oneryd_lambda_angstrom = rhd.hc_in_ev_angstrom / ryd_to_ev
57+
expected_n1 = np.array(
58+
[
59+
[1.0, 6.30341644],
60+
[1.1, 4.88284569],
61+
[1.21, 3.77314939],
62+
[1.331, 2.90845266],
63+
[1.4641, 2.23644386],
64+
[1.61051, 1.71560775],
65+
[1.771561, 1.31303106],
66+
[1.9487171, 1.00268611],
67+
[2.1435888, 0.76405918],
68+
[2.35794768, 0.58102658],
69+
]
70+
)
71+
72+
phixstable_nl = rhd.get_hydrogenic_nl_phixstable(oneryd_lambda_angstrom, 1, 0, 0)
73+
assert np.allclose(expected_n1, phixstable_nl[:10], rtol=1e-3)
74+
75+
phixstable_n = rhd.get_hydrogenic_n_phixstable(oneryd_lambda_angstrom, 1)
76+
assert np.allclose(expected_n1, phixstable_n[:10], rtol=1e-3)
77+
78+
oneryd_lambda_angstrom = rhd.hc_in_ev_angstrom / (5**2 * ryd_to_ev)
79+
expected_n5 = np.array(
80+
[
81+
[2.50000000e01, 5.91880525e-02],
82+
[2.75000000e01, 4.48991991e-02],
83+
[3.02500000e01, 3.40407216e-02],
84+
[3.32750000e01, 2.57948374e-02],
85+
[3.66024999e01, 1.95370282e-02],
86+
[4.02627499e01, 1.47907913e-02],
87+
[4.42890249e01, 1.11930170e-02],
88+
[4.87179274e01, 8.46718091e-03],
89+
[5.35897201e01, 6.40292666e-03],
90+
[5.89486921e01, 4.84036618e-03],
91+
]
92+
)
93+
phixstable_nl = rhd.get_hydrogenic_nl_phixstable(oneryd_lambda_angstrom, 5, 0, 4)
94+
assert np.allclose(expected_n5, phixstable_nl[:10], rtol=1e-3)
95+
96+
phixstable_n = rhd.get_hydrogenic_n_phixstable(oneryd_lambda_angstrom, 5)
97+
assert np.allclose(expected_n5, phixstable_n[:10], rtol=1e-3)

0 commit comments

Comments
 (0)