Skip to content

Commit

Permalink
Merge pull request #371 from albertoesmp/devel
Browse files Browse the repository at this point in the history
Solved scene's bounding box and subray intersection time issues.
  • Loading branch information
albertoesmp authored Oct 5, 2023
2 parents a390993 + 4bec505 commit 548a07d
Show file tree
Hide file tree
Showing 51 changed files with 2,583 additions and 203 deletions.
2 changes: 1 addition & 1 deletion cmake/CMakeDebugFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ endif()

#-DDATA_ANALYTICS=1 to enable
if(${DATA_ANALYTICS})
add_definitions(-DDATA_ANALYTICS)
add_compile_definitions(DATA_ANALYTICS=${DATA_ANALYTICS})
endif()
6 changes: 3 additions & 3 deletions pytests/test_demo_scenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def test_arbaro_tls_pyh():

def eval_arbaro_tls(dirname):
assert (dirname / 'leg000_points.las').exists()
assert abs((dirname / 'leg000_points.las').stat().st_size - 21_656_853) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.las').stat().st_size - 21_755_791) < MAX_DIFFERENCE_BYTES
assert (dirname / 'leg001_points.las').exists()
assert abs((dirname / 'leg001_points.las').stat().st_size - 13_908_757) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg001_points.las').stat().st_size - 13_936_877) < MAX_DIFFERENCE_BYTES
with open(dirname / 'leg000_trajectory.txt', 'r') as f:
line = f.readline()
assert line.startswith('1.0000 25.5000 0.0000')
Expand Down Expand Up @@ -231,7 +231,7 @@ def test_interpolated_traj_pyh():
def eval_interpolated_traj(dirname):
assert (dirname / 'leg000_points.laz').exists()
assert (dirname / 'leg000_trajectory.txt').exists()
assert abs((dirname / 'leg000_points.laz').stat().st_size - 873_554) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.laz').stat().st_size - 875_054) < MAX_DIFFERENCE_BYTES
with open(dirname / 'leg000_trajectory.txt', 'r') as f:
for _ in range(3):
next(f)
Expand Down
6 changes: 3 additions & 3 deletions pytests/test_gpsStartTimeFlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_gpsStartTimeFlag_exe():
r3_sum = sha256sum(r3 / 'leg000_points.xyz')
assert r2_sum == r3_sum
assert r2_sum == 'e1daca137b066eca4bd29b62f3cb5ecde4bcc41650f2cdfc44110c87b97f23dc' or \
r2_sum == '59b9d09d6e2a6b8a8c25112f5b06fc08430c4058216efeea6ec7324dff0c7797' # linux checksum
r2_sum == 'e5ff320c318bd8cb87865ff8a3fd5d8835ca7a66736cc7469e59ad2c365a3a31' # linux checksum
assert r1_sum != r2_sum

if DELETE_FILES_AFTER:
Expand Down Expand Up @@ -95,7 +95,7 @@ def test_gpsStartTimeFlag_pyh():
r3_sum = sha256sum(r3 / 'leg000_points.xyz')
assert r2_sum == r3_sum
assert r2_sum == 'e1daca137b066eca4bd29b62f3cb5ecde4bcc41650f2cdfc44110c87b97f23dc' or \
r2_sum == '59b9d09d6e2a6b8a8c25112f5b06fc08430c4058216efeea6ec7324dff0c7797' # linux checksum
r2_sum == 'e5ff320c318bd8cb87865ff8a3fd5d8835ca7a66736cc7469e59ad2c365a3a31' # linux checksum
assert r1_sum != r2_sum

if DELETE_FILES_AFTER:
Expand All @@ -104,4 +104,4 @@ def test_gpsStartTimeFlag_pyh():
shutil.rmtree(r2)
shutil.rmtree(r3)
except Exception as e:
print(f"Error cleaning up: {e}")
print(f"Error cleaning up: {e}")
4 changes: 2 additions & 2 deletions pytests/test_pyhelios.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def test_create_survey():
output = simB.join()
meas, traj = pyhelios.outputToNumpy(output)
# check length of output
assert meas.shape == (10397, 17)
assert meas.shape == (10470, 17)
assert traj.shape == (6670, 7)
# compare individual points
np.testing.assert_allclose(meas[100, :3], np.array([83.32, -66.44204, 0.03114649]))
Expand Down Expand Up @@ -373,7 +373,7 @@ def test_output(export_to_file):
measurements_array, trajectory_array = pyhelios.outputToNumpy(output)

np.testing.assert_allclose(measurements_array[0, :3], np.array([474500.3, 5473530.0, 106.0988]), rtol=0.000001)
assert measurements_array.shape == (2433, 17)
assert measurements_array.shape == (2435, 17)
assert trajectory_array.shape == (9, 7)
if export_to_file:
assert Path(output.outpath).parent.parent == Path(WORKING_DIR) / "output" / "als_hd_demo"
Expand Down
Empty file modified scripts/debug/fullwave_plotter.py
100644 → 100755
Empty file.
Empty file modified scripts/debug/hda_diff_report.py
100644 → 100755
Empty file.
52 changes: 52 additions & 0 deletions scripts/debug/hda_pulse_calc_intensity_csv_to_laz.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# ########################################################################
# #
# AUTHOR : Alberto M. Esmorís Pena #
# #
# Script to transform an input CSV file, which rows are pulse records #
# written by the HDA_PulseRecorder component of HELIOS++, to a LAS/LAZ #
# file. #
# #
# ########################################################################

# Path or alias to TXT2LAS util
TXT2LAS='txt2las'

# Function to show help
function show_help {
cat << EOF
hda_pulse_calc_intensity_csv_to_laz.sh
Argument 1: Path to the input CSV file
Argument 2: Path to the output LAZ file
EOF
}

# Handle input arguments
if [[ $# -ne 2 ]]; then
echo -e 'ERROR: Exactly two arguments must be provided\n'
show_help
exit 1
fi


echo -e "Transforming \"$1\" to \"$2\" ..."
mkdir -p $(dirname "$2")
${TXT2LAS} -i "$1" \
-set_version 1.4 -parse xyz01234567 -rescale 1e-5 1e-5 1e-5 \
-add_attribute 10 'incidence_angle_rad' 'incidence_angle_rad' \
-add_attribute 10 'target_range_m' 'target_range_m' \
-add_attribute 10 'target_area_m2' 'target_area_m2' \
-add_attribute 10 'radius_m' 'radius_m' \
-add_attribute 10 'bdrf' 'bdrf' \
-add_attribute 10 'cross_section_m2' 'cross_section_m2' \
-add_attribute 10 'received_power' 'received_power' \
-add_attribute 2 'captured' 'captured' \
-o "$2"


Loading

0 comments on commit 548a07d

Please sign in to comment.