public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { double averageOfReversals = reversalValues.Sum() / (double)reversalValues.Count; if (double.IsNaN(averageOfReversals)) { averageOfReversals = stepValue; } foreach (ControlledParameterTemplate template in controlledParameters .Where(x => x.ControllerParameter == (int)ControlParameter.Staircase)) { template.FinalizeParameters(averageOfReversals); template.PopulateScriptContextOutputs(scriptContext); } double blockStepValue = (correctCount - trial * taskGuessRate) / ((trial / BlockSteps) * (1.0 - taskGuessRate)); foreach (ControlledParameterTemplate template in controlledParameters .Where(x => x.ControllerParameter == (int)ControlParameter.Block)) { template.FinalizeParameters(blockStepValue); template.PopulateScriptContextOutputs(scriptContext); } }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { List <double> stepValues = null; try { stepValues = scriptObject.ExecuteFunction <List <double> >("CalculateThreshold", context); } catch (ScriptRuntimeException excp) { UnityEngine.Debug.LogError($"Runtime Error: \"CalculateThreshold\" failed with error: {excp.Message}."); ModalDialog.ShowSimpleModal(ModalDialog.Mode.Accept, headerText: "Runtime Error", bodyText: $"Runtime Error: \"CalculateThreshold\" failed with error: {excp.Message}."); } catch (Exception excp) { UnityEngine.Debug.LogError($"Error: \"CalculateThreshold\" failed with error: {excp.Message}."); ModalDialog.ShowSimpleModal(ModalDialog.Mode.Accept, headerText: "Error", bodyText: $"Error: \"CalculateThreshold\" failed with error: {excp.Message}."); } foreach (ControlledParameterTemplate template in controlledParameters) { double stepValue; if (stepValues is null || stepValues.Count <= template.ControllerParameter) { stepValue = 0.0; }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { double stepValue = 0.0; try { stepValue = scriptObject.ExecuteFunction <double>("CalculateThreshold", context); } catch (ScriptRuntimeException excp) { UnityEngine.Debug.LogError($"Runtime Error: \"CalculateThreshold\" failed with error: {excp.Message}."); ModalDialog.ShowSimpleModal(ModalDialog.Mode.Accept, headerText: "Runtime Error", bodyText: $"Runtime Error: \"CalculateThreshold\" failed with error: {excp.Message}."); } catch (Exception excp) { UnityEngine.Debug.LogError($"Error: \"CalculateThreshold\" failed with error: {excp.Message}."); ModalDialog.ShowSimpleModal(ModalDialog.Mode.Accept, headerText: "Error", bodyText: $"Error: \"CalculateThreshold\" failed with error: {excp.Message}."); } foreach (ControlledParameterTemplate template in controlledParameters) { template.FinalizeParameters(stepValue); template.PopulateScriptContextOutputs(scriptContext); } }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { foreach (ControlledParameterTemplate template in controlledParameters) { template.FinalizeParameters(thresholdStep); template.PopulateScriptContextOutputs(scriptContext); } }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { Expanded = stepValues.Count > InitialTrials; foreach (ControlledParameterTemplate template in controlledParameters) { template.FinalizeParameters(0); template.PopulateScriptContextOutputs(scriptContext); } }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { double stepValue = (correctCount - trial * taskGuessRate) / (Tracks * (1.0 - taskGuessRate)); foreach (ControlledParameterTemplate template in controlledParameters) { template.FinalizeParameters(stepValue); template.PopulateScriptContextOutputs(scriptContext); } }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { Accuracy = correctCount / (double)trial; foreach (ControlledParameterTemplate template in controlledParameters) { template.FinalizeParameters(0.0); template.PopulateScriptContextOutputs(scriptContext); } }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { for (int parameter = 0; parameter < 4; parameter++) { double stepValue = (correctCount - trial * taskGuessRate) / (GetOrthogonalCount(parameter) * (1.0 - taskGuessRate)); foreach (ControlledParameterTemplate template in controlledParameters.Where(x => x.ControllerParameter == parameter)) { template.FinalizeParameters(stepValue); template.PopulateScriptContextOutputs(scriptContext); } } }
public override void PopulateScriptContext(GlobalRuntimeContext scriptContext) { double averageOfReversals = reversalValues.Sum() / (double)reversalValues.Count; if (double.IsNaN(averageOfReversals)) { averageOfReversals = stepValue; } foreach (ControlledParameterTemplate template in controlledParameters) { template.FinalizeParameters(averageOfReversals); template.PopulateScriptContextOutputs(scriptContext); } }
void IBescriptedPropertyGroup.Initialize(GlobalRuntimeContext globalContext) { scriptObject = ScriptParser.LexAndParseScript( script: Script, new FunctionSignature( identifier: "Initialize", returnType: typeof(int)), new FunctionSignature( identifier: "Step", returnType: typeof(int), arguments: new VariableData("lastTrialCorrect", typeof(bool))), new FunctionSignature( identifier: "End", returnType: typeof(bool)), new FunctionSignature( identifier: "CalculateThreshold", returnType: typeof(double))); context = scriptObject.PrepareScript(globalContext); }
void IBescriptedPropertyGroup.Initialize(GlobalRuntimeContext globalContext) { scriptObject = ScriptParser.LexAndParseScript( script: Script, new FunctionSignature( identifier: "Initialize", returnType: typeof(void)), new FunctionSignature( identifier: "GetValue", returnType: typeof(double), arguments: new VariableData("stepNumber", typeof(int))), new FunctionSignature( identifier: "CouldStepTo", returnType: typeof(bool), arguments: new VariableData("stepNumber", typeof(int))), new FunctionSignature( identifier: "CalculateThreshold", returnType: typeof(double), arguments: new VariableData("stepValue", typeof(double)))); context = scriptObject.PrepareScript(globalContext); }
public abstract void PopulateScriptContext(GlobalRuntimeContext scriptContext);