Relacs Numerics Library  0.9.8
Public Types | Public Member Functions | Friends | List of all members
EventData Class Reference

#include <eventdata.h>

Public Types

typedef EventIterator const_iterator
 

Public Member Functions

 EventData (void)
 
 EventData (int n, bool sizebuffer=false, bool widthbuffer=false)
 
 EventData (int n, double tbegin, double tend, double stepsize=0.0001, bool sizebuffer=false, bool widthbuffer=false)
 
 EventData (const EventData &events)
 
 EventData (const EventData *events)
 
 EventData (const EventData &events, double tbegin, double tend)
 
 EventData (const EventData &events, double tbegin, double tend, double tref)
 
 EventData (const ArrayD &times, double tbegin=-HUGE_VAL, double tend=HUGE_VAL, double stepsize=0.0001)
 
 EventData (const ArrayD &times, const ArrayD &sizes, double tbegin=-HUGE_VAL, double tend=HUGE_VAL, double stepsize=0.0001)
 
 EventData (const ArrayD &times, const ArrayD &sizes, const ArrayD &width, double tbegin=-HUGE_VAL, double tend=HUGE_VAL, double stepsize=0.0001)
 
 ~EventData (void)
 
int size (void) const
 
bool empty (void) const
 
void resize (int nevents, double dflt=0.0)
 
void clear (void)
 
int capacity (void) const
 
void reserve (int n, double dflt=0.0)
 
void free (int n=0, double dflt=0.0)
 
int writeBufferCapacity (void) const
 
void setWriteBufferCapacity (int m)
 
bool cyclic (void) const
 
void setCyclic (bool cyclic=true)
 
bool sizeBuffer (void) const
 
bool useSizeBuffer (void) const
 
void setSizeBuffer (bool use=true)
 
bool widthBuffer (void) const
 
bool useWidthBuffer (void) const
 
void setWidthBuffer (bool use=true)
 
LinearRangerange (void)
 
const LinearRangerange (void) const
 
double offset (void) const
 
void setOffset (double offset)
 
double length (void) const
 
void setLength (double duration)
 
double stepsize (void) const
 
void setStepsize (double stepsize)
 
double rangeFront (void) const
 
void setRangeFront (double front)
 
double rangeBack (void) const
 
void setRangeBack (double back)
 
double signalTime (void) const
 
void setSignalTime (double s)
 
EventDataoperator= (const EventData &events)
 
EventDataoperator= (const ArrayD &times)
 
void assign (const EventData &events)
 
void assign (const EventData &events, double tbegin, double tend)
 
void assign (const EventData &events, double tbegin, double tend, double tref)
 
void assign (const ArrayD &times, double tbegin=-HUGE_VAL, double tend=HUGE_VAL, double stepsize=0.0001)
 
void assign (const ArrayD &times, const ArrayD &sizes, double tbegin=-HUGE_VAL, double tend=HUGE_VAL, double stepsize=0.0001)
 
void assign (const ArrayD &times, const ArrayD &sizes, const ArrayD &width, double tbegin=-HUGE_VAL, double tend=HUGE_VAL, double stepsize=0.0001)
 
const EventDataassign (const EventData *events)
 
const EventDataassign (void)
 
void update (void)
 
void append (const EventData &events, double tbegin, double tend)
 
void append (const EventData &events, double tbegin, double tend, double tref)
 
void copy (double tbegin, double tend, double *events, int &nevents) const
 
void copy (double tbegin, double tend, double tref, double *events, int &nevents) const
 
void copy (double tbegin, double tend, vector< double > &events) const
 
void copy (double tbegin, double tend, double tref, vector< double > &events) const
 
void copy (double tbegin, double tend, ArrayD &events) const
 
void copy (double tbegin, double tend, double tref, ArrayD &events) const
 
void copy (double tbegin, double tend, MapD &events) const
 
void copy (double tbegin, double tend, double tref, MapD &events) const
 
void copy (double tbegin, double tend, EventData &events) const
 
void copy (double tbegin, double tend, double tref, EventData &events) const
 
double operator[] (int i) const
 
double & operator[] (int i)
 
double at (int i) const
 
double & at (int i)
 
double front (void) const
 
double & front (void)
 
double front (int n) const
 
double & front (int n)
 
double back (void) const
 
double & back (void)
 
double back (int n) const
 
double & back (int n)
 
const_iterator begin (void) const
 
const_iterator begin (double time) const
 
const_iterator minBegin (void) const
 
const_iterator end (void) const
 
double eventSize (int i) const
 
double & eventSize (int i)
 
double frontSize (void) const
 
double & frontSize (void)
 
double frontSize (int n) const
 
double & frontSize (int n)
 
double backSize (void) const
 
double & backSize (void)
 
double backSize (int n) const
 
double & backSize (int n)
 
double eventWidth (int i) const
 
double & eventWidth (int i)
 
double frontWidth (void) const
 
double & frontWidth (void)
 
double frontWidth (int n) const
 
double & frontWidth (int n)
 
double backWidth (void) const
 
double & backWidth (void)
 
double backWidth (int n) const
 
double & backWidth (int n)
 
void push (double time, double size=1.0, double width=0.0)
 
void push (const ArrayD &time, double size=1.0, double width=0.0)
 
void set (int index, const ArrayD &time, const ArrayD &size, const ArrayD &width)
 
void insert (double time, double size=0.0, double width=0.0)
 
void insert (const EventData &e)
 
void erase (int index)
 
void erase (const_iterator iter)
 
void pop (void)
 
const double * data (void) const
 
double * data (void)
 
void sum (const EventData &e, EventData &all) const
 
void sync (const EventData &e, EventData &s, double bin) const
 
const EventDataoperator+= (double x)
 
const EventDataoperator-= (double x)
 
const EventDataoperator*= (double x)
 
const EventDataoperator/= (double x)
 
const EventDataoperator+= (const EventData &e)
 
EventData operator+ (const EventData &e) const
 
EventData operator* (const EventData &e) const
 
bool check (void) const
 
string message (void) const
 
int currentEvent (void) const
 
int minEvent (void) const
 
double minTime (void) const
 
int mode (void) const
 
void setMode (int mode)
 
int source (void) const
 
void setSource (int source)
 
const string & ident (void) const
 
void setIdent (const string &ident)
 
const string & sizeName (void) const
 
void setSizeName (const string &name)
 
double sizeScale (void) const
 
void setSizeScale (double scale)
 
const string & sizeUnit (void) const
 
void setSizeUnit (const string &unit)
 
const string & sizeFormat (void) const
 
void setSizeFormat (const string &format)
 
double minSize (double tbegin, double tend) const
 
double maxSize (double tbegin, double tend) const
 
void minMaxSize (double tbegin, double tend, double &min, double &max) const
 
double meanSize (double tbegin, double tend, double &stdev) const
 
double meanSize (double tbegin, double tend) const
 
double meanSize (double time) const
 
double meanSize (void) const
 
void setMeanSize (double meansize)
 
void updateMeanSize (int n=1, double size=0.0)
 
void sizeHist (double tbegin, double tend, SampleDataD &hist) const
 
const double * sizeData (void) const
 
double * sizeData (void)
 
const string & widthName (void) const
 
void setWidthName (const string &name)
 
double widthScale (void) const
 
void setWidthScale (double scale)
 
const string & widthUnit (void) const
 
void setWidthUnit (const string &unit)
 
const string & widthFormat (void) const
 
void setWidthFormat (const string &format)
 
double minWidth (double tbegin, double tend) const
 
double maxWidth (double tbegin, double tend) const
 
void minMaxWidth (double tbegin, double tend, double &min, double &max) const
 
double meanWidth (double tbegin, double tend) const
 
double meanWidth (void) const
 
void setMeanWidth (double meanwidth)
 
void updateMeanWidth (int n=1, double width=0.0)
 
void widthHist (double tbegin, double tend, SampleDataD &hist) const
 
const double * widthData (void) const
 
double * widthData (void)
 
double meanRate (void) const
 
void setMeanRate (double meanrate)
 
void updateMeanRate (int n=1, double rate=0.0)
 
void updateMean (int n=1, double size=0.0, double width=0.0, double rate=0.0)
 
double meanQuality (void) const
 
void setMeanQuality (double meanquality)
 
void updateMeanQuality (bool good=false)
 
double meanRatio (void) const
 
void setMeanRatio (double ratio)
 
int next (double time) const
 
double nextTime (double time, double dflt=-HUGE_VAL) const
 
int previous (double time) const
 
double previousTime (double time, double dflt=-HUGE_VAL) const
 
bool within (double time, double distance) const
 
int count (double tbegin, double tend) const
 
int count (double time) const
 
double rate (double tbegin, double tend) const
 
double rate (int n) const
 
double rate (double time) const
 
void rate (SampleDataD &rate, double width=0.0, double time=0.0) const
 
void addRate (SampleDataD &rate, int &trial, double width=0.0, double time=0.0) const
 
