MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Table Class Reference

#include <Table.h>

+ Inheritance diagram for Table:
+ Collaboration diagram for Table:

Public Member Functions

string getColumnName () const
 
double getDt (void) const
 
string getFormat () const
 
string getOutfile (void) const
 
double getThreshold () const
 
bool getUseSpikeMode (void) const
 
bool getUseStreamer (void) const
 
void input (double v)
 
Tableoperator= (const Table &tab)
 
void process (const Eref &e, ProcPtr p)
 
void reinit (const Eref &e, ProcPtr p)
 Reinitialize. More...
 
void setColumnName (const string colname)
 
void setFormat (const string format)
 
void setOutfile (string outfilepath)
 
void setThreshold (double v)
 
void setUseSpikeMode (bool status)
 
void setUseStreamer (bool status)
 
void spike (double v)
 
 Table ()
 
void zipWithTime (const vector< double > &yvec, vector< double > &tvec, const double &lasttime)
 Take the vector from table and timestamp it. It must only be called when packing the data for writing. More...
 
 ~Table ()
 
- Public Member Functions inherited from TableBase
void clearVec ()
 
void compareVec (vector< double > other, string op)
 
void compareXplot (string fname, string plotname, string op)
 
const vector< double > & data ()
 
double getOutputValue () const
 
string getPlotDump () const
 
vector< double > getVec () const
 
unsigned int getVecSize () const
 
double getY (unsigned int index) const
 
double interpolate (double x, double xmin, double xmax) const
 
void linearTransform (double scale, double offset)
 
void loadCSV (string fname, int startLine, int colNum, char separator)
 
void loadXplot (string fname, string plotname)
 
void loadXplotRange (string fname, string plotname, unsigned int start, unsigned int end)
 
double * lookupVec (unsigned int index)
 
void plainPlot (string file)
 
void setOutputValue (double val)
 
void setPlotDump (string v)
 
void setVec (vector< double > val)
 
void setVecSize (unsigned int num)
 
 TableBase ()
 
void xplot (string file, string plotname)
 

Static Public Member Functions

static const CinfoinitCinfo ()
 
- Static Public Member Functions inherited from TableBase
static const CinfoinitCinfo ()
 

Private Attributes

vector< string > columns_
 
vector< double > data_
 Keep the data, each entry is preceeded by time value. t0, v0, t1, v1, t2, v2 etc. More...
 
double dt_
 dt of its clock. Needed for creating time co-ordinates, More...
 
bool fired_
 
string format_
 format of data. Default to csv. More...
 
double input_
 
double lastTime_
 
std::ofstream of_
 Output stream. More...
 
string outfile_
 
bool outfileIsSet_
 Wheather or not outfile path is set by user. More...
 
string rootdir_
 Table directory into which dump the stream data. More...
 
string tableColumnName_
 Column name of this table. Use it when writing data to a datafile. More...
 
string tablePath_
 
string text_
 text_ to write. More...
 
double threshold_
 
bool useSpikeMode_
 
bool useStreamer_
 If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting from pwd/_tables_ . On table, set streamToFile to true. More...
 

Additional Inherited Members

- Protected Member Functions inherited from TableBase
vector< double > & vec ()
 

Detailed Description

Receives and records inputs. Handles plot and spiking data in batch mode.

Definition at line 18 of file Table.h.

Constructor & Destructor Documentation

Table::Table ( )

Definition at line 213 of file Table.cpp.

References format_, outfileIsSet_, rootdir_, and useStreamer_.

