Skip to main content
. Author manuscript; available in PMC: 2011 Apr 13.
Published in final edited form as: Opt Express. 2010 Aug 30;18(18):18598–18614. doi: 10.1364/OE.18.018598

Algorithm 1.

Weighted normalization

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; ji 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; ik 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
   np̄q̄ ← 0
   p,q ← indices of maxval(n*, n*)
  end for
end if