public abstract class NumericProbeBase extends Probe implements Displayable
Probe.ExportProps, Probe.ImportExportFileInfoModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibility| Modifier and Type | Field and Description |
|---|---|
static double |
EXPLICIT_TIME |
static PropertyList |
myProps |
NumericProbePanel |
mySmallDisplay |
useOldSaveMethod, writeStartStopTimeInSecondsenforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames| Constructor and Description |
|---|
NumericProbeBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
addData(ReaderTokenizer rtok,
double timeStep) |
abstract void |
apply(double t)
Called at time
t to apply this probe |
void |
applyDefaultDisplayRanges() |
void |
clearData() |
java.lang.Object |
clone() |
void |
decreaseDisplayRanges()
Decrease the display range of each numeric probe panel.
|
void |
dispose()
Remove resources used by this agent.
|
void |
exportCsvData(java.io.File file)
Exports the data values in this probe to a CSV file.
|
void |
exportCsvData(java.io.File file,
java.lang.String fmtStr,
boolean includeTime)
Exports the data values in this probe to a CSV file.
|
void |
exportData(java.io.File file,
Probe.ExportProps props) |
void |
exportTextData(java.io.File file)
Exports the data values in this probe to a text file.
|
void |
exportTextData(java.io.File file,
java.lang.String fmtStr,
boolean includeTime)
Exports the data values in this probe to a text file.
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
Property[] |
getAttachedProperties() |
double[][] |
getData()
Returns the data of this probe as a two dimensional array of
doubles.
|
VectorNd |
getData(double sec) |
double |
getDefaultDisplayMax() |
double |
getDefaultDisplayMin() |
double[] |
getDefaultDisplayRange() |
javax.swing.JPanel |
getDisplay(int w,
int h,
boolean isLargeDisplay) |
NumericProbeDriver[] |
getDrivers() |
Probe.ImportExportFileInfo[] |
getExportFileInfo() |
Probe.ExportProps |
getExportProps(java.lang.String ext) |
java.lang.String |
getFormat() |
Probe.ImportExportFileInfo[] |
getImportFileInfo() |
Interpolation |
getInterpolation()
Returns the interpolation method for this numeric input probe.
|
Interpolation.Order |
getInterpolationOrder()
Returns the interpolation order for this numeric probe.
|
LegendDisplay |
getLegend() |
java.lang.String |
getMatlabName() |
double[] |
getMinMaxValues() |
NumericList |
getNumericList() |
int |
getOrderedTraceIndex(int order) |
PlotTraceInfo |
getPlotTraceInfo(int idx) |
RotationRep |
getRotationRep() |
int[] |
getRotationSubvecOffsets() |
java.awt.Color |
getTraceColor(int idx) |
java.lang.String |
getTraceLabel(int idx) |
PlotTraceManager |
getTraceManager() |
double[][] |
getValues()
Deprecated.
Use
getData() instead. |
java.util.LinkedHashMap<java.lang.String,NumericProbeVariable> |
getVariables() |
double[] |
getVisibleMinMaxValues() |
double[] |
getVisibleRange() |
static double[] |
getVisibleRange(PlotTraceManager traceManager,
NumericList list) |
int |
getVsize() |
void |
importCsvData(java.io.File file,
double timeStep)
Imports the data values in this probe from a CSV file.
|
void |
importData(java.io.File file,
double timeStep)
Imports the data values in this probe from either a text or CSV file,
depending on the file extension (
.txt for text; .csv for
CSV). |
void |
importText(java.io.File file,
double timeStep,
char separator)
Still being implemented
|
void |
importTextData(java.io.File file,
double timeStep)
Imports the data values in this probe from a text file.
|
void |
increaseDisplayRanges()
Increase the display range of each numeric probe panel.
|
boolean |
isCloneable() |
boolean |
isDisplayable()
Queries whether this component is currently displayable.
|
boolean |
isEmpty() |
boolean |
isPrintable() |
boolean |
isSmallDisplayVisible() |
boolean |
isTraceVisible(int idx) |
static boolean |
isValidVariableName(java.lang.String name) |
boolean |
isWritable()
Returns
true if this component should in fact be written to
secondary storage. |
boolean |
loadFromMatlab(MatlabInterface mi,
java.lang.String matlabName) |
void |
print(double sec) |
void |
read(java.io.File file,
boolean setTimes)
Reads the start and stop times, scale value, and data for this probe from
an ascii file.
|
boolean |
removeDisplay(javax.swing.JPanel display) |
void |
removeLegend() |
void |
resetTraceColors() |
void |
resetTraceOrder() |
void |
saveToMatlab(MatlabInterface mi,
java.lang.String matlabName) |
void |
scaleNumericList(double s)
Scales the values of a numberic probe.
|
void |
setData(double[][] vals)
Sets the data of this numeric probe from a two dimensional array of
doubles.
|
void |
setData(NumericProbeBase src,
boolean useAbsoluteTime)
Sets the data of this numeric probe from the data of another numeric
probe
src. |
void |
setDefaultDisplayRange(double[] minmax) |
void |
setDefaultDisplayRange(double min,
double max) |
void |
setFormat(java.lang.String fmtStr) |
void |
setInterpolation(Interpolation method)
Sets the interpolation method for this numeric input probe.
|
void |
setInterpolationOrder(Interpolation.Order order)
Sets the interpolation order for this numeric probe.
|
void |
setLegend(LegendDisplay legend) |
void |
setLegendLabels(java.util.List<java.lang.String> labels) |
void |
setScale(double s) |
void |
setSmallDisplayVisible(boolean visible) |
void |
setTraceColor(int idx,
java.awt.Color color) |
void |
setTraceLabel(int idx,
java.lang.String label) |
void |
setTraceOrder(int[] indices)
Sets a new ordering for the plot traces.
|
void |
setTraceVisible(int idx,
boolean visible) |
void |
setValues(double[][] vals)
Deprecated.
Use
setData(double[][]) instead. |
void |
setValues(NumericProbeBase src,
boolean useAbsoluteTime)
Deprecated.
Use
setData(NumericProbeBase,boolean) instead. |
void |
smoothWithMovingAverage(int winSize)
Smooths the values in this probe by applying a mean average filter over a
moving window of specified size.
|
void |
smoothWithSavitzkyGolay(int winSize,
int deg)
Smooths the values in this probe by applying Savitzky-Golay smoothing
over a moving window of specified size.
|
void |
swapPlotTraceOrder(PlotTraceInfo pti0,
PlotTraceInfo pti1) |
void |
updateDisplays() |
void |
updateDisplays(NumericProbePanel notToUpdate) |
void |
updateDisplaysForPropertyChanges()
Update displays if associated properties (like interpolation) have
changed.
|
void |
updateDisplaysWithoutAutoRanging()
Update displays with auto-ranging suppressed.
|
void |
writeText(java.io.File file,
java.lang.String fmtStr,
java.lang.String separator,
boolean includeTime) |
createState, getAttachedFile, getAttachedFileName, getChildren, getClippedVirtualTime, getDefaultScale, getDefaultStartTime, getDefaultStopTime, getDefaultUpdateInterval, getDuration, getExportFile, getExportFileName, getFileFromPath, getImportFile, getImportFileName, getInitialState, getPathFromFile, getProperty, getScale, getStartTime, getState, getStopTime, getTimelineTime, getTrack, getUpdateInterval, getVirtualTime, hasAttachedFile, hasChildren, hasState, isAttachedFileRelative, isEditable, isEventTime, isInput, isScalable, isSettable, load, nextEventTime, save, scan, setAttachedFileName, setData, setExportFileName, setImportFileName, setInterval, setName, setScalable, setStartStopTimes, setStartTime, setState, setStopTime, setTrack, setUpdateIntervalfinalize, getModel, initialize, isActive, setActive, setModel, setModelFromComponent, writecheckFlag, checkName, checkNameUniqueness, clearFlag, connectToHierarchy, copy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isScanning, isSelected, makeValidName, makeValidName, notifyParentOfChange, postscan, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferencesequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconnectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setNumber, setParent, setSelected, setWritable, updateReferencespostscanpublic static final double EXPLICIT_TIME
public NumericProbePanel mySmallDisplay
public static PropertyList myProps
public PropertyList getAllPropertyInfo()
HasPropertiesgetAllPropertyInfo in interface HasPropertiesgetAllPropertyInfo in class Probepublic double[][] getValues()
getData() instead.public void setValues(double[][] vals)
setData(double[][]) instead.public void setValues(NumericProbeBase src, boolean useAbsoluteTime)
setData(NumericProbeBase,boolean) instead.public double[][] getData()
public void setData(double[][] vals)
getData().vals - data values used to set this numeric probepublic void setData(NumericProbeBase src, boolean useAbsoluteTime)
src. All current probe data is removed. The vector size of
the source probe must be greater than or equal to that of this probe;
extra data in the source probe is ignored. The scaling, start and stop
times, and interpolation method of this probe are unchanged.src - source probe to copy data fromuseAbsoluteTime - if true, time values are mapped between
the probes using absolute time; otherwise, probe relative time is usedpublic void importTextData(java.io.File file,
double timeStep)
throws java.io.IOException
timeStep <= 0; otherwise, time values
are computed from timeStep*k where k is the line number
starting at 0. An example with time values included for a probe with
vector size 3 is
0.0 2.45e-8 3.4 6.5 7.6 1.5 6.8 9.7 3.1 2.0 19.8 12.4 6.0e-5An exception is thrown if a line has insufficient values. If a line has more numbers than necessary the extra values are ignored. The scaling, start and stop times, and interpolation method of this probe are unchanged.
file - file to import the data fromtimeStep - if > 0, specifies the time step between data;
otherwise, time data is assumed to be included in the filejava.io.IOExceptionpublic void exportTextData(java.io.File file)
throws java.io.IOException
' ' character. The time value is
included at the start of the line, resulting in vsize+1 numbers
per line, where vsize is the value returned by getVsize().file - file to write the data tojava.io.IOExceptionpublic void exportTextData(java.io.File file,
java.lang.String fmtStr,
boolean includeTime)
throws java.io.IOException
' '
character. The number format is specified by a printf()-style
format string fmtStr, and time values are included at the start
of each line if includeTime is true.file - file to write the data tofmtStr - numeric format string as described for NumberFormat; examples are "%g" (general with full precision),
"%8.3f", etc.includeTime - if true, time values are includedjava.io.IOExceptionpublic void importCsvData(java.io.File file,
double timeStep)
throws java.io.IOException
',' character. Time values should be
included at the start of each line if timeStep <= 0; otherwise,
time values are computed from timeStep*k where k is the
line number starting at 0. An example with time values included for a
probe with vector size 3 is
0.0, 3.4, 6.5, 7.6 1.5, 6.8, 9.7, 3.1 2.0, 19.8, 12.4, 0.6An exception is thrown if a line has insufficient values. If a line has more numbers than necessary the extra values are ignored. The scaling, start and stop times, and interpolation method of this probe are unchanged.
file - file to import the data fromtimeStep - if > 0, specifies the time step between data;
otherwise, time data is assumed to be included in the filejava.io.IOExceptionpublic void exportCsvData(java.io.File file)
throws java.io.IOException
',' character. The time value is included
at the start of the line, resulting in vsize+1 numbers per line,
where vsize is the value returned by getVsize().file - file to write the data tojava.io.IOExceptionpublic void exportCsvData(java.io.File file,
java.lang.String fmtStr,
boolean includeTime)
throws java.io.IOException
','
character. The number format is specified by a printf()-style
format string fmtStr, and time values are included at the start
of each line if includeTime is true.file - file to write the data tofmtStr - numeric format string as described for NumberFormat; examples are "%g" (general with full precision),
"%8.3f", etc.includeTime - if true, time values are includedjava.io.IOExceptionpublic abstract void apply(double t)
Probet to apply this probepublic boolean isDisplayable()
DisplayableisDisplayable in interface Displayablepublic javax.swing.JPanel getDisplay(int w,
int h,
boolean isLargeDisplay)
getDisplay in interface Displayablepublic boolean removeDisplay(javax.swing.JPanel display)
removeDisplay in interface Displayablepublic int getVsize()
public RotationRep getRotationRep()
public int[] getRotationSubvecOffsets()
public void clearData()
public void updateDisplays()
updateDisplays in interface Displayablepublic void setSmallDisplayVisible(boolean visible)
public boolean isSmallDisplayVisible()
public void updateDisplays(NumericProbePanel notToUpdate)
public void updateDisplaysForPropertyChanges()
public void updateDisplaysWithoutAutoRanging()
public void setInterpolation(Interpolation method)
method - interpolation method.public Interpolation getInterpolation()
setInterpolation(maspack.interpolation.Interpolation)public void setInterpolationOrder(Interpolation.Order order)
order - new interpolation orderpublic Interpolation.Order getInterpolationOrder()
public void setFormat(java.lang.String fmtStr)
public java.lang.String getFormat()
public boolean isCloneable()
isCloneable in class Probepublic double getDefaultDisplayMax()
public double getDefaultDisplayMin()
public void setDefaultDisplayRange(double min,
double max)
public void setDefaultDisplayRange(double[] minmax)
public void increaseDisplayRanges()
public void decreaseDisplayRanges()
public void applyDefaultDisplayRanges()
public double[] getDefaultDisplayRange()
public double[] getMinMaxValues()
public double[] getVisibleMinMaxValues()
public boolean isEmpty()
public static double[] getVisibleRange(PlotTraceManager traceManager, NumericList list)
public double[] getVisibleRange()
public void scaleNumericList(double s)
s - scale factor
the parameter by which to scale the values.public NumericList getNumericList()
public java.util.LinkedHashMap<java.lang.String,NumericProbeVariable> getVariables()
public NumericProbeDriver[] getDrivers()
public Property[] getAttachedProperties()
public void smoothWithMovingAverage(int winSize)
winSize - size of the averaging window. The value should be odd; if
it is even, it will be incremented internally to be odd. The method does
nothing if the value is is less than 1. Finally, winSize will be
reduced if necessary to fit the number of data points.public void smoothWithSavitzkyGolay(int winSize,
int deg)
deg, and then using this to recompute the value in the middle of the
window. The polynomial is also used to interpolate the first and last
winSize/2 values, since it is not possible to center the window
on these.deg - degree of the smoothing polynomial. Must be at least 1.winSize - size of the averaging window. The value must be >=
deg+1 and should also be odd; if it is even, it will be incremented
internally to be odd. Finally, winSize will be reduced if
necessary to fit the number of data points.public static boolean isValidVariableName(java.lang.String name)
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class ModelComponentBasejava.lang.CloneNotSupportedExceptionpublic boolean isPrintable()
isPrintable in class Probepublic VectorNd getData(double sec)
public void setLegendLabels(java.util.List<java.lang.String> labels)
public PlotTraceInfo getPlotTraceInfo(int idx)
public int getOrderedTraceIndex(int order)
public void setTraceOrder(int[] indices)
public void swapPlotTraceOrder(PlotTraceInfo pti0, PlotTraceInfo pti1)
public void resetTraceOrder()
public void setTraceVisible(int idx,
boolean visible)
public boolean isTraceVisible(int idx)
public void setTraceColor(int idx,
java.awt.Color color)
public java.awt.Color getTraceColor(int idx)
public void resetTraceColors()
public PlotTraceManager getTraceManager()
public void setTraceLabel(int idx,
java.lang.String label)
public java.lang.String getTraceLabel(int idx)
public LegendDisplay getLegend()
public void setLegend(LegendDisplay legend)
public void removeLegend()
public void dispose()
dispose in interface ModelAgentdispose in class ModelAgentBasepublic java.lang.String getMatlabName()
public void saveToMatlab(MatlabInterface mi, java.lang.String matlabName) throws MatlabInterfaceException
MatlabInterfaceExceptionpublic boolean loadFromMatlab(MatlabInterface mi, java.lang.String matlabName) throws MatlabInterfaceException
MatlabInterfaceExceptionpublic boolean isWritable()
ModelComponentBasetrue if this component should in fact be written to
secondary storage. This gives subclasses control over whether or
not they are actually written out.isWritable in interface ScannableisWritable in class ModelComponentBasetrue if this component should be written to
secondary storage.public void addData(ReaderTokenizer rtok, double timeStep) throws java.io.IOException
java.io.IOExceptionpublic void read(java.io.File file,
boolean setTimes)
throws java.io.IOException
setTimes is false.
setTimes is false.
setTimes is false.
2.0 10.0 1.2 linear 2 explicit 0.0 2.0 2.0 1.1 4.0 3.0 3.0 0.0 1.0specifies a probe with a start and stop time of 2 and 10 seconds, respectively, a scale value of 1.2, linear interpolation, 2 values at each knot point, and three knot points at times 0.0, 1.1, and 3.0. If knot time is given implicitly by a time setp, then time is assumed to start at 0. The following input
2000000000 3000000000 2.5 step 2 2.0 2.0 2.0 4.0 3.0 0.0 1.0specifies a probe with a start and stop time of 2 and 3 seconds, respectively, a scale value of 2.5, step interpolation, 2 values at each knot point, and three knot points with times of 0, 2.0, and 4.0 (given implicity by a step size of 2.0).
The character '#' is a comment character, causing all subsequent input up to the next new line to be ignored.
file - File from which to read the probe informationsetTimes - if true, sets the start time, stop time,
and scale values to those indicated at the head of the file. If
false, these values are ignored.java.io.IOException - if an I/O or format error occurred.public void writeText(java.io.File file,
java.lang.String fmtStr,
java.lang.String separator,
boolean includeTime)
throws java.io.IOException
java.io.IOExceptionpublic void importText(java.io.File file,
double timeStep,
char separator)
throws java.io.IOException
java.io.IOExceptionpublic Probe.ImportExportFileInfo[] getExportFileInfo()
getExportFileInfo in class Probepublic Probe.ImportExportFileInfo[] getImportFileInfo()
getImportFileInfo in class Probepublic Probe.ExportProps getExportProps(java.lang.String ext)
getExportProps in class Probepublic void exportData(java.io.File file,
Probe.ExportProps props)
throws java.io.IOException
exportData in class Probejava.io.IOExceptionpublic void importData(java.io.File file,
double timeStep)
throws java.io.IOException
.txt for text; .csv for
CSV). See importTextData and importCsvData for details.importData in class Probefile - file to import the data fromtimeStep - if > 0, specifies the time step between data;
otherwise, time data is assumed to be included in the filejava.io.IOException