Ejemplo n.º 1
0
        private void MakeReflectivity()
        {
            //Fill Rho array
            try
            {
                ReflCalc.IsOneSigma          = Holdsigma.Checked;
                ReflCalc.ZOffset             = 25;
                ReflCalc.GetSubRoughness     = SubRough.ToDouble();
                ReflCalc.BoxCount            = BoxCount.ToInt();
                ReflCalc.SubphaseSLD         = SubphaseSLD.ToDouble();
                ReflCalc.SuperphaseSLD       = SupSLDTB.ToDouble();
                ReflCalc.HighQOffset         = Rightoffset.ToInt();
                ReflCalc.LowQOffset          = CritOffset.ToInt();
                ReflCalc.NormalizationFactor = NormCorrectTB.ToDouble();
                ReflCalc.ImpNormCB           = ImpNormCB.Checked;
                ReflCalc.QSpreadTB           = QSpreadTB.ToDouble();
                //Blank our Rho data from the previous iteration
                ReflCalc.RhoArray.Clear();
                ReflCalc.LengthArray.Clear();
                ReflCalc.SigmaArray.Clear();

                RhoArray.ForEach(p => ReflCalc.RhoArray.Add(p.ToDouble()));
                LengthArray.ForEach(p => ReflCalc.LengthArray.Add(p.ToDouble()));
                SigmaArray.ForEach(p => ReflCalc.SigmaArray.Add(p.ToDouble()));

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

                ReflCalc.UpdateProfile();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Ejemplo n.º 2
0
 private void LowQ_TextChanged(object sender, EventArgs e)
 {
     ReflGraphing.GetLowQOffset = CritOffset.ToInt();
     ReflGraphing.SetBounds();
 }
Ejemplo n.º 3
0
        private void GetConstraints()
        {
            ReflCalc.HighQOffset = Rightoffset.ToInt();
            ReflCalc.LowQOffset  = CritOffset.ToInt();

            int arrayconst = 2;
            int holdcount  = 0;

            if (SubRoughCB.Checked || SubRoughCB.Checked)
            {
                holdcount++;
            }

            //Check if any holds have been set
            Action <CheckBox> f = p => { if (p.Checked)
                                         {
                                             holdcount++;
                                         }
            };

            HoldRhoArray.ForEach(f);
            HoldSigmaArray.ForEach(f);
            HoldLengthArray.ForEach(f);

            //Setup all of our constraints if true, if it has been uninitialized,
            if (ConstrForm.Initialized || holdcount > 0)
            {
                if (!ReflCalc.IsOneSigma)
                {
                    arrayconst = 3;
                }

                ReflCalc.UL = new double[2 + arrayconst * ReflCalc.BoxCount];
                ReflCalc.LL = new double[2 + arrayconst * ReflCalc.BoxCount];
                int ULLength = ReflCalc.UL.Length;

                //Set the subphase constraints
                if (SubRoughCB.Checked)
                {
                    ReflCalc.UL[0] = SubRough.ToDouble();
                    ReflCalc.LL[0] = SubRough.ToDouble();
                }
                else if (!ConstrForm.Initialized)
                {
                    ReflCalc.UL[0] = 10000;
                    ReflCalc.LL[0] = -10000;
                }
                else
                {
                    ReflCalc.UL[0] = ConstrForm.SubRoughMax;
                    ReflCalc.LL[0] = ConstrForm.SubRoughMin;
                }

                //Set the Normalization const
                if (NormCB.Checked)
                {
                    ReflCalc.UL[ULLength - 1] = NormCorrectTB.ToDouble();
                    ReflCalc.LL[ULLength - 1] = NormCorrectTB.ToDouble();
                }
                else if (!ConstrForm.Initialized)
                {
                    ReflCalc.UL[ULLength - 1] = 10000;
                    ReflCalc.LL[ULLength - 1] = -10000;
                }
                else
                {
                    ReflCalc.UL[ULLength - 1] = ConstrForm.NormMax;
                    ReflCalc.LL[ULLength - 1] = ConstrForm.NormMin;
                }

                for (int i = 0; i < ReflCalc.BoxCount; i++)
                {
                    //Check for constraints
                    if (ConstrForm.Initialized)
                    {
                        ReflCalc.UL[arrayconst * i + 1] = ConstrForm.ThickHighArray[i];
                        ReflCalc.LL[arrayconst * i + 1] = ConstrForm.ThickLowArray[i];

                        if (!m_bUseSLD)
                        {
                            ReflCalc.UL[arrayconst * i + 2] = ConstrForm.RhoHighArray[i];
                            ReflCalc.LL[arrayconst * i + 2] = ConstrForm.RhoLowArray[i];
                        }
                        else
                        {
                            if (ReflCalc.SubphaseSLD > 0)
                            {
                                ReflCalc.UL[arrayconst * i + 2] = ConstrForm.RhoHighArray[i] / ReflCalc.SubphaseSLD;
                                ReflCalc.LL[arrayconst * i + 2] = ConstrForm.RhoLowArray[i] / ReflCalc.SubphaseSLD;
                            }
                            else
                            {
                                ReflCalc.LL[arrayconst * i + 2] = ConstrForm.RhoHighArray[i] / ReflCalc.SubphaseSLD;
                                ReflCalc.UL[arrayconst * i + 2] = ConstrForm.RhoLowArray[i] / ReflCalc.SubphaseSLD;
                            }
                        }
                        if (!Holdsigma.Checked)
                        {
                            ReflCalc.UL[arrayconst * i + 3] = ConstrForm.SigmaHighArray[i];
                            ReflCalc.LL[arrayconst * i + 3] = ConstrForm.SigmaLowArray[i];
                        }
                    }
                    else
                    {
                        ReflCalc.UL[arrayconst * i + 2] = ReflCalc.UL[arrayconst * i + 1] = 10000;
                        ReflCalc.LL[arrayconst * i + 2] = ReflCalc.LL[arrayconst * i + 1] = -10000;

                        if (!Holdsigma.Checked)
                        {
                            ReflCalc.UL[arrayconst * i + 3] = 10000;
                            ReflCalc.LL[arrayconst * i + 3] = -10000;
                        }
                    }
                    //Check for holds - holds take precedence over constraints
                    if (HoldLengthArray[i].Checked)
                    {
                        ReflCalc.LL[arrayconst * i + 1] = ReflCalc.UL[arrayconst * i + 1] = LengthArray[i].ToDouble();
                    }
                    if (HoldRhoArray[i].Checked)
                    {
                        ReflCalc.LL[arrayconst * i + 2] = ReflCalc.UL[arrayconst * i + 2] = RhoArray[i].ToDouble();
                    }
                    if (HoldSigmaArray[i].Checked && !Holdsigma.Checked)
                    {
                        ReflCalc.LL[arrayconst * i + 3] = ReflCalc.UL[arrayconst * i + 3] = SigmaArray[i].ToDouble();
                    }
                }
            }
            else
            {
                ReflCalc.UL = null;
                ReflCalc.LL = null;
            }
        }