示例#1
0
        private void CutOffFunction_Click(object sender, EventArgs e) // COS TUTAJ NIE GRA
        {
            CutoffSaver.ShowDialog();
            int Max = 0;

            for (int i = 1; i < InteferogramData.Count(); i++)
            {
                CutoffAll.Add(DA.CutoffFunction(InteferogramData[i], double.Parse(CutoffTB.Text), int.Parse(IgnoredColumnsForInteferometer.Text)));
                Max = DA.MaximumsCounter(CutoffAll[i - 1]);
                using (StreamWriter SW = new StreamWriter(CutoffSaver.FileName + " Inteferometer", true))
                {
                    for (int j = 0; j < int.Parse(IgnoredColumnsForInteferometer.Text); j++)
                    {
                        SW.Write(InteferogramData[i][j] + " ");
                    }
                    SW.Write(i + " " + Max + " " + DA.MaximumsUncertainty(Max) + Environment.NewLine);
                    SW.Flush();
                }
            }
        }
示例#2
0
        private void CutoffTest_Click(object sender, EventArgs e)
        {
            CutoffSaver.ShowDialog();
            string line;
            double Max;
            int    CounterOfMax = 0;
            List <List <double> > ReadDataInDoubles = new List <List <double> >();

            string[]      Test;
            int           i;
            List <string> StringList = new List <string>();
            List <double> DoubleList = new List <double>();
            Stopwatch     stopwatch  = new Stopwatch();

            stopwatch.Start();
            using (FileStream FS = File.Open(InteferometerPathway.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (BufferedStream BS = new BufferedStream(FS))
                {
                    using (StreamReader SR = new StreamReader(BS))
                    {
                        while ((line = SR.ReadLine()) != null)
                        {
                            StringList = Regex.Split(line, FileSeparator.Text).ToList();
                            for (i = int.Parse(IgnoredColumnsForInteferometer.Text); i < StringList.Count - 1; i++)
                            {
                                DoubleList.Add(double.Parse(StringList[i]));
                            }
                            ReadDataInDoubles.Add(DoubleList);
                            if (ReadDataInDoubles.Count > 100)
                            {
                                for (int k = 0; k < 100; k++)
                                {
                                    Max          = ReadDataInDoubles[k].Max();
                                    CounterOfMax = 0;
                                    for (int j = 0; j < ReadDataInDoubles[k].Count; j++)
                                    {
                                        if (ReadDataInDoubles[k][j] < (double.Parse(CutoffTB.Text) / 100) * Max)
                                        {
                                            ReadDataInDoubles[k][j] = 0;
                                        }
                                        if (j > 1 && ReadDataInDoubles[k][j] - ReadDataInDoubles[k][j - 1] == 0)
                                        {
                                            CounterOfMax++;
                                        }
                                    }
                                    using (StreamWriter SW = new StreamWriter(CutoffSaver.FileName + " Inteferometer", true))
                                    {
                                        SW.Write(k + " " + stopwatch.ElapsedMilliseconds + " " + i + Environment.NewLine);
                                        SW.Flush();
                                    }
                                }

                                ReadDataInDoubles.Clear();
                            }
                            //DoubleList = new List<double>();
                            //StringList = new List<string>();
                        }
                    }
                }
            }
            stopwatch.Stop();
            MessageBox.Show("" + stopwatch.ElapsedMilliseconds + " " + ReadDataInDoubles[1].Count);
        }