Commit 51990c45 authored by Lukas Aspöck's avatar Lukas Aspöck

error messages / refactoring for running raven simulations

parent c17e7d8d
...@@ -274,17 +274,26 @@ classdef itaRavenProject < handle ...@@ -274,17 +274,26 @@ classdef itaRavenProject < handle
%------------------------------------------------------------------ %------------------------------------------------------------------
function setRavenExe(obj, newRavenExe) function setRavenExe(obj, newRavenExe)
obj.ravenExe = newRavenExe;
if (exist(obj.ravenIniFile,'file')) if (exist(newRavenExe,'file'))
obj.raven_ini.SetValues('Global', {'PathRavenExe'}, {obj.ravenExe});
obj.raven_ini.WriteFile(obj.ravenIniFile); obj.ravenExe = newRavenExe;
if (exist(obj.ravenIniFile,'file'))
obj.raven_ini.SetValues('Global', {'PathRavenExe'}, {obj.ravenExe});
obj.raven_ini.WriteFile(obj.ravenIniFile);
else
obj.raven_ini = IniConfig();
obj.raven_ini.AddSections({'Global'});
obj.raven_ini.AddKeys('Global', {'PathRavenExe'}, {obj.ravenExe});
end
else else
obj.raven_ini = IniConfig(); error('[itaRaven]: Error: Path to new Raven binary not found!');
obj.raven_ini.AddSections({'Global'});
obj.raven_ini.AddKeys('Global', {'PathRavenExe'}, {obj.ravenExe});
end end
end end
%------------------------------------------------------------------ %------------------------------------------------------------------
...@@ -444,29 +453,30 @@ classdef itaRavenProject < handle ...@@ -444,29 +453,30 @@ classdef itaRavenProject < handle
% give the project name a date and time string to help to identify the results % give the project name a date and time string to help to identify the results
obj.setProjectName(obj.projectTag); obj.setProjectName(obj.projectTag);
% set filter length to the length of the reverberation
% obj.setFilterLengthToReverbTime();
% run the simulation % run the simulation
disp(['Running simulation... (' obj.ravenExe ')']); disp(['Running simulation... (' obj.ravenExe ')']);
if exist(obj.ravenLogFile, 'file') if exist(obj.ravenLogFile, 'file')
delete(obj.ravenLogFile); delete(obj.ravenLogFile);
end end
% system([obj.ravenExe ' "' obj.ravenProjectFile '" >> ' obj.ravenLogFile]); % system([obj.ravenExe ' "' obj.ravenProjectFile '" >> ' obj.ravenLogFile]);
if (~exist(obj.ravenExe,'file'))
error('[itaRaven]: Error: Cannot find Raven binary file!');
end
prevPath = pwd; prevPath = pwd;
cd(fileparts(obj.ravenExe)); cd(fileparts(obj.ravenExe));
dos(['"' obj.ravenExe '"' ' "' obj.ravenProjectFile '"'],'-echo'); dos(['"' obj.ravenExe '"' ' "' obj.ravenProjectFile '"'],'-echo');
disp('Done.');
cd(prevPath); cd(prevPath);
% restore the initial project name % restore the initial project name
obj.setProjectName(savedProjectName); obj.setProjectName(savedProjectName);
% gather results % gather results
disp('Getting results...'); disp('[R] Simulation seems to be finished. Getting results...');
obj.gatherResults(); obj.gatherResults();
disp('Done.'); disp('[R] Done.');
obj.simulationDone = true; obj.simulationDone = true;
...@@ -5422,7 +5432,7 @@ classdef itaRavenProject < handle ...@@ -5422,7 +5432,7 @@ classdef itaRavenProject < handle
windowEnd = round(timestep + currentWindowLength/2); windowEnd = round(timestep + currentWindowLength/2);
windowLength = windowEnd - windowBegin + 1; windowLength = windowEnd - windowBegin + 1;
histo(timestep, :) = sum(histo(windowBegin:windowEnd, :), 1) / windowLength; histo(timestep, :) = sum(histo(windowBegin:windowEnd, :), 1) / windowLength;
currentWindowLength = currentWindowLength * stepFactor; currentWindowLength = currentWindowLength * stepFactor;
end end
for timestep = endTimeStep : numTimeSteps for timestep = endTimeStep : numTimeSteps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment