P2D
jhplot

Class P2D

  • All Implemented Interfaces:
    Serializable


    public class P2Dextends Plottableimplements Serializable
    A container to hold data points in X,Y,Z. Should be used to plot data in 3D. This is a high-performance array implementation.
    See Also:
    Serialized Form
    • Constructor Detail

      • P2D

        public P2D()
        Construct an empty container
      • P2D

        public P2D(String title)
        Construct an empty container with a title
        Parameters:
        title - New title
      • P2D

        public P2D(String title,   String sfile)
        Construct a P2D from a file. Data should be separated by space in 3 columns.
        Parameters:
        title - Title of the container
        sfile - File name with input. It can be either a file on a file system or URL location (must start from http or ftp)
    • Method Detail

      • getSymbolColor

        public Color getSymbolColor()
        Get color attribute
        Returns:
        Color
      • setSymbolColor

        public void setSymbolColor(Color c)
        Sets symbol color
        Parameters:
        c - Color
      • getSymbolSize

        public int getSymbolSize()
        Get size of the symbols
        Returns:
        size of the symbols
      • read

        public int read(BufferedReader br)
        Read P2D from a file. The old content will be lost. The file should contain 3 columns: x,y,z. Comment lines starting with "#" and "*" are ignored.
        Parameters:
        br - Input buffered reader
        Returns:
        zero if success
      • read

        public int read(File sfile)
        Read P2D from a file. The old content will be lost. Use a space to separate values in columns and tab to put new row. Comment lines starting with "#" and "*" are ignored.
        Parameters:
        sfile - input file
        Returns:
        zero if success
      • read

        public int read(URL url)
        Read data from URL. Use a space to separate values in columns and tab to put new row.
        Parameters:
        url - URL location of input file
      • read

        public int read(String sfile)
        Read P2D from a file. It can read URL if the string starts from http or ftp, otherwise a file on the file system is assumed.

        The old content will be lost. Use a space to separate values in columns and tab to put new row. Comment lines starting with "#" and "*" are ignored.

        Parameters:
        sfile - File name with input
        Returns:
        zero if success
      • readGZip

        public int readGZip(String sfile)
        Read P2D from a GZiped file. It can read URL if the string starts from http or ftp, otherwise a file on the file system is assumed.

        Use a space to separate values in columns and tab to put new row.

        Parameters:
        sfile - File name with input (extension .gz)
        Returns:
        zero if success
      • readZip

        public int readZip(String sfile)
        Read P1D from a Zipped file. The old content will be lost. The file should contain 2, or 4, or 6, or 10 columns: 1) x,y: data without any errors 2) x,y, y(upper), y(lower) - data with 1st level errors on Y 3) x,y, x(left), x(right), y(upper), y(lower) - data with 1st level errors on X and Y 4) x,y, x(left), x(right), y(upper), y(lower), x(leftSys), x(rightSys), y(upperSys), y(lowerSys) - data with X and Y and 1st and 2nd level errors
        Parameters:
        sfile - File name with input (extension zip)
        Returns:
        zero if success
      • setSymbolSize

        public void setSymbolSize(int s)
        Sets the symbol size
        Parameters:
        s - symbol size
      • toFile

        public void toFile(String name)
        Write a P2D to an external file.
        Parameters:
        name - File name with output
      • merge

        public P2D merge(P2D a)
        Merge two P2D containers
        Parameters:
        a - Container to be added
        Returns:
        New P2D container
      • setDataArray

        public void setDataArray(jplot.DataArray2D data)
        Set data in a form of DataArray
        Parameters:
        data - input data
      • getDataArray

        public jplot.DataArray2D getDataArray()
        Return a DataArray2D container.
        Returns:
        Container of type DataArray
      • add

        public void add(double x,       double y,       double z)
        Adds values of a plot-point pair (X,Y,Z).
        Parameters:
        x - X-value of the plot-point
        y - Y-value of the plot-point
        z - Z-value of the plot-point
      • fill

        public void fill(double[] xa,        double[] ya,        double[] za)
        Fill a P2D container from 3 arrays. If it is not empty, add values will be appended. It is assumed that all errors are zero.
        Parameters:
        xa - array with X values
        ya - array with Y values
        za - array with Z values
      • set

        public void set(int i,       double x,       double y,       double z)
        Sets the values of (x,y,z).
        Parameters:
        i - index of the plot-point
        x - x-value of the plot-point
        y - y-value of the plot-point
        z - z-value of the plot-point
      • size

        public int size()
        Return the length of the data vector.
        Returns:
        length of the PlotPoint vector
      • copy

        public P2D copy()
        Get a copy of the current holder
      • toString

        public String toString()
        Convert to a string
        Overrides:
        toString in class Object
        Returns:
        String representing the data
      • copy

        public P2D copy(String newtitle)
        create an exact of the current holder
        Parameters:
        newtitle - new title
      • getArrayX

        public double[] getArrayX()
        Get array representing X-values
        Returns:
        array with X values
      • writeSerialized

        public int writeSerialized(String name)
        Write a object to a serialized file
        Parameters:
        name - serialized file name for output.
        Returns:
        zero if no errors
      • readSerialized

        public P2D readSerialized(String name)
        Read a P2D object from a serialized file
        Parameters:
        name - serialized file name for input.
        Returns:
        new P2D object
      • getArrayY

        public double[] getArrayY()
        Get array representing Y-values
        Returns:
        array with Y values
      • getArrayZ

        public double[] getArrayZ()
        Get array representing Z-values
        Returns:
        array with Y values
      • getX

        public double getX(int i)
        Return a specific X-value. This function returns POSINF (1e300) if index i falls beyond the valid range.
        Parameters:
        i - index of the array
        Returns:
        the value of x at index i
      • getY

        public double getY(int i)
        Return a specific Y-value. This function returns POSINF (1e300) if index i falls beyond the valid range.
        Parameters:
        i - index of the array
        Returns:
        the value of y at index i
      • getZ

        public double getZ(int i)
        Return a specific Z-value. This function returns POSINF (1e300) if index i falls beyond the valid range.
        Parameters:
        i - index of the array
        Returns:
        the value of z at index i
      • getMax

        public double getMax(int axis)
        Returns the maximum value in the range.
        Parameters:
        axis - defines to which axis this function applies. axis=0 - X, axis=1 - Y, axis=2 - Z,
        Returns:
        the maximum value.
      • getMin

        public double getMin(int axis)
        Returns the minimum value in the range. axis=0 - X, axis=1 - Y, axis=2 - Z.
        Parameters:
        axis - defines to which axis this function applies.
        Returns:
        the minimum value.
      • meanX

        public double meanX()
        Returns the mean value in X.
        Returns:
        Mean value in X
      • meanY

        public double meanY()
        Returns the mean value in Y.
        Returns:
        Mean value in Y
      • meanZ

        public double meanZ()
        Returns the mean value in Z.
        Returns:
        Mean value in Y
      • mean

        public double mean(int axis)
        Returns the mean value for any axis
        Parameters:
        axis - axis (0,1,2)
        Returns:
        Mean value for axis (0,1,2)
      • clear

        public void clear()
        Clear the container
      • toTable

        public void toTable()
        Print the P2D container to a Table in a separate Frame. The numbers are formatted to scientific format. One can sort and search the data in this table (but not modify)
      • doc

        public void doc()
        Show online documentation.

SCaVis 2.0 © jWork.ORG