Beispiel #1
0
        private async Task <bool> ProvideAdditionalApproximation(Wave[] waves)
        {
            m_AdditionalApproximation = new AdditionalApproximation();
            m_AproximatedWavePoints   = null;

            List <Wave> fit_waves = waves.ToList();

            if (m_SysConf.UseBetterStatistic == true)
            {
                var waveSet = Averaging.GenerateWaveInRangeUniform(m_SysConf.waveLimits.min.lambda, m_SysConf.waveLimits.max.lambda, WAVE_COUNT);

                Computation computation_engine = null;


                computation_engine = computation_engine = new Computation(ref m_SysConf, waveSet);

                computation_engine.Title          = "XRay-tracing. Additional lines.";
                computation_engine.WaveProcessed += new EventHandler <Wave>((obj, wave) =>
                {
                    var index = -1;
                    for (int i = 0; i < waveSet.Length; ++i)
                    {
                        if (waveSet[i].lambda == wave.lambda && waveSet[i].intensity == wave.intensity)
                        {
                            index = i;
                            break;
                        }
                    }
                    if (index < waveSet.Length && index >= 0)
                    {
                        waveSet[index].Efficiency = wave.Efficiency;
                        waveSet[index].Emited     = wave.Emited;
                        waveSet[index].Reflected  = wave.Reflected;
                    }
                });

                this.IsEnabled = false;

                computation_engine.Show();

                var res = await computation_engine.StartXRayTracing();

                computation_engine.Close();

                this.IsEnabled = true;

                string detectorFile = "results/Order_0/Detector.dmp";
                var    a_Detector   = new Detector();
                await Task.Factory.StartNew(() => a_Detector.ReadDetectorPlane(detectorFile));

                await Task.Factory.StartNew(() => SetLinesMagnification(waveSet, a_Detector));

                fit_waves.AddRange(waveSet);
            }

            m_AdditionalApproximation.MakeFitEfficiency(fit_waves.ToArray());
            m_AdditionalApproximation.MakeFitMagnification(fit_waves.ToArray());

            m_AproximatedWavePoints = m_AdditionalApproximation.GetApproximatedPoint(waves);

            return(true);
        }