Components for interactive experiments in the alfred3 framework.
Project description
alfred3-interact: Interactive web-experiments in alfred3
Alfred3-interact is a plugin for alfred3. It allows for the creation of interactive web experiments, predominantly in the social sciences. As prerequisites, you need to have Python 3.7 or newer and alfred3 v2.2.0 or newer installed.
Installation
$ pip3 install alfred3_interact
Documentation
Documentation for alfred3_interact is available here: Link to docs
Quick example
Below is an example script.py
for creating an experiment with an
asynchronous exchange of data between participants matching:
- Initialize a group spec and the
alfred3_interact.MatchMaker
during experiment setup - Use a
alfred3_interact.WaitingPage
for matchmaking inside itswait_for
hook method. - Find a group via
MatchMaker.match
and bind it to the experiment plugins object. - Now the group object is available in sections, pages, and elements through the experiment session object. You can use it to access data from other participants in the same group.
# script.py
import alfred3 as al
import alfred3_interact as ali
exp = al.Experiment()
@exp.setup
def setup(exp):
spec = ali.SequentialSpec("role1", "role2", nslots = 10, name="mygroup")
exp.plugins.mm = ali.MatchMaker(spec, exp=exp)
@exp.member
class Match(ali.WaitingPage):
def wait_for(self):
group = self.exp.plugins.mm.match()
self.exp.plugins.group = group
return True
@exp.member
class Success(al.Page):
title = "Match successful"
def on_exp_access(self):
group = self.exp.plugins.group
txt = f"You have successfully matched to role: {group.me.role}"
self += al.Text(txt, align="center")
if __name__ == "__main__":
exp.run()
The demo experiment can be started by executing the following command
from the experiment directory (i.e. the directory in which you placed
the script.py
):
$ alfred3 run
Citation
Alfred3-interact was developed for research at the department for economic and social psychology, Georg-August-University Göttingen. If you are publishing research conducted using alfred3, the following citation is required:
Brachem, J. & Treffenstädt, C. (2021). Alfred3-interact - Interactive web experiments in alfred3. (Version x.x.x). Göttingen, Germany: https://doi.org/10.5281/zenodo.1437219
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file alfred3_interact-0.3.1.tar.gz
.
File metadata
- Download URL: alfred3_interact-0.3.1.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3284bf1315d6871d11a11593cebf5d8352cc8ca2211d8b08dc9199ae21386b0d |
|
MD5 | 2c3d495f95e79f4b28d3e41f847db0f2 |
|
BLAKE2b-256 | 56cea20ceed13159afb32694678b9cfc1a1f9daa211bcffd499f8c174621c4d8 |
File details
Details for the file alfred3_interact-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: alfred3_interact-0.3.1-py3-none-any.whl
- Upload date:
- Size: 44.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae5579aad03d42f9daf3b80c1880d7e42591e5f39f47d9a4ba039bfc6a34b2ec |
|
MD5 | 556a4256e16dbd9c2eb778a547904cba |
|
BLAKE2b-256 | 3809f863b1f34564ed45f49f027510583b94baf853c99cb5d9d54776f33c8441 |