From 1dc69723401c2c6808cb7325c82763ccb8e5d8a0 Mon Sep 17 00:00:00 2001 From: yucongalicechen Date: Wed, 5 Feb 2025 14:11:12 -0500 Subject: [PATCH] fix: removed mu*D requirement for one of the error msg --- src/diffpy/labpdfproc/tools.py | 10 ++++------ tests/test_tools.py | 7 +++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/diffpy/labpdfproc/tools.py b/src/diffpy/labpdfproc/tools.py index 3a629b9..3850673 100644 --- a/src/diffpy/labpdfproc/tools.py +++ b/src/diffpy/labpdfproc/tools.py @@ -175,8 +175,7 @@ def set_wavelength(args): ValueError Raised if: (1) neither wavelength or anode type is provided, - and either mu*D needs to be looked up or - xtype is not the two-theta grid, + and xtype is not the two-theta grid, (2) both are provided, (3) anode_type is not one of the known sources, (4) wavelength is non-positive. @@ -188,11 +187,10 @@ def set_wavelength(args): """ # first load values from config file if args.wavelength is None and args.anode_type is None: - # either mu*D needs to be looked up or - # xtype is not the two-theta grid - if args.mud is None or args.xtype not in ANGLEQUANTITIES: + if args.xtype not in ANGLEQUANTITIES: raise ValueError( - f"Please provide a wavelength or anode type. " + f"Please provide a wavelength or anode type " + f"because the independent variable axis is not on two-theta. " f"Allowed anode types are {*known_sources, }." ) elif args.wavelength is not None and args.anode_type is not None: diff --git a/tests/test_tools.py b/tests/test_tools.py index 74e7394..e6f2269 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -257,14 +257,13 @@ def test_set_wavelength(inputs, expected): @pytest.mark.parametrize( "inputs, expected_error_msg", [ - ( # C1.1: nothing passed in, xtype is not on tth + ( # C1: nothing passed in, xtype is not on tth # expect error asking for either wavelength or anode type ["--xtype", "q"], - f"Please provide a wavelength or anode type. " + f"Please provide a wavelength or anode type " + f"because the independent variable axis is not on two-theta. " f"Allowed anode types are {*known_sources, }.", ), - # C1.2: nothing passed in, need to look up mu*D - # expect error asking for either wavelength or anode type ( # C2: both wavelength and anode type were specified # expect error asking not to specify both ["--wavelength", "0.7", "--anode-type", "Mo"],