public void FillDetail(IScienceExperiment experiment) { TitleDescription.text = string.Format("<b>{0}</b>\n<i>{1}</i>", experiment.Title().ToUpperInvariant(), experiment.Experiment.Description()); RewardText.text = string.Format("${0} REWARD", experiment.Reward); DetailSprite.sprite = experiment.Experiment.Sprite(); ExperimentStatus status = experiment.Status; CancelButton.gameObject.SetActive(status == ExperimentStatus.Accepted); AcceptButton.gameObject.SetActive(status == ExperimentStatus.Available); FinishButton.gameObject.SetActive(status == ExperimentStatus.ReadyForCompletion); FinishedPanel.gameObject.SetActive(status == ExperimentStatus.Completed); switch (status) { case ExperimentStatus.Accepted: ClockFill.fillAmount = experiment.Progress; break; case ExperimentStatus.Available: ClockFill.fillAmount = 0f; break; case ExperimentStatus.ReadyForCompletion: case ExperimentStatus.Completed: ClockFill.fillAmount = 1f; break; } DayText.text = experiment.ProgressText; }
public void Run() { experimentStatus = ExperimentStatus.Running; population = new Population <Polygon, int, Bitmap>( (popul) => { return(Fitness(popul, target)); }, (x, y) => { int result = x.CompareTo(y); if (result == 0) { return(1); // Handle equality as beeing greater } else { return(result); } }, new PolygonGenerator(target.Width, target.Height)); population.Generate(ExperimentConsts.PopulationCapacity); Draw(); oldValue = getBest().Key; Thread oThread = new Thread(new ThreadStart(MakeEvolution)); oThread.Start(); }
private async Task RefreshStatus() { var handle = ui.StartIndicateLongOperation("Gettings status of the experiment..."); try { var resp = (await Task.Run(() => manager.GetStatus(new[] { id }))).FirstOrDefault(); if (resp == null) { return; } this.status = resp; Note = status.Note; } finally { ui.StopIndicateLongOperation(handle); } NotifyPropertyChanged("Status"); NotifyPropertyChanged("NoteChanged"); NotifyPropertyChanged("SubmissionTime"); NotifyPropertyChanged("BenchmarksTotal"); NotifyPropertyChanged("BenchmarksDone"); NotifyPropertyChanged("BenchmarksQueued"); NotifyPropertyChanged("Creator"); }
public void EndExperiment() { experimentStatus = ExperimentStatus.INACTIVE; phraseConsole.SetActive(false); if (_path.Length != 0) { try { FileStream fileStream = File.Open(_path, FileMode.Append, FileAccess.Write); StreamWriter fileWriter = new StreamWriter(fileStream); fileWriter.WriteLine(experimentMode + "," + experiment.participant + "," + experiment.phrase + "," + experiment.date + "," + experiment.time); ExperimentSample firstSample = experiment.samples[0]; foreach (ExperimentSample sample in experiment.samples) { fileWriter.WriteLine((sample.timestamp - firstSample.timestamp) + "," + sample.character); } fileWriter.Flush(); fileWriter.Close(); } catch (IOException ioe) { Console.WriteLine(ioe); } } }
private void Update() { if (status == ExperimentStatus.CalibrationRunning && isCalibratingCenterOfPLanes) { transform.position = cursor.GetCursorPosition(); if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)) { FinishCalibrationOfExperimentPosition(); } else if (Input.GetKey(KeyCode.RightArrow)) { Vector3 currentRotation = transform.rotation.eulerAngles; transform.rotation = Quaternion.Euler(new Vector3(currentRotation.x, currentRotation.y - 0.5f, currentRotation.z)); } else if (Input.GetKey(KeyCode.LeftArrow)) { Vector3 currentRotation = transform.rotation.eulerAngles; transform.rotation = Quaternion.Euler(new Vector3(currentRotation.x, currentRotation.y + 0.5f, currentRotation.z)); } } else if (status == ExperimentStatus.Running) { KeepContentsSizeConstantOn2DScreen(); if (currentTestController != null && currentTestController.isRunning()) { LogFrameData(); } } else if (status == ExperimentStatus.Initializing) { status = ExperimentStatus.Stopped; } }
public IEnumerable <Model.Experiment> GetByStatus(ExperimentStatus status, string username) { if (string.IsNullOrWhiteSpace(username)) { throw new ArgumentException(); } if (username == "worker") { return(Repository .Get(experiment => experiment.Status == (int)status) .Select(e => Mapper.Map <Model.Experiment>(e))); } var user = UsersService.GetByUserName(username); if (user != null) { return(Repository .Get(experiment => experiment.Status == (int)status && experiment.UserId == user.Id) .Select(e => Mapper.Map <Model.Experiment>(e))); } return(Enumerable.Empty <Model.Experiment>()); }
public ExperimentPropertiesViewModel(ExperimentDefinition def, ExperimentStatus status, Domain domain, ExperimentManager manager, IUIService ui) { if (def == null) { throw new ArgumentNullException("def"); } if (status == null) { throw new ArgumentNullException("status"); } if (domain == null) { throw new ArgumentNullException("domain"); } if (manager == null) { throw new ArgumentNullException("manager"); } if (ui == null) { throw new ArgumentNullException("ui"); } this.id = status.ID; this.definition = def; this.status = status; this.domain = domain; this.manager = manager; this.ui = ui; currentNote = status.Note; isSyncing = true; Sync = new DelegateCommand(async _ => { isSyncing = true; Sync.RaiseCanExecuteChanged(); try { if (NoteChanged) { await SubmitNote(); } await Refresh(); } catch (Exception ex) { ui.ShowError(ex, "Failed to synchronize experiment properties"); } finally { isSyncing = false; Sync.RaiseCanExecuteChanged(); } }, _ => !isSyncing); Initialize(); }
public void TestInitialize() { status1 = new ExperimentStatus() { Id = 0, DisplayOrder = 1, StatusName = "Draft" }; status2 = new ExperimentStatus() { Id = 1, DisplayOrder = 2, StatusName = "Scheduled" }; status3 = new ExperimentStatus() { Id = 2, DisplayOrder = 3, StatusName = "Live" }; childItem1 = new Experiment() { Id = 1, MarketingAssetPackageId = 1, ExperimentName = "ChildItem1" }; childItem2 = new Experiment() { Id = 2, MarketingAssetPackageId = 1, ExperimentName = "ChildItem2" }; childItem3 = new Experiment() { Id = 3, MarketingAssetPackageId = 1, ExperimentName = "ChildItem3" }; //set up the dummy data for testing map1 = new MarketingAssetPackage() { MAPName = "Northern Lights", Id = 0, Hypothesis = "Test Hypothesis", Problem = "Test Problem", ProblemValidation = "Test Problem Validation", Notes = "Test Notes", Experiments = new List <Experiment>() { childItem1, childItem2, childItem3 } }; map2 = new MarketingAssetPackage() { MAPName = "Amber Spyglass", Id = 1 }; map3 = new MarketingAssetPackage() { MAPName = "Subtle Knife", Id = 2 }; _maps = new List <MarketingAssetPackage> { map1, map2, map3 }; mapRepository = new DummyMAPRepository(_maps); _controller = new MarketingAssetPackageController(mapRepository); }
void FinishCalibration() { if (status == ExperimentStatus.CalibrationRunning) { SetCursorActive(false); status = ExperimentStatus.Stopped; OnCalibrationFinished?.Invoke(); OnCalibrationFinished = null; } }
void Start() { status = ExperimentStatus.Initializing; frameData = new List <FrameData>(60 * 60 * 120); // Enough capacity to record up to 2 min of data at 60 fps LoadConfigurationsFromCanvasValues(); SharedData.calibrationData.LoadFromFile(); }
public void StartExperiment(string phrase, string participant, string path) { if (experimentStatus == ExperimentStatus.INACTIVE) { Debug.Log("Zaczynam eksperyment dla klawiatury: " + experimentMode); Debug.Log("Wybrana fraza to: " + phrase); Debug.Log("Wybrany uczestnik: " + participant); if (participant.Length == 0) { participant = "unnamed"; } phraseConsole.SetActive(true); _targetString = phrase.ToUpper(); _targetWords = _targetString.Split(); _path = path; int fontSize = Mathf.Clamp(110 - _targetString.Length, 50, 100); phraseText.text = _targetString; phraseText.fontSize = fontSize; _swypeCurrentIndex = 0; _currentString = ""; outputPhraseText.text = _currentString; outputPhraseText.fontSize = fontSize; experiment = new Experiment(); experiment.date = DateTime.Now.ToShortDateString(); experiment.time = DateTime.Now.ToLongTimeString(); experiment.participant = participant; experiment.phrase = phrase; experiment.samples = new List <ExperimentSample>(); switch (experimentMode) { case ExperimentMode.NORMAL_KEYBOARD: experimentStatus = ExperimentStatus.ACTIVE_NORMAL_KEYBOARD; break; case ExperimentMode.SWYPE_KEYBOARD: experimentStatus = ExperimentStatus.ACTIVE_SWYPE; break; } } }
public void RunExperiment() { if (status == ExperimentStatus.CalibrationRunning) { Debug.Log("[ExperimentController] Calibration is running. Finish Calibration process first."); return; } if (status == ExperimentStatus.Initializing || status == ExperimentStatus.Stopped) { Debug.Log("[ExperimentController] Starting experiment..."); centerOfTestPlanesObject.SetActive(false); cursor.cursorPositionController = GetControllerForPositioningMethod(configuration.cursorPositioningMethod, configuration.planeOrientation); cursor.selectionMethod = configuration.cursorSelectionMethod; cursor.SetDwellTime(configuration.dwellTime); cursor.transform.localScale = configuration.cursorWidth * Vector3.one; cursor.cursorPositionController.gameObject.SetActive(true); cursor.gameObject.SetActive(true); if (configuration.experimentMode == ExperimentMode.Experiment2D) { // Do not show the cursor when running the 2D mode //cursor.GetComponent<MeshRenderer>().enabled = false; computerCamera.backgroundColor = Color.white; worldSpaceRatio = 1f; } else if (configuration.experimentMode == ExperimentMode.Experiment3DOnMeta2) { worldSpaceRatio = configuration.screenTo3DWorldDimensionRatio; computerCamera.backgroundColor = Color.grey; ActivateMetaCamera(); } currentSequence = 0; status = ExperimentStatus.Running; RunNextTestConfiguration(); } else if (status == ExperimentStatus.Paused) { Debug.Log("[ExperimentController] Resuming experiment..."); cursor.cursorPositionController.gameObject.SetActive(true); status = ExperimentStatus.Running; RunNextTestConfiguration(); } else { Debug.Log("[ExperimentController] Experiment already running!"); } }
private Experiment ExperimentFromEntity(int id, ExperimentEntity entity) { var totalRuntime = TimeSpan.FromSeconds(entity.TotalRuntime); ExperimentDefinition def = DefinitionFromEntity(entity); ExperimentStatus status = new ExperimentStatus( id, def.Category, entity.Submitted, entity.Creator, entity.Note, entity.Flag, entity.CompletedBenchmarks, entity.TotalBenchmarks, totalRuntime, entity.WorkerInformation); return(new Experiment { Definition = def, Status = status }); }
public IList <ExperimentStatus> GetStatuses() { ExperimentStatus s1 = new ExperimentStatus { Id = 0, StatusName = "Draft" }; ExperimentStatus s2 = new ExperimentStatus { Id = 1, StatusName = "Scheduled" }; return(new List <ExperimentStatus> { s1, s2 }); }
public void CycleStatusUpdated(object sender, EventArgs e) { if (!cycle.runningCycle && runningSingleCycle) { runningSingleCycle = false; if (timeLapseExperiment != null && cycle.runningCycle == false) { timeLapseExperiment.SaveExperiment(Properties.Settings.Default.tlExperimentPath); } tempExperiment.SaveExperimentToSettings(); ExperimentStatus.Raise(this, new EventArgs()); } }
public void PauseExperiment() { if (status == ExperimentStatus.Running) { Debug.Log("[ExperimentController] Pausing experiment..."); status = ExperimentStatus.Paused; cursor.cursorPositionController.gameObject.SetActive(false); } else { Debug.Log("[ExperimentController] No experiment running!"); } }
public async void HandleTimelapseCalculations(TimeSpan timeLapseInterval, Double endDuration) { if (((Properties.Settings.Default.StartNow || Properties.Settings.Default.tlStartDate <= DateTime.Now)) && endDuration > 0) { _log.Info("Running single timelapse cycle"); tokenSource = new CancellationTokenSource(); tempExperiment = new Experiment(); tempExperiment.LoadExperiment(); timeLapseExperiment = Experiment.LoadExperimentAndSave(Properties.Settings.Default.tlExperimentPath); ExperimentStatus.Raise(this, new EventArgs()); runningSingleCycle = true; _log.Debug("TimeLapse Single Cycle Executed at: " + DateTime.Now); cycle.Start(); try { await RunSingleTimeLapse(timeLapseInterval, tokenSource.Token); } catch (TaskCanceledException e) { _log.Error("TimeLapse Cancelled: " + e); Stop(); TimeLapseStatus.Raise(this, new EventArgs()); return; } catch (Exception e) { _log.Error("Unknown timelapse error: " + e); } HandleTimelapseCalculations(timeLapseInterval, endDuration - timeLapseInterval.TotalMilliseconds); } else if (Properties.Settings.Default.tlStartDate > DateTime.Now) { await WaitForStartNow(); HandleTimelapseCalculations(timeLapseInterval, endDuration); } else { _log.Info("TimeLapse Finished"); runningTimeLapse = false; TimeLapseStatus.Raise(this, new EventArgs()); return; } }
public string ConvertEnumStatusToText(ExperimentStatus status) { if (status == ExperimentStatus.Create) return "新建"; else if (status == ExperimentStatus.Fail) return "失败"; else if (status == ExperimentStatus.Finish) return "完成"; else if (status == ExperimentStatus.Processing) return "运行"; else if (status == ExperimentStatus.Stop) return "停止"; else if (status == ExperimentStatus.Suspend) return "暂停"; else return null; }
public void UpdataExperimentStatus(Guid ExperimentID, bool isFinal, ExperimentStatus State) { using (WanTaiEntities _WanTaiEntities = new WanTaiEntities()) { ExperimentsInfo experiment = _WanTaiEntities.ExperimentsInfoes.Where(c => c.ExperimentID == ExperimentID).FirstOrDefault(); if (experiment != null) { experiment.State = (short)State; if (isFinal) { experiment.EndTime = DateTime.Now; } } _WanTaiEntities.SaveChanges(); } }
public ExperimentStatusViewModel(Experiment exp, ExperimentManager manager, IUIService message) { if (exp == null) { throw new ArgumentNullException("experiment"); } if (manager == null) { throw new ArgumentNullException("manager"); } if (message == null) { throw new ArgumentNullException("message"); } this.status = exp.Status; this.definition = exp.Definition; this.flag = status.Flag; this.manager = manager; this.uiService = message; }
public void StartCalibrationOfExperimentPosition(Action onFinished = null) { if (CanStartCalibrationProcess()) { OnCalibrationFinished = onFinished; status = ExperimentStatus.CalibrationRunning; isCalibratingCenterOfPLanes = true; originalCursorPosition = calibrationPositioningCursor.cursorPosition; calibrationPositioningCursor.cursorPosition = CursorPositioningController.CursorHandPosition.HandTop; cursor.cursorPositionController = calibrationPositioningCursor; SetCursorActive(true); cursor.selectionMethod = CursorSelectionMethod.KeyboardSpaceBar; cursor.transform.localScale = 0.01f * Vector3.one; ActivateMetaCamera(); } }
public void NewStatus(ExperimentStatus newStatus) { if (newStatus == null) { throw new ArgumentNullException("newStatus"); } if (newStatus.ID != status.ID) { throw new InvalidOperationException("Invalid experiment id"); } status = newStatus; NotifyPropertyChanged(nameof(Category)); NotifyPropertyChanged(nameof(Submitted)); NotifyPropertyChanged(nameof(Note)); NotifyPropertyChanged(nameof(Creator)); NotifyPropertyChanged(nameof(WorkerInformation)); NotifyPropertyChanged(nameof(BenchmarksDone)); NotifyPropertyChanged(nameof(BenchmarksTotal)); NotifyPropertyChanged(nameof(BenchmarksQueued)); }
public void StartCalibrationOfLeapMotionController(Action onFinished = null) { if (CanStartCalibrationProcess()) { OnCalibrationFinished = onFinished; LeapMotionControllerCursorBehaviour controller = inputDevices.GetComponentInChildren <LeapMotionControllerCursorBehaviour>(true); if (controller != null) { cursor.cursorPositionController = controller; controller.gameObject.SetActive(true); status = ExperimentStatus.CalibrationRunning; controller.StartLeapMotionCalibration(() => { FinishCalibration(); }); } else { Debug.LogWarning("Could not find the LeapMotionControllerCursorBehaviour component in the children of inputMethods!"); } } }
public void StopExperiment() { if (status == ExperimentStatus.Running || status == ExperimentStatus.Paused) { status = ExperimentStatus.Stopped; AbortCurrentTest(); if (configuration.experimentMode == ExperimentMode.Experiment3DOnMeta2) { centerOfTestPlanesObject.SetActive(true); } cursor.cursorPositionController.gameObject.SetActive(false); cursor.gameObject.SetActive(false); CleanTargetPlane(); Debug.Log("[ExperimentController] Stopped current experiment..."); } else { Debug.Log("[ExperimentController] No experiment running!"); } }
private static ExperimentTurn BuildNextExperimentTurn(ExperimentStatus experimentStatus) { var newSimulationTime = experimentStatus.LatestSimulationTime + 1.Turn() ?? new AlienDateTime(0); var random = experimentStatus.LatestRandomSeed == null ? new Random() : new Random(experimentStatus.LatestRandomSeed.Value); var moveUp = random.Next(4) == 0; var newSunPosition = (experimentStatus.LatestSunPosition == null ? new AlienSpaceVector(32, 18) : experimentStatus.LatestSunPosition.Value + new AlienSpaceVector(1, moveUp ? -1 : 0)).ToCoordinates(); var newExtraEnergy = experimentStatus.LatestExtraEnergy ?? AlienSpaceVector.WorldWidth * AlienSpaceVector.WorldHeight * Experiment.Richness; var newExperimentTurn = new ExperimentTurn { ExperimentId = experimentStatus.ExperimentId, SimulationTime = newSimulationTime, RandomSeed = random.Next(), SunPosition = newSunPosition, ExtraEnergy = newExtraEnergy, }; return(newExperimentTurn); }
public void Continue(object sender, EventArgs e) { experimentStatus = ExperimentStatus.Running; }
internal void OnClose(object sender, EventArgs e) { experimentStatus = ExperimentStatus.Closing; }
public void Pause(object sender, EventArgs e) { experimentStatus = ExperimentStatus.Pausing; }
public void ExperimentStatusChanged(IExperimentConnection document, ExperimentStatus previousStatus, ExperimentStatus newStatus) { Logger.Info( $"Experiment {document.DocumentName} status changed from {previousStatus.ToString()} to {newStatus.ToString()}"); }
//-------------------------------------------------------------------------------------------------// private ExperimentStatus ConvertType(Proxy.ExperimentStatus proxyExperimentStatus) { ExperimentStatus experimentStatus = null; if (proxyExperimentStatus != null) { experimentStatus = new ExperimentStatus(); experimentStatus.EstimatedRemainingRuntime = proxyExperimentStatus.estRemainingRuntime; experimentStatus.EstimatedRuntime = proxyExperimentStatus.estRuntime; experimentStatus.StatusCode = (StatusCodes)proxyExperimentStatus.statusCode; experimentStatus.WaitEstimate = this.ConvertType(proxyExperimentStatus.wait); } return experimentStatus; }
public Experiment() { experimentStatus = ExperimentStatus.Init; }