Skip to content

Commit

Permalink
remove regression testing from pyhelios output test
Browse files Browse the repository at this point in the history
  • Loading branch information
han16nah committed Nov 27, 2024
1 parent d1ebf24 commit f3d2901
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions pytests/test_pyhelios.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def test_detector(test_sim):
[pytest.param(True, id="setExportToFile(True)"),
pytest.param(False, id="setExportToFile(False)")]
)
def test_output(output_dir, regression_data, export_to_file):
def test_output(output_dir, export_to_file):
"""Validating the output of a survey started with pyhelios"""
from pyhelios import SimulationBuilder
survey_path = Path('data') / 'test' / 'als_hd_demo_tiff_min.xml'
Expand All @@ -358,22 +358,18 @@ def test_output(output_dir, regression_data, export_to_file):

sim.start()
output = sim.join()

if regression_data:
measurements_array, trajectory_array = pyhelios.outputToNumpy(output)
time = measurements_array[:, 16]
pcloud = pcu.PointCloud(measurements_array[:, :3], fnames=['gps_time'], F=time.reshape(time.shape[0], 1))
las = laspy.read(regression_data / 'tiffloader_als_merged.las')
pcloud_ref = pcu.PointCloud.from_las(las, fnames=['gps_time'])
pcloud.assert_equals(pcloud_ref, eps=0.00011) # larger tolerance due to las scale factor of 0.0001
measurements_array, trajectory_array = pyhelios.outputToNumpy(output)

if export_to_file:
# check if output files exist
dirname = find_playback_dir(survey_path, output_dir)
assert (Path(dirname) / 'leg000_points.xyz').exists()
assert (Path(dirname) / 'leg001_points.xyz').exists()
assert (Path(dirname) / 'leg002_points.xyz').exists()

if regression_data:
pcloud0 = pcu.PointCloud.from_xyz_file(Path(dirname) / 'leg000_points.xyz', cols=(0, 1, 2), names=['x', 'y', 'z'])
pcloud_ref0 = pcu.PointCloud.from_las_file(regression_data / 'tiffloader_als_leg000_points.las')
pcloud0.assert_equals(pcloud_ref0, eps=0.00011) # larger tolerance due to las scale factor of 0.0001
# check if output files contain the same data as the internal arrays
leg0 = np.loadtxt(Path(dirname) / 'leg000_points.xyz')
leg1 = np.loadtxt(Path(dirname) / 'leg001_points.xyz')
leg2 = np.loadtxt(Path(dirname) / 'leg002_points.xyz')
measurements_from_file = np.vstack((leg0, leg1, leg2))
# account for different (order of) fields in internal array and file
assert np.allclose(measurements_array[:, (0, 1, 2, 9, 10, 12, 11, 13, 14, 15, 16)], measurements_from_file, atol=1e-6)

0 comments on commit f3d2901

Please sign in to comment.