Skip to content

Commit 46e2a40

Browse files
add ability to log csv settings
1 parent c2ce8f8 commit 46e2a40

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Assets/UXF/Scripts/Etc/SessionExtensions.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class SessionExtensions
1515
/// </summary>
1616
/// <param name="session"></param>
1717
/// <param name="table"></param>
18-
public static void BuildFromTable(this Session session, UXFDataTable table)
18+
public static void BuildFromTable(this Session session, UXFDataTable table, bool addSettingsToLog = true)
1919
{
2020
if (table == null) throw new ArgumentNullException("table");
2121
if (session == null) throw new ArgumentNullException("session");
@@ -65,6 +65,12 @@ public static void BuildFromTable(this Session session, UXFDataTable table)
6565

6666
// add trial setting
6767
newTrial.settings.SetValue(kvp.Key, kvp.Value);
68+
69+
// possibly mark the setting to be logged in the results output
70+
if (addSettingsToLog && !session.settingsToLog.Contains(kvp.Key))
71+
{
72+
session.settingsToLog.Add(kvp.Key);
73+
}
6874
}
6975

7076
rowNum++;

Assets/UXF/Scripts/SessionBuilders/CSVExperimentBuilder.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class CSVExperimentBuilder : MonoBehaviour, IExperimentBuilder
1111

1212
[Tooltip("The name key in the settings that contains the name of the trial specification file.")]
1313
[SerializeField] private string csvFileKey = "trial_specification_name";
14+
[Tooltip("Enable to copy all settings from each trial in the CSV file to the the trial results output.")]
15+
[SerializeField] private bool copyToResults = true;
1416

1517
/// <summary>
1618
/// Reads a CSV from filepath as specified in csvFileKey in the settings.
@@ -45,7 +47,7 @@ public void BuildExperiment(Session session)
4547
// this adds a new trial to the session for each row in the table
4648
// the trial will be created with the settings from the values from the table
4749
// if "block_num" is specified in the table, the trial will be added to the block with that number
48-
session.BuildFromTable(table);
50+
session.BuildFromTable(table, copyToResults);
4951
}
5052
}
5153

0 commit comments

Comments
 (0)