#include <dlogger.h>
Inheritance diagram for punnets_common::tlogger:

Public Types | |
| enum | logoption { shownone = 0, showthr = 1, showext = 2, showpart = 4 } |
Public Methods | |
| tlogger (std::ostream &iout, ntime_t istep, ntime_t ifrom=0, ntime_t iuntil=mak::Infinity) | |
| Constructs a logger with output stream iout, time step istep, and logging range between ifrom and iuntil. | |
| virtual const char * | getClassName () const |
| Get the class name of this action. Primarily for debugging. | |
| virtual tqueue * | queue () const |
| Obtain a local event queue of this action. | |
| void | add (tneuron_base &p, ntime_t delay, bool ishowthr, bool ishowext=false, real offset=0.0) |
| Add a neuron to be logged. Two boolean specifies logging options of thresholds and externals. | |
| void | add (tneuron_base &p, ntime_t delay=0.0, logoption logopt=showthr, real offset=0.0) |
| Add a neuron to be logged. logoption specifies logging options. | |
| void | add (tsynapse_base &p, ntime_t delay=0.0) |
| Add a synapse to be logged. | |
| virtual void | activate (tscheduler &scheduler, ntime_t current_time) |
| When activated by scheduler, the logger logs the current status to the log file. | |
| void | schedule (tscheduler &scheduler) |
| Schedule the logger itself to the specified scheduler. | |
| void | gnuplot_def (std::ostream &os, std::string file) |
This class periodically probes the state (potential value) of neurons, and produces a log file of the state changes. To use logging, you need to do the followings:
Definition at line 51 of file dlogger.h.
|
|
The option of the logging. You may log threshold, external inputs, and partitions. Multiple of them can be specified by logical or.
Definition at line 58 of file dlogger.h. Referenced by add().
|
|
||||||||||||
|
Generate a GNUPLOT definition file to the specified stream. file is a file name of the log file. Definition at line 90 of file dlogger.cpp. References showext, showpart, and showthr.
00091 {
00092 // cerr << "min/max: " << delaymin << "/" << delaymax << endl;
00093 // os << "set term X11" << endl;
00094 os << "set y2tics" << endl;
00095 os << "plot [" << from << ":" << until << "]";
00096
00097 string delim = "";
00098 int column = 1;
00099 for( vector< neuentry >::iterator i = neus.begin(); i != neus.end(); i++ )
00100 {
00101 int xcol = (i->delay == 0.0 ? 1 : ++column);
00102 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00103 "using " << xcol << ":" << (++column) << " axes x1y1 " <<
00104 "title \"" << i->neuron->getClassName() << " '" << i->neuron->getName() << "'";
00105 if( i->delay != 0.0 )
00106 os << "(delay " << i->delay << ")";
00107 if( i->offset != 0.0 )
00108 os << "(offset " << i->offset << ")";
00109 os << " signal\" with lines";
00110 delim = ",";
00111
00112 if( i->logopt & showthr )
00113 {
00114 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00115 "using " << xcol << ":" << (++column) << " axes x1y1 " <<
00116 "title \"" << i->neuron->getClassName() << " '" << i->neuron->getName() << "'";
00117 if( i->delay != 0.0 )
00118 os << "(delay " << i->delay << ")";
00119 if( i->offset != 0.0 )
00120 os << "(offset " << i->offset << ")";
00121 os << " threshold\" with dots";
00122 delim = ",";
00123 }
00124 if( i->logopt & showext )
00125 {
00126 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00127 "using " << xcol << ":" << (++column) << " axes x1y1 " <<
00128 "title \"" << i->neuron->getClassName() << " '" << i->neuron->getName() << "'";
00129 if( i->delay != 0.0 )
00130 os << "(delay " << i->delay << ")";
00131 if( i->offset != 0.0 )
00132 os << "(offset " << i->offset << ")";
00133 os << " external\" with dots";
00134 delim = ",";
00135 }
00136 if( i->logopt & showpart )
00137 {
00138 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00139 "using " << xcol << ":" << (++column) << " axes x1y1 " <<
00140 "title \"" << i->neuron->getClassName() << " '" << i->neuron->getName() << "'";
00141 if( i->delay != 0.0 )
00142 os << "(delay " << i->delay << ")";
00143 if( i->offset != 0.0 )
00144 os << "(offset " << i->offset << ")";
00145 os << " partition 0\" with impulses";
00146 delim = ",";
00147
00148 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00149 "using " << xcol << ":" << (++column) << " axes x1y1 " <<
00150 "title \"" << i->neuron->getClassName() << " '" << i->neuron->getName() << "'";
00151 if( i->delay != 0.0 )
00152 os << "(delay " << i->delay << ")";
00153 if( i->offset != 0.0 )
00154 os << "(offset " << i->offset << ")";
00155 os << " partition 1\" with impulses";
00156
00157 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00158 "using " << xcol << ":" << (++column) << " axes x1y1 " <<
00159 "title \"" << i->neuron->getClassName() << " '" << i->neuron->getName() << "'";
00160 if( i->delay != 0.0 )
00161 os << "(delay " << i->delay << ")";
00162 if( i->offset != 0.0 )
00163 os << "(offset " << i->offset << ")";
00164 os << " partition 2\" with impulses";
00165
00166 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00167 "using " << xcol << ":" << (++column) << " axes x1y1 " <<
00168 "title \"" << i->neuron->getClassName() << " '" << i->neuron->getName() << "'";
00169 if( i->delay != 0.0 )
00170 os << "(delay " << i->delay << ")";
00171 if( i->offset != 0.0 )
00172 os << "(offset " << i->offset << ")";
00173 os << " partition delta_t\" with impulses";
00174 }
00175 }
00176 for( vector<pair<tsynapse_base *, ntime_t> >::iterator i = syns.begin(); i != syns.end(); i++ )
00177 {
00178 int xcol = (i->second == 0.0 ? 1 : ++column);
00179 os << delim << " \\" << endl << "\t'" << logfile << "' " <<
00180 "using " << xcol << ":" << (++column) << " axes x1y2 " <<
00181 "title \"" << i->first->getClassName() << " '" << i->first->getSrc().getName() << "' -> '" << i->first->getDest().getName() << "'";
00182 if( i->second != 0.0 )
00183 os << "(delay " << i->second << ")";
00184 os << "\" with lines";
00185 delim = ",";
00186 }
00187
00188 os << endl;
00189 os << "pause -1" << endl;
00190 }
|
1.2.18