ソースを参照

Octathingy calibration: fix normalization of A2B matrix, the UV components were being boosted so signals close to full scale were being clipped, and then attenuated by the filters

Fernando Pablo Lopez-Lezcano 8 年 前
親
コミット
e786aad467
1 ファイル変更、14 行追加、0 行削除
  1. 14 0
      calibration/src/sphear_calibration_common.m

+ 14 - 0
calibration/src/sphear_calibration_common.m

@@ -169,6 +169,17 @@ function [SP, FC, FE] = sphear_signal_power_all(SIG, FS, fmin, fmax, frefmin, fr
   ref = sphear_signal_power(SIG, FS, frefmin, frefmax, fft_size);
   norm = mean(ref(:,:));
 
+  %% we only normalize with respect to WXYZ, UV in the frequency range
+  %% where WXYZ are well behaved has low power (high pass filter due
+  %% to the difference microphones) so we don't want to average that.
+  %% If we do that the A2B coefficients are much higher than the ones
+  %% for WXYZ and we get clipping for signals close to full scale (and
+  %% then attenuation in the filtering stage after that)
+  WXYZnorm = mean(ref(:,[1,2,3,4]));
+  XYavg = mean(WXYZnorm([2,3]));
+  %% use XY average for UV
+  norm = cat(1, WXYZnorm', [XYavg], [XYavg])';
+
   for i = (1:size(FC))
     %% (measurement,signal,band,power)
     SP(:,:,i) = sphear_signal_power(SIG, FS, FE(i), FE(i + 1), fft_size) ./ norm;
@@ -285,4 +296,7 @@ function [A2B XY_gain, UV_gain] = sphear_bf_normalize_gain(A2B, B, FS, fmin, fma
   else
     UV_gain = 1.0;
   end
+  %% we want the W contribution of each capsule to be 1/8,
+  %% so scale the whole matrix relative to mean W
+  A2B(:,:) = A2B(:,:) / (mean(A2B(:, 1)) * 8);
 end