Example #1
0
        private void ilPanel1_Load(object sender, EventArgs e)
        {
            // create a simple plot with a colorbar
            ilPanel1.Scene.Add(new ILPlotCube()
            {
                new ILSurface(ILSpecialData.sincf(50, 40))
                {
                    new ILColorbar()
                }
            });
            // get the colorbar for configuration
            var cb = ilPanel1.SceneSyncRoot.First <ILColorbar>();  // <- use SceneSyncRoot before 4.3! (see below)

            cb.Background.Color = Color.FromArgb(230, 230, 255);
            cb.Scale(new Vector3(0.1, 0.1, 1));           // configure a custom tick creation function
            cb.First <ILTickCollection>().TickCreationFuncEx = MyTicksCreationFunc;

            // Note: until ILNumerics Ultimate VS vers. 4.3 the setting for ILTickCollection.TickCreationFuncEx
            // has not been synchronized with the synchronized copy used for rendering yet. Thererfore, in order
            // to configure a custom TickCreationFuncEx, one must assign the custom function to the
            // tick collection in the synchronized tree in these versions. For example:
            // ilPanel1.SceneSyncRoot.First<ILColorbar>().First<ILTickCollection>().TickCreationFuncEx = MyTicksCreationFunc
            //
            // Up from version 4.3 the same setting for the TickCreationFuncEx is used in the synchronized
            // scene as in the global scene. Hence the configuration can happen directly on the glbal scene.
        }
Example #2
0
        /// <summary>
        /// Plot with built-in waveform in the library
        /// </summary>
        /// <param name="builtInWfmIndex"></param>
        public void Plot(stdWfm wfmType)
        {
            ///Colormap and part of the colorbar function could only be modified in the static state.
            ///This will ensure the best efficiency in run-time status.

            switch (wfmType)
            {
            case stdWfm.Sinc:
                _displayData = ILSpecialData.sinc(128, 128) + 1;
                break;

            case stdWfm.Waterfall:
                _displayData = ILSpecialData.waterfall(128, 128) + 1;
                break;

            default:
                _displayData = ILSpecialData.sinc(128, 128) + 1;
                break;
            }
            _panel.Graphs.Clear();
            _sgr         = _panel.Graphs.AddSurfGraph(_displayData);
            _sgr.Opacity = 0.8f;
            _sgr.Shading = ShadingStyles.Interpolate;
            ApplyProperties();
            AutoScaleColorRange();
            UpdateGraph();
        }
Example #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ILFigure fig   = new ILFigure();
            ILPanel  panel = fig.ActiveSubfigure.Panel;

            ILPlot2DGraph[] graphs = panel.Graphs.AddPlot2DGraph(ILSpecialData.sincos1D(30, 1.0));
            graphs[0].Marker.Shape = @"\yvalue";
            (graphs[0].Marker.Shape as ILTexMarkerShape).ValueFormat    = "g2";
            (graphs[0].Marker.Shape as ILTexMarkerShape).MaxLabelsDrawn = 15;
            graphs[1].Marker.Shape = MarkerStyle.Diamond;
            graphs[1].Marker.Size  = 4;
            graphs[1].Marker.Color = Color.Red;
        }
Example #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            m_panel = ILPanel.Create();
            Controls.Add(m_panel);

            ILArray <double> B   = ILSpecialData.sinc(40, 50) + 1;
            ILSurfaceGraph   sgr = m_panel.Graphs.AddSurfGraph(B);
            ILImageSCGraph   igr = m_panel.Graphs.AddImageSCGraph(B);

            igr.ZPosition                 = float.NegativeInfinity;
            sgr.Opacity                   = 0.8f;
            sgr.Wireframe.Visible         = false;
            sgr.Shading                   = ShadingStyles.Interpolate;
            m_panel.Axes.XAxis.Label.Text = "\\Omega, a \\bfgreek \\resetLetter";
        }
Example #5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
#if TRACE
            Trace.TraceInformation("{0},{1} ILSubfigure.OnLoad ", DateTime.Now, Environment.TickCount);
#endif
            SuspendLayout();
            Controls.Add(m_colorbar);
            Controls.Add(m_title);
            Controls.Add(m_panel);
#if TRACE
            Trace.TraceInformation("{0},{1} ILSubfigure.OnLoad ", DateTime.Now, Environment.TickCount);
