Package: aepsych
AEPsychAEPsych is a framework and library for adaptive experimetation in psychophysics and related domains.InstallationAEPsychonly supports python 3.8+. We recommend installingAEPsychunder a virtual environment likeAnaconda.
Once you've created a virtual environment forAEPsychand activated it, you can installAEPsychusing pip:pip install aepsychIf you're a developer or want to use the latest features, you can install from GitHub using:git clone https://github.com/facebookresearch/aepsych.git
cd aepsych
pip install -r requirements.txt
pip install -e .UsageSee the code exampleshere.The canonical way of using AEPsych is to launch it in server mode (you can runaepsych_server--help to see additional arguments):aepsych_server --port 5555 --ip 0.0.0.0 database --db mydatabase.dbThe server accepts messages over either a unix socket orZMQ, and
all messages are formatted usingJSON. All messages
have the following format:{
     "type":<TYPE>,
     "version":<VERSION>,
     "message":<MESSAGE>,
}Version can be omitted, in which case we default to the oldest / unversioned handler for this message
type. There are five message types:setup,resume,ask,tellandexit.SetupThesetupmessage prepares the server for making suggestions and accepting data. The setup
message can be formatted as either INI or a python dict (similar to JSON) format, and an example
for psychometric threshold estimation is given inconfigs/single_lse_example.ini. It looks like this:{
    "type":"setup",
    "version":"0.01",
    "message":{"config_str":<PASTED CONFIG STRING>}
}After receiving a setup message, the server responds with a strategy index that can be used
to resume this setup (for example, for interleaving multiple experiments).ResumeTheresumemessage tells the server to resume a strategy from earlier in the same run. It looks like this:{
    "type":"resume",
    "version":"0.01",
    "message":{"strat_id":"0"}
}After receiving a resume message, the server responds with the strategy index resumed.AskTheaskmessage queries the server for the next trial configuration. It looks like this:{
    "type":"ask",
    "version":"0.01",
    "message":""
}After receiving an ask message, the server responds with a configuration in JSON format, for example{"frequency":100, "intensity":0.8}TellThetellmessage updates the server with the outcome for a trial configuration. Note that thetelldoes not need to match with a previouslyask'd trial. For example, if you are interleaving
AEPsych runs with a classical staircase, you can still feed AEPsych with the staircase data. A message
looks like this:{
    "type":"tell",
    "version":"0.01",
    "message":{
        "config":{
                "frequency":100,
                "intensity":0.8
            },
        "outcome":"1",
    }
}ExitTheexitmessage tells the server to close the socket connection, write strats into the database and terminate current session.
The message is:{
    "type":"exit",
}The server closes the connection.Data export and visualizationThe data is logged to a SQLite database on disk (by default,databases/default.db). The database
has one table containing all experiment sessions that were run. Then, for each experiment there
is a table containing all messages sent and received by the server, capable of supporting a
full replay of the experiment from the server's perspective. This table can be summarized
into a data frame output (docs forthcoming) and used to visualize data (docs forthcoming).ContributingSee theCONTRIBUTINGfile for how to help out.LicenseAEPsych licensed CC-BY-NC 4.0, as found in theLICENSEfile.CitingThe AEPsych paper is currently under review. In the meanwhile, you can cite ourpreprint:Owen, L., Browder, J., Letham, B., Stocek, G., Tymms, C., & Shvartsman, M. (2021). Adaptive Nonparametric Psychophysics. http://arxiv.org/abs/2104.09549