@@ -56,13 +56,10 @@ def test_set_muls_at_angle(inputs, expected):
56
56
assert actual_muls_sorted == pytest .approx (expected_muls_sorted , rel = 1e-4 , abs = 1e-6 )
57
57
58
58
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" ):
63
60
test_do = Diffraction_object (wavelength = 1.54 )
64
61
test_do .insert_scattering_quantity (
65
- mocker_xarray ,
62
+ xarray ,
66
63
yarray ,
67
64
"tth" ,
68
65
scat_quantity = scat_quantity ,
@@ -73,11 +70,15 @@ def _instantiate_test_do(mocker, yarray, name="test", scat_quantity="x-ray"):
73
70
74
71
75
72
def 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 )
77
78
actual_abdo = compute_cve (input_pattern , mud = 1 , wavelength = 1.54 )
78
79
expected_abdo = _instantiate_test_do (
79
- mocker ,
80
- yarray = np . array ([ 2.49717 , 2.49706 , 2.49695 ]) ,
80
+ xarray ,
81
+ expected_cve ,
81
82
name = "absorption correction, cve, for test" ,
82
83
scat_quantity = "cve" ,
83
84
)
0 commit comments