Skip to content

Commit 96ba060

Browse files
update with updated wavelength function
1 parent d3adca2 commit 96ba060

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

src/diffpy/labpdfproc/tests/test_tools.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def _preprocess_args(args):
297297
args = load_user_info(args)
298298
args = set_input_lists(args)
299299
args.output_directory = set_output_directory(args)
300-
args.wavelength = set_wavelength(args)
300+
args = set_wavelength(args)
301301
args = load_user_metadata(args)
302302
return args
303303

@@ -307,8 +307,6 @@ def test_load_metadata(mocker, user_filesystem):
307307
cli_inputs = [
308308
"2.5",
309309
".",
310-
"--wavelength",
311-
"1.54",
312310
"--user-metadata",
313311
"key=value",
314312
"--username",
@@ -323,8 +321,8 @@ def test_load_metadata(mocker, user_filesystem):
323321
expected_metadata = {
324322
"mud": 2.5,
325323
"input_directory": str(filepath),
326-
"anode_type": "Cu",
327-
"wavelength": 1.54,
324+
"anode_type": "Mo",
325+
"wavelength": 0.71,
328326
"output_directory": str(Path.cwd().resolve()),
329327
"xtype": "tth",
330328
"key": "value",

src/diffpy/labpdfproc/tools.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,18 +217,9 @@ def load_package_info(args):
217217
return args
218218

219219

220-
def _set_anode_type(args):
221-
if args.wavelength in WAVELENGTHS.values():
222-
args.anode_type = next(key for key, value in WAVELENGTHS.items() if value == args.wavelength)
223-
else:
224-
delattr(args, "anode_type")
225-
return args
226-
227-
228220
def load_metadata(args, filepath):
229221
"""
230-
Load metadata from args,
231-
except for anode type if wavelength does not match, and do not load output_correction or force_overwrite
222+
Load relevant metadata from args
232223
233224
Parameters
234225
----------
@@ -237,10 +228,9 @@ def load_metadata(args, filepath):
237228
238229
Returns
239230
-------
240-
A dictionary with all arguments from the parser
231+
A dictionary with relevant arguments from the parser
241232
"""
242233

243-
args = _set_anode_type(args)
244234
metadata = vars(args)
245235
for key in METADATA_KEYS_TO_EXCLUDE:
246236
metadata.pop(key, None)

0 commit comments

Comments
 (0)