Skip to content
jackbrookes edited this page Jun 1, 2018 · 14 revisions

UXF.Session

The main class used to manage your experiment. Attach this to a gameobject, and it will manage your experiment "session".


Fields

endOnDestroy: Enable to automatically safely end the session when this object is destroyed (or the application stops running).

blocks: List of blocks for this experiment

settingsToLog: List of settings you wish to log to the behavioural file for each trial.

customHeaders: List of variables you plan to measure in your experiment. Once set here, you can add the observations to your results dictionary on each trial.

trackedObjects: List of tracked objects. Add a tracker to a GameObject in your scene and set it here to track position and rotation of the object on each Update().

onSessionBegin: Event(s) to trigger when the session is initialised. Can pass the instance of the Session as a dynamic argument

onTrialBegin: Event(s) to trigger when a trial begins. Can pass the instance of the Trial as a dynamic argument

onTrialEnd: Event(s) to trigger when a trial ends. Can pass the instance of the Trial as a dynamic argument

experimentName: Name of the experiment. Data is saved in a folder with this name.

ppid: Unique string for this participant (participant ID)

number: Current session number for this participant

currentTrialNum: Currently active trial number.

currentBlockNum: Currently active block number.

settings: Settings for the experiment. These are provided on initialisation of the session.

fileIOManager: Reference to the associated FileIOManager which deals with inputting and outputting files.

logger: Reference to the associated SessionLogger which automatically stores all Debug.Log calls

participantDetails: Dictionary of objects for datapoints collected via the UI, or otherwise.

Properties

hasInitialised: Returns true if session has been intialised

inTrial: Returns true if current trial is in progress

currentTrial: Alias of GetTrial()

nextTrial: Alias of NextTrial()

prevTrial: Get the trial before the current trial.

firstTrial: Get the last trial in the last block of the session.

lastTrial: Get the last trial in the last block of the session.

currentBlock: Alias of GetBlock()

trials: Returns a list of trials for all blocks. Modifying the order of this list will not affect trial order. Modify block.trials to change order within blocks.

experimentPath: Path to the folder used for reading settings and storing the output.

ppPath: Path within the experiment path for this particular particpant.

path: Path within the particpant path for this particular session.

trackingHeaders: List of file headers generated for all referenced tracked objects.

headers: Stores combined list of headers for the behavioural output.

Methods

UXF.Session.AttachReferences(UXF.FileIOManager,UXF.SessionLogger)

Provide references to other components

Parameters

newFileIOManager:

newSessionLogger:

UXF.Session.InitFolder

Folder error checks (creates folders, has set save folder, etc)

Parameters

None

UXF.Session.SaveTrackerData(UXF.Tracker)

Save tracking data for this trial

Parameters

tracker: The tracker to take data from to save

UXF.Session.CopyFileToSessionFolder(System.String)

Copies a file to the folder for this session

Parameters

filePath:

UXF.Session.WriteDictToSessionFolder(System.Collections.Generic.Dictionary{System.String,System.Object},System.String)

Write a dictionary object to a JSON file in the session folder (in a new FileIOManager thread)

Parameters

dict: Dictionary object to write

objectName: Name of the object (is used for file name)

UXF.Session.CheckSessionExists(System.String,System.String,System.String,System.Int32)

Checks if a session folder already exists for this participant

Parameters

experimentName:

participantId:

baseFolder:

sessionNumber:

UXF.Session.Begin(System.String,System.String,System.String,System.Int32,System.Collections.Generic.Dictionary{System.String,System.Object},UXF.Settings)

Initialises a Session

Parameters

experimentName: A name for the experiment

participantId: A unique ID associated with a participant

baseFolder: Location where data should be stored

sessionNumber: A number for the session (optional: default 1)

participantDetails: Dictionary of information about the participant to be used within the experiment (optional: default null)

settings: A Settings instance (optional: default empty settings)

UXF.Session.CreateBlock

Create and return 1 Block, which then gets automatically added to Session.blocks

Parameters

None

UXF.Session.CreateBlock(System.Int32)

Create and return block containing a number of trials, which then gets automatically added to Session.blocks

Parameters

numberOfTrials: Number of trials. Must be greater than or equal to 1.

UXF.Session.GetTrial

Get currently active trial.

Parameters

None

UXF.Session.GetTrial(System.Int32)

Get trial by trial number (non zero indexed)

Parameters

None

UXF.Session.NextTrial

Get next Trial

Parameters

None

UXF.Session.EndCurrentTrial

Ends currently running trial. Useful to call from an inspector event

Parameters

None

UXF.Session.BeginNextTrial

Begins next trial. Useful to call from an inspector event

Parameters

None

UXF.Session.PrevTrial

Get previous Trial.

Parameters

None

UXF.Session.FirstTrial

Get first Trial in this session.

Parameters

None

UXF.Session.LastTrial

Get last Trial in this session.

Parameters

None

UXF.Session.GetBlock

Get currently active block.

Parameters

None

UXF.Session.GetBlock(System.Int32)

Get block by block number (non-zero indexed).

Parameters

None

UXF.Session.End

Ends the experiment session.

Parameters

None

UXF.Session.ReadSettingsFile(System.String,System.Action{System.Collections.Generic.Dictionary{System.String,System.Object}})

Reads json settings file as Dictionary then calls actioon with Dictionary as parameter

Parameters

path: Location of .json file to read

action: Action to call when completed

UXF.Session.SessionNumToName(System.Int32)

Convert a session number to a session name

Parameters

num:


Note: This file was automatically generated

๐Ÿง  Core topics

โ“ More help


๐Ÿ‘ฉโ€๐Ÿ’ป Programming reference

Unit tests

Clone this wiki locally