Require: SIZE(arrays) = SIZE(errors) = [n,nx,ny]{n arrays to be normalized with errors} |
for i = 0 to n −1 do
|
for j = 0 to n −1; j ≠ i do
|
indicesi j ←WHERE((arrays[i,*,*] AND arrays[j,*,*]) > threshold) |
end for
|
alli ← union of all indicesi*
|
stddev[i,*,*] ← errors[i,*,*] · arrays[i,*,*] |
end for
|
arrays[k,*,*]; where allk has the most elements nall {Find reference array} |
if nall > 100 then
|
for i = 0 to n −1; i ≠ k do
|
using indices allk, calculate σ using Eq. (5) and c for arrays[i] and arrays[k] using Eq. (7)
|
arrays[i] *= c
|
end for
|
else {normalizing in pairs instead} |
ni j ← number of elements of indicesi j
|
p,q ← indices of maxval(ni j) |
for l = 0 to n − 2 do
|
calculate total error σ from stddev[p] and stddev[q] using Eq. (5)
|
using indicespq, calculate c for arrays[p] and arrays[q] according to Eq. (7)
|
arrays[p] *= c
|
p̄,q̄ ← p,q
|
np̄q̄ ← 0 |
p,q ← indices of maxval(np̄*, n*q̄) |
end for
|
end if
|