1+ from pathlib import Path
2+
13import numpy
2- from helper import run_multi_contribution_example , run_ni_example
34
45from diffpy .apps .refinebase .refinement_session import RefinementSession
6+ from helper import run_multi_contribution_example , run_ni_example
7+
8+ _DATA_DIR = Path (__file__ ).parent / "data"
59
610
711def test_refine_sine (sine_profile ):
@@ -42,7 +46,7 @@ def test_refine_ni():
4246 # obtained using diffpy.srfit script
4347 session = RefinementSession ()
4448 session .add_profile_from_file (
45- profile_name = "ni_profile" , profile_path = "tests/data/ Ni.gr"
49+ profile_name = "ni_profile" , profile_path = str ( _DATA_DIR / " Ni.gr")
4650 )
4751 session .set_profile_calculation_range (
4852 profile_name = "ni_profile" ,
@@ -56,7 +60,7 @@ def test_refine_ni():
5660 )
5761 session .add_pdf_model (
5862 model_name = "pdf" ,
59- structure_file_path = "tests/data/ Ni.cif" ,
63+ structure_file_path = str ( _DATA_DIR / " Ni.cif") ,
6064 )
6165 session .constrain_pdf_model_space_group_symmetry (
6266 model_name = "pdf" , space_group = "Fm-3m"
@@ -149,29 +153,28 @@ def test_refine_ni():
149153def test_refine_multi_contribution ():
150154 session = RefinementSession ()
151155 session .add_profile_from_file (
152- profile_path = "tests/data/ ni-q27r60-xray.gr" ,
156+ profile_path = str ( _DATA_DIR / " ni-q27r60-xray.gr") ,
153157 profile_name = "ni_xray" ,
154158 )
155159 session .add_profile_from_file (
156- profile_path = "tests/data/ ni-q27r100-neutron.gr" ,
160+ profile_path = str ( _DATA_DIR / " ni-q27r100-neutron.gr") ,
157161 profile_name = "ni_neutron" ,
158162 )
159163 session .add_profile_from_file (
160- profile_path = "tests/data/ si-q27r60-xray.gr" ,
164+ profile_path = str ( _DATA_DIR / " si-q27r60-xray.gr") ,
161165 profile_name = "si_xray" ,
162166 )
163167 session .add_profile_from_file (
164- profile_path = "tests/data/ si90ni10-q27r60-xray.gr" ,
168+ profile_path = str ( _DATA_DIR / " si90ni10-q27r60-xray.gr") ,
165169 profile_name = "total_xray" ,
166170 )
167171 session .set_profile_calculation_range (profile_name = "ni_xray" , xmax = 20 )
168172 session .set_profile_calculation_range (profile_name = "ni_neutron" , xmax = 20 )
169173 session .set_profile_calculation_range (profile_name = "si_xray" , xmax = 20 )
170174 session .set_profile_calculation_range (profile_name = "total_xray" , xmax = 20 )
171175 session .add_pdf_model (
172- structure_file_path = "tests/data/ni .cif" ,
176+ structure_file_path = str ( _DATA_DIR / "Ni .cif") ,
173177 model_name = "pdf_ni" ,
174- # structure_lib="PyObjcryst",
175178 )
176179 session .constrain_pdf_model_space_group_symmetry ("pdf_ni" )
177180 session .add_pdf_model (
@@ -183,7 +186,7 @@ def test_refine_multi_contribution():
183186 model_name = "pdf_ni_partial" ,
184187 )
185188 session .add_pdf_model (
186- structure_file_path = "tests/data/ si.cif" ,
189+ structure_file_path = str ( _DATA_DIR / " si.cif") ,
187190 model_name = "pdf_si" ,
188191 structure_lib = "PyObjcryst" ,
189192 )
0 commit comments