213  :
214  threshold_( 0.0 ) ,
215  lastTime_( 0.0 ) ,
216  input_( 0.0 ),
217  fired_(false),
218  useSpikeMode_(false),
219  dt_( 0.0 )
220 {
221  // Initialize the directory to which each table should stream.
222  rootdir_ = "_tables";
223  useStreamer_ = false;
224  format_ = "csv";
225  outfileIsSet_ = false;
226 }
double input_
Definition: Table.h:76
double lastTime_
Definition: Table.h:75
string format_
format of data. Default to csv.
Definition: Table.h:119
bool outfileIsSet_
Wheather or not outfile path is set by user.
Definition: Table.h:114
bool fired_
Definition: Table.h:77
double dt_
dt of its clock. Needed for creating time co-ordinates,
Definition: Table.h:129
string rootdir_
Table directory into which dump the stream data.
Definition: Table.h:105
bool useSpikeMode_
Definition: Table.h:78
bool useStreamer_
If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting f...
Definition: Table.h:100
double threshold_
Definition: Table.h:74
Table::~Table ( )

Definition at line 228 of file Table.cpp.

References TableBase::clearVec(), columns_, data_, format_, lastTime_, outfile_, useStreamer_, TableBase::vec(), StreamerBase::writeToOutFile(), and zipWithTime().

229 {
230  // Make sure to write to rest of the entries to file before closing down.
231  if( useStreamer_ )
232  {
235  clearVec();
236  data_.clear();
237  }
238 }
vector< double > & vec()
Definition: TableBase.cpp:492
double lastTime_
Definition: Table.h:75
void clearVec()
Definition: TableBase.cpp:414
string format_
format of data. Default to csv.
Definition: Table.h:119
string outfile_
Definition: Table.h:109
void zipWithTime(const vector< double > &yvec, vector< double > &tvec, const double &lasttime)
Take the vector from table and timestamp it. It must only be called when packing the data for writing...
Definition: Table.cpp:453
bool useStreamer_
If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting f...
Definition: Table.h:100
vector< string > columns_
Definition: Table.h:85
vector< double > data_
Keep the data, each entry is preceeded by time value. t0, v0, t1, v1, t2, v2 etc. ...
Definition: Table.h:84
static void writeToOutFile(const string &filepath, const string &format, const string &openmode, const vector< double > &data, const vector< string > &columns)
Write to a output file in given format.

+ Here is the call graph for this function:

Member Function Documentation

string Table::getColumnName ( void  ) const

Definition at line 389 of file Table.cpp.

References tableColumnName_.

Referenced by Streamer::addTable(), and initCinfo().

390 {
391  return tableColumnName_;
392 }
string tableColumnName_
Column name of this table. Use it when writing data to a datafile.
Definition: Table.h:93

+ Here is the caller graph for this function:

double Table::getDt ( void  ) const

Definition at line 444 of file Table.cpp.

References dt_.

445 {
446  return dt_;
447 }
double dt_
dt of its clock. Needed for creating time co-ordinates,
Definition: Table.h:129
string Table::getFormat ( void  ) const

Definition at line 383 of file Table.cpp.

References format_.

Referenced by initCinfo().

384 {
385  return format_;
386 }
string format_
format of data. Default to csv.
Definition: Table.h:119

+ Here is the caller graph for this function:

string Table::getOutfile ( void  ) const

Definition at line 438 of file Table.cpp.

References outfile_.

Referenced by initCinfo().

439 {
440  return outfile_;
441 }
string outfile_
Definition: Table.h:109

+ Here is the caller graph for this function:

double Table::getThreshold ( ) const

Definition at line 365 of file Table.cpp.

References threshold_.

Referenced by initCinfo().

366 {
367  return threshold_;
368 }
double threshold_
Definition: Table.h:74

+ Here is the caller graph for this function:

bool Table::getUseSpikeMode ( void  ) const

Definition at line 416 of file Table.cpp.

References useSpikeMode_.

Referenced by initCinfo().

417 {
418  return useSpikeMode_;
419 }
bool useSpikeMode_
Definition: Table.h:78

+ Here is the caller graph for this function:

bool Table::getUseStreamer ( void  ) const

Definition at line 405 of file Table.cpp.

References useStreamer_.

Referenced by initCinfo().

406 {
407  return useStreamer_;
408 }
bool useStreamer_
If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting f...
Definition: Table.h:100

+ Here is the caller graph for this function:

const Cinfo * Table::initCinfo ( )
static

Definition at line 42 of file Table.cpp.

References getColumnName(), getFormat(), getOutfile(), getThreshold(), getUseSpikeMode(), getUseStreamer(), handleInput(), TableBase::initCinfo(), process(), reinit(), requestOut(), setColumnName(), setFormat(), setOutfile(), setThreshold(), setUseSpikeMode(), setUseStreamer(), spike(), and tableCinfo.

43 {
45  // Field Definitions
47  static ValueFinfo< Table, double > threshold(
48  "threshold"
49  , "threshold used when Table acts as a buffer for spikes"
52  );
53 
54  static ValueFinfo< Table, bool > useStreamer(
55  "useStreamer"
56  , "When set to true, write to a file instead writing in memory."
57  " If `outfile` is not set, streamer writes to default path."
60  );
61 
62  static ValueFinfo< Table, bool > useSpikeMode(
63  "useSpikeMode"
64  , "When set to true, look for spikes in a time-series."
65  " Normally used for monitoring Vm for action potentials."
66  " Could be used for any thresholded event. Default is False."
69  );
70 
71  static ValueFinfo< Table, string > outfile(
72  "outfile"
73  , "Set the name of file to which data is written to. If set, "
74  " streaming support is automatically enabled."
77  );
78 
79  static ValueFinfo< Table, string > format(
80  "format"
81  , "Data format for table: default csv"
84  );
85 
86  // relevant for Streamer class. When data is written to a datafile, this is
87  // used to create column name.
88  static ValueFinfo< Table, string > columnName(
89  "columnName"
90  , "Name of the table written in header of data file."
93  );
94 
96  // MsgDest Definitions
98 
99  static DestFinfo spike(
100  "spike",
101  "Fills spike timings into the Table. Signal has to exceed thresh",
103  );
104 
105  static DestFinfo process(
106  "process",
107  "Handles process call, updates internal time stamp.",
109  );
110 
111  static DestFinfo reinit(
112  "reinit",
113  "Handles reinit call.",
115  );
116 
118  // SharedMsg Definitions
120  static Finfo* procShared[] =
121  {
122  &process, &reinit
123  };
124 
125  static SharedFinfo proc(
126  "proc"
127  , "Shared message for process and reinit"
128  , procShared, sizeof( procShared ) / sizeof( const Finfo* )
129  );
130 
132  // Field Element for the vector data
133  // Use a limit of 2^20 entries for the tables, about 1 million.
135 
136  static Finfo* tableFinfos[] =
137  {
138  &threshold, // Value
139  &format, // Value
140  &columnName, // Value
141  &outfile, // Value
142  &useStreamer, // Value
143  &useSpikeMode, // Value
144  handleInput(), // DestFinfo
145  &spike, // DestFinfo
146  requestOut(), // SrcFinfo
147  &proc, // SharedFinfo
148  };
149 
150  static string doc[] =
151  {
152  "Name", "Table",
153  "Author", "Upi Bhalla",
154  "Description",
155  "Table for accumulating data values, or spike timings. "
156  "Can either receive incoming doubles, or can explicitly "
157  "request values from fields provided they are doubles. "
158  "The latter mode of use is preferable if you wish to have "
159  "independent control of how often you sample from the output "
160  "variable. \n"
161  "Typically used for storing simulation output into memory, or to file"
162  " when stream is set to True \n"
163  "There are two functionally identical variants of the Table "
164  "class: Table and Table2. Their only difference is that the "
165  "default scheduling of the Table (Clock Tick 8, dt = 0.1 ms ) "
166  "makes it suitable for "
167  "tracking electrical compartmental models of neurons and "
168  "networks. \n"
169  "Table2 (Clock Tick 18, dt = 1.0 s) is good for tracking "
170  "biochemical signaling pathway outputs. \n"
171  "These are just the default values and Tables can be assigned"
172  " to any Clock Tick and timestep in the usual manner.",
173  };
174 
175  static Dinfo< Table > dinfo;
176 
177  static Cinfo tableCinfo (
178  "Table",
180  tableFinfos,
181  sizeof( tableFinfos ) / sizeof ( Finfo* ),
182  &dinfo,
183  doc,
184  sizeof( doc ) / sizeof( string )
185  );
186 
187  static string doc2[] =
188  {
189  doc[0], "Table2", doc[2], doc[3], doc[4], doc[5]
190  };
191 
192  doc2[1] = "Table2";
193 
194  static Cinfo table2Cinfo (
195  "Table2",
197  tableFinfos,
198  sizeof( tableFinfos ) / sizeof ( Finfo* ),
199  &dinfo,
200  doc2,
201  sizeof( doc2 ) / sizeof( string )
202  );
203 
204  return &tableCinfo;
205 }
bool getUseStreamer(void) const
Definition: Table.cpp:405
void setUseStreamer(bool status)
Definition: Table.cpp:400
Definition: Dinfo.h:60
void reinit(const Eref &e, ProcPtr p)
Reinitialize.
Definition: Table.cpp:287
void setOutfile(string outfilepath)
Definition: Table.cpp:423
string getFormat() const
Definition: Table.cpp:383
static const Cinfo * initCinfo()
Definition: TableBase.cpp:15
void process(const Eref &e, ProcPtr p)
Definition: Table.cpp:250
static DestFinfo * handleInput()
Definition: Table.cpp:32
void setColumnName(const string colname)
Definition: Table.cpp:394
void setThreshold(double v)
Definition: Table.cpp:360
Definition: OpFunc.h:27
static SrcFinfo1< vector< double > * > * requestOut()
Definition: Table.cpp:23
string getColumnName() const
Definition: Table.cpp:389
static const Cinfo * tableCinfo
Definition: Table.cpp:211
double getThreshold() const
Definition: Table.cpp:365
string getOutfile(void) const
Definition: Table.cpp:438
bool getUseSpikeMode(void) const
Definition: Table.cpp:416
void setUseSpikeMode(bool status)
Definition: Table.cpp:411
void spike(double v)
Definition: Table.cpp:343
Definition: Cinfo.h:18
void setFormat(const string format)
Definition: Table.cpp:371
Definition: Finfo.h:12

