Utilities to interface with iMotions from oTree
Project description
iomotions
This (unofficial) project provides useful utilities for interfacing with iMotions software from third party applications.
Installation
To use this module add the following line to your requirements.txt file:
iomotions>=0.1.0
Then install your requirements as usual.
pip3 install -r requirements.txt
iMotions Setup
IMPORTANT: In order for the following functions to work you must ensure that in Global Preferences > API > Event Receiving both Enable event reception and Use TCP are checked.
API
iomotions module
start_scene_recording(ip_address, scene_name, scene_description = '')
Instruct the iMotions instance running at the designated IP address to start recording a scene with the prescribed name and optional description.
end_scene_recording(ip_address, scene_name)
Instruct the iMotions instance running at the designated IP address to end its recording of the named scene.
class EventEmitter
Helper class that stores connection information and exposes a simpler messaging API. This class is not well supported but can be used to send messages over UDP in place of the default TCP behavior of the above APIs.
iomotions.otree module
iomotions includes API for integrating with oTree out of the box. The provided iomotions.otree.pages.ScenePage class extends oTree's Page to record the page as a Scene in iMotions.
class ScenePage(otree.api.Page)
The ScenePage class should be subclassed in place of oTree's Page when you want iMotions to record the page. By using a ScenePage iMotions records a scene starting when the page begins loading and ending when the page transitions. The scene name is derived from the class name by default the current round number.
scene_name
If you would like to provide an alternative scene identifier than the class name, simply override the scene_name property with the string you would like to use instead.
scene_description
When provided, the description will be included with the scene marker in iMotions.
Full Example
# <app-name>/__init__.py
from iomotions.otree.pages import ScenePage
...
class QuizPage(ScenePage):
# optional, would default to QuizPage<round_number>
scene_name = 'Question'
# optional
scene_description = 'General knowledge question'
Note: The current round number will also be appended to the scene name to account for pages that appear in multi-round apps.
Note: For simplicity to the user the ScenePage class extends private functions from Page. The primary motivation for this is to avoid unexpected breakage from overriding before_next_page without calling ScenePage's implementation. Since the overridden methods are private it's possible that a future version of oTree will result in changes that break this API.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iomotions-0.1.0.tar.gz.
File metadata
- Download URL: iomotions-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bc08b840df9d0fb47bc45cbc6283afd85c846711c803bdaf73009a6c9b50a97
|
|
| MD5 |
37a87417786bdf6582b5b5fce9fdeb47
|
|
| BLAKE2b-256 |
e0c08b554607d899a71e9d37493580dba905c71580434d16f7a926501572f449
|
File details
Details for the file iomotions-0.1.0-py3-none-any.whl.
File metadata
- Download URL: iomotions-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
964427c6e90ee3692834552c855bfd6f8a4efa5e1e44a62f080fdeef61b85092
|
|
| MD5 |
487c4e5ec562586396cb1189c779eda9
|
|
| BLAKE2b-256 |
5f139d22721fbf6d44363d28ff706c8e9e18a7912cc0ab237ed3732d39c7ed91
|