Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyhelios updates (see #464) #475

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pyhelios/simulation_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def copy(self):
Return:
SimulationBuild which is a copy of current one
"""
copySim = SimulationBuild(None, None, None, None, None, None, True)
copySim = SimulationBuild(
None, None, None, None, None, None, None, None, True
)
copySim.sim = self.sim.copy()
return copySim

Expand Down
3 changes: 2 additions & 1 deletion pyhelios/simulation_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def build(self):
self.writeWaveform,
self.calcEchowidth,
self.fullwaveNoise,
self.platformNoiseDisabled
self.platformNoiseDisabled,
False
)
if self.callback is not None:
build.sim.setCallback(self.callback)
Expand Down
2 changes: 1 addition & 1 deletion src/main/helios_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const char * HELIOS_VERSION = "1.3.0";

const char * HELIOS_GIT_HASH = "107d3ee5";
const char * HELIOS_GIT_HASH = "917263d4";

const char * getHeliosVersion(){
return HELIOS_VERSION;
Expand Down
5 changes: 5 additions & 0 deletions src/pybinds/PyHelios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ BOOST_PYTHON_MODULE(_pyhelios){
&PyHeliosSimulation::newLeg,
return_internal_reference<>()
)
.def(
"newLegFromTemplate",
&PyHeliosSimulation::newLegFromTemplate,
return_internal_reference<>()
)
.def(
"newScanningStrip",
&PyHeliosSimulation::newScanningStrip,
Expand Down
22 changes: 17 additions & 5 deletions src/pybinds/PyHeliosSimulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,20 @@ Leg & PyHeliosSimulation::newLeg(int index){
int const n = (int) survey->legs.size();
if(index<0 || index>n) index = n;
std::shared_ptr<Leg> leg = std::make_shared<Leg>();
leg->mScannerSettings =
std::make_shared<ScannerSettings>();
leg->mPlatformSettings =
std::make_shared<PlatformSettings>();
leg->mScannerSettings = std::make_shared<ScannerSettings>();
leg->mPlatformSettings = std::make_shared<PlatformSettings>();
survey->addLeg(index, leg);
return *leg;
}

Leg & PyHeliosSimulation::newLegFromTemplate(
int index,
Leg &baseLeg
){
int const n = (int) survey->legs.size();
if(index<0 || index>n) index = n;
std::shared_ptr<Leg> leg = std::make_shared<Leg>(baseLeg);
leg->setSerialId(index);
survey->addLeg(index, leg);
return *leg;
}
Expand Down Expand Up @@ -312,13 +322,15 @@ void PyHeliosSimulation::loadSurvey(
bool writeWaveform,
bool calcEchowidth,
bool fullWaveNoise,
bool platformNoiseDisabled
bool platformNoiseDisabled,
bool writePulse
){
xmlreader->sceneLoader.kdtFactoryType = kdtFactory;
xmlreader->sceneLoader.kdtNumJobs = kdtJobs;
xmlreader->sceneLoader.kdtSAHLossNodes = kdtSAHLossNodes;
survey = xmlreader->load(legNoiseDisabled, rebuildScene);
survey->scanner->setWriteWaveform(writeWaveform);
survey->scanner->setWritePulse(writePulse);
survey->scanner->setCalcEchowidth(calcEchowidth);
survey->scanner->setFullWaveNoise(fullWaveNoise);
survey->scanner->setPlatformNoiseDisabled(platformNoiseDisabled);
Expand Down
21 changes: 17 additions & 4 deletions src/pybinds/PyHeliosSimulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,23 @@ class PyHeliosSimulation{
{survey->legs.erase(survey->legs.begin() + index);}
/**
* @brief Create a new empty leg
* @param index The index specifying the position in the survey where the
* leg will be inserted
* @return Created empty leg
* @param index The index specifying the position in the survey where the
* leg will be inserted.
* @return Created leg.
*/
Leg & newLeg(int index);
/**
* @brief Create a new leg from a template.
* @param index The index specifying the position in the survey where the
* leg will be inserted.
* @param baseLeg The leg to be used as a template to build the new leg.
* If null, the new leg will be created fully from scratch.
* @return Created leg.
*/
Leg & newLegFromTemplate(
int index,
Leg &baseLeg
);
/**
* @brief Create a new empty scanning strip (with no legs)
* @param stripId The identifier for the strip
Expand Down Expand Up @@ -390,7 +402,8 @@ class PyHeliosSimulation{
bool writeWaveform = false,
bool calcEchowidth = false,
bool fullWaveNoise = false,
bool platformNoiseDisabled = true
bool platformNoiseDisabled = true,
bool writePulse = false
);
void addRotateFilter(
double q0,
Expand Down
2 changes: 1 addition & 1 deletion src/scanner/MultiScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// ************************************ //
MultiScanner::MultiScanner(MultiScanner &scanner) :
Scanner(scanner),
scanDevs(std::move(scanner.scanDevs))
scanDevs(scanner.scanDevs)
{}


Expand Down
4 changes: 3 additions & 1 deletion src/sim/comps/Survey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Survey::Survey(Survey &survey, bool const deepCopy){

// Copy Scanner
this->scanner = survey.scanner->clone();
this->scanner->getDetector()->scanner = this->scanner;
for(size_t i = 0 ; i < this->scanner->getNumDevices() ; ++i){
this->scanner->getDetector(i)->scanner = this->scanner;
}

// Copy legs
this->legs = std::vector<std::shared_ptr<Leg>>(0);
Expand Down
2 changes: 1 addition & 1 deletion src/sim/core/SurveyPlayback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void SurveyPlayback::clearPointcloudFile(){
// Dont clear strip file, it would overwrite previous point cloud content
if(getCurrentLeg()->isContainedInAStrip()) return;
// Dont clear pcloud file, if leg is not active there is nothing to clear
// Otherwise, WATCHOUT because last active leg might be overwriten
// Otherwise, WATCH OUT because last active leg might be overwriten
if(!getCurrentLeg()->mScannerSettings->active) return;
fms->write.clearPointcloudFile();
}
Expand Down
Loading