+ Here is the call graph for this function:

void Table::input ( double  v)

Definition at line 338 of file Table.cpp.

References TableBase::vec().

Referenced by handleInput(), and testTable().

339 {
340  vec().push_back( v );
341 }
vector< double > & vec()
Definition: TableBase.cpp:492

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Table & Table::operator= ( const Table tab)

Definition at line 240 of file Table.cpp.

241 {
242  return *this;
243 }
void Table::process ( const Eref e,
ProcPtr  p 
)

Definition at line 250 of file Table.cpp.

References TableBase::clearVec(), columns_, ProcInfo::currTime, data_, format_, TableBase::getVecSize(), lastTime_, outfile_, requestOut(), spike(), useSpikeMode_, useStreamer_, TableBase::vec(), StreamerBase::writeToOutFile(), and zipWithTime().

Referenced by initCinfo().

251 {
252  lastTime_ = p->currTime;
253 
254  // Copy incoming data to ret and insert into vector.
255  vector< double > ret;
256  requestOut()->send( e, &ret );
257  if (useSpikeMode_) {
258  for ( vector< double >::const_iterator
259  i = ret.begin(); i != ret.end(); ++i )
260  spike( *i );
261  } else {
262  vec().insert( vec().end(), ret.begin(), ret.end() );
263  }
264 
265  /* If we are streaming to a file, let's write to a file. And clean the
266  * vector.
267  * Write at every 5 seconds or whenever size of vector is more than 10k.
268  */
269  if( useStreamer_ )
270  {
271  if( fmod(lastTime_, 5.0) == 0.0 or getVecSize() >= 10000 )
272  {
275  data_.clear();
276  clearVec();
277  }
278  }
279 }
vector< double > & vec()
Definition: TableBase.cpp:492
double currTime
Definition: ProcInfo.h:19
double lastTime_
Definition: Table.h:75
void clearVec()
Definition: TableBase.cpp:414
string format_
format of data. Default to csv.
Definition: Table.h:119
string outfile_
Definition: Table.h:109
unsigned int getVecSize() const
Definition: TableBase.cpp:477
void zipWithTime(const vector< double > &yvec, vector< double > &tvec, const double &lasttime)
Take the vector from table and timestamp it. It must only be called when packing the data for writing...
Definition: Table.cpp:453
static SrcFinfo1< vector< double > * > * requestOut()
Definition: Table.cpp:23
bool useSpikeMode_
Definition: Table.h:78
bool useStreamer_
If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting f...
Definition: Table.h:100
vector< string > columns_
Definition: Table.h:85
vector< double > data_
Keep the data, each entry is preceeded by time value. t0, v0, t1, v1, t2, v2 etc. ...
Definition: Table.h:84
static void writeToOutFile(const string &filepath, const string &format, const string &openmode, const vector< double > &data, const vector< string > &columns)
Write to a output file in given format.
void spike(double v)
Definition: Table.cpp:343

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Table::reinit ( const Eref e,
ProcPtr  p 
)

