Skip to main content

EventInIntervalComputer

EventInIntervalComputer

Templated computer for processing events within time intervals. More…

#include <EventInIntervalComputer.h>

Inherits from IColumnComputer< T >

Public Functions

Name
EventInIntervalComputer(std::shared_ptr< DigitalEventSeries > source, EventOperation operation, std::string sourceName)
Constructor for EventInIntervalComputer.
virtual std::pair< std::vector< T >, ColumnEntityIds > compute(ExecutionPlan const & plan) const override
Computes the result for all intervals in the execution plan.
virtual std::string getSourceDependency() const override
Returns the name of the data source this computer depends on.
virtual EntityIdStructure getEntityIdStructure() const override
Gets the EntityID structure type for this computer.
virtual std::pair< std::vector< bool >, ColumnEntityIds > compute(ExecutionPlan const & plan) const
Template specialization for bool (Presence operation).
virtual std::pair< std::vector< int >, ColumnEntityIds > compute(ExecutionPlan const & plan) const
Template specialization for int (Count operation).
virtual std::pair< std::vector< std::vector< float > >, ColumnEntityIds > compute(ExecutionPlan const & plan) const
Template specialization for std::vector (Gather operations).
virtual std::pair< std::vector< bool >, ColumnEntityIds > compute(ExecutionPlan const & plan) const
The core batch computation method.
virtual std::pair< std::vector< int >, ColumnEntityIds > compute(ExecutionPlan const & plan) const
The core batch computation method.
virtual std::pair< std::vector< std::vector< float > >, ColumnEntityIds > compute(ExecutionPlan const & plan) const
The core batch computation method.

Additional inherited members

Public Functions inherited from IColumnComputer< T >

Name
virtual ~IColumnComputer() =default
IColumnComputer(IColumnComputer const & ) =delete
IColumnComputer & operator=(IColumnComputer const & ) =delete
IColumnComputer(IColumnComputer && ) =delete
IColumnComputer & operator=(IColumnComputer && ) =delete
virtual std::vector< std::string > getDependencies() const
Declares dependencies on other columns.
virtual ColumnEntityIds computeColumnEntityIds(ExecutionPlan const & plan) const
Computes all EntityIDs for the column using the high-level variant approach.
virtual std::vector< EntityId > computeCellEntityIds(ExecutionPlan const & plan, size_t row_index) const
Computes EntityIDs for a specific row.
virtual bool hasEntityIds() const
Checks if this computer can provide EntityID information.

Protected Functions inherited from IColumnComputer< T >

Name
IColumnComputer() =default

Detailed Description

template <typename T >
class EventInIntervalComputer;

Templated computer for processing events within time intervals.

Template Parameters:

Par: Usage Example:

// Create an event source with spike data
auto spikeSource = std::make_shared<SpikeEventSource>("Neuron1", timeFrame, spikeTimes);

// Create intervals for analysis
std::vector<TimeFrameInterval> intervals = {
    TimeFrameInterval(TimeFrameIndex(0), TimeFrameIndex(10)),  // 0-10ms
    TimeFrameInterval(TimeFrameIndex(10), TimeFrameIndex(20)), // 10-20ms
    TimeFrameInterval(TimeFrameIndex(20), TimeFrameIndex(30))  // 20-30ms
};
ExecutionPlan plan(intervals, timeFrame);

// Check for presence of events in each interval
EventInIntervalComputer<bool> presenceComputer(spikeSource, EventOperation::Presence, "Neuron1");
auto presenceResults = presenceComputer.compute(plan);
// Result: [true, false, true] - events present in intervals 0-10ms and 20-30ms

// Count events in each interval
EventInIntervalComputer<int> countComputer(spikeSource, EventOperation::Count, "Neuron1");
auto countResults = countComputer.compute(plan);
// Result: [3, 0, 2] - 3 events in 0-10ms, 0 in 10-20ms, 2 in 20-30ms

