void OpenReportNode(string filename, OutputReaderBase reader)
        {
            ReportNode rp = new ReportNode(this, filename, reader, fullNameToolStripMenuItem.Checked);

            rp.UpdatedProgess += new ProgressHandler(rp_UpdatedProgess);
            this.treeView1.Nodes.Add(rp);
        }
        public override List <NextGenLab.Chart.ChartData> OnPlot(ReportNode rp)
        {
            string str = "";

            switch (rmstype)
            {
            case RMSType.Simple:
                PrintRMS rms = new PrintRMS();
                str = rms.Print(this.Name, rp.GetPlot(this.Name));

                break;

            case RMSType.SNRfromRMS:
                List <double> chxaxis = rp.GetPlot(xaxis);
                List <double> chyaxis = rp.GetPlot(yaxis);

                PrintSnrFromRMS psrm = new PrintSnrFromRMS(0, "");
                str = psrm.Print(xaxis, chxaxis, yaxis, chyaxis);
                break;
            }

            MessageBox.Show(str);

            return(new List <ChartData>());
        }
Beispiel #3
0
        public override List <ChartData> OnPlot(ReportNode rp)
        {
            PlotType = this.Name;
            List <ChartData> cds = new List <ChartData>();
            ChartData        cd  = ChartData.GetInstance();

            List <double> time   = rp.GetPlot(rp.DefaultXAxis);
            List <double> values = rp.GetPlot(this.Name);

            cd.TitlesY = new string[] { this.Name };

            if (time != null && time.Count == values.Count)
            {
                cd.TitleX     = rp.DefaultXAxis;
                cd.AxisLabelX = "[s]";
                cd.X          = time.ToArray();
            }
            else
            {
                cd.TitleX = "Sample";
                double[] x = new double[values.Count];
                for (int i = 0; i < x.Length; i++)
                {
                    x[i] = i;
                }
                cd.AxisLabelX = "[n]";
                cd.X          = x;
            }

            cd.Y = new double[][] { values.ToArray() };

            cds.Add(cd);
            return(cds);
        }
        public override List <ChartData> OnPlot(ReportNode rp)
        {
            PlotType = xaxis + " VS DERIV(" + yaxis + ")";

            List <ChartData> cds = new List <ChartData>();

            ChartData cd = ChartData.GetInstance();

            cd.TitlesY = new string[] { "d(" + yaxis + ")/dx:" };

            List <double> chxaxis = rp.GetPlot(xaxis);
            List <double> chyaxis = rp.GetPlot(yaxis);

            double[] deriv = new double[chxaxis.Count - 1];
            for (int i = 0; i < deriv.Length; i++)
            {
                deriv[i] = (chyaxis[i + 1] - chyaxis[i]) / (chxaxis[i + 1] - chxaxis[i]);
            }
            double[] xvals = new double[deriv.Length];
            chxaxis.CopyTo(0, xvals, 0, deriv.Length);

            cd.TitleX = xaxis;

            cd.X = xvals;

            cd.Y = new double[][] { deriv };
            cds.Add(cd);
            return(cds);
        }
Beispiel #5
0
 public SingleFFTPlot(ReportNode rp) : base(rp)
 {
     fs = 1;
     AddMenuItem("Frequency", "Spectral Density", delegate { Plot(); });
     AddMenuItem("Frequency", "Spectral Density [fs]", delegate
     {
         InputFormBase ifb = InputFormFactory.GetInstance("Sampling Frequency",
                                                          "Sampling Frequency(Fs)");
         if (ifb.ShowDialog() == DialogResult.OK)
         {
             this.fs = ifb.Values["Sampling Frequency(Fs)"];
             Plot();
         }
     }
                 );
     AddMenuItem("Frequency", "Spectral Density [fs,A]", delegate
     {
         InputFormBase ifb = InputFormFactory.GetInstance("SD Parameters",
                                                          "Sampling Frequency(Fs)", "Max Signal Amplitude(A0)");
         if (ifb.ShowDialog() == DialogResult.OK)
         {
             this.fs            = ifb.Values["Sampling Frequency(Fs)"];
             this.max_amplitude = ifb.Values["Max Signal Amplitude(A0)"];
             Plot();
         }
     }
                 );
 }
