Skip to content

Commit 6b31a90

Browse files
committed
tweaking help messages in parser for wavelengths
1 parent bac589d commit 6b31a90

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/diffpy/labpdfproc/labpdfprocapp.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
from pathlib import Path
44

55
from diffpy.labpdfproc.functions import apply_corr, compute_cve
6-
from diffpy.labpdfproc.tools import set_wavelength
6+
from diffpy.labpdfproc.tools import known_sources, set_wavelength
77
from diffpy.utils.parsers.loaddata import loadData
88
from diffpy.utils.scattering_objects.diffraction_objects import XQUANTITIES, Diffraction_object
99

10-
WAVELENGTHS = {"Mo": 0.71, "Ag": 0.59, "Cu": 1.54}
11-
known_sources = [key for key in WAVELENGTHS.keys()]
12-
1310

1411
def get_args():
1512
p = ArgumentParser()
1613
p.add_argument("mud", help="Value of mu*D for your " "sample. Required.", type=float)
1714
p.add_argument("-i", "--input-file", help="The filename of the " "datafile to load")
1815
p.add_argument(
19-
"-a", "--anode-type", help=f"X-ray source, allowed " f"values: {*[known_sources], }", default="Mo"
16+
"-a",
17+
"--anode-type",
18+
help=f"The type of the x-ray source. Allowed values are "
19+
f"{*[known_sources], }. Either specify a known x-ray source or specify wavelength",
20+
default="Mo",
2021
)
2122
p.add_argument(
2223
"-w",
2324
"--wavelength",
24-
help="X-ray source wavelength. Not needed if the anode-type "
25-
"is specified. This will override the wavelength if anode "
26-
"type is specified",
25+
help="X-ray source wavelength in angstroms. Not needed if the anode-type "
26+
"is specified. This wavelength will override the anode wavelength if both are specified",
2727
default=None,
2828
type=float,
2929
)
@@ -55,7 +55,7 @@ def get_args():
5555
"-f",
5656
"--force-overwrite",
5757
action="store_true",
58-
help="outputs will not overwrite existing file unless --force is spacified",
58+
help="outputs will not overwrite existing files unless --force is spacified",
5959
)
6060
args = p.parse_args()
6161
return args

src/diffpy/labpdfproc/tests/test_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from diffpy.labpdfproc.tools import WAVELENGTHS, set_wavelength
5+
from diffpy.labpdfproc.tools import known_sources, set_wavelength
66

77
params2 = [
88
([None, None], [0.71]),
@@ -23,7 +23,7 @@ def test_set_wavelength(inputs, expected):
2323
params3 = [
2424
(
2525
[None, "invalid"],
26-
[f"Anode type not recognized. please rerun specifying an anode_type from {*WAVELENGTHS, }"],
26+
[f"Anode type not recognized. please rerun specifying an anode_type from {*known_sources, }"],
2727
),
2828
([0, None], ["No valid wavelength. Please rerun specifying a known anode_type or a positive wavelength"]),
2929
([-1, "Mo"], ["No valid wavelength. Please rerun specifying a known anode_type or a positive wavelength"]),

0 commit comments

Comments
 (0)