src/Level2/TrnsTable1D.cc
/*             Function              Return Type & Value
               --------   -----------------------------------------------------
                center     double:  The center frequency of the transitions
                offset     void:    Shift one or all transition frequencies
                FRscale    void:    Scale one or all transition frequencies
                  BC       void:    Baseline correction by removal of
                                    frequencies near zero.

           Input                TTab1D  : Transitions table (this)
                                wa      : Flag for weighted average (def=true)
                                F       : Frequency offset (Hz=default, 1/sec)
                                inHz    : Flag whether F is in Hz or 1/sec
                                tr      : Transition index
                                Fscf    : Frequency scaling factor
                                res     : Frequency resolution
           Output center        double  : The center frequency is returned
           Output offset        void    : All frequency values or that of the
                                          the specified transitions tr are
                                          adjusted as Im(<i|mx|0>) += F
           Output FRscale       void    : All frequency values or that of the
                                          the specified transitions tr are
                                          adjusted as Im(<i|mx|0>) *= Fscf
           Output BC            void    : All transitions havign frequencies
                                          within 0+/-res will be removed     */
Function              Return Type & Value

center     double:  The center frequency of the transitions
offset     void:    Shift one or all transition frequencies
FRscale    void:    Scale one or all transition frequencies
BC       void:    Baseline correction by removal of
frequencies near zero.


Function Return Type & Value center double : The center frequency of the transitions offset void : Shift one or all transition frequencies FRscale void : Scale one or all transition frequencies BC void : Baseline correction by removal of frequencies near zero .
double TTable1D::center(bool wa)
  {
  int ntr = rows();			
  if(!ntr) return 0;			
  double Fcenter;			
  if(!wa)				
    {
    double Fmax = FRmax(); 		
    double Fmin = FRmin(); 		
    Fcenter = (Fmin-Fmax)/2.0;		
    }
  else
    {
    double Fri;				
    double Ii;				
    double Isum = 0.0;			
    double WFsum = 0.0;			
    for(int i=0; i<ntr; i++)		
      {
      Ii  = norm(I(i));			
      Fri = getIm(i,0);			
      WFsum += Ii*Fri; 			
      Isum  += Ii;			
      }
    Fcenter = WFsum/Isum;		
    }
  offset(Fcenter, 0);			
  return Fcenter;			
  }
double TTable1D :: center ( bool wa ) { int ntr = rows ( ) ; if ( ! ntr ) return 0 ; double Fcenter ; if ( ! wa ) { double Fmax = FRmax ( ) ; double Fmin = FRmin ( ) ; Fcenter = ( Fmin - Fmax ) / 2.0 ; } else { double Fri ; double Ii ; double Isum = 0.0 ; double WFsum = 0.0 ; for ( int i = 0 ; i < ntr ; i ++ ) { Ii = norm ( I ( i ) ) ; Fri = getIm ( i , 0 ) ; WFsum += Ii * Fri ; Isum += Ii ; } Fcenter = WFsum / Isum ; } offset ( Fcenter , 0 ) ; return Fcenter ; }
Function              Return Type & Value
Function Return Type & Value
// Number of transitions // If no transitions, exit // Center transition frequency // If not weighted average // Largest transition frequency // Smallest transition frequency // Frequency in spectrum center // For transition i's frequency // For transition i's intensity // For summed intensities // For summed weighted frequencies // Loop over all transitons //   Transition i intensity //   Transition i frequency //   Weighted frequency sum //   Intensity sum // Weighed freqeuncy center // Offset frequencies, center now ~0 // Return this center