Beispiel #6
0
        void AddAll(ReportNode rn)
        {
            List <List <double> > ml = new List <List <double> >();
            DataGridViewColumn    dc;

            List <double> dl;
            int           max = 0;

            foreach (string s in rn.PlotKeys)
            {
                dc            = new DataGridViewTextBoxColumn();
                dc.HeaderText = s;
                dc.ReadOnly   = true;
                dl            = rn.GetPlot(s);
                if (max < dl.Count)
                {
                    max = dl.Count;
                }
                ml.Add(dl);
                dc.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                this.dataGridView1.Columns.Add(dc);
            }


            object[] da;
            for (int i = 0; i < max; i++)
            {
                da = new object[ml.Count];
                for (int z = 0; z < ml.Count; z++)
                {
                    da[z] = ml[z][i];
                }
                this.dataGridView1.Rows.Add(da);
            }
        }
        public override List <ChartData> OnPlot(ReportNode rp)
        {
            List <ChartData> cds = new List <ChartData>();

            PlotType = "Plot (";
            foreach (string s in selectedkeys)
            {
                PlotType += s + ",";
            }
            PlotType  = PlotType.Remove(PlotType.Length - 1);
            PlotType += ")";


            if (selectedkeys == null || selectedkeys.Count < 1)
            {
                return(null);
            }
            ChartData cd = ChartData.GetInstance();

            cd.Title   = "";
            cd.TitlesY = selectedkeys.ToArray();
            cd.TitleX  = "Sample";

            double[][] yval      = new double[selectedkeys.Count][];
            int        maxlength = int.MinValue;

            for (int i = 0; i < selectedkeys.Count; i++)
            {
                yval[i] = rp.GetPlot(selectedkeys[i]).ToArray();// plots[selectedkeys[i]].ToArray();
                if (maxlength < yval[i].Length)
                {
                    maxlength = yval[i].Length;
                }
            }
            cd.Y = yval;

            List <double> time = rp.GetPlot("Time");

            if (time != null && time.Count == maxlength)
            {
                cd.TitleX     = "Time";
                cd.AxisLabelX = "[s]";
                cd.X          = time.ToArray();
            }
            else
            {
                cd.TitleX = "Sample";
                double[] x = new double[maxlength];
                for (int i = 0; i < x.Length; i++)
                {
                    x[i] = i;
                }
                cd.AxisLabelX = "[n]";
                cd.X          = x;
            }
            cds.Add(cd);

            return(cds);
        }
 public ColumnNode(ReportNode parent, string name)
 {
     this.parent             = parent;
     this.Text               = name;
     this.ImageIndex         = 0;
     this.SelectedImageIndex = 0;
     this.StateImageIndex    = 0;
 }
        public override List <ChartData> OnPlot(ReportNode rp)
        {
            List <ChartData> cds = new List <ChartData>();
            ChartData        cd  = ChartData.GetInstance();

            List <double> chxaxis = rp.GetPlot(xaxis);
            List <double> chyaxis = rp.GetPlot(yaxis);
            List <double> chzaxis = rp.GetPlot(zaxis);

            SortedDictionary <string, List <double> > ys = new SortedDictionary <string, List <double> >();

            double[]      tmp = new double[chxaxis.Count];
            List <double> dtmp;
            string        k;

            for (int i = 0; i < chzaxis.Count; i++)
            {
                if (chzaxis[i] == 0)
                {
                    continue;
                }

                k = (chzaxis[i] / 1e-6).ToString();

                dtmp = new List <double>();
                dtmp.AddRange(tmp);

                if (!ys.ContainsKey(k))
                {
                    ys.Add(k, dtmp);
                }
                ys[k][i] = chyaxis[i];
            }

            string[]   keys  = new string[ys.Keys.Count];
            double[][] yvals = new double[ys.Keys.Count][];
            int        z     = 0;

            foreach (string key in ys.Keys)
            {
                keys[z]  = key;
                yvals[z] = ys[key].ToArray();
                z++;
            }

            cd.TitlesY = keys;

            cd.TitleX = xaxis;

            cd.X = chxaxis.ToArray();

            cd.Y = yvals;

            cds.Add(cd);

            return(cds);
        }
        public void Open(string Title, List <ChartData> cds)
        {
            ORBChartDataReader cdr = new ORBChartDataReader(cds);

            ReportNode rp = new ReportNode(this, Title, cdr, true);

            rp.UpdatedProgess += new ProgressHandler(rp_UpdatedProgess);
            this.treeView1.Nodes.Add(rp);
        }
Beispiel #11
0
        public override List <NextGenLab.Chart.ChartData> OnPlot(ReportNode rp)
        {
            PrintDynamicParameters pdp = new PrintDynamicParameters(f0, fs, fmin, fmax, true);

            string s = pdp.Print(this.Name, rp.GetPlot(this.Name));

            MessageBox.Show(s);

            return(new List <ChartData>());
        }
Beispiel #12
0
        public override List <ChartData> OnPlot(ReportNode rp)
        {
            PlotType = "Spectral Density (" + this.Name + ")";

            PlotPowerSpectralDensity psd = new PlotPowerSpectralDensity(fs, true, max_amplitude);

            psd.Title = this.Name;
            List <ChartData> cds = psd.Plot(rp.GetPlot(this.Name));

            return(cds);
        }
 public SinglePlotMultiple(ReportNode rp) : base(rp)
 {
     AddMenuItem("General", "Multiple dataset", delegate
     {
         MultiSelect ms = new MultiSelect(rp.PlotKeys);
         if (DialogResult.OK == ms.ShowDialog())
         {
             selectedkeys = ms.SelectedKeys;
             Plot();
         }
     });
 }
Beispiel #14
0
 public SingleHistogram(ReportNode rp)
     : base(rp)
 {
     AddMenuItem("Statistics", "Histogram w/normal dist.", delegate
     {
         histType = HistogramType.WithNormalDist;
         Plot();
     });
     AddMenuItem("Statistics", "Histogram", delegate
     {
         histType = HistogramType.Normal;
         Plot();
     });
 }
 public SinglePlotXYDifferentiate(ReportNode rp)
     : base(rp)
 {
     AddMenuItem("Calculus", "Differentiate", delegate
     {
         XYSelectForm xy = new XYSelectForm("X-Axis:", "Y-Axis:", rp.PlotKeys);
         if (DialogResult.OK == xy.ShowDialog())
         {
             xaxis = xy.XAxis;
             yaxis = xy.YAxis;
             Plot();
         }
     }
                 );
 }
Beispiel #16
0
 public SinglePlotDifference(ReportNode rp)
     : base(rp)
 {
     AddMenuItem("General", "Difference between two dataset", delegate
     {
         XYSelectForm xy = new XYSelectForm("Plot 1:", "Plot 2:", rp.PlotKeys);
         if (DialogResult.OK == xy.ShowDialog())
         {
             xaxis = xy.XAxis;
             yaxis = xy.YAxis;
             Plot();
         }
     }
                 );
 }
Beispiel #17
0
 public SinglePlotXY(ReportNode rp)
     : base(rp)
 {
     AddMenuItem("General", "X VS Y", delegate
     {
         XYSelectForm xy = new XYSelectForm("X-Axis:", "Y-Axis:", rp.PlotKeys);
         if (DialogResult.OK == xy.ShowDialog())
         {
             xaxis = xy.XAxis;
             yaxis = xy.YAxis;
             Plot();
         }
     }
                 );
 }
Beispiel #18
0
 public SingleResample(ReportNode rp)
     : base(rp)
 {
     AddMenuItem("Wave functions", "Resample", delegate {
         InputFormBase ifb = InputFormFactory.GetInstance("Resample parameters", "X-Step",
                                                          "X-Delay{0}",
                                                          "X-Uncertainty{1e-10}");
         if (ifb.ShowDialog() == DialogResult.OK)
         {
             x_step   = ifb.Values["X-Step"];
             x_delay  = ifb.Values["X-Delay{0}"];
             x_uncert = ifb.Values["X-Uncertainty{1e-10}"];
             Plot();
         }
     });
 }
