Skip to content

Commit

Permalink
fixed broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bing Li committed Jan 16, 2025
1 parent aebe20e commit 1700c92
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 17 deletions.
Binary file modified test_data/scan_to_nexus_test.h5
Binary file not shown.
Binary file modified test_data/spice_to_nxdict_test_all.h5
Binary file not shown.
Binary file modified test_data/spice_to_nxdict_test_empty.h5
Binary file not shown.
Binary file modified test_data/spice_to_nxdict_test_scan0034.h5
Binary file not shown.
Binary file modified test_data/tavi_test_exp424.h5
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/test_cooper_nathans.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def test_copper_nathans_localQ(tas_params):
tas, ei, ef, hkl, _, r0 = tas_params

rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, projection=None, R0=r0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, projection=None, R0=r0)
mat = np.array(
[
[9583.2881, -4671.0614, -0.0000, 986.5610],
Expand All @@ -25,7 +25,7 @@ def test_copper_nathans_localQ(tas_params):
def test_copper_nathans_hkl(tas_params):
tas, ei, ef, hkl, _, r0 = tas_params

rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, R0=r0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, R0=r0)
mat = np.array(
[
[33305.0843, 33224.4963, -2651.8290, -5152.9962],
Expand All @@ -40,7 +40,7 @@ def test_copper_nathans_hkl(tas_params):
def test_copper_nathans_projection(tas_params):
tas, ei, ef, hkl, projection, r0 = tas_params

rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, projection=projection, R0=r0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, projection=projection, R0=r0)
mat = np.array(
[
[1.3306e05, -5.3037e03, -1.7660e-01, -1.0306e04],
Expand All @@ -55,7 +55,7 @@ def test_copper_nathans_projection(tas_params):
def test_copper_nathans_list(tas_params):
tas, ei, ef, _, _, r0 = tas_params

rez_list = tas.cooper_nathans(hkl_list=[(0, 0, 3), (0, 0, -3)], ei=[ei, ei + 1], ef=ef, projection=None, R0=r0)
rez_list = tas.rez(hkl_list=[(0, 0, 3), (0, 0, -3)], ei=[ei, ei + 1], ef=ef, projection=None, R0=r0)
mat = np.array(
[
[9583.2881, -4671.0614, -0.0000, 986.5610],
Expand Down
6 changes: 3 additions & 3 deletions tests/test_ellipse.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

def test_local_q(tas_params):
tas, ei, ef, hkl, _, R0 = tas_params
rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, projection=None, R0=R0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, projection=None, R0=R0)
ellipse = rez.get_ellipse(axes=(0, 3), PROJECTION=False)

assert np.allclose(ellipse.angle, 90)
Expand All @@ -22,7 +22,7 @@ def test_local_q(tas_params):

def test_hkl(tas_params):
tas, ei, ef, hkl, _, R0 = tas_params
rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, R0=R0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, R0=R0)

e01_co = rez.get_ellipse(axes=(0, 1), PROJECTION=False)

Expand All @@ -33,7 +33,7 @@ def test_hkl(tas_params):

def test_plotting(tas_params):
tas, ei, ef, hkl, _, R0 = tas_params
rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, R0=R0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, R0=R0)

e01_co = rez.get_ellipse(axes=(0, 1), PROJECTION=False)
e01_inco = rez.get_ellipse(axes=(0, 1), PROJECTION=True)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_ellipsoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def test_local_q(tas_params):
tas, ei, ef, hkl, _, R0 = tas_params
rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, projection=None, R0=R0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, projection=None, R0=R0)

assert np.allclose(rez.hkl, (0, 0, 3))
assert np.allclose(rez.q, (3 * 2 * np.pi / tas.sample.c, 0, 0))
Expand All @@ -21,7 +21,7 @@ def test_local_q(tas_params):

def test_hkl(tas_params):
tas, ei, ef, hkl, _, R0 = tas_params
rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, R0=R0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, R0=R0)

assert np.allclose(rez.hkl, (0, 0, 3))
assert np.allclose(rez.q, (0, 0, 3))
Expand All @@ -32,7 +32,7 @@ def test_hkl(tas_params):

def test_projection(tas_params):
tas, ei, ef, hkl, projection, R0 = tas_params
rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, projection=projection, R0=R0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, projection=projection, R0=R0)

assert np.allclose(rez.hkl, (0, 0, 3))
assert np.allclose(rez.q, (0, 3, 0))
Expand All @@ -43,7 +43,7 @@ def test_projection(tas_params):

def test_plotting(tas_params):
tas, ei, ef, hkl, _, R0 = tas_params
rez = tas.cooper_nathans(hkl_list=hkl, ei=ei, ef=ef, R0=R0)
rez = tas.rez(hkl_list=hkl, ei=ei, ef=ef, R0=R0)
rez.plot_ellipses()
plt.show()

Expand Down
6 changes: 4 additions & 2 deletions tests/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def test_scan_from_nexus():


def test_get_scan_data():
nexus_file_name = "./test_data/IPTS32124_CG4C_exp0424/scan0042.h5"
scan = Scan.from_nexus(nexus_file_name)

path_to_spice_folder = "./test_data/exp424"
scan = Scan.from_spice(path_to_spice_folder, scan_num=42)

scan_data_1d = scan.get_data()

x_data = np.arange(0.1, 4.1, 0.1)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_scan_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def test_scan_group_default_1d():
tavi = TAVI("./test_data/tavi_exp424.h5")
tavi = TAVI("./test_data/tavi_test_exp424.h5")
scan_list = list(range(42, 49, 1)) + list(range(70, 76, 1))

sg = tavi.combine_scans(scan_list, name="dispH")
Expand All @@ -22,7 +22,7 @@ def test_scan_group_default_1d():


def test_scan_group_1d_rebin():
tavi = TAVI("./test_data/tavi_exp424.h5")
tavi = TAVI("./test_data/tavi_test_exp424.h5")
scan_list = list(range(42, 49, 1)) + list(range(70, 76, 1))

sg = tavi.combine_scans(scan_list, name="dispH")
Expand All @@ -39,7 +39,7 @@ def test_scan_group_1d_rebin():


def test_scan_group_2d():
tavi = TAVI("./test_data/tavi_exp424.h5")
tavi = TAVI("./test_data/tavi_test_exp424.h5")
scan_list = list(range(42, 49, 1)) + list(range(70, 76, 1))

sg = tavi.combine_scans(scan_list, name="dispH")
Expand All @@ -56,7 +56,7 @@ def test_scan_group_2d():


def test_scan_group_2d_rebin():
tavi = TAVI("./test_data/tavi_exp424.h5")
tavi = TAVI("./test_data/tavi_test_exp424.h5")
scan_list = list(range(42, 49, 1)) + list(range(70, 76, 1))

sg = tavi.combine_scans(scan_list, name="dispH")
Expand Down

0 comments on commit 1700c92

Please sign in to comment.