Commit 38ade209 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding postprocessing section

parent 56f8803e
......@@ -6,7 +6,8 @@
% Requires ITA-Toolbox, obtain from http://www.ita-toolbox.org
output_folder = fullfile( 'C:\Users\jonas\sciebo\Thesis stuff\auralization\resources', 'example_ppa/s1_r1' );
%output_folder = fullfile( 'C:\Users\jonas\sciebo\Thesis stuff\auralization\resources', 'example_ppa/s1_r1' );
output_folder = fullfile( 'D:\Users\stienen\Sciebo\Thesis stuff\auralization\resources', 'example_ppa/s1_r1' );
frame_rate = 128 / 44100; % block length / sampling frequency
sort_by_date = false;
......@@ -17,11 +18,11 @@ S = 1;
R = 1;
ppa_example_mode = questdlg( 'Please select', 'VA example ppa mode selection', ...
'simulation', 'auralization', 'both', 'auralization');
'simulation', 'auralization', 'all', 'auralization');
ppa_example_mode = 'postprocessing'
%% Prepare run data
if any( strcmpi( ppa_example_mode, { 'simulation', 'both' } ) )
if any( strcmpi( ppa_example_mode, { 'simulation', 'all' } ) )
if ~exist( output_folder, 'dir' )
mkdir( output_folder )
......@@ -184,8 +185,67 @@ if any( strcmpi( ppa_example_mode, { 'simulation', 'both' } ) )
end
%% Run postprocessing
postproc_all_paths = struct();
if any( strcmpi( ppa_example_mode, { 'postprocessing', 'all' } ) )
% Load data
file_listing = dir( strcat( output_folder, '/frame*data.mat' ) );
N = numel( file_listing );
fprintf( 'Found data on %i frames in folder ''%s''\n', N, output_folder )
if sort_by_date
frame_datenums = zeros( N, 1 );
for n=1:N
frame_datenums( n ) = file_listing( n ).datenum;
end
[ ~, idx ] = sort( frame_datenums );
else
idx = 1:N;
end
h = waitbar( 0, 'Hold on, running postprocessing on generated data' );
% Run postprocessing over frames from front and back
for n = 1:N
idx_current_front = idx( n );
load( fullfile( output_folder, file_listing( idx_current_front ).name ), '-mat' );
pathnames = fieldnames( paths_update );
for p = 1:numel( pathnames )
path_id = pathnames{ p };
if ~isfield( postproc_all_paths, path_id ) || ~isfield( postproc_all_paths.( path_id ), 'first_frame' )
postproc_all_paths.( path_id ).first_frame = n;
end
end
idx_current_back = idx( N + 1 - n );
load( fullfile( output_folder, file_listing( idx_current_back ).name ), '-mat' );
pathnames = fieldnames( paths_update );
for p = 1:numel( pathnames )
path_id = pathnames{ p };
if ~isfield( postproc_all_paths, path_id ) || ~isfield( postproc_all_paths.( path_id ), 'last_frame' )
postproc_all_paths.( path_id ).last_frame = N + 1 - n;
end
end
waitbar( n / N )
end
save( fullfile( output_folder, 'postprocessing_data.mat' ), 'postproc_all_paths' )
close( h )
end
%% Run auralization
if any( strcmpi( ppa_example_mode, { 'auralization', 'both' } ) )
if any( strcmpi( ppa_example_mode, { 'auralization', 'all' } ) )
% Load data
......
%% Input conditions
target_path = 'path_50df740f16865a987b4b69ff1bb12c2f'; %path to follow through simulation
target_path = 'path_003ca6d3a74540310873574908219251'; %path to follow through simulation
%target_path = 'diffracted_path';
input_folder = 'example_ppa\s1_r1';
input_folder = fullfile( 'D:\Users\stienen\Sciebo\Thesis stuff\auralization\resources', 'example_ppa/s1_r1' );
out_filename = 'Path_evolution.gif';
out_filename_freq = 'Path_evolution_freq.gif';
plot_single_path_freq = true;
......
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