void cyclicRate (SampleDataD &rate, double width=0.0, double time=0.0) const
 
void addCyclicRate (SampleDataD &rate, int &trial, double width=0.0, double time=0.0) const
 
void rate (SampleDataD &rate, const Kernel &kernel, double time=0.0) const
 
void addRate (SampleDataD &rate, int &trial, const Kernel &kernel, double time=0.0) const
 
void cyclicRate (SampleDataD &rate, const Kernel &kernel, double time=0.0) const
 
void addCyclicRate (SampleDataD &rate, int &trial, const Kernel &kernel, double time=0.0) const
 
double interval (double tbegin, double tend, double *sd=0) const
 
double interval (double time, double *sd=0) const
 
double interval (int n, double *sd) const
 
double intervalAt (double time) const
 
void interval (SampleDataD &intervals, double time=0.0) const
 
void addInterval (SampleDataD &intervals, int &trial, double time=0.0) const
 
void cyclicInterval (SampleDataD &intervals, double time=0.0) const
 
void addCyclicInterval (SampleDataD &intervals, int &trial, double time=0.0) const
 
int intervals (double tbegin, double tend, ArrayD &intervals) const
 
int addIntervals (double tbegin, double tend, ArrayD &intervals) const
 
int intervals (double tbegin, double tend, MapD &intrvls, int pos=-1) const
 
int addIntervals (double tbegin, double tend, MapD &intrvls, int pos=-1) const
 
int saveIntervals (double tbegin, double tend, ostream &os, int pos=-1, double tfac=1.0, int width=0, int prec=5, char frmt='g', const string &noevents="") const
 
double frequency (double tbegin, double tend, double *sd=0) const
 
double frequency (double time, double *sd=0) const
 
double frequency (int n, double *sd=0) const
 
double frequencyAt (double time, double defaultfrequency=0.0) const
 
void frequency (SampleDataD &rate, double time=0.0, double defaultfrequency=0.0) const
 
void addFrequency (SampleDataD &rate, int &trial, double time=0.0, double defaultfrequency=0.0) const
 
void addFrequency (SampleDataD &rate, SampleDataD &ratesq, int &trial, double time=0.0, double defaultfrequency=0.0) const
 
void cyclicFrequency (SampleDataD &rate, double time=0.0) const
 
void addCyclicFrequency (SampleDataD &rate, int &trial, double time=0.0) const
 
void addCyclicFrequency (SampleDataD &rate, SampleDataD &period, int &trial, double time=0.0) const
 
int frequencies (double tbegin, double tend, MapD &freqs, int pos=-1) const
 
int addFrequencies (double tbegin, double tend, MapD &freqs, int pos=-1) const
 
int saveFrequencies (double tbegin, double tend, ostream &os, int pos=-1, double tfac=1.0, int width=0, int prec=5, char frmt='g', const string &noevents="") const
 
void intervalHistogram (double tbegin, double tend, SampleDataD &hist) const
 
void addIntervalHistogram (double tbegin, double tend, SampleDataD &hist) const
 
void serialCorr (double tbegin, double tend, ArrayD &sc) const
 
void fano (double tbegin, double tend, SampleDataD &ff) const
 
double locking (double tbegin, double tend, double period) const
 
double vectorStrength (double tbegin, double tend, double period) const
 
double vectorPhase (double tbegin, double tend, double period) const
 
int average (double tbegin, double tend, const SampleDataD &trace, SampleDataD &ave) const
 
int average (double tbegin, double tend, const SampleDataD &trace, SampleDataD &ave, SampleDataD &sd) const
 
int average (double tbegin, double tend, const SampleDataD &trace, SampleDataD &ave, SampleDataD &sd, vector< SampleDataD > &snippets) const
 
