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

#include <eventlist.h>

Public Types

typedef vector< EventData * > EL
 
typedef EL::iterator iterator
 
typedef EL::const_iterator const_iterator
 

Public Member Functions

 EventList (void)
 
 EventList (const EventList &el)
 
 EventList (const EventList *el)
 
 EventList (const EventList &el, double tbegin, double tend)
 
 EventList (const EventList &el, double tbegin, double tend, double tref)
 
 EventList (const EventData &events)
 
 EventList (const EventData &events, double tbegin, double tend)
 
 EventList (const EventData &events, double tbegin, double tend, double tref)
 
 EventList (const EventData &events, const EventData &times, double tend)
 
 EventList (const EventData &events, const EventData &times, double tbegin, double tend)
 
 EventList (EventData *events, bool own=false)
 
 EventList (int n, int m=0, bool sizebuffer=false, bool widthbuffer=false)
 
 ~EventList (void)
 
int size (void) const
 
bool empty (void) const
 
void resize (int n, int m=0, bool sizebuffer=false, bool widthbuffer=false)
 
void clear (void)
 
int capacity (void) const
 
void reserve (int n)
 
EventListoperator= (const EventList &el)
 
EventListassign (const EventList *el)
 
EventListassign (void)
 
const EventDataoperator[] (int i) const
 
EventDataoperator[] (int i)
 
const EventDatafront (void) const
 
EventDatafront (void)
 
const EventDataback (void) const
 
EventDataback (void)
 
const EventDataoperator[] (const string &ident) const
 
EventDataoperator[] (const string &ident)
 
int index (const string &ident) const
 
void push (const EventData &events)
 
void push (const EventData &events, double tbegin, double tend)
 
void push (const EventData &events, double tbegin, double tend, double tref)
 
void push (const ArrayD &events, double tbegin=-HUGE_VAL, double tend=HUGE_VAL, double stepsize=0.0001)
 
void push (const EventData &events, const EventData &times, double tend)
 
void push (const EventData &events, const EventData &times, double tbegin, double tend)
 
void push (const EventList &el)
 
void push (const EventList &el, double tbegin, double tend)
 
void push (const EventList &el, double tbegin, double tend, double tref)
 
void push (int m, bool sizebuffer=false, bool widthbuffer=false)
 
void push (int n, int m, bool sizebuffer=false, bool widthbuffer=false)
 
void add (EventData *events, bool own=false)
 
void add (const EventData *events, bool own=false)
 
void add (EventList &events, bool own=false)
 
void add (const EventList &events, bool own=false)
 
void set (int index, const EventData *data, bool own=false)
 
void assign (int index, const EventData *data)
 
void erase (int index)
 
void update (void)
 
void updateRaw (void)
 
void updateDerived (void)
 
void clearBuffer (void)
 
iterator begin (void)
 
const_iterator begin (void) const
 
iterator end (void)
 
const_iterator end (void) const
 
void setOffset (double offset)
 
void setLength (double duration)
 
void setStepsize (double stepsize)
 
void setRangeFront (double front)
 
void setRangeBack (double back)
 
void setSignalTime (double s)
 
const EventListoperator+= (double x)
 
const EventListoperator-= (double x)
 
const EventListoperator*= (double x)
 
const EventListoperator/= (double x)
 
double count (double tbegin, double tend, double *sd=0) const
 
double totalCount (double tbegin, double tend) const
 
double rate (double tbegin, double tend, double *sd=0) const
 
void rate (SampleDataD &rate, double width=0.0, double time=0.0) const
 
