示例#1
0
        /// <summary>
        /// This routine updates our frontend. All updates are performed in a threadsafe manner, as the
        /// stochastic methods can take place on a separate thread
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ReflCalc_Update(object sender, EventArgs e)
        {
            //Necessary due to the possibility of updating from a separate thread (such as stochastic fitting). Otherwise, events are fired which reset some of the values
            //below. A lock isn't necessary this isn't necessarilly a race condition
            m_isupdating = true;

            SubRough.ThreadSafeSetText(ReflCalc.GetSubRoughness.ToString());

            if (ReflCalc.ImpNormCB)
            {
                NormCorrectTB.ThreadSafeSetText(ReflCalc.NormalizationFactor.ToString());
            }

            Holdsigma.ThreadSafeChecked(ReflCalc.IsOneSigma);
            BoxCount.ThreadSafeSetText(ReflCalc.BoxCount.ToString());
            ImpNormCB.ThreadSafeChecked(ReflCalc.ImpNormCB);

            //Blank our Rho data from the previous iteration
            for (int i = 0; i < RhoArray.Count; i++)
            {
                if (!m_bUseSLD)
                {
                    RhoArray[i].ThreadSafeSetText(ReflCalc.RhoArray[i].ToString());
                }
                else
                {
                    RhoArray[i].ThreadSafeSetText((ReflCalc.RhoArray[i] / ReflCalc.SubphaseSLD).ToString());
                }

                LengthArray[i].ThreadSafeSetText(ReflCalc.LengthArray[i].ToString());
                SigmaArray[i].ThreadSafeSetText(ReflCalc.SigmaArray[i].ToString());
            }

            if (Holdsigma.Checked)
            {
                ChangeRoughnessArray();
            }

            if (m_bmodelreset)
            {
                ReflGraphing.Clear();
                ReflGraphing.LoadDatawithErrorstoGraph("Reflectivity Data", Color.Black, SymbolType.Circle, 5, ReflData.Instance.GetQData, ReflData.Instance.GetReflData);
                m_bmodelreset = false;
            }

            GreyFields();
            //Update graphs
            RhoGraphing.Pane.XAxis.Scale.Min = 0;
            RhoGraphing.Pane.XAxis.Scale.Max = ReflCalc.Z[ReflCalc.Z.Length - 1];

            ReflGraphing.LoadfromArray("modelrefl", ReflData.Instance.GetQData, ReflCalc.ReflectivityMap, System.Drawing.Color.Black, SymbolType.XCross, 4, true, string.Empty);
            RhoGraphing.LoadfromArray("Model Dependent Fit", ReflCalc.Z, ReflCalc.ElectronDensityArray, System.Drawing.Color.Turquoise, SymbolType.None, 0, true, string.Empty);
            RhoGraphing.LoadfromArray("Model Dependent Box Fit", ReflCalc.Z, ReflCalc.BoxElectronDensityArray, System.Drawing.Color.Red, SymbolType.None, 0, false, string.Empty);

            chisquaretb.ThreadSafeSetText(ReflCalc.MakeChiSquare().ToString());
            FitnessScoreTB.ThreadSafeSetText(ReflCalc.MakeFitnessScore().ToString());

            m_isupdating = false;
        }
示例#2
0
        private void UpdateProfile(object sender, EventArgs e)
        {
            Zoffset.Text  = RhoCalc.ZOffset.ToString();
            SubRough.Text = RhoCalc.GetSubRoughness.ToString();

            //Update our Rho data from the previous iteration
            for (int i = 0; i < BoxRhoArray.Count; i++)
            {
                BoxRhoArray[i].Text    = RhoCalc.RhoArray[i].ToString();
                BoxSigmaArray[i].Text  = RhoCalc.SigmaArray[i].ToString();
                BoxLengthArray[i].Text = RhoCalc.LengthArray[i].ToString();
            }

            chisquaretb.ThreadSafeSetText(RhoCalc.MakeChiSquare().ToString());
            FitnessScoreTB.ThreadSafeSetText(RhoCalc.MakeFitnessScore().ToString());

            m_gRhoGraphing.LoadfromArray("Model Dependent Fit", RhoCalc.Z, RhoCalc.ElectronDensityArray, System.Drawing.Color.Turquoise, SymbolType.None, 0, true, string.Empty);
            m_gRhoGraphing.LoadfromArray("Model Dependent Box Fit", RhoCalc.Z, RhoCalc.BoxElectronDensityArray, System.Drawing.Color.Red, SymbolType.None, 0, false, string.Empty);
        }