From Version 13.0 onwards, Pack&Go now features an API that enables scientists to retrieve information about study participants, facilitating dynamic choices within the experiment flow. This API is available for MATLAB, Python, and LabMaestro experiments (version 11 and later).
Downloading and Using the API in your Experiment
To prepare your experiments, mock versions of the API can be downloaded.
End Experiment:
Description
Use this function to end the experiment with a defined exit code. This function enables alternative return paths based on various conditions within your experiments. For more information on alternate return paths, see this page.
Input
-
exitcode (String). The exit code returned to Pack&Go. If this exit code is tied to a return path, the participant will be redirected to this URL.
Syntax
Color Depth:
Description
Use this function to obtain the color depth of the participant’s monitor.
Output
-
result (Integer). The color depth of the participant’s monitor. If the server cannot be reached, the result will be equal to 0.
Syntax
Frames Dropped:
Description
Use this function to get the number of dropped frames from the beginning of the experiment.
Output
-
result (Integer). The number of dropped frames. If the server cannot be reached, the result will be equal to 0.
Syntax
Height (cm):
Description
Use this function to get the participant monitor’s height in centimeters.
Output
-
result (Real). The monitor height in centimeters. If the server cannot be reached, the result will be equal to 0.
Syntax
Height (px):
Description
Use this function to get the participant monitor’s height in pixels.
Output
-
result (Real). The monitor width in pixels. If the server cannot be reached, the result will be equal to 0.
Syntax
Last Frame Delay:
Description
Use this function to get the delay between the last two frames.
Output
-
result (Real). The frame delay in seconds. If the server cannot be reached, the result will be equal to 0.
Syntax
Network Latency:
Description
Use this function to get the current network latency for your participant. This function returns the latency at the precise moment the function is called.
Output
-
result (Real). The network latency in seconds. If the server cannot be reached, the result will be equal to 0.
Syntax
Orientation:
Description
Use this function to retrieve the orientation of the participant’s display, which can be either “Landscape” or “Portrait”.
Output
-
result (String). The display orientation. The returned values can either be “Landscape” or “Portrait”. If the server cannot be reached, the result will be equal to 0.
Syntax
Pixels per Inch (ppi):
Description
Use this function to get the number of pixels per inch of the participant’s display.
Output
-
result (Real). The number of pixels per inch. If the server cannot be reached, the result will be equal to 0.
Syntax
Video Height (cm):
Description
Use this function to get the height of the Pack&Go experiment video feed on the participant’s monitor, in centimeters.
Output
-
result (Real). The height of the video feed, in centimeters. If the server cannot be reached, the result will be equal to 0.
Syntax
Video Width (cm):
Description
Use this function to get the width of the Pack&Go experiment video feed on the participant’s monitor, in centimeters.
Output
-
result (Real). The width of the video feed, in centimeters. If the server cannot be reached, the result will be equal to 0.
Syntax
Width (cm):
Description
Use this function to get the participant monitor’s width in centimeters.
Output
-
result (Real). The monitor width in centimeters. If the server cannot be reached, the result will be equal to 0.
Syntax
Width (px):
Description
Use this function to get the participant monitor’s width in pixels.
Output
-
result (Real). The monitor width in pixels. If the server cannot be reached, the result will be equal to 0.
Syntax
API Demo
The following code block demonstrates an experiment that runs for approximately 2 minutes, utilizing the API to retrieve information on the user’s display and network connection every second and print it to the console.