Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Evaluation of correlators:

Code Block

ImgAlgos/include/CorAna.h:  typedef float cor_t;

void CorAnaData::evaluateCorTau(unsigned tau) // tau in number of frames between images
{
  m_log << "\nCorAnaData::evaluateCorTau(tau): tau=" << tau;
  std::fill_n(m_sum_gi, m_blk_size, double(0));
  std::fill_n(m_sum_gf, m_blk_size, double(0));
  std::fill_n(m_sum_g2, m_blk_size, double(0));
  std::fill_n(m_sum_st, m_blk_size, unsigned(0));
  std::fill_n(m_cor_gi, m_blk_size, cor_t(0));
  std::fill_n(m_cor_gf, m_blk_size, cor_t(0));
  std::fill_n(m_cor_g2, m_blk_size, cor_t(0));

  for (unsigned ti=0; ti<m_tind_size-tau; ti++) {
       unsigned tf=ti+tau;

       if ( ! (tf<m_tind_size) ) break;
       
       // get the event index in array for time index
       int evi = m_tind_to_evind[ti];
       int evf = m_tind_to_evind[tf];

       // If the event does not exist for specified time index -> skip it in sum
       if(evi<0) continue;
       if(evf<0) continue;

       sumCorTau((unsigned)evi,(unsigned)evf);
  }
}

//----------------
void CorAnaData::sumCorTau(unsigned i, unsigned f) // i and f are the event indexes
{
   data_t* p_i = &m_data[i*m_blk_size];
   data_t* p_f = &m_data[f*m_blk_size];
   double Ii, If;

   for(unsigned pix=0; pix<m_blk_size; pix++) {
     Ii = p_i[pix]; 
     If = p_f[pix]; 
     m_sum_gi[pix] += Ii; 
     m_sum_gf[pix] += If; 
     m_sum_g2[pix] += Ii*If; 
     m_sum_st[pix] ++; 
   }
}

Averaging:

Code Block

   for(unsigned pix=0; pix<m_blk_size; pix++) {
       if(m_sum_st[pix]<1) continue;
       m_cor_gi[pix] = cor_t( m_sum_gi[pix] / m_sum_st[pix] ); 
       m_cor_gf[pix] = cor_t( m_sum_gf[pix] / m_sum_st[pix] ); 
       m_cor_g2[pix] = cor_t( m_sum_g2[pix] / m_sum_st[pix] ); 
   }

Module ImgAlgos.CorAna

...