Beispiel #19
0
        public override List <ChartData> OnPlot(ReportNode rp)
        {
            PlotType = "Difference (" + xaxis + " - " + yaxis + ")";

            List <ChartData> cds = new List <ChartData>();

            ChartData cd = ChartData.GetInstance();

            cd.TitlesY = new string[] { xaxis + " - " + yaxis };

            List <double> chxaxis = rp.GetPlot(xaxis);
            List <double> chyaxis = rp.GetPlot(yaxis);

            List <double> time = rp.GetPlot("Time");

            if (time != null && time.Count == chxaxis.Count)
            {
                cd.TitleX     = "Time";
                cd.AxisLabelX = "[s]";
                cd.X          = time.ToArray();
            }
            else
            {
                cd.TitleX = "Sample";
                double[] x = new double[chxaxis.Count];
                for (int i = 0; i < x.Length; i++)
                {
                    x[i] = i;
                }
                cd.AxisLabelX = "[n]";
                cd.X          = x;
            }

            double[] y = new double[chxaxis.Count];
            for (int i = 0; i < chxaxis.Count; i++)
            {
                if (chyaxis.Count > i)
                {
                    y[i] = chxaxis[i] - chyaxis[i];
                }
            }

            cd.Y = new double[][] { y };
            cds.Add(cd);

            return(cds);
        }
 public SingleMomentPlot(ReportNode rp)
     : base(rp)
 {
     AddMenuItem("Statistics", "Mean", delegate
     {
         momenttype = MomentType.Mean;
         Plot();
     });
     AddMenuItem("Statistics", "Variance", delegate
     {
         momenttype = MomentType.Variance;
         Plot();
     });
     AddMenuItem("Statistics", "Third Moment", delegate
     {
         momenttype = MomentType.ThirdMoment;
         Plot();
     });
 }
 public SingleRMSPlot(ReportNode rp)
     : base(rp)
 {
     AddMenuItem("Calculate", "RMS", delegate
     {
         rmstype = RMSType.Simple;
         Plot();
     });
     AddMenuItem("Calculate", "SNR from RMS", delegate
     {
         XYSelectForm xy = new XYSelectForm("Signal:", "Noise:", rp.PlotKeys);
         if (DialogResult.OK == xy.ShowDialog())
         {
             xaxis   = xy.XAxis;
             yaxis   = xy.YAxis;
             rmstype = RMSType.SNRfromRMS;
             Plot();
         }
     });
 }
        public NodeContextMenu(ReportNode reportnode)
        {
            List <SinglePlotBase> plots = new List <SinglePlotBase>();

            Type[] types = this.GetType().Assembly.GetTypes();
            foreach (Type t in types)
            {
                if (t.IsSubclassOf(typeof(SinglePlotBase)))
                {
                    object o = null;
                    try
                    {
                        o = Activator.CreateInstance(t, new object[] { reportnode });
                    }
                    catch { }

                    if (o != null)
                    {
                        plots.Add((SinglePlotBase)o);
                    }
                }
            }

            foreach (SinglePlotBase sb in plots)
            {
                foreach (string key in sb.EventHandlers.Keys)
                {
                    if (!handlers.ContainsKey(key))
                    {
                        handlers.Add(key, new SortedDictionary <string, EventHandler>());
                    }
                    foreach (string innerkey in sb.EventHandlers[key].Keys)
                    {
                        if (!handlers[key].ContainsKey(innerkey))
                        {
                            handlers[key].Add(innerkey, sb.EventHandlers[key][innerkey]);
                        }
                    }
                }
            }
        }
Beispiel #23
0
        public override List <ChartData> OnPlot(ReportNode rp)
        {
            PlotType = xaxis + " VS " + yaxis;

            List <ChartData> cds = new List <ChartData>();
            ChartData        cd  = ChartData.GetInstance();

            cd.TitlesY = new string[] { yaxis };

            List <double> chxaxis = rp.GetPlot(xaxis);
            List <double> chyaxis = rp.GetPlot(yaxis);

            cd.TitleX = xaxis;

            cd.X = chxaxis.ToArray();

            cd.Y = new double[][] { chyaxis.ToArray() };

            cds.Add(cd);
            return(cds);
        }