Reinitialize.

Parameters
e
p

Create the default filepath for this table.

Definition at line 287 of file Table.cpp.

References TableBase::clearVec(), columns_, Eref::data(), data_, dt_, Eref::element(), Id::eref(), fired_, format_, Element::getTick(), Clock::getTickDt(), Eref::id(), input_, lastTime_, moose::moosePathToUserPath(), outfile_, outfileIsSet_, Id::path(), requestOut(), rootdir_, setOutfile(), spike(), tablePath_, useSpikeMode_, useStreamer_, TableBase::vec(), StreamerBase::writeToOutFile(), and zipWithTime().

Referenced by initCinfo().

288 {
289  tablePath_ = e.id().path();
290  unsigned int numTick = e.element()->getTick();
291  Clock* clk = reinterpret_cast<Clock*>(Id(1).eref().data());
292  dt_ = clk->getTickDt( numTick );
293  fired_ = false;
294 
296  if( useStreamer_ )
297  {
298  // The first column is variable time.
299  columns_.push_back( "time" );
300  // And the second column name is the name of the table.
302 
303  // If user has not set the filepath, then use the table path prefixed
304  // with rootdit as path.
305  if( ! outfileIsSet_ )
308  );
309  }
310 
311  input_ = 0.0;
312  vec().resize( 0 );
313  lastTime_ = 0;
314  vector< double > ret;
315  requestOut()->send( e, &ret );
316  if (useSpikeMode_) {
317  for ( vector< double >::const_iterator
318  i = ret.begin(); i != ret.end(); ++i )
319  spike( *i );
320  } else {
321  vec().insert( vec().end(), ret.begin(), ret.end() );
322  }
323 
324  if( useStreamer_ )
325  {
328  clearVec();
329  data_.clear();
330  clearVec();
331  }
332 }
Id id() const
Definition: Eref.cpp:62
char * data() const
Definition: Eref.cpp:41
double input_
Definition: Table.h:76
vector< double > & vec()
Definition: TableBase.cpp:492
Definition: Clock.h:25
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
double lastTime_
Definition: Table.h:75
void clearVec()
Definition: TableBase.cpp:414
string format_
format of data. Default to csv.
Definition: Table.h:119
double getTickDt(unsigned int i) const
Definition: Clock.cpp:621
Eref eref() const
Definition: Id.cpp:125
Element * element() const
Definition: Eref.h:42
bool outfileIsSet_
Wheather or not outfile path is set by user.
Definition: Table.h:114
string moosePathToUserPath(string path)
When user gives a path /a/b/c, moose creates a path /a[0]/b[0]/c[0]. This is helpful in cases where o...
Definition: global.cpp:189
void setOutfile(string outfilepath)
Definition: Table.cpp:423
int getTick() const
Definition: Element.cpp:186
string outfile_
Definition: Table.h:109
bool fired_
Definition: Table.h:77
void zipWithTime(const vector< double > &yvec, vector< double > &tvec, const double &lasttime)
Take the vector from table and timestamp it. It must only be called when packing the data for writing...
Definition: Table.cpp:453
double dt_
dt of its clock. Needed for creating time co-ordinates,
Definition: Table.h:129
string rootdir_
Table directory into which dump the stream data.
Definition: Table.h:105
static SrcFinfo1< vector< double > * > * requestOut()
Definition: Table.cpp:23
bool useSpikeMode_
Definition: Table.h:78
bool useStreamer_
If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting f...
Definition: Table.h:100
string tablePath_
Definition: Table.h:87
Definition: Id.h:17
vector< string > columns_
Definition: Table.h:85
vector< double > data_
Keep the data, each entry is preceeded by time value. t0, v0, t1, v1, t2, v2 etc. ...
Definition: Table.h:84
static void writeToOutFile(const string &filepath, const string &format, const string &openmode, const vector< double > &data, const vector< string > &columns)
Write to a output file in given format.
void spike(double v)
Definition: Table.cpp:343

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Table::setColumnName ( const string  colname)

Definition at line 394 of file Table.cpp.

References tableColumnName_.

Referenced by initCinfo().

395 {
396  tableColumnName_ = colname ;
397 }
string tableColumnName_
Column name of this table. Use it when writing data to a datafile.
Definition: Table.h:93

+ Here is the caller graph for this function:

void Table::setFormat ( const string  format)

Definition at line 371 of file Table.cpp.

References format_, LOG, and moose::warning.

Referenced by initCinfo().

372 {
373  if( format == "csv" or format == "npy" )
374  format_ = format;
375  else
377  , "Unsupported format " << format
378  << " only npy and csv are supported"
379  );
380 }
string format_
format of data. Default to csv.
Definition: Table.h:119

+ Here is the caller graph for this function:

void Table::setOutfile ( string  outfilepath)

Definition at line 423 of file Table.cpp.

References moose::createMOOSEPath(), moose::createParentDirs(), format_, moose::getExtension(), outfile_, outfileIsSet_, setUseStreamer(), and moose::toFilename().

Referenced by initCinfo(), and reinit().

424 {
425  outfile_ = moose::createMOOSEPath( outpath );
428 
429  outfileIsSet_ = true;
430  setUseStreamer( true );
431 
432  // If possible get the format of file as well.
434  if( format_.size() == 0 )
435  format_ = "csv";
436 }
void setUseStreamer(bool status)
Definition: Table.cpp:400
bool createParentDirs(const string &path)
Create directories recursively needed to open the given file p.
Definition: global.cpp:122
string format_
format of data. Default to csv.
Definition: Table.h:119
bool outfileIsSet_
Wheather or not outfile path is set by user.
Definition: Table.h:114
string getExtension(const string &path, bool without_dot)
Get the extension of a given filepath.
Definition: global.cpp:170
string outfile_
Definition: Table.h:109
string toFilename(const string &path)
Replace all directory sepearator with _. This creates a filepath which can be created in current dire...
Definition: global.cpp:161
string createMOOSEPath(const string &path)
Create a POSIX compatible path from a given string. Remove/replace bad characters.
Definition: global.cpp:105

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Table::setThreshold ( double  v)

Definition at line 360 of file Table.cpp.

References threshold_.

Referenced by initCinfo().

361 {
362  threshold_ = v;
363 }
double threshold_
Definition: Table.h:74

+ Here is the caller graph for this function:

void Table::setUseSpikeMode ( bool  status)

Definition at line 411 of file Table.cpp.

References useSpikeMode_.

Referenced by initCinfo().

412 {
413  useSpikeMode_ = useSpikeMode;
414 }
bool useSpikeMode_
Definition: Table.h:78

+ Here is the caller graph for this function:

void Table::setUseStreamer ( bool  status)

Definition at line 400 of file Table.cpp.

References useStreamer_.

Referenced by initCinfo(), and setOutfile().

401 {
402  useStreamer_ = useStreamer;
403 }
bool useStreamer_
If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting f...
Definition: Table.h:100

+ Here is the caller graph for this function:

