/app-fit-psych-func

app for brainlife.io that fits psychometric functions

Primary LanguagePythonMIT LicenseMIT

Fits a psychometric function to an individual subject's trial-wise responses using negative log likelihood (nLL)

Right now the function is forced to fit a Weibull, will add more options via a new input argument in the future

  • objective function: Weibull
  • cost function: nLL

inputs:

  1. file {.csv}: file containing trial-wise subject responses (should follow tidy-data format and has to be named 'datafile.csv' should have the following column labels {'xvals','trialsIdx','conditions','accuracy'} in no specific order where: 'trialsIdx' is the trial indexes eg. 1...nTrials 'conditions'is a column with condition labels could be numerial or string or both 'accuracy' is the observer's correct (1) or incorrect (0) responses across trials
trialsIdx xvals conditions accuracy
1 0.05 valid 0
2 0.2 neutral 1
3 0.85 invalid 1
  1. chance {float}: what is chance performance in your task? example: if a detection task then there are 2 response alternatives (yes/no) so enter 0.5, if 4 response alternatives enter 0.25

  2. plot {bool}: if True plots the fits / False = no plots


output: output.npy file in the our_dir containing:

  1. % correct per condition
  2. best fit functions per condition
  3. best fit parameters

CREATED BY: Antonio Fernandez (af) [Oct. 20, 2022] 
last edited: Oct. 28, 2020 af