public class PND extends Object implements Serializable
| Constructor and Description |
|---|
PND()
Construct an empty container with no title
|
PND(String title)
Construct an empty container with a title
|
PND(String title,
boolean shallow,
PND pnd)
Construct a copy from a PND.
|
PND(String title,
String file)
Construct a container with a title from external file (see the method
toFile() how to write such ASCII file).
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(double[] values)
Adds (appends) the specified element to the end of this list.
|
void |
add(P0D values)
Adds (appends) P0D to the end of this list.
|
void |
clear()
Clear the container
|
PND |
copy(String newtitle)
Create an exact copy of the current P0D.
|
void |
doc()
Show online documentation.
|
double[] |
get(int row)
Return a specific row as array
|
double |
get(int row,
int column)
Return a specific value.
|
double[][] |
getArray()
Get a double array with values.
|
ArrayList<double[]> |
getArrayList()
Get data in form of ArrayList
|
double[] |
getColumn(int column)
Return a specific column as an array
|
P0D |
getColumnP0D(int column)
Return a specific column as P0D object
|
int |
getDimension()
Get last dimension of the data.
|
H1D |
getH1D(int bins)
Create histogram.
|
H1D |
getH1D(int bins,
double min,
double max)
Return H1D histogram with PND content.
|
H1D |
getH1D(int bins,
double min,
double max,
int column)
Make a histogram from a column of PND.
|
hep.aida.IDataPointSet |
getIDataPointSet()
Get the data point set for JAIDA
|
double |
getMax()
Get min value
|
double |
getMin()
Get max value
|
String |
getName()
Get a new title
|
P0D |
getP0D(int column)
Return a specific column as an array
|
P1D |
getP1D(int c1,
int c2)
Return 2 columns as P1D to show as a X-Y plot
|
P2D |
getP2D(int c1,
int c2,
int c3)
Return 3 columns as P2D to show as a X-Y-Z plot
|
P0D |
getRow(int row)
Return a specific row as array
|
P0D |
getRowP0D(int row)
Return a specific row as P0D
|
PND |
getRows(String newtitle,
int indexMin,
int indexMax)
Get rows : min is inxluded, max is not;
|
String |
getTitle()
Get a new title
|
static void |
main(String[] args)
Test
|
PND |
oper(PND pnd,
String what)
Operations on PND containers: add, subtract, multiply, divide.
|
PND |
oper(PND pnd,
String title,
String what)
Operations on PND containers: add, subtract, multiply, divide.
|
void |
operScale(double scale)
Scale each element of data
|
void |
print()
Print PND to System.out.
|
int |
read(BufferedReader br)
Read the data from an external source.
|
int |
read(File sfile)
Read PND from a file.
|
int |
read(String sfile)
Read PND from a file.
|
int |
read(URL url)
Read data from URL.
|
int |
readGZip(File sfile)
Read PND from a GZiped file.
|
int |
readGZip(String sfile)
Read PND from a GZiped file.
|
PND |
readSerialized(String name)
Read a PND object from a serialized file
|
int |
readZip(String sfile)
Read the data from ZIPed external file.
|
PND |
remove(int index)
Remove a row
|
PND |
rescale(double[][] v)
This is an inverse operation to rescale(type) function.
|
double[][] |
rescale(int type)
Rescale the column vectors.
|
void |
set(int index,
double[] values)
Sets (replace) the specified row.
|
void |
set(int index,
P0D values)
Sets (replace) the specified element with P0D.
|
PND |
setArray(double[][] values)
Set values from double array Old content will be lost.
|
void |
setArrayList(ArrayList<double[]> array)
Set the data in form of ArrayList
|
void |
setName(String title)
Set a new title
|
void |
setTitle(String title)
Set a new title
|
int |
size()
Data size (number of rows)
|
PND |
standardize()
Standardize each column.
|
void |
toFile(String name)
Write a PND to an external file.
|
String |
toString()
Get a string representing PND
|
void |
write(String name)
Write a PND to an external file.
|
int |
writeSerialized(String name)
Write a P0D object to a serialized file
|
public PND(String title)
title - A titlepublic PND(String title, boolean shallow, PND pnd)
title - new titleshallow - if true, a shallow copy of a collection.pnd - inpit datapublic PND(String title, String file)
title - A titlefile - input file name. It can be either a file on a file system or URL location (must start from http or ftp)public PND()
public void setTitle(String title)
title - New Titlepublic void setName(String title)
title - New Titlepublic String getTitle()
public String getName()
public void clear()
public double[] get(int row)
row - index of the rowpublic P0D getRowP0D(int row)
row - index of the rowpublic double get(int row,
int column)
row - row indexcolumn - column indexpublic String toString()
public void print()
public P0D getP0D(int column)
column - index of the columnpublic double[] getColumn(int column)
column - index of the columnpublic P0D getColumnP0D(int column)
column - index of the columnpublic P1D getP1D(int c1, int c2)
c1 - index of the first columnc2 - index of the second columnpublic P2D getP2D(int c1, int c2, int c3)
c1 - index of the first columnc2 - index of the second columnc3 - index of the third columnpublic int getDimension()
public P0D getRow(int row)
row - index of the rowpublic ArrayList<double[]> getArrayList()
public hep.aida.IDataPointSet getIDataPointSet()
public void add(double[] values)
values - array of values to be added.public void add(P0D values)
values - array of values to be added.public void set(int index,
double[] values)
index - position indexvalues - array of values to be added.public void set(int index,
P0D values)
index - position indexvalues - array of values to be added.public int read(BufferedReader br)
br - BufferedReaderpublic int read(File sfile)
sfile - input filepublic int read(URL url)
url - URL location of input filepublic int readGZip(String sfile)
Use a space to separate values in columns and new line to put new row.
sfile - File name with input (extension .gz)public int read(String sfile)
The old content will be lost. Use a space to separate values in columns and new line to put new row. Comment lines starting with "#" and "*" are ignored.
sfile - File name with inputpublic int readGZip(File sfile)
sfile - File name with input (extension .gz)public int readZip(String sfile)
sfile - File name with the input (extension .zip)public void write(String name)
name - File name with outputpublic int writeSerialized(String name)
name - serialized file name for output.public PND readSerialized(String name)
name - serialized file name for input.public void toFile(String name)
name - File name with outputpublic PND remove(int index)
index - row index to be removedpublic PND oper(PND pnd, String what)
pnd - Input PND container for operationwhat - String representing the operation: "+" add a P0D container to
the original; "-" subtract a P0D from the original; "*"
multiply; "/" divide by P0Dpublic PND oper(PND pnd, String title, String what)
pnd - Input PND container for operationtitle - New titlewhat - String representing the operation: "+" add a P0D container to
the original; "-" subtract a P0D from the original; "*"
multiply; "/" divide by P0Dpublic void operScale(double scale)
scale - Scale factorpublic int size()
public PND copy(String newtitle)
newtitle - new titlepublic PND getRows(String newtitle, int indexMin, int indexMax)
title - New titleindexMin - min index of rowindexMax - max index of rowpublic void setArrayList(ArrayList<double[]> array)
array - ArrayList to be set.public double[][] getArray()
public PND setArray(double[][] values)
values - array to be set: [ROWS][dimension];public PND standardize()
public double[][] rescale(int type)
type - 0: is ths standard rescaling, i.e.
all columns are rescaled to the range [0,1] This is done
as: v[0] is the min value of X(i), v[1] is the range
(max-min).
type 1: midrange rescaling, i.e. all values are in the range [-1,1]. v[0] is 0.5*(min+max), while [1] is (max-min) /2
public H1D getH1D(int bins, double min, double max)
bins - Number of bins for the histogram.min - Min value of histogrammax - Max value of histogrampublic H1D getH1D(int bins, double min, double max, int column)
bins - Number of binsmin - Min valuemax - Max valuecolumn - column of PND (public H1D getH1D(int bins)
bins - Number of binspublic double getMax()
public double getMin()
public PND rescale(double[][] v)
v - array used to rescale the data. applied as X(i)=S(i)*v[1]+v[0]public static void main(String[] args)
args - public void doc()
jHepWork 3.5 ©