void Table::spike ( double  v)

Definition at line 343 of file Table.cpp.

References fired_, lastTime_, threshold_, and TableBase::vec().

Referenced by initCinfo(), process(), and reinit().

344 {
345  if ( fired_ ) { // Wait for it to go below threshold
346  if ( v < threshold_ )
347  fired_ = false;
348  } else {
349  if ( v > threshold_ ) { // wait for it to go above threshold.
350  fired_ = true;
351  vec().push_back( lastTime_ );
352  }
353  }
354 }
vector< double > & vec()
Definition: TableBase.cpp:492
double lastTime_
Definition: Table.h:75
bool fired_
Definition: Table.h:77
double threshold_
Definition: Table.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Table::zipWithTime ( const vector< double > &  yvec,
vector< double > &  tvec,
const double &  lasttime 
)

Take the vector from table and timestamp it. It must only be called when packing the data for writing.

Definition at line 453 of file Table.cpp.

References dt_.

Referenced by process(), reinit(), and ~Table().

457 {
458  size_t N = v.size();
459  for (size_t i = 0; i < N; i++)
460  {
461  tvec.push_back( currTime - (N - i - 1 ) * dt_ );
462  tvec.push_back( v[i] );
463  }
464 }
double dt_
dt of its clock. Needed for creating time co-ordinates,
Definition: Table.h:129

+ Here is the caller graph for this function:

Member Data Documentation

vector<string> Table::columns_
private

Definition at line 85 of file Table.h.

Referenced by process(), reinit(), and ~Table().

vector<double> Table::data_
private

Keep the data, each entry is preceeded by time value. t0, v0, t1, v1, t2, v2 etc.

Definition at line 84 of file Table.h.

Referenced by process(), reinit(), and ~Table().

double Table::dt_
private

dt of its clock. Needed for creating time co-ordinates,

Definition at line 129 of file Table.h.

Referenced by getDt(), reinit(), and zipWithTime().

bool Table::fired_
private

Definition at line 77 of file Table.h.

Referenced by reinit(), and spike().

string Table::format_
private

format of data. Default to csv.

Definition at line 119 of file Table.h.

Referenced by getFormat(), process(), reinit(), setFormat(), setOutfile(), Table(), and ~Table().

double Table::input_
private

Definition at line 76 of file Table.h.

Referenced by reinit().

double Table::lastTime_
private

Definition at line 75 of file Table.h.

Referenced by process(), reinit(), spike(), and ~Table().

std::ofstream Table::of_
private

Output stream.

Definition at line 134 of file Table.h.

string Table::outfile_
private

Definition at line 109 of file Table.h.

Referenced by getOutfile(), process(), reinit(), setOutfile(), and ~Table().

bool Table::outfileIsSet_
private

Wheather or not outfile path is set by user.

Definition at line 114 of file Table.h.

Referenced by reinit(), setOutfile(), and Table().

string Table::rootdir_
private

Table directory into which dump the stream data.

Definition at line 105 of file Table.h.

Referenced by reinit(), and Table().

string Table::tableColumnName_
private

Column name of this table. Use it when writing data to a datafile.

Definition at line 93 of file Table.h.

Referenced by getColumnName(), and setColumnName().

string Table::tablePath_
private

Definition at line 87 of file Table.h.

Referenced by reinit().

string Table::text_
private

text_ to write.

Definition at line 124 of file Table.h.

double Table::threshold_
private

Definition at line 74 of file Table.h.

Referenced by getThreshold(), setThreshold(), and spike().

bool Table::useSpikeMode_
private

Definition at line 78 of file Table.h.

Referenced by getUseSpikeMode(), process(), reinit(), and setUseSpikeMode().

bool Table::useStreamer_
private

If stream is set to true, then stream to outfile_. Default value of outfile_ is table path starting from pwd/_tables_ . On table, set streamToFile to true.

Definition at line 100 of file Table.h.

Referenced by getUseStreamer(), process(), reinit(), setUseStreamer(), Table(), and ~Table().


The documentation for this class was generated from the following files: