Skip to content

Commit 5fecd14

Browse files
fix: updated wavelengths, workflow for loading user info
1 parent b479cf2 commit 5fecd14

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/diffpy/labpdfproc/tools.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from diffpy.utils.diffraction_objects import ANGLEQUANTITIES, QQUANTITIES, XQUANTITIES
55
from diffpy.utils.tools import check_and_build_global_config, compute_mud, get_package_info, get_user_info
66

7-
WAVELENGTHS = {"Mo": 0.71, "Ag": 0.59, "Cu": 1.54}
7+
WAVELENGTHS = {"Mo": 0.71073, "Ag": 0.55941, "Cu": 1.5406}
88
known_sources = [key for key in WAVELENGTHS.keys()]
99

1010
# Exclude wavelength from metadata to prevent duplication,
@@ -225,7 +225,8 @@ def load_user_metadata(args):
225225

226226
def load_user_info(args):
227227
"""
228-
Update username and email using get_user_info function from diffpy.utils
228+
Load user info into args. If args are not provided, call check_and_build_global_config function from
229+
diffpy.utils to prompt the user for inputs. Otherwise, call get_user_info with the provided arguments.
229230
230231
Parameters
231232
----------
@@ -237,10 +238,11 @@ def load_user_info(args):
237238
the updated argparse Namespace with username and email inserted
238239
239240
"""
240-
check_and_build_global_config()
241+
if args.username is None or args.email is None:
242+
check_and_build_global_config()
241243
config = get_user_info(owner_name=args.username, owner_email=args.email)
242-
args.username = config["owner_name"]
243-
args.email = config["owner_email"]
244+
args.username = config.get("owner_name")
245+
args.email = config.get("owner_email")
244246
return args
245247

246248

tests/test_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def test_set_output_directory_bad(user_filesystem):
150150

151151

152152
params2 = [
153-
([], [0.71, "Mo"]),
153+
([], [0.71073, "Mo"]),
154154
(["--anode-type", "Ag"], [0.59, "Ag"]),
155155
(["--wavelength", "0.25"], [0.25, None]),
156156
(["--wavelength", "0.25", "--anode-type", "Ag"], [0.25, None]),

0 commit comments

Comments
 (0)