Class P1D
- java.lang.Object
-
- jhplot.Plottable
-
- jhplot.DrawOptions
-
- jhplot.P1D
-
- All Implemented Interfaces:
- java.io.Serializable
public class P1D extends DrawOptions implements java.io.Serializable
A container to hold data points with 1st and 2nd level errors. The first errors are usually statistical, the second error are systematic. P1D can be used for drawing, manipulation with data etc.This is a vast high-performance low-memory footprint data container.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description P1D()
Construct an empty containerP1D(Cloud2D c2d)
Construct P1D from a Cloud2DP1D(DataHolder dh, int i1, int i2)
Create P1D data holder from multidimensional data holder.P1D(DataHolder dh, java.lang.String title, int i1, int i2)
Create P1D data holder from multidimensional data holder.P1D(H1D histo)
Create a P1D container from a histogram.P1D(H1D histo, boolean binMean)
Create a P1D container from a histogram.P1D(H1D histo, boolean binMean, boolean fillXerrors)
Create a P1D container from a histogram.P1D(IDataPointSet pd)
Create a P1D container from IDataPointSet.P1D(P0D p1, P0D p2)
Construct a container from pairs of P0D (one for X, second for Y)P1D(java.lang.String title)
Construct an empty container with a title.P1D(java.lang.String title, java.awt.Color color)
Construct an empty container with a title and color for pointsP1D(java.lang.String title, java.awt.Color color, int symbolstyle)
Construct an empty container with a title and color and symbol style for pointsP1D(java.lang.String title, double[] p1, double[] p2)
Construct a container from pairs X and YP1D(java.lang.String title, DoubleArrayList Xval, DoubleArrayList Yval)
Construct an empty container with a title.P1D(java.lang.String title, H1D histo)
Create a P1D container from a histogram.P1D(java.lang.String title, H1D histo, boolean binMean)
Create a P1D container from a histogram.P1D(java.lang.String title, H1D histo, boolean binMean, boolean fillXerrors)
Create a P1D container from a histogramP1D(java.lang.String title, int dimension)
Construct an empty container with a titleP1D(java.lang.String title, int[] p1, int[] p2)
Construct a container from pairs X and YP1D(java.lang.String title, P0D p1, P0D p2)
Construct a container from pairs of P0D (one for X, second for Y)P1D(java.lang.String title, P1D p1d)
Construct a new copy of the data container.P1D(java.lang.String title, java.lang.String sfile)
Construct a P1D from a file.P1D(java.lang.String title, java.net.URL url)
Construct a P1D from a file on the we web.P1D(java.net.URL url)
Construct a P1D from a file on the we web.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description void
add(double x, double y)
Adds values of a plot-point pair (X,Y).void
add(double x, double y, double err)
Adds the values of a plot-point pair (X,Y).void
add(double x, double y, double upper, double lower)
Add values of a plot-point pair (X,Y).void
add(double x, double y, double left, double right, double upper, double lower)
Adds the values of a plot-point pair (X,Y).void
add(double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
Adds the values of a plot-point pair (x,y).P1D
addAndAverage(P1D[] p1darray)
Return P1D array with weighted average of several measurements.void
addQuick(double x, double y, double err)
Adds the values of a plot-point pair (X,Y).void
addQuick(double x, double y, double upper, double lower)
Add values of a plot-point pair (X,Y).void
addQuick(double x, double y, double left, double right, double upper, double lower)
Adds the values of a plot-point pair (X,Y).void
addQuick(double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
Adds the values of a plot-point pair (x,y).void
clear()
Clear the container.void
combineErr(int axis)
Add 1st and 2nd level in quadrature and attribute the combined error to 1st level error.java.util.Map<java.lang.String,java.lang.Double>
compareChi2(F1D f1)
Compare data with a function.java.util.Map<java.lang.String,java.lang.Double>
compareChi2(P1D h2)
Compare two data sets in X-Y.P1D
copy()
Make a new data holder with the same title from the current one.P1D
copy(java.lang.String newtitle)
create a copy of this container.P1D
derivative()
Calculate derivative for X-Y data points.int
dimension()
Returns the dimension of this P1D holder.void
doc()
Show online documentation.void
fill(Cloud2D c2d)
Fill a P1D container from a Cloud2D.void
fill(double[] xa, double[] ya)
Fill a P1D container from 2 arrays.void
fill(double[] xa, double[] ya, double[] yerror)
Fill a P1D container from 3 arrays (one represents symmetrical errors on Y).void
fill(double[] xa, double[] ya, double[] yupper, double[] ylower)
Fill a P1D container from 4 arrays (last represents asymmetrical upper and lower errors on Y).void
fill(double[] x, double[] y, double[] left, double[] right, double[] upper, double[] lower, double[] left_sys, double[] right_sys, double[] upper_sys, double[] lower_sys)
Fill the values of a X-Y plot-points with full errors.void
fill(int[] xa, int[] ya)
Fill a P1D container from 2 integer arrays.void
fill(P0D xa, P0D ya)
Fill a P1D container from 2 P0D arrays.void
fill(P0D xa, P0D ya, P0D yerror)
Fill a P1D container from P0D arrays (one represents symmetrical errors on Y).void
fillIDataPointSet(IDataPointSet fDps2D)
Fill IDataPointSet.double[]
getArrayErr()
Get array representing (symmetric) error on Y.double[]
getArrayX()
Get array representing X-valuesdouble[]
getArrayXleft()
Get array representing X-left errorsdouble[]
getArrayXleftSys()
Get array representing X-left 2nd level errorsdouble[]
getArrayXright()
Get array representing X-right errorsdouble[]
getArrayXrightSys()
Get array representing X-right 2nd level errorsdouble[]
getArrayY()
Get array representing Y-valuesdouble[]
getArrayYlower()
Get array representing Y lower errorsdouble[]
getArrayYlowerSys()
Get array representing Y lower 2nd level errorsdouble[]
getArrayYupper()
Get array representing Y upper errorsdouble[]
getArrayYupperSys()
Get array representing Y upper 2nd level errorsjplot.DataArray
getDataArray()
Return a DataArray container from JPlotint
getDimension()
Returns the dimension of this P1D holder.double
getErr(int i)
Return (symmetric) error on Y-value.double
getError(int i)
Return error (uncertainty) on the Y value.IDataPointSet
getIDataPointSet()
Get IDataPointSet.jplot.LinePars
getLinePars()
get LinePars class which holds graphical attributesdouble
getMax(int axis)
Returns the maximum value in the range.int
getMaxIndex(int axis)
Returns the index of maximum value in the range.double
getMin(int axis)
Returns the minimum value in the range.int
getMinIndex(int axis)
Returns the index of minimum value in the range.double
getQuickX(int i)
Return a specific X-value quickly (no bound check).double
getQuickY(int i)
Return a specific Y-value quickly (no bound check).java.util.Map<java.lang.String,java.lang.Double>
getStat(int axis)
Get complete statistics for this container for a given axis.P1D
getSys(P1D[] p1darray)
Return P1D array which contains 2nd level errors (or systematic errors) evaluated from an array of P1D data holders.double
getX(int i)
Return a specific X-value.DoubleArrayList
getXE1left()
Left error on X (1st level)DoubleArrayList
getXE1right()
Right eroor on XDoubleArrayList
getXE2left()
Left error on X (2nd level)DoubleArrayList
getXE2right()
Right error (2nd level) on Xdouble
getXleft(int i)
Return a specific left error on X-value.double
getXleftSys(int i)
Return a specific left error on X-value (systematic error).double
getXright(int i)
Return a specific right error on X-value.double
getXrightSys(int i)
Return a specific right error on X-value (systematic error).DoubleArrayList
getXval()
Get array of X values;double
getY(int i)
Return a specific Y-value.DoubleArrayList
getYE1down()
Down error on Y (1st level)DoubleArrayList
getYE1upper()
Upper error on Y (1st level)DoubleArrayList
getYE2down()
Down error on Y (2nd level)DoubleArrayList
getYE2upper()
Upper error on Y (2nd level)double
getYlower(int i)
Return a specific lower error on Y-value.double
getYlowerSys(int i)
Return a specific total lower error on Y-value.double
getYupper(int i)
Return a specific upper error on Y-value.double
getYupperSys(int i)
Return a specific systematical upper error on Y-value.DoubleArrayList
getYval()
Get array of Y values;int
hashCode()
Returns the hash code value for this collection (onoy X,Y values)int
indexOf(double valueX, double valueY)
Searches the list front to back for the index of value, starting at offset.int
indexOfX(double valueX)
Searches the list front to back for the index of value, starting at offset.int
indexOfY(double valueY)
Searches for a Y value starting at offset.double
integral()
Integrate P1D (sum up all Y values)double
integral(int IndexMin, int IndexMax)
Integrate P1D between two indices (between 1 and max index)int
lastIndexOf(double valueX, double valueY)
Searches for the index of value, starting at offset, but backwards Here we search for (X,Y) pairs only.int
lastIndexOfX(double valueX)
Searches for value in X backwards.int
lastIndexOfY(double valueY)
Searches for a Y value backewards.double
meanX()
Returns the mean value in X.double
meanXerror()
Returns the standard error of the mean values for X.double
meanY()
Returns the mean value in Y.double
meanYerror()
Returns the standard error of the mean values for Y.P1D
merge(P1D p1d)
Merge two P1D containers.P1D
move(java.lang.String what, java.lang.String how)
Transform a P1D data holder to some function with error propagation (for both levels)int
oper(P1D a, java.lang.String what)
Operations on P1D container: add, subtract, multiply, divide.int
oper(P1D a, java.lang.String title, java.lang.String what)
Operations on P1D containers: add, subtract, multiply, divide.P1D
oper(P1D a, java.lang.String title, java.lang.String what, java.lang.String how, P1D corr)
Operations on P1D containers: add, subtract, multiply, divide.P1D
operErrSys(java.lang.String title, int axis, P1D left, P1D right)
Obtain a new P1D with 2nd-level errors on X or Y obtained from two P1D objects, one represents left on X (or lower on Y) error and the other represents the right on X (or upper on Y) error.void
operPlusY(P1D p1)
Add all Y-values from another P1D.void
operScale(int axis, double scale)
Scale X-values (axis=0) or Y values (axis=1) and their errors with a scale factor.void
operScaleErr(int axis, double scale)
Scale 1st level errors with a scale factor.void
operScaleErrSys(int axis, double scale)
Scale 2nd level errors with a scale factor.P1D
operSmooth(int axis, boolean isWeighted, int k)
Smooth P1D data points in either X or Y.P1D
operSmoothGauss(int axis, double standardDeviation)
Computes a Gaussian smoothed version of P1D.void
print()
Print a P1D container on the screenP1D
range(int IndexMin, int IndexMax)
Obtain a new PD1 in the range between Min and Max indexes.P1D
rangeCut(int axis, double Min, double Max)
Construct P1D removing a range of values defined by Min and Max.int
read(java.io.BufferedReader br)
Read data using 10-column format.int
read(java.lang.String sfile)
Read P1D from a file.int
read(java.net.URL url)
Read data from URL.int
readGZip(java.lang.String sfile)
Read P1D from a GZiped file.P1D
readSerialized(java.lang.String name)
Read a P1D object from a serialized fileint
readZip(java.lang.String sfile)
Read P1D from a Zipped file.P1D
remove(int position)
Removes at the positionvoid
removeAt(int index)
Remove a (X,Y) value at a given indexdouble
rmsX()
Returns RMS for X-values.double
rmsY()
Returns RMS for Y-values.void
set(int i, double x, double y)
Sets the values of a plot-point pair (X,Y).void
set(int i, double x, double y, double err)
Sets the values of a plot-point pair (x,y).void
set(int i, double x, double y, double upper, double lower)
Sets the values of a plot-point pair (x,y).void
set(int i, double x, double y, double left, double right, double upper, double lower)
Sets the values of a plot-point pair (x,y).void
set(int i, double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
Sets the values of a plot-point pair (x,y).void
setArrayX(double[] x)
Set array at oncevoid
setArrayY(double[] y)
Set array at oncevoid
setDataArray(jplot.DataArray data)
Set data in a form of DataArrayvoid
setDimension(int dimension)
Set the dimension for the container.void
setErrAllToZero(java.lang.String title, int axis)
Set all (1st and 2nd) level errors to zero.void
setErrSqrt(int axis)
Set 1st level error to sqrt of X or Y values.void
setErrSysToZero(int axis)
Set 2nd level errors to zero.void
setErrToZero(int axis)
Set 1st level errors to zero.void
setLinePars(jplot.LinePars pnew)
Sets LinePars class for graphical attributesvoid
setQuick(int i, double x, double y)
setQuicks the ith value of a plot-point pair (x,y).void
setQuick(int i, double x, double y, double err)
setQuicks the ith value of a plot-point pair (x,y).void
setQuick(int i, double x, double y, double upper, double lower)
setQuicks the ith value of a plot-point pair (x,y).void
setQuick(int i, double x, double y, double left, double right, double upper, double lower)
setQuicks the ith value of a plot-point pair (x,y).void
setQuick(int i, double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
setQuicks the ith value of a plot-point pair (x,y).void
setXE1left(DoubleArrayList xE1left)
Error on X left.Statistical error.void
setXE1right(DoubleArrayList xE1right)
Error on X.void
setXE2left(DoubleArrayList xE2left)
Set left second-level errorsvoid
setXE2right(DoubleArrayList xE2right)
Set right second-level errorsvoid
setXval(DoubleArrayList X)
Set X values as arrayvoid
setYE1down(DoubleArrayList yE1down)
Set statististical down errorvoid
setYE1upper(DoubleArrayList yE1upper)
Set statistical error on Y 91st level)void
setYE2down(DoubleArrayList yE2down)
Set second level down error on Yvoid
setYE2upper(DoubleArrayList yE2upper)
Set second level upper error on Yvoid
setYval(DoubleArrayList yval)
Set Y valuesint
size()
Return the length of the data vector.void
sort(int axis)
Sorting the original array using either X or Y values.double
stddeviationX()
Standard deviation of values X.double
stddeviationY()
Standard deviation of values Y.void
toFile(java.lang.String name)
Write a P1D to an external file.void
toFileAsLatex(java.lang.String name, java.text.DecimalFormat dx, java.text.DecimalFormat dy)
Write a File in form of LaTeX table from values in the container P1Djava.lang.String
toString()
Convert to a stringvoid
toTable()
Show in a Table in a separate Frame.void
updateSummary()
Deprecated.Debricated!double
varianceX()
Returns variance for X-values.double
varianceY()
Returns variance for Y-values.int
writeSerialized(java.lang.String name)
Write a P0D object to a serialized file-
Methods inherited from class jhplot.DrawOptions
copyLinePars, getBinWidth, getColor, getDrawOption, getDrawOptions, getFillColor, getLegend, getLineParm, getLineStyle, getNameX, getNameY, getNameZ, getPenWidth, getSymbol, getSymbolShape, getSymbolSize, getTitle, getType, isBars, isErrX, isErrY, isFilled, printDrawOptions, printDrawOptions, setBars, setBinWidth, setColor, setDrawLine, setDrawLineKey, setDrawOption, setDrawSymbol, setErr, setErrAll, setErrColor, setErrColor, setErrColorX, setErrColorY, setErrFill, setErrFillColor, setErrFillColor, setErrSys, setErrSysFill, setErrSysFillColor, setErrSysFillColor, setErrSysX, setErrSysY, setErrTicSize, setErrX, setErrY, setFill, setFillColor, setFillColorTransparency, setGraphStyle, setLegend, setLineStyle, setNameX, setNameY, setNameZ, setPenDash, setPenDash, setPenWidth, setPenWidthErr, setPenWidthErrSys, setStyle, setSymbol, setSymbol, setSymbolSize, setTitle, setType
-
-
-
-
Constructor Detail
-
P1D
public P1D()
Construct an empty container
-
P1D
public P1D(java.lang.String title)
Construct an empty container with a title. It is assumed that on X and Y values will be stored (dimension 2).- Parameters:
title
- New title
-
P1D
public P1D(java.lang.String title, DoubleArrayList Xval, DoubleArrayList Yval)
Construct an empty container with a title. It is assumed that on X and Y values will be stored (dimension 2).- Parameters:
title
- New title
-
P1D
public P1D(java.lang.String title, int dimension)
Construct an empty container with a title- Parameters:
title
- New titledimension
- dimension (2,4,6,10)
-
P1D
public P1D(java.lang.String title, java.awt.Color color)
Construct an empty container with a title and color for points- Parameters:
title
- New titlecolor
- for points
-
P1D
public P1D(java.lang.String title, java.awt.Color color, int symbolstyle)
Construct an empty container with a title and color and symbol style for points- Parameters:
title
- New titlecolor
- for pointsstyle
- used to draw symbols (1,2,3,4..)
-
P1D
public P1D(P0D p1, P0D p2)
Construct a container from pairs of P0D (one for X, second for Y)- Parameters:
p1
- P1D representing Xp2
- P1D representing Y
-
P1D
public P1D(java.lang.String title, P0D p1, P0D p2)
Construct a container from pairs of P0D (one for X, second for Y)- Parameters:
title
- new titlep1
- P1D representing Xp2
- P1D representing Y
-
P1D
public P1D(Cloud2D c2d)
Construct P1D from a Cloud2D- Parameters:
c2d
- input cloud2d
-
P1D
public P1D(java.lang.String title, double[] p1, double[] p2)
Construct a container from pairs X and Y- Parameters:
title
- new titlep1
- array representing Xp2
- array representing Y
-
P1D
public P1D(java.lang.String title, int[] p1, int[] p2)
Construct a container from pairs X and Y- Parameters:
title
- new titlep1
- array representing Xp2
- array representing Y
-
P1D
public P1D(java.lang.String title, P1D p1d)
Construct a new copy of the data container.- Parameters:
title
- New titlep1d
- input P1D object
-
P1D
public P1D(DataHolder dh, java.lang.String title, int i1, int i2)
Create P1D data holder from multidimensional data holder. You should specify a slice which you want to export (X,Y) pair of P1D- Parameters:
dh
- Input data containertitle
- New titlei1
- Index of the first columni2
- Index of the second column
-
P1D
public P1D(DataHolder dh, int i1, int i2)
Create P1D data holder from multidimensional data holder. You should specify a slice which you want to export (X,Y) pair of P1D. The title is default- Parameters:
dh
- Input data containeri1
- Index of the first columni2
- Index of the second column
-
P1D
public P1D(java.lang.String title, java.lang.String sfile)
Construct a P1D from a file.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. Comments lines starting with "#" and "*" are ignored.
- Parameters:
title
- Title of the containersfile
- File name with input. input file name. It can be either a file on a file system or URL location (must start from http or ftp)
-
P1D
public P1D(IDataPointSet pd)
Create a P1D container from IDataPointSet.- Parameters:
pd
- Imported IDataPointSet.
-
P1D
public P1D(java.lang.String title, H1D histo, boolean binMean, boolean fillXerrors)
Create a P1D container from a histogram- Parameters:
title
- New titlehisto
- Imported histogrambinMean
- If true, Y values are put to the mean values in each bin. If false, is just a height in the histogram binfillXerrors
- If true, errors are set to X values (half of the bin width) If false, errors on X are set to zero
-
P1D
public P1D(H1D histo, boolean binMean, boolean fillXerrors)
Create a P1D container from a histogram. The title is set to the histogram title.- Parameters:
histo
- Imported histogrambinMean
- If true, Y values are put to the mean values in each bin. If false, Y corresponds to height of the histogram binfillXerrors
- If true, errors are set to X values (half of the bin width) If false, errors on X are set to zero
-
P1D
public P1D(java.lang.String title, H1D histo, boolean binMean)
Create a P1D container from a histogram. The title is set to the histogram title. Show errors on X as bin width x 0.5- Parameters:
title
- New titlehisto
- Imported histogrambinMean
- If true, Y values are put to the mean values in each bin. If false, Y is just a center of the histogram bin
-
P1D
public P1D(H1D histo, boolean binMean)
Create a P1D container from a histogram. The title is set to the histogram title. Show errors on X as bin width x 0.5- Parameters:
histo
- Imported histogrambinMean
- If true, Y values are put to the mean values in each bin. If false, Y is just a height of the histogram bin
-
P1D
public P1D(H1D histo)
Create a P1D container from a histogram. The title is set to the histogram title. Show errors on X as bin width x 0.5. The Y points are set to the high values in each bin.- Parameters:
histo
- Imported histogram
-
P1D
public P1D(java.lang.String title, H1D histo)
Create a P1D container from a histogram. The title is set to the histogram title. Show errors on X as bin width x 0.5 The Y points are set to the mean values in each bin.- Parameters:
title
- New titlehisto
- Imported histogram
-
P1D
public P1D(java.lang.String title, java.net.URL url)
Construct a P1D from a file on the we web. 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. Comments lines starting with "#" and "*" are ignored. Numbers are separated by a space.- Parameters:
title
- Title of the containerurl
- URL location
-
P1D
public P1D(java.net.URL url)
Construct a P1D from a file on the we web. 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. Comments lines starting with "#" and "*" are ignored. Numbers are seprated by space.- Parameters:
url
- URL location
-
-
Method Detail
-
setDimension
public void setDimension(int dimension)
Set the dimension for the container. Can be: 2: for X,Y
3: for X,Y and error on Y
4: for X,Y and error on Y (up) and Y (down)
6: for X,Y and error on Y (up) and Y (down) and X(left) and X(right)
10: same as before but 2nd level errors (usually systematics)- Parameters:
dimension
- dimension used.
-
getLinePars
public jplot.LinePars getLinePars()
get LinePars class which holds graphical attributes- Returns:
- Graphic attributes
-
setLinePars
public void setLinePars(jplot.LinePars pnew)
Sets LinePars class for graphical attributes- Parameters:
pnew
- Graphic attributes
-
toFileAsLatex
public void toFileAsLatex(java.lang.String name, java.text.DecimalFormat dx, java.text.DecimalFormat dy)
Write a File in form of LaTeX table from values in the container P1D- Parameters:
name
- Name of the filedx
- Format of x valuesdy
- Format of y values
-
toFile
public void toFile(java.lang.String name)
Write a P1D to an external file. If errors on data points are not given, they are set to 0- Parameters:
name
- File name with output
-
print
public void print()
Print a P1D container on the screen
-
toString
public java.lang.String toString()
Convert to a string- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representing P1D
-
merge
public P1D merge(P1D p1d)
Merge two P1D containers.- Parameters:
p1d
- Container to be added- Returns:
- modified P1D container
-
remove
public P1D remove(int position)
Removes at the position- Parameters:
position
-- Returns:
-
hashCode
public int hashCode()
Returns the hash code value for this collection (onoy X,Y values)- Overrides:
hashCode
in classjava.lang.Object
-
indexOf
public int indexOf(double valueX, double valueY)
Searches the list front to back for the index of value, starting at offset. Here we search for (X,Y) value. The search is done for pairs only.- Parameters:
valueX
- X valuevalueY
- Y value- Returns:
- index of X with found pair value. If not pair found, return -1.
-
lastIndexOf
public int lastIndexOf(double valueX, double valueY)
Searches for the index of value, starting at offset, but backwards Here we search for (X,Y) pairs only.- Parameters:
valueX
- X valuevalueY
- Y value- Returns:
- index with the found pair value (or -1 if not found)
-
indexOfX
public int indexOfX(double valueX)
Searches the list front to back for the index of value, starting at offset.- Parameters:
valueX
- X value- Returns:
- index of found value
-
lastIndexOfX
public int lastIndexOfX(double valueX)
Searches for value in X backwards.- Parameters:
valueX
- X value- Returns:
- index of found value
-
indexOfY
public int indexOfY(double valueY)
Searches for a Y value starting at offset. Here we serch for (Y) value.- Parameters:
valueY
- Y value- Returns:
- index of found value
-
lastIndexOfY
public int lastIndexOfY(double valueY)
Searches for a Y value backewards.- Parameters:
valueY
- Y value- Returns:
- index of found value
-
setDataArray
public void setDataArray(jplot.DataArray data)
Set data in a form of DataArray- Parameters:
data
- input data
-
operScale
public void operScale(int axis, double scale)
Scale X-values (axis=0) or Y values (axis=1) and their errors with a scale factor. The object to be returned is the same, only X or Y are scaled.- Parameters:
axis
- axis for which scaling is applied. set to 0 for X and set to 1 for Y.scale
- Scale factor
-
setErrToZero
public void setErrToZero(int axis)
Set 1st level errors to zero. All other errors are the same as before.- Parameters:
axis
- axis = 0 for X, axis =1 for Y
-
setErrAllToZero
public void setErrAllToZero(java.lang.String title, int axis)
Set all (1st and 2nd) level errors to zero. If axis=0, for X values if axis=1, for Y values- Parameters:
axis
- axis = 0 for X, axis =1 for Y
-
setErrSysToZero
public void setErrSysToZero(int axis)
Set 2nd level errors to zero.- Parameters:
axis
- axis = 0 for X, axis =1 for Y
-
setErrSqrt
public void setErrSqrt(int axis)
Set 1st level error to sqrt of X or Y values. If axis=0, left and right errors will be set on X as sqrt(X). If axis=1, upper and lower errors will be set on Y as sqrt(Y).- Parameters:
axis
- axis (=0 for X, 1 for Y).
-
operScaleErrSys
public void operScaleErrSys(int axis, double scale)
Scale 2nd level errors with a scale factor. If axis=0, the scaling is applied to errors on X, if axis=1, the scale factor is applied for errors on Y.- Parameters:
axis
- axis to a which a scale factor is applied (=0 for X, =1 for Y).scale
- Scale factor to be applied to 2nd level errors defined by axis
-
operPlusY
public void operPlusY(P1D p1)
Add all Y-values from another P1D. X-values will be unchanged. 1st and 2nd errors on Y are added in quadrature assuming uncorrelated Y-values. Dimensions are assumed to be the same.- Parameters:
p1d
- P1D to be added to the original. Only Y-values are added, x-values are unchanged.
-
operScaleErr
public void operScaleErr(int axis, double scale)
Scale 1st level errors with a scale factor. If axis=0, the scaling is applied to errors on X, if axis=1, the scale factor to errors on Y.- Parameters:
axis
- axis to which a scale factor is applied (=0 for X, 1 for Y).scale
- Scale factor to be applied to 1st level errors defined by axis
-
operErrSys
public P1D operErrSys(java.lang.String title, int axis, P1D left, P1D right)
Obtain a new P1D with 2nd-level errors on X or Y obtained from two P1D objects, one represents left on X (or lower on Y) error and the other represents the right on X (or upper on Y) error. To define X or Y axis, use "axis" variable. If axis=0, this method will be applied for X, if axis=1, this will be applied for Y. This means the central X,Y values are given by the original P1D, while 2nd level errors on X or Y of the original P1D are given by the differences: central-left and right-central for X or upper-central and central-lower for Y. The statistical errors (1st-level errors) are the same as for the original P1D. In case if it happen that the upper P1D is lower than the central value, it takes absolute value. This method is useful if you need to plot uncertainties associated with a measurement. Note: the method does create new object.- Parameters:
title
- New Titleaxis
- axis=0, errors will be set to X (left and right). If axis=1, errors will be set as lower and upper error.left
- P1D used to build left errors on the central values (in X, when axis=0) or lower error on Y (when axis=1)right
- P1D used to build right errors on the central values (in X, when axis=0) or upper error on Y (when axis=1)- Returns:
- Same P1D container with the 2nd-level errors on X or Y given by the differences between the original P1D and left (or right) P1Ds (if axis=0), or upper and lower P1Ds (if axis=1)
-
oper
public int oper(P1D a, java.lang.String what)
Operations on P1D container: add, subtract, multiply, divide. Keep the same graphical attributes and the title as for the original container. Note, no new object is created.- Parameters:
a
- Input P1D containerwhat
- the operation type (+,-,*,/)- Returns:
- 0 if no problems.
-
oper
public int oper(P1D a, java.lang.String title, java.lang.String what)
Operations on P1D containers: add, subtract, multiply, divide. Keep the same graphical attributes, They are all applied for "Y", rather than for X. Errors on Y (1st and 2nd) will be propogared assuming independence of the the containers. Only 1st level error (statisticals) are propogared, the second-level errors are the same.- Parameters:
a
- Input P1D container for operation (may contain errors on Y).title
- New titlewhat
- String representing the operation:
"+" add a P1D container to the original;
"-" subtract a P1D from the original;
"*" multiply;
"/" divide by P1D- Returns:
- error code:
0 means OK
1: means divistion by zero
2: error during error evalutaion
-
oper
public P1D oper(P1D a, java.lang.String title, java.lang.String what, java.lang.String how, P1D corr)
Operations on P1D containers: add, subtract, multiply, divide. Keep the same graphical attributes. Correlated errors are taken into account via additional P1D data holder which keeps correlation coefficients. The size of this P1D holder should be equal to the original size of P1D.This container assumes the dimension 10 (2 X,Y values and 6 errors)
- Parameters:
a
- Input P1D container for the operationtitle
- New titlewhat
- String representing the operation: "+" add a P1D to the original; "-" subtract a P1D from the original "*"; multiply "/" dividehow
- how the operation should be performed: "X" - for X values; "Y" - do it for Y values; XY - do for X and Y values. Normally, however, you should do this for the Y option.corr
- P1D container which keeps correlation coefficients for each point. In most general case, this container should be filled as: add(0,0,x1,x2,x3,x4,y1,y2,y3,y4), where x1 (left), x2(right), x3(leftSys), x4(rightSys) - coefficients on X y1 (up), y2(down), y3(upSys), x4(downSys) - coefficients on Y. For example, in a simplest case when Y has 1st level (symmetrical statistical) errors and X does not have any, you need just define "corr" by filling it with: add(0,0,0,0,0,0,c,c,0,0), where c is a correlation coefficient. If "Y" values have both statistical and systematic errors, use the correlation P1D holder of the form add(0,0,0,0,0,0,c,c,c1,c2),- Returns:
- Output P1D container
-
move
public P1D move(java.lang.String what, java.lang.String how)
Transform a P1D data holder to some function with error propagation (for both levels)- Parameters:
what
- what operation should be performed: "inverse" - inverse to (1/a); "sqrt" - sqrt(a); "exp" - exp(a); "log" - log10(a); "cos" - cos(a) ;"sin" - sin(a); "tan" - tan(a); "acos" - acos(a); "asin" - asin(a); "atan" - atan(a); "cosh" - cosh(a); "sinh" - sinh(a); "tanh" - tanh(a); "square" - a**2how
- how the operation should be performed: "X" - for X values; "Y" - do it for Y values; XY - do for X and Y- Returns:
- transformed P1D object
-
getDataArray
public jplot.DataArray getDataArray()
Return a DataArray container from JPlot- Returns:
- Container of type DataArray
-
add
public void add(double x, double y)
Adds values of a plot-point pair (X,Y). All 1st and 2nd level errors on X and Y are assumed to be 0. The dimension of this container is 2 by default.- Parameters:
x
- X-value of the plot-pointy
- Y-value of the plot-point
-
addQuick
public void addQuick(double x, double y, double err)
Adds the values of a plot-point pair (X,Y). It is assumed that Y-values have 1st level symmetrical errors (i.e. statistical errors). All other errors are set to 0 This point is added at the end of the array.This is a fast implementation. Not check of the dimension is done. The dimension of this container should be set to 3 before you use this method.
- Parameters:
x
- X-value of the plot-pointy
- Y-value of the plot-pointerr
- an error on Y (assume symmetrical)
-
add
public void add(double x, double y, double err)
Adds the values of a plot-point pair (X,Y). It is assumed that Y-values have 1st level symmetrical errors (i.e. statistical errors). All other errors are set to 0 This point is added at the end of the array.This is a slower implementation than addQuick(), since if the dimension is set wrong, it will be adjusted to 3.
- Parameters:
x
- X-value of the plot-pointy
- Y-value of the plot-pointerr
- an error on Y (assume symmetrical)
-
addQuick
public void addQuick(double x, double y, double upper, double lower)
Add values of a plot-point pair (X,Y). The points include upper and lower errors on Y. All other errors are set to 0. This point is added at the end of the array.The container should be initialized with dimenstion 4 before using this method. This is a fast implementation without dimension check.
- Parameters:
x
- X-value of the plot-pointy
- Y-value of the plot-pointupper
- - upper error on Ylower
- - lower error on Y
-
add
public void add(double x, double y, double upper, double lower)
Add values of a plot-point pair (X,Y). The points include upper and lower errors on Y. All other errors are set to 0. This point is added at the end of the array.This is a slower implementation than addQuick(), since if the dimension is set wrong, it will be adjusted to 4.
- Parameters:
x
- X-value of the plot-pointy
- Y-value of the plot-pointupper
- - upper error on Ylower
- - lower error on Y
-
add
public void add(double x, double y, double left, double right, double upper, double lower)
Adds the values of a plot-point pair (X,Y). It includes upper and lower errors on Y and left and right error on X. 2nd level errors are assumed to be 0. This point is added at the end of the array.This is a slower implementation than addQuick(), since if the dimension is set wrong, it will be adjusted to 6.
- Parameters:
x
- X-value of the plot-pointy
- Y-value of the plot-pointleft
- - left error on Xright
- - right error on Xupper
- - upper error on Ylower
- - lower error on Y
-
addQuick
public void addQuick(double x, double y, double left, double right, double upper, double lower)
Adds the values of a plot-point pair (X,Y). It includes upper and lower errors on Y and left and right error on X. 2nd level errors are assumed to be 0. This point is added at the end of the array.The container should be initialized with dimenstion 6 before using this method. This is a fast implementation without dimension check.
- Parameters:
x
- X-value of the plot-pointy
- Y-value of the plot-pointleft
- - left error on Xright
- - right error on Xupper
- - upper error on Ylower
- - lower error on Y
-
add
public void add(double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
Adds the values of a plot-point pair (x,y). It includes upper and lower errors on X and Y, including 1st and 2nd level errors (i.e. statistical and systematic). This point is added at the end of the array.This is a slower implementation than addQuick(), since if the dimension is set wrong, it will be adjusted to 10.
- Parameters:
x
- x-value of the plot-pointy
- y-value of the plot-pointleft
- - error on x (left)right
- - error on x (right)upper
- - error on y (upper)lower
- - error on y (lower)left_sys
- - error on x (left) - second level, used for systematicsright_sys
- - error on x (right)upper_sys
- - error on y (upper)lower_sys
- - error on y (lower)
-
addQuick
public void addQuick(double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
Adds the values of a plot-point pair (x,y). It includes upper and lower errors on X and Y, including 1st and 2nd level errors (i.e. statistical and systematic). This point is added at the end of the array.The container should be initialized with dimenstion 6 before using this method. This is a fast implementation without dimension check.
- Parameters:
x
- x-value of the plot-pointy
- y-value of the plot-pointleft
- - error on x (left)right
- - error on x (right)upper
- - error on y (upper)lower
- - error on y (lower)left_sys
- - error on x (left) - second level, used for systematicsright_sys
- - error on x (right)upper_sys
- - error on y (upper)lower_sys
- - error on y (lower)
-
set
public void set(int i, double x, double y)
Sets the values of a plot-point pair (X,Y). All errors are assumed to be 0- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-point
-
set
public void set(int i, double x, double y, double upper, double lower)
Sets the values of a plot-point pair (x,y). The dimension of the container should be 4.- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-pointupper
- upper error on ylower
- lower error on y
-
set
public void set(int i, double x, double y, double err)
Sets the values of a plot-point pair (x,y). The dimension of the container should be 3.If dimension is wrong, extend it to 3.
- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointerr
- error on Y (symmetric)
-
set
public void set(int i, double x, double y, double left, double right, double upper, double lower)
Sets the values of a plot-point pair (x,y). The dimension must be 6.- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-pointleft
- - error on x (left)right
- - error on x (right)upper
- - error on y (upper)lower
- - error on y (lower)
-
set
public void set(int i, double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
Sets the values of a plot-point pair (x,y). The dimension must be 10.- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-pointleft
- - error on x (left)right
- - error on x (right)upper
- - error on y (upper)lower
- - error on y (lower)left_sys
- - error on x (left) - second level, used for systematicsright_sys
- - error on x (right)upper_sys
- - error on y (upper)lower_sys
- - error on y (lower)
-
updateSummary
public void updateSummary()
Deprecated. Debricated!Update summary of the data. This is necessary after using "setQuick" method, since a single setQuickment of a data point does not trigger update of min and max for the data ranges. You do not need to do this if you use "add" or "set" methods.
-
setQuick
public void setQuick(int i, double x, double y, double left, double right, double upper, double lower, double left_sys, double right_sys, double upper_sys, double lower_sys)
setQuicks the ith value of a plot-point pair (x,y). After all setQuickments are done, call updateSummary method to get autorange axis values. The dimension must be 10.- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-pointleft
- - error on x (left)right
- - error on x (right)upper
- - error on y (upper)lower
- - error on y (lower)left_sys
- - error on x (left) - second level, used for systematicsright_sys
- - error on x (right)upper_sys
- - error on y (upper)lower_sys
- - error on y (lower)
-
setQuick
public void setQuick(int i, double x, double y, double left, double right, double upper, double lower)
setQuicks the ith value of a plot-point pair (x,y). After all setQuickments are done, call updateSummary method to get autorange axis values.The dimension must be 6.
- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-pointleft
- - error on x (left)right
- - error on x (right)upper
- - error on y (upper)lower
- - error on y (lower)
-
setQuick
public void setQuick(int i, double x, double y, double upper, double lower)
setQuicks the ith value of a plot-point pair (x,y). After all setQuickments are done, call updateSummary method to get autorange axis values.The dimension must be 4.
- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-pointupper
- - error on y (upper)lower
- - error on y (lower)
-
setQuick
public void setQuick(int i, double x, double y, double err)
setQuicks the ith value of a plot-point pair (x,y). After all setQuickments are done, call updateSummary method to get autorange axis values.The dimension must be 3.
- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-pointerr
- - error on y (symmetric)
-
setQuick
public void setQuick(int i, double x, double y)
setQuicks the ith value of a plot-point pair (x,y). After all setQuickments are done, call updateSummary method to get autorange axis values.- Parameters:
i
- index of the plot-pointx
- x-value of the plot-pointy
- y-value of the plot-point
-
compareChi2
public java.util.Map<java.lang.String,java.lang.Double> compareChi2(F1D f1)
Compare data with a function. The comparison tests hypotheses that the data represent identical distribution with a function using Pearson's chi-squared test. The number chi2/ndf gives the estimate (values close to 1 indicates similarity between 2 histograms.). the function and histogram are identical if chi2=0. Chi2/ndf and p-value probability is 1. Maken sure that statistical errors are included correctly. Data with zero errors will be ignored.- Parameters:
f1
- function to compare to.- Returns:
- map with the result. It gives Chi2, gives number of degrees of freedom (ndf), probability ("quality", or p-value).
-
compareChi2
public java.util.Map<java.lang.String,java.lang.Double> compareChi2(P1D h2)
Compare two data sets in X-Y. Comparison of two data sets test hypotheses that two data sets represent identical distributions in 2D. It calculates Chi2 between values in Y taking into account errors on the Y values. The number chi2/ndf gives the estimate (values close to 1 indicates similarity between 2 histograms.) Two P1D are identical if chi2=0. Chi2/ndf can be obtained as output[0]/output[1]. Probability (p-value) is 1.Make sure that both P1D have symmetric errors on Y (first level, i.e. obtained with the method getYupper(i) (or set them to small values).
- Parameters:
h2
- second P1D- Returns:
- the result. It gives Chi2, gives number of degrees of freedom (ndf), and probability ("quality", or p-value).
-
size
public int size()
Return the length of the data vector.- Returns:
- length of the PlotPoint vector
-
getArrayX
public double[] getArrayX()
Get array representing X-values- Returns:
- array with X values
-
copy
public P1D copy(java.lang.String newtitle)
create a copy of this container.- Parameters:
newtitle
- new title
-
setXE2left
public void setXE2left(DoubleArrayList xE2left)
Set left second-level errors- Parameters:
xE2left
-
-
setXE2right
public void setXE2right(DoubleArrayList xE2right)
Set right second-level errors- Parameters:
xE2right
-
-
writeSerialized
public int writeSerialized(java.lang.String name)
Write a P0D object to a serialized file- Parameters:
name
- serialized file name for output.- Returns:
- zero if no errors
-
readSerialized
public P1D readSerialized(java.lang.String name)
Read a P1D object from a serialized file- Parameters:
name
- serialized file name for input. Can be URL if starts from http.- Returns:
- new P1D object
-
read
public int read(java.io.BufferedReader br)
Read data using 10-column format. Each line corresponds to a new data point.- Parameters:
br
- BufferedReader- Returns:
- 0 if no errors
-
read
public int read(java.net.URL url)
Read data from URL. Use a space to separate values in columns and new line to put new data point.- Parameters:
url
- URL location of input file
-
readGZip
public int readGZip(java.lang.String sfile)
Read P1D 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 new line to put new row.
- Parameters:
sfile
- File name with input (extension .gz)- Returns:
- zero if success
-
read
public int read(java.lang.String sfile)
Read P1D from a 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. Comment lines starting with "#" and "*" are ignored. It can read URL if the string starts from http or ftp, otherwise a file on the file system is assumed.
- Parameters:
sfile
- File name with input. If the string starts from http or ftp, otherwise a file on the file system is assumed.- Returns:
- zero if success
-
readZip
public int readZip(java.lang.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. Comment lines starting with "#" and "*" are ignored.- Parameters:
sfile
- File name with input (extension zip)- Returns:
- zero if success
-
copy
public P1D copy()
Make a new data holder with the same title from the current one.- Returns:
- new data holder
-
operSmooth
public P1D operSmooth(int axis, boolean isWeighted, int k)
Smooth P1D data points in either X or Y.It is smoothed by averaging over a moving window of a size specified by the method parameter: if the value of the parameter is k then the width of the window is 2*k + 1. If the window runs off the end of the P1D only those values which intersect the histogram are taken into consideration. The smoothing may optionally be weighted to favor the central value using a "triangular" weighting. For example, for a value of k equal to 2 the central bin would have weight 1/3, the adjacent bins 2/9, and the next adjacent bins 1/9. Errors are kept the same as before.
- Parameters:
axis
- axis to which smoothing is applied (axis=0 for X, axis=1 for Y)isWeighted
- Whether values in X or Y will be weighted using a triangular weighting scheme favoring bins near the central bin.k
- The smoothing parameter which must be non-negative. If zero, the histogram object will be returned with no smoothing applied.- Returns:
- A smoothed version of P1D.
-
operSmoothGauss
public P1D operSmoothGauss(int axis, double standardDeviation)
Computes a Gaussian smoothed version of P1D. Smoothing can be done either to X or YEach band of the P1D is smoothed by discrete convolution with a kernel approximating a Gaussian impulse response with the specified standard deviation.
- Parameters:
axis
- axis to which smoothing is applied (axis=0 for X, axis=1 for Y)standardDeviation
- The standard deviation of the Gaussian smoothing kernel which must be non-negative or anIllegalArgumentException
will be thrown. If zero, the P1D object will be returned with no smoothing applied.- Returns:
- A Gaussian smoothed version of the histogram.
-
getSys
public P1D getSys(P1D[] p1darray)
Return P1D array which contains 2nd level errors (or systematic errors) evaluated from an array of P1D data holders. This means that this method returns a P1D , but now it has systematic errors evaluated from the input array. All systematic variations are treated independently and thus are added in quadrature. Use this method for evaluation of systematic uncertainties. This function implies only for Y values.- Parameters:
p1darray
- Input P1D arrays- Returns:
- output P1D arrays with the same values and systematic errors, but systematic errors are evaluated from the input set of P1D objects
-
combineErr
public void combineErr(int axis)
Add 1st and 2nd level in quadrature and attribute the combined error to 1st level error. This is useful to simplify presentation of data, but this certainly not always correct approach. The original object is modified.Dimension should be 10.
- Parameters:
axis
- is 0 for X errors, 1 for Y errors
-
addAndAverage
public P1D addAndAverage(P1D[] p1darray)
Return P1D array with weighted average of several measurements. This is a standard weighted least-squares procedure to combine experimental data with errors. Measurements represented by input P1Ds are assumed to be uncorrelated. Errors in X positions are not affected during averaging. Only 1st and 2nd level errors on Y are used. It is also assumed that upper and lower 1st-level errors on Y have the same size. In case if the are not the same, I average them (and print error!)- Parameters:
p1darray
- Input P1D arrays. They will be added to the original P1D- Returns:
- ouput P1D arrays with the same values and systematical errors, but systematical errors are evaluated from the input set of P1D objects
-
getArrayXleft
public double[] getArrayXleft()
Get array representing X-left errors- Returns:
- array with X left errors
-
getArrayXright
public double[] getArrayXright()
Get array representing X-right errors- Returns:
- array with X right errors
-
getArrayXrightSys
public double[] getArrayXrightSys()
Get array representing X-right 2nd level errors- Returns:
- array with X right 2nd level errors
-
getArrayXleftSys
public double[] getArrayXleftSys()
Get array representing X-left 2nd level errors- Returns:
- array with X left 2nd level values
-
getArrayY
public double[] getArrayY()
Get array representing Y-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
-
getXleft
public double getXleft(int i)
Return a specific left error on X-value. if index i falls beyond the valid range.- Parameters:
i
- index of the array- Returns:
- the value of x at index i
-
getXright
public double getXright(int i)
Return a specific right error on X-value. if index i falls beyond the valid range.- Parameters:
i
- index of the array- Returns:
- the value of x at index i
-
getXleftSys
public double getXleftSys(int i)
Return a specific left error on X-value (systematic error). if index i falls beyond the valid range.- Parameters:
i
- index of the array- Returns:
- the value of x at index i
-
getXrightSys
public double getXrightSys(int i)
Return a specific right error on X-value (systematic error). 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 falls beyond the valid range.- Parameters:
i
- index of the array- Returns:
- the value of y at index i
-
getErr
public double getErr(int i)
Return (symmetric) error on Y-value. This is equivalent to getYupper(). Errors for Y can be added as add(X,Y,Error).- Parameters:
i
- index of the array- Returns:
- error value on y at index i
-
getQuickY
public double getQuickY(int i)
Return a specific Y-value quickly (no bound check).- Parameters:
i
- index of the array- Returns:
- the value of y at index i
-
getQuickX
public double getQuickX(int i)
Return a specific X-value quickly (no bound check).- Parameters:
i
- index of the array- Returns:
- the value of x at index i
-
getYupper
public double getYupper(int i)
Return a specific upper error on Y-value. This function returns POSINF (1e300) if index i falls beyond the valid range.- Parameters:
i
- index of the array- Returns:
- the upper error on value of y at index i
-
getError
public double getError(int i)
Return error (uncertainty) on the Y value. This is equivalent to getYupper(). It is assumed that upperl and lower error is the same.- Parameters:
i
- index of the array- Returns:
- error on value of Y at index i
-
getYlower
public double getYlower(int i)
Return a specific lower error on 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
-
getArrayYlower
public double[] getArrayYlower()
Get array representing Y lower errors- Returns:
- array with Y lower error
-
getArrayYlowerSys
public double[] getArrayYlowerSys()
Get array representing Y lower 2nd level errors- Returns:
- array with Y lower 2nd level error
-
getYupperSys
public double getYupperSys(int i)
Return a specific systematical upper error on 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
-
getArrayYupper
public double[] getArrayYupper()
Get array representing Y upper errors- Returns:
- array with Y upper error
-
getArrayErr
public double[] getArrayErr()
Get array representing (symmetric) error on Y. This is equivalent to getArrayYupper().- Returns:
- array with errors on the Y values.
-
dimension
public int dimension()
Returns the dimension of this P1D holder. The convention is: 2: only x and y 3: x,y and symmetrical stat error on y 4: only x, y, y(up), y(down) 6: only x, y, x(up), x(down) y(up), y(down) > the rest- Returns:
- dimension of the P1D
-
getDimension
public int getDimension()
Returns the dimension of this P1D holder. The convention is: 2: only x and y 3: x,y and symmetrical stat error on y 4: only x, y, y(up), y(down) 6: only x, y, x(up), x(down) y(up), y(down) > the rest- Returns:
- dimension of the P1D
-
getYlowerSys
public double getYlowerSys(int i)
Return a specific total lower error on 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
-
getArrayYupperSys
public double[] getArrayYupperSys()
Get array representing Y upper 2nd level errors- Returns:
- array with Y upper 2nd level error
-
getIDataPointSet
public IDataPointSet getIDataPointSet()
Get IDataPointSet. If systematical errors included, they are added in quadrature with statistical errors.- Returns:
- IDataPointSet made of P1D
-
fillIDataPointSet
public void fillIDataPointSet(IDataPointSet fDps2D)
Fill IDataPointSet. If systematical errors included, they are added in quadrature with statistical errors.
-
getMax
public double getMax(int axis)
Returns the maximum value in the range.- Parameters:
axis
- defines to which axis this function applies (0=X; 1=Y);- Returns:
- the maximum value.
-
getMaxIndex
public int getMaxIndex(int axis)
Returns the index of maximum value in the range.- Parameters:
axis
- defines to which axis this function applies (0=X; 1=Y);- Returns:
- index of maximum value.
-
getMin
public double getMin(int axis)
Returns the minimum value in the range. Careful, no error checking on the value of axis, which should be less than N_AXES, defined in GraphSettings.- Parameters:
axis
- defines to which axis this function applies (0=X; 1=Y);- Returns:
- the minimum value.
-
getMinIndex
public int getMinIndex(int axis)
Returns the index of minimum value in the range.- Parameters:
axis
- defines to which axis this function applies (0=X; 1=Y);- Returns:
- index of maximum value.
-
removeAt
public void removeAt(int index)
Remove a (X,Y) value at a given index- Parameters:
index
- index
-
range
public P1D range(int IndexMin, int IndexMax)
Obtain a new PD1 in the range between Min and Max indexes. Min and Max are included. All errors will be copied to a new P1D. For example, getRange(2,2) will return a P1D at index=2 (only one point with errors).- Parameters:
IndexMin
- Min indexIndexMax
- Max index- Returns:
- a new P1D with the value in the range.
-
derivative
public P1D derivative()
Calculate derivative for X-Y data points. It is used to express how fast a Y-values are changing, and are therefore related, mathematically, to the slope of a line. It is calculate as: getY(i+1)-getY(i) / getX(i+1)-getX(i), assuming that all points are ordered in X. For a series of data X-Y points, you can join each pair of adjacent points with a straight line and a slope can be associated with each such line segment.Data points can have errors (statistical), with upper and lower error on Y (dimen=4). Statistical uncertainties on Y are propagated and included into the final P1D with derivatives. Second-level errors are ignored.
- Returns:
- a new P1D with derivative in each data point.
-
rangeCut
public P1D rangeCut(int axis, double Min, double Max)
Construct P1D removing a range of values defined by Min and Max. All errors will be copied to a new P1D. TMin and max are included in the final output.- Parameters:
axis
- if axis=0, applied for X, if axis=1, applied for Y.Min
- Min valueMax
- Max value- Returns:
- a new P1D
-
sort
public void sort(int axis)
Sorting the original array using either X or Y values. The sorting done in increasing order. We use exchange sort method. Currently supports dimensions 2 (X-Y), 3 (X-Y,errror on Y), 4 (X-Y, errors upper and lower on Y).- Parameters:
axis
- if axis=0, sorting applied for X, if axis=1, sorting is applied for Y.
-
integral
public double integral(int IndexMin, int IndexMax)
Integrate P1D between two indices (between 1 and max index)- Parameters:
IndexMin
- Min minimal index for integration starting from 1 (included to integration)IndexMax
- Max maximal index for integration (included to integration)- Returns:
- integral (sum of all Y-values)
-
integral
public double integral()
Integrate P1D (sum up all Y values)- Returns:
- integral (sum of all Y-values)
-
varianceX
public double varianceX()
Returns variance for X-values. This is a measure of how far a set of numbers are spread out from each other.- Returns:
- variance for X values
-
stddeviationX
public double stddeviationX()
Standard deviation of values X.- Returns:
- standard deviation of values X
-
stddeviationY
public double stddeviationY()
Standard deviation of values Y.- Returns:
- standard deviation of values Y
-
varianceY
public double varianceY()
Returns variance for Y-values. This is a measure of how far a set of numbers are spread out from each other.- Returns:
- variance for Y values
-
rmsX
public double rmsX()
Returns RMS for X-values. It represents a root-mean-square (sometimes called the quadratic mean), is the square root of mean of the values x_i^2,- Returns:
- RMS for X
-
rmsY
public double rmsY()
Returns RMS for Y-values. It represents a root-mean-square (sometimes called the quadratic mean), is the square root of mean of the values x_i^2,- Returns:
- RMS for Y
-
meanX
public double meanX()
Returns the mean value in X.- Returns:
- Mean value in X
-
meanXerror
public double meanXerror()
Returns the standard error of the mean values for X. This is (standard deviation)/sqrt(size).- Returns:
- standard error of the mean values for X
-
meanYerror
public double meanYerror()
Returns the standard error of the mean values for Y. This is (standard deviation)/sqrt(size).- Returns:
- standard error of the mean values for X
-
getStat
public java.util.Map<java.lang.String,java.lang.Double> getStat(int axis)
Get complete statistics for this container for a given axis. It return mean, error on the mean, RMS, variance, standard deviation.The key for the output map are: mean, error, rms, variance, stddev .
- Parameters:
axis
- axis=0 for X and axis=1 for Y- Returns:
- map representing statistics
-
meanY
public double meanY()
Returns the mean value in Y.- Returns:
- Mean value in Y
-
clear
public void clear()
Clear the container.
-
toTable
public void toTable()
Show in 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)
-
fill
public void fill(double[] xa, double[] ya)
Fill a P1D container from 2 arrays. If it is not empty, add values will be appended. It is assumed that all errors are zero.- Parameters:
xa
- array with X valuesya
- array with Y values
-
fill
public void fill(int[] xa, int[] ya)
Fill a P1D container from 2 integer arrays. If it is not empty, add values will be appended. It is assumed that all errors are zero.- Parameters:
xa
- integer array with X valuesya
- integer array with Y values
-
fill
public void fill(P0D xa, P0D ya)
Fill a P1D container from 2 P0D arrays. If it is not empty, add values will be appended. It is assumed that all errors are zero.- Parameters:
xa
- P0D with X valuesya
- P0D with Y values
-
fill
public void fill(Cloud2D c2d)
Fill a P1D container from a Cloud2D.- Parameters:
c2D
- input Cloud
-
getXval
public DoubleArrayList getXval()
Get array of X values;- Returns:
-
getYval
public DoubleArrayList getYval()
Get array of Y values;- Returns:
-
getXE1left
public DoubleArrayList getXE1left()
Left error on X (1st level)- Returns:
-
getXE2left
public DoubleArrayList getXE2left()
Left error on X (2nd level)- Returns:
-
getXE1right
public DoubleArrayList getXE1right()
Right eroor on X- Returns:
-
getXE2right
public DoubleArrayList getXE2right()
Right error (2nd level) on X- Returns:
-
getYE1down
public DoubleArrayList getYE1down()
Down error on Y (1st level)- Returns:
-
getYE1upper
public DoubleArrayList getYE1upper()
Upper error on Y (1st level)- Returns:
-
getYE2down
public DoubleArrayList getYE2down()
Down error on Y (2nd level)- Returns:
-
getYE2upper
public DoubleArrayList getYE2upper()
Upper error on Y (2nd level)- Returns:
-
setXE1left
public void setXE1left(DoubleArrayList xE1left)
Error on X left.Statistical error.- Parameters:
xE1left
- left statistical error.
-
setXval
public void setXval(DoubleArrayList X)
Set X values as array- Parameters:
array
- with X values
-
setXE1right
public void setXE1right(DoubleArrayList xE1right)
Error on X. right error (1st level).- Parameters:
xE1right
-
-
setYE1down
public void setYE1down(DoubleArrayList yE1down)
Set statististical down error- Parameters:
yE1down
- down error
-
setYE1upper
public void setYE1upper(DoubleArrayList yE1upper)
Set statistical error on Y 91st level)- Parameters:
yE1upper
- upper error on Y
-
setYE2down
public void setYE2down(DoubleArrayList yE2down)
Set second level down error on Y- Parameters:
yE2down
- error on Y down (2nd level)
-
setYE2upper
public void setYE2upper(DoubleArrayList yE2upper)
Set second level upper error on Y- Parameters:
yE2upper
- upper error on Y
-
setYval
public void setYval(DoubleArrayList yval)
Set Y values- Parameters:
yval
- Y value
-
fill
public void fill(double[] xa, double[] ya, double[] yerror)
Fill a P1D container from 3 arrays (one represents symmetrical errors on Y). If it is not empty, add values will be appended. It is assumed that all other errors are zero. Arrays must be of the same size.- Parameters:
xa
- array with X valuesya
- array with Y valuesyerror
- array with errors on Y values
-
fill
public void fill(P0D xa, P0D ya, P0D yerror)
Fill a P1D container from P0D arrays (one represents symmetrical errors on Y). If it is not empty, add values will be appended. It is assumed that all other errors are zero. Arrays must be of the same size.- Parameters:
xa
- P0D array with X valuesya
- P0D array with Y valuesyerror
- P0D array with errors on Y values
-
fill
public void fill(double[] xa, double[] ya, double[] yupper, double[] ylower)
Fill a P1D container from 4 arrays (last represents asymmetrical upper and lower errors on Y). If it is not empty, add values will be appended. It is assumed that all other errors are zero. All arrays must be of the same size.- Parameters:
xa
- array with X valuesya
- array with Y valuesyupper
- array with upper errors on Y valuesylower
- array with upper errors on Y values
-
fill
public void fill(double[] x, double[] y, double[] left, double[] right, double[] upper, double[] lower, double[] left_sys, double[] right_sys, double[] upper_sys, double[] lower_sys)
Fill the values of a X-Y plot-points with full errors. It includes upper and lower errors on X and Y, including 1st and 2nd level errors (i.e. statistical and systematic). All arrays must be of the same size.- Parameters:
x
- array of x-value of the plot-pointy
- array of y-value of the plot-pointleft
- - array of error on x (left)right
- - array of error on x (right)upper
- - array of error on y (upper)lower
- - array of error on y (lower)left_sys
- - array of error on x (left) - second level, used for systematicsright_sys
- - array of error on x (right)upper_sys
- - array of error on y (upper)lower_sys
- - array of error on y (lower)
-
setArrayX
public void setArrayX(double[] x)
Set array at once- Parameters:
x
- X-values
-
setArrayY
public void setArrayY(double[] y)
Set array at once- Parameters:
x
- Y-values
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG