A staircase procedure to measure psychophysical thresholds. More...
#include <Psycho/Staircase.H>
Classes | |
struct | StaircaseEvent |
Public Member Functions | |
Staircase (OptionManager &mgr, const std::string &descrName="Staircase", const std::string &tagName="Staircase") | |
Constructor. | |
~Staircase () | |
Destructor. | |
virtual void | reset1 () |
Reset to initial conditions. | |
void | getValues (double &value1, double &value2) |
Get parameter values to use for next trial. | |
void | setResponse (const bool response) |
Set the response of the current trial. | |
void | pushEvent (const std::string &msg, const int trial=-1, const double val=0.0, const bool response=false) |
Log an event. | |
Protected Member Functions | |
void | start2 () |
get started | |
void | stop1 () |
get stopped | |
Protected Attributes | |
NModelParam< double > | itsInitial |
initial value | |
NModelParam< double > | itsDelta |
delta in values | |
NModelParam< double > | itsMini |
minimum possible value | |
NModelParam< double > | itsMaxi |
maximum possible value | |
NModelParam< int > | itsNright |
nb of right responses to subtract a delta | |
NModelParam< int > | itsNwrong |
nb of wrong responses to add a delta | |
NModelParam< std::string > | itsFileName |
name of file to save the logs |
A staircase procedure to measure psychophysical thresholds.
This class facilitates the evaluation of a threshold in a psychophysical task.
Definition at line 54 of file Staircase.H.
Staircase::Staircase | ( | OptionManager & | mgr, | |
const std::string & | descrName = "Staircase" , |
|||
const std::string & | tagName = "Staircase" | |||
) |
Constructor.
Definition at line 47 of file Staircase.C.
Staircase::~Staircase | ( | ) |
Destructor.
Definition at line 63 of file Staircase.C.
void Staircase::getValues | ( | double & | value1, | |
double & | value2 | |||
) |
Get parameter values to use for next trial.
This will give you two values, one to use for the first period of the following trial, and one for the second period. The Staircase class will keep in memory what the expected answer should be, which you will give using setResponse().
Definition at line 125 of file Staircase.C.
References pushEvent(), and randomDouble().
void Staircase::pushEvent | ( | const std::string & | msg, | |
const int | trial = -1 , |
|||
const double | val = 0.0 , |
|||
const bool | response = false | |||
) |
Log an event.
This is in the public section just in case someone wants to push external events, but should not be called by the user in normal situations, as it is called internally when getNextValue() is called.
Definition at line 168 of file Staircase.C.
References Timer::get().
Referenced by getValues(), reset1(), setResponse(), and start2().
void Staircase::reset1 | ( | ) | [virtual] |
Reset to initial conditions.
Reimplemented from ModelComponent.
Definition at line 77 of file Staircase.C.
References NModelParam< T >::getVal(), itsInitial, pushEvent(), Timer::reset(), and sformat().
void Staircase::setResponse | ( | const bool | response | ) |
Set the response of the current trial.
The response should be true is the user said nothing-then-something, false otherwise.
Definition at line 144 of file Staircase.C.
References NModelParam< T >::getVal(), itsDelta, itsMaxi, itsMini, itsNright, itsNwrong, and pushEvent().
void Staircase::start2 | ( | ) | [protected, virtual] |
get started
Reimplemented from ModelComponent.
Definition at line 67 of file Staircase.C.
References NModelParam< T >::getVal(), initRandomNumbers(), itsInitial, pushEvent(), Timer::reset(), and sformat().
void Staircase::stop1 | ( | ) | [protected, virtual] |
get stopped
Reimplemented from ModelComponent.
Definition at line 88 of file Staircase.C.
References NModelParam< T >::getVal(), itsFileName, and sec().
NModelParam<double> Staircase::itsDelta [protected] |
NModelParam<std::string> Staircase::itsFileName [protected] |
NModelParam<double> Staircase::itsInitial [protected] |
NModelParam<double> Staircase::itsMaxi [protected] |
NModelParam<double> Staircase::itsMini [protected] |
NModelParam<int> Staircase::itsNright [protected] |
nb of right responses to subtract a delta
Definition at line 93 of file Staircase.H.
Referenced by setResponse().
NModelParam<int> Staircase::itsNwrong [protected] |
nb of wrong responses to add a delta
Definition at line 94 of file Staircase.H.
Referenced by setResponse().