public class DataSetUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROPERTY_TYPE_BOOLEAN |
static java.lang.String |
PROPERTY_TYPE_CACHETAG |
static java.lang.String |
PROPERTY_TYPE_MAP |
static java.lang.String |
PROPERTY_TYPE_NUMBER |
static java.lang.String |
PROPERTY_TYPE_QDATASET |
static java.lang.String |
PROPERTY_TYPE_STRING |
static java.lang.String |
PROPERTY_TYPE_UNITS |
Constructor and Description |
---|
DataSetUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addContext(java.util.Map<java.lang.String,java.lang.Object> props,
QDataSet cds)
adds the rank 0 dataset (a Datum) to the properties, after all
the other CONTEXT_<i> properties.
|
static void |
addContext(MutablePropertyDataSet ds,
QDataSet cds)
adds the rank 0 dataset (a Datum) to the dataset's properties, after all
the other CONTEXT_<i> properties.
|
static void |
addQube(MutablePropertyDataSet ds)
add QUBE property to dataset, maybe verifying that it is a qube.
|
static double[][] |
as2DArrayOfDoubles(QDataSet d)
convert the QDataSet to an array.
|
static double[] |
asArrayOfDoubles(QDataSet d)
convert the QDataSet to an array.
|
static DRank0DataSet |
asDataSet(Datum d)
create a rank 0 dataset from the Datum.
|
static QDataSet |
asDataSet(DatumRange dr)
return a 2-element rank 1 bins dataset with BINS_0=QDataSet.VALUE_BINS_MIN_MAX
|
static QDataSet |
asDataSet(DatumVector dv)
return the rank 1 dataset equivalent to the DatumVector
|
static DRank0DataSet |
asDataSet(double d)
create a dimensionless rank 0 dataset from the double.
|
static DRank0DataSet |
asDataSet(double d,
Units u)
create a rank 0 dataset from the double and units.
|
static QDataSet |
asDataSet(java.lang.Object arr)
convert java arrays into QDataSets.
|
static QDataSet |
asDataSet(java.lang.Object x,
java.lang.Object y)
convert java arrays into QDataSets.
|
static QDataSet |
asDataSet(java.lang.Object x,
java.lang.Object y,
java.lang.Object z)
convert java types into QDataSets.
|
static Datum |
asDatum(QDataSet ds)
convert the rank 0 QDataSet to a Datum.
|
static Datum |
asDatum(RankZeroDataSet ds) |
static DatumRange |
asDatumRange(QDataSet ds)
return the DatumRange equivalent of this 2-element, rank 1 bins dataset.
|
static DatumRange |
asDatumRange(QDataSet ds,
boolean sloppy)
return the DatumRange equivalent of this 2-element, rank 1 bins dataset.
|
static DatumVector |
asDatumVector(QDataSet ds)
return DatumVector, which is a 1-d array of Datums.
|
static DatumFormatter |
bestFormatter(QDataSet datums)
return a DatumFormatter that can accurately format all of the datums
in the dataset.
|
static int |
binarySearch(QDataSet ds,
double key,
int low,
int high)
perform a binary search for key within ds, constraining the search to between low and high.
|
static java.lang.String[] |
bundleNames(QDataSet ds)
return the name for each column of the bundle.
|
static QDataSet |
bundleWeightsDataSet(QDataSet ds)
special weightsDataSet for when there is a bundle, and each
component could have its own FILL_VALID and VALID_MAX.
|
static WritableDataSet |
canonizeFill(QDataSet ds)
Iterate through the dataset, changing all points outside of validmin,
validmax and with zero weight to fill=-1e31.
|
static void |
checkListOfIndeces(QDataSet ds,
QDataSet indices)
verify that the indeces really are indeces, and a warning may be printed
if the indeces don't appear to match the array by
looking at the MAX_VALUE property of the indeces.
|
static boolean |
checkQube(QDataSet ds)
check to see if a dataset really is a qube, even if there is a
rank 2 dep1.
|
static int |
closest(QDataSet ds,
double d,
int guess)
return the index of the closest value in ds to d, using guess as a starting point.
|
static int |
closestIndex(QDataSet ds,
Datum datum)
returns the index of the closest index in the data.
|
static int |
closestIndex(QDataSet table,
double x,
Units units) |
static java.lang.String |
contextAsString(QDataSet ds)
provide the context as a string, for example to label a plot.
|
static java.lang.String |
contextAsString(QDataSet ds,
java.lang.String delim)
provide the context as a string, for example to label a plot.
|
static QDataSet |
convertTo(QDataSet ds,
Units u)
convert the dataset to the given units.
|
static void |
copyDimensionProperties(QDataSet source,
MutablePropertyDataSet dest)
Copy over all the dimension properties, including:
UNITS, FORMAT, SCALE_TYPE,
TYPICAL_MIN, TYPICAL_MAX,
VALID_MIN, VALID_MAX, FILL_VALUE,
NAME, LABEL, TITLE,
USER_PROPERTIES
These are dimension properties, as opposed to structural
see dimensionProperties() for a list of dimension properties.
|
static java.lang.String[] |
correlativeProperties()
properties that go along with the zeroth index.
|
static RankZeroDataSet |
courserCadence(RankZeroDataSet yTagWidth0,
RankZeroDataSet yTagWidth1)
return the courser cadence of the two cadences.
|
static java.lang.String[] |
dimensionProperties()
return the list of properties that pertain to the dimension that dataset
values exist.
|
static QDataSet |
firstValidPoint(QDataSet ds)
returns the first valid point found in a dataset, or null if
no such point is found.
|
static java.lang.String |
format(QDataSet ds)
return a human-readable string representing the dataset
|
static java.lang.String |
format(QDataSet ds,
boolean showContext)
return a human-readable string representing the dataset
|
static QDataSet |
gcd(QDataSet ds,
QDataSet limit)
return the greatest common divisor, which is the unit for which
all elements in the dataset are integer multiples of the result.
|
static QDataSet |
gcd(QDataSet ds,
QDataSet d,
QDataSet limit)
return the greatest common divisor, which is the unit for which
all elements in the dataset are integer multiples of the result.
|
static RankZeroDataSet |
getCadenceWaveform(QDataSet ds)
return the cadence between measurements of a waveform dataset.
|
static QDataSet |
getContext(QDataSet ds)
collect the context for the dataset.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getDimensionProperties(QDataSet ds,
java.util.Map<java.lang.String,java.lang.Object> def)
return just the properties attached to the dataset, like
UNITS and SCALE_TYPE, and not like DEPEND_x, etc.
|
static int |
getNextIndex(QDataSet ds,
Datum datum)
returns the first column that is after the given datum.
|
static java.lang.Integer |
getNextIndexStrict(QDataSet ds,
Datum datum)
Returns the index of the value which is greater than the
value less of the datum.
|
static DatumRange |
getNextInterval(QDataSet ds,
DatumRange dr0)
return the next interval (typically time) containing data, centered on data, with the
roughly the same width.
|
static int |
getPreviousIndex(QDataSet ds,
Datum datum)
returns the first index that is before the given datum, or zero
if no data is found before the datum.
|
static java.lang.Integer |
getPreviousIndexStrict(QDataSet ds,
Datum datum)
Returns the index of the value which is less than the
value less of the datum.
|
static DatumRange |
getPreviousInterval(QDataSet ds,
DatumRange dr0)
return the previous interval (typically time) containing data, centered on data, with the
roughly the same width.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getProperties(QDataSet ds)
gets all the properties of the dataset.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getProperties(QDataSet ds,
java.util.Map<java.lang.String,java.lang.Object> def)
gets all the properties of the dataset.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getProperties(QDataSet ds,
java.lang.String[] names,
java.util.Map<java.lang.String,java.lang.Object> def)
return the properties listed, using the defaults if provided.
|
static java.lang.Object |
getProperty(QDataSet ds,
java.lang.String name,
java.lang.Object deflt) |
static java.lang.Class |
getPropertyClass(java.lang.String name)
return the class for the property, to support Jython.
|
static java.lang.String |
getPropertyType(java.lang.String name)
return the type of the property, as a string to support use in Jython:
String,Number,Boolean,Map,QDataSet,CacheTag,Units
|
static java.lang.String |
getStringValue(QDataSet ds)
Return just the value encoded as richly as possible, for human consumption.
|
static java.lang.String |
getStringValue(QDataSet yds,
double value)
return the string value of the double, considering QDataSet.FORMAT, the units and the value.
|
static java.lang.String |
getStringValue(QDataSet ds,
double value,
int i)
return the value, which gets units from index i.
|
static java.lang.Object |
getUserProperty(QDataSet ds,
java.lang.String name)
return the "User" property, which allow for extensions of the data model that
aren't used.
|
static java.lang.String[] |
globalProperties()
properties that describe the dataset itself, rather than those of a dimension
or structural properties.
|
static QDataSet |
guessCadence(QDataSet xds,
QDataSet yds)
return the cadence for the given x tags.
|
static QDataSet |
guessCadence(QDataSet xds,
QDataSet yds,
QDataSet zds)
return the cadence in X for the given X tags and Y tags.
|
static RankZeroDataSet |
guessCadenceNew(QDataSet xds,
QDataSet yds)
returns a rank 0 dataset indicating the cadence of the dataset.
|
static MutablePropertyDataSet |
indexGenDataSet(int n)
creates a dataset of integers 0,1,2,...,n-1.
|
static QDataSet |
inferBins(QDataSet yds)
This is the one code to infer bin boundaries when only the
centers are available.
|
static QDataSet[] |
inferBinsRank2(QDataSet ydss)
infer the bins for the rank 2 ytags.
|
static boolean |
isConstant(QDataSet ds)
return true if each record of DEPEND_0 is the same.
|
static boolean |
isConstant(QDataSet ds,
int dim)
return true if each record of DEPEND_i is the same.
|
static boolean |
isDataAt(QDataSet ds,
Datum t)
is data found at the time t, or might it be within a gap in the data?
|
static boolean |
isDimensionProperty(java.lang.String name)
return true if the property name is a valid dimension property
like "UNITS" or "FORMAT".
|
static boolean |
isInheritedProperty(java.lang.String prop)
true if the property is one that is global and is relevant throughout the
dataset, such as a title or the units.
|
static boolean |
isLogSpacing(QDataSet ds)
return true if the data appears to have log spacing.
|
static boolean |
isMonotonic(QDataSet ds)
returns true if the dataset is monotonically increasing.
|
static boolean |
isMonotonicAndIncreasing(QDataSet ds)
returns true if the dataset is monotonically increasing
and does not contain repeat values.
|
static boolean |
isMonotonicAndIncreasingQuick(QDataSet ds)
quickly determine, with high accuracy, if data is monotonic.
|
static boolean |
isMonotonicQuick(QDataSet ds)
quickly determine, with high accuracy, if data is monotonic (repeated values
allowed).
|
static boolean |
isNotBundle(QDataSet ds)
return true if the data is not a bundle and has uniform units throughout
the dataset.
|
static boolean |
isQube(QDataSet ds)
test to see that the dataset is a qube.
|
static QDataSet |
kmeansCadence(QDataSet xds,
int n)
use K-means algorithm to find N means in a rank 1 dataset.
|
static void |
makeValid(MutablePropertyDataSet ds)
throw out DEPEND and PLANE to make dataset valid.
|
static void |
maybeCopyRenderType(QDataSet source,
MutablePropertyDataSet dest)
copy over the render type, if it is still appropriate.
|
static QDataSet |
nLargest(QDataSet set,
int n)
return the value of the nth biggest item.
|
static boolean |
oneUnit(QDataSet ds)
Test for bundle scheme.
|
static int |
product(int[] qube)
returns 1 for zero-length qube, the product otherwise.
|
static java.lang.String[] |
propertyNames()
Return the names of non-structural properties of the dataset, like the UNITS and CADENCE.
|
static void |
putProperties(java.util.Map<java.lang.String,java.lang.Object> properties,
MutablePropertyDataSet ds)
copy all properties into the dataset by iterating through the map.
|
static int[] |
qubeDims(QDataSet ds)
provides a convenient way of indexing qubes, returning an int[] of
length ds.rank() containing each dimension's length,
or null if the dataset is not a qube.
|
static QDataSet |
qubeSubset(QDataSet ds,
int reclen)
return a subset of the dataset which is a qube.
|
static int[] |
rangeOfMonotonic(QDataSet ds)
returns the indeces of the min and max elements of the monotonic dataset.
|
static int |
repeatingSignal(QDataSet yds)
return 0 or the number of values after which the signal repeats.
|
static MutablePropertyDataSet |
replicateDataSet(int n,
double value)
creates a dataset with the given cadence, start and length.
|
static boolean |
samePopulation(QDataSet ds1,
QDataSet ds2)
true if the two datasets appear to be from the same population.
|
static java.util.Map<java.lang.String,java.lang.Object> |
sliceProperties(QDataSet ds,
int index,
java.util.Map<java.lang.String,java.lang.Object> result)
return properties attached to the slice at index.
|
static java.lang.String |
statsString(QDataSet ds)
return a human readable statistical representation of the dataset.
|
static int |
sum(int[] qube)
returns 0 for zero-length qube, the sum otherwise.
|
static MutablePropertyDataSet |
tagGenDataSet(int n,
double start,
double cadence)
creates a dataset with the given cadence, start and length.
|
static MutablePropertyDataSet |
tagGenDataSet(int n,
double start,
double cadence,
Units units)
creates a dataset with the given cadence, start and length.
|
static MutablePropertyDataSet |
toBundleDs(QDataSet labels)
make a proper bundle ds from a simple bundle containing ordinal units
This assumes that labels is a unique set of labels.
|
static java.lang.String |
toSparkline(QDataSet ds,
QDataSet extent,
boolean bar)
Make a unicode spark line http://www.ssec.wisc.edu/~tomw/java/unicode.html.
|
static java.lang.String |
toString(int[] qube)
return string representation of the dimensions of the qube dimensions.
|
static java.lang.String |
toString(QDataSet ds)
provide a string representation of the dataset.
|
static int |
totalLength(QDataSet ds)
return the total number of values in the dataset.
|
static long |
totalLengthAsLong(QDataSet ds)
return the total number of values in the dataset, as a long.
|
static java.util.Map<java.lang.String,java.lang.Object> |
trimProperties(QDataSet ds,
int start,
int stop)
help out implementations of the QDataSet.trim() command.
|
static boolean |
validate(QDataSet ds,
java.util.List<java.lang.String> problems)
returns true if the dataset is valid, false otherwise.
|
static boolean |
validate(QDataSet xds,
QDataSet yds,
java.util.List<java.lang.String> problems)
add method for validating before link is called.
|
static boolean |
validate(QDataSet xds,
QDataSet yds,
QDataSet zds,
java.util.List<java.lang.String> problems)
add method for validating before link is called.
|
static QDataSet |
validPoints(QDataSet ds)
return just the valid points of the dataset.
|
static double |
value(RankZeroDataSet ds,
Units tu)
get the value of the rank 0 dataset in the specified units.
|
static QDataSet |
weightsDataSet(QDataSet ds)
Provide consistent valid logic to operators by providing a QDataSet
with >0.0 where the data is valid, and 0.0 where the data is invalid.
|
static int |
xTagBinarySearch(QDataSet ds,
Datum datum,
int low,
int high)
returns the index of a tag, or the (-(insertion point) - 1).
|
public static final java.lang.String PROPERTY_TYPE_STRING
public static final java.lang.String PROPERTY_TYPE_NUMBER
public static final java.lang.String PROPERTY_TYPE_BOOLEAN
public static final java.lang.String PROPERTY_TYPE_MAP
public static final java.lang.String PROPERTY_TYPE_QDATASET
public static final java.lang.String PROPERTY_TYPE_CACHETAG
public static final java.lang.String PROPERTY_TYPE_UNITS
public static MutablePropertyDataSet indexGenDataSet(int n)
n
- the boundpublic static MutablePropertyDataSet tagGenDataSet(int n, double start, double cadence)
n
- the number of elementsstart
- the value for the first element.cadence
- the step size between elementspublic static MutablePropertyDataSet tagGenDataSet(int n, double start, double cadence, Units units)
n
- the number of elementsstart
- the value for the first element.cadence
- the step size between elementsunits
- the units of the dataset, for example Units.cmpublic static MutablePropertyDataSet replicateDataSet(int n, double value)
n
- the number of elementsvalue
- the value for each elementpublic static boolean isMonotonic(QDataSet ds)
ds
- the rank 1 dataset with physical units.QDataSet.MONOTONIC
,
ArrayDataSet.monotonicSubset(org.das2.qds.ArrayDataSet)
,
isMonotonicAndIncreasing(org.das2.qds.QDataSet)
,
Ops.ensureMonotonic(org.das2.qds.QDataSet)
public static boolean isMonotonicAndIncreasing(QDataSet ds)
ds
- the rank 1 dataset with physical units.QDataSet.MONOTONIC
,
ArrayDataSet.monotonicSubset(org.das2.qds.ArrayDataSet)
,
isMonotonic(org.das2.qds.QDataSet)
public static boolean isMonotonicQuick(QDataSet ds)
ds
- isMonotonicAndIncreasing(org.das2.qds.QDataSet)
,
QDataSet.MONOTONIC
public static boolean isMonotonicAndIncreasingQuick(QDataSet ds)
ds
- isMonotonicAndIncreasing(org.das2.qds.QDataSet)
,
QDataSet.MONOTONIC
,
Ops.ensureMonotonicAndIncreasingWithFill(org.das2.qds.QDataSet)
public static int binarySearch(QDataSet ds, double key, int low, int high)
ds
- a rank 1 monotonic dataset.key
- the value to find.low
- high
- public static int closest(QDataSet ds, double d, int guess)
ds
- a rank 1, monotonic dataset.d
- the value to find.guess
- a guess at a close index, or -1 if no guess should be made. In this case, a binary search is performed.public static java.lang.Object getUserProperty(QDataSet ds, java.lang.String name)
ds
- The dataset containing the property.name
- The name of the user property.public static java.lang.String[] propertyNames()
public static void copyDimensionProperties(QDataSet source, MutablePropertyDataSet dest)
source
- dest
- public static void maybeCopyRenderType(QDataSet source, MutablePropertyDataSet dest)
source
- dest
- public static java.lang.String[] dimensionProperties()
public static java.lang.Class getPropertyClass(java.lang.String name)
name
- the property name, e.g. QDataSet.TITLE//TODO: super inefficient, this needs to be rewritten as switch
public static java.lang.String getPropertyType(java.lang.String name)
name
- the property namegetPropertyClass(java.lang.String)
,
QDataSet
public static boolean isDimensionProperty(java.lang.String name)
name
- property name to testpublic static java.lang.String[] globalProperties()
public static java.lang.String[] correlativeProperties()
public static boolean isInheritedProperty(java.lang.String prop)
prop
- the property name.public static java.util.Map<java.lang.String,java.lang.Object> sliceProperties(QDataSet ds, int index, java.util.Map<java.lang.String,java.lang.Object> result)
ds
- the dataset to slice.index
- index to slice at.result
- a map to insert the new properties, or null if a new one should be created.public static java.util.Map<java.lang.String,java.lang.Object> trimProperties(QDataSet ds, int start, int stop)
ds
- the dataset with properties to trim.start
- start index of trim operationstop
- exclusive stop index of the trim operation.public static java.util.Map<java.lang.String,java.lang.Object> getDimensionProperties(QDataSet ds, java.util.Map<java.lang.String,java.lang.Object> def)
ds
- the datasetdef
- default values or null.dimensionProperties()
public static java.util.Map<java.lang.String,java.lang.Object> getProperties(QDataSet ds, java.lang.String[] names, java.util.Map<java.lang.String,java.lang.Object> def)
ds
- dataset source of the properties.names
- array of namesdef
- defaults, or null if no defaults are to be used.public static java.util.Map<java.lang.String,java.lang.Object> getProperties(QDataSet ds, java.util.Map<java.lang.String,java.lang.Object> def)
ds
- the datasetdef
- an empty map.public static java.util.Map<java.lang.String,java.lang.Object> getProperties(QDataSet ds)
ds
- the datasetputProperties(java.util.Map, org.das2.qds.MutablePropertyDataSet)
public static void putProperties(java.util.Map<java.lang.String,java.lang.Object> properties, MutablePropertyDataSet ds)
properties
- the propertiesds
- the mutable property dataset, which is still mutable.getProperties(org.das2.qds.QDataSet)
public static boolean isNotBundle(QDataSet ds)
ds
- any dataset.public static java.lang.String toString(QDataSet ds)
ds
- any dataset.format(org.das2.qds.QDataSet, boolean)
public static QDataSet firstValidPoint(QDataSet ds)
ds
- non-bundle dataset.public static QDataSet validPoints(QDataSet ds)
ds
- a dataset rank > 0.public static QDataSet gcd(QDataSet ds, QDataSet d, QDataSet limit)
ds
- any datasetd
- rank 0 dataset, first factor for the dataset, error is used to detect non-zero significance.limit
- rank 0 dataset, the resolution for which data is considered equal, and this
limit should be greater than numerical precision.java.lang.IllegalArgumentException
- if there is no valid data.public static QDataSet gcd(QDataSet ds, QDataSet limit)
ds
- any datasetlimit
- the resolution for which data is considered equal. The result
will be an integer multiple of this.java.lang.IllegalArgumentException
- if there is no valid data.public static RankZeroDataSet courserCadence(RankZeroDataSet yTagWidth0, RankZeroDataSet yTagWidth1)
yTagWidth0
- rank 0 dataset that is one cadence (e.g. 84 sec)yTagWidth1
- rank 0 dataset that is the second cadence (e.g. 70 sec)public static java.lang.String toSparkline(QDataSet ds, QDataSet extent, boolean bar)
ds
- the rank N (typically 1) datasetextent
- None or the range, see Ops.extent(ds)bar
- true indicates bars should be used instead of scatterpublic static boolean samePopulation(QDataSet ds1, QDataSet ds2)
ds1
- first datasetds2
- second datasetpublic static boolean isLogSpacing(QDataSet ds)
ds
- rank 1 dataset.public static QDataSet[] inferBinsRank2(QDataSet ydss)
ydss
- rank 2 dataset[n,m]public static QDataSet inferBins(QDataSet yds)
yds
- rank 1 dataset.public static RankZeroDataSet getCadenceWaveform(QDataSet ds)
ds
- public static RankZeroDataSet guessCadenceNew(QDataSet xds, QDataSet yds)
xds
- the x tags, which may not contain fill values for non-null result.yds
- the y values, which if non-null is only used for fill values. This
is only used if it is rank 1.public static QDataSet nLargest(QDataSet set, int n)
set
- rank 1 dataset containing comparable data.n
- the number of items to findpublic static QDataSet kmeansCadence(QDataSet xds, int n)
xds
- dataset containing data from N normal distributionsn
- number of divisions.public static QDataSet guessCadence(QDataSet xds, QDataSet yds)
xds
- the x tags, which may not contain fill values for non-null result.yds
- the y values, which if non-null is only used for fill values. This is only used if it is rank 1.public static QDataSet guessCadence(QDataSet xds, QDataSet yds, QDataSet zds)
xds
- the x tags, which may not contain fill values for non-null result.yds
- the y values, which may not contain fill values for non-null result.zds
- the z valuespublic static boolean isConstant(QDataSet ds)
ds
- any datasetpublic static boolean isConstant(QDataSet ds, int dim)
ds
- any datasetdim
- the indexpublic static boolean checkQube(QDataSet ds)
ds
- any datasetpublic static boolean isQube(QDataSet ds)
ds
- QDataSet of any rank.public static QDataSet qubeSubset(QDataSet ds, int reclen)
ds
- a rank N dataset like dataset[3,1616*,6144*], where asterisks (stars) indicate it is not a qube.reclen
- the record length for each record.public static int[] qubeDims(QDataSet ds)
ds
- public static boolean oneUnit(QDataSet ds)
ds
- the datasetpublic static int product(int[] qube)
qube
- int arraypublic static int sum(int[] qube)
qube
- int arraypublic static java.lang.String toString(int[] qube)
qube
- an array of integers, 4 elements or fewer.public static void addQube(MutablePropertyDataSet ds) throws java.lang.IllegalArgumentException
ds
- the datasetjava.lang.IllegalArgumentException
- if the dataset is not a qubepublic static java.lang.String format(QDataSet ds)
ds
- the dataset to representpublic static java.lang.String format(QDataSet ds, boolean showContext)
ds
- the dataset to representshowContext
- show the context property (@slice2=1) if present and ds is rank0.toString(org.das2.qds.QDataSet)
public static java.lang.String statsString(QDataSet ds)
ds
- the datapublic static boolean validate(QDataSet ds, java.util.List<java.lang.String> problems)
ds
- rank N dataset.problems
- insert problem descriptions here, if null then ignorepublic static boolean validate(QDataSet xds, QDataSet yds, java.util.List<java.lang.String> problems)
xds
- yds
- problems
- insert problem descriptions here, if null then ignorepublic static boolean validate(QDataSet xds, QDataSet yds, QDataSet zds, java.util.List<java.lang.String> problems)
xds
- rank 1 tagsyds
- rank 1 or rank 2 tagszds
- the dependent data.problems
- insert problem descriptions here, if null then ignorepublic static long totalLengthAsLong(QDataSet ds)
ds
- public static int totalLength(QDataSet ds)
ds
- public static void makeValid(MutablePropertyDataSet ds)
ds
- public static QDataSet bundleWeightsDataSet(QDataSet ds)
ds
- rank 2 bundle datasetpublic static QDataSet weightsDataSet(QDataSet ds)
ds
- the datasetpublic static WritableDataSet canonizeFill(QDataSet ds)
ds
- rank N QUBE dataset.public static QDataSet convertTo(QDataSet ds, Units u)
ds
- the datasetu
- new Unitspublic static double value(RankZeroDataSet ds, Units tu)
ds
- tu
- target unitspublic static Datum asDatum(RankZeroDataSet ds)
public static Datum asDatum(QDataSet ds)
ds
- rank 0 dataset.public static DatumRange asDatumRange(QDataSet ds, boolean sloppy)
ds
- a rank 1, 2-element bins dataset.sloppy
- true indicates we don't check BINS_0 property.public static DatumRange asDatumRange(QDataSet ds)
ds
- a two-element datasetpublic static DatumVector asDatumVector(QDataSet ds)
ds
- a rank 1 QDataSetpublic static QDataSet asDataSet(DatumVector dv)
dv
- public static QDataSet asDataSet(DatumRange dr)
dr
- a Das2 DatumRangepublic static DRank0DataSet asDataSet(double d, Units u)
d
- a double, or Double.NaNu
- null or the units of d.public static DRank0DataSet asDataSet(double d)
d
- a double, or Double.NaNpublic static DRank0DataSet asDataSet(Datum d)
d
- a datumpublic static double[] asArrayOfDoubles(QDataSet d)
d
- the rank 1 dataset.public static double[][] as2DArrayOfDoubles(QDataSet d)
d
- the rank 2 datasetpublic static QDataSet asDataSet(java.lang.Object arr)
arr
- 1-D or 2-D array of java native type.public static QDataSet asDataSet(java.lang.Object x, java.lang.Object y)
x
- array, number, or String parsed with DatumUtil.parsey
- array, number, or String parsed with DatumUtil.parseDatumUtil.parse(java.lang.String)
public static QDataSet asDataSet(java.lang.Object x, java.lang.Object y, java.lang.Object z)
x
- array, number, or String parsed with DatumUtil.parsey
- array, number, or String parsed with DatumUtil.parsez
- array, number, or String parsed with DatumUtil.parsepublic static void addContext(MutablePropertyDataSet ds, QDataSet cds)
ds
- cds
- public static void addContext(java.util.Map<java.lang.String,java.lang.Object> props, QDataSet cds)
props
- the propertiescds
- the context in a rank 0 datasetpublic static java.lang.String contextAsString(QDataSet ds)
ds
- the dataset containing context properties which are rank 0 datums or rank 1 datum ranges.public static java.lang.String contextAsString(QDataSet ds, java.lang.String delim)
ds
- the dataset containing context properties which are rank 0 datums or rank 1 datum ranges.delim
- the delimiter between context elements, such as "," or "!c"public static QDataSet getContext(QDataSet ds)
ds
- the datasetpublic static int[] rangeOfMonotonic(QDataSet ds)
ds
- monotonic, rank 1 dataset.java.lang.IllegalArgumentException
- when isMonotonic(ds) is false.which returns the range containing any data.
,
which must be true
public static int xTagBinarySearch(QDataSet ds, Datum datum, int low, int high)
ds
- monotonically increasing data.datum
- value we are looking forlow
- inclusive lower bound of the searchhigh
- inclusive upper bound of the searchpublic static int closestIndex(QDataSet ds, Datum datum)
ds
- tags datasetdatum
- the location to findjava.lang.IllegalArgumentException
- if the dataset is not rank 1.java.lang.IllegalArgumentException
- if the dataset is length 0.java.lang.IllegalArgumentException
- if the dataset is all fill.public static java.lang.Integer getPreviousIndexStrict(QDataSet ds, Datum datum)
ds
- rank 1 monotonic tags, or rank 2 bins.datum
- a datum of the same or convertible units.public static java.lang.Integer getNextIndexStrict(QDataSet ds, Datum datum)
ds
- rank 1 monotonic tags, or rank 2 bins.datum
- a datum of the same or convertible units.public static int getPreviousIndex(QDataSet ds, Datum datum)
ds
- the datasetdatum
- a datum in the same units of the dataset.public static int getNextIndex(QDataSet ds, Datum datum)
ds
- the datasetdatum
- a datum in the same units of the dataset.public static DatumRange getNextInterval(QDataSet ds, DatumRange dr0)
ds
- the datasetdr0
- the current intervalpublic static boolean isDataAt(QDataSet ds, Datum t)
ds
- any time-series datasett
- the timepublic static DatumRange getPreviousInterval(QDataSet ds, DatumRange dr0)
ds
- the datasetdr0
- the current intervalpublic static java.lang.Object getProperty(QDataSet ds, java.lang.String name, java.lang.Object deflt)
public static java.lang.String getStringValue(QDataSet ds, double value, int i)
ds
- the dataset providing units and format information.value
- double value from the dataseti
- the index of the valuepublic static DatumFormatter bestFormatter(QDataSet datums)
datums
- a rank 1 dataset, or if rank>1, then return the formatter for a slice.public static java.lang.String getStringValue(QDataSet yds, double value)
yds
- the dataset, maybe with FORMAT and VALID_MIN, etc.value
- the double from the dataset (presumably).public static java.lang.String getStringValue(QDataSet ds)
ds
- public static MutablePropertyDataSet toBundleDs(QDataSet labels)
labels
- java.lang.IllegalArgumentException
- if the input is not rank 1.public static java.lang.String[] bundleNames(QDataSet ds)
ds
- dataset, presumably with BUNDLE_1 property.public static void checkListOfIndeces(QDataSet ds, QDataSet indices)
ds
- the dataset.indices
- the indeces which refer to a subset of dataset.public static int repeatingSignal(QDataSet yds)
ds= dataset([1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2])
assert repeatingSignal(ds)==4
if the data contains fill, then it is also not repeating.yds
- the rank 1 dataset.guessCadenceNew(org.das2.qds.QDataSet, org.das2.qds.QDataSet)