Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

statisticsoutput.h

00001 /***************************************************************************
00002                           statisticsoutput.h  -  description
00003                              -------------------
00004     begin                : Wed Oct 24 2001
00005     copyright            : (C) 2001 by Matt Grover
00006     email                : mpgrover@sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef STATISTICSOUTPUT_H
00019 #define STATISTICSOUTPUT_H
00020 
00021 using namespace std;
00022 #include <amygdala/types.h>
00023 #if GCC_VERSION >= 30000
00024     #include <ext/hash_map>
00025 #else
00026     #include <hash_map>
00027 #endif
00028 #include <vector>
00029 #include <set>
00030 #include <string>
00031 #include <amygdala/spikeoutput.h>
00032 
00033 #include <stdio.h>
00034 
00042 class StatisticsOutput : public SpikeOutput  {
00043 public: 
00044     StatisticsOutput();
00045     virtual ~StatisticsOutput();
00046     
00051     virtual void OutputEvent(AmIdInt neuronId, AmTimeInt eventTime);
00052     
00058     virtual void OutputCache() {};
00059     
00065     void SetStepSize(AmTimeInt step);
00066     
00070     AmTimeInt GetStepSize() const { return stepSize; }
00071     
00079     void ClearHistory();
00080     
00086     vector<unsigned int>& Histogram();
00087     
00092     vector<unsigned int>& Histogram(AmIdInt neuronId);
00093     
00099     vector<unsigned int> Histogram(AmTimeInt start, AmTimeInt end);
00100     
00105     vector<unsigned int> Histogram(AmIdInt neuronId, AmTimeInt start, AmTimeInt end);
00106     
00111     float PeakSpikeRate();
00112     
00116     float PeakSpikeRate(AmIdInt neuronId);
00117     
00122     AmTimeInt PeakRateTime();
00123     
00127     AmTimeInt PeakRateTime(AmIdInt neuronId);
00128     
00132     AmIdInt PeakNeuron();
00133     
00138     AmIdInt MostActiveNeuron();
00139     
00144     unsigned int TotalOutputSpikes();
00145     
00149     unsigned int TotalOutputSpikes(AmIdInt neuronId);
00150     
00155     float MeanSpikeRate();
00156     
00161     float MeanSpikeRate(AmIdInt neuronId);
00162 
00168     void LogSpikeTimes(string filename, AmTimeInt start=0, AmTimeInt end=~0);
00173     void AddTrace(AmIdInt nId);
00175   void CloseLog();
00176 
00177 protected:  // protected methods
00179     void Log(AmIdInt neuronId, AmTimeInt eventTime);
00180     
00181 protected:
00182     hash_map< AmIdInt, vector<AmTimeInt> > outputHistory;  // hash_map<nId, spikeTime>
00183 
00186     hash_map< AmIdInt, vector<unsigned int> > histogram;
00187     vector<unsigned int> combinedHistogram;
00188 
00189     AmIdInt maxPeakId;  // The neuron with the highest peak activity
00190     AmTimeInt maxPeakTime;  // Time of peak activity of maxPeakId
00191 
00192     AmIdInt mostActiveId;   // The neuron with the highest number of spikes
00193     unsigned int mostActiveCount;   // Number of times mostActiveId spiked
00194 
00195     float combinedPeakRate;
00196     AmTimeInt combinedPeakTime;
00197     float meanRate;
00198     unsigned int totalSpikeCount;
00199 
00201     AmTimeInt stepSize;
00203     AmTimeInt beginTime;
00205     AmTimeInt calcTime;
00207     AmTimeInt lastCalcTime;
00209     set <AmIdInt> traceNeurons;
00210     bool logging;
00211     AmTimeInt logStart;
00212     AmTimeInt logEnd;
00213     FILE *logFd;
00214 
00215 };
00216 
00217 #endif

Generated on Wed Sep 4 02:30:35 2002 for Amygdala by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002