private void SaveToCSV(object state) { selChanObj = new selectChannel("dump"); List<int> streamID = new List<int>(); //double[][] dataOut = new double[Globals.channelsSelected.Count][]; //string[][] parNames = new string[Globals.channelsSelected.Count][]; Dictionary<string, double[]> dataOut = new Dictionary<string,double[]>(); int streamCnt = 0; foreach (int stream in Globals.channelsSelected.Keys) { if (Globals.channelsSelected[stream].Count != 0) { streamID.Add(stream); foreach (string parName in Globals.channelsSelected[stream]) { dataOut[parName] = DataComparer.LoadTempData(stream,parName,"reduced");//new double[65536]; } } } DataComparer.SaveToCSV(dataOut); }
private void GetNewGraph(object state) { try { //GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); if (checkBox6.Checked) { //ThreadPool.QueueUserWorkItem(new WaitCallback(getUDPPayloads)); Thread tSave = null; tSave = new Thread(() => getUDPPayloads(tSave.ThreadState)); tSave.Name = String.Format("Saving_DATA_Thread_{0}", DateTime.Now.ToString()); tSave.Priority = ThreadPriority.Highest; tSave.IsBackground = true; tSave.Start(); return; } if (checkBox7.Checked) selChanObj = new selectChannel("from dump"); else selChanObj = new selectChannel(); List<int> streamID = new List<int>(); foreach (int stream in Globals.channelsSelected.Keys) { if (Globals.channelsSelected[stream].Count != 0) { streamID.Add(stream); } } // Declare a new argument object. //ThreadInfo threadInfo = new ThreadInfo(); //threadInfo.FileName = "file.txt"; //threadInfo.SelectedIndex = 3; // Send the custom object to the threaded method. //ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object state) { // new PlotData(streamID).ShowDialog();})); Thread t1 = null; if (Globals.useDumpFiles) t1 = new Thread(() => new PlotData(streamID, "dumpFile").ShowDialog()); else t1 = new Thread(() => new PlotData(streamID).ShowDialog()); t1.Name = DateTime.Now.ToString(); t1.Priority = ThreadPriority.Highest; t1.IsBackground = true; t1.Start(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void GetNewGraph() { try { //GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); if (checkBox6.Checked) { ThreadPool.QueueUserWorkItem(new WaitCallback(getUDPPayloads)); } if (checkBox7.Checked) selChanObj = new selectChannel("from dump"); else selChanObj = new selectChannel(); //GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); // TODO parallel streams ? //Parallel.ForEach(Globals.channelsSelected, kvp => //{ // if (Globals.channelsSelected[kvp.Key].Count != 0) // { // GraphPlot = new PlotData(kvp.Key); // GraphPlot.SuspendLayout(); // GraphPlot.ResumeLayout(false); // GraphPlot.ShowDialog(); // } //}); List<int> streamID = new List<int>(); foreach (int stream in Globals.channelsSelected.Keys) { if (Globals.channelsSelected[stream].Count != 0) { streamID.Add(stream); } } // Declare a new argument object. //ThreadInfo threadInfo = new ThreadInfo(); //threadInfo.FileName = "file.txt"; //threadInfo.SelectedIndex = 3; // Send the custom object to the threaded method. //ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object state) { // new PlotData(streamID).ShowDialog();})); Thread t1 = null; if (Globals.useDumpFiles) t1 = new Thread(() => new PlotData(streamID, "dumpFile").ShowDialog()); else t1 = new Thread(() => new PlotData(streamID).ShowDialog()); t1.Priority = ThreadPriority.Highest; t1.IsBackground = true; t1.Start(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void Draw_FFT(object state) { //GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); selChanObj = new selectChannel("dump"); List<int> streamID = new List<int>(); foreach (int stream in Globals.channelsSelected.Keys) { if (Globals.channelsSelected[stream].Count != 0) { streamID.Add(stream); } } double[] parameter1 = null; double[] parameter2 = null; int c = 0; foreach (int stream in Globals.channelsSelected.Keys) { foreach (string parName in Globals.channelsSelected[stream]) { if (c == 0) { parameter1 = DataComparer.LoadTempData(stream, parName); c++; } else if (c == 1) { parameter2 = DataComparer.LoadTempData(stream, parName); c++; } } } Double[] Out = null;// new double[parameter2.Length]; Out = DataComparer.getRatio(parameter1, parameter2); double correlation = DataComparer.Correlation(parameter1, parameter2); parameter1 = null; parameter2 = null; var msg = String.Format("Correlation is equal to {0}", correlation); MessageBox.Show(msg); LogItems.addStreamInfo(msg); PlotData plot = new PlotData(Out,streamID);//.ShowDialog(); DialogResult thisPlot = plot.ShowDialog(); if (thisPlot != DialogResult.OK) { Out = null; } //GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); plot.Dispose(); }