Home > Matching_SYM_LSM > src > 2D_LSM_62 > 2D_LSM_62_sym_Functions > sym_lsm_analysis.m

sym_lsm_analysis

PURPOSE ^

% analysis of Sym-LSM

SYNOPSIS ^

function sym_lsm_analysis(r_sample,est_sigma_0,est_x,est_xi,est_xs, sigma_0s, N_iters,Red,lsm_time,par)

DESCRIPTION ^

% analysis of Sym-LSM

 r_sample          number of successful samples
 sigma_0_est       sqrt of estimated variance factor
 est_x             estimated parameters (est_x.x and est_x.C)
 est_xi            estimated parameters of symmetric solution, ...
 est_xs, sigma_0s, N_iters
                   list of estimated parameters, sigma_0s and iterations
 Red               redundancy
 lsm_time          total CPU time for all samples.

 wf 7/2020

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function sym_lsm_analysis(...
0002     r_sample,...
0003     est_sigma_0,...
0004     est_x,...
0005     est_xi,...
0006     est_xs, sigma_0s, N_iters,...
0007     Red,...
0008     lsm_time,...
0009     par)
0010 
0011 %% analysis of Sym-LSM
0012 %
0013 % r_sample          number of successful samples
0014 % sigma_0_est       sqrt of estimated variance factor
0015 % est_x             estimated parameters (est_x.x and est_x.C)
0016 % est_xi            estimated parameters of symmetric solution, ...
0017 % est_xs, sigma_0s, N_iters
0018 %                   list of estimated parameters, sigma_0s and iterations
0019 % Red               redundancy
0020 % lsm_time          total CPU time for all samples.
0021 %
0022 % wf 7/2020
0023 
0024 
0025 
0026 % successful samples
0027 Nr_samples = r_sample;
0028 
0029 if par.N_samples-Nr_samples > 0
0030     if par.N_samples-Nr_samples ==1
0031         disp(['Warning: ',num2str(par.N_samples-Nr_samples),...
0032             ' sample reached maximum number of iterations ',...
0033             num2str(par.max_iter)])
0034     else
0035         disp(['Warning: ',num2str(par.N_samples-Nr_samples),...
0036             ' samples reached maximum number of iterations ',...
0037             num2str(par.max_iter)])
0038     end
0039 end
0040 
0041 if Nr_samples > 9
0042     
0043     
0044     if par.plot_type > 1
0045         sigma_0_est=est_sigma_0
0046     end
0047     
0048     if par.plot_type > 1
0049         est_xs
0050         sigma_rho=Covariance_2_sigma_rho(Tg_est.C)
0051     else
0052         check_estimation_result(Red, par.x_true, est_x.C,...
0053             sigma_0s(1:Nr_samples).^2, est_xs(1:Nr_samples,:), par.S, ' LSM-62-sym all');
0054         
0055         
0056         
0057         check_estimation_result(Red, par.x_true(1:6), est_x.C(1:6,1:6),...
0058             sigma_0s(1:Nr_samples).^2, est_xs(1:Nr_samples,1:6), par.S, ' LSM-62-sym affinity');
0059         
0060         figure
0061         hist(N_iters,[2:2:2*(par.max_iter+1)]/2)
0062         title(['Histogram of number of iterations,  LSM-62-sym'])
0063     end
0064     
0065     if par.plot_type > 0
0066         disp(' ')
0067         disp('Standard deviations and differences to ground truth')
0068         disp('---------------------------------------------------')
0069         disp(['     a1        a2        a3        a4        a5',...
0070             '        a6        a7        a8'])
0071         
0072         sigmas_theor      = sqrt(diag(est_x.C)')
0073         sigmas_empir      = sqrt(diag(cov(est_xs))')
0074         ratio_sigma_empir_sigma_theor = sigmas_empir./sigmas_theor
0075         Mean_difference_to_ground_truth       = mean(est_xs) - par.x_true'
0076         Std_difference_to_ground_truth        = std(est_xs)
0077         Max_difference_to_ground_truth        = max(abs(est_xs - ones(par.N_samples,1)*par.x_true'))
0078     end
0079     
0080     disp(' ')
0081     disp(['sigma affinity        [%] : ',...
0082         num2str(100*mean(sqrt(diag(est_x.C(1:4,1:4))')))])
0083     disp(['sigma shift       [pixel] : ',...
0084         num2str(mean(sqrt(diag(est_x.C(5:6,5:6))')))])
0085     disp(['sigma intensity      [gr] : ',...
0086         num2str(mean(sqrt(diag(est_x.C(7:8,7:8))'))*255)])
0087     disp(' ')
0088     disp(['time per iteration    [ms]: ', num2str(1000*lsm_time/sum(N_iters))])
0089     disp(['time per observation  [ms]: ', num2str(1000*lsm_time/sum(N_iters)/(Red+8))])
0090     %     time_per_LSM = lsm_time/N_samples
0091     %     time_per_observation = time_per_LSM/(Red+8)
0092     
0093 else
0094     
0095     A_est   = [reshape(est_x.x(1:6),2,3)]
0096     Rm_est  = [est_x.x(7:8)']
0097     
0098     if par.plot_type > 0
0099         
0100         A_estimated   = [reshape(est_x.x(1:6),2,3);0 0 1];
0101         if par.test_symmetry
0102             Ainv_estimated  = [reshape(est_xi.x(1:6),2,3);0 0 1]
0103         end
0104         R_estimated  = [est_x.x(7:8)'; 0 1];
0105         if par.test_symmetry
0106             Rinv_estimated = [est_xi.x(7:8)'; 0 1]
0107         end
0108         A_differences_to_ground_truth = A_estimated(1:2,:) - par.A_a(1:2,:)
0109         R_differences_to_ground_truth = R_estimated(1,:) -par.R_a
0110         if par.test_symmetry
0111             cA =A_estimated*Ainv_estimated-eye(3);
0112             cR =R_estimated*Rinv_estimated-eye(2);
0113             check_symmetry_AAi_I =cA(1:2,:)
0114             check_symmetry_RRi_I =cR(1,:)
0115         end
0116         
0117         
0118         A_standard_deviations        = reshape(sqrt(diag(est_x.C(1:6,1:6))'),2,3)
0119         
0120         R_standard_deviations        = reshape(sqrt(diag(est_x.C(7:8,7:8))'),1,2)
0121     end
0122     
0123     
0124 end
0125 
0126 if par.plot_type > 1
0127     test_bias_z =(est_x.x-par.x_true)'./sqrt(diag(est_x.C))';
0128 end
0129 
0130 end
0131

Generated on Sun 19-Jul-2020 23:00:25 by m2html © 2005