Skip to content

Commit 9e9464a

Browse files
committed
example
1 parent c77b927 commit 9e9464a

23 files changed

+3694
-15
lines changed

Assets/UXF/Examples/1_Basic/BasicExample.unity

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9287,17 +9287,18 @@ MonoBehaviour:
92879287
m_HorizontalOverflow: 0
92889288
m_VerticalOverflow: 0
92899289
m_LineSpacing: 1
9290-
m_Text: "In this example, a script BasicExampleScript has been written and attached
9291-
to the MyExample GameObject.\n\nIt contains 3 methods:\n\nGenerateExperiment -
9292-
after the Session has been initialised, we generate the blocks and trials we want
9293-
in our experiment with any associated settings.\n\nPresentStimulus - when a trial
9294-
begins, this mimics some stimulus presentation behaviour (in this case logging
9295-
text to the console). We also then set a timer for when the trial should end and
9296-
the next one should begin.\n\nUpdate - this is the default Unity MonoBehaviour
9297-
function that runs each frame. Here we just check if it is time for us to end
9298-
the trial and start the next one. \n\nNotice, in the inspector of our Session
9299-
component (attached to the [UXF_Rig] GameObject), several Events have been created
9300-
which call functions from our BasicExampleScript component."
9290+
m_Text: "In this example, a pace shuttle will fly upwards, depending on an independant
9291+
variable called thrust. We want to measure the altitude of flight. This is a non-interactive
9292+
experiment, just for demonstration purposes. \nA script Example_BasicExampleScript
9293+
has been written and attached to the MyExampleExperiment GameObject, which controls
9294+
the experiment.\n\nIt contains several methods:\n\nGenerateExperiment - after
9295+
the Session has been initialised, we generate the blocks and trials we want in
9296+
our experiment with any associated settings.\n\nPresentStimulus - when a trial
9297+
begins, we can setup the scene using the settings from our trials (i.e. thrust).
9298+
We also then use Invoke to end the trial after a fixed time.\n\nNotice, in the
9299+
inspector of our Session component (attached to the [UXF_Rig] GameObject), in
9300+
the Events tab, several Events have been created which call functions from ourExample_BasicExampleScript
9301+
component."
93019302
--- !u!222 &1335906556
93029303
CanvasRenderer:
93039304
m_ObjectHideFlags: 0

Assets/UXF/Examples/1_Basic/Example_BasicExampleScript.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ public void PresentStimulus(Trial trial)
8484

