Skip to main content

Components for interactive experiments in the alfred3 framework.

Project description

alfred3-interact: Interactive web-experiments in alfred3

GitHub DOI pre-commit Run tests pytest-coverage

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:

  1. Initialize a group spec and the alfred3_interact.MatchMaker during experiment setup
  2. Use a alfred3_interact.WaitingPage for matchmaking inside its wait_for hook method.
  3. Find a group via MatchMaker.match and bind it to the experiment plugins object.
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alfred3_interact-0.4.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alfred3_interact-0.4.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file alfred3_interact-0.4.0.tar.gz.

File metadata

  • Download URL: alfred3_interact-0.4.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for alfred3_interact-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f6e11af8e3df2446f4bc5dd99a87e032b6ec5aa9279c26ccf4bd93b4ac76c418
MD5 b35b75a1b82a0f8538d16c2c1e68a2e7
BLAKE2b-256 70222342a4779ebd72862782a8b61083e6859cf14ba33bd4f42ca2063d53df7a

See more details on using hashes here.

File details

Details for the file alfred3_interact-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for alfred3_interact-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50959c125638b7b8dedc74974117303254ea5325d4f93f7d0680651f0df0779b
MD5 26937e1bb193e76c22f87f503b82ab35
BLAKE2b-256 3701045ef37bfb50bf99cf12e7511b0c9888f98e8b9935dc50269064a68c5fea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page