void Start() { // Added by Aislinn to get session experiment = GameObject.FindGameObjectWithTag("Experiment"); experimentGenerator = experiment.GetComponent <ExperimentGenerator>(); dotSession = experimentGenerator.session; // Added by Aislinn to get stim_start_time from DotStimScript dotStimulus = GameObject.FindGameObjectWithTag("DotStimulus"); dotStimScript = dotStimulus.GetComponent <DotStimScript>(); // Added by Aislinn to put stimulus in right location headCamera = GameObject.FindGameObjectWithTag("Camera"); transform.SetParent(headCamera.transform); stimLocList = dotSession.settings.GetIntList("stimulusLocation"); stimLoc = Quaternion.Euler(stimLocList[0], stimLocList[1], stimLocList[2]); stimDepth = dotSession.settings.GetFloat("StimDepth"); speedApertureUnits = dotSession.settings.GetInt("DotSpeed") / (2 * dotSession.settings.GetFloat("ApertureRad")); // Aperture has scaled radius of 1 here, need to scale speed to use with local position if (current_directionH == 1 && !isNoise) // "right opening" movement wedge (use for motion with leftward component) { if (!dotSession.settings.GetBool("DeterministicSignal")) { movement_angle = Quaternion.AngleAxis(-Random.Range(-current_angle / 2, current_angle / 2), Vector3.up); } transform.localRotation = Quaternion.identity * movement_angle; //Debug.Log("movement angle is " + movement_angle.eulerAngles); } if (current_directionH != 1 && !isNoise) // "left opening" movement wedge (use for motion with rightward component) { if (!dotSession.settings.GetBool("DeterministicSignal")) { movement_angle = Quaternion.AngleAxis(Random.Range(-current_angle / 2, current_angle / 2), Vector3.up); } transform.localRotation = Quaternion.identity * movement_angle; // Debug.Log("movement angle is " + movement_angle.eulerAngles); } if (isNoise && !isBuddy) { buddyDot = GameObject.Find("Dot" + buddyNumber.ToString()); float angle_degrees = Random.Range(-360, 360); movement_angle = Quaternion.AngleAxis(angle_degrees, Vector3.up); buddyDot.GetComponent <DotMotion>().movement_angle = Quaternion.AngleAxis(angle_degrees + 180, Vector3.up); transform.localRotation = Quaternion.identity * movement_angle; } if (isNoise && isBuddy) { transform.localRotation = Quaternion.identity * movement_angle; } //GetComponent<Renderer>().material.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f); timeSinceStartup = Time.realtimeSinceStartup; }
public async Task Test1( IEnumerable <Detail> j1, IEnumerable <Detail> j2, IEnumerable <LaboriousDetail> j12, IEnumerable <LaboriousDetail> j21) { // Arrange var experimentInfo = new ExperimentInfo(); experimentInfo.J1.AddRange(j1); experimentInfo.J2.AddRange(j2); experimentInfo.J12.AddRange(j12); experimentInfo.J21.AddRange(j21); var experiment = new Experiment { Id = Guid.NewGuid(), TestsAmount = 1 }; var generatorMock = new Mock <IExperimentGenerator>(); generatorMock.Setup(g => g.GenerateDataForTest(It.Is <Experiment>(ex => ex.Id == experiment.Id), It.IsAny <int>())) .Returns(() => experimentInfo); var originalGenerator = new ExperimentGenerator(new RandomizeService()); generatorMock.Setup(g => g.GenerateP(It.IsAny <IOnlineChainNode>())) .Callback <IOnlineChainNode>(node => originalGenerator.GenerateP(node)); ExperimentInfo resultInfo = null; var experimentTestResultService = new Mock <IExperimentTestResultService>(); experimentTestResultService .Setup(e => e.SaveExperimentTestResult(It.Is <Guid>(id => id == experiment.Id), It.IsAny <ExperimentInfo>())) .Callback <Guid, ExperimentInfo>((id, info) => resultInfo = info); var experimentPipeline = new ExperimentPipeline( generatorMock.Object, Mock.Of <IWorkerExperimentService>(), experimentTestResultService.Object, Mock.Of <IReportsService>(), Mock.Of <ILogger <ExperimentPipeline> >(), Mock.Of <IOptions <DbSettings> >(), new OnlineExecutor()); // Act await experimentPipeline.Run(Enumerable.Empty <Experiment>().Append(experiment)); // Assert Assert.NotNull(resultInfo); }
//public Tracker distractorTracker; void Start() { // Get session experiment = GameObject.FindGameObjectWithTag("Experiment"); experimentGenerator = experiment.GetComponent <ExperimentGenerator>(); distSession = experimentGenerator.session; // Get the direction of the stimulus dots and go the opposite way createDotMotion = experiment.GetComponent <CreateDotMotion>(); combinedDirection = createDotMotion.combined_direction; // Set the direction and speed the distractor moveSpeed = distSession.settings.GetInt("distractorMoveSpeed"); transform.Rotate(90f, 0f, 0f); if (combinedDirection == "Northeast") { distDir = new Vector3(-1f, -1f, 0f); distDirection = "Southwest"; } else if (combinedDirection == "Southeast") { distDir = new Vector3(-1f, 1f, 0f); distDirection = "Northwest"; } else if (combinedDirection == "Northwest") { distDir = new Vector3(1f, -1f, 0f); distDirection = "Southeast"; } else { distDir = new Vector3(1f, 1f, 0f); distDirection = "Northeast"; } // Log distractor direction distSession.CurrentTrial.result["distractor_direction"] = distDirection; /* * // Add a tracker of its position * distSession.trackedObjects.Add(distractorTracker); * distractorTracker.StartRecording(); */ }
void Start() { // Get session experiment = GameObject.FindGameObjectWithTag("Experiment"); experimentGenerator = experiment.GetComponent <ExperimentGenerator>(); targetSession = experimentGenerator.session; // Get the direction of the stimulus dots createDotMotion = experiment.GetComponent <CreateDotMotion>(); combinedDirection = createDotMotion.combined_direction; targetSession.CurrentTrial.result["target_direction"] = combinedDirection; // Set the direction and speed the target moveSpeed = targetSession.settings.GetInt("targetMoveSpeed"); transform.Rotate(90f, 0f, 0f); if (combinedDirection == "Northeast") { targetDir = new Vector3(1f, 1f, 0f); } else if (combinedDirection == "Southeast") { targetDir = new Vector3(1f, -1f, 0f); } else if (combinedDirection == "Northwest") { targetDir = new Vector3(-1f, 1f, 0f); } else { targetDir = new Vector3(-1f, -1f, 0f); } /* * // Add a tracker of its position * targetSession.trackedObjects.Add(targetTracker); * targetTracker.StartRecording(); */ }
public void Awake() { // Added by Aislinn to get session experiment = GameObject.FindGameObjectWithTag("Experiment"); experimentGenerator = experiment.GetComponent <ExperimentGenerator>(); dotSession = experimentGenerator.session; // Added by Aislinn to change angle with difficulty createDotMotion = experiment.GetComponent <CreateDotMotion>(); currentLevel = createDotMotion.level; /* * //stim_direction = Random.Range(0, 2); * if (stim_directionH == 0 && stim_directionV == 0) * { * combined_direction = "Northeast"; * } * if (stim_directionH == 0 && stim_directionV == 1) * { * combined_direction = "Southeast"; * } * if (stim_directionH == 1 && stim_directionV == 0) * { * combined_direction = "Northwest"; * } * if (stim_directionH == 1 && stim_directionV == 1) * { * combined_direction = "Southwest"; * } */ // Added by Aislinn to get the dots to go in a tangential direction stimLocList = dotSession.settings.GetIntList("stimulusLocation"); if (stimLocList[1] == 45) { stimPosSt = "upperRight"; } else if (stimLocList[1] == 135) { stimPosSt = "lowerRight"; } else if (stimLocList[1] == 225) { stimPosSt = "lowerLeft"; } else { stimPosSt = "upperLeft"; } stim_direction = Random.Range(0, 2); if (stimPosSt == "upperRight") { if (stim_direction == 0) { combined_direction = "Northwest"; stim_directionH = 1; stim_directionV = 0; } else { combined_direction = "Southeast"; stim_directionH = 0; stim_directionV = 1; } } else if (stimPosSt == "lowerRight") { if (stim_direction == 0) { combined_direction = "Northeast"; stim_directionH = 0; stim_directionV = 0; } else { combined_direction = "Southwest"; stim_directionH = 1; stim_directionV = 1; } } else if (stimPosSt == "lowerLeft") { if (stim_direction == 0) { combined_direction = "Northwest"; stim_directionH = 1; stim_directionV = 0; } else { combined_direction = "Southeast"; stim_directionH = 0; stim_directionV = 1; } } else { if (stim_direction == 0) { combined_direction = "Northeast"; stim_directionH = 0; stim_directionV = 0; } else { combined_direction = "Southwest"; stim_directionH = 1; stim_directionV = 1; } } }