Closed gabrielDiaz-performlab closed 4 years ago
Whilst your solution is OK, I think it makes it complicated for simple experiments. One way to solve this in my experience is make a GameObject called e.g. "Tracker" with the PositionRotationTracker component attached, then you can just reparent this Tracker GameObject to the head, foot, tool etc. E.g.
if (trialType == "foot")
{
tracker.transform.parent = foot.transform;
}
else if (trialType == "head")
{
tracker.transform.parent = head.transform;
}
...
This is still a bit limiting, as it assumes that you know all the trackers you will need at the beginning of the experiment. Jack, can you point me towards the code where the tracker's filenames are written out to the trial data file?
At the end of each trial, this is called: https://github.com/immersivecognition/unity-experiment-framework/blob/3716bf0018fcece530b65f2cfe77a09b430f4da0/Assets/UXF/Scripts/Etc/Trial.cs#L113-L119
Which calls this per tracker: https://github.com/immersivecognition/unity-experiment-framework/blob/e09e4ce821763500d4d48e7aa23c23ad41c95c93/Assets/UXF/Scripts/Session.cs#L379-L403
In general, I would prefer a simple approach rather than a complex approach that hurts most use cases, which I think splitting a string delimited by ;
does. For your exact issue where an unknown number of trackers are needed, you can actually write your own tracker class which collects data however it wants, and can be different on each trial. You would need to create a class which inherits from Tracker
and implements all the methods. The PositionRotationTracker
is an example of this:
You could copy the above file but add public fields which point to the object(s) you are currently tracking, and change the data it spits out based on the content of the field.
?Thanks, Jack. I'll see what I can do.
Gabriel J. Diaz, Ph.D. Associate Professor Rochester Institute of Technology Chester F. Carlson Center for Imaging Science
Founder of PerForM Labs Click for demos.https://www.cis.rit.edu/performlab/
Office 2108, Building #76 Rochester, NY 14623 Office: (585) 475-6215<tel:(585)%20475-6215> gabriel.diaz@rit.edumailto:gabriel.diaz@rit.edu
From: Jack Brookes notifications@github.com Sent: Tuesday, August 4, 2020 11:51 AM To: immersivecognition/unity-experiment-framework Cc: Gabriel Diaz; Author Subject: Re: [immersivecognition/unity-experiment-framework] Editing tracker list mid-experiment leads to problematic trialData.csv (#30)
At the end of each trial, this is called: https://github.com/immersivecognition/unity-experiment-framework/blob/3716bf0018fcece530b65f2cfe77a09b430f4da0/Assets/UXF/Scripts/Etc/Trial.cs#L113-L119
Which calls this per tracker: https://github.com/immersivecognition/unity-experiment-framework/blob/e09e4ce821763500d4d48e7aa23c23ad41c95c93/Assets/UXF/Scripts/Session.cs#L379-L403
- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/immersivecognition/unity-experiment-framework/issues/30#issuecomment-668677141, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACEL7WZM77NDHDE4DMPDWR3R7AU6RANCNFSM4POITKWQ.
@performlabrit I have news! I tested this out with the new "Ad Hoc Header Add" setting in the Session component, everything should work out of the box.
The way to do it is to edit the session.trackedObjects
as the trial begins, and then remove that object from the list after the trial has ended. Something like this, assuming you have a reference to the "Foot" tracker in your script:
// starting your trial
session.NextTrial.Begin();
session.trackedObjects.Add(foot);
... // your trial happens
// ending your trial
session.CurrentTrial.End();
session.trackedObjects.Remove(foot); // <-- IMPORTANT, REMOVE AFTER TRIAL ENDED, NOT BEFORE
Of course you get something like this as the output, but I think this is preferable as it requires no further processing.
Please ignore my previous comment (now deleted). I saw and replied to your update in email, and the image was not included. Great job! My only hesitation is that most common CSV importers require that the number of columns is constant. You may be putting the user in a position where they will have to write a custom CSV parser. I believe this is true of both Matlab and Python's standard parsers (for Python, Pandas' dataframe.read_csv).
If my understanding is true, then it would be a better solution to have a single column in which tracker files row-wise, as a delimited string.
...or, maybe I'm misunderstanding the organization implied by that image. Maybe the number of columns is indeed constant (as indicated by the top-row) and the repetitions in each column serve more as bools to indicate that the file is included for that row. If that's the case, then that works, too.
There is a constant number of columns within a session. If the cell is blank, it just means that tracker was not active on that trial.
There would be a variable number of columns (across participants) if some participants did not experience some trials which had those trackers, correct. This is why the adhoc option is optional, because it requires a bit more thinking if you are importoring and merging lots of participants' data files.
My experimental design involves different types of trials, with different needs for data recording. As a result, I modify the session's tracker list mid-experiment. This leads to issues with trialData.csv, which assumes a stable tracker list, where each tracker file is linked in its own column, which receives its own header at the start of the session.
The issues is that these headers are invalid once the number of trackers is modified.
The simple fix would be to stop using a column per tracker, and instead switch to a SINGLE column output regardless of the number of trackers. The column, which I will call, "Trackerlist" would list all data files associated with that trial in string format, with a non-comma delimiter between filenames. Eg, "head_movement.csv; foot_movement.csv; tool_orientation.csv".
This solution is an improvement in that it avoids having a CSV that changes the number of columns when the number of trackers changes.