@Platform(include="<nix/DataArray.hpp>") @Platform(value="linux",link="nix@.1",preload="hdf5@.7") @Platform(value="windows",link="nix",preload={"hdf5","msvcp120","msvcr120","szip","zlib"})
@Namespace(value="nix")
public class DataArray
extends EntityWithSources
The DataArray is the core entity of the NIX data model, its purpose is to
store arbitrary n-dimensional data. In addition to the common fields id, name, type, and definition
the DataArray stores sufficient information to understand the physical nature of the stored data.
A guiding principle of the data model is provides enough information to create a
plot of the stored data. In order to do so, the DataArray defines a property
DataType which provides the physical type of the stored data (for example
16 bit integer or double precision IEEE floatingpoint number).
The property setUnit(String) specifies the SI unit of the values stored in the
DataArray{} whereas the setLabel(String) defines what is given in this units.
Together, both specify what corresponds to the the y-axis of a plot.
In some cases it is much more efficient or convenient to store data not as
floating point numbers but rather as (16 bit) integer values as, for example
read from a data acquisition board.
In order to convert such data to the correct values, we follow the approach
taken by the comedi data-acquisition library (http://www.comedi.org)
and provide setPolynomCoefficients(double[]) and an setExpansionOrigin(double).
Block b = ...;
DataArray da = b.createDataArray("array_one", "testdata", DataType.Double, new NDSize(new int[] { 3, 4, 2 }));
Block b = ...;
boolean deleted = b.deleteDataArray(some_id);
| Constructor and Description |
|---|
DataArray()
Constructor that creates an uninitialized DataArray.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSource(Source source)
Associate a new source with the entity.
|
void |
addSource(String id)
Associate a new source with the entity.
|
RangeDimension |
appendAliasRangeDimension()
Append a new RangeDimension that uses the data stored in this DataArray as ticks.
|
RangeDimension |
appendRangeDimension(double[] ticks)
Append a new RangeDimension to the list of existing dimension descriptors.
|
SampledDimension |
appendSampledDimension(double samplingInterval)
Append a new SampledDimension to the list of existing dimension descriptors.
|
SetDimension |
appendSetDimension()
Append a new SetDimension to the list of existing dimension descriptors.
|
RangeDimension |
createAliasRangeDimension()
Create a new RangeDimension that uses the data stored in this DataArray as ticks.
|
RangeDimension |
createRangeDimension(long id,
double[] ticks)
Create a new RangeDimension at a specified dimension index.
|
SampledDimension |
createSampledDimension(long id,
double samplingInterval)
Create a new SampledDimension at a specified dimension index.
|
SetDimension |
createSetDimension(long id)
Create a new SetDimension at a specified dimension index.
|
boolean |
deleteDimension(long id)
Remove a dimension descriptor at a specified index.
|
void |
forceCreatedAt(Date date)
Sets the creation date to the provided value even if the attribute is set.
|
void |
forceUpdatedAt()
Sets the time of the last update to the current time.
|
Date |
getCreatedAt()
Get the creation date of the data array.
|
void |
getData(byte[] data,
NDSize count,
NDSize offset)
Get stored data.
|
void |
getData(double[] data,
NDSize count,
NDSize offset)
Get stored data.
|
void |
getData(float[] data,
NDSize count,
NDSize offset)
Get stored data.
|
void |
getData(int[] data,
NDSize count,
NDSize offset)
Get stored data.
|
void |
getData(long[] data,
NDSize count,
NDSize offset)
Get stored data.
|
void |
getData(short[] data,
NDSize count,
NDSize offset)
Get stored data.
|
NDSize |
getDataExtent()
Get the extent of the data of the DataArray entity.
|
int |
getDataType()
Get the data type of the data stored in the DataArray entity.
|
String |
getDefinition()
Getter for the definition of the data array.
|
Dimension |
getDimension(long id)
Returns the Dimension object for the specified dimension of the data.
|
long |
getDimensionCount()
Returns the number of dimensions stored in the DataArray.
|
List<Dimension> |
getDimensions()
Get all dimensions associated with this data array.
|
List<Dimension> |
getDimensions(java.util.function.Predicate<Dimension> filter)
Get all dimensions associated with this data array.
|
double |
getExpansionOrigin()
Returns the expansion origin of the calibration polynom.
|
String |
getId()
Get id of the data array.
|
String |
getLabel()
Get the label for the values stored in the DataArray.
|
Section |
getMetadata()
Get metadata associated with this entity.
|
String |
getName()
Getter for the name of the data array.
|
double[] |
getPolynomCoefficients()
Returns the polynom coefficients.
|
Source |
getSource(long index)
Retrieves an associated source identified by its index.
|
Source |
getSource(String id)
Returns an associated source identified by its id.
|
long |
getSourceCount()
Get the number of sources associated with this entity.
|
List<Source> |
getSources()
Get all sources associated with this entity.
|
String |
getType()
Getter for the type of the data array
|
String |
getUnit()
Get the unit of the data stored in this data array.
|
Date |
getUpdatedAt()
Get the date of the last update.
|
boolean |
hasSource(Source source)
Checks if a specific source is associated with this entity.
|
boolean |
hasSource(String id)
Checks if a specific source is associated with this entity.
|
boolean |
isNone()
Check if entity is null
|
void |
removeMetadata()
Removes metadata associated with the entity.
|
boolean |
removeSource(Source source)
Remove a source from the list of associated sources.
|
boolean |
removeSource(String id)
Remove a source from the list of associated sources.
|
void |
setCreatedAt()
Sets the creation time to the current time if the field is not set.
|
void |
setData(byte[] data,
NDSize count,
NDSize offset)
Set byte array data.
|
void |
setData(double[] data,
NDSize count,
NDSize offset)
Set double array data.
|
void |
setData(float[] data,
NDSize count,
NDSize offset)
Set float array data.
|
void |
setData(int[] data,
NDSize count,
NDSize offset)
Set integer array data.
|
void |
setData(long[] data,
NDSize count,
NDSize offset)
Set long array data.
|
void |
setData(short[] data,
NDSize count,
NDSize offset)
Set short array data.
|
void |
setDataExtent(NDSize extent)
Set the data extent of the DataArray entity.
|
void |
setDefinition(String definition)
Setter for the definition of the data array.
|
void |
setExpansionOrigin(double expansionOrigin)
Set the expansion origin for the calibration.
|
void |
setLabel(String label)
Set the label for the data stored.
|
void |
setMetadata(Section metadata)
Associate the entity with some metadata.
|
void |
setMetadata(String id)
Associate the entity with some metadata.
|
void |
setPolynomCoefficients(double[] polynomCoefficients)
Set the polynom coefficients for the calibration.
|
void |
setSources(List<Source> sources)
Set all sources associations for this entity.
|
void |
setType(String type)
Setter for the type of the data array.
|
void |
setUnit(String unit)
Set the unit for the values stored in this DataArray.
|
void |
setUpdatedAt()
Sets the time of the last update to the current time if the field is not set.
|
String |
toString() |
compareToisInitializedpublic DataArray()
Calling any method on an uninitialized data array will throw a RuntimeException
exception. The following code illustrates how to check if a data array is initialized:
@Cast(value="bool") public boolean isNone()
ImplContainerisNone in class ImplContainer@Name(value="id") @StdString public String getId()
public Date getCreatedAt()
getCreatedAt in class Entitypublic Date getUpdatedAt()
getUpdatedAt in class Entitypublic void setUpdatedAt()
setUpdatedAt in class Entitypublic void forceUpdatedAt()
forceUpdatedAt in class Entitypublic void setCreatedAt()
setCreatedAt in class Entitypublic void forceCreatedAt(Date date)
forceCreatedAt in class Entitydate - The creation date to set.@Name(value="type")
public void setType(@StdString
String type)
setType in class NamedEntitytype - The type of the data array.@Name(value="type") @StdString public String getType()
getType in class NamedEntity@Name(value="name") @StdString public String getName()
getName in class NamedEntitypublic void setDefinition(String definition)
setDefinition in class NamedEntitydefinition - definition of data arraypublic String getDefinition()
getDefinition in class NamedEntity@Name(value="metadata") public Section getMetadata()
getMetadata in class EntityWithMetadataSection@Name(value="metadata")
public void setMetadata(@Const @ByRef
Section metadata)
Calling this method will replace previously stored information.
setMetadata in class EntityWithMetadatametadata - The Section that should be associated
with this entity.Section@Name(value="metadata")
public void setMetadata(@StdString
String id)
Calling this method will replace previously stored information.
setMetadata in class EntityWithMetadataid - The id of the Section that should be associated
with this entity.Sectionpublic void removeMetadata()
removeMetadata in class EntityWithMetadataSection@Name(value="sourceCount") public long getSourceCount()
getSourceCount in class EntityWithSourcesSource@Cast(value="bool")
public boolean hasSource(@StdString
String id)
hasSource in class EntityWithSourcesid - The source id to check.Source@Cast(value="bool")
public boolean hasSource(@Const @ByRef
Source source)
hasSource in class EntityWithSourcessource - The source to check.Sourcepublic Source getSource(String id)
getSource in class EntityWithSourcesid - The id of the associated source.Sourcepublic Source getSource(long index)
getSource in class EntityWithSourcesindex - The index of the associated source.Sourcepublic List<Source> getSources()
getSources in class EntityWithSourcesSourcepublic void setSources(List<Source> sources)
All previously existing associations will be overwritten.
setSources in class EntityWithSourcessources - A list with all sources.Sourcepublic void addSource(@StdString
String id)
If a source with the given id already is associated with the entity, the call will have no effect.
addSource in class EntityWithSourcesid - The id of the source.Sourcepublic void addSource(@Const @ByRef
Source source)
Calling this method will have no effect if the source is already associated to this entity.
addSource in class EntityWithSourcessource - The source to add.Source@Cast(value="bool")
public boolean removeSource(@StdString
String id)
This method just removes the association between the entity and the source. The source itself will not be deleted from the file.
removeSource in class EntityWithSourcesid - The id of the source to remove.Source@Cast(value="bool")
public boolean removeSource(@Const @ByRef
Source source)
This method just removes the association between the entity and the source. The source itself will not be deleted from the file.
removeSource in class EntityWithSourcessource - The source to remove.Sourcepublic String getLabel()
public void setLabel(String label)
label - The label of the data array.public String getUnit()
public void setUnit(String unit)
unit - The unit of the data array.public double getExpansionOrigin()
The expansion origin is 0.0 by default.
@Name(value="expansionOrigin") public void setExpansionOrigin(double expansionOrigin)
expansionOrigin - The expansion origin for the calibration.public void setPolynomCoefficients(double[] polynomCoefficients)
By default this is set to a two element array of [0.0, 1.0] for a linear calibration with zero offset.
polynomCoefficients - The new polynom coefficients for the calibration.
If null, deletes for the `polynomCoefficients` attribute.public double[] getPolynomCoefficients()
public List<Dimension> getDimensions()
Dimensionpublic List<Dimension> getDimensions(java.util.function.Predicate<Dimension> filter)
The parameter filter can be used to filter sources by various criteria.
filter - A filter function.Dimension@Name(value="dimensionCount") @Cast(value="size_t") public long getDimensionCount()
This matches the dimensionality of the data stored in this property.
Dimensionpublic Dimension getDimension(long id)
id - The index of the respective dimension.Dimension@ByVal public SetDimension appendSetDimension()
SetDimension@ByVal public RangeDimension appendRangeDimension(@StdVector double[] ticks)
ticks - The ticks of the RangeDimension to create.RangeDimension@ByVal public RangeDimension appendAliasRangeDimension()
RangeDimension@ByVal public SampledDimension appendSampledDimension(double samplingInterval)
samplingInterval - The sampling interval of the SetDimension to create.SampledDimension@ByVal public SetDimension createSetDimension(@Cast(value="size_t") long id)
This adds a new dimension descriptor of the type SetDimension that describes the dimension
of the data at the specified index.
id - The index of the dimension. Must be a value > 0 and <= `dimensionCount + 1`.SetDimension@ByVal public RangeDimension createRangeDimension(@Cast(value="size_t") long id, @StdVector double[] ticks)
This adds a new dimension descriptor of the type RangeDimension that describes the dimension
of the data at the specified index.
id - The index of the dimension. Must be a value > 0 and <= `dimensionCount + 1`.ticks - Array with RangeDimension.setTicks(double[]).RangeDimension@ByVal public RangeDimension createAliasRangeDimension()
RangeDimension@ByVal public SampledDimension createSampledDimension(@Cast(value="size_t") long id, double samplingInterval)
This adds a new dimension descriptor of the type SampledDimension that describes the dimension
of the data at the specified index.
id - The index of the dimension. Must be a value > 0 and <= `dimensionCount + 1`.samplingInterval - The sampling interval of the dimension.SampledDimension@Cast(value="bool")
public boolean deleteDimension(@Cast(value="size_t")
long id)
id - The index of the dimension. Must be a value > 0 and < `getDimensionCount + 1`.Dimension@Name(value="dataExtent") @ByVal public NDSize getDataExtent()
NDSize@Name(value="dataExtent")
public void setDataExtent(@Const @ByRef
NDSize extent)
extent - The extent of the data.NDSize@Name(value="dataType") @ByVal @Cast(value="nix::DataType") public int getDataType()
DataTypepublic void getData(byte[] data,
NDSize count,
NDSize offset)
data - byte arraycount - dimensionsoffset - offsetpublic void getData(short[] data,
NDSize count,
NDSize offset)
data - short arraycount - dimensionsoffset - offsetpublic void getData(int[] data,
NDSize count,
NDSize offset)
data - int arraycount - dimensionsoffset - offsetpublic void getData(long[] data,
NDSize count,
NDSize offset)
data - long arraycount - dimensionsoffset - offsetpublic void getData(float[] data,
NDSize count,
NDSize offset)
data - float arraycount - dimensionsoffset - offsetpublic void getData(double[] data,
NDSize count,
NDSize offset)
data - double arraycount - dimensionsoffset - offsetpublic void setData(byte[] data,
NDSize count,
NDSize offset)
data - datacount - dimensionsoffset - offsetpublic void setData(short[] data,
NDSize count,
NDSize offset)
data - datacount - dimensionsoffset - offsetpublic void setData(int[] data,
NDSize count,
NDSize offset)
data - datacount - dimensionsoffset - offsetpublic void setData(long[] data,
NDSize count,
NDSize offset)
data - datacount - dimensionsoffset - offsetpublic void setData(float[] data,
NDSize count,
NDSize offset)
data - datacount - dimensionsoffset - offsetpublic void setData(double[] data,
NDSize count,
NDSize offset)
data - datacount - dimensionsoffset - offsetpublic String toString()
toString in class org.bytedeco.javacpp.PointerCopyright © 2016. All rights reserved.