// Gather all events in each interval
EventInIntervalComputer<std::vector<float>> gatherComputer(spikeSource, EventOperation::Gather, "Neuron1");
auto gatherResults = gatherComputer.compute(plan);
// Result: [[1.2, 3.4, 8.9], [], [22.1, 25.7]] - actual event times

Source type: DigitalEventSeries Selector type: Interval Output type: T

This computer analyzes event data from a DigitalEventSeries and performs statistical operations on events that fall within specified time intervals. It supports different analysis modes through the EventOperation enum, each requiring a specific template parameter type.

The computer efficiently processes events using binary search algorithms and handles time frame conversions between source and destination time frames automatically.

Public Functions Documentation

function EventInIntervalComputer

inline EventInIntervalComputer(
    std::shared_ptr< DigitalEventSeries > source,
    EventOperation operation,
    std::string sourceName
)

Constructor for EventInIntervalComputer.

Parameters:

  • source Shared pointer to the event source providing the event data. Must not be null.
  • operation The statistical operation to perform on events within intervals. Must be compatible with the template parameter T.
  • sourceName The name of the data source for dependency tracking. Used to identify data dependencies in the table view system.

Precondition:

Postcondition:

  • The computer is ready to process events from the specified source
  • getSourceDependency() returns sourceName

Creates a computer that will analyze events from the specified source using the given operation. The source name is used for dependency tracking in the table view system.

function compute

virtual std::pair< std::vector< T >, ColumnEntityIds > compute(
    ExecutionPlan const & plan
) const override

Computes the result for all intervals in the execution plan.

Parameters:

  • plan The execution plan containing interval boundaries and destination time frame. Must contain valid intervals and a non-null time frame.

Exceptions:

  • std::runtime_error if the operation type doesn’t match the template parameter T
  • std::runtime_error if the source time frame is incompatible with the destination time frame

Return: Vector of computed results for each interval in the same order as the plan. The size of the result vector equals the number of intervals in the plan.

Precondition:

Postcondition:

  • Result vector size equals plan.getIntervals().size()
  • For Presence operation: each result is true if any events exist in the interval, false otherwise
  • For Count operation: each result is the number of events in the corresponding interval
  • For Gather operation: each result is a vector of event times within the interval
  • For Gather_Center operation: each result is a vector of event times relative to interval center

Reimplements: IColumnComputer::compute

Processes each interval in the execution plan and applies the configured operation to events that fall within each interval. The computation handles time frame conversions automatically between the source and destination time frames.

function getSourceDependency

inline virtual std::string getSourceDependency() const override

Returns the name of the data source this computer depends on.

Return: The name of the source dependency as specified in the constructor.

Reimplements: IColumnComputer::getSourceDependency

Used by the table view system to track data dependencies and determine when recomputation is needed.

function getEntityIdStructure

inline virtual EntityIdStructure getEntityIdStructure() const override

Gets the EntityID structure type for this computer.

Return: The EntityID structure type for this computer.

Reimplements: IColumnComputer::getEntityIdStructure

For each of these, we could return the spikes that could be present in the interval.

function compute

virtual std::pair< std::vector< bool >, ColumnEntityIds > compute(
    ExecutionPlan const & plan
) const

Template specialization for bool (Presence operation).

Parameters:

  • plan The execution plan containing interval boundaries and time frame

Exceptions:

Return: Vector of boolean values indicating event presence in each interval

Precondition:

Postcondition:

  • Result vector size equals plan.getIntervals().size()
  • Each result is true if any events exist in the corresponding interval, false otherwise

Reimplements: IColumnComputer::compute

Computes whether any events exist within each interval of the execution plan. Returns a boolean vector where each element indicates the presence (true) or absence (false) of events in the corresponding interval.

This specialization is optimized for detecting event occurrence patterns and is commonly used for binary classification of time intervals based on event presence.

function compute

virtual std::pair< std::vector< int >, ColumnEntityIds > compute(
    ExecutionPlan const & plan
) const

