99@pytest .mark .parametrize (
1010 "wavelength, q, expected_tth" ,
1111 [
12- # Test conversion of q to tth with valid values
12+ # Test conversion of q to tth with q and wavelength
1313 # C1: Allow empty array q to compute tth with or without wavelength
1414 # 1. Wavelength provided, expect empty array of tth
1515 (4 * np .pi , np .empty ((0 )), np .empty (0 )),
16- # 2. No wavelength provided, expected empty tth and wavelength UserWarning
16+ # 2. No wavelength provided, expected empty array of tth and wavelength UserWarning
1717 (None , np .empty ((0 )), np .empty ((0 ))),
18- # C2: Use non-empty q values to compute tth with or without
18+ # C2: Use non-empty q values to compute tth with or without
1919 # 1. No wavelength provided, expect valid tth values in degrees with wavelength UserWarning
2020 (
2121 None ,
@@ -39,14 +39,14 @@ def test_q_to_tth(wavelength, q, expected_tth, wavelength_warning_msg):
3939@pytest .mark .parametrize (
4040 "wavelength, q, expected_error_type" ,
4141 [
42- # Test error messages in q to tth conversion with invalid Two theta values.
43- # C1: Invalid q values that result in tth > 180 degrees
42+ # Test ValeuError in q to tth conversion with invalid two- theta values.
43+ # C1: Invalid q values that result in tth > 180 degrees, expect ValueError
4444 (
4545 4 * np .pi ,
4646 np .array ([0.2 , 0.4 , 0.6 , 0.8 , 1 , 1.2 ]),
4747 ValueError ,
4848 ),
49- # C2: Wrong wavelength that results in tth > 180 degrees
49+ # C2: Wrong wavelength that results in tth > 180 degrees, expect ValueError
5050 (
5151 100 ,
5252 np .array ([0 , 0.2 , 0.4 , 0.6 , 0.8 , 1 ]),
@@ -63,18 +63,20 @@ def test_q_to_tth_bad(wavelength, q, expected_error_type, invalid_q_or_d_or_wave
6363@pytest .mark .parametrize (
6464 "wavelength, tth, expected_q" ,
6565 [
66- # C0: Empty tth values (without wavelength)
66+ # Test conversion of q to tth with q and wavelength
67+ # C1: Allow empty tth values to compute 1, with or without wavelength
68+ # 1. Wavelength provided, expect empty array of q
6769 (None , np .array ([]), np .array ([])),
68- # C1: Empty tth values (with wavelength)
70+ # 2. No wavelength provided, expected empty array of q and wavelength UserWarning
6971 (4 * np .pi , np .array ([]), np .array ([])),
70- # C2: valid tth values between 0-180 degrees (without wavelength)
72+ # C2: Use non-empty tth values between 0-180 degrees to compute q, with or without wavelength
73+ # 1. No wavelength provided, expect valid q values between 0-1
7174 (
7275 None ,
7376 np .array ([0 , 30 , 60 , 90 , 120 , 180 ]),
7477 np .array ([0 , 1 , 2 , 3 , 4 , 5 ]),
7578 ),
76- # C3: valid tth values between 0-180 degrees (with wavelength)
77- # expected q values are sin15, sin30, sin45, sin60, sin90
79+ # 2. Wavelength provided, expect expected q values are sin15, sin30, sin45, sin60, sin90
7880 (
7981 4 * np .pi ,
8082 np .array ([0 , 30.0 , 60.0 , 90.0 , 120.0 , 180.0 ]),
@@ -95,14 +97,15 @@ def test_tth_to_q(wavelength, tth, expected_q, wavelength_warning_msg):
9597@pytest .mark .parametrize (
9698 "wavelength, tth, expected_error_type, expected_error_msg" ,
9799 [
98- # C1: Invalid tth value of > 180 degrees, no wavelength, expect two theta ValueError
100+ # C1: Invalid tth value of > 180 degrees provided, with or without wavelength
101+ # 1. No wavelength provided, expect two theta ValueError
99102 (
100103 None ,
101104 np .array ([0 , 30 , 60 , 90 , 120 , 181 ]),
102105 ValueError ,
103106 "Two theta exceeds 180 degrees. Please check the input values for errors." ,
104107 ),
105- # C2: Invalid tth value of > 180 degrees with wavelength , expect two theta ValueError
108+ # 2. Wavelength provided , expect two theta ValueError
106109 (
107110 4 * np .pi ,
108111 np .array ([0 , 30 , 60 , 90 , 120 , 181 ]),
0 commit comments