NES

Overview

The NES class is designed to detect button presses from 2 buttons (A and B). It inherits from the Controller class, allowing for manual button manipulation.

An NES object compares the activity in two buttons: A and B. They can be created with one of the constructors, or can be added manually (e.g. if the buttons need to have different window lengths). Many buttons can be added to an NES object; however, for now, it will only compare buttons with the names A and B.

Since it is a child of Controller, NES can hold more than 2 buttons; however, it will only check for presses from A and B.

CSV output

An NES object will automatically create and update a csv during the experiment. There are 12 columns in the csv (<button> indicates that there is a column for each button):

  • frame number: frame at which the button pressed occurred

  • button pressed: the button that was pressed (0 if neither was pressed, 1 if A was pressed, and 2 if B was pressed)

  • percent fired <button>: the percentage of the button that fired, calculated with (total # spikes)/(total # channels)

  • firing rate <button>: the firing rate of the button, calculated with (total # spikes)/(frames)

  • avg FR <button>: the average firing rate over the saved windows

  • SD <button>: standard deviation of the buttons firing rate

  • Z score <button>: z score of the buttons firing rate

Members

class NES : public Controller

Public Functions

NES(float spikePercentThreshold = 0.03, float zScoreThreshold = 3)

Construct a new NES object.

Parameters:
  • spikePercentThresholdfloat percent of channels that spiked threshold (default 0.03)

  • zScoreThresholdfloat Z score threshold (default 3)

NES(const char *csvName, float spikePercentThreshold = 0.03, float zScoreThreshold = 3)

Construct a new NES object.

Parameters:
  • csvNameconst char * full path to csv which holds button data for post-experiment analysis. If the csv doesn’t exist, it will automatically be created.

  • spikePercentThresholdfloat percent of channels that spiked threshold (default 0.03)

  • zScoreThresholdfloat Z score threshold (default 3)

NES(bool maxtwo, int windowLength, const char *AconfigPath, const char *BconfigPath, const char *csvName, float spikePercentThreshold = 0.03, float zScoreThreshold = 3)

Construct a new NES object, creating buttons A and B.

Parameters:
  • maxtwobool indicates if the experiment is running on the maxtwo

  • windowLengthint length of the windows representing the buttons, measured in frames

  • AconfigPathconst char *

  • BconfigPathconst char *

  • csvNameconst char * full path to csv which holds button data for post-experiment analysis. If the csv doesn’t exist, it will automatically be created.

  • spikePercentThresholdfloat percent of channels that spiked threshold (default 0.03)

  • zScoreThresholdfloat Z score threshold (default 3)

~NES()

Destroy the NES object.

int checkButtons(int frameNo)

checks if either button A or button B has been pressed

Parameters:

frameNo

Returns:

int code: -1: button A or B has not been initialized 0: neither button A or B was pressed 1: button A was pressed 2: button B was pressed