Template specialization for int (Count operation).

Parameters:

  • plan The execution plan containing interval boundaries and time frame

Exceptions:

Return: Vector of integer values representing event counts in each interval

Precondition:

Postcondition:

  • Result vector size equals plan.getIntervals().size()
  • Each result is the number of events in the corresponding interval (>= 0)

Reimplements: IColumnComputer::compute

Computes the number of events within each interval of the execution plan. Returns an integer vector where each element represents the count of events in the corresponding interval.

This specialization is useful for quantifying event frequency and density across different time periods, commonly used in spike rate analysis and event frequency studies.

function compute

virtual std::pair< std::vector< std::vector< float > >, ColumnEntityIds > compute(
    ExecutionPlan const & plan
) const

Template specialization for std::vector (Gather operations).

Parameters:

  • plan The execution plan containing interval boundaries and time frame

Exceptions:

Return: Vector of float vectors, each containing event times within the corresponding interval

Precondition:

Postcondition:

  • Result vector size equals plan.getIntervals().size()
  • For Gather operation: each inner vector contains absolute event times within the interval
  • For Gather_Center operation: each inner vector contains event times relative to interval center
  • Each inner vector is sorted in ascending order

Reimplements: IColumnComputer::compute

Computes the actual event times within each interval of the execution plan. Returns a vector of float vectors where each inner vector contains the event times that occurred within the corresponding interval.

This specialization supports two modes:

This is particularly useful for detailed event analysis, spike timing studies, and when the exact timing of events within intervals is required.

function compute

virtual std::pair< std::vector< bool >, ColumnEntityIds > compute(
    ExecutionPlan const & plan
) const

The core batch computation method.

Parameters:

  • plan The execution plan containing interval boundaries and time frame

Exceptions:

Return: Vector of boolean values indicating event presence in each interval

Precondition:

Postcondition:

  • Result vector size equals plan.getIntervals().size()
  • Each result is true if any events exist in the corresponding interval, false otherwise

Reimplements: IColumnComputer::compute

Computes whether any events exist within each interval of the execution plan. Returns a boolean vector where each element indicates the presence (true) or absence (false) of events in the corresponding interval.

This specialization is optimized for detecting event occurrence patterns and is commonly used for binary classification of time intervals based on event presence.

function compute

virtual std::pair< std::vector< int >, ColumnEntityIds > compute(
    ExecutionPlan const & plan
) const

The core batch computation method.

Parameters:

  • plan The execution plan containing interval boundaries and time frame

Exceptions:

Return: Vector of integer values representing event counts in each interval

Precondition:

Postcondition:

  • Result vector size equals plan.getIntervals().size()
  • Each result is the number of events in the corresponding interval (>= 0)

Reimplements: IColumnComputer::compute

Computes the number of events within each interval of the execution plan. Returns an integer vector where each element represents the count of events in the corresponding interval.

This specialization is useful for quantifying event frequency and density across different time periods, commonly used in spike rate analysis and event frequency studies.

function compute

virtual std::pair< std::vector< std::vector< float > >, ColumnEntityIds > compute(
    ExecutionPlan const & plan
) const

The core batch computation method.

Parameters:

  • plan The execution plan containing interval boundaries and time frame

Exceptions:

Return: Vector of float vectors, each containing event times within the corresponding interval

Precondition:

Postcondition:

  • Result vector size equals plan.getIntervals().size()
  • For Gather operation: each inner vector contains absolute event times within the interval
  • For Gather_Center operation: each inner vector contains event times relative to interval center
  • Each inner vector is sorted in ascending order

Reimplements: IColumnComputer::compute

Computes the actual event times within each interval of the execution plan. Returns a vector of float vectors where each inner vector contains the event times that occurred within the corresponding interval.

This specialization supports two modes:

This is particularly useful for detailed event analysis, spike timing studies, and when the exact timing of events within intervals is required.


Updated on 2026-11-13 at 20:25:40 +0000