void rate (SampleDataD &rate, SampleDataD &ratesd, 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 rate (SampleDataD &rate, SampleDataD &ratesd, 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 cyclicRate (SampleDataD &rate, SampleDataD &ratesd, const Kernel &kernel, double time=0.0) const
 
void addCyclicRate (SampleDataD &rate, int &trial, const Kernel &kernel, double time=0.0) const
 
void intervals (SampleData< ArrayD > &intervals, double time=0.0) const
 
void intervalsAt (double time, ArrayD &intervals) const
 
double interval (double tbegin, double tend) const
 
double interval (double tbegin, double tend, double &sd) const
 
void interval (SampleDataD &intervals, double time=0.0) const
 
void interval (SampleDataD &intervals, SampleDataD &sd, double time=0.0) const
 
void intervalCV (SampleDataD &intervals, SampleDataD &cv, double time=0.0) const
 
void cyclicInterval (SampleDataD &intervals, double time=0.0) const
 
double intervalAt (double time) const
 
double intervalAt (double time, double &sd) const
 
int intervals (double tbegin, double tend, ArrayD &intervals) const
 
int intervals (double tbegin, double tend, vector< MapD > &intrvls, int pos=-1) const
 
ostream & saveIntervals (double tbegin, double tend, ostream &os, int pos=-1, double tfac=1.0, int width=0, int prec=5, char frmt='g', int sep=1, const string &noevents="") const
 
double frequency (double tbegin, double tend) const
 
double frequency (double tbegin, double tend, double &sd) const
 
void frequency (SampleDataD &rate, double time=0.0, double defaultfrequency=-1.0) const
 
void frequency (SampleDataD &rate, SampleDataD &sd, double time=0.0, double defaultfrequency=-1.0) const
 
void frequencyCV (SampleDataD &rate, SampleDataD &cv, double time=0.0) const
 
void cyclicFrequency (SampleDataD &rate, double time=0.0) const
 
void cyclicFrequency (SampleDataD &rate, SampleDataD &sd, double time=0.0) const
 
double frequencyAt (double time, double defaultfrequency=-1.0) const
 
double frequencyAt (double time, double &sd, double defaultfrequency=-1.0) const
 
int frequencies (double tbegin, double tend, vector< MapD > &freqs, int pos=-1) const
 
ostream & saveFrequencies (double tbegin, double tend, ostream &os, int pos=-1, double tfac=1.0, int width=0, int prec=5, char frmt='g', int sep=1, const string &noevents="") const
 
void intervalHistogram (double tbegin, double tend, SampleDataD &hist) const
 
void directIntervalHistogram (double time, SampleDataD &hist) const
 
void correctedIntervalHistogram (double time, SampleDataD &hist) const
 
void serialCorr (double tbegin, double tend, ArrayD &sc) const
 
void trialAveragedSerialCorr (double tbegin, double tend, ArrayD &sc) const
 
void trialAveragedSerialCorr (double tbegin, double tend, ArrayD &sc, ArrayD &sd) const
 
double locking (double tbegin, double tend, double period) const
 
double locking (double tbegin, double tend, double period, double &sd) const
 
double vectorStrength (double tbegin, double tend, double period) const
 
double vectorStrength (double tbegin, double tend, double period, double &sd) const
 
double vectorPhase (double tbegin, double tend, double period) const
 
double vectorPhase (double tbegin, double tend, double period, double &sd) const
 
double correlation (double tbegin, double tend, const Kernel &kernel, double dt, double &sd) const
 
double correlation (double tbegin, double tend, const Kernel &kernel, double dt=0.001) const
 
double reliability (double tbegin, double tend, const Kernel &kernel, double dt, double &sd) const
 
double reliability (double tbegin, double tend, const Kernel &kernel, double dt=0.001) const
 
void coincidenceRate (SampleDataD &rate, SampleDataD &ratesd, const Kernel &kernel)
 
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 spectrum (double tbegin, double tend, double step, SampleDataD &psd, SampleDataD &sd, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
void spectra (const SampleDataD &stimulus, SampleDataD &g, SampleDataD &c, SampleDataD &cs, SampleDataD &ss, SampleDataD &rs, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
void spectra (const SampleDataD &stimulus, SampleDataD &g, SampleDataD &gsd, SampleDataD &c, SampleDataD &csd, SampleDataD &cs, SampleDataD &cssd, SampleDataD &ss, SampleDataD &rs, SampleDataD &rssd, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
int coherence (const SampleDataD &stimulus, SampleDataD &c, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
int coherence (double tbegin, double tend, double step, SampleDataD &c, bool overlap=true, double(*window)(int j, int n)=bartlett) const
 
double latency (double time, double *sd=0) const
 
void sum (EventData &all) const
 
void sync (EventData &s, double bin, double p=1.0, bool keep=false, double advance=0.0) const
 
void poisson (int trials, 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', int sep=1, 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', int sep=1, 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', int sep=0, 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', int sep=0, double lower=0.1, double upper=0.9, const string &noevents="", double noy=-1.0) const
 

Friends

ostream & operator<< (ostream &str, const EventList &events)
 

Detailed Description

A container for EventData.

Author
Jan Benda
Version
1.1

Use push() or add() to add EventData to the list.

The range operator[] returns a reference to an EventData specified either by index or identifier.

The index() function returns the index of an EventData specified by its identifier.

Todo:
check equal size of input SampleDataD in e.g. rate, etc.

Member Typedef Documentation

typedef vector< EventData* > EL
typedef EL::iterator iterator
typedef EL::const_iterator const_iterator

Constructor & Destructor Documentation

EventList ( void  )

Constructs an empty EventList.

EventList ( const EventList el)

Copy constructor. All EventData that are owened by el are copied, otherwise only pointers to EventData are copied.

EventList ( const EventList el)

Copies el to this with copying pointers to the data buffers only.

EventList ( const EventList el,
double  tbegin,
double  tend 
)

Contruct an EventList with event times copied from each element of el between time tbegin and time tend seconds. In the copy, all event times and the signalTime() are set relative to time tbegin.

References EventList::push().

EventList ( const EventList el,
double  tbegin,
double  tend,
double  tref 
)

Contruct an EventList with event times copied from each element of el between time tbegin and time tend seconds. In the copy, all event times and the signalTime() are set relative to time tref.

References EventList::push().

EventList ( const EventData events)

Constructs an EventList containing the single EventData events.

References EventList::push().

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

Constructs an EventList containing the event times of events between time tbegin and time tend seconds. In the copy, all event times and the signalTime() are set relative to time tbegin.

References EventList::push().

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

Constructs an EventList containing the event times of events between time tbegin and time tend seconds. In the copy, all event times and the signalTime() are set relative to time tref.

References EventList::push().

EventList ( const EventData events,
const EventData times,
double  tend 
)

For each event t in times copy all event times from events between the time of the event t and t plus tend seconds as a new element to the end of the EventList with the event times set relative to the time of the event t.

References EventList::push().

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

For each event t in times copy all event times from events between the time of the event t plus tbegin seconds and t plus tend seconds as a new element to the end of the EventList with the event times set relative to the time of the event t.

References EventList::push().

EventList ( EventData events,
bool  own = false 
)

Constructs an EventList containing the single pointer events. Setting own to true transfers the ownership to the EventList.

References EventList::add().

EventList ( int  n,
int  m = 0,
bool  sizebuffer = false,
bool  widthbuffer = false 
)

Creates an EventList with n non-cyclic EventData, each of capacity m and additional buffer for the size and the width of events if sizebuffer or widthbuffer are true, respectively.

References EventList::push().

~EventList ( void  )

Destructs an EventList. All EventData are deleted.

References EventList::clear().

Member Function Documentation

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

True if there are no EventData contained in the EventList.

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

void resize ( int  n,
int  m = 0,
bool  sizebuffer = false,
bool  widthbuffer = false 
)

Resize the EventList such that it contains n EventData. If n equals zero, clear() is called. If a larger size than the current size() is requested than empty EventData are appended, each of capacity m and additional buffer for the size and the width of events if sizebuffer or widthbuffer are true, respectively.

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

References EventList::clear().

Referenced by EventList::assign(), and EventList::poisson().

void clear ( void  )

Clear the EventList, i.e. remove all EventData the EventList owns.

References EventList::begin(), and EventList::end().

Referenced by EventList::poisson(), EventList::resize(), and EventList::~EventList().

int capacity ( void  ) const

Maximum number of EventData the EventList can hold.

void reserve ( int  n)
EventList & operator= ( const EventList el)

Assignment.

EventList & assign ( const EventList el)

Copies el to this with copying pointers to the data buffers only.

References EventList::assign(), EventList::resize(), and EventList::size().

EventList & assign ( void  )

Copies again all settings and indices from the reference EventData.

Referenced by EventList::assign().

const EventData& operator[] ( int  i) const
inline

Returns a const reference of the i -th EventData of the list.

Referenced by EventList::operator[]().

EventData& operator[] ( int  i)
inline

Returns a reference of the i -th EventData of the list.

const EventData & front ( void  ) const

Returns a const reference to the first EventData in the list.

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

EventData & front ( void  )

Returns a reference to the first EventData in the list.

const EventData & back ( void  ) const

Returns a const reference to the last EventData in the list.

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

EventData & back ( void  )

Returns a reference to the last EventData in the list.

const EventData & operator[] ( const string &  ident) const

Returns a const reference of the EventData element with identifier ident.

Warning
No "range checking" is performed. If there is no EventData element with identifier ident a reference to the first element is returned.

References EventList::begin(), EventList::end(), and EventList::operator[]().

EventData & operator[] ( const string &  ident)

Returns a reference of the EventData element with identifier ident.

Warning
No "range checking" is performed. If there is no EventData element with identifier ident a reference to the first element is returned.

References EventList::begin(), EventList::end(), and EventList::operator[]().

int index ( const string &  ident) const

Return the index of the event data trace with identifier ident. If there is no trace with this identifier -1 is returned.

References EventList::begin(), and EventList::end().

Referenced by EventList::assign(), EventList::erase(), and EventList::set().

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

Copy event times from events between time tbegin and time tend seconds as a new element to the end of the EventList. In the copy, all event times and the signalTime() are set relative to time tbegin.

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

Copy event times from events between time tbegin and time tend seconds as a new element to the end of the EventList. In the copy, all event times and the signalTime() are set relative to time tref.

void push ( const ArrayD events,
double  tbegin = -HUGE_VAL,
double  tend = HUGE_VAL,
double  stepsize = 0.0001 
)

Copies events as a new element to the end of the EventList.

void push ( const EventData events,
const EventData times,
double  tend 
)

For each event t in times copy all event times from events between the time of the event t and t plus tend seconds as a new element to the end of the EventList with the event times set relative to the time of the event t.

References EventList::reserve(), EventList::size(), and EventData::size().

void push ( const EventData events,
const EventData times,
double  tbegin,
double  tend 
)

For each event t in times copy all event times from events between the time of the event t plus tbegin seconds and t plus tend seconds as a new element to the end of the EventList with the event times set relative to the time of the event t.

References EventList::reserve(), EventList::size(), and EventData::size().

void push ( const EventList el)

Copy each element of el as new elements to the end of the EventList.

References EventList::push(), EventList::reserve(), and EventList::size().

void push ( const EventList el,
double  tbegin,
double  tend 
)

Copy event times from each element of el between time tbegin and time tend seconds as a new element to the end of the EventList. In the copy, all event times and the signalTime() are set relative to time tbegin.

References EventList::push(), EventList::reserve(), and EventList::size().

void push ( const EventList el,
double  tbegin,
double  tend,
double  tref 
)

Copy event times from each element of el between time tbegin and time tend seconds as a new element to the end of the EventList. In the copy, all event times and the signalTime() are set relative to time tref.

References EventList::push(), EventList::reserve(), and EventList::size().

void push ( int  m,
bool  sizebuffer = false,
bool  widthbuffer = false 
)

Add an EventData as a new element to the end of the list and set its capacity to m. The new EventData element gets additional buffers for the size and the width of events if sizebuffer or widthbuffer are true, respectively.

References EventList::reserve(), and EventList::size().

void push ( int  n,
int  m,
bool  sizebuffer = false,
bool  widthbuffer = false 
)

Add n EventData as new elements to the end of the list and set their capacity to m. The new EventData elements get additional buffers for the size and the width of events if sizebuffer or widthbuffer are true, respectively.

References EventList::reserve(), and EventList::size().

void add ( EventData events,
bool  own = false 
)

Add the pointer events as a new element to the end of the EventList. If own is set to true then the ownership of events is transfered to the EventList, i.e. the EventList might delete it.

Referenced by EventList::EventList(), and relacs::peaksTroughs().

void add ( const EventData events,
bool  own = false 
)

Add the pointer events as a new element to the end of the EventList. If own is set to true then the ownership of events is transfered to the EventList, i.e. the EventList might delete it.

void add ( EventList events,
bool  own = false 
)

Add pointer to each element of events as a new element to the end of the EventList. If own is set to true then the ownership of events is transfered to the EventList, i.e. the EventList might delete it.

References EventList::size().

void add ( const EventList events,
bool  own = false 
)

Add pointer to each element of events as a new element to the end of the EventList. If own is set to true then the ownership of events is transfered to the EventList, i.e. the EventList might delete it.

References EventList::size().

void set ( int  index,
const EventData data,
bool  own = false 
)

Set the pointer to data as the index-th element. If own is set to true then the ownership of the events is transferred to the EventList, i.e. the EventList might delete it.

References EventList::index(), and EventList::size().

void assign ( int  index,
const EventData data 
)

Make the index-th element a copy of data with shared buffer.

References EventList::index(), and EventList::size().

void erase ( int  index)

Erase the EventData at index index.

References EventList::index(), and EventList::size().

void update ( void  )

Make written data of all events available for reading.

References EventList::size().

void updateRaw ( void  )

Make written data of raw events (source == 0) available for reading.

References EventList::size().

void updateDerived ( void  )

Make written data of derived events (source != 0 ) available for reading.

References EventList::size().

void clearBuffer ( void  )

Clear each of the EventData without erasing them from the EventList.

References EventList::begin(), and EventList::end().

iterator begin ( void  )
inline
const_iterator begin ( void  ) const
inline
iterator end ( void  )
inline
const_iterator end ( void  ) const
inline
void setOffset ( double  offset)

Set the beginning of the range() containing the events to offset for all EventData in the list.

References EventList::begin(), and EventList::end().

void setLength ( double  duration)

Set the length of the range() containing the events to duration for all EventData in the list.

References EventList::begin(), and EventList::end().

void setStepsize ( double  stepsize)

Set the stepsize (resolution) of the range() containing the events to stepsize for all EventData in the list.

References EventList::begin(), and EventList::end().

void setRangeFront ( double  front)

Set the offset of the range containing the events to front without changing the last range element for all EventData in the list.

References EventList::begin(), and EventList::end().

void setRangeBack ( double  back)

Resize the range containing the events such that the last range element equals back for all EventData in the list.

References EventList::begin(), and EventList::end().

void setSignalTime ( double  s)

Set the time of the signal to s for all EventData in the list.

References EventList::begin(), and EventList::end().

const EventList & operator+= ( double  x)

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

References EventList::begin(), and EventList::end().

const EventList & operator-= ( double  x)

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

References EventList::begin(), and EventList::end().

const EventList & operator*= ( double  x)

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

References EventList::begin(), and EventList::end().

const EventList & operator/= ( double  x)

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

References EventList::begin(), and EventList::end().

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

Returns the average number of events between time tbegin and time tend seconds. The standard deviation of the count is returned in sd, provided sd does not equal zero.

References EventList::begin(), EventList::end(), relacs::mean(), EventList::size(), and relacs::sqrt().

double totalCount ( double  tbegin,
double  tend 
) const

Returns the total number of events between time tbegin and time tend seconds.

References EventList::begin(), and EventList::end().

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

Mean event rate (Hz) as the number of events between time tbegin and time tend seconds divided by the width tend - tbegin of the time window. In sd the standard deviation of the rate is returned provided sd does not equal zero.

References EventList::begin(), EventList::end(), EventList::size(), and relacs::sqrt().

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

The time course of the mean event rate between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is returned in rate. The rate is the average 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.

References EventList::addRate().

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

The time course of the mean event rate and its standard deviation between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is returned in rate. The rate is the average 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.

References EventList::begin(), EventList::end(), relacs::meanStdev(), EventList::push(), SampleData< T >::range(), EventList::reserve(), EventList::size(), and SampleData< T >::size().

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

The time course of the mean event rate between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is added to rate. The rate is the average 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.

References EventList::begin(), and EventList::end().

Referenced by EventList::rate().

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

The time course of the mean cyclic event rate between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds 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.

References EventList::addCyclicRate().

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

The time course of the mean cyclic event rate between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds 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.

References EventList::begin(), and EventList::end().

Referenced by EventList::cyclicRate().

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

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

References EventList::addRate().

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

The time course of the mean event rate and its standard deviation between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds are returned in rate and ratesd, respectively. Each event is replaced by the kernel, which then are summed up.

References EventList::begin(), EventList::end(), relacs::meanStdev(), EventList::push(), SampleData< T >::range(), EventList::reserve(), EventList::size(), and SampleData< T >::size().

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

The time course of the mean event rate between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is added to rate. Each event is replaced by the kernel, which then are summed up.

References EventList::begin(), and EventList::end().

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

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

References EventList::addCyclicRate().

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

The time course of the mean cyclic event rate and its standard deviation. between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds are returned in rate and ratesd, respectively. The width and the position of the time windows are given by rate in seconds. Each event is replaced by the kernel, which then are summed up.

References EventList::begin(), EventList::end(), relacs::meanStdev(), EventList::push(), SampleData< T >::range(), EventList::reserve(), EventList::size(), and SampleData< T >::size().

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

The time course of the mean cyclic event rate between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is added to rate. Each event is replaced by the kernel, which then are summed up.

References EventList::begin(), and EventList::end().

void intervals ( SampleData< ArrayD > &  intervals,
double  time = 0.0 
) const
void intervalsAt ( double  time,
ArrayD intervals 
) const

Return the interevent intervals that include time time in intervals.

References EventList::begin(), Array< T >::clear(), EventList::end(), Array< T >::push(), Array< T >::reserve(), and EventList::size().

double interval ( double  tbegin,
double  tend 
) const

Mean event interval (seconds) of all event intervals between time tbegin and time tend seconds.

References EventList::begin(), and EventList::end().

double interval ( double  tbegin,
double  tend,
double &  sd 
) const

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

References EventList::begin(), EventList::end(), and relacs::sqrt().

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

The time course of the trial averaged event intervals 1/<1/ISI> between intervals.rangeFront() and intervals.rangeBack() seconds relative to time time seconds is returned in intervals.

References SampleData< T >::pos(), SampleData< T >::rangeFront(), EventList::size(), and SampleData< T >::size().

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

The time course of the trial averaged event intervals 1/<1/ISI> between intervals.rangeFront() and intervals.rangeBack() seconds relative to time time seconds is returned in intervals. In sd the standard deviation of the intervals is returned.

References SampleData< T >::pos(), SampleData< T >::rangeFront(), EventList::size(), SampleData< T >::size(), and relacs::sqrt().

void intervalCV ( SampleDataD intervals,
SampleDataD cv,
double  time = 0.0 
) const

The time course of the trial averaged event intervals 1/<1/ISI> between intervals.rangeFront() and intervals.rangeBack() seconds relative to time time seconds is returned in intervals. In cv the corresponding coefficient of variation is returned.

References SampleData< T >::pos(), SampleData< T >::rangeFront(), EventList::size(), SampleData< T >::size(), and relacs::sqrt().

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

The time course of the trial averaged cyclic event intervals 1/<1/ISI> between intervals.rangeFront() and intervals.rangeBack() seconds relative to time time seconds is returned in intervals.

References EventList::begin(), and EventList::end().

double intervalAt ( double  time) const

Mean event interval (seconds) of the event intervals at time seconds.

References EventList::begin(), and EventList::end().

double intervalAt ( double  time,
double &  sd 
) const

Mean event interval (seconds) of the event intervals at time seconds. In sd the standard deviation of the intervals is returned.

References EventList::begin(), EventList::end(), and relacs::sqrt().

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

Returns in intervals the interevent intervals from all trials between tbegin and tend.

Returns
the number of interevent intervals.

References EventList::begin(), Array< T >::clear(), and EventList::end().

int intervals ( double  tbegin,
double  tend,
vector< MapD > &  intrvls,
int  pos = -1 
) const

Returns in intrvls[i].x() the position of each interevent interval between tbegin and tend, and in intrvls[i].y() the interevent interval for each trial i. 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 EventList::begin(), EventList::end(), and EventList::size().

ostream & saveIntervals ( double  tbegin,
double  tend,
ostream &  os,
int  pos = -1,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
int  sep = 1,
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. The individual EventData are separated by sep blank lines. 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 EventList::begin(), and EventList::end().

double frequency ( double  tbegin,
double  tend 
) const

Mean event frequency (Hz) as the inverse of the mean event interval of all event intervals between time tbegin and time tend seconds.

References EventList::begin(), and EventList::end().

double frequency ( double  tbegin,
double  tend,
double &  sd 
) 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.

References EventList::begin(), EventList::end(), and relacs::sqrt().

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

The time course of the averaged instantaneous rate <1/ISI> between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is returned in rate. If defaultfrequency is negative (the default) then trials that have not an ISI at a particular time are not included in computing the instantaneous rate. Therefore at the margins of the measured interval only few or even no trial deterine the average 1/ISI. Alternatively, one can set defaultfrequency to an instantaneous rate (for example zero) that is used whenever there is no ISI defined.

References SampleData< T >::pos(), SampleData< T >::rangeFront(), EventList::size(), and SampleData< T >::size().

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

The time course of the averaged instantaneous rate <1/ISI> between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is returned in rate. In sd the standard deviation of the rate is returned. If defaultfrequency is negative (the default) then trials that have not an ISI at a particular time are not included in computing the instantaneous rate. Therefore at the margins of the measured interval only few or even no trial deterine the average 1/ISI. Alternatively, one can set defaultfrequency to an instantaneous rate (for example zero) that is used whenever there is no ISI defined.

References Array< T >::clear(), relacs::meanStdev(), SampleData< T >::pos(), Array< T >::push(), SampleData< T >::rangeFront(), Array< T >::reserve(), EventList::size(), and SampleData< T >::size().

void frequencyCV ( SampleDataD rate,
SampleDataD cv,
double  time = 0.0 
) const

The time course of the averaged instantaneous rate <1/ISI> between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is returned in rate. In cv the corresponding coefficient of variation is returned.

References SampleData< T >::pos(), SampleData< T >::rangeFront(), EventList::size(), SampleData< T >::size(), and relacs::sqrt().

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

The time course of the averaged cyclic instantaneous rate <1/ISI> between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is returned in rate.

References EventList::begin(), and EventList::end().

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

The time course of the averaged cyclic instantaneous rate <1/ISI> between rate.rangeFront() and rate.rangeBack() seconds relative to time time seconds is returned in rate. In sd the standard deviation of the rate is written.

References EventList::begin(), EventList::end(), SampleData< T >::size(), and relacs::sqrt().

double frequencyAt ( double  time,
double  defaultfrequency = -1.0 
) const

Mean frequency as the inverse of the mean event intervals at time seconds. If defaultfrequency is negative (the default) then trials that have not an ISI that time are not included in computing the instantaneous rate. Therefore at the margins of the measured interval only few or even no trial deterine the average 1/ISI. Alternatively, one can set defaultfrequency to an instantaneous rate (for example zero) that is used whenever there is no ISI defined.

References EventList::begin(), and EventList::end().

double frequencyAt ( double  time,
double &  sd,
double  defaultfrequency = -1.0 
) const

Mean frequency (Hz) as the inverse of the mean event intervals at time seconds. If defaultfrequency is negative (the default) then trials that have not an ISI that time are not included in computing the instantaneous rate. Therefore at the margins of the measured interval only few or even no trial deterine the average 1/ISI. Alternatively, one can set defaultfrequency to an instantaneous rate (for example zero) that is used whenever there is no ISI defined. In sd the standard deviation in Hz is returned.

References EventList::begin(), EventList::end(), relacs::meanStdev(), Array< T >::push(), Array< T >::reserve(), and EventList::size().

int frequencies ( double  tbegin,
double  tend,
vector< MapD > &  freqs,
int  pos = -1 
) const

Returns in freqs[i].x() the position of each interevent interval between tbegin and tend, and in freqs[i].y() 1 divided by that interevent interval for each trial i. 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 EventList::begin(), EventList::end(), and EventList::size().

ostream & saveFrequencies ( double  tbegin,
double  tend,
ostream &  os,
int  pos = -1,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
int  sep = 1,
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 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. The individual EventData are separated by sep blank lines. 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 EventList::begin(), and EventList::end().

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

Compute a histogram of the event intervals between time tbegin and time tend seconds. The resolution and maximum interval lenght is given by hist.

References EventList::begin(), and EventList::end().

void directIntervalHistogram ( double  time,
SampleDataD hist 
) const

Compute a normalized histogram of all the event intervals that include time time. The resolution and maximum interval lenght is given by hist.

References EventList::begin(), EventList::end(), SampleData< T >::hist(), EventList::intervals(), Array< T >::push(), Array< T >::reserve(), EventList::size(), SampleData< T >::stepsize(), and relacs::sum().

void correctedIntervalHistogram ( double  time,
SampleDataD hist 
) const

Compute a normalized histogram of all the event intervals that include time time weighted with their length. The resolution and maximum interval lenght is given by hist.

References EventList::begin(), EventList::end(), SampleData< T >::hist(), EventList::intervals(), SampleData< T >::pos(), Array< T >::push(), Array< T >::reserve(), EventList::size(), SampleData< T >::size(), SampleData< T >::stepsize(), and EventList::sum().

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 seonds from all trials. Only pairs of intervals within a trial are used.

References Array< T >::back(), EventList::begin(), EventList::end(), EventList::size(), Array< T >::size(), and relacs::sqrt().

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

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

Note
: if the number of intervals per trial is too low (below several hundred) the resulting serial correlations are biased to lower values.
See Also
relacs::serialCorr()

References EventList::begin(), EventList::end(), relacs::mean(), EventList::push(), EventList::reserve(), EventList::size(), and Array< T >::size().

void trialAveragedSerialCorr ( double  tbegin,
double  tend,
ArrayD sc,
ArrayD sd 
) const

Compute for each trial the serial correlation coefficients for lag zero to lag sc.size()-1 of all event intervals between time tbegin and time tend seonds and average over trials. In sd the standard deviation of the trial average is returned.

Note
: if the number of intervals per trial is too low (below several hundred) the resulting serial correlations are biased to lower values.
See Also
relacs::serialCorr()

References EventList::begin(), EventList::end(), relacs::mean(), EventList::push(), EventList::reserve(), Array< T >::resize(), EventList::size(), and Array< T >::size().

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

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

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

Compute the phase locking as the number of spikes per period period of all events since time time (seconds) during duration seconds. duration is reduced to the closest multiple of period. For each EventData the locking is computed separately. The function returns the mean locking and the standarad deviation in sd.

References EventList::begin(), EventList::end(), relacs::mean(), Array< T >::mean(), Array< T >::push(), Array< T >::reserve(), and EventList::size().

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 EventList::begin(), relacs::cos(), EventList::end(), relacs::sin(), and relacs::sqrt().

double vectorStrength ( double  tbegin,
double  tend,
double  period,
double &  sd 
) 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 of each trial. For each EventData the vector strength is computed separately. The function returns the mean vector strength and the standarad deviation in sd.

References EventList::begin(), EventList::end(), relacs::mean(), Array< T >::mean(), Array< T >::push(), Array< T >::reserve(), and EventList::size().

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 EventList::begin(), relacs::cos(), EventList::end(), and relacs::sin().

double vectorPhase ( double  tbegin,
double  tend,
double  period,
double &  sd 
) 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 of each trial. For each EventData the vector strength is computed separately. The function returns the mean vector strength and the standarad deviation in sd.

References EventList::begin(), EventList::end(), relacs::mean(), Array< T >::mean(), Array< T >::push(), Array< T >::reserve(), and EventList::size().

double correlation ( double  tbegin,
double  tend,
const Kernel kernel,
double  dt,
double &  sd 
) const

Returns the correlation between time tbegin and time tend seconds computed as the correlation between pairs of EventData convolved with kernel and averaged over pairs. The corresponding standard deviation is returned in sd. Performs computation using a temporal resolution of dt seconds.

References EventList::begin(), relacs::corrCoef(), EventList::end(), relacs::meanStdev(), and EventList::size().

Referenced by EventList::correlation().

double correlation ( double  tbegin,
double  tend,
const Kernel kernel,
double  dt = 0.001 
) const

Returns the correlation between time tbegin and time tend seconds computed as the correlation between pairs of EventData convolved with kernel and averaged over pairs. Performs computation using a temporal resolution of dt seconds.

References EventList::correlation().

double reliability ( double  tbegin,
double  tend,
const Kernel kernel,
double  dt,
double &  sd 
) const

Returns the reliability between time tbegin and time tend seconds computed as the correlation between pairs of EventData convolved with kernel without removing the average and averaged over pairs (Schreiber et al.). The corresponding standard deviation is returned in sd. Performs computation using a temporal resolution of dt seconds.

References EventList::begin(), relacs::dot(), EventList::end(), relacs::magnitude(), relacs::meanStdev(), and EventList::size().

Referenced by EventList::reliability().

double reliability ( double  tbegin,
double  tend,
const Kernel kernel,
double  dt = 0.001 
) const

Returns the reliability between time tbegin and time tend seconds computed as the correlation between pairs of EventData convolved with kernel without removing the average and averaged over pairs (Schreiber et al.). Performs computation using a temporal resolution of dt seconds.

References EventList::reliability().

void coincidenceRate ( SampleDataD rate,
SampleDataD ratesd,
const Kernel kernel 
)

Convolves each spiketrain with the kernel kernel. The resulting firing rates are pairwise multiplied. Returns the square root of the mean over all pairs in rate and the corresponding standard deviation in ratesd.

References EventList::begin(), EventList::end(), relacs::meanStdev(), EventList::push(), SampleData< T >::range(), EventList::reserve(), EventList::size(), SampleData< T >::size(), and relacs::sqrt().

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

Compute the event-triggered average (spike-triggerd average STA) ave 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 EventList::begin(), EventList::end(), SampleData< T >::pos(), 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 EventList::begin(), EventList::end(), SampleData< T >::pos(), 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(), EventList::begin(), SampleData< T >::clear(), EventList::end(), SampleData< T >::pos(), SampleData< T >::range(), SampleData< T >::rangeBack(), SampleData< T >::rangeFront(), SampleData< T >::reserve(), 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 trial averaged 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(), relacs::rPSD(), SampleData< T >::setOffset(), SampleData< T >::setStepsize(), EventList::size(), and SampleData< T >::size().

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

Returns in psd the trial averaged powerspectrum density of the events between tbegin and tend. In sd the corresponding standard deviation is returned. 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 and its standard deviation sd is set to the appropriate values.

References relacs::mean(), SampleData< T >::resize(), relacs::rPSD(), SampleData< T >::setOffset(), SampleData< T >::setStepsize(), EventList::size(), SampleData< T >::size(), and relacs::sqrt().

void spectra ( const SampleDataD stimulus,
SampleDataD g,
SampleDataD c,
SampleDataD cs,
SampleDataD ss,
SampleDataD rs,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
) const

Returns trial-averaged spectral measures between stimulus stimulus and the events. The size of g 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 gain g, coherence c, stimulus spectrum ss, response spectrum rs, and cross-spectrum cs are set to the appropriate values.

Parameters
[in]stimulusthe stimulus that evoked the response
[out]gthe gain between stimlus and response
[out]cthe coherence between stimulus and response (the S-R coherence $\gamma^2_{SR}$).
[out]csthe cross-spectrum between stimulus and the events.
[out]ssthe power-spectrum of the stimulus.
[out]rsthe power-spectrum of the events.
[in]overlapif true overlap the fft windows by 50%.
[in]windowthe fft window to be used.

References relacs::mean(), SampleData< T >::range(), SampleData< T >::resize(), SampleData< T >::setOffset(), SampleData< T >::setStepsize(), EventList::size(), SampleData< T >::size(), and relacs::spectra().

void spectra ( const SampleDataD stimulus,
SampleDataD g,
SampleDataD gsd,
SampleDataD c,
SampleDataD csd,
SampleDataD cs,
SampleDataD cssd,
SampleDataD ss,
SampleDataD rs,
SampleDataD rssd,
bool  overlap = true,
double(*)(int j, int n)  window = bartlett 
) const

Returns trial-averaged spectral measures between stimulus stimulus and the events. The size of g 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 gain g, coherence c, stimulus spectrum ss, response spectrum rs, and cross-spectrum cs and their standard deviations are set to the appropriate values.

Parameters
[in]stimulusthe stimulus that evoked the response
[out]gthe gain between stimlus and response
[out]gsdthe standard deviation of the gain.
[out]cthe coherence between stimulus and response (the S-R coherence $\gamma^2_{SR}$).
[out]csdthe standard deviation of the coherence.
[out]csthe cross-spectrum between stimulus and the events.
[out]cssdthe standard deviation of the cross spectrum.
[out]ssthe power-spectrum of the stimulus.
[out]rsthe power-spectrum of the events.
[out]rssdthe standard deviation of the response spectrum.
[in]overlapif true overlap the fft windows by 50%.
[in]windowthe fft window to be used.

References relacs::mean(), SampleData< T >::range(), SampleData< T >::resize(), SampleData< T >::setOffset(), SampleData< T >::setStepsize(), EventList::size(), SampleData< T >::size(), relacs::spectra(), and relacs::sqrt().

int 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 each of the event trials (the S-R coherence $\gamma^2_{SR}$). Cross and power spectra are computed for each trial and averaged before computing the 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.

Returns
The error code of the crossSpectra() function.

References relacs::coherence(), relacs::crossSpectra(), relacs::mean(), relacs::nextPowerOfTwo(), SampleData< T >::range(), EventList::size(), and SampleData< T >::size().

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

Returns in c the square-root of the coherence between pairs of event trials averaged over all pairs (the response-response (R-R) coherence $\gamma_{RR}$). 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.

Returns
The error code of the crossSpectra() function.

References EventList::begin(), relacs::coherence(), relacs::crossSpectra(), EventList::end(), relacs::nextPowerOfTwo(), EventList::size(), SampleData< T >::size(), and relacs::sqrt().

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

The mean latenceny and standard deviation sd of the events following time time.

References EventList::begin(), EventList::end(), relacs::mean(), and relacs::sqrt().

void sum ( EventData all) const
void sync ( EventData s,
double  bin,
double  p = 1.0,
bool  keep = false,
double  advance = 0.0 
) const

For each time bin of width bin count the number of trials that contain at least one event. If the event count divided by the number of trials (size()) equals or exceeds p, an event with the time of the time bin is added to s. If keep is set true, then the event times of the first trial are added to s instead of the time bins. If advance is greater than zero, the bins of width bin are advanced by advance and not by bin.

References EventList::back(), EventData::clear(), EventList::empty(), relacs::floor(), EventList::front(), relacs::min(), EventData::offset(), EventData::push(), EventData::rangeBack(), EventData::reserve(), EventData::setOffset(), EventData::setRangeBack(), EventData::setStepsize(), EventList::size(), EventData::size(), and EventData::stepsize().

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

Generate trials of independent poisson spike trains each with rate rate Hertz and absoulte refractory period refract and duration duration seconds. Use the random number gnerator random.

References EventList::begin(), EventList::clear(), EventList::end(), and EventList::resize().

void saveText ( ostream &  os,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
int  sep = 1,
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. The individual EventData are separated by sep blank lines. If there aren't any events in a trial and noevents isn't empty, than noevents is printed as the only output for that trial.

References EventList::begin(), and EventList::end().

void savePoint ( ostream &  os,
double  y = 0.0,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
int  sep = 1,
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. The individual EventData are separated by sep blank lines. If there aren't any events in a trial 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 for that trial.

References EventList::begin(), and EventList::end().

void saveStroke ( ostream &  os,
int  offs = 0,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
int  sep = 0,
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 n + lower and n + upper where n is the index of the EventData + offs. Each event time is multiplied by tfac, and is formatted as specified by width, prec, and frmt. Events are separated by a blank line. The individual EventData are separated by sep blank lines (in addition to the one blank line separating the events). If there aren't any events in a trial 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 for that trial.

References EventList::begin(), and EventList::end().

void saveBox ( ostream &  os,
double  bin,
int  offs = 0,
double  tfac = 1.0,
int  width = 0,
int  prec = 5,
char  frmt = 'g',
int  sep = 0,
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 n + lower and n + upper where n is the index of the EventData + offs. 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 in a trial 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 for that trial.

References EventList::begin(), and EventList::end().

Friends And Related Function Documentation

ostream& operator<< ( ostream &  str,
const EventList events 
)
friend

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


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