8585
void EndAndPrepare()
8686
{
87-
// reset the shuttle's position and thrust
88-
spaceShuttle.transform.localPosition = Vector3.zero;
89-
spaceShuttleEngine.thrust = 0f;
90-
9187
// record the altitude of the space shuttle
9288
float altitude = spaceShuttle.transform.position.y;
9389
Debug.LogFormat("The space shuttle got an altitude of {0}!", altitude);
@@ -99,6 +95,10 @@ void EndAndPrepare()
9995
Debug.Log("Ending trial");
10096
Session.instance.CurrentTrial.End();
10197

98+
// reset the shuttle's position and thrust
99+
spaceShuttle.transform.localPosition = Vector3.zero;
100+
spaceShuttleEngine.thrust = 0f;
101+
102102
// if last trial, end session.
103103
if (Session.instance.CurrentTrial == Session.instance.LastTrial)
104104
{
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
timestamp,log_type,message
2+
7.323537,Log,Running trial 1
3+
7.323537,Log,The 'thrust' for this trial is: 0.6519734
4+
12.33049,Log,The space shuttle got an altitude of 5.275034!
5+
12.33049,Log,Ending trial
6+
14.33582,Log,Running trial 2
7+
14.33582,Log,The 'thrust' for this trial is: 1.55982
8+
19.32296,Log,The space shuttle got an altitude of 9.779029!
9+
19.32296,Log,Ending trial
10+
21.32841,Log,Running trial 3
11+
21.32841,Log,The 'thrust' for this trial is: 1.70831
12+
26.33214,Log,The space shuttle got an altitude of 10.54792!
13+
26.33214,Log,Ending trial
14+
28.32051,Log,Running trial 4
15+
28.32051,Log,The 'thrust' for this trial is: 1.00294
16+
33.32465,Log,The space shuttle got an altitude of 7.018851!
17+
33.32465,Log,Ending trial
18+
35.32959,Log,Running trial 5
19+
35.32959,Log,The 'thrust' for this trial is: 1.724325
20+
40.33425,Log,The space shuttle got an altitude of 10.62966!
21+
40.33425,Log,Ending trial
22+
42.32199,Log,Running trial 6
23+
42.32199,Log,The 'thrust' for this trial is: 1.105075
24+
47.32689,Log,The space shuttle got an altitude of 7.530792!
25+
47.32689,Log,Ending trial
26+
49.33183,Log,Running trial 7
27+
49.33183,Log,The 'thrust' for this trial is: 0.7706299
28+
54.33543,Log,The space shuttle got an altitude of 5.855925!
29+
54.33543,Log,Ending trial
30+
56.32363,Log,Running trial 8
31+
56.32363,Log,The 'thrust' for this trial is: 0.5705822
32+
61.32783,Log,The space shuttle got an altitude of 4.85531!
33+
61.32783,Log,Ending trial
34+
63.33342,Log,Running trial 9
35+
63.33342,Log,The 'thrust' for this trial is: 0.9920511
36+
68.32023,Log,The space shuttle got an altitude of 6.947166!
37+
68.32023,Log,Ending trial
38+
70.32543,Log,Running trial 10
39+
70.32543,Log,The 'thrust' for this trial is: 1.582997
40+
75.32957,Log,The space shuttle got an altitude of 9.921541!
41+
75.32957,Log,Ending trial
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
age,gender
2+
21,Male
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"n_trials": 10
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
time,pos_x,pos_y,pos_z,rot_x,rot_y,rot_z
2+
7.323537,0,2.0106,0,0,270,90
3+
7.359992,0,2.0344,0,0,270,90
4+
7.377244,0,2.0456,0,0,270,90
5+
7.39425,0,2.0567,0,0,270,90
6+
7.410542,0,2.0674,0,0,270,90
7+
7.427391,0,2.0783,0,0,270,90
8+
7.444257,0,2.0893,0,0,270,90
9+
7.461264,0,2.1004,0,0,270,90
10+
7.478268,0,2.1115,0,0,270,90
11+
7.495268,0,2.1226,0,0,270,90
12+
7.511637,0,2.1333,0,0,270,90
13+
7.528487,0,2.1443,0,0,270,90
14+
7.545335,0,2.1552,0,0,270,90
15+
7.562284,0,2.1663,0,0,270,90
16+
7.579289,0,2.1774,0,0,270,90
17+
7.595882,0,2.1882,0,0,270,90
18+
7.612731,0,2.1992,0,0,270,90
19+
7.629581,0,2.2102,0,0,270,90
20+
7.64643,0,2.2211,0,0,270,90
21+
7.663307,0,2.2322,0,0,270,90
22+
7.680312,0,2.2432,0,0,270,90
23+
7.697322,0,2.2543,0,0,270,90
24+
7.714322,0,2.2654,0,0,270,90
25+
7.730676,0,2.2761,0,0,270,90
26+
7.747525,0,2.2871,0,0,270,90
27+
7.764375,0,2.298,0,0,270,90
28+
7.781337,0,2.3091,0,0,270,90
29+
7.798338,0,2.3202,0,0,270,90
30+
7.815343,0,2.3313,0,0,270,90
31+
7.83177,0,2.342,0,0,270,90
32+
7.849353,0,2.3535,0,0,270,90
33+
7.866355,0,2.3645,0,0,270,90
34+
7.882358,0,2.375,0,0,270,90
35+
7.899168,0,2.3859,0,0,270,90
36+
7.916373,0,2.3971,0,0,270,90
37+
7.932866,0,2.4079,0,0,270,90
38+
7.950377,0,2.4193,0,0,270,90
39+
7.96738,0,2.4304,0,0,270,90
40+
7.983414,0,2.4409,0,0,270,90
41+
8.000397,0,2.4519,0,0,270,90
42+
8.017392,0,2.463,0,0,270,90
43+
8.034392,0,2.4741,0,0,270,90
44+
8.051396,0,2.4852,0,0,270,90
45+
8.068402,0,2.4963,0,0,270,90
46+
8.084508,0,2.5068,0,0,270,90
47+
8.101408,0,2.5178,0,0,270,90
48+
8.118415,0,2.5289,0,0,270,90
49+
8.135424,0,2.54,0,0,270,90
50+
8.152417,0,2.551,0,0,270,90
51+
8.168753,0,2.5617,0,0,270,90
52+
8.185602,0,2.5727,0,0,270,90
53+
8.202452,0,2.5837,0,0,270,90
54+
8.219432,0,2.5947,0,0,270,90
55+
8.236444,0,2.6058,0,0,270,90
56+
8.253439,0,2.6169,0,0,270,90
57+
8.270452,0,2.628,0,0,270,90
58+
8.286697,0,2.6386,0,0,270,90
59+
8.303548,0,2.6496,0,0,270,90
60+
8.320456,0,2.6606,0,0,270,90
61+
8.337461,0,2.6717,0,0,270,90
62+
8.354468,0,2.6828,0,0,270,90
63+
8.371467,0,2.6939,0,0,270,90
64+
8.387792,0,2.7045,0,0,270,90
65+
8.404642,0,2.7155,0,0,270,90
66+
8.421491,0,2.7265,0,0,270,90
67+
8.438484,0,2.7375,0,0,270,90
68+
8.455189,0,2.7484,0,0,270,90
69+
8.47249,0,2.7597,0,0,270,90
70+
8.489496,0,2.7708,0,0,270,90
71+
8.505735,0,2.7814,0,0,270,90
72+
8.522585,0,2.7924,0,0,270,90
73+
8.539506,0,2.8034,0,0,270,90
74+
8.556305,0,2.8144,0,0,270,90
75+
8.57352,0,2.8256,0,0,270,90
76+
8.59053,0,2.8367,0,0,270,90
77+
8.606833,0,2.8473,0,0,270,90
78+
8.623682,0,2.8583,0,0,270,90
79+
8.64054,0,2.8693,0,0,270,90
80+
8.657535,0,2.8804,0,0,270,90
81+
8.674539,0,2.8914,0,0,270,90
82+
8.691547,0,2.9025,0,0,270,90
83+
8.707928,0,2.9132,0,0,270,90
84+
8.724775,0,2.9242,0,0,270,90
85+
8.741647,0,2.9352,0,0,270,90
86+
8.758559,0,2.9462,0,0,270,90
87+
8.775324,0,2.9572,0,0,270,90
88+
8.792567,0,2.9684,0,0,270,90
89+
8.80957,0,2.9795,0,0,270,90
90+
8.826572,0,2.9906,0,0,270,90
91+
8.84272,0,3.0011,0,0,270,90
92+
8.859582,0,3.0121,0,0,270,90
93+
8.876418,0,3.0231,0,0,270,90
94+
8.893267,0,3.0341,0,0,270,90
95+
8.910118,0,3.045,0,0,270,90
96+
8.926966,0,3.056,0,0,270,90
97+
8.943815,0,3.067,0,0,270,90
98+
8.960665,0,3.078,0,0,270,90
99+
8.977606,0,3.089,0,0,270,90
100+
8.994362,0,3.1,0,0,270,90
101+
9.011211,0,3.111,0,0,270,90
102+
9.02806,0,3.1219,0,0,270,90
103+
9.044909,0,3.1329,0,0,270,90
104+
9.061759,0,3.1439,0,0,270,90
105+
9.078642,0,3.1549,0,0,270,90
106+
9.095637,0,3.166,0,0,270,90
107+
9.112638,0,3.1771,0,0,270,90
108+
9.129643,0,3.1882,0,0,270,90
109+
9.146004,0,3.1988,0,0,270,90
110+
9.163649,0,3.2103,0,0,270,90
111+
9.179703,0,3.2208,0,0,270,90
112+
9.196552,0,3.2318,0,0,270,90
113+
9.21366,0,3.2429,0,0,270,90
114+
9.230676,0,3.254,0,0,270,90
115+
9.247671,0,3.2651,0,0,270,90
116+
9.263949,0,3.2757,0,0,270,90
117+
9.280798,0,3.2867,0,0,270,90
118+
9.297685,0,3.2977,0,0,270,90
119+
9.314688,0,3.3088,0,0,270,90
120+
9.331688,0,3.3199,0,0,270,90
121+
9.348693,0,3.331,0,0,270,90
122+
9.365695,0,3.3421,0,0,270,90
123+
9.381893,0,3.3526,0,0,270,90
124+
9.398742,0,3.3636,0,0,270,90
125+
9.415705,0,3.3747,0,0,270,90
126+
9.43271,0,3.3858,0,0,270,90
127+
9.449718,0,3.3968,0,0,270,90
128+
9.466139,0,3.4076,0,0,270,90
129+
9.482988,0,3.4185,0,0,270,90
130+
9.499837,0,3.4295,0,0,270,90
131+
9.516729,0,3.4405,0,0,270,90
132+
9.533737,0,3.4516,0,0,270,90
133+
9.550742,0,3.4627,0,0,270,90
134+
9.567233,0,3.4735,0,0,270,90
135+
9.584083,0,3.4844,0,0,270,90
136+
9.600932,0,3.4954,0,0,270,90
137+
9.617781,0,3.5064,0,0,270,90
138+
9.634754,0,3.5175,0,0,270,90
139+
9.651761,0,3.5286,0,0,270,90
140+
9.668767,0,3.5397,0,0,270,90
141+
9.685772,0,3.5507,0,0,270,90
142+
9.702026,0,3.5613,0,0,270,90
143+
9.718877,0,3.5723,0,0,270,90
144+
9.735779,0,3.5833,0,0,270,90
145+
9.752782,0,3.5944,0,0,270,90
146+
9.769792,0,3.6055,0,0,270,90
147+
9.786797,0,3.6166,0,0,270,90
148+
9.803121,0,3.6273,0,0,270,90
149+
9.819971,0,3.6382,0,0,270,90
150+
9.836821,0,3.6492,0,0,270,90
151+
9.853806,0,3.6603,0,0,270,90
152+
9.870811,0,3.6714,0,0,270,90
153+
9.887815,0,3.6825,0,0,270,90
154+
9.904815,0,3.6936,0,0,270,90
155+
9.921065,0,3.7042,0,0,270,90
156+
9.937915,0,3.7151,0,0,270,90
157+
9.954827,0,3.7262,0,0,270,90
158+
9.971839,0,3.7373,0,0,270,90
159+
9.988461,0,3.7481,0,0,270,90
160+
10.00531,0,3.7591,0,0,270,90
161+
10.02216,0,3.7701,0,0,270,90
162+
10.03901,0,3.781,0,0,270,90
163+
10.05586,0,3.792,0,0,270,90
164+
10.07285,0,3.8031,0,0,270,90
165+
10.08986,0,3.8142,0,0,270,90
166+
10.10687,0,3.8253,0,0,270,90
167+
10.12387,0,3.8364,0,0,270,90
168+
10.1401,0,3.847,0,0,270,90
169+
10.15695,0,3.8579,0,0,270,90
170+
10.17388,0,3.869,0,0,270,90
171+
10.19088,0,3.8801,0,0,270,90
172+
10.2075,0,3.8909,0,0,270,90
173+
10.2249,0,3.9022,0,0,270,90
174+
10.2412,0,3.9129,0,0,270,90
175+
10.25805,0,3.9239,0,0,270,90
176+
10.27491,0,3.9349,0,0,270,90
177+
10.29191,0,3.9459,0,0,270,90
178+
10.30892,0,3.957,0,0,270,90
179+
10.32592,0,3.9681,0,0,270,90
180+
10.34229,0,3.9788,0,0,270,90
181+
10.35914,0,3.9898,0,0,270,90
182+
10.37599,0,4.0008,0,0,270,90
183+
10.39295,0,4.0118,0,0,270,90
184+
10.40969,0,4.0227,0,0,270,90
185+
10.42654,0,4.0337,0,0,270,90
186+
10.44339,0,4.0447,0,0,270,90
187+
10.46095,0,4.0561,0,0,270,90
188+
10.47709,0,4.0667,0,0,270,90
189+
10.49395,0,4.0777,0,0,270,90
190+
10.51096,0,4.0887,0,0,270,90
191+
10.52796,0,4.0998,0,0,270,90
192+
10.54496,0,4.1109,0,0,270,90
193+
10.56196,0,4.122,0,0,270,90
194+
10.57897,0,4.1331,0,0,270,90
195+
10.59503,0,4.1436,0,0,270,90
196+
10.61198,0,4.1546,0,0,270,90
197+
10.62898,0,4.1657,0,0,270,90
198+
10.64598,0,4.1768,0,0,270,90
199+
10.66243,0,4.1875,0,0,270,90
200+
10.67928,0,4.1985,0,0,270,90
201+
10.69613,0,4.2095,0,0,270,90
202+
10.713,0,4.2205,0,0,270,90
203+
10.73001,0,4.2316,0,0,270,90
204+
10.74701,0,4.2426,0,0,270,90
205+
10.76402,0,4.2537,0,0,270,90
206+
10.78102,0,4.2648,0,0,270,90
207+
10.79722,0,4.2754,0,0,270,90
208+
10.81407,0,4.2864,0,0,270,90
209+
10.83103,0,4.2974,0,0,270,90
210+
10.84803,0,4.3085,0,0,270,90
211+
10.86504,0,4.3196,0,0,270,90
212+
10.88147,0,4.3303,0,0,270,90
213+
10.89832,0,4.3413,0,0,270,90
214+
10.91516,0,4.3523,0,0,270,90
215+
10.93206,0,4.3633,0,0,270,90
216+
10.94886,0,4.3742,0,0,270,90
217+
10.96571,0,4.3852,0,0,270,90
218+
10.98306,0,4.3965,0,0,270,90
219+
11.00007,0,4.4076,0,0,270,90
220+
11.01626,0,4.4182,0,0,270,90
221+
11.03311,0,4.4292,0,0,270,90
222+
11.05008,0,4.4402,0,0,270,90
223+
11.06708,0,4.4513,0,0,270,90
224+
11.08409,0,4.4624,0,0,270,90
225+
11.10109,0,4.4735,0,0,270,90
226+
11.11809,0,4.4846,0,0,270,90
227+
11.1342,0,4.4951,0,0,270,90
228+
11.1511,0,4.5061,0,0,270,90
229+
11.1681,0,4.5172,0,0,270,90
230+
11.18511,0,4.5283,0,0,270,90
231+
11.20212,0,4.5394,0,0,270,90
232+
11.21845,0,4.55,0,0,270,90
233+
11.2353,0,4.561,0,0,270,90
234+
11.25215,0,4.572,0,0,270,90
235+
11.26913,0,4.5831,0,0,270,90
236+
11.28613,0,4.5941,0,0,270,90
237+
11.30314,0,4.6052,0,0,270,90
238+
11.32014,0,4.6163,0,0,270,90
239+
11.33714,0,4.6274,0,0,270,90
240+
11.35324,0,4.6379,0,0,270,90
241+
11.37015,0,4.6489,0,0,270,90
242+
11.38716,0,4.66,0,0,270,90
243+
11.40379,0,4.6708,0,0,270,90
244+
11.42117,0,4.6822,0,0,270,90
245+
11.43816,0,4.6933,0,0,270,90
246+
11.45517,0,4.7043,0,0,270,90
247+
11.47119,0,4.7148,0,0,270,90
248+
11.48804,0,4.7258,0,0,270,90
249+
11.50488,0,4.7368,0,0,270,90
250+
11.52174,0,4.7477,0,0,270,90
251+
11.53858,0,4.7587,0,0,270,90
252+
11.55619,0,4.7702,0,0,270,90
253+
11.57228,0,4.7807,0,0,270,90
254+
11.58913,0,4.7917,0,0,270,90
255+
11.6062,0,4.8028,0,0,270,90
256+
11.62283,0,4.8137,0,0,270,90
257+
11.64021,0,4.825,0,0,270,90
258+
11.65721,0,4.8361,0,0,270,90
259+
11.67338,0,4.8466,0,0,270,90
260+
11.69023,0,4.8576,0,0,270,90
261+
11.70723,0,4.8687,0,0,270,90
262+
11.72423,0,4.8798,0,0,270,90
263+
11.74077,0,4.8906,0,0,270,90
264+
11.75762,0,4.9015,0,0,270,90
265+
11.77447,0,4.9125,0,0,270,90
266+
11.79132,0,4.9235,0,0,270,90
267+
11.80825,0,4.9345,0,0,270,90
268+
11.82525,0,4.9456,0,0,270,90
269+
11.84187,0,4.9565,0,0,270,90
270+
11.85872,0,4.9674,0,0,270,90
271+
11.87627,0,4.9789,0,0,270,90
272+
11.89327,0,4.99,0,0,270,90
273+
11.90927,0,5.0004,0,0,270,90
274+
11.92628,0,5.0115,0,0,270,90
275+
11.94328,0,5.0226,0,0,270,90
276+
11.96029,0,5.0337,0,0,270,90
277+
11.97729,0,5.0448,0,0,270,90
278+
11.99351,0,5.0553,0,0,270,90
279+
12.01036,0,5.0663,0,0,270,90
280+
12.0273,0,5.0774,0,0,270,90
281+
12.0443,0,5.0884,0,0,270,90
282+
12.06131,0,5.0995,0,0,270,90
283+
12.07831,0,5.1106,0,0,270,90
284+
12.0946,0,5.1212,0,0,270,90
285+
12.11145,0,5.1322,0,0,270,90
286+
12.12832,0,5.1432,0,0,270,90
287+
12.14515,0,5.1542,0,0,270,90
288+
12.162,0,5.1652,0,0,270,90
289+
12.17885,0,5.1762,0,0,270,90
290+
12.1957,0,5.1872,0,0,270,90
291+
12.21334,0,5.1987,0,0,270,90
292+
12.23035,0,5.2097,0,0,270,90
293+
12.24634,0,5.2202,0,0,270,90
294+
12.2631,0,5.2311,0,0,270,90
295+
12.27995,0,5.2421,0,0,270,90
296+
12.29737,0,5.2534,0,0,270,90
297+
12.31365,0,5.264,0,0,270,90

0 commit comments

Comments
 (0)