@@ -56,13 +56,10 @@ def test_set_muls_at_angle(inputs, expected):
5656 assert actual_muls_sorted == pytest .approx (expected_muls_sorted , rel = 1e-4 , abs = 1e-6 )
5757
5858
59- def _instantiate_test_do (mocker , yarray , name = "test" , scat_quantity = "x-ray" ):
60- mocker_xarray = np .array ([90 , 90.1 , 90.2 ])
61- mocker .patch ("diffpy.labpdfproc.functions.N_POINTS_ON_DIAMETER" , 4 )
62- mocker .patch ("diffpy.labpdfproc.functions.TTH_GRID" , mocker_xarray )
59+ def _instantiate_test_do (xarray , yarray , name = "test" , scat_quantity = "x-ray" ):
6360 test_do = Diffraction_object (wavelength = 1.54 )
6461 test_do .insert_scattering_quantity (
65- mocker_xarray ,
62+ xarray ,
6663 yarray ,
6764 "tth" ,
6865 scat_quantity = scat_quantity ,
@@ -73,11 +70,15 @@ def _instantiate_test_do(mocker, yarray, name="test", scat_quantity="x-ray"):
7370
7471
7572def test_compute_cve (mocker ):
76- input_pattern = _instantiate_test_do (mocker , yarray = np .array ([1 , 1 , 1 ]))
73+ xarray , yarray = np .array ([90 , 90.1 , 90.2 ]), np .array ([2 , 2 , 2 ])
74+ expected_cve = np .array ([0.5 , 0.5 , 0.5 ])
75+ mocker .patch ("diffpy.labpdfproc.functions.TTH_GRID" , xarray )
76+ mocker .patch ("numpy.interp" , return_value = expected_cve )
77+ input_pattern = _instantiate_test_do (xarray , yarray )
7778 actual_abdo = compute_cve (input_pattern , mud = 1 , wavelength = 1.54 )
7879 expected_abdo = _instantiate_test_do (
79- mocker ,
80- yarray = np . array ([ 2.49717 , 2.49706 , 2.49695 ]) ,
80+ xarray ,
81+ expected_cve ,
8182 name = "absorption correction, cve, for test" ,
8283 scat_quantity = "cve" ,
8384 )
0 commit comments