Skip to content

Commit

Permalink
Merge pull request #436 from 3dgeo-heidelberg/package-default-xmls
Browse files Browse the repository at this point in the history
Ship essential data as part of the Python package
  • Loading branch information
dokempf authored Apr 15, 2024
2 parents 0315eae + ce5c28b commit b5299b4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pytests/test_demo_scenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def run_helios_pyhelios(survey_path: Path, las_output: bool = True, zip_output:
pyhelios.setDefaultRandomnessGeneratorSeed("43")
simB = pyhelios.SimulationBuilder(
surveyPath=str(survey_path.absolute()),
assetsDir=[str(Path("assets")), os.getcwd()],
assetsDir=[str(Path("assets"))],
outputDir=str(Path("output")),
)
simB.setLasOutput(las_output)
Expand Down
9 changes: 9 additions & 0 deletions python/pyhelios/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ def _get_executable():


def helios_exec(args):
#
# Inject additional arguments to account for standard paths
#

# We always look for assets in the current working directory
args = args + ["--assets", os.getcwd()]

# We always look in the Python installation tree
args = args + ["--assets", resources.files("pyhelios")]
args = args + ["--assets", resources.files("pyhelios") / "data"]

# Inject the legacy model switch. This is part of our transitioning strategy
# to the new energy model.
args = args + ["--legacyEnergyModel"]

# Call the executable
executable = _get_executable()
return subprocess.call([executable] + args)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions python/pyhelios/simulation_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from math import isnan
import os
import time
import importlib_resources as resources


SimulationBuilderRotateFilter = namedtuple(
'SimulationBuilderRotateFilter',
Expand Down Expand Up @@ -64,6 +66,9 @@ class SimulationBuilder:
# --- CONSTRUCTOR --- #
# --------------------- #
def __init__(self, surveyPath, assetsDir, outputDir):
# Add default values for asset directories
assetsDir = assetsDir + [os.getcwd(), str(resources.files("pyhelios")), str(resources.files("pyhelios") / "data")]

# Base values
self.setSurveyPath(surveyPath)
self.setAssetsDir(assetsDir)
Expand Down

0 comments on commit b5299b4

Please sign in to comment.