public class Trace
extends java.lang.Object
This class is IMMUTABLE
TODO sortedコンストラクタと説明 |
---|
Trace(double[] x,
double[] y)
Deep copy
|
修飾子とタイプ | メソッドと説明 |
---|---|
Trace |
add(Trace trace)
x in this and trace must be same. i.e. all the x elements must be same
|
double |
average() |
static Trace |
createTrace(java.nio.file.Path path) |
static Trace |
createTrace(java.nio.file.Path path,
int xColumn,
int yColumn)
All lines are trimmed.
|
Trace |
cutWindow(double start,
double end)
thisの start ≤ x ≤ endの部分を切り抜く
|
Trace |
cutWindow(Timewindow timeWindow) |
static int |
findBestShift(double[] base,
double[] compare)
最も相関の高い位置を探す 探し方は、短い方をずらしていく 同じ長さだと探さない。
|
double |
findBestShift(Trace trace)
Assume the interval of x is same as that of this.
|
int |
getLength() |
double |
getMaxValue() |
double |
getMinValue() |
double |
getNearestX(double target) |
int |
getNearestXIndex(double target) |
double[] |
getX() |
double |
getXAt(int i) |
double |
getXforMaxValue() |
double |
getXforMinValue() |
org.apache.commons.math3.linear.RealVector |
getXVector() |
double[] |
getY() |
double |
getYAt(int i) |
org.apache.commons.math3.linear.RealVector |
getYVector() |
int[] |
indexOfDownwardConvex()
0 < (y(x[i])-y(x[i-1])) * (y(x[i]) - y(x[i+1])) and y[i] < y[i-1]
|
int[] |
indexOfPeaks()
peak is defined as 0 < (y(x[i])-y(x[i-1]))*(y(x[i])-y(x[i+1]))
|
int[] |
indexOfUpwardConvex()
0 < (y(x[i])-y(x[i-1]))*(y(x[i])-y(x[i+1])) and y[i-1] < t[i]
|
Trace |
multiply(double d) |
Trace |
shiftX(double shift)
f(x) → f(x-shift) Shifts "shift" in the direction of x axis.
|
double |
standardDeviation()
1/n×Σ(yi - ymean)2
|
org.apache.commons.math3.analysis.polynomials.PolynomialFunction |
toPolynomial(int n)
compute n th polynomial functions for the trace
|
double |
toValue(int n,
double c)
x=cの点でのyの値をfをn次関数として補完する 補完の際には直近のn+1点で補完
f(x) = Σ ai xi
|
void |
write(java.nio.file.Path path,
java.nio.file.OpenOption... options)
Writes X and Y.
|
public Trace(double[] x, double[] y)
x
- array for Xy
- array for Ypublic static Trace createTrace(java.nio.file.Path path, int xColumn, int yColumn) throws java.io.IOException
path
- of the file you want to readxColumn
- indicates which column is x (for the first column → 0)yColumn
- indicates which column is yjava.io.IOException
- if anypublic static Trace createTrace(java.nio.file.Path path) throws java.io.IOException
path
- of a filejava.io.IOException
- if anypublic static int findBestShift(double[] base, double[] compare)
base
- arraycompare
- arraypublic double getXAt(int i)
i
- index for x [0, length -1]public double getYAt(int i)
i
- index for y [0, length -1]public int getLength()
public org.apache.commons.math3.analysis.polynomials.PolynomialFunction toPolynomial(int n)
n
- degree of polynomialPolynomialFunction
fitted to thispublic Trace shiftX(double shift)
shift
- value of shiftpublic double toValue(int n, double c)
n
- degree of function for interpolationc
- point for the valuepublic double getNearestX(double target)
target
- value of x to look for the nearest x value topublic int[] indexOfPeaks()
public int[] indexOfDownwardConvex()
public int[] indexOfUpwardConvex()
public int getNearestXIndex(double target)
target
- value of x to look for the nearest x value topublic double findBestShift(Trace trace)
trace
- which length must be shorter than this.public Trace cutWindow(double start, double end)
start
- start x of windowend
- end x of windowpublic Trace cutWindow(Timewindow timeWindow)
timeWindow
- Timewindow
for cutpublic double[] getX()
public double[] getY()
public double getXforMaxValue()
public double getXforMinValue()
public double getMaxValue()
public double getMinValue()
public org.apache.commons.math3.linear.RealVector getXVector()
public org.apache.commons.math3.linear.RealVector getYVector()
public Trace add(Trace trace)
trace
- to be addedpublic Trace multiply(double d)
d
- to be multipliedpublic double average()
public double standardDeviation()
public void write(java.nio.file.Path path, java.nio.file.OpenOption... options) throws java.io.IOException
path
- of the write fileoptions
- if anyjava.io.IOException
- if any