void spectrum (double tbegin, double tend, double step, SampleDataD &psd, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
void coherence (const SampleDataD &stimulus, SampleDataD &c, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
void coherence (const EventData &e, double tbegin, double tend, double step, SampleDataD &c, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
double latency (double time) const
 
void poisson (double rate, double refract, double duration, RandomBase &random=rnd)
 
void saveText (ostream &os, double tfac=1.0, int width=0, int prec=5, char frmt='g', const string &noevents="") const
 
void savePoint (ostream &os, double y=0.0, double tfac=1.0, int width=0, int prec=5, char frmt='g', const string &noevents="", double noy=-1.0) const
 
void saveStroke (ostream &os, int offs=0, double tfac=1.0, int width=0, int prec=5, char frmt='g', double lower=0.1, double upper=0.9, const string &noevents="", double noy=-1.0) const
 
void saveBox (ostream &os, double bin, int offs=0, double tfac=1.0, int width=0, int prec=5, char frmt='g', double lower=0.1, double upper=0.9, const string &noevents="", double noy=-1.0) const
 

Friends

class EventIterator
 
ostream & operator<< (ostream &str, const EventData &events)
 

Detailed Description

Class for event times that can also be an infinite ring-buffer.

Author
Jan Benda
Version
2.1
Bug:
why does spikes.erase( spikes.begin() ) not compile?
Todo:
check equal size of input SampleDataD in e.g. rate, etc.

Member Typedef Documentation

Const Iterator used to iterate through an EventData.

Constructor & Destructor Documentation

EventData ( void  )

Constructs an empty EventData with a stepsize() of 0.0001 seconds (0.1 ms) and a non-cyclic buffer.

References EventData::clear().

EventData ( int  n,
bool  sizebuffer = false,
bool  widthbuffer = false 
)

Constructs an EventData that can hold (has a capacity() of) n events with a stepsize() of 0.0001 seconds (0.1 ms) and a non-cyclic buffer. If sizebuffer is true, an additional buffer for the sizes of events is created. If widthbuffer is true, an additional buffer for the widths of events is created.

References EventData::clear(), and EventData::reserve().

EventData ( int  n,
double  tbegin,
double  tend,
double  stepsize = 0.0001,
bool  sizebuffer = false,
bool  widthbuffer = false 
)

Constructs an EventData that can hold (has a capacity() of) n events beginning at time tbegin, ending at time tend, and with stepsize stepsize and a non-cyclic buffer. If sizebuffer is true, an additional buffer for the sizes of events is created. If widthbuffer is true, an additional buffer for the widths of events is created.

References EventData::clear(), and EventData::reserve().

EventData ( const EventData events)

Copy constructor. Copy the entire event list of events to *this.

References EventData::assign().

EventData ( const EventData events)

Creates an EventData with the same size and content as events that shares the data buffers with the ones of events.

References EventData::assign().

EventData ( const EventData events,
double  tbegin,
double  tend 
)

Copy from events all events between tbegin and tend seconds to *this. In the copy, all event times and the signalTime() are set relative to time tbegin.

References EventData::assign().

EventData ( const EventData events,
double  tbegin,
double  tend,
double  tref 
)

Copy from events all event times between time tbegin and time tend seconds. In the copy, all event times and the signalTime() are set relative to time tref.

References EventData::assign().

EventData ( const ArrayD times,
double  tbegin = -HUGE_VAL,
double  tend = HUGE_VAL,
double  stepsize = 0.0001 
)

Copy the event times times to *this and initializes the range with tbegin, tend, and stepsize. By default tbegin and tend are set to the first and last event of times.

References EventData::assign().

EventData ( const ArrayD times,
const ArrayD sizes,
double  tbegin = -HUGE_VAL,
double  tend = HUGE_VAL,
double  stepsize = 0.0001 
)

Copy the event times times and their correspondiong sizes sizes to *this and initializes the range with tbegin, tend, and stepsize. By default tbegin and tend are set to the first and last event of times.

References EventData::assign().

EventData ( const ArrayD times,
const ArrayD sizes,
const ArrayD width,
double  tbegin = -HUGE_VAL,
double  tend = HUGE_VAL,
double  stepsize = 0.0001 
)

Copy the event times times and their correspondiong sizes sizes and widths widths to *this and initializes the range with tbegin, tend, and stepsize. By default tbegin and tend are set to the first and last event of times.

References EventData::assign().

~EventData ( void  )

Destructs an EventData.

Member Function Documentation

int size ( void  ) const
bool empty ( void  ) const

True if there are no events.

Referenced by EventData::sync().

void resize ( int  nevents,
double  dflt = 0.0 
)

Resize the content of the buffers to nevents. If nevents equals zero, clear() is called. Otherwise the buffer content is only resized if the buffer is not cyclic. If a larger size is requested, new event data elements are initialized with dflt. New size data and width data are initialized with zero.

Warning
The capacity of the event buffer is enlarged only. It is never shrinked. Use free() to control the buffer size. The range() is not changed.
See Also
clear(), size(), empty(), reserve(), free(), capacity()

References EventData::clear(), and EventData::reserve().

Referenced by EventData::insert().

void clear ( void  )
int capacity ( void  ) const
void reserve ( int  n,
double  dflt = 0.0 
)

If n is less than or equal to capacity(), this call has no effect. Otherwise, it is a request for allocation of additional memory to hold n events altogether. If useSizeBuffer() is true, an additional buffer for the sizes of events is created. If useWidthBuffer() is true, an additional buffer for the widths of events is created. The first size() or capacity() elements of the event, size, and width buffers are preserved whichever is smaller. The remaining event data elements are initialized with dflt. New size data and width data are initialized with zero. The range() is not changed.

See Also
free(), capacity(), resize(), clear(), size(), empty()

Referenced by EventData::append(), EventData::assign(), EventData::copy(), EventData::EventData(), EventData::insert(), EventData::poisson(), EventData::push(), EventData::resize(), EventData::set(), Detector< DataIter, TimeIter >::setHistorySize(), EventData::sum(), EventData::sync(), and EventList::sync().

void free ( int  n = 0,
double  dflt = 0.0 
)

In contrast to the reserve() function, this function frees or allocates memory, such that capacity() equals exactly n. If useSizeBuffer() is true, an additional buffer for the sizes of events is created. If useWidthBuffer() is true, an additional buffer for the widths of events is created. The first size() or capacity() elements of the event, size, and width buffers are preserved whichever is smaller. The remaining event data elements are initialized with dflt. New size data and width data are initialized with zero. The range() is not changed.

See Also
reserve(), capacity(), resize(), clear(), size(), empty()

References EventData::clear().

int writeBufferCapacity ( void  ) const
Returns
the size of the part of the buffers reserved for writing new data.
void setWriteBufferCapacity ( int  m)

Set the capacity of the part of the bufers to be used for writing new data to m. If m is greater than capacity() it is set to capacity().

References EventData::capacity().

bool cyclic ( void  ) const

True if events are stored in a cyclic buffer.

Referenced by EventData::erase(), EventData::insert(), and EventData::setCyclic().

void setCyclic ( bool  cyclic = true)

Set buffer to cyclic mode (cyclic = true) or non-cyclic mode (cyclic = false).

References EventData::cyclic().

Referenced by EventData::copy(), and Detector< DataIter, TimeIter >::Detector().

bool sizeBuffer ( void  ) const

True if an additional buffer for the sizes of the events exist.

Referenced by EventData::copy(), and Map< T >::Map().

bool useSizeBuffer ( void  ) const

True if an additional buffer for the sizes of the events exist or is going to be used.

void setSizeBuffer ( bool  use = true)

If use is set to true, the next call of reserve will create an additional buffer for event sizes.

bool widthBuffer ( void  ) const

True if an additional buffer for the widths of the events exist.

Referenced by EventData::copy(), and Map< T >::Map().

bool useWidthBuffer ( void  ) const

True if an additional buffer for the widths of the events exist or is going to be used.

void setWidthBuffer ( bool  use = true)

If use is set to true, the next call of reserve will create an additional buffer for event widths.

LinearRange & range ( void  )

The range that contains the events.

const LinearRange & range ( void  ) const

The range that contains the events.

double offset ( void  ) const

The beginning of the range() containing the events.

References LinearRange::offset().

Referenced by EventData::insert(), EventData::sum(), EventList::sum(), EventData::sync(), and EventList::sync().

void setOffset ( double  offset)

Set the beginning of the range() containing the events to offset.

References LinearRange::setOffset().

Referenced by EventData::insert(), EventData::sum(), EventData::sync(), and EventList::sync().

double length ( void  ) const

The length of the range() containing the events.

References LinearRange::length().

void setLength ( double  duration)

Set the length of the range() containing the events to duration.

References LinearRange::setLength().

double stepsize ( void  ) const

The stepsize of the range() containing the events, i.e. the resolution of the event times.

References LinearRange::stepsize().

Referenced by EventData::copy(), EventData::insert(), EventData::sum(), EventList::sum(), EventData::sync(), and EventList::sync().

void setStepsize ( double  stepsize)

Set the stepsize (resolution) of the range() containing the events to stepsize.

References LinearRange::setStepsize().

Referenced by EventData::insert(), EventData::sum(), EventData::sync(), and EventList::sync().

double rangeFront ( void  ) const

The beginning of the range() containing the events. Same as offset().

References LinearRange::front().

void setRangeFront ( double  front)

Set the offset of the range containing the events to front without changing the last range element.

References LinearRange::setFront().

double rangeBack ( void  ) const

Returns the last element of the range containing the events.

References LinearRange::back().

Referenced by EventData::insert(), EventData::sum(), EventList::sum(), EventData::sync(), and EventList::sync().

void setRangeBack ( double  back)

Resize the range containing the events such that the last range element equals back.

References LinearRange::setBack().

Referenced by EventData::insert(), EventData::sum(), EventData::sync(), and EventList::sync().

double signalTime ( void  ) const

Returns the time of the signal. If there wasn't any signal yet, -HUGE_VAL is returned.

void setSignalTime ( double  s)

Set the time of the signal to s.

EventData & operator= ( const EventData events)

Copy events to *this.

References EventData::assign().

EventData & operator= ( const ArrayD times)

Copy the event times times to *this.

References EventData::assign().

void assign ( const EventData events)

Make *this a copy of events.

References EventData::capacity(), EventData::clear(), and EventData::reserve().

Referenced by EventList::sum().

void assign ( const EventData events,
double  tbegin,
double  tend 
)

Copy from events all events between time tbegin and time tend seconds to *this. In the copy, all event times and the signalTime() are set relative to time tbegin.

References EventData::clear(), EventData::eventSize(), EventData::eventWidth(), EventData::next(), EventData::previous(), EventData::reserve(), LinearRange::setLength(), and LinearRange::setOffset().

void assign ( const EventData events,
double  tbegin,
double  tend,
double  tref 
)

Copy from events all event times between time tbegin and time tend seconds to *this. In the copy, all event times and the signalTime() are set relative to time tref.

References EventData::clear(), EventData::eventSize(), EventData::eventWidth(), EventData::next(), EventData::previous(), EventData::reserve(), LinearRange::setLength(), and LinearRange::setOffset().

void assign ( const ArrayD times,
double  tbegin = -HUGE_VAL,
double  tend = HUGE_VAL,
double  stepsize = 0.0001 
)

Copy the event times times to *this and initializes the range with tbegin, tend, and stepsize. On default tbegin and tend are set to the first and last event of times.

References Array< T >::back(), EventData::back(), EventData::clear(), Array< T >::front(), EventData::front(), EventData::reserve(), EventData::size(), and Array< T >::size().

void assign ( const ArrayD times,
const ArrayD sizes,
double  tbegin = -HUGE_VAL,
double  tend = HUGE_VAL,
double  stepsize = 0.0001 
)

Copy the event times times and the corresponding sizes sizes to *this and initializes the range with tbegin, tend, and stepsize. On default tbegin and tend are set to the first and last event of times.

References Array< T >::back(), EventData::back(), EventData::clear(), Array< T >::front(), EventData::front(), relacs::mean(), EventData::reserve(), EventData::size(), and Array< T >::size().

void assign ( const ArrayD times,
const ArrayD sizes,
const ArrayD width,
double  tbegin = -HUGE_VAL,
double  tend = HUGE_VAL,
double  stepsize = 0.0001 
)

Copy the event times times and the corresponding sizes sizes and widths widths to *this and initializes the range with tbegin, tend, and stepsize. On default tbegin and tend are set to the first and last event of times.

References Array< T >::back(), EventData::back(), EventData::clear(), Array< T >::front(), EventData::front(), relacs::mean(), EventData::reserve(), EventData::size(), and Array< T >::size().

const EventData & assign ( const EventData events)

Assigns events to this by only copying pointers to the data buffers.

const EventData & assign ( void  )

Assign all properties from the internal reference to an EventData instance to this.

See Also
update()

Referenced by EventData::EventData(), and EventData::operator=().

void update ( void  )

Copy all indices from the internal reference to an EventData instance to this.

See Also
assign()
void append ( const EventData events,
double  tbegin,
double  tend 
)
void append ( const EventData events,
double  tbegin,
double  tend,
double  tref 
)

Append from events all event times between time tbegin and time tend seconds to *this. The appended event times and the signalTime() are set relative to time tref.

References EventData::eventSize(), EventData::eventWidth(), EventData::next(), LinearRange::offset(), EventData::previous(), EventData::reserve(), LinearRange::setLength(), LinearRange::setOffset(), and EventData::size().

void copy ( double  tbegin,
double  tend,
double *  events,
int &  nevents 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tbegin. Specify in nevents the size of the buffer where events points to. After executing this function nevents is the number of events copied to events.

Referenced by EventData::copy().

void copy ( double  tbegin,
double  tend,
double  tref,
double *  events,
int &  nevents 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tref. Specify in nevents the size of the buffer where events points to. After executing this function nevents is the number of events copied to events.

References EventData::next(), and EventData::previous().

void copy ( double  tbegin,
double  tend,
vector< double > &  events 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tbegin.

References EventData::copy().

void copy ( double  tbegin,
double  tend,
double  tref,
vector< double > &  events 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tref.

References EventData::next(), and EventData::previous().

void copy ( double  tbegin,
double  tend,
ArrayD events 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tbegin.

References EventData::copy().

void copy ( double  tbegin,
double  tend,
double  tref,
ArrayD events 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tref.

References Array< T >::clear(), EventData::next(), EventData::previous(), Array< T >::push(), and Array< T >::reserve().

void copy ( double  tbegin,
double  tend,
MapD events 
) const

Copy event times between time tbegin and time tend seconds and the corresponding sizes to events. The event times in events are set relative to tbegin. If the sizes are not stored but the widths, then the widths are stored in the y-vector of events. If neither sizes or widths are available, the y-vector is initialized with zeros.

References EventData::copy().

void copy ( double  tbegin,
double  tend,
double  tref,
MapD events 
) const

Copy event times between time tbegin and time tend seconds and the corresponding sizes to events. The event times in events are set relative to tref. If the sizes are not stored but the widths, then the widths are stored in the y-vector of events. If neither sizes or widths are available, the y-vector is initialized with zeros.

References Map< T >::clear(), EventData::eventSize(), EventData::eventWidth(), EventData::next(), EventData::previous(), Map< T >::push(), Map< T >::reserve(), EventData::sizeBuffer(), and EventData::widthBuffer().

void copy ( double  tbegin,
double  tend,
EventData events 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tbegin.

References EventData::copy().

void copy ( double  tbegin,
double  tend,
double  tref,
EventData events 
) const

Copy event times between time tbegin and time tend seconds to events. The event times in events are set relative to tref.

References EventData::clear(), EventData::eventSize(), EventData::eventWidth(), EventData::next(), EventData::previous(), EventData::push(), EventData::reserve(), EventData::setCyclic(), and EventData::stepsize().

double operator[] ( int  i) const
inline

Get the time of the i -th event in seconds. No range checking is performed.

Referenced by EventData::back(), EventData::fano(), EventData::front(), EventData::minTime(), EventData::next(), EventData::nextTime(), EventData::previous(), and EventData::previousTime().

double & operator[] ( int  i)
inline

Get a reference to the time of the i -th event in seconds. No range checking is performed.

double at ( int  i) const
inline

Get the time of the i -th event in seconds. If an invalid index is specified, -HUGE_VAL is returned.

double & at ( int  i)
inline

Get a reference to the time of the i -th event in seconds. If an invalid index is specified, a reference to a dummy variable set to -HUGE_VAL is returned.

double front ( void  ) const

Get the time of the first accessible event in seconds.

References EventData::minEvent(), and EventData::operator[]().

Referenced by EventData::assign(), and EventData::sync().

double & front ( void  )

Get a reference to the time of the first accessible event in seconds.

References EventData::minEvent(), and EventData::operator[]().

double front ( int  n) const

Get the time of the first plus n accessible event in seconds.

References EventData::minEvent(), and EventData::operator[]().

double & front ( int  n)

Get a reference to the time of the first plus n accessible event in seconds.

References EventData::minEvent(), and EventData::operator[]().

double back ( void  ) const
double & back ( void  )

Get a reference to the time of the last event in seconds.

References EventData::operator[](), and EventData::size().

double back ( int  n) const

Get the time of the last minus n event in seconds.

References EventData::operator[](), and EventData::size().

double & back ( int  n)

Get a reference to the time of the last minus n event in seconds.

References EventData::operator[](), and EventData::size().

EventData::const_iterator begin ( void  ) const

Returns an iterator pointing to the first element of the EventData.

Referenced by EventData::erase(), EventData::saveBox(), EventData::savePoint(), EventData::saveStroke(), EventData::saveText(), and EventData::sync().

EventData::const_iterator begin ( double  time) const

Returns an iterator pointing to the first element of the EventData following time time seconds.

References EventData::next().

EventData::const_iterator minBegin ( void  ) const

Returns an iterator pointing to the first accessible event

See Also
minEvent().

References EventData::minEvent().

EventData::const_iterator end ( void  ) const

Returns an iterator pointing behind the last element of the EventData.

References EventData::size().

Referenced by EventData::saveBox(), EventData::savePoint(), EventData::saveStroke(), EventData::saveText(), and EventData::sync().

double eventSize ( int  i) const
inline

Get the size of the i -th element of the event buffer. If an invalid index is specified or the sizes of events are not stored, -HUGE_VAL is returned.

Referenced by EventData::append(), EventData::assign(), EventData::backSize(), EventData::copy(), EventData::frontSize(), Map< T >::Map(), EventData::maxSize(), EventData::meanSize(), EventData::minMaxSize(), EventData::minSize(), and EventData::sizeHist().

double & eventSize ( int  i)
inline

Get a reference to the size of the i -th element of the event buffer. If an invalid index is specified or the sizes of events are not stored, a reference to a dummy variable set to -HUGE_VAL is returned.

double frontSize ( void  ) const

Get the size of the first accessible event.

References EventData::eventSize(), and EventData::minEvent().

double & frontSize ( void  )

Get a reference to the size of the first accessible event.

References EventData::eventSize(), and EventData::minEvent().

double frontSize ( int  n) const

Get the size of the first plus n accessible event.

References EventData::eventSize(), and EventData::minEvent().

double & frontSize ( int  n)

Get a reference to the size of the first plus n accessible event.

References EventData::eventSize(), and EventData::minEvent().

double backSize ( void  ) const

Get the size of the last event.

References EventData::eventSize(), and EventData::size().

double & backSize ( void  )

Get a reference to the size of the last event.

References EventData::eventSize(), and EventData::size().

double backSize ( int  n) const

Get the size of the last minus n event.

References EventData::eventSize(), and EventData::size().

double & backSize ( int  n)

Get a reference to the size of the last minus n event.

References EventData::eventSize(), and EventData::size().

double eventWidth ( int  i) const
inline

Get the width of the i -th element of the event buffer. If an invalid index is specified or the widths of events are not stored, -HUGE_VAL is returned.

Referenced by EventData::append(), EventData::assign(), EventData::backWidth(), EventData::copy(), EventData::frontWidth(), Map< T >::Map(), EventData::maxWidth(), EventData::meanWidth(), EventData::minMaxWidth(), EventData::minWidth(), and EventData::widthHist().

double & eventWidth ( int  i)
inline

Get a reference to the width of the i -th element of the event buffer. If an invalid index is specified or the widths of events are not stored, a reference to a dummy variable set to -HUGE_VAL is returned.

double frontWidth ( void  ) const

Get the width of the first accessible event.

References EventData::eventWidth(), and EventData::minEvent().

double & frontWidth ( void  )

Get a reference to the width of the first accessible event.

References EventData::eventWidth(), and EventData::minEvent().

double frontWidth ( int  n) const

Get the width of the first plus n accessible event.

References EventData::eventWidth(), and EventData::minEvent().

double & frontWidth ( int  n)

Get a reference to the width of the first plus n accessible event.

References EventData::eventWidth(), and EventData::minEvent().

double backWidth ( void  ) const

Get the width of the last event.

References EventData::eventWidth(), and EventData::size().

double & backWidth ( void  )

Get a reference to the width of the last event.

References EventData::eventWidth(), and EventData::size().

double backWidth ( int  n) const

Get the width of the last minus n event.

References EventData::eventWidth(), and EventData::size().

double & backWidth ( int  n)

Get a reference to the width of the last minus n event.

References EventData::eventWidth(), and EventData::size().

void push ( double  time,
double  size = 1.0,
double  width = 0.0 
)
void push ( const ArrayD time,
double  size = 1.0,
double  width = 0.0 
)

Add new events which occured at times time (seconds) and have the size size and width width to the buffer. The mean size and the mean width are updated using size and width. Mean rate it updated to.

References LinearRange::back(), EventData::back(), Array< T >::empty(), LinearRange::front(), Array< T >::front(), LinearRange::offset(), EventData::reserve(), LinearRange::setBack(), LinearRange::setFront(), LinearRange::setOffset(), EventData::size(), and Array< T >::size().

void set ( int  index,
const ArrayD time,
const ArrayD size,
const ArrayD width 
)

Set the content of the buffers to time, size, an width starting at index index.

References LinearRange::back(), EventData::back(), Array< T >::empty(), EventData::reserve(), LinearRange::setBack(), and Array< T >::size().

void insert ( double  time,
double  size = 0.0,
double  width = 0.0 
)

Insert a new event which occured at time time (seconds) and has the size size and width width to the buffer. The EventData must be non-cyclic (see cyclic(), setCyclic() ). The mean size, width, and rate are NOT updated.

References EventData::cyclic(), LinearRange::front(), EventData::next(), LinearRange::offset(), EventData::push(), EventData::reserve(), LinearRange::setFront(), LinearRange::setOffset(), and EventData::size().

void insert ( const EventData e)
void erase ( int  index)

Erase event at index index. The EventData must be non-cyclic (see cyclic(), setCyclic() ).

References EventData::cyclic().

Referenced by EventData::erase().

void erase ( const_iterator  iter)

Erase the event where iter points to. The EventData must be non-cyclic (see cyclic(), setCyclic() ).

References EventData::begin(), and EventData::erase().

void pop ( void  )

Erases the last event.

References EventData::size().

const double* data ( void  ) const
inline

Returns a pointer to the buffer with the event times.

double* data ( void  )
inline

Returns a pointer to the buffer with the event times.

void sum ( const EventData e,
EventData all 
) const
void sync ( const EventData e,
EventData s,
double  bin 
) const
const EventData & operator+= ( double  x)

Add x to all event times, signalTime() and the range().

const EventData & operator-= ( double  x)

Subtract x from all event times, signalTime() and the range().

const EventData & operator*= ( double  x)

Multiply all event times, signalTime() and the range() by x.

const EventData & operator/= ( double  x)

Divide all event times, signalTime() and the range() by x.

const EventData& operator+= ( const EventData e)
inline

Insert the event times of e.

See Also
insert()
EventData operator+ ( const EventData e) const
inline

Merge (sum up) the events of the two EventData.

See Also
sum()

References relacs::sum().

EventData operator* ( const EventData e) const
inline

Return the times of the time bins of width stepsize() that contain at least an event in each of e and *this.

See Also
sync()
bool check ( void  ) const

Check whether values of members are ok.

string message ( void  ) const

If check() has detected an error, message() returns the reason.

int currentEvent ( void  ) const

Number of events. Same as size().

int minEvent ( void  ) const
double minTime ( void  ) const

The time of the first event that can be accesed.

References EventData::minEvent(), and EventData::operator[]().

int mode ( void  ) const

Mode of the event data. The mode is just a number, which can be used to label the traces.

Referenced by EventData::setMode().

void setMode ( int  mode)

Set mode to mode. The mode mode is just a number, which can be used to label the event data.

References EventData::mode().

int source ( void  ) const

Returns 1 if the events were extracted from an InData, 2 if the events were extracted from other events.

Referenced by EventData::setSource().

void setSource ( int  source)

Set the source of the events to source.

References EventData::source().

const string & ident ( void  ) const

The identifier string of the events.

Referenced by EventData::next(), relacs::operator<<(), EventData::previous(), and EventData::setIdent().

void setIdent ( const string &  ident)

Set the identifier of the events to ident.

References EventData::ident().

Referenced by Detector< DataIter, TimeIter >::Detector().

const string & sizeName ( void  ) const

The name for the event sizes.

See Also
setSizeName(), sizeBuffer(), widthName(), sizeScale(), sizeUnit(), sizeFormat()
void setSizeName ( const string &  name)

Set the name for the size of the events to name.

See Also
sizeName(), setSizeBuffer(), setWidthName(), setSizeScale(), setSizeUnit(), setSizeFormat()
double sizeScale ( void  ) const

The scale factor for the event sizes.

See Also
setSizeScale(), sizeBuffer(), widthScale(), sizeName(), sizeUnit(), sizeFormat()
void setSizeScale ( double  scale)

Set the scale factor for the size of the events to scale.

See Also
sizeScale(), sizeBuffer(), setWidthScale(), setSizeName(), setSizeUnit(), setSizeFormat()
const string & sizeUnit ( void  ) const

The unit of the event sizes after multiplication with sizeScale().

See Also
setSizeUnit(), sizeBuffer(), widthUnit(), sizeName(), sizeScale(), sizeFormat()
void setSizeUnit ( const string &  unit)

Set the unit of the size of the eventsafter multiplication with sizeScale() to unit.

See Also
sizeUnit(), sizeBuffer(), setWidthUnit(), setSizeName(), setSizeScale(), setSizeFormat()
const string & sizeFormat ( void  ) const

The format of the event sizes for writing them as strings after multiplication with sizeScale().

See Also
setSizeFormat(), sizeBuffer(), widthFormat(), sizeName(), sizeScale(), sizeUnit()
void setSizeFormat ( const string &  format)

Set the format for the size of the events after multiplication with sizeScale() to format.

See Also
sizeFormat(), sizeBuffer(), setWidthFormat(), setSizeName(), setSizeScale(), setSizeUnit()
double minSize ( double  tbegin,
double  tend 
) const

Minimum size of events between time tbegin and time tend seconds. If there are no events within this time interval or if the event sizes of the events are not stored then the current value of the running average of the event sizes is returned.

References EventData::eventSize(), relacs::min(), EventData::next(), and EventData::previous().

double maxSize ( double  tbegin,
double  tend 
) const

Maximum size of events between time tbegin and time tend seconds. If there are no events within this time interval or if the event sizes of the events are not stored then the current value of the running average of the event sizes is returned.

References EventData::eventSize(), relacs::max(), EventData::next(), and EventData::previous().

void minMaxSize ( double  tbegin,
double  tend,
double &  min,
double &  max 
) const

Returns in min and max the minimum and maximum size of events between time tbegin and time tend seconds, respectively. If there are no events within this time interval or if the event sizes of the events are not stored then min and max are set to the current value of the running average of the event sizes.

References EventData::eventSize(), relacs::min(), EventData::next(), and EventData::previous().

double meanSize ( double  tbegin,
double  tend,
double &  stdev 
) const

Mean size of events and standard deviation stdev between time tbegin and time tend seconds. If there are no events within this time interval zero is returned. If the event sizes of the events are not stored then the current value of the running average of the event sizes is returned.

References EventData::eventSize(), EventData::next(), EventData::previous(), and relacs::sqrt().

double meanSize ( double  tbegin,
double  tend 
) const

Mean size of events between time tbegin and time tend seconds. If there are no events within this time interval zero is returned. If the event sizes of the events are not stored then the current value of the running average of the event sizes is returned.

References EventData::eventSize(), EventData::next(), and EventData::previous().

double meanSize ( double  time) const
inline

Mean size of events since time seconds before the last event. If there are no events within this time interval zero is returned. If the event sizes of the events are not stored then the current value of the running average of the event sizes is returned.

References EventData::meanSize().

Referenced by EventData::meanSize().

double meanSize ( void  ) const
inline

Mean size of detected events.

void setMeanSize ( double  meansize)
inline

Set mean event size to meansize.

void updateMeanSize ( int  n = 1,
double  size = 0.0 
)

Update the mean size with n times size.

void sizeHist ( double  tbegin,
double  tend,
SampleDataD hist 
) const

Compute a histogram hist over the event sizes between time tbegin and time tend seconds.

References EventData::eventSize(), EventData::next(), EventData::previous(), SampleData< T >::rangeFront(), SampleData< T >::size(), and SampleData< T >::stepsize().

const double* sizeData ( void  ) const
inline

Returns a pointer to the buffer with the event sizes.

double* sizeData ( void  )
inline

Returns a pointer to the buffer with the event sizes.

const string & widthName ( void  ) const

The name for the event widths.

See Also
setWidthName(), widthBuffer(), sizeName(), widthScale(), widthUnit(), widthFormat()
void setWidthName ( const string &  name)

Set the name for the width of the events to name.

See Also
widthName(), setWidthBuffer(), setSizeName(), setWidthScale(), setWidthUnit(), setWidthFormat()
double widthScale ( void  ) const

The scale factor for the event widths.

See Also
setWidthScale(), widthBuffer(), sizeScale(), widthName(), widthUnit(), widthFormat()
void setWidthScale ( double  scale)

Set the scale factor for the width of the events to scale.

See Also
widthScale(), widthBuffer(), setSizeScale(), setWidthName(), setWidthUnit(), setWidthFormat()
const string & widthUnit ( void  ) const

The unit of the event widths after multiplication with widthScale().

See Also
setWidthUnit(), widthBuffer(), sizeUnit(), widthName(), widthScale(), widthFormat()
void setWidthUnit ( const string &  unit)

Set the unit of the width of the eventsafter multiplication with widthScale() to unit.

See Also
widthUnit(), widthBuffer(), setSizeUnit(), setWidthName(), setWidthScale(), setWidthFormat()
const string & widthFormat ( void  ) const

The format of the event widths for writing them as strings after multiplication with widthScale().

See Also
setWidthFormat(), widthBuffer(), sizeFormat(), widthName(), widthScale(), widthUnit()
void setWidthFormat ( const string &  format)

Set the format for the width of the events after multiplication with widthScale() to format.

See Also
widthFormat(), widthBuffer(), setSizeFormat(), setWidthName(), setWidthScale(), setWidthUnit()
double minWidth ( double  tbegin,
double  tend 
) const

Minimum width of events between time tbegin and time tend seconds. If there are no events within this time interval or if the event widths of the events are not stored then the current value of the running average of the event widths is returned.

References EventData::eventWidth(), relacs::min(), EventData::next(), and EventData::previous().

double maxWidth ( double  tbegin,
double  tend 
) const

Maximum width of events between time tbegin and time tend seconds. If there are no events within this time interval or if the event widths of the events are not stored then the current value of the running average of the event widths is returned.

References EventData::eventWidth(), relacs::max(), EventData::next(), and EventData::previous().

void minMaxWidth ( double  tbegin,
double  tend,
double &  min,
double &  max 
) const

Returns in min and max the minimum and maximum width of events between time tbegin and time tend seconds, respectively. If there are no events within this time interval or if the event widths of the events are not stored then min and max are set to the current value of the running average of the event widths.

References EventData::eventWidth(), relacs::min(), EventData::next(), and EventData::previous().

double meanWidth ( double  tbegin,
double  tend 
) const

Mean width of events between time tbegin and time tend seconds. If there are no events within this time interval zero is returned. If the event widths of the events are not stored then the current value of the running average of the event widths is returned.

References EventData::eventWidth(), EventData::next(), and EventData::previous().

double meanWidth ( void  ) const
inline

Mean width of the recent detected events in seconds.

void setMeanWidth ( double  meanwidth)
inline

Set event width to meanwidth seconds.

void updateMeanWidth ( int  n = 1,
double  width = 0.0 
)

Update the mean width with n times width seconds.

void widthHist ( double  tbegin,
double  tend,
SampleDataD hist 
) const

Compute a histogram hist over the event widths between time tbegin and time tend seconds.

References EventData::eventWidth(), EventData::next(), EventData::previous(), SampleData< T >::rangeFront(), SampleData< T >::size(), and SampleData< T >::stepsize().

const double* widthData ( void  ) const
inline

Returns a pointer to the buffer with the event widths.

double* widthData ( void  )
inline

Returns a pointer to the buffer with the event sizes.

double meanRate ( void  ) const

Mean rate of detected events in Hertz.

void setMeanRate ( double  meanrate)

Set mean event rate to meanrate Hertz.

void updateMeanRate ( int  n = 1,
double  rate = 0.0 
)

Update the mean rate with n times rate Hertz.

void updateMean ( int  n = 1,
double  size = 0.0,
double  width = 0.0,
double  rate = 0.0 
)

Update mean size, width, and rate with n times size, width, and rate, respectively.

double meanQuality ( void  ) const

Mean quality of event detection.

void setMeanQuality ( double  meanquality)

Set mean quality of event detection to meanquality.

void updateMeanQuality ( bool  good = false)
double meanRatio ( void  ) const

Return the ratio value which is used to update the mean values.

void setMeanRatio ( double  ratio)

Set the ratio value which is used to update the mean values to ratio. The mean values are updated according to nm = om*(1-r) + nv*r where the old and the new value of the mean are om and nm, respectively, the new value is nv and r is the mean ratio. N = 1/r is the number of new values which are needed for the mean value to adapt to a new value (in the sense of a time constant of an exponential decay).

int next ( double  time) const
double nextTime ( double  time,
double  dflt = -HUGE_VAL 
) const

Returns time of event following or equal to time time in seconds. Returns dflt if no event is found.

References EventData::next(), EventData::operator[](), and EventData::size().

int previous ( double  time) const
double previousTime ( double  time,
double  dflt = -HUGE_VAL 
) const

Returns time to event preceeding or equal to time time in seconds. Returns dflt if no event is found.

References EventData::operator[](), EventData::previous(), and EventData::size().

bool within ( double  time,
double  distance 
) const

True if an event is within time time plus or minus distance seconds.

References EventData::next(), EventData::previous(), and EventData::size().

int count ( double  tbegin,
double  tend 
) const

Count events since time tbegin and time tend seconds.

References EventData::next(), and EventData::previous().

Referenced by EventData::fano().

int count ( double  time) const

Count all events since time time (seconds).

References EventData::next(), and EventData::size().

double rate ( double  tbegin,
double  tend 
) const

Mean event rate (Hz) as the number of events between time tbegin and time tend seconds divided by the width of the time window tend - tbegin.

References EventData::next(), and EventData::previous().

Referenced by EventData::coherence(), and EventData::spectrum().

double rate ( int  n) const

Mean rate (Hz) of the last n events. If n < 1 or there are less than n events in the buffer zero is returned.

References EventData::back(), and EventData::size().

double rate ( double  time) const

Mean rate (Hz) of all events since time time (seconds).

References LinearRange::back(), EventData::next(), and EventData::size().

void rate ( SampleDataD rate,
double  width = 0.0,
double  time = 0.0 
) const

The time course of the event rate is returned in rate. The rate is the number of events per bin. The width of the bins is given by width seconds. If width is less or equal to zero it is set to the stepsize of rate. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References EventData::addRate().

void addRate ( SampleDataD rate,
int &  trial,
double  width = 0.0,
double  time = 0.0 
) const

The time course of the event rate for the trial + 1 trial is added to rate. The rate is the number of events per bin. The width of the bins is given by width seconds. If width is less or equal to zero it is set to the stepsize of rate. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered. trial is incremented by one.

References EventData::minEvent(), EventData::next(), SampleData< T >::pos(), EventData::previous(), EventData::size(), SampleData< T >::size(), and SampleData< T >::stepsize().

Referenced by EventData::rate().

void cyclicRate ( SampleDataD rate,
double  width = 0.0,
double  time = 0.0 
) const

The time course of the cyclic event rate is returned in rate. The rate is the number of events per bin. The width of the bins is given by width seconds. If width is less or equal to zero it is set to the stepsize of rate. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References EventData::addCyclicRate().

void addCyclicRate ( SampleDataD rate,
int &  trial,
double  width = 0.0,
double  time = 0.0 
) const

The time course of the cyclic event rate for the trial + 1 trial is added to rate. The rate is the number of events per bin. The width of the bins is given by width seconds. If width is less or equal to zero it is set to the stepsize of rate. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References SampleData< T >::length(), EventData::minEvent(), EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), EventData::size(), SampleData< T >::size(), and SampleData< T >::stepsize().

Referenced by EventData::cyclicRate().

void rate ( SampleDataD rate,
const Kernel kernel,
double  time = 0.0 
) const

The time course of the event rate is returned in rate. Each event is replaced by the kernel, which then are summed up. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References SampleData< T >::index(), SampleData< T >::indices(), SampleData< T >::interval(), Kernel::left(), SampleData< T >::length(), EventData::next(), SampleData< T >::pos(), EventData::previous(), Kernel::right(), SampleData< T >::size(), and Kernel::value().

void addRate ( SampleDataD rate,
int &  trial,
const Kernel kernel,
double  time = 0.0 
) const

The time course of the event rate for the trial + 1 trial is added to rate. Each event is replaced by the kernel, which then are summed up. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered. trial is incremented by one.

References SampleData< T >::index(), SampleData< T >::indices(), SampleData< T >::interval(), Kernel::left(), SampleData< T >::length(), EventData::next(), SampleData< T >::pos(), EventData::previous(), Kernel::right(), SampleData< T >::size(), and Kernel::value().

void cyclicRate ( SampleDataD rate,
const Kernel kernel,
double  time = 0.0 
) const

The time course of the cyclic event rate is returned in rate. Each event is replaced by the kernel, which then are summed up. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References EventData::addCyclicRate().

void addCyclicRate ( SampleDataD rate,
int &  trial,
const Kernel kernel,
double  time = 0.0 
) const

The time course of the cyclic event rate for the trial + 1 trial is added to rate. Each event is replaced by the kernel, which then are summed up. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References SampleData< T >::index(), SampleData< T >::indices(), SampleData< T >::interval(), Kernel::left(), EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), Kernel::right(), SampleData< T >::size(), and Kernel::value().

double interval ( double  tbegin,
double  tend,
double *  sd = 0 
) const

Mean event interval (seconds) of all event intervals between time tbegin and time tend. In sd the standard deviation of the intervals is returned provided sd does not equal zero.

References EventData::next(), EventData::previous(), and relacs::sqrt().

Referenced by EventData::interval().

double interval ( double  time,
double *  sd = 0 
) const

Mean event interval (seconds) of all event intervals since time time (seconds). In sd the standard deviation of the intervals is returned provided sd does not equal zero.

References LinearRange::back(), and EventData::interval().

double interval ( int  n,
double *  sd 
) const

Mean interval (seconds) of the last n events. If n < 1 or there are less than n events in the buffer zero is returned. In sd the standard deviation of the intervals is returned provided sd does not equal zero.

References EventData::back(), EventData::interval(), and EventData::size().

double intervalAt ( double  time) const

Interval (seconds) of the event interval at time time (seconds).

References EventData::next().

void interval ( SampleDataD intervals,
double  time = 0.0 
) const

The time course of the event intervals is returned in intervals with intervals.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References EventData::addInterval().

void addInterval ( SampleDataD intervals,
int &  trial,
double  time = 0.0 
) const

The time course of the event intervals for the trial + 1 trial is added to intervals with intervals.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References EventData::minEvent(), EventData::next(), SampleData< T >::pos(), SampleData< T >::rangeFront(), EventData::size(), and SampleData< T >::size().

Referenced by EventData::interval().

void cyclicInterval ( SampleDataD intervals,
double  time = 0.0 
) const

The time course of the cyclic event intervals is returned in intervals with intervals.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References EventData::addCyclicInterval().

void addCyclicInterval ( SampleDataD intervals,
int &  trial,
double  time = 0.0 
) const

The time course of the cyclic event intervals for the trial + 1 trial is added to intervals with intervals.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References SampleData< T >::length(), EventData::minEvent(), EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), EventData::size(), and SampleData< T >::size().

Referenced by EventData::cyclicInterval().

int intervals ( double  tbegin,
double  tend,
ArrayD intervals 
) const

Returns in intervals the interevent intervals between tbegin and tend.

Returns
the number of interevent intervals.

References EventData::addIntervals(), and Array< T >::clear().

int addIntervals ( double  tbegin,
double  tend,
ArrayD intervals 
) const

Adds to intervals the interevent intervals between tbegin and tend.

Returns
the number of interevent intervals.

References EventData::next(), EventData::previous(), Array< T >::push(), Array< T >::reserve(), and Array< T >::size().

Referenced by EventData::intervals().

int intervals ( double  tbegin,
double  tend,
MapD intrvls,
int  pos = -1 
) const

Returns in intrvls.x() the position of each interevent interval between tbegin and tend, and in intrvls.y() the corresponding interevent intervals. The position of each interevent interval is the position of the left event (pos = -1, default), the position of the right event (pos = 1), or in between the left and the right event (pos = 0).

Returns
the number of interevent intervals.

References EventData::addIntervals(), and Map< T >::clear().

int addIntervals ( double  tbegin,
double  tend,
MapD intrvls,
int  pos = -1 
) const

Adds to intrvls.x() the position of each interevent interval between tbegin and tend, and to intrvls.y() the corresponding interevent intervals. The position of each interevent interval is the position of the left event (pos = -1, default), the position of the right event (pos = 1), or in between the left and the right event (pos = 0).

Returns
the number of interevent intervals.

References EventData::next(), EventData::previous(), Map< T >::push(), Map< T >::reserve(), and Map< T >::size().

int saveIntervals ( double  tbegin,
double  tend,
ostream &  os,
int  pos = -1,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
const string &  noevents = "" 
) const

Write into stream os the position of each interevent interval between tbegin and tend multiplied by tfac in the first column, and the interevent interval in the second column. The position of the interevent interval is the position of the left event (pos = -1, default), the position of the right event (pos = 1), or in between the left and the right event (pos = 0). Both the position and the intervals are formatted as specified by width, prec, and frmt. If there aren't any intervals and noevents isn't empty, than noevents is printed as the only output once in each column.

Returns
the number of interevent intervals.

References relacs::abs(), EventData::next(), and EventData::previous().

double frequency ( double  tbegin,
double  tend,
double *  sd = 0 
) const

Mean event frequency (Hz) as the inverse of the mean event interval of all event intervals between time tbegin and time tend seconds. In sd the standard deviation in Hz as the standard deviation of the intervals devided by the squared mean interval is returned provided sd does not equal zero.

References EventData::next(), EventData::previous(), and relacs::sqrt().

Referenced by EventData::frequency().

double frequency ( double  time,
double *  sd = 0 
) const

Mean event frequency (Hz) as the inverse of the mean event interval (seconds) of all event intervals since time time (seconds). In sd the standard deviation in Hz as the standard deviation of the intervals devided by the squared mean interval is returned provided sd does not equal zero.

References LinearRange::back(), and EventData::frequency().

double frequency ( int  n,
double *  sd = 0 
) const

Mean event frequency (Hz) as the inverse of the mean event interval (seconds) of the n recent events. If n < 1 or there are less than n events in the buffer zero is returned. In sd the standard deviation in Hz as the standard deviation of the intervals devided by the squared mean interval is returned provided sd does not equal zero.

References EventData::back(), EventData::frequency(), and EventData::size().

double frequencyAt ( double  time,
double  defaultfrequency = 0.0 
) const

Frequency (Hz) as the inverse of the event interval at time time (seconds). If there is no interval, defaultfrequency is returned.

References EventData::next().

void frequency ( SampleDataD rate,
double  time = 0.0,
double  defaultfrequency = 0.0 
) const

The time course of the instantaneous frequency 1/ISI is returned in rate with rate.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered. Times with no defined interval get defaultfrequency assigned.

References EventData::addFrequency().

void addFrequency ( SampleDataD rate,
int &  trial,
double  time = 0.0,
double  defaultfrequency = 0.0 
) const

The time course of the instantaneous frequency 1/ISI for the trial + 1 trial is added to rate with rate.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered. At times where there is no interval defined, defaultfrequency is used. trial is incremented by one.

References EventData::minEvent(), EventData::next(), SampleData< T >::pos(), SampleData< T >::rangeFront(), EventData::size(), and SampleData< T >::size().

Referenced by EventData::frequency().

void addFrequency ( SampleDataD rate,
SampleDataD ratesq,
int &  trial,
double  time = 0.0,
double  defaultfrequency = 0.0 
) const

The time course of the instantaneous frequency 1/ISI for the trial + 1 trial is added to rate with rate.stepsize() in seconds. In ratesq the updated mean squared instantaneous frequency is returned. It can be used to calculate the standard deviation according to sd = sqrt( ratesq - rate * rate ). The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered. At times where there is no interval defined, defaultfrequency is used. trial is incremented by one.

References EventData::minEvent(), EventData::next(), SampleData< T >::pos(), SampleData< T >::rangeFront(), EventData::size(), and SampleData< T >::size().

void cyclicFrequency ( SampleDataD rate,
double  time = 0.0 
) const

The time course of the cyclic instantaneous frequency 1/ISI is returned in rate with rate.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References EventData::addCyclicFrequency().

void addCyclicFrequency ( SampleDataD rate,
int &  trial,
double  time = 0.0 
) const

The time course of the cyclic instantaneous frequency 1/ISI for the trial + 1 trial is added to rate with rate.stepsize() in seconds. The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References SampleData< T >::length(), EventData::minEvent(), EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), EventData::size(), and SampleData< T >::size().

Referenced by EventData::cyclicFrequency().

void addCyclicFrequency ( SampleDataD rate,
SampleDataD period,
int &  trial,
double  time = 0.0 
) const

The time course of the cyclic instantaneous frequency 1/ISI for the trial + 1 trial is added to rate with rate.stepsize() in seconds. In period the updated mean interval is returned. It can be used to calculate the standard deviation according to sd = rate * sqrt( rate * period - 1 ). The events between rate.leftMargin() and rate.rightMargin() seconds relative to time time (seconds) are considered.

References SampleData< T >::length(), EventData::minEvent(), EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), EventData::size(), and SampleData< T >::size().

int frequencies ( double  tbegin,
double  tend,
MapD freqs,
int  pos = -1 
) const

Returns in freqs.x() the position of each interevent interval between tbegin and tend, and in freqs.y() 1 divided by that interevent interval (the frequency). The position of the interevent interval is the position of the left event (pos = -1, default), the position of the right event (pos = 1), or in between the left and the right event (pos = 0).

Returns
the number of interevent intervals.

References EventData::addFrequencies(), and Map< T >::clear().

int addFrequencies ( double  tbegin,
double  tend,
MapD freqs,
int  pos = -1 
) const

Adds to freqs.x() the position of each interevent interval between tbegin and tend, and to freqs.y() 1 divided by that interevent interval (the frequency). The position of the interevent interval is the position of the left event (pos = -1, default), the position of the right event (pos = 1), or in between the left and the right event (pos = 0).

Returns
the number of interevent intervals.

References EventData::next(), EventData::previous(), Map< T >::push(), Map< T >::reserve(), and Map< T >::size().

Referenced by EventData::frequencies().

int saveFrequencies ( double  tbegin,
double  tend,
ostream &  os,
int  pos = -1,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
const string &  noevents = "" 
) const

Write into stream os the position of each interevent interval between tbegin and tend multiplied by tfac in the first column, and 1 divided by that interevent interval (the frequency) in the second column. The position of the interevent interval is the position of the left event (pos = -1, default), the position of the right event (pos = 1), or in between the left and the right event (pos = 0). Both the position and the frequency are formatted as specified by width, prec, and frmt. If there aren't any events and noevents isn't empty, than noevents is printed as the only output once in each column.

Returns
the number of interevent intervals.

References relacs::abs(), EventData::next(), and EventData::previous().

void intervalHistogram ( double  tbegin,
double  tend,
SampleDataD hist 
) const

Compute interval histogram hist for the event intervals between time tbegin and time tend seconds. Resolution and maximum interspike interval in hist are given in seconds.

References EventData::addIntervalHistogram().

void addIntervalHistogram ( double  tbegin,
double  tend,
SampleDataD hist 
) const

Add event intervals between time tbegin and time tend seconds to the interval histogram hist. Resolution and maximum interspike interval in hist are given in seconds.

References SampleData< T >::index(), EventData::next(), EventData::previous(), and SampleData< T >::size().

Referenced by EventData::intervalHistogram().

void serialCorr ( double  tbegin,
double  tend,
ArrayD sc 
) const

Compute the serial correlation coefficients for lag zero to lag sc.size()-1 of all event intervals between time tbegin and time tend seconds.

References EventData::next(), EventData::previous(), Array< T >::push(), Array< T >::reserve(), and relacs::serialCorr().

void fano ( double  tbegin,
double  tend,
SampleDataD ff 
) const

Compute the fano factors for windows as defined by ff (in seconds) of all events between time tbegin and time tend seconds.

References Array< T >::clear(), EventData::count(), relacs::floor(), Array< T >::mean(), EventData::next(), EventData::operator[](), SampleData< T >::pos(), EventData::previous(), Array< T >::push(), Array< T >::reserve(), Array< T >::size(), and SampleData< T >::size().

double locking ( double  tbegin,
double  tend,
double  period 
) const

Compute the phase locking as the number of spikes per period period of all events between time tbegin and time tend seconds. tend is reduced to tbegin plus the closest multiple of period.

References relacs::floor(), EventData::next(), and EventData::previous().

double vectorStrength ( double  tbegin,
double  tend,
double  period 
) const

Compute the vector strength for a period period (seconds) of all events between time tbegin and time tend seconds according to

\[ VS = \frac{1}{n} \sqrt{ \left( \sum_{i=1}^n \sin\varphi_i \right)^2 + \left( \sum_{i=1}^n \cos\varphi_i \right)^2} \]

with

\[ \varphi_i = 2 \pi ( t_i - time ) / period \]

for all n spike times t_i.

References relacs::cos(), EventData::next(), EventData::previous(), relacs::sin(), and relacs::sqrt().

double vectorPhase ( double  tbegin,
double  tend,
double  period 
) const

Compute the vector phase for a period period (seconds) of all events between time tbegin and time tend seconds according to

\[ VP = \mbox{atan} \frac{ \sum_{i=1}^n \sin\varphi_i }{ \sum_{i=1}^n \cos\varphi_i } \]

with

\[ \varphi_i = 2 \pi ( t_i - time ) / period \]

for all n spike times t_i.

References relacs::cos(), EventData::next(), EventData::previous(), and relacs::sin().

int average ( double  tbegin,
double  tend,
const SampleDataD trace,
SampleDataD ave 
) const

Compute the event-triggered average ave (spike-triggerd average STA) of the trace trace for all n events t_i between time tbegin and time tend seconds:

\[ ave(t) = \frac{1}{n} \sum_{i=1}^n trace( t_i + t ) \]

. The range of ave determines the time axis of the event-triggered average.

Returns
the number of events used for computing the event-triggered average.

References EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), and SampleData< T >::size().

int average ( double  tbegin,
double  tend,
const SampleDataD trace,
SampleDataD ave,
SampleDataD sd 
) const

Compute the event-triggered average ave (spike-triggerd average STA) and its standard deviation sd of the trace trace for all n events t_i between time tbegin and time tend seconds:

\[ ave(t) = \frac{1}{n} \sum_{i=1}^n trace( t_i + t ) \]

\[ sd(t) = \sqrt{ \frac{1}{n} \sum_{i=1}^n \left( trace( t_i + t ) - ave(t)\right)^2} \]

. The range of ave determines the time axis of the event-triggered average.

Returns
the number of events used for computing the event-triggered average.

References EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), SampleData< T >::size(), and relacs::sqrt().

int average ( double  tbegin,
double  tend,
const SampleDataD trace,
SampleDataD ave,
SampleDataD sd,
vector< SampleDataD > &  snippets 
) const

Compute the event-triggered average ave (spike-triggerd average STA) and its standard deviation sd of the trace trace for all n events t_i between time tbegin and time tend seconds:

\[ ave(t) = \frac{1}{n} \sum_{i=1}^n trace( t_i + t ) \]

\[ sd(t) = \sqrt{ \frac{1}{n} \sum_{i=1}^n \left( trace( t_i + t ) - ave(t)\right)^2} \]

. The range of ave determines the time axis of the event-triggered average. In snippets all individual sections from trace that were used for computing the event-triggered average are returned. snippets does not need to be initialized in any way.

Returns
the number of events used for computing the event-triggered average.

References SampleData< T >::back(), SampleData< T >::clear(), EventData::next(), SampleData< T >::pos(), EventData::previous(), SampleData< T >::range(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), SampleData< T >::size(), and relacs::sqrt().

void spectrum ( double  tbegin,
double  tend,
double  step,
SampleDataD psd,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
) const

Returns in psd the powerspectrum density of the events between tbegin and tend. The size of psd times step determines the width of the time windows used for the fourier transformations. The data chunks are windowed by the window function and may overlap by half if overlap is set to true. The bin width for discretizing the events is set to step. The frequency axis of the spectrum psd is set to the appropriate values.

References relacs::mean(), EventData::rate(), and relacs::rPSD().

void coherence ( const SampleDataD stimulus,
SampleDataD c,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
) const

Returns in c the stimulus-response coherence between stimulus and the events (the S-R coherence). The size of c times stimulus.stepsize() determines the width of the time windows used for the fourier transformations. The data chunks are windowed by the window function and may overlap by half if overlap is set to true. Only events during the stimulus (between stimulus.rangeFront() and stimulus.rangeBack() ) are considered. The sampling interval of the stimulus (stimulus.stepsize()) is used as the bin width for discretizing the events. The frequency axis of the coherence c is set to the appropriate values.

References relacs::coherence(), relacs::mean(), SampleData< T >::range(), and EventData::rate().

void coherence ( const EventData e,
double  tbegin,
double  tend,
double  step,
SampleDataD c,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
) const

Returns in c the coherence between the events and the events in e (the response-response (R-R) coherence). The size of c times step determines the width of the time windows used for the fourier transformations. The data chunks are windowed by the window function and may overlap by half if overlap is set to true. Only events during the tbegin and tend are considered. The bin width for discretizing the events is set to step. The frequency axis of the coherence c is set to the appropriate values.

References relacs::coherence(), relacs::mean(), and EventData::rate().

double latency ( double  time) const

Latency of first event relative to time in seonds. A negative number is returned, if there is no event.

References EventData::next(), and EventData::size().

void poisson ( double  rate,
double  refract,
double  duration,
RandomBase random = rnd 
)

Generate a poisson spike train with rate rate Hertz and absoulte refractory period refract for duration duration seconds. Use the random number gnerator random.

References EventData::capacity(), relacs::ceil(), EventData::clear(), RandomBase::exponential(), EventData::push(), EventData::reserve(), and EventData::size().

void saveText ( ostream &  os,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
const string &  noevents = "" 
) const

Write event times as a single column of text in stream s. Each event time is multiplied by tfac, formatted as specified by width, prec, and frmt, and is written in a separate line. If there aren't any events and noevents isn't empty, than noevents is printed as the only output.

References relacs::abs(), EventData::begin(), EventData::end(), and EventData::minEvent().

void savePoint ( ostream &  os,
double  y = 0.0,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
const string &  noevents = "",
double  noy = -1.0 
) const

Write event times as text in stream s. Two columns are written. The first column is the event time is multiplied by tfac, and is formatted as specified by width, prec, and frmt. The second column is an y-value as specified by y. If there aren't any events and noevents isn't empty, than a single line with noevents as the time of an event followed by noy as the corresponding y-value is printed as the only output.

References relacs::abs(), EventData::begin(), EventData::end(), and EventData::minEvent().

void saveStroke ( ostream &  os,
int  offs = 0,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
double  lower = 0.1,
double  upper = 0.9,
const string &  noevents = "",
double  noy = -1.0 
) const

Write event times as text in stream s such that each event gets two data points. The y-value of the data points are set to offs + lower and offs + upper. Each event time is multiplied by tfac, and is formatted as specified by width, prec, and frmt. Events are separated by a blank line. If there aren't any events and noevents isn't empty, than a single line with noevents as the time of an event followed by noy as the corresponding y-value is printed as the only output.

References relacs::abs(), EventData::begin(), EventData::end(), and EventData::minEvent().

void saveBox ( ostream &  os,
double  bin,
int  offs = 0,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
double  lower = 0.1,
double  upper = 0.9,
const string &  noevents = "",
double  noy = -1.0 
) const

Write event times as text in stream s such that each event gets four data points. Each such box has width bin and contains the corresponding event. The sides of the box are at multiples of bin. The y-values of the box are set to offs + lower and offs + upper. All times are multiplied by tfac, and are formatted as specified by width, prec, and frmt. Events are separated by a blank line. If there aren't any events and noevents isn't empty, than a single line with noevents as the time of a event followed by noy as the corresponding y-value is printed as the only output.

References relacs::abs(), EventData::begin(), EventData::end(), and EventData::minEvent().

Friends And Related Function Documentation

friend class EventIterator
friend
ostream& operator<< ( ostream &  str,
const EventData events 
)
friend

Write all EventData variables to stream str (for debugging only).


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