sweetbean.variable
CodeVariable
Bases: Variable
A variable to access JavaScript code.
Source code in sweetbean/variable/__init__.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
|
__init__(name, value)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
the name of the variable |
required | |
value
|
the initial value of the variable |
required |
Source code in sweetbean/variable/__init__.py
83 84 85 86 87 88 89 90 |
|
DataVariable
Bases: Variable
A data variable for jsPsych to access data of previous trials.
Source code in sweetbean/variable/__init__.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
__init__(name, window)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
the name of the variable |
required | |
window
|
the window of the data |
required |
Source code in sweetbean/variable/__init__.py
33 34 35 36 37 38 39 40 41 42 |
|
FunctionVariable
Bases: Variable
A variable that is the result of a function. Examples: >>> def add(a, b): ... return a + b >>> FunctionVariable('a', add, [1, 2]).to_js() ((a,b) => {return a+b})(1, 2)
Source code in sweetbean/variable/__init__.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
|
__init__(name, fct, args)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
the name of the variable |
required | |
fct
|
the function |
required | |
args
|
the arguments of the function |
required |
Source code in sweetbean/variable/__init__.py
61 62 63 64 65 66 67 68 69 70 |
|
SharedVariable
A variable that can be shared between different stimuli.
Source code in sweetbean/variable/__init__.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
__init__(name, value)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
the name of the variable |
required | |
value
|
the initial value of the variable |
required |
Source code in sweetbean/variable/__init__.py
104 105 106 107 108 109 110 111 |
|
SideEffect
Source code in sweetbean/variable/__init__.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
__init__(set_variable, get_variable)
A side effect that can set variables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
set_variable
|
the variable to set (often a SharedVariable) |
required | |
get_variable
|
the variable to get (e.g, the variable the set variable should be set to) |
required |
Source code in sweetbean/variable/__init__.py
121 122 123 124 125 126 127 128 129 130 |
|
TimelineVariable
Bases: Variable
A timeline variable for jsPsych.
Source code in sweetbean/variable/__init__.py
19 20 21 22 23 24 25 |
|
Variable
Bases: ABC
A base class for variables.
Source code in sweetbean/variable/__init__.py
6 7 8 9 10 11 12 13 14 15 16 |
|