GetValuesZasFloats() public method

public GetValuesZasFloats ( ) : float[]
return float[]
Esempio n. 1
0
    void Show3D(Tables.Denso.Table3D table)
    {
        if (table == null)
        {
            return;
        }

        navbarwidget.CurrentPos = table.Location;

        navbarwidget.SetMarkedPositions(new int[] { table.RangeX.Pos, table.RangeY.Pos, table.RangeZ.Pos });

        var valuesZ = table.GetValuesZasFloats();
        var tableUI = new GtkWidgets.TableWidget3D(coloring, table.ValuesX, table.ValuesY, valuesZ,
                                                   table.Xmin, table.Xmax, table.Ymin, table.Ymax, table.Zmin, table.Zmax);

        tableUI.TitleMarkup  = Util.Markup.NameUnit_Large(table.Title, table.UnitZ);
        tableUI.AxisXMarkup  = Util.Markup.NameUnit(table.NameX, table.UnitX);
        tableUI.AxisYMarkup  = Util.Markup.NameUnit(table.NameY, table.UnitY);
        tableUI.FormatValues = ScoobyRom.Data.AutomaticValueFormat(valuesZ, table.Zmin, table.Zmax);

        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport();

        viewPort.Add(tableUI.Create());

        Gtk.Widget previous = this.scrolledwindowTable3D.Child;
        if (previous != null)
        {
            this.scrolledwindowTable3D.Remove(previous);
        }
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable3D.Add(viewPort);
        this.scrolledwindowTable3D.ShowAll();
    }
Esempio n. 2
0
        /// <summary>
        /// Draws NPlot.ImagePlot (heatmap).
        /// Does Clear(), axis are hidden.
        /// Can be used for icons as well.
        /// </summary>
        /// <param name="plotSurface2D">
        /// A <see cref="IPlotSurface2D"/>
        /// </param>
        /// <param name="table">
        /// A <see cref="Table3D"/>
        /// </param>
        public static void Draw(IPlotSurface2D plotSurface2D, Table3D table)
        {
            float[] valuesZ = table.GetValuesZasFloats ();

            // NPlot ImagePlot, needs 2D-array of type double
            int cyi = table.CountY - 1;
            int cx = table.CountX;
            double[,] data = new double[table.CountY, cx];
            for (int i = 0; i < valuesZ.Length; i++) {
                // [row, col], include y-reordering, same effect as plotSurface.YAxis1.Reversed
                // not using using YAxis1.Reversed seems to avoid a display bug (white row sometimes included)
                data[cyi - i / cx, i % cx] = valuesZ[i];
            }

            var ip = new ImagePlot (data);
            ip.Gradient = gradient;

            plotSurface2D.Clear ();
            plotSurface2D.Add (ip);

            plotSurface2D.XAxis1.Hidden = true;
            plotSurface2D.YAxis1.Hidden = true;
        }
Esempio n. 3
0
        //        static string AnnotationStr (Table2D table2D)
        //        {
        //            return string.Format ("Min: {0} Max: {1} Avg: {2}", table2D.Ymin.ToString (), table2D.Ymax.ToString (), table2D.Yavg.ToString ());
        //        }
        // TODO investigate piping binary data via standard input, avoiding temp file
        // However temp file might be useful for manual gnuplot experiments.
        static void WriteGnuPlotBinary(BinaryWriter bw, Table3D table3D)
        {
            /* from gnuplot help PDF page 157, "matrix binary":

                    Single precision floats are stored in a binary file as follows:
                    <N+1> <y0>   <y1>   <y2>  ... <yN>
                    <x0> <z0,0> <z0,1> <z0,2> ... <z0,N>
                    <x1> <z1,0> <z1,1> <z1,2> ... <z1,N>
                    */
            // x <-> y designation from above (manual) seems wrong as xlabel etc. matches code below!

            float[] valuesX = table3D.ValuesX;
            // write first float: <N+1>
            bw.Write ((float)(valuesX.Length));

            // x axis
            foreach (var x in valuesX) {
                bw.Write (x);
            }

            float[] valuesY = table3D.ValuesY;
            float[] valuesZ = table3D.GetValuesZasFloats ();
            for (int iy = 0; iy < valuesY.Length; iy++) {
                bw.Write (valuesY [iy]);
                for (int ix = 0; ix < valuesX.Length; ix++) {
                    bw.Write (valuesZ [ix + iy * valuesX.Length]);
                }
            }
        }