#endif

            ResumeLayout();
            m_isInitializing = false;
            if (DesignMode)
            {
#if TRACE
                Trace.TraceInformation("{0},{1} ILSubfigure.OnLoad: DesignMode detected", DateTime.Now, Environment.TickCount);
#endif
                try {
                    SetStyle(ControlStyles.Opaque, true);
                    SetStyle(ControlStyles.ResizeRedraw, true);
                    m_panel.Graphs.AddSurfGraph(ILSpecialData.sinc(14, 20));
#if TRACE
                    Trace.TraceInformation("{0},{1} ILSubfigure.OnLoad:DesignMode: SurfGraph added", DateTime.Now, Environment.TickCount);
#else
                } catch (Exception) {
#endif
#if TRACE
                } catch (Exception exc) {
                    Trace.TraceWarning("{0},{1} ILSubfigure.OnLoad:DesignMode: failure added surf graph: {2}", DateTime.Now, Environment.TickCount, exc.ToString());
#endif
                }
            }
            Invalidate(true);
        }
Example #6
0
        private void Dipole_Imaging_Load(object sender, EventArgs e)
        {
            try {
                DataTable table = new DataTable();
                if (inforadio == 0)
                {
                    table.Columns.AddRange(new DataColumn[] { new DataColumn("a (m)"),
                                                              new DataColumn("C1"),
                                                              new DataColumn("C2"),
                                                              new DataColumn("P1"),
                                                              new DataColumn("P2"),
                                                              new DataColumn("X (m)"),
                                                              new DataColumn("Z/n (m)"),
                                                              new DataColumn("V (mV)"),
                                                              new DataColumn("I (mA)"),
                                                              new DataColumn("R (Ω)"),
                                                              new DataColumn("K (m)"),
                                                              new DataColumn("ρa (Ω.m)"),
                                                              new DataColumn("Za (m)") });
                    string[] MyDataLines = MyDataString.Split('\n');
                    L = MyDataLines.Length;
                    double[] data_a   = new double[L];
                    double[] data_C1  = new double[L];
                    double[] data_C2  = new double[L];
                    double[] data_P1  = new double[L];
                    double[] data_P2  = new double[L];
                    double[] data_V   = new double[L];
                    double[] data_I   = new double[L];
                    double[] data_R   = new double[L];
                    double[] data_K   = new double[L];
                    double[] data_Rho = new double[L];
                    double[] data_dis = new double[L];
                    double[] data_n   = new double[L];
                    double[] data_Z   = new double[L];
                    double   pi       = 3.14;

                    for (int i = 0; i < L; i++)
                    {
                        string[] MyDataColumns = MyDataLines[i].Split('\t');
                        data_a[i]   = Convert.ToDouble(MyDataColumns[selected[0]]);
                        data_C1[i]  = Convert.ToDouble(MyDataColumns[selected[1]]);
                        data_C2[i]  = Convert.ToDouble(MyDataColumns[selected[2]]);
                        data_P1[i]  = Convert.ToDouble(MyDataColumns[selected[3]]);
                        data_P2[i]  = Convert.ToDouble(MyDataColumns[selected[4]]);
                        data_V[i]   = Convert.ToDouble(MyDataColumns[selected[5]]);
                        data_I[i]   = Convert.ToDouble(MyDataColumns[selected[6]]);
                        data_R[i]   = data_V[i] / data_I[i];
                        data_n[i]   = data_P1[i] - data_C2[i];
                        data_K[i]   = data_n[i] * data_a[i] * pi * (data_n[i] + 2) * (data_n[i] + 1);
                        data_Rho[i] = data_R[i] * data_K[i];
                        data_dis[i] = (data_P1[i] + data_C2[i]) * data_a[i] / 2;
                        data_Z[i]   = data_n[i] * data_a[i] / 3;
                        object[] Data_Row = { data_a[i],  data_C1[i],  data_C2[i],
                                              data_P1[i], data_P2[i],  data_dis[i],data_n[i],  data_V[i], data_I[i], data_R[i],
                                              data_K[i],  data_Rho[i], data_Z[i] };
                        table.Rows.Add(Data_Row);
                    }
                    dataGridView1.DataSource = table;
                    dis = data_dis;
                    Rho = data_Rho;
                    n   = data_n;

                    double[] X = data_dis;
                    double[] Y = data_n;
                    double[] Z = data_Rho;

                    /*
                     * double[] Z = new double[data_Rho.Length];
                     * for (int i = 0; i < data_Rho.Length; i++)
                     * {
                     *  Z[i] = Math.Log10(data_Rho[i]);
                     * }
                     */
                    double   minX  = X.Min();
                    double   maxX  = X.Max();
                    double   minY  = Y.Min();
                    double   maxY  = Y.Max();
                    double   intX  = 1;
                    double   intY  = 0.1;
                    int      LX    = Convert.ToInt32((maxX - minX) / intX);
                    int      LY    = Convert.ToInt32((maxY - minY) / intY);
                    double[] intpX = new double[LX];
                    double[] intpY = new double[LY];
                    for (int i = 0; i < LX; i++)
                    {
                        if (i == 0)
                        {
                            intpX[i] = minX;
                        }
                        else
                        {
                            intpX[i] = intpX[i - 1] + intX;
                        }
                    }
                    for (int i = 0; i < LY; i++)
                    {
                        if (i == 0)
                        {
                            intpY[i] = minY;
                        }
                        else
                        {
                            intpY[i] = intpY[i - 1] + intY;
                        }
                    }
                    // IDW
                    int      nX    = intpX.Length;
                    int      nY    = intpY.Length;
                    int      N     = nX * nY;
                    double[] intpZ = new double[N];
                    double[] susX  = new double[N];
                    double[] susY  = new double[N];
                    for (int i = 0; i < nY; i++)
                    {
                        for (int j = 0; j < nX; j++)
                        {
                            susX[j + (nX * (i))] = intpX[j];
                            susY[j + (nX * (i))] = intpY[i];
                        }
                    }
                    double k = 2;
                    for (int i = 0; i < N; i++)
                    {
                        double[] d_obs     = new double[X.Length];
                        double[] d_ok      = new double[X.Length];
                        double[] spd_ok    = new double[X.Length];
                        double[] Zspd_ok   = new double[X.Length];
                        double[] s_spd_ok  = new double[X.Length];
                        double[] s_Zspd_ok = new double[X.Length];
                        for (int j = 0; j < X.Length; j++)
                        {
                            d_obs[j]   = Math.Sqrt(Math.Pow(X[j] - susX[i], 2) + Math.Pow(Y[j] - susY[i], 2));
                            d_ok[j]    = Math.Pow(d_obs[j], k);
                            spd_ok[j]  = 1 / (d_ok[j] + 0.00001);
                            Zspd_ok[j] = Z[j] * spd_ok[j];
                            if (j == 0)
                            {
                                s_spd_ok[j]  = spd_ok[j];
                                s_Zspd_ok[j] = Zspd_ok[j];
                            }
                            else
                            {
                                s_spd_ok[j]  = s_spd_ok[j - 1] + spd_ok[j];
                                s_Zspd_ok[j] = s_Zspd_ok[j - 1] + Zspd_ok[j];
                            }
                        }
                        intpZ[i] = s_Zspd_ok[X.Length - 1] / s_spd_ok[X.Length - 1];
                    }
                    ILArray <double> ILintpZ = intpZ;
                    ILArray <double> matrix  = ILMath.zeros(nY, nX);

                    for (int i = 0; i < nY; i++)
                    {
                        ILArray <int> rangeX = ILMath.vec <int>(0, nX - 1);
                        ILArray <int> rangeZ = ILMath.vec <int>(0 + (nX) * (i), (nX * (i + 1) - 1));
                        matrix[i, rangeX] = ILintpZ[rangeZ];
                    }

                    ILArray <float> matrixf = ILMath.convert <double, float>(matrix);
                    ILArray <float> matrixl = ILMath.log10(matrixf);
                    ILArray <float> Xf      = ILMath.convert <double, float>(intpX);
                    ILArray <float> Yf      = -1 * ILMath.convert <double, float>(intpY);

                    matrixgen = matrixf;
                    Xgen      = X;
                    Ygen      = Y;

                    // Example
                    ILArray <float> ZZZ = ILSpecialData.sincf(40, 50);
                    ILArray <float> XXX = ILMath.linspace <float>(1, 2, 50);
                    ILArray <float> YYY = ILMath.linspace <float>(1, 2, 40);
                    ilPanel1.Scene.Add(new ILPlotCube
                    {
                        Axes =
                        {
                            XAxis        =
                            {
                                Label    =
                                {
                                    Text = "Distance (m)"
                                }
                            },
                            YAxis        =
                            {
                                Label    =
                                {
                                    Text = "n"
                                }
                            }
                        },
                        Children =
                        {
                            new ILSurface(matrixf, Xf, Yf)
                            {
                                // make thin transparent wireframes
                                Wireframe = { Color = Color.FromArgb(50,Color.LightGray) },
                                // choose a different colormap
                                Colormap = new ILColormap(Colormaps.Jet),
                                // add a colorbar (see below)
                                Children = { new ILColorbar() }
                            }
                        }
                    });
                }
                if (inforadio == 1)
                {
                    table.Columns.AddRange(new DataColumn[] { new DataColumn("a (m)"),
                                                              new DataColumn("C1"),
                                                              new DataColumn("C2"),
                                                              new DataColumn("P1"),
                                                              new DataColumn("P2"),
                                                              new DataColumn("X (m)"),
                                                              new DataColumn("Z/n (m)"),
                                                              new DataColumn("R (Ω)"),
                                                              new DataColumn("K (m)"),
                                                              new DataColumn("ρa (Ω.m)"),
                                                              new DataColumn("Za (m)") });
                    string[] MyDataLines = MyDataString.Split('\n');
                    L = MyDataLines.Length;
                    double[] data_a   = new double[L];
                    double[] data_C1  = new double[L];
                    double[] data_C2  = new double[L];
                    double[] data_P1  = new double[L];
                    double[] data_P2  = new double[L];
                    double[] data_R   = new double[L];
                    double[] data_K   = new double[L];
                    double[] data_Rho = new double[L];
                    double[] data_dis = new double[L];
                    double[] data_n   = new double[L];
                    double[] data_Z   = new double[L];
                    double   pi       = 3.14;

                    for (int i = 0; i < L; i++)
                    {
                        string[] MyDataColumns = MyDataLines[i].Split('\t');
                        data_a[i]   = Convert.ToDouble(MyDataColumns[selected[0]]);
                        data_C1[i]  = Convert.ToDouble(MyDataColumns[selected[1]]);
                        data_C2[i]  = Convert.ToDouble(MyDataColumns[selected[2]]);
                        data_P1[i]  = Convert.ToDouble(MyDataColumns[selected[3]]);
                        data_P2[i]  = Convert.ToDouble(MyDataColumns[selected[4]]);
                        data_R[i]   = Convert.ToDouble(MyDataColumns[selected[5]]);
                        data_n[i]   = data_P1[i] - data_C2[i];
                        data_K[i]   = data_n[i] * data_a[i] * pi * (data_n[i] + 2) * (data_n[i] + 1);
                        data_Rho[i] = data_R[i] * data_K[i];
                        data_dis[i] = (data_P1[i] + data_C2[i]) * data_a[i] / 2;
                        data_Z[i]   = data_n[i] * data_a[i] / 3;
                        object[] Data_Row = { data_a[i],  data_C1[i],  data_C2[i],
                                              data_P1[i], data_P2[i],  data_dis[i],data_n[i],  data_R[i],
                                              data_K[i],  data_Rho[i], data_Z[i] };
                        table.Rows.Add(Data_Row);
                    }
                    dataGridView1.DataSource = table;
                    dis = data_dis;
                    Rho = data_Rho;
                    n   = data_n;

                    double[] X     = data_dis;
                    double[] Y     = data_n;
                    double[] Z     = data_Rho;
                    double   minX  = X.Min();
                    double   maxX  = X.Max();
                    double   minY  = Y.Min();
                    double   maxY  = Y.Max();
                    double   intX  = 1;
                    double   intY  = 0.1;
                    int      LX    = Convert.ToInt32((maxX - minX) / intX);
                    int      LY    = Convert.ToInt32((maxY - minY) / intY);
                    double[] intpX = new double[LX];
                    double[] intpY = new double[LY];
                    for (int i = 0; i < LX; i++)
                    {
                        if (i == 0)
                        {
                            intpX[i] = minX;
                        }
                        else
                        {
                            intpX[i] = intpX[i - 1] + intX;
                        }
                    }
                    for (int i = 0; i < LY; i++)
                    {
                        if (i == 0)
                        {
                            intpY[i] = minY;
                        }
                        else
                        {
                            intpY[i] = intpY[i - 1] + intY;
                        }
                    }
                    // IDW
                    int      nX    = intpX.Length;
                    int      nY    = intpY.Length;
                    int      N     = nX * nY;
                    double[] intpZ = new double[N];
                    double[] susX  = new double[N];
                    double[] susY  = new double[N];
                    for (int i = 0; i < nY; i++)
                    {
                        for (int j = 0; j < nX; j++)
                        {
                            susX[j + (nX * (i))] = intpX[j];
                            susY[j + (nX * (i))] = intpY[i];
                        }
                    }
                    double k = 2;
                    for (int i = 0; i < N; i++)
                    {
                        double[] d_obs     = new double[X.Length];
                        double[] d_ok      = new double[X.Length];
                        double[] spd_ok    = new double[X.Length];
                        double[] Zspd_ok   = new double[X.Length];
                        double[] s_spd_ok  = new double[X.Length];
                        double[] s_Zspd_ok = new double[X.Length];
                        for (int j = 0; j < X.Length; j++)
                        {
                            d_obs[j]   = Math.Sqrt(Math.Pow(X[j] - susX[i], 2) + Math.Pow(Y[j] - susY[i], 2));
                            d_ok[j]    = Math.Pow(d_obs[j], k);
                            spd_ok[j]  = 1 / (d_ok[j] + 0.00001);
                            Zspd_ok[j] = Z[j] * spd_ok[j];
                            if (j == 0)
                            {
                                s_spd_ok[j]  = spd_ok[j];
                                s_Zspd_ok[j] = Zspd_ok[j];
                            }
                            else
                            {
                                s_spd_ok[j]  = s_spd_ok[j - 1] + spd_ok[j];
                                s_Zspd_ok[j] = s_Zspd_ok[j - 1] + Zspd_ok[j];
                            }
                        }
                        intpZ[i] = s_Zspd_ok[X.Length - 1] / s_spd_ok[X.Length - 1];
                    }
                    ILArray <double> ILintpZ = intpZ;
                    ILArray <double> matrix  = ILMath.zeros(nY, nX);

                    for (int i = 0; i < nY; i++)
                    {
                        ILArray <int> rangeX = ILMath.vec <int>(0, nX - 1);
                        ILArray <int> rangeZ = ILMath.vec <int>(0 + (nX) * (i), (nX * (i + 1) - 1));
                        matrix[i, rangeX] = ILintpZ[rangeZ];
                    }

                    ILArray <float> matrixf = ILMath.convert <double, float>(matrix);
                    ILArray <float> Xf      = ILMath.convert <double, float>(intpX);
                    ILArray <float> Yf      = -1 * ILMath.convert <double, float>(intpY);

                    matrixgen = matrixf;
                    Xgen      = X;
                    Ygen      = Y;

                    // Example
                    ILArray <float> ZZZ = ILSpecialData.sincf(40, 50);
                    ILArray <float> XXX = ILMath.linspace <float>(1, 2, 50);
                    ILArray <float> YYY = ILMath.linspace <float>(1, 2, 40);
                    ilPanel1.Scene.Add(new ILPlotCube
                    {
                        Axes =
                        {
                            XAxis        =
                            {
                                Label    =
                                {
                                    Text = "Distance (m)"
                                }
                            },
                            YAxis        =
                            {
                                Label    =
                                {
                                    Text = "n"
                                }
                            }
                        },
                        Children =
                        {
                            new ILSurface(matrixf, Xf, Yf)
                            {
                                // make thin transparent wireframes
                                Wireframe = { Color = Color.FromArgb(50,Color.LightGray) },
                                // choose a different colormap
                                Colormap = new ILColormap(Colormaps.Jet),
                                // add a colorbar (see below)
                                Children = { new ILColorbar() }
                            }
                        }
                    });
                }
                if (inforadio == 2)
                {
                    table.Columns.AddRange(new DataColumn[] { new DataColumn("Distance (m)"),
                                                              new DataColumn("Za (m)"),
                                                              new DataColumn("ρa (Ω.m)") });
                    string[] MyDataLines = MyDataString.Split('\n');
                    L = MyDataLines.Length;
                    double[] data_dis = new double[L];
                    double[] data_Z   = new double[L];
                    double[] data_Rho = new double[L];


                    for (int i = 0; i < L; i++)
                    {
                        string[] MyDataColumns = MyDataLines[i].Split('\t');
                        data_Z[i]   = Convert.ToDouble(MyDataColumns[selected[1]]);
                        data_dis[i] = Convert.ToDouble(MyDataColumns[selected[0]]);
                        data_Rho[i] = Convert.ToDouble(MyDataColumns[selected[2]]);
                        object[] Data_Row = { data_dis[i], data_Z[i], data_Rho[i] };
                        table.Rows.Add(Data_Row);
                    }
                    dataGridView1.DataSource = table;
                    dis = data_dis;
                    Rho = data_Rho;
                    n   = data_Z;

                    double[] X     = data_dis;
                    double[] Y     = data_Z;
                    double[] Z     = data_Rho;
                    double   minX  = X.Min();
                    double   maxX  = X.Max();
                    double   minY  = Y.Min();
                    double   maxY  = Y.Max();
                    double   intX  = 1;
                    double   intY  = 1;
                    int      LX    = Convert.ToInt32((maxX - minX) / intX);
                    int      LY    = Convert.ToInt32((maxY - minY) / intY);
                    double[] intpX = new double[LX];
                    double[] intpY = new double[LY];
                    for (int i = 0; i < LX; i++)
                    {
                        if (i == 0)
                        {
                            intpX[i] = minX;
                        }
                        else
                        {
                            intpX[i] = intpX[i - 1] + intX;
                        }
                    }
                    for (int i = 0; i < LY; i++)
                    {
                        if (i == 0)
                        {
                            intpY[i] = minY;
                        }
                        else
                        {
                            intpY[i] = intpY[i - 1] + intY;
                        }
                    }
                    // IDW
                    int      nX    = intpX.Length;
                    int      nY    = intpY.Length;
                    int      N     = nX * nY;
                    double[] intpZ = new double[N];
                    double[] susX  = new double[N];
                    double[] susY  = new double[N];
                    for (int i = 0; i < nY; i++)
                    {
                        for (int j = 0; j < nX; j++)
                        {
                            susX[j + (nX * (i))] = intpX[j];
                            susY[j + (nX * (i))] = intpY[i];
                        }
                    }
                    double k = 2;
                    for (int i = 0; i < N; i++)
                    {
                        double[] d_obs     = new double[X.Length];
                        double[] d_ok      = new double[X.Length];
                        double[] spd_ok    = new double[X.Length];
                        double[] Zspd_ok   = new double[X.Length];
                        double[] s_spd_ok  = new double[X.Length];
                        double[] s_Zspd_ok = new double[X.Length];
                        for (int j = 0; j < X.Length; j++)
                        {
                            d_obs[j]   = Math.Sqrt(Math.Pow(X[j] - susX[i], 2) + Math.Pow(Y[j] - susY[i], 2));
                            d_ok[j]    = Math.Pow(d_obs[j], k);
                            spd_ok[j]  = 1 / (d_ok[j] + 0.00001);
                            Zspd_ok[j] = Z[j] * spd_ok[j];
                            if (j == 0)
                            {
                                s_spd_ok[j]  = spd_ok[j];
                                s_Zspd_ok[j] = Zspd_ok[j];
                            }
                            else
                            {
                                s_spd_ok[j]  = s_spd_ok[j - 1] + spd_ok[j];
                                s_Zspd_ok[j] = s_Zspd_ok[j - 1] + Zspd_ok[j];
                            }
                        }
                        intpZ[i] = s_Zspd_ok[X.Length - 1] / s_spd_ok[X.Length - 1];
                    }
                    ILArray <double> ILintpZ = intpZ;
                    ILArray <double> matrix  = ILMath.zeros(nY, nX);

                    for (int i = 0; i < nY; i++)
                    {
                        ILArray <int> rangeX = ILMath.vec <int>(0, nX - 1);
                        ILArray <int> rangeZ = ILMath.vec <int>(0 + (nX) * (i), (nX * (i + 1) - 1));
                        matrix[i, rangeX] = ILintpZ[rangeZ];
                    }

                    ILArray <float> matrixf = ILMath.convert <double, float>(matrix);
                    ILArray <float> Xf      = ILMath.convert <double, float>(intpX);
                    ILArray <float> Yf      = -1 * ILMath.convert <double, float>(intpY);

                    matrixgen = matrixf;
                    Xgen      = X;
                    Ygen      = Y;

                    // Example
                    ILArray <float> ZZZ = ILSpecialData.sincf(40, 50);
                    ILArray <float> XXX = ILMath.linspace <float>(1, 2, 50);
                    ILArray <float> YYY = ILMath.linspace <float>(1, 2, 40);
                    ilPanel1.Scene.Add(new ILPlotCube
                    {
                        Axes =
                        {
                            XAxis        =
                            {
                                Label    =
                                {
                                    Text = "Distance (m)"
                                }
                            },
                            YAxis        =
                            {
                                Label    =
                                {
                                    Text = "Z"
                                }
                            }
                        },
                        Children =
                        {
                            new ILSurface(matrixf, Xf, Yf)
                            {
                                // make thin transparent wireframes
                                Wireframe = { Color = Color.FromArgb(50,Color.LightGray) },
                                // choose a different colormap
                                Colormap = new ILColormap(Colormaps.Jet),
                                // add a colorbar (see below)
                                Children = { new ILColorbar() }
                            }
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }