Skip to content

Commit

Permalink
Merge pull request #406 from albertoesmp/devel
Browse files Browse the repository at this point in the history
Merge local devel into 3DGeo dev
  • Loading branch information
albertoesmp authored Jan 19, 2024
2 parents edfd146 + 5798f34 commit 0994954
Show file tree
Hide file tree
Showing 49 changed files with 2,034 additions and 438 deletions.
1 change: 1 addition & 0 deletions cmake/CMakeSources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ set(HELIOS_INCLUDE_DIRECTORIES
"src/maths/"
"src/maths/rigidmotion/"
"src/maths/fluxionum/"
"src/maths/model/"
"src/surfaceinspector/maths/"
"src/surfaceinspector/maths/functions/"
"src/surfaceinspector/maths/permuters/"
Expand Down
26 changes: 18 additions & 8 deletions pyhelios/simulation_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SimulationBuilder:
fullwaveNoise -- Compute fullwave noise enabling flag
platformNoiseDisabled -- Platform noise disabling flag
exportToFile -- Export to file enabling flag
legacyEnergyModel -- Legacy energy model enabling flag
callback -- Callback function to be used when callbackFrequency is
greater than 0. It can be None, then no callbacks will occur
rotateFilters -- List of rotate filters to apply
Expand Down Expand Up @@ -94,6 +95,7 @@ def makeDefault(self):
self.setCalcEchowidth(False)
self.setFullwaveNoise(False)
self.setPlatformNoiseDisabled(True)
self.setLegacyEnergyModel(False)
self.setExportToFile(True)
self.setCallback(None)
self.rotateFilters = []
Expand All @@ -118,15 +120,8 @@ def build(self):
)
build.sim.callbackFrequency = self.callbackFrequency
build.sim.finalOutput = self.finalOutput
build.sim.legacyEnergyModel = self.legacyEnergyModel
build.sim.exportToFile = self.exportToFile
build.sim.loadSurvey(
self.legNoiseDisabled,
self.rebuildScene,
self.writeWaveform,
self.calcEchowidth,
self.fullwaveNoise,
self.platformNoiseDisabled
)
if self.callback is not None:
build.sim.setCallback(self.callback)
for rotateFilter in self.rotateFilters:
Expand All @@ -149,6 +144,14 @@ def build(self):
translateFilter.z,
translateFilter.id
)
build.sim.loadSurvey(
self.legNoiseDisabled,
self.rebuildScene,
self.writeWaveform,
self.calcEchowidth,
self.fullwaveNoise,
self.platformNoiseDisabled
)

end = time.perf_counter()
print(
Expand All @@ -162,6 +165,9 @@ def build(self):
# --- GETTERS and SETTERS --- #
# ----------------------------- #
def setSurveyPath(self, surveyPath):
# TODO Remove ---
print(f'surveyPath: "{surveyPath}"')
# --- TODO Remove
self.validatePath(surveyPath)
self.surveyPath = surveyPath

Expand Down Expand Up @@ -254,6 +260,10 @@ def setPlatformNoiseDisabled(self, platformNoiseDisabled):
self.validateBoolean(platformNoiseDisabled)
self.platformNoiseDisabled = platformNoiseDisabled

def setLegacyEnergyModel(self, legacyEnergyModel):
self.validateBoolean(legacyEnergyModel)
self.legacyEnergyModel = legacyEnergyModel

def setExportToFile(self, exportToFile):
self.validateBoolean(exportToFile)
self.exportToFile = exportToFile
Expand Down
14 changes: 7 additions & 7 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_755_791) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.las').stat().st_size - 22_704_249) < MAX_DIFFERENCE_BYTES
assert (dirname / 'leg001_points.las').exists()
assert abs((dirname / 'leg001_points.las').stat().st_size - 13_936_877) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg001_points.las').stat().st_size - 14_381_469) < 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 All @@ -148,7 +148,7 @@ def test_tiffloader_als_pyh():

def eval_tiffloader_als(dirname):
assert (dirname / 'leg000_points.las').exists()
assert abs((dirname / 'leg000_points.las').stat().st_size - 54_699) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.las').stat().st_size - 53_367) < MAX_DIFFERENCE_BYTES
assert (dirname / 'leg001_points.las').exists()
assert abs((dirname / 'leg001_points.las').stat().st_size - 85_557) < MAX_DIFFERENCE_BYTES
with open(dirname / 'leg000_trajectory.txt', 'r') as f:
Expand Down Expand Up @@ -177,7 +177,7 @@ def test_detailedVoxels_uls_pyh():

def eval_detailedVoxels_uls(dirname):
assert (dirname / 'leg000_points.las').exists()
assert abs((dirname / 'leg000_points.las').stat().st_size - 459_701) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.las').stat().st_size - 460_737) < MAX_DIFFERENCE_BYTES
assert (dirname / 'leg000_trajectory.txt').exists()
assert abs((dirname / 'leg000_trajectory.txt').stat().st_size - 2_541) < MAX_DIFFERENCE_BYTES
with open(dirname / 'leg000_trajectory.txt', 'r') as f:
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_xyzVoxels_tls_pyh():

def eval_xyzVoxels_tls(dirname):
assert (dirname / 'leg000_points.las').exists()
assert abs((dirname / 'leg000_points.las').stat().st_size - 19_288_187) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.las').stat().st_size - 50_340_807) < MAX_DIFFERENCE_BYTES
# clean up
if DELETE_FILES_AFTER:
shutil.rmtree(dirname)
Expand All @@ -233,7 +233,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 - 875_054) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.laz').stat().st_size - 850_173) < MAX_DIFFERENCE_BYTES
with open(dirname / 'leg000_trajectory.txt', 'r') as f:
for _ in range(3):
next(f)
Expand Down Expand Up @@ -454,7 +454,7 @@ def test_dyn_exe():

def eval_dyn(dirname):
assert (dirname / 'leg000_points.laz').exists()
assert abs((dirname / 'leg000_points.laz').stat().st_size - 2_654_123) < MAX_DIFFERENCE_BYTES
assert abs((dirname / 'leg000_points.laz').stat().st_size - 4_181_700) < MAX_DIFFERENCE_BYTES
# clean up
if DELETE_FILES_AFTER:
shutil.rmtree(dirname)
8 changes: 4 additions & 4 deletions pytests/test_gpsStartTimeFlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def test_gpsStartTimeFlag_exe():
r2_sum = sha256sum(r2 / 'leg000_points.xyz')
r3_sum = sha256sum(r3 / 'leg000_points.xyz')
assert r2_sum == r3_sum
assert r2_sum == 'e1daca137b066eca4bd29b62f3cb5ecde4bcc41650f2cdfc44110c87b97f23dc' or \
r2_sum == 'e5ff320c318bd8cb87865ff8a3fd5d8835ca7a66736cc7469e59ad2c365a3a31' # linux checksum
assert r2_sum == '41313dfe46ed34fcb9733af03a4d5e52487fd4579014f13dc00c609b53813229' or \
r2_sum == '984cfbbc5a54ab10a566ea901363218f35da569dbab5cd102424ab27794074ae' # linux checksum
assert r1_sum != r2_sum

if DELETE_FILES_AFTER:
Expand Down Expand Up @@ -94,8 +94,8 @@ def test_gpsStartTimeFlag_pyh():
r2_sum = sha256sum(r2 / 'leg000_points.xyz')
r3_sum = sha256sum(r3 / 'leg000_points.xyz')
assert r2_sum == r3_sum
assert r2_sum == 'e1daca137b066eca4bd29b62f3cb5ecde4bcc41650f2cdfc44110c87b97f23dc' or \
r2_sum == 'e5ff320c318bd8cb87865ff8a3fd5d8835ca7a66736cc7469e59ad2c365a3a31' # linux checksum
assert r2_sum == '41313dfe46ed34fcb9733af03a4d5e52487fd4579014f13dc00c609b53813229' or \
r2_sum == '984cfbbc5a54ab10a566ea901363218f35da569dbab5cd102424ab27794074ae' # linux checksum
assert r1_sum != r2_sum

if DELETE_FILES_AFTER:
Expand Down
6 changes: 3 additions & 3 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 == (10470, 17)
assert meas.shape == (34317, 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 @@ -372,8 +372,8 @@ def test_output(export_to_file):
output = sim.join()
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 == (2435, 17)
np.testing.assert_allclose(measurements_array[0, :3], np.array([474500.3, 5473580.0, 107.0001]), rtol=0.000001)
assert measurements_array.shape == (2412, 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
5 changes: 0 additions & 5 deletions scripts/build/build_cesga.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
# ./build_cesga.sh -p 3.8 -w 12 -c
# To compile later use:
# cmake -DPYTHON_BINDING=1 -DPCL_BINDING=0 -DBOOST_DYNAMIC_LIBS=1 \
# -DPYTHON_VERSION=38 -DLAPACK_LIB="lib/lapack/install/lib/liblapack.so"
# And:
# make -j12
# To run tests and check everything is working:
# LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:lib/lapack/install/lib/ ./helios --test
# -DPYTHON_VERSION=38 -DLAPACK_LIB="${HELIOS_LIB_DIR}/lapack/install/lib/liblapack.so"
# And:
# make -j12
Expand Down
3 changes: 2 additions & 1 deletion scripts/debug/hda_pulse_calc_intensity_csv_to_laz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ 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 \
-set_version 1.4 -parse xyz012345678 -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' \
Expand All @@ -47,6 +47,7 @@ ${TXT2LAS} -i "$1" \
-add_attribute 10 'cross_section_m2' 'cross_section_m2' \
-add_attribute 10 'received_power' 'received_power' \
-add_attribute 2 'captured' 'captured' \
-add_attribute 10 'emitted power' \
-o "$2"


Loading

0 comments on commit 0994954

Please sign in to comment.