Skip to content

Commit 651aaf3

Browse files
author
Kyle Beyer
committed
move quantities to parsing
1 parent c3f45a2 commit 651aaf3

File tree

4 files changed

+28
-19
lines changed

4 files changed

+28
-19
lines changed

src/exfor_tools/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
from .db import __EXFOR_DB__
22
from . import reaction
33
from . import angular_distribution
4-
from .parsing import (
4+
from .parsing import (
55
parse_angle,
66
parse_inc_energy,
77
parse_ex_energy,
88
parse_differential_data,
99
parse_angular_distribution,
10+
quantities,
1011
)
1112
from .exfor_tools import (
12-
quantities,
1313
attempt_parse_subentry,
1414
get_measurements_from_subentry,
1515
sort_subentry_data_by_energy,

src/exfor_tools/exfor_tools.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,13 @@
1717
parse_angular_distribution,
1818
parse_inc_energy,
1919
parse_ex_energy,
20+
quantity_matches,
21+
quantity_symbols,
22+
unit_symbols,
23+
quantities,
2024
)
2125
from .angular_distribution import AngularDistributionSysStatErr
2226

23-
# these are the supported quantities at the moment
24-
quantity_matches = {
25-
"dXS/dA": [["DA"]],
26-
"dXS/dRuth": [["DA", "RTH"], ["DA", "RTH/REL"]],
27-
"Ay": [["POL/DA", "ANA"]],
28-
}
29-
quantities = list(quantity_matches.keys())
30-
31-
quantity_symbols = {
32-
("DA",): r"$\frac{d\sigma}{d\Omega}$",
33-
("DA", "RTH"): r"$\sigma / \sigma_{Rutherford}$",
34-
("DA", "RTH/REL"): r"$\sigma / \sigma_{Rutherford}$",
35-
("POL/DA", "ANA"): r"$A_y$",
36-
}
37-
38-
unit_symbols = {"no-dim": "unitless", "barns/ster": "b/Sr"}
39-
4027

4128
def attempt_parse_subentry(*args, **kwargs):
4229
failed_parses = {}

src/exfor_tools/parsing.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@
2323
)
2424

2525

26+
# these are the supported quantities at the moment
27+
quantity_matches = {
28+
"dXS/dA": [["DA"]],
29+
"dXS/dRuth": [["DA", "RTH"], ["DA", "RTH/REL"]],
30+
"Ay": [["POL/DA", "ANA"]],
31+
}
32+
quantities = list(quantity_matches.keys())
33+
34+
quantity_symbols = {
35+
("DA",): r"$\frac{d\sigma}{d\Omega}$",
36+
("DA", "RTH"): r"$\sigma / \sigma_{Rutherford}$",
37+
("DA", "RTH/REL"): r"$\sigma / \sigma_{Rutherford}$",
38+
("POL/DA", "ANA"): r"$A_y$",
39+
}
40+
41+
unit_symbols = {"no-dim": "unitless", "barns/ster": "b/Sr"}
2642
energyExParserList = [
2743
X4MissingErrorColumnPair(
2844
X4ColumnParser(

src/exfor_tools/reaction.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ class ElasticReaction(Reaction):
290290
:param projectile: The projectile nucleus.
291291
:param kwargs: Additional keyword arguments.
292292
"""
293+
293294
def __init__(self, target, projectile, **kwargs):
294295
super().__init__(target, projectile, "EL", target, **kwargs)
295296

@@ -302,6 +303,7 @@ class InelasticReaction(Reaction):
302303
:param projectile: The projectile nucleus.
303304
:param kwargs: Additional keyword arguments.
304305
"""
306+
305307
def __init__(self, target, projectile, **kwargs):
306308
super().__init__(target, projectile, "INL", target, **kwargs)
307309

@@ -314,6 +316,7 @@ class TotalReaction(Reaction):
314316
:param projectile: The projectile nucleus.
315317
:param kwargs: Additional keyword arguments.
316318
"""
319+
317320
def __init__(self, target, projectile, **kwargs):
318321
super().__init__(target, projectile, "TOT", None, **kwargs)
319322

@@ -326,6 +329,7 @@ class AbsorptionReaction(Reaction):
326329
:param projectile: The projectile nucleus.
327330
:param kwargs: Additional keyword arguments.
328331
"""
332+
329333
def __init__(self, target, projectile, **kwargs):
330334
super().__init__(target, projectile, "ABS", None, **kwargs)
331335

@@ -339,6 +343,7 @@ class InclusiveReaction(Reaction):
339343
:param residual: The residual nucleus.
340344
:param kwargs: Additional keyword arguments.
341345
"""
346+
342347
def __init__(self, target, projectile, residual, **kwargs):
343348
super().__init__(target, projectile, "X", residual, **kwargs)
344349

@@ -351,6 +356,7 @@ class GammaCaptureReaction(Reaction):
351356
:param projectile: The projectile nucleus.
352357
:param kwargs: Additional keyword arguments.
353358
"""
359+
354360
def __init__(self, target, projectile, **kwargs):
355361
residual = target + projectile
356362
product = Gamma()

0 commit comments

Comments
 (0)