Changeset 13643 for trunk/FACT++/src


Ignore:
Timestamp:
05/10/12 17:18:09 (12 years ago)
Author:
tbretz
Message:
Some little improvements to statistics and display; new scale for the currents
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/smartfact.cc

    r13621 r13643  
    254254
    255255        template<class T>
    256             Statistics(const T &t)
    257         {
    258             min = *min_element(t.begin(), t.end());
    259             max = *max_element(t.begin(), t.end());
    260             avg =  accumulate (t.begin(), t.end(), 0.)/t.size();
     256            Statistics(const T &t, size_t offset_min=0, size_t offset_max=0)
     257        {
     258            T copy(t);
     259            sort(copy.begin(), copy.end());
     260
     261            if (offset_min>t.size())
     262                offset_min = 0;
     263            if (offset_max>t.size())
     264                offset_max = 0;
     265
     266            min = copy[offset_min];
     267            max = copy[copy.size()-1-offset_max];
     268            avg = accumulate (t.begin(), t.end(), 0.)/t.size();
    261269
    262270            const size_t p = t.size()/2;
    263271
    264             T copy(t);
    265             nth_element(copy.begin(), copy.begin()+p, copy.end());
    266272            med = copy[p];
    267273        }
     
    489495
    490496        // Write the 160 patch values to a file
    491         WriteBinary("biascontrol-current", val, 1000);
    492 
    493         const Statistics stat(v);
     497        WriteBinary("biascontrol-current", val, 500);
     498
     499        const Statistics stat(v, 0, 3);
    494500
    495501        // Exclude the three crazy channels
     
    503509
    504510        // write the history to a file
    505         WriteBinary("biascontrol-current-hist", fBiasControlCurrentHist, 1000);
     511        WriteBinary("biascontrol-current-hist", fBiasControlCurrentHist, 500);
    506512
    507513        ostringstream out;
     
    700706            return;
    701707
    702         if (HandleService(curr, fDimMcpConfiguration,       &StateMachineSmartFACT::configuHandleMcpConfiguration))
     708        if (HandleService(curr, fDimMcpConfiguration,       &StateMachineSmartFACT::HandleMcpConfiguration))
    703709            return;
    704710        if (HandleService(curr, fDimMagicWeatherData,       &StateMachineSmartFACT::HandleMagicWeatherData))
     
    826832            out << col << '\t' << fMcpConfigurationName;
    827833
    828             if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationState==12)
     834            if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12)
    829835                out << " [";
    830836            if (fMcpConfigurationMaxEvents>0)
    831837                out << fMcpConfigurationMaxEvents;
    832             if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationState==12)
     838            if (fMcpConfigurationMaxEvents>0 && (fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12))
    833839                out << '/';
    834840            if (fMcpConfigurationMaxTime>0)
     
    837843                    out << fMcpConfigurationMaxTime-(Time()-fMcpConfigurationRunStart).total_seconds() << 's';
    838844                else
    839                     out << fMcpConfigurationMaxTime << 's';
     845                    out << "[" << fMcpConfigurationMaxTime << "s]";
    840846            }
    841847            else
     
    849855            }
    850856
    851             if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationState==12)
     857            if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12)
    852858                out << ']';
    853859        }
Note: See TracChangeset for help on using the changeset viewer.