Esempio n. 1
0
        public override NumericalText GetData()
        {
            NumericalText nt = new NumericalText();

            if (AppSettings.Output.OUTPUT_PROCESSED.Item)
            {
                List <DataPoint> dps   = GetHistoCoords();
                List <string>    names = Data.Keys.ToList();
                List <double>    xs    = new List <double> ();
                List <double>    ys    = new List <double> ();

                foreach (DataPoint dp in dps)
                {
                    xs.Add(dp.X);
                    ys.Add(dp.Y);
                }

                nt.Titles.Add("Groups");
                nt.Titles.Add(lineName + "_X");
                nt.Titles.Add(lineName + "_Y");
                nt.Tags.Add(names);
                nt.Data.Add(xs);
                nt.Data.Add(ys);
            }
            else
            {
                foreach (KeyValuePair <string, List <double> > kvp in Data)
                {
                    nt.Titles.Add(kvp.Key);
                    nt.Data.Add(kvp.Value);
                }
            }

            return(nt);
        }
Esempio n. 2
0
        public override NumericalText GetData()
        {
            NumericalText nt = new NumericalText();

            if (AppSettings.Output.OUTPUT_PROCESSED.Item)
            {
                nt.Titles.Add(this.lineName + "_X");
                nt.Titles.Add(this.lineName + "_Y");
                List <DataPoint> dps = GetHistoCoords();
                List <double>    xs  = new List <double> ();
                List <double>    ys  = new List <double> ();
                foreach (DataPoint dp in dps)
                {
                    xs.Add(dp.X);
                    ys.Add(dp.Y);
                }
                nt.Data.Add(xs);
                nt.Data.Add(ys);
            }
            else
            {
                nt.Titles.Add(this.lineName);
                nt.Data.Add(data);
            }
            return(nt);
        }
Esempio n. 3
0
        public override NumericalText GetData()
        {
            NumericalText nextDat = new NumericalText();

            foreach (DoublesHisto dh in histos)
            {
                nextDat.Merge(dh.GetData());
            }
            return(nextDat);
        }
Esempio n. 4
0
        public override NumericalText GetData()
        {
            if (AppSettings.Output.OUTPUT_PROCESSED.Item)
            {
                NumericalText nt      = base.GetData();
                List <double> rankpos = new List <double> ();

                for (int i = 1; i <= DivSize; i++)
                {
                    rankpos.Add(i);
                }
                nt.Data.Insert(0, rankpos);
                nt.Titles.Insert(0, "Division");

                return(nt);
            }
            else
            {
                return(base.GetData());
            }
        }
Esempio n. 5
0
        protected void OnSaveRSPContainer(object sender, EventArgs e)
        {
            NumericalText currentData = RSPGetNumericalText();

            if (currentData != null)
            {
                FileChooserDialog saveIt = new FileChooserDialog(
                    "Where should the Rank/Split Output be saved?..",
                    this,
                    FileChooserAction.Save,
                    "Cancel", ResponseType.Cancel,
                    "Open", ResponseType.Accept);

                if (saveIt.Run() == (int)ResponseType.Accept)
                {
                    ProcessingClass.WriteDataFile(saveIt.Filename, currentData);
                }

                saveIt.Destroy();
            }
        }
Esempio n. 6
0
        public override NumericalText GetData()
        {
            NumericalText nt = new NumericalText();

            if (!AppSettings.Output.OUTPUT_PROCESSED.Item)
            {
                nt.Titles.Add(lineName);
                nt.Data.Add(processed);
            }
            else
            {
                int inc = 1;
                foreach (List <double> ldbl in data)
                {
                    nt.Titles.Add(lineName + "_div" + inc);
                    nt.Data.Add(ldbl);
                    inc++;
                }
            }

            return(nt);
        }
Esempio n. 7
0
        protected void OnSaveText(object sender, EventArgs e)
        {
            GraphWindow win = (GraphWindow)graphNoteBook.CurrentPage;

            NumericalText currentData = gWindows [win].GetData();

            if (currentData != null)
            {
                FileChooserDialog saveIt = new FileChooserDialog(
                    "Where should the data be saved?..",
                    this,
                    FileChooserAction.Save,
                    "Cancel", ResponseType.Cancel,
                    "Open", ResponseType.Accept);

                if (saveIt.Run() == (int)ResponseType.Accept)
                {
                    ProcessingClass.WriteDataFile(saveIt.Filename, currentData);
                }

                saveIt.Destroy();
            }
        }
Esempio n. 8
0
 public void Merge(NumericalText txt)
 {
     Titles.AddRange(txt.Titles);
     Data.AddRange(txt.Data);
     Tags.AddRange(txt.Tags);
 }
Esempio n. 9
0
        public static void WriteDataFile(string fileName, NumericalText nt)
        {
            if (((nt.Data != null) && (nt.Data.Count > 0)) || ((nt.Tags != null) && (nt.Tags.Count > 0)))
            {
                int                 useLen         = Math.Min(nt.Titles.Count, (nt.Data.Count + nt.Tags.Count));
                int                 dataLen        = nt.Data [0].Count;
                List <int>          counts         = new List <int> ();
                List <int>          currentIndexes = new List <int> ();
                List <PrintOutNext> printTypes     = new List <PrintOutNext> ();

                if (nt.Tags != null)
                {
                    int tagInd = 0;
                    foreach (List <string> sl in nt.Tags)
                    {
                        counts.Add(sl.Count - 1);
                        printTypes.Add(PrintOutNext.Tag);
                        dataLen = Math.Max(dataLen, sl.Count);
                        currentIndexes.Add(tagInd);
                        tagInd++;
                    }
                }
                if (nt.Data != null)
                {
                    int datInd = 0;
                    foreach (List <Double> ld in nt.Data)
                    {
                        counts.Add(ld.Count - 1);
                        printTypes.Add(PrintOutNext.Data);
                        dataLen = Math.Max(dataLen, ld.Count);
                        currentIndexes.Add(datInd);
                        datInd++;
                    }
                }

                using (StreamWriter sw = new StreamWriter(fileName)) {
                    for (int i = 0; i < useLen; i++)
                    {
                        if (i > 0)
                        {
                            sw.Write("\t");
                        }
                        sw.Write(nt.Titles [i]);
                    }
                    sw.Write("\n");

                    for (int j = 0; j < dataLen; j++)
                    {
                        for (int i = 0; i < useLen; i++)
                        {
                            if (i > 0)
                            {
                                sw.Write("\t");
                            }
                            if (counts [i] >= j)
                            {
                                if (printTypes [i] == PrintOutNext.Data)
                                {
                                    sw.Write(nt.Data [currentIndexes[i]] [j]);
                                }
                                else
                                {
                                    sw.Write(nt.Tags [currentIndexes [i]] [j]);
                                }
                            }
                            else
                            {
                                sw.Write("x");
                            }
                        }
                        sw.Write("\n");
                    }
                }
                MainData.UpdateLog("Saved " + MainData.MainWindow.MaxLenString(fileName, 20), false);
            }
            else
            {
                MainData.ShowMessageWindow("There isn't any data there to save!", false);
            }
        }