/// <summary> /// Define SimulationInput to describe homogeneous and two layer tissue /// </summary> /// <returns></returns> private void GenerateReferenceDatabase() { var simulationOptions = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { DatabaseType.pMCDiffuseReflectance }, false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var sourceInput = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 1); var detectorInputs = new List <IDetectorInput>() { new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101) }, new ROfRhoAndTimeDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Time = new DoubleRange(0.0, 1.0, 101) } }; _referenceInputTwoLayerTissue = new SimulationInput( 100, "", simulationOptions, sourceInput, new MultiLayerTissueInput( new ITissueRegion[] { new LayerRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerRegion( new DoubleRange(0.0, _layerThickness), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerRegion( new DoubleRange(_layerThickness, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectorInputs); _factor = 1.0 - Optics.Specular( _referenceInputTwoLayerTissue.TissueInput.Regions[0].RegionOP.N, _referenceInputTwoLayerTissue.TissueInput.Regions[1].RegionOP.N); _referenceOutputTwoLayerTissue = new MonteCarloSimulation(_referenceInputTwoLayerTissue).Run(); _databaseTwoLayerTissue = pMCDatabase.FromFile("DiffuseReflectanceDatabase", "CollisionInfoDatabase"); }
public SimulationOptionsViewModel(SimulationOptions options) { _simulationOptions = options; // use the property to invoke the appropriate change notification #if WHITELIST _absorptionWeightingTypeVM = new OptionViewModel <AbsorptionWeightingType>("Absorption Weighting Type:", false, _simulationOptions.AbsorptionWeightingType, WhiteList.AbsorptionWeightingTypes); _randomNumberGeneratorTypeVM = new OptionViewModel <RandomNumberGeneratorType>("Random Number Generator Type:", false, _simulationOptions.RandomNumberGeneratorType, WhiteList.RandomNumberGeneratorTypes); _phaseFunctionTypeVM = new OptionViewModel <PhaseFunctionType>("Phase Function Type:", false, _simulationOptions.PhaseFunctionType, WhiteList.PhaseFunctionTypes); #else _absorptionWeightingTypeVM = new OptionViewModel <AbsorptionWeightingType>("Absorption Weighting Type:", false, _simulationOptions.AbsorptionWeightingType); _randomNumberGeneratorTypeVM = new OptionViewModel <RandomNumberGeneratorType>("Random Number Generator:", false, _simulationOptions.RandomNumberGeneratorType); _phaseFunctionTypeVM = new OptionViewModel <PhaseFunctionType>("Phase Function Type:", false, _simulationOptions.PhaseFunctionType); #endif SetStatisticsFolderCommand = new RelayCommand(() => MC_SetStatisticsFolder_Executed(null, null)); _absorptionWeightingTypeVM.PropertyChanged += (sender, args) => _simulationOptions.AbsorptionWeightingType = _absorptionWeightingTypeVM.SelectedValue; _randomNumberGeneratorTypeVM.PropertyChanged += (sender, args) => _simulationOptions.RandomNumberGeneratorType = _randomNumberGeneratorTypeVM.SelectedValue; _phaseFunctionTypeVM.PropertyChanged += (sender, args) => _simulationOptions.PhaseFunctionType = _phaseFunctionTypeVM.SelectedValue; }
public IEnumerable <SimulationResult> Run(SimulationOptions options) { var cardPairs = GeneratePairs(GenerateCards()); foreach (var cards in cardPairs) { IntermediateSimulationResult result = ComputeChances(options, cards.ToList()); var wonRate = (double)result.Won / result.Runs; var wonSingleRate = (double)result.WonSingle / result.Runs; var drawRate = (double)result.Draw / result.Runs; var loseRate = (double)(result.Runs - result.Won) / result.Runs; yield return(new SimulationResult { Card1 = cards[0], Card2 = cards[1], WonRate = wonRate, WonSingleRate = wonSingleRate, DrawRate = drawRate, LoseRate = loseRate, Runs = result.Runs, ConfidenceLevel = options.ConfidenceLevel, PlayerCount = options.PlayerCount, WinLoseRatesRelativeError = options.WinLoseRatesDesiredRelativeError, Balance = result.Balance / result.Runs }); } }
public void Start(SimulationOptions options) { if (!_callCenter.IsRunning) { _callCenter.Start(options); } }
/// <summary> /// Initializes a new instance of the ModuleBlackboardServer class /// </summary> /// <param name="name">Module name</param> /// <param name="port">Port for accepting incoming connections</param> internal ModuleBlackboardServer(string name, int port) { if ((port < 1024) || (port > 65535)) { throw new ArgumentException("Port must be between 1024 and 65535", "port"); } if (!Regex.IsMatch(name, @"\w[\w\-_\d]{2,}")) { throw new ArgumentException("Invalid module name", "name"); } this.name = name; this.port = port; this.busy = false; //this.waitingResponse = new List<Command>(10); //this.responses = new List<Response>(); //this.commands = new List<Command>(); this.prototypes = new PrototypeCollection(this); this.lockList = new List <Command>(); this.restartActions = new ActionCollection(this); this.restartTestActions = new ActionCollection(this); this.startupActions = new ActionCollection(this); this.stopActions = new ActionCollection(this); this.dataReceived = new Queue <byte[]>(10); this.restartRequested = false; this.restartTestRequested = false; this.simOptions = SimulationOptions.SimulationDisabled; }
private void CreateNewProject() { // Устанавливаем дефолтные значения testTabControl.Items.Clear(); drawAreas.Clear(); processes.Clear(); mainProcess = new SimulationOptions(); mainProcessNumber = 0; processNamesCounter = 1; // Создаём процесс //Process process = new Process() { Description = mainProcess.Description }; processes.Add(mainProcess); // Добавляем в список процессов var tabItem = new TabItem() { Header = mainProcess }; testTabControl.SelectedItem = tabItem; // Создаём область рисования var drawArea = new DrawArea() { Processes = processes }; drawAreas.Add(drawArea); tabItem.Content = drawArea; testTabControl.Items.Add(tabItem); SetTheme(); }
private void InitComponents(SimulationOptions options) { m_PrSimulator = new PrSimulator(options); m_StSimulator = new StSimulator(options); m_DiffGenerator = new DiffGenerator(m_PrSimulator, m_StSimulator); m_Visualizer = new Visualizer2D(); }
protected virtual List <Player> MakePlayers(SimulationOptions options, int startingPot) { return(Enumerable .Range(0, options.PlayerCount) .Select(i => new Player() { PlayerPot = startingPot, Strategy = new AllInStrategy() }).ToList()); }
public SimulationOptionsDialog(SimulationOptions options) { InitializeComponent(); DataContext = this; WidthSetting = options.Size.Width; HeightSetting = options.Size.Height; StartXSetting = options.StartLocation.J + 1; StartYSetting = options.StartLocation.I + 1; }
public void UpdateChildControlsWithNewOptions(SimulationOptions newOptions) { for (int i = 0; i <= 8; i++) { CheckedListBox_BirthConditions.SetItemChecked(i, newOptions.birthConditions[i]); CheckedListBox_KillConditions.SetItemChecked(i, newOptions.killConditions[i]); } CheckBox_ConnectEdges.Checked = newOptions.connectEdges; NumericUpDown_FPS.Value = (decimal)(1000.0 / newOptions.frameDuration); }
public void validate_random_number_seed_is_correct() { var random1 = new SimulationOptions(-1); var deterministic = new SimulationOptions(1); Assert.AreNotEqual(random1.Seed, deterministic.Seed); // Setting a random seed now performed in RNGFactory //System.Threading.Thread.Sleep(1000); //var random2 = new SimulationOptions(-1); //Assert.AreNotEqual(random1.Seed, random2.Seed); }
protected override List <Player> MakePlayers(SimulationOptions options, int startingPot) { return(Enumerable .Range(0, options.PlayerCount) .Select(i => new Player() { PlayerPot = startingPot, Strategy = i == 0 ? new AllInStrategy() : (IPlayerStrategy) new FoldBadCardsOrAllInStrategy() }).ToList()); }
static void Main(string[] args) { var options = new SimulationOptions(new GridSize(11, 11), new GridIndex(5, 5)); PrSimulator pr = new PrSimulator(options); StSimulator st = new StSimulator(options); Func <double, double, double> u = (x, y) => Math.Log(Math.Sqrt((x / 10 + 3) * (x / 10 + 3) + (y / 10 + 3) * (y / 10 + 3))); File.WriteAllLines("comp_pr.csv", CalcPr(pr, u).Select(x => $"{x.Item1.ToString("E20")};{x.Item2.ToString("E20")}"), Encoding.UTF8); Console.WriteLine("Finished pr"); File.WriteAllLines("comp_st.csv", CalcSt(st, u).Select(x => $"{x.Item1.ToString("E20")};{x.Item2.ToString("E20")}"), Encoding.UTF8); }
public void validate_null_database_input_gets_converted_to_empty_list_correctly() { var so = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.Bidirectional, null, false, 0.0, 0); Assert.IsTrue(so.Databases.Count == 0); }
public static SimulationOptions loadSimulationOptionsFromDisk() { try { if (File.Exists(SIM_SETTINGS_FILE_NAME)) { SimulationOptions simulationOptions = null; FileStream fileStream = new FileStream(SIM_SETTINGS_FILE_NAME, FileMode.Open); simulationOptions = (SimulationOptions)formatter.Deserialize(fileStream); fileStream.Close(); return(simulationOptions); } return(new SimulationOptions()); } catch { return(new SimulationOptions()); } }
public void StartSimulation(SimulationData simulationData, SimulationOptions options = new SimulationOptions()) { var containerObject = new GameObject("SimulationConfig"); containerObject.tag = "SimulationConfig"; var configContainer = containerObject.AddComponent <SimulationConfigContainer>(); configContainer.Config = new SimulationConfig(); configContainer.Config.SimulationData = simulationData; configContainer.Config.Options = options; DontDestroyOnLoad(containerObject); InputRegistry.shared.Deregister(this); Physics.autoSimulation = false; Physics.autoSyncTransforms = false; // Load simulation scene SceneController.LoadSync(SceneController.Scene.SimulationContainer); }
public MainViewModel() { var logger = Logger.New(typeof(MainViewModel)); using (logger.LogPerf("Init")) { SettingsCommand = new DelegateCommand(_ => { var dlg = new SettingsDialog { ViewModel = new SettingsViewModel() }; dlg.ShowDialog(); }); SimulationOptions options = new SimulationOptions(new GridSize(9, 9), new GridIndex(4, 4)); Tabs.Add(new PrTabViewModel(options)); Tabs.Add(new StTabViewModel(options)); Tabs.Add(new CpTabViewModel(options)); Tabs.Add(new СlTabViewModel()); SelectedTab = Tabs.First(); } }
public void Start(SimulationOptions options) { CallCenterHubAppendLine("Simulation starting"); if (_isRunning) { throw new Exception("Already started"); } _options = options; var id = 1; var callId = 1; for (var i = 0; i < _options.OperatorCount; i++) { var @operator = new Operator(id++, OperatorTitle.Operator); _operators.Add(@operator); } for (var i = 0; i < _options.ManagerCount; i++) { var @operator = new Operator(id++, OperatorTitle.Manager); _operators.Add(@operator); } for (var i = 0; i < _options.SeniorManagerCount; i++) { var @operator = new Operator(id++, OperatorTitle.SeniorManager); _operators.Add(@operator); } for (var i = 0; i < _options.CallsAmount; i++) { var duration = _random.Next(_options.MinSecAnswer, _options.MaxSecAnswer); var call = new Call { Id = callId++, Duration = duration, IsActive = true }; _calls.Add(call); } foreach (var @operator in _operators) { @operator.StatusChanged += operator_StatusChanged; var thread = new Thread(() => @operator.Start()); thread.Start(); } _isRunning = true; CallCenterHubAppendLine("Simulation started"); CallCenterHubAppendLine("Operators starts answer the calls."); while (_calls.Any() || _awaitingCalls.Any()) { Task task = null; if (_calls.Any() || _awaitingCalls.Any()) { var call = _calls.FirstOrDefault(); if (call == null) { call = _awaitingCalls.Where(x => x.IsActive == true).FirstOrDefault(); if (call == null) { CallCenterHubAppendLine("Calls are ended"); _awaitingCalls.Clear(); } } if (call != null) { Thread.Sleep(call.Duration * 1000 / 15); CallCenterHubAppendLine("Sending a call"); task = Task.Run(() => SendingCallsAsync()); task.Wait(); } } } WaitForEmployeeEndsCalls(); Stop(); }
public void execute_Monte_Carlo() { // delete previously generated files clear_folders_and_files(); // instantiate common classes var simulationOptions = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { }, // databases to be written false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var source = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 1); // start inside tissue var oneLayerDetectors = new List <IDetectorInput> { new ROfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11), TallySecondMoment = true }, new TOfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11) }, new ReflectedDynamicMTOfFxAndSubregionHistDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11), // fx bins MAKE SURE AGREES with ROfFx fx specification for unit test below Z = new DoubleRange(0.0, 10.0, 21), MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11), BloodVolumeFraction = new List <double>() { 0, 0.5, 0 } }, new TransmittedDynamicMTOfFxAndSubregionHistDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11), // fx bins MAKE SURE AGREES with TOfFx fx specification for unit test below Z = new DoubleRange(0.0, 10.0, 21), MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11), BloodVolumeFraction = new List <double>() { 0, 0.5, 0 } }, }; _inputOneLayerTissue = new SimulationInput( 100, "", simulationOptions, source, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), oneLayerDetectors); _outputOneLayerTissue = new MonteCarloSimulation(_inputOneLayerTissue).Run(); var twoLayerDetectors = new List <IDetectorInput> { new ReflectedDynamicMTOfFxAndSubregionHistDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11), Z = new DoubleRange(0.0, 10.0, 21), MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11), BloodVolumeFraction = new List <double>() { 0, 0.2, 0.5, 0 } }, new TransmittedDynamicMTOfFxAndSubregionHistDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11), Z = new DoubleRange(0.0, 10.0, 21), MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11), BloodVolumeFraction = new List <double>() { 0, 0.2, 0.5, 0 } } }; _inputTwoLayerTissue = new SimulationInput( 100, "", simulationOptions, source, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, _layerThickness), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(_layerThickness, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), twoLayerDetectors); _outputTwoLayerTissue = new MonteCarloSimulation(_inputTwoLayerTissue).Run(); }
public void execute_Monte_Carlo() { // delete previously generated files clear_folders_and_files(); var simulationOptions = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Continuous, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { DatabaseType.pMCDiffuseReflectance }, false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var sourceInput = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 1); var detectorInputs = new List <IDetectorInput>() { new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101) }, new ROfRhoAndTimeDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Time = new DoubleRange(0.0, 1.0, 101) }, new ROfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11) }, new ROfFxAndTimeDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 11), Time = new DoubleRange(0.0, 1.0, 101) } }; _referenceInputOneLayerTissue = new SimulationInput( 100, "", // can't create folder in isolated storage simulationOptions, sourceInput, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectorInputs); _factor = 1.0 - Optics.Specular( _referenceInputOneLayerTissue.TissueInput.Regions[0].RegionOP.N, _referenceInputOneLayerTissue.TissueInput.Regions[1].RegionOP.N); _referenceOutputOneLayerTissue = new MonteCarloSimulation(_referenceInputOneLayerTissue).Run(); _databaseOneLayerTissue = pMCDatabase.FromFile("DiffuseReflectanceDatabase", "CollisionInfoDatabase"); }
public void execute_Monte_Carlo() { // delete previously generated files clear_folders_and_files(); // instantiate common classes var simulationOptions = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { }, // databases to be written false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var source = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 1); // start inside tissue var detectors = new List <IDetectorInput> { new RDiffuseDetectorInput(), new ROfAngleDetectorInput() { Angle = new DoubleRange(Math.PI / 2, Math.PI, 2) }, new ROfXAndYDetectorInput() { X = new DoubleRange(-200.0, 200.0, 401), Y = new DoubleRange(-200.0, 200.0, 401) }, new TDiffuseDetectorInput(), new TOfAngleDetectorInput() { Angle = new DoubleRange(0.0, Math.PI / 2, 2) }, new ATotalDetectorInput(), }; _inputOneRegionTissue = new SimulationInput( 100, "", simulationOptions, source, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputOneRegionTissue = new MonteCarloSimulation(_inputOneRegionTissue).Run(); _inputTwoRegionTissue = new SimulationInput( 100, "", simulationOptions, source, new SingleVoxelTissueInput( new VoxelTissueRegion( new DoubleRange(-5, 5), new DoubleRange(-5, 5), new DoubleRange(1e-9, 5), // smallest Z.Start with tests passing is 1e-9 new OpticalProperties(0.01, 1.0, 0.8, 1.4) //debug with g=1 ), new LayerTissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 20.0), // debug with thin slab d=2 new OpticalProperties(0.01, 1.0, 0.8, 1.4)), // debug with g=1 new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputTwoRegionTissue = new MonteCarloSimulation(_inputTwoRegionTissue).Run(); _factor = 1.0 - Optics.Specular( _inputOneRegionTissue.TissueInput.Regions[0].RegionOP.N, _inputOneRegionTissue.TissueInput.Regions[1].RegionOP.N); }
public void execute_Monte_Carlo() { // delete previously generated files clear_folders_and_files(); // instantiate common classes var simulationOptions = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { }, // databases to be written false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var source = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 1); // start inside tissue var detectors = new List <IDetectorInput> { new RDiffuseDetectorInput(), new ROfAngleDetectorInput() { Angle = new DoubleRange(Math.PI / 2, Math.PI, 2) }, new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), TallySecondMoment = true }, new ROfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Angle = new DoubleRange(Math.PI / 2, Math.PI, 2) }, new ROfRhoAndTimeDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Time = new DoubleRange(0.0, 1.0, 101), TallySecondMoment = true }, new ROfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101) }, new ROfRhoAndOmegaDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Omega = new DoubleRange(0.05, 1.0, 20) }, // DJC - edited to reflect frequency sampling points (not bins) new ROfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 51) }, new TDiffuseDetectorInput(), new TOfAngleDetectorInput() { Angle = new DoubleRange(0.0, Math.PI / 2, 2) }, new TOfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101) }, new TOfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Angle = new DoubleRange(0.0, Math.PI / 2, 2) }, new TOfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101) }, new TOfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 51) }, new AOfRhoAndZDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Z = new DoubleRange(0.0, 10.0, 101) }, new AOfXAndYAndZDetectorInput() { X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101), Z = new DoubleRange(0.0, 10.0, 101), TallySecondMoment = true }, new ATotalDetectorInput() { TallySecondMoment = true }, new FluenceOfRhoAndZDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Z = new DoubleRange(0.0, 10.0, 101) }, new FluenceOfXAndYAndZDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), Z = new DoubleRange(0.0, 10.0, 11), TallySecondMoment = true }, new FluenceOfXAndYAndZAndOmegaDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), Z = new DoubleRange(0.0, 10.0, 11), Omega = new DoubleRange(0.05, 1.0, 20) }, new RadianceOfRhoAtZDetectorInput() { ZDepth = _dosimetryDepth, Rho = new DoubleRange(0.0, 10.0, 101) }, new RadianceOfRhoAndZAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Z = new DoubleRange(0.0, 10.0, 101), Angle = new DoubleRange(0, Math.PI, 5) }, new RadianceOfFxAndZAndAngleDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 51), Z = new DoubleRange(0.0, 10, 101), Angle = new DoubleRange(0, Math.PI, 5) }, new RadianceOfXAndYAndZAndThetaAndPhiDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), Z = new DoubleRange(0.0, 10.0, 11), Theta = new DoubleRange(0.0, Math.PI, 5), // theta (polar angle) Phi = new DoubleRange(-Math.PI, Math.PI, 5), // phi (azimuthal angle) }, new ReflectedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), // rho bins MAKE SURE AGREES with ROfRho rho specification for unit test below MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11) }, new TransmittedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), // rho bins MAKE SURE AGREES with TOfRho rho specification for unit test below MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11) }, new ReflectedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101), MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11), TallySecondMoment = true }, new TransmittedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101), MTBins = new DoubleRange(0.0, 500.0, 51), // MT bins FractionalMTBins = new DoubleRange(0.0, 1.0, 11) } }; _inputOneLayerTissue = new SimulationInput( 100, "", simulationOptions, source, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputOneLayerTissue = new MonteCarloSimulation(_inputOneLayerTissue).Run(); _inputTwoLayerTissue = new SimulationInput( 100, "", simulationOptions, source, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, _layerThickness), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(_layerThickness, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputTwoLayerTissue = new MonteCarloSimulation(_inputTwoLayerTissue).Run(); _factor = 1.0 - Optics.Specular( _inputOneLayerTissue.TissueInput.Regions[0].RegionOP.N, _inputOneLayerTissue.TissueInput.Regions[1].RegionOP.N); }
public void execute_Monte_Carlo() { // delete any previously generated files clear_folders_and_files(); // instantiate common classes var simulationOptions = new SimulationOptions( 0, // rng seed = same as linux (0) RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Continuous, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { }, // databases to be written false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var source = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 1); // start inside tissue var detectors = new List <IDetectorInput> { new ATotalDetectorInput(), new RDiffuseDetectorInput() { TallySecondMoment = true }, new ROfAngleDetectorInput() { Angle = new DoubleRange(Math.PI / 2, Math.PI, 2) }, new ROfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Angle = new DoubleRange(Math.PI / 2, Math.PI, 2) }, new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), TallySecondMoment = true }, new ROfRhoAndTimeDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Time = new DoubleRange(0.0, 1.0, 101) }, new ROfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101) }, new ROfRhoAndOmegaDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Omega = new DoubleRange(0.05, 1.0, 20) }, // DJC - edited to reflect frequency sampling points (not bins) new TDiffuseDetectorInput(), new TOfAngleDetectorInput() { Angle = new DoubleRange(0.0, Math.PI / 2, 2) }, new TOfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101) }, new TOfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Angle = new DoubleRange(0.0, Math.PI / 2, 2) }, new TOfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 101), Y = new DoubleRange(-10.0, 10.0, 101) }, new ReflectedTimeOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 101), Time = new DoubleRange(0.0, 1.0, 101) }, }; // one tissue layer var inputOneLayerTissue = new SimulationInput( 100, "", simulationOptions, source, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputOneLayerTissue = new MonteCarloSimulation(inputOneLayerTissue).Run(); // two tissue layers with same optical properties var inputTwoLayerTissue = new SimulationInput( 100, "Output", simulationOptions, source, new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, _layerThickness), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(_layerThickness, 20.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(20.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputTwoLayerTissue = new MonteCarloSimulation(inputTwoLayerTissue).Run(); _factor = 1.0 - Optics.Specular( inputOneLayerTissue.TissueInput.Regions[0].RegionOP.N, inputOneLayerTissue.TissueInput.Regions[1].RegionOP.N); }
public void execute_Monte_Carlo() { // instantiate common classes var simulationOptions = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { DatabaseType.pMCDiffuseReflectance }, // write database for pMC tests false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var source = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 0); // start in air var tissue = new MultiLayerTissueInput( new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 10.0), // make tissue layer thin so transmittance results improved new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(10.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) }); var detectorsNA0 = new List <IDetectorInput> { new RDiffuseDetectorInput() { FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfAngleDetectorInput() { Angle = new DoubleRange(Math.PI / 2, Math.PI, 2), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Angle = new DoubleRange(Math.PI / 2, Math.PI, 2), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfRhoAndTimeDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Time = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfRhoAndOmegaDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Omega = new DoubleRange(0.05, 1.0, 20), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfXAndYAndTimeDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), Time = new DoubleRange(0, 1, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfXAndYAndMaxDepthDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MaxDepth = new DoubleRange(0, 10.0, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 51), FinalTissueRegionIndex = 0, NA = 0.0 }, new ROfFxAndTimeDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 51), Time = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new RSpecularDetectorInput() { FinalTissueRegionIndex = 0, NA = 0.0 }, new TDiffuseDetectorInput() { FinalTissueRegionIndex = 2, NA = 0.0 }, new TOfAngleDetectorInput() { Angle = new DoubleRange(0.0, Math.PI / 2, 2), FinalTissueRegionIndex = 2, NA = 0.0 }, new TOfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Angle = new DoubleRange(0.0, Math.PI / 2, 2), FinalTissueRegionIndex = 2, NA = 0.0 }, new TOfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), FinalTissueRegionIndex = 2, NA = 0.0 }, new TOfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), FinalTissueRegionIndex = 2, NA = 0.0 }, new RadianceOfRhoAtZDetectorInput() { ZDepth = _dosimetryDepth, Rho = new DoubleRange(0.0, 10.0, 11), FinalTissueRegionIndex = 1, NA = 0.0 }, new ReflectedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new ReflectedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.0 }, new TransmittedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 2, NA = 0.0 }, new TransmittedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 2, NA = 0.0 }, }; var input = new SimulationInput( 100, "", simulationOptions, source, tissue, detectorsNA0); _outputNA0 = new MonteCarloSimulation(input).Run(); _inputForPMC = input; // set pMC input to one that specified database generation _pMCDatabase = pMCDatabase.FromFile("DiffuseReflectanceDatabase", "CollisionInfoDatabase"); // grab database var detectorsNA0p3 = new List <IDetectorInput> { new RDiffuseDetectorInput() { FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfAngleDetectorInput() { Angle = new DoubleRange(Math.PI / 2, Math.PI, 2), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Angle = new DoubleRange(Math.PI / 2, Math.PI, 2), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfRhoAndTimeDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Time = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfRhoAndOmegaDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Omega = new DoubleRange(0.05, 1.0, 20), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfXAndYAndTimeDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), Time = new DoubleRange(0, 1, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfXAndYAndMaxDepthDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MaxDepth = new DoubleRange(0, 10.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 51), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfFxAndTimeDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 5), Time = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new RSpecularDetectorInput() { FinalTissueRegionIndex = 0, NA = 0.3 }, new TDiffuseDetectorInput() { FinalTissueRegionIndex = 2, NA = 0.3 }, new TOfAngleDetectorInput() { Angle = new DoubleRange(0.0, Math.PI / 2, 2), FinalTissueRegionIndex = 2, NA = 0.3 }, new TOfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Angle = new DoubleRange(0.0, Math.PI / 2, 2), FinalTissueRegionIndex = 2, NA = 0.3 }, new TOfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), FinalTissueRegionIndex = 2, NA = 0.3 }, new TOfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), FinalTissueRegionIndex = 2, NA = 0.3 }, new RadianceOfRhoAtZDetectorInput() { ZDepth = _dosimetryDepth, Rho = new DoubleRange(0.0, 10.0, 11), FinalTissueRegionIndex = 1, NA = 0.3 }, new ReflectedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ReflectedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new TransmittedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 2, NA = 0.3 }, new TransmittedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), FinalTissueRegionIndex = 2, NA = 0.3 }, }; input = new SimulationInput( 100, "", simulationOptions, source, tissue, detectorsNA0p3); _outputNA0p3 = new MonteCarloSimulation(input).Run(); var detectorsNoNASpecified = new List <IDetectorInput> { new RDiffuseDetectorInput() { }, new ROfAngleDetectorInput() { Angle = new DoubleRange(Math.PI / 2, Math.PI, 2) }, new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11) }, new ROfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Angle = new DoubleRange(Math.PI / 2, Math.PI, 2) }, new ROfRhoAndTimeDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Time = new DoubleRange(0.0, 1.0, 11) }, new ROfRhoAndOmegaDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Omega = new DoubleRange(0.05, 1.0, 20) }, new ROfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11) }, new ROfXAndYAndTimeDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), Time = new DoubleRange(0, 1, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfXAndYAndMaxDepthDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MaxDepth = new DoubleRange(0, 10.0, 11), FinalTissueRegionIndex = 0, NA = 0.3 }, new ROfFxDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 51) }, new ROfFxAndTimeDetectorInput() { Fx = new DoubleRange(0.0, 0.5, 5), Time = new DoubleRange(0.0, 1.0, 11) }, new RSpecularDetectorInput() { }, new TDiffuseDetectorInput() { }, new TOfAngleDetectorInput() { Angle = new DoubleRange(0.0, Math.PI / 2, 2) }, new TOfRhoAndAngleDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), Angle = new DoubleRange(0.0, Math.PI / 2, 2) }, new TOfRhoDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11) }, new TOfXAndYDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11) }, new RadianceOfRhoAtZDetectorInput() { ZDepth = _dosimetryDepth, Rho = new DoubleRange(0.0, 10.0, 11) }, new ReflectedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), }, new ReflectedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), }, new TransmittedMTOfRhoAndSubregionHistDetectorInput() { Rho = new DoubleRange(0.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), }, new TransmittedMTOfXAndYAndSubregionHistDetectorInput() { X = new DoubleRange(-10.0, 10.0, 11), Y = new DoubleRange(-10.0, 10.0, 11), MTBins = new DoubleRange(0.0, 500.0, 5), FractionalMTBins = new DoubleRange(0.0, 1.0, 11), }, }; input = new SimulationInput( 100, "", simulationOptions, source, tissue, detectorsNoNASpecified); _outputNoNASpecified = new MonteCarloSimulation(input).Run(); }
public SimulationRenderHelper(Panel gamePanel, RenderZoneOptions renderZoneOptions, SimulationOptions options) { if (gamePanel == null) { throw new ArgumentNullException(nameof(gamePanel)); } gamePanel.Controls.Clear(); SimulationSession = new SimulationSession(options); _zoneSelectionPanel.Width = 160; _zoneSelectionPanel.Dock = DockStyle.Left; _viewportPanel.Dock = DockStyle.Fill; _viewportPanel.AutoScroll = true; gamePanel.Controls.Add(_viewportPanel); gamePanel.Controls.Add(_zoneSelectionPanel); _zoneSelectionPanel.BringToFront(); _viewportPanel.BringToFront(); if (renderZoneOptions == null) { throw new ArgumentNullException(nameof(renderZoneOptions)); } _canvasPanel = new Panel { BackColor = EmptyZoneConsumption.DefaultColor, Size = _tilesetAccessor.GetAreaSize(SimulationSession.Area), Dock = DockStyle.None }; _viewportPanel.Controls.Add(_canvasPanel); _zoneSelectionPanelBehaviour = new ZoneSelectionPanelCreator( area: SimulationSession.Area, targetPanel: _zoneSelectionPanel ); MouseEventHandler eventHandler = (sender, e) => { var point = _canvasPanel.PointToClient(Cursor.Position); var zone = GetZoneStateFor(point); var zoneConsumption = (e.Button == MouseButtons.Right) ? new EmptyZoneConsumption() : _zoneSelectionPanelBehaviour.CreateNewCurrentZoneConsumption(); var result = SimulationSession.ConsumeZoneAt(zone, zoneConsumption); if (result == null) { throw new InvalidOperationException(); } }; _canvasPanel.MouseDown += eventHandler; _canvasPanel.MouseMove += (sender, e) => { if (e.Button != MouseButtons.None && _zoneSelectionPanelBehaviour.IsCurrentlyNetworkZoning) { eventHandler(sender, e); } }; _zoneRenderInfos = SimulationSession.Area .EnumerateZoneInfos() .ToDictionary(x => x, zoneRenderInfo => new ZoneRenderInfo( zoneInfo: zoneRenderInfo, createRectangle: zonePoint => new Rectangle( x: zonePoint.Point.X * _tilesetAccessor.TileWidthAndSizeInPixels, y: zonePoint.Point.Y * _tilesetAccessor.TileWidthAndSizeInPixels, width: _tilesetAccessor.TileWidthAndSizeInPixels, height: _tilesetAccessor.TileWidthAndSizeInPixels ), tilesetAccessor: _tilesetAccessor, renderZoneOptions: renderZoneOptions )); _graphicsManager = CreateGraphicsManagerWrapperWithFactory(renderZoneOptions.SelectedGraphicsManager.Factory); }
//public void Map(UIElementCollection uIElementCollection, SimulationOptions simOptions) //{ // Dictionary<ProcedureWPF, Procedure> procedures = new Dictionary<ProcedureWPF, Procedure>(); // Dictionary<ResourceWPF, Resource> resources = new Dictionary<ResourceWPF, Resource>(); // var resultProcedures = new List<Procedure>(); // foreach (var element in uIElementCollection) // { // //смотрим все соединения процедур // if (element is ProcConnectionWPF) // { // var connection = (element as ProcConnectionWPF); // //TODO типа можно здесь всё обработать // // Комментарий от 28.05.19: facepalm // if (connection.StartBlock is StartBlockWPF && connection.EndBlock is EndBlockWPF) // { // throw new Exception("Нельзя просто соединить начало с концом!"); // } // //обработка стартового блока // if (connection.StartBlock is StartBlockWPF) // { // Procedure block; // //если в первый раз встерчаем блок // if (!(procedures.ContainsKey(connection.EndBlock as ProcedureWPF))) // { // //первого нет, второй значимый // block = (connection.EndBlock as ProcedureWPF).BlockModel; // //добавляем его в список // procedures.Add(connection.EndBlock as ProcedureWPF, block); // //добавляем его в список всех блоков процесса // resultProcedures.Add(block); // } // //иначе просто берём из базы // else // block = procedures[connection.EndBlock as ProcedureWPF]; // //process.StartBlock = block; // //соединение будет когда-то потом // } // //обработка конечного блока // else if (connection.EndBlock is EndBlockWPF) // { // Procedure block = null; // //если в первый раз такое встречаем // if (!(procedures.ContainsKey(connection.StartBlock as ProcedureWPF))) // { // block = (connection.StartBlock as ProcedureWPF).BlockModel; // procedures.Add(connection.StartBlock as ProcedureWPF, block); // resultProcedures.Add(block); // } // else // { // block = procedures[connection.StartBlock as ProcedureWPF]; // } // //process.EndBlock = block; // //соединение будет когда-то потом // } // //обработка всех остальных блоков // else // { // Procedure block = null; // //если в первый раз такое встречаем // if (!(procedures.ContainsKey(connection.StartBlock as ProcedureWPF))) // { // block = (connection.StartBlock as ProcedureWPF).BlockModel; // procedures.Add(connection.StartBlock as ProcedureWPF, block); // resultProcedures.Add(block); // } // //если в первый раз такое встречаем // if (!(procedures.ContainsKey(connection.EndBlock as ProcedureWPF))) // { // block = (connection.EndBlock as ProcedureWPF).BlockModel; // procedures.Add(connection.EndBlock as ProcedureWPF, block); // resultProcedures.Add(block); // } // //к счастью там только один вход и выход // //process.Connections.Connect(procedures[connection.StartBlock as ProcedureWPF], connection.StartPort, // // procedures[connection.EndBlock as ProcedureWPF], connection.EndPort); // } // } // //сотрим соединения ресурсов // else if (element is ResConnectionWPF) // { // var connection = (element as ResConnectionWPF); // ProcedureWPF procedure; // ResourceWPF resourceWPF; // if (connection.StartBlock is ProcedureWPF) // { // procedure = connection.StartBlock as ProcedureWPF; // resourceWPF = connection.EndBlock as ResourceWPF; // } // else // { // procedure = connection.EndBlock as ProcedureWPF; // resourceWPF = connection.StartBlock as ResourceWPF; // } // Procedure block = null; // //если в первый раз такое встречаем // if (!(procedures.ContainsKey(procedure))) // { // block = procedure.BlockModel; // procedures.Add(procedure, block); // resultProcedures.Add(block); // } // else // block = procedures[procedure]; // Resource resource = null; ; // //если в первый раз такое встречаем // if (!(resources.ContainsKey(resourceWPF))) // { // resource = this.ConvertWpfResourceToModel(resourceWPF); // resources.Add(resourceWPF, resource); // //process.Resources.Add(resource); // WTF??? // } // else // resource = resources[resourceWPF]; // if (block is Procedure) // (block as Procedure).Resources.Add(resource); // else // throw new ArgumentException("Ресурсы поддерживает только блоки типа Procedure"); // } // } // simOptions.Procedures = resultProcedures; //} private void StartModeling_Executed(object sender, RoutedEventArgs e) { try { var tabs = testTabControl.Items.OfType <TabItem>().ToList(); var drawArea = tabs[0].Content as DrawArea; var proceduresConnections = drawArea.Children.OfType <ProcConnectionWPF>() .Where(x => x.startPoint == null || x.startPoint.ConnectType == ConnectPointWPF_Type.outPut) .ToList(); var backLinksConnections = drawArea.Children.OfType <ProcConnectionWPF>() .Where(x => x.startPoint != null && x.startPoint.ConnectType == ConnectPointWPF_Type.backOutput) .ToList(); var resourcesConnections = drawArea.Children.OfType <ResConnectionWPF>().ToList(); var procedures = drawArea.Children.OfType <ProcedureWPF>().ToList(); var resources = drawArea.Children.OfType <ResourceWPF>().ToList(); var resourcesDictionary = resourcesConnections .Select(x => new { Connection = x, Resource = x.StartBlock is ResourceWPF ? x.StartBlock as ResourceWPF : x.EndBlock as ResourceWPF, Procedure = x.StartBlock is ProcedureWPF ? x.StartBlock as ProcedureWPF : x.EndBlock as ProcedureWPF }) .GroupBy(x => x.Procedure) .ToDictionary(x => x.Key.BlockModel, x => x.Select(y => y.Resource).ToList()); var proceduresDictionary = proceduresConnections .Where(x => x.StartBlock as ProcedureWPF != null && x.EndBlock as ProcedureWPF != null) .Select(x => new { StartProcedure = x.StartBlock as ProcedureWPF, EndProcedure = x.EndBlock as ProcedureWPF }) .Select(x => new { Connection = new Connection() { Begin = x.StartProcedure.BlockModel, End = x.EndProcedure.BlockModel }, x.StartProcedure, x.EndProcedure }) .ToList(); var proceduresBackLinkDictionary = backLinksConnections .Select(x => new { StartProcedure = x.StartBlock as ProcedureWPF, EndProcedure = x.EndBlock as ProcedureWPF }) .Select(x => new { Connection = new Connection() { Begin = x.StartProcedure.BlockModel, End = x.EndProcedure.BlockModel }, x.StartProcedure, x.EndProcedure }) .ToList(); var allProcedures = new List <Procedure>(); allProcedures.AddRange(proceduresDictionary.SelectMany(x => new[] { x.Connection.Begin, x.Connection.End }).Cast <Procedure>()); allProcedures.AddRange(proceduresBackLinkDictionary.SelectMany(x => new[] { x.Connection.Begin, x.Connection.End }).Cast <Procedure>()); allProcedures.AddRange(resourcesDictionary.Keys.Select(x => x)); var totalProcedures = allProcedures.Distinct(); foreach (var procedure in totalProcedures) { procedure.Resources = resourcesDictionary.ContainsKey(procedure) ? resourcesDictionary[procedure].Select(res => res.ResourceModel).ToList() : new List <Resource>(); procedure.Inputs = proceduresDictionary.Where(x => x.EndProcedure.BlockModel == procedure).Select(x => x.Connection).ToList(); procedure.Outputs = proceduresDictionary.Where(x => x.StartProcedure.BlockModel == procedure).Select(x => x.Connection).ToList(); procedure.BackLinks = proceduresBackLinkDictionary.Where(x => x.StartProcedure.BlockModel == procedure).Select(x => x.Connection).ToList(); } var options = new SimulationOptions() { Procedures = totalProcedures .Cast <BaseProcedure>() .ToList() }; var simulator = new Simulator(); try { var results = simulator.Simulate(options); var successString = results.IsSuccess ? "успешно" : "неудачно"; string resultMsg = $"Моделирование завершено {successString}"; if (results.IsSuccess) { resultMsg += $"{Environment.NewLine}Время моделирования: {results.ModelingTime}"; foreach (var log in results.Logs.Where(log => !string.IsNullOrEmpty(log.Procedure.Name))) { resultMsg += $"{Environment.NewLine}===" + $"{Environment.NewLine}Процедура: {log.Procedure?.Name}" + $"{Environment.NewLine}Начало: {log.SimulationResult.StartTime}" + $"{Environment.NewLine}Продолжительность: {log.SimulationResult.Duration}" + $"{Environment.NewLine}Конец: {log.SimulationResult.EndTime}" + $"{Environment.NewLine}Входное качество: {(int)(log.SimulationResult.StartQuality * 100.0)}" + $"{Environment.NewLine}Выходное качество: {(int)(log.SimulationResult.ResultQuality * 100.0)}"; } var resultsWindow = new ResultWindow( results.ModelingTime.Value, resources.Select(x => x.ResourceModel.Cost).Sum(), results.Logs.Where(log => !string.IsNullOrEmpty(log.Procedure.Name)).ToArray() ); resultsWindow.Show(); } else { throw new Exception("Моделирование завершено неудачно"); } listBox1.Items.Clear(); } catch (Exception err) { MessageBox.Show(err.Message); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { foreach (var process in processes) { //process = new SimulationOptions(); } } }
public void execute_Monte_Carlo() { // instantiate common classes _simulationOptions = new SimulationOptions( 0, RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>(), false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); _source = new DirectionalPointSourceInput( new Position(0.0, 0.0, 0.0), new Direction(0.0, 0.0, 1.0), 1); _tissue = new MultiLayerWithSurfaceFiberTissueInput( new SurfaceFiberTissueRegion( new Position(0, 0, 0), _detectorRadius, // needs to match SurfaceFiberDetectorInput new OpticalProperties(0.01, 1.0, 0.8, 1.4) ), new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( new DoubleRange(0.0, 100.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), new LayerTissueRegion( new DoubleRange(100.0, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ); // tissue specification to verify MultiLayerWithSurfaceFiberTissue // increases reflectance. If use this tissue need to change FinalTissueRegion // for ALL detectors to 0 //new MultiLayerTissueInput( // new ITissueRegion[] // { // new LayerTissueRegion( // new DoubleRange(double.NegativeInfinity, 0.0), // new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), // new LayerTissueRegion( // new DoubleRange(0.0, 100.0), // new OpticalProperties(0.01, 1.0, 0.8, 1.4)), // new LayerTissueRegion( // new DoubleRange(100.0, double.PositiveInfinity), // new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) // } //); _detectorOpen = new List <IDetectorInput> { new SurfaceFiberDetectorInput() { Center = new Position(0, 0, 0), Radius = _detectorRadius, TallySecondMoment = true, N = 1.4, NA = 1.4, FinalTissueRegionIndex = 3 }, new ROfRhoDetectorInput() // 1mm wide ring to match fiber and 2 because beyond goes into 2nd { Rho = new DoubleRange(0.0, 2 * _detectorRadius, 3), // since tissue w fiber specified -> photon will be in 3 upon exit FinalTissueRegionIndex = 3, NA = 1.4, TallySecondMoment = true }, }; _detectorNA = new List <IDetectorInput> { new SurfaceFiberDetectorInput() { Center = new Position(0, 0, 0), Radius = _detectorRadius, TallySecondMoment = true, N = 1.4, FinalTissueRegionIndex = 3, NA = 0.39 }, new ROfRhoDetectorInput() // ring to match fiber detector { Rho = new DoubleRange(0.0, 2 * _detectorRadius, 3), // since tissue w fiber specified -> photon will be in 3 upon exit FinalTissueRegionIndex = 3, NA = 0.39, TallySecondMoment = true }, }; _detectorNAOffCenter = new List <IDetectorInput> { new SurfaceFiberDetectorInput() { Center = new Position(_detectorRadius, 0, 0), // diam = [0, 2*radius] Radius = _detectorRadius, TallySecondMoment = true, N = 1.4, FinalTissueRegionIndex = 3, NA = 1.4 }, new ROfRhoDetectorInput() // ring to match fiber detector { // place 1st rho bin center at _detectorRadius with width = 2*radius Rho = new DoubleRange(_detectorRadius / 2, 2 * _detectorRadius + _detectorRadius / 2, 3), // since tissue w fiber specified -> photon will be in 3 upon exit FinalTissueRegionIndex = 3, NA = 1.4, TallySecondMoment = true }, }; var _inputOpen = new SimulationInput( 100, "", _simulationOptions, _source, _tissue, _detectorOpen); _outputOpen = new MonteCarloSimulation(_inputOpen).Run(); var _inputNA = new SimulationInput( 100, "", _simulationOptions, _source, _tissue, _detectorNA); _outputNA = new MonteCarloSimulation(_inputNA).Run(); var _inputNAOffCenter = new SimulationInput( 100, "", _simulationOptions, _source, _tissue, _detectorNAOffCenter); _outputNAOffCenter = new MonteCarloSimulation(_inputNAOffCenter).Run(); }
public void execute_Monte_Carlo() { // delete previously generated files clear_folders_and_files(); var cylinderRadius = 5.0; var tissueThickness = 2.0; // instantiate common classes var simulationOptions = new SimulationOptions( 0, // reproducible RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List <DatabaseType>() { }, // databases to be written false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var source = new CustomCircularSourceInput( cylinderRadius - 0.01, // outer radius 0.0, // inner radius new FlatSourceProfile(), new DoubleRange(0.0, 0.0), // polar angle emission range new DoubleRange(0.0, 0.0), // azimuthal angle emission range new Direction(0, 0, 1), // normal to tissue new Position(0, 0, 0), // center of beam on surface new PolarAzimuthalAngles(0, 0), // no beam rotation 0); // 0=start in air, 1=start in tissue // debug with point source //var source = new DirectionalPointSourceInput( // new Position(0.0, 0.0, 0.0), // new Direction(0.0, 0.0, 1.0), // //new Direction(1/Math.Sqrt(2), 0.0, 1/Math.Sqrt(2)),// debug with 45 degree direction and g=1.0 // 1); // start inside tissue var detectors = new List <IDetectorInput> { new RSpecularDetectorInput(), new RDiffuseDetectorInput(), new ROfRhoDetectorInput() { Rho = new DoubleRange(0.0, cylinderRadius, 11) }, new TDiffuseDetectorInput(), new TOfRhoDetectorInput() { Rho = new DoubleRange(0.0, cylinderRadius, 11) }, new AOfRhoAndZDetectorInput() { Rho = new DoubleRange(0.0, cylinderRadius, 11), Z = new DoubleRange(0, tissueThickness, 11) }, new ATotalDetectorInput(), new ATotalBoundingVolumeDetectorInput() }; _inputBoundedTissue = new SimulationInput( 100, "", simulationOptions, source, new BoundingCylinderTissueInput( new CaplessCylinderTissueRegion( new Position(0, 0, tissueThickness / 2), cylinderRadius, tissueThickness, new OpticalProperties(0.0, 1e-10, 1.0, 1.4) ), new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( // note two layer and one layer give same results Yay! new DoubleRange(0.0, 1.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), // debug g=1.0 new LayerTissueRegion( new DoubleRange(1.0, tissueThickness), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), // debug g=1.0 new LayerTissueRegion( new DoubleRange(tissueThickness, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputBoundedTissue = new MonteCarloSimulation(_inputBoundedTissue).Run(); }
public PrTabViewModel(SimulationOptions simulationOptions) : base("ІПРАЙ") { var logger = Logger.New(typeof(PrTabViewModel)); using (logger.LogPerf("Init")) { m_SimulationOptions = simulationOptions; m_Simulator = new PrSimulator(m_SimulationOptions); m_VisualizationProvider = GridDataVisualizationProvider.Table(); m_Player = new Player(() => { using (logger.LogPerf("Step simulation")) { m_Simulator.SimulateSteps(); } }, () => { using (logger.LogPerf("Auto simulation")) { m_Simulator.SimulateSteps(5); } }, () => { UpdateVisualization.Execute().Subscribe(); }, TimeSpan.FromMilliseconds(10), DispatcherPriority.ContextIdle); UpdateVisualization = ReactiveCommand.Create(() => { using (logger.LogPerf("Visualization")) { Visualization = m_VisualizationProvider.ProvideVisualization(m_Simulator.GetData()); SimulationInfo = m_Simulator.SimulationInfo; } }); var notRunningOrPlaying = m_Player.WhenAny(x => x.RunningOrPlaying, r => !r.Value); var notSingleStepRunning = m_Player.WhenAny(x => x.SingleStepRunning, r => !r.Value); Step = ReactiveCommand.Create(() => { m_Player.StepOnce(); }, notRunningOrPlaying); PlayPause = new ReactivePlayPauseCommand("Програти", "Пауза", notSingleStepRunning); PlayPause.Subscribe(p => { if (p) { m_Player.Start(); } else { m_Player.Stop(); } }); Restart = ReactiveCommand.Create(() => { m_Simulator.Reset(); }, notRunningOrPlaying); Restart.InvokeCommand(UpdateVisualization); VisualTypeSelector = new ReactiveSelectorCommand <string>(x => (string)x, "Table"); VisualTypeSelector.Selected .Subscribe(option => { switch (option) { case "Table": m_VisualizationProvider = GridDataVisualizationProvider.Table(); break; case "2D": m_VisualizationProvider = GridDataVisualizationProvider.Color(); break; case "3D": m_VisualizationProvider = GridDataVisualizationProvider.Model3D(m_SimulationOptions.Size); break; } }); VisualTypeSelector.Selected .ToSignal() .InvokeCommand(UpdateVisualization); OpenSimulationOptions = ReactiveCommand.Create(() => { SimulationOptionsDialog dialog = new SimulationOptionsDialog(m_SimulationOptions); dialog.ShowDialog(); if (!dialog.DialogResult.GetValueOrDefault(false)) { return; } m_SimulationOptions = dialog.SimulationOptions; m_Simulator = new PrSimulator(m_SimulationOptions); m_VisualizationProvider = m_VisualizationProvider.Copy(m_SimulationOptions.Size); }, notRunningOrPlaying); OpenSimulationOptions .InvokeCommand(UpdateVisualization); ExportToCsv = ReactiveCommand.Create(() => { SaveFileDialog saveFileDialog = new SaveFileDialog() { Filter = "Файл CSV (*.csv)|*.csv" }; if (saveFileDialog.ShowDialog(Application.Current.MainWindow).GetValueOrDefault()) { CsvUtil.ExportToFile(m_Simulator.GetData(), saveFileDialog.FileName); } }); Settings.SettingsChange .InvokeCommand(UpdateVisualization); Settings.SettingsChange .Subscribe(_ => { Pallete = Settings.Current.VisualizationOptions.Pallete; }); Pallete = Settings.Current.VisualizationOptions.Pallete; } }
public void CopyTo(SimulationOptions other) { other.NumberOfParticles = this.m_NumberOfParticles; other.ParticleScale = this.m_ParticleScale; other.BerendsenThermostatCoupling = this.m_BerendsenThermostatCoupling; other.EquilibriumTemperature = this.m_EquilibriumTemperature; other.GradientScaleFactor = this.m_GradientScaleFactor; other.PotentialEnergy = this.m_PotentialEnergy; for (int i = 0; i < ParticleTypes.Count; i++) { ParticleTypes[i].CopyTo(other.ParticleTypes[i]); } }
public void LoadDefaults() { mode = "dataset"; loggingEnabled = false; simulationOptions = new SimulationOptions() { videoPort = 44209, webAPIPort = 44210, videoQuality = 60, selectedWaterContainer = "waterpool1", fixedDeltaTime = 0.001f, depthMapQuality = 90, depthMapScale = 0.1f, videoFeedQuality = 90, videoFeedScale = 0.5f }; datasetOptions = new DatasetOptions() { selectedWaterContainer = "waterpool1", classDetectedFrameNum = 11, classMultipleFrameNum = 11, classBlankFrameNum = 11, classObstacleFrameNum = 11, minVisibleMultipleObjectsNum = 2, minCameraDistanceToObject = 0, maxCameraDistanceToObject = 30, minObjectFill = .01f, minObjectColorPercentVisible = 0.15f, checkFogVisibility = true, percentClosest = 0.05f, closestMaxDistanceOffset = 2f, objectFillOffset = .01f, overrideDataset = true, datasetDirPath = "dataset", cameraLookAtObjectPitchOffset = 30, cameraLookAtObjectYawOffset = 30, cameraLookAtObjectRollOffset = 30, cameraLookRandomlyPitchOffset = 45, cameraLookRandomlyRollOffset = 45, testPointsNum = 1000 }; datasetOptions.graphicsOptions = new GraphicsOptions() { fogEnabled = true, randomizeFogDensity = true, fogDensity = 0.15f, fogColorRandomized = true, fogColor = new List <float>() { 0f, 0.64f, 1f }, cameraBackgroundColor = new List <float>() { 0f, 0.64f, 1f }, bloomIntensity = 1.89f, ambientOcclusionIntensity = 0.26f, mixerRedOutRedIn = 62, mixerGreenOutGreenIn = 100, mixerBlueOutBlueIn = 100, grainIntesity = 0.3f, randomizeLightIntesity = true, lightIntesity = 1f, ambientLightColor = new List <float>() { 0f, 0.64f, 1f }, ambientLightIntesity = 0.1f, cameraFocalLength = 2.550718f, cameraSensorSize = new List <float>() { 4.8f, 3.6f } }; datasetOptions.debugOptions = new DatasetOptions.DebugOptions() { drawDetectionRect = true, drawPostProcessDebug = false, disableScreenshot = false, logDetection = true }; //TODO }