Beispiel #24
0
        public SingleDynamicParameters(ReportNode rp) : base(rp)
        {
            AddMenuItem("Calculate", "Dynamic Parameters (SNDR SNR ENOB) [fs,f0,fmin,fmax]", delegate
            {
                InputFormBase ifb = InputFormFactory.GetInstance("Frequency Information [fs,f0,fmin,fmax]",
                                                                 "Sampling Frequency(Fs)",
                                                                 "Input Frequency(F0)",
                                                                 "Bandlimit noise, lower limit(Fmin)",
                                                                 "Bandlimit noise, high limit(Fmax)");

                if (ifb.ShowDialog() == DialogResult.OK)
                {
                    this.fs   = ifb.Values["Sampling Frequency(Fs)"];
                    this.f0   = ifb.Values["Input Frequency(F0)"];
                    this.fmin = ifb.Values["Bandlimit noise, lower limit(Fmin)"];
                    this.fmax = ifb.Values["Bandlimit noise, high limit(Fmax)"];
                    Plot();
                }
            });

            AddMenuItem("Calculate", "Dynamic Parameters (SNDR SNR ENOB) [fs,f0]", delegate
            {
                InputFormBase ifb = InputFormFactory.GetInstance("Frequency Information [fs,f0]",
                                                                 "Sampling Frequency(Fs)",
                                                                 "Input Frequency(F0)");

                if (ifb.ShowDialog() == DialogResult.OK)
                {
                    this.fs   = ifb.Values["Sampling Frequency(Fs)"];
                    this.f0   = ifb.Values["Input Frequency(F0)"];
                    this.fmin = -1;
                    this.fmax = -1;
                    Plot();
                }
            });
        }
        public override List <NextGenLab.Chart.ChartData> OnPlot(ReportNode rp)
        {
            PlotType = momenttype.ToString() + "(" + this.Name + ")";
            ChartData     cd     = ChartData.GetInstance();
            List <double> values = rp.GetPlot(this.Name);

            double[] meanlist = Mean(values);

            cd.Y       = new double[][] { meanlist };
            cd.TitlesY = new string[] { this.Name };
            cd.TitleX  = "Sample";
            double[] x = new double[values.Count];
            for (int i = 0; i < x.Length; i++)
            {
                x[i] = i;
            }
            cd.AxisLabelX = "[n]";
            cd.X          = x;

            List <ChartData> cds = new List <ChartData>();

            cds.Add(cd);
            return(cds);
        }
Beispiel #26
0
 public SinglePlot(ReportNode rp) : base(rp)
 {
     AddMenuItem("General", "Just Plot", delegate { Plot(); });
 }
Beispiel #27
0
 public DataForm(ReportNode rp)
 {
     InitializeComponent();
     this.Text = rp.Text;
     AddAll(rp);
 }
Beispiel #28
0
        void DoPlot(object state)
        {
            Name = reportnode.CurrentName;
            List <ChartData> cdsa = new List <ChartData>();
            List <ChartData> cds  = null;
            ChartData        cd;
            int index = 1;

            if (MatchNames)
            {
                reportnode.SingleWindow = true;
                foreach (TreeNode tn in reportnode.TreeView.Nodes)
                {
                    if (tn is ReportNode)
                    {
                        ReportNode rp = (ReportNode)tn;
                        cds = OnPlot(rp);
                        if (cds != null)
                        {
                            for (int i = 0; i < cds.Count; i++)
                            {
                                cd = cds[i];
                                for (int z = 0; z < cd.TitlesY.Length; z++)
                                {
                                    cd.TitlesY[z] = cd.TitlesY[z] + ":" + index;
                                }
                                cds[i] = cd;
                            }


                            cdsa.AddRange(cds);
                        }
                        index++;
                    }
                }
            }
            else
            {
                cds = OnPlot(reportnode);
                if (cds != null)
                {
                    cdsa.AddRange(cds);
                }
            }

            for (int i = 0; i < cdsa.Count; i++)
            {
                cd = cdsa[i];
                if (PlotType == "")
                {
                    cd.Title = reportnode.Text;
                }
                else
                {
                    cd.Title = PlotType;
                }


                cd.AutoScale = true;
                cdsa[i]      = cd;
            }

            if (reportnode.MDIContainer != null)
            {
                reportnode.MDIContainer.Invoke(new ChartDataHandler(reportnode.Plot), cdsa);
            }
        }
Beispiel #29
0
 public SinglePlotBase(ReportNode rp)
 {
     reportnode = rp;
     reportnode.SingleWindow = false;
 }
Beispiel #30
0
 public abstract List <ChartData> OnPlot(ReportNode rp);