ADDM.cpp
Loading...
Searching...
No Matches
util.cpp File Reference
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <set>
#include <cmath>
#include <functional>
#include <vector>
#include "util.h"
#include "addm.h"
Include dependency graph for util.cpp:

Functions

std::map< int, std::vector< aDDMTrial > > loadDataFromSingleCSV (std::string filename)
 Load experimental data from a single CSV file. Format expected is:
 
std::map< int, std::vector< aDDMTrial > > loadDataFromCSV (std::string expDataFilename, std::string fixDataFilename)
 Load experimental data from two CSV files: an experimental data file and a fixations file. Format expected for experimental data file:
 
FixationData getEmpiricalDistributions (std::map< int, std::vector< aDDMTrial > > data, int timeStep, int maxFixTime, int numFixDists, std::vector< float > valueDiffs, std::vector< int > subjectIDs, bool useOddTrials, bool useEvenTrials, bool useCisTrials, bool useTransTrials)
 Create empirical distributions fro the data ot be used when generating model simulations.
 

Variables

vector< string > validComputeMethods = {"basic", "thread"}
 

Function Documentation

◆ getEmpiricalDistributions()

FixationData getEmpiricalDistributions ( std::map< int, std::vector< aDDMTrial > > data,
int timeStep = 10,
int maxFixTime = 3000,
int numFixDists = 3,
std::vector< float > valueDiffs = {-3,-2,-1, 0, 1, 2, 3},
std::vector< int > subjectIDs = {},
bool useOddTrials = true,
bool useEvenTrials = true,
bool useCisTrials = true,
bool useTransTrials = true )

Create empirical distributions fro the data ot be used when generating model simulations.

Parameters
dataA mapping of subject IDs to vectors of each subject's corresponding aDDMTrials.
timeStepMinimum duration of a fixation to be considered in milliseconds.
maxFixTimeMaximum duration of a fixation to be considered, in milliseconds.
numFixDistsInteger indicating the number of fixation types to use in the fixation distributions. I.e. if set to 3, then three separate fixation typyes will be used, corresponding to the first, second, and third fixation in each trial.
valueDiffsList of integers corresponding to the available value differences between item.
subjectIDsList of subject IDs to consider in the empirical data. If left empty, all subjectIDs will be used.
useOddTrialsBoolean indicating whether or not to use odd trials when creating the distributions.
useEvenTrialsBoolean indicating whether or not to use even trials when creating the distributions.
useCisTrialsBoolean indiciating whether or not to use cis trials when creating the distributions. Cis trials are defined as trials in which both items have either positive or negative values.
useTransTrialsBoolean indicating whether or not to use trans trials when creating the distributions. Trans trials are defined as trials in which one item has a positive value and one item has a negative value.
Returns
FixationData object serving as a record of empirical fixation distributions.

◆ loadDataFromCSV()

std::map< int, std::vector< aDDMTrial > > loadDataFromCSV ( std::string expDataFilename,
std::string fixDataFilename )

Load experimental data from two CSV files: an experimental data file and a fixations file. Format expected for experimental data file:

parcode, trial, rt, choice, valueLeft, valueRight

Format expected for fixations file:

parcode, trial, fixItem, fixTime

Parameters
expDataFilenameName of the experimental data trial.
fixDataFilenameName of the fixations file.
Returns
std::map<int, std::vector<aDDMTrial>> mapping subject IDs to each subject's corresponding aDDMTrials.

◆ loadDataFromSingleCSV()

std::map< int, std::vector< aDDMTrial > > loadDataFromSingleCSV ( std::string filename)

Load experimental data from a single CSV file. Format expected is:

trial, choice, rt, valueLeft, valueRight, fixItem, fixTime

Parameters
filenameName of the CSV file.
Returns
std::map<int, std::vector<aDDMTrial>> mapping subject IDs to each subject's corresponding aDDMTrials.

Variable Documentation

◆ validComputeMethods

vector<string> validComputeMethods = {"basic", "thread"}