Skip to content

add ability to log csv settings #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Assets/UXF/Scripts/Etc/SessionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class SessionExtensions
/// </summary>
/// <param name="session"></param>
/// <param name="table"></param>
public static void BuildFromTable(this Session session, UXFDataTable table)
public static void BuildFromTable(this Session session, UXFDataTable table, bool addSettingsToLog = true)
{
if (table == null) throw new ArgumentNullException("table");
if (session == null) throw new ArgumentNullException("session");
Expand Down Expand Up @@ -65,6 +65,12 @@ public static void BuildFromTable(this Session session, UXFDataTable table)

// add trial setting
newTrial.settings.SetValue(kvp.Key, kvp.Value);

// possibly mark the setting to be logged in the results output
if (addSettingsToLog && !session.settingsToLog.Contains(kvp.Key))
{
session.settingsToLog.Add(kvp.Key);
}
}

rowNum++;
Expand Down
4 changes: 3 additions & 1 deletion Assets/UXF/Scripts/SessionBuilders/CSVExperimentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class CSVExperimentBuilder : MonoBehaviour, IExperimentBuilder

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

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

Expand Down