@Platform(include="<nix/Dimensions.hpp>",link="nix",preload="hdf5") @Platform(value="linux") @Platform(value="windows") @Namespace(value="nix") public class SampledDimension<T extends SampledDimension> extends ImplContainer implements Comparable<T>
Instances of the SampledDimension Class are used to describe a dimension of data in a DataArray that has been sampled in regular intervals. For example this can be a time axis.
Sampled dimensions are characterized by the label for the dimension, the unit in which the sampling interval is given. If not specified otherwise the dimension starts with zero offset.
DataArray da = ...;
SampledDimension sd = da.appendSampledDimension(0.1);
sd.setUnit("ms");
sd.setLabel("time");
sd.setOffset(10000);
Dimension
,
RangeDimension
,
SetDimension
Constructor and Description |
---|
SampledDimension()
Constructor that creates an uninitialized SampledDimension.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(T dimension) |
double[] |
getAxis(long count)
Returns a list containing the positions defined by this
dimension with the start index set to 0.
|
double[] |
getAxis(long count,
long startIndex)
Returns a list containing the positions defined by this
dimension.
|
int |
getDimensionType()
The type of the dimension.
|
long |
getIndex()
The actual dimension that is described by the dimension descriptor.
|
long |
getIndexOf(double position)
Returns the index of the given position.
|
String |
getLabel()
Getter for the label of the dimension.
|
double |
getOffset()
Gets the offset of the dimension.
|
double |
getPositionAt(long index)
Returns the position of this dimension at a given index.
|
double |
getSamplingInterval()
Gets the sampling interval of the dimension.
|
String |
getUnit()
Gets the unit of a dimension.
|
boolean |
isNone()
Check if entity is null
|
void |
setLabel(String label)
Sets the label of the dimension.
|
void |
setOffset(double offset)
Sets the offset of the dimension.
|
void |
setSamplingInterval(double interval)
Sets the sampling interval of the dimension.
|
void |
setUnit(String unit)
Sets the unit of a dimension.
|
isInitialized
address, asBuffer, asByteBuffer, capacity, capacity, deallocate, deallocate, deallocateReferences, equals, fill, hashCode, isNull, limit, limit, memchr, memcmp, memcpy, memmove, memset, offsetof, position, position, put, setNull, sizeof, toString, zero
public SampledDimension()
Calling any method on an uninitialized dimension will throw a RuntimeException
.
@Cast(value="bool") public boolean isNone()
ImplContainer
isNone
in class ImplContainer
@Name(value="index") @Cast(value="size_t") public long getIndex()
The index of the dimension entity representing the dimension of the actual data that is defined by this descriptor.
@Name(value="dimensionType") @ByVal @Cast(value="nix::DimensionType") public int getDimensionType()
This field indicates whether the dimension is a SampledDimension, SetDimension or RangeDimension.
DataType
public String getLabel()
The label of a SampledDimension corresponds to the axis label in a plot of the respective dimension.
public void setLabel(String label)
label
- The label of the dimension.public String getUnit()
The unit describes which SI unit applies to this dimension and to its sampling interval.
public void setUnit(String unit)
unit
- The unit to set.@Name(value="samplingInterval") public double getSamplingInterval()
@Name(value="samplingInterval") public void setSamplingInterval(double interval)
interval
- The sampling interval to set.public double getOffset()
The offset defines at which position the sampling was started. The offset is interpreted in the same unit as the sampling interval.
By default the offset is 0.
@Name(value="offset") public void setOffset(double offset)
offset
- The offset of the dimension.@Name(value="indexOf") @Cast(value="size_t") public long getIndexOf(double position)
This method returns the index of the given position. Use this method for example to find out which data point (index) relates to a given time. Note: This method does not check if the position is within the extent of the data!
position
- The position@Name(value="positionAt") public double getPositionAt(@Cast(value="const size_t") long index)
This method returns the position at a given index. Use this method for example to find the position that relates to a certain index. Note: This method does not check if the index is the extent of the data!
index
- The index.public double[] getAxis(long count, long startIndex)
count
- The number of indicesstartIndex
- The start indexpublic double[] getAxis(long count)
count
- The number of indicespublic int compareTo(T dimension)
compareTo
in interface Comparable<T extends SampledDimension>
Copyright © 2015. All rights reserved.