Skip to content
Jack Brookes edited this page Mar 23, 2019 · 14 revisions

UXF.Session.EventHandler

An event handler for a C# event.


Fields

UXF.Session.endOnQuit: Enable to automatically safely end the session when the application is quitting.

UXF.Session.endOnDestroy: Enable to automatically safely end the session when this object is destroyed.

UXF.Session.blocks: List of blocks for this experiment

UXF.Session.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.

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

UXF.Session.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().

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

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

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

UXF.Session.onSessionEnd: Event(s) to trigger when the session has ended and all jobs have finished. It is safe to quit the application beyond this event.

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

UXF.Session.ppid: Unique string for this participant (participant ID)

UXF.Session.number: Current session number for this participant

UXF.Session.currentTrialNum: Currently active trial number.

UXF.Session.currentBlockNum: Currently active block number.

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

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

UXF.Session.baseHeaders: The headers that are always included in the trial_results output.

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

Properties

UXF.Session.hasInitialised: Returns true if session has been intialised

UXF.Session.InTrial: Returns true if current trial is in progress

UXF.Session.CurrentTrial: Returns the current trial object.

UXF.Session.NextTrial: Returns the next trial object (i.e. trial with trial number currentTrialNum + 1 ).

UXF.Session.PrevTrial: Get the trial before the current trial.

UXF.Session.FirstTrial: Get the last trial in the last block of the session.

UXF.Session.LastTrial: Get the last trial in the last block of the session.

UXF.Session.CurrentBlock: Returns the current block object.

UXF.Session.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.

UXF.Session.BasePath: The path in which the experiment data are stored.

UXF.Session.ExperimentPath: Path to the folder used for reading settings and storing the output.

UXF.Session.ParticipantPath: Path within the experiment path for this particular particpant.

UXF.Session.FullPath: Path within the particpant path for this particular session.

UXF.Session.FolderName: Name of the Session folder

UXF.Session.TrackingHeaders: List of file headers generated for all referenced tracked objects.

UXF.Session.Headers: Stores combined list of headers for the behavioural output.

UXF.Session.inTrial: Returns true if current trial is in progress

UXF.Session.currentTrial: Returns the current trial object.

UXF.Session.nextTrial: Returns the next trial object (i.e. trial with trial number currentTrialNum + 1 ).

UXF.Session.prevTrial: Get the trial before the current trial.

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

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

UXF.Session.currentBlock: Returns the current block object.

UXF.Session.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.

UXF.Session.basePath: The path in which the experiment data are stored.

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

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

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

UXF.Session.folderName: Name of the Session folder

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

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

Methods

UXF.Session.Awake()

Provide references to other components

Parameters

None

UXF.Session.AttachReferences(UXF.FileIOManager)

Provide references to other components

Parameters

  • newFileIOManager:

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(string)

Copies a file to the folder for this session

Parameters

  • filePath:

UXF.Session.WriteDictToSessionFolder(System.Collections.Generic.Dictionary<string, object>, 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(string, string, string, int)

Checks if a session folder already exists for this participant

Parameters

  • experimentName:

  • participantId:

  • baseFolder:

  • sessionNumber:

UXF.Session.Begin(string, string, string, int, System.Collections.Generic.Dictionary<string, 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(int)

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. When not in a trial, gets previous trial.

Parameters

None

UXF.Session.GetTrial(int)

Get trial by trial number (non zero indexed)

Parameters

None

UXF.Session.GetNextTrial()

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.GetPrevTrial()

Get previous Trial.

Parameters

None

UXF.Session.GetFirstTrial()

Get first Trial in this session.

Parameters

None

UXF.Session.GetLastTrial()

Get last Trial in this session.

Parameters

None

UXF.Session.GetBlock()

Get currently active block.

Parameters

None

UXF.Session.GetBlock(int)

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

Parameters

None

UXF.Session.End()

Ends the experiment session.

Parameters

None

UXF.Session.ReadSettingsFile(string, System.Action<System.Collections.Generic.Dictionary<string, 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(int)

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