public class SampleSet extends VectorType implements AsciiComm, Signal
ComplexSampleSet
,
ComplexSpectrum
,
Spectrum
,
VectorType
,
Triplet
,
Serialized FormModifier and Type | Field and Description |
---|---|
double[] |
data
(Parameter that is kept for consistency with previous versions, but which is obsolete.
|
double |
samplingFrequency
(Parameter that is kept for consistency with previous versions, but which is obsolete.
|
x, xlabel, y, ylabel
NOT_CONNECTED, NOT_READY, OUT_OF_RANGE
Constructor and Description |
---|
SampleSet()
Creates an empty SampleSet.
|
SampleSet(ComplexSampleSet css)
Creates a real-valued SampleSet from a ComplexSampleSet by keeping only the real part of the data.
|
SampleSet(ComplexSampleSet css,
boolean copy)
Creates a real-valued SampleSet from a ComplexSampleSet by keeping only the real part of the data.
|
SampleSet(double[] samplingTimes)
Creates a new real-valued SampleSet with given sampling times.
|
SampleSet(double[] samplingTimes,
double acquisitionTime)
Creates a new real-valued SampleSet with the given sampling times and data acquisition time.
|
SampleSet(double[] samplingTimes,
double[] d)
Creates a new real-valued SampleSet with the given sampling times and array of sampled data.
|
SampleSet(double[] samplingTimes,
double[] d,
double acquisitionTime)
Creates a new real-valued SampleSet with the given sampling times, data array, and data acquisition time.
|
SampleSet(double[] samplingTimes,
double[] dr,
double[] di)
Creates a new complex-valued SampleSet with the given sampling times and arrays containing the sampled data.
|
SampleSet(double[] samplingTimes,
double[] dr,
double[] di,
double acquisitionTime)
Creates a new complex-valued SampleSet with the given sampling times, data arrays, and data acquisition time.
|
SampleSet(double sf,
double[] d)
Creates a new real-valued SampleSet with the given sampling frequency and array of sampled data.
|
SampleSet(double sf,
double[] d,
double acquisitionTime)
Creates a new real-valued SampleSet with the given sampling frequency, the array of sampled data, and the
acquisition time of the first sample.
|
SampleSet(double sf,
double[] dr,
double[] di)
Creates a new complex-valued SampleSet with a certain sampling frequency and arrays containing the sampled data.
|
SampleSet(double sf,
double[] dr,
double[] di,
double acquisitionTime)
Creates a new complex-valued SampleSet with a certain sampling frequency, the arrays of sampled data, and the
acquisition time of the first sample.
|
SampleSet(double sf,
int samples)
Creates a new SampleSet with the given sampling frequency and number of samples.
|
SampleSet(double sf,
int samples,
boolean allocateMem)
Creates a new real-valued SampleSet with the given sampling frequency and number of samples.
|
SampleSet(double sf,
int samples,
double acquisitionTime)
Creates a new real-valued SampleSet with the given sampling frequency, number of samples, and data acquisition
time.
|
Modifier and Type | Method and Description |
---|---|
TrianaType |
copyMe()
This is one of the most important methods of Triana data.
|
protected void |
copyParameters(TrianaType source)
Copies modifiable parameters from the argument object to the current object.
|
boolean |
equals(TrianaType obj)
Determines whether the argument TrianaType is equal to the current SampleSet.
|
double |
getAcquisitionTime()
Returns the acquisition time as a double giving the number of seconds since the reference time, which should be
the same reference time as for the method setAcquisitionTime.
|
double |
getSamplingRate()
Returns the sampling frequency of the data.
|
void |
inputFromStream(java.io.BufferedReader dis)
Used when Triana types want to be able to receive ASCII data from the output of other programs.
|
void |
interpolateZeros(int factor,
boolean before)
Adds zeros between existing data values using the method of the same name in VectorType.
|
boolean |
isCompatible(TrianaType obj)
Tests the argument object to determine if it makes sense to perform arithmetic operations between it and the
current object.
|
void |
outputToStream(java.io.PrintWriter dos)
Used when Triana types want to be able to send ASCII data to other programs using strings.
|
int |
samples()
Obsolete synonym for size.
|
double |
samplingFrequency()
Obsolete synonym for getSamplingRate.
|
void |
setAcquisitionTime(double t)
Sets the acquisition time.
|
void |
setDefaultAxisLabelling()
Added by I.
|
void |
setSamplingFrequency(double s)
Obsolete synonym for setSamplingRate.
|
void |
setSamplingRate(double r)
Sets the sampling rate of the signal and adjusts the data for the independent variable accordingly.
|
protected void |
updateObsoletePointers() |
extendWithZeros, getData, getDataImag, getDataReal, getGraph, getGraphImag, getGraphReal, getScale, getScaleImag, getScaleReal, getXArray, getXImag, getXReal, getXTriplet, initialiseData, initialiseDataComplex, initialiseDataReal, isTriplet, isUniform, length, setData, setData, setDataImag, setDataReal, setX, setX, setX, setXImag, setXReal, size, testDataModel
add, addToTitle, convertDependentDataArraysToBytes, convertDependentDataArraysToDoubles, convertDependentDataArraysToFloats, convertDependentDataArraysToInts, convertDependentDataArraysToLongs, convertDependentDataArraysToShorts, copyData, copyLabels, divide, equals, getDataArrayClass, getDataArrayImag, getDataArrayImag, getDataArrayImagAsBytes, getDataArrayImagAsDoubles, getDataArrayImagAsFloats, getDataArrayImagAsInts, getDataArrayImagAsLongs, getDataArrayImagAsShorts, getDataArrayReal, getDataArrayReal, getDataArrayRealAsBytes, getDataArrayRealAsDoubles, getDataArrayRealAsFloats, getDataArrayRealAsInts, getDataArrayRealAsLongs, getDataArrayRealAsShorts, getDataArrayTypeNames, getDependentLabels, getDependentVariableDimensions, getDependentVariables, getDimensionLengths, getDimensionLengths, getGraphArrayImag, getGraphArrayImagLog10, getGraphArrayReal, getGraphArrayRealLog10, getIndependentArrayImag, getIndependentArrayReal, getIndependentLabels, getIndependentScaleImag, getIndependentScaleImagLog10, getIndependentScaleReal, getIndependentScaleRealLog10, getIndependentTriplet, getIndependentVariables, getLabels, getLabelsColumn, getTitle, isArithmeticArray, isArithmeticData, isCompatible, isDependentComplex, isIndependentComplex, isPrimitiveArray, isPrimitiveData, isTriplet, isUniform, maxDependentGraphingValuesImag, maxDependentGraphingValuesReal, maxDependentVariablesImag, maxDependentVariablesReal, maxIndependentScalesImag, maxIndependentScalesReal, maxIndependentVariablesImag, maxIndependentVariablesReal, minDependentGraphingValuesImag, minDependentGraphingValuesReal, minDependentVariablesImag, minDependentVariablesReal, minIndependentScalesImag, minIndependentScalesReal, minIndependentVariablesImag, minIndependentVariablesReal, multiply, resetDependent, resetIndependent, restrictToSubdomain, restrictToSubdomain, setDataArrayImag, setDataArrayReal, setDependentLabels, setDependentVariableDimensions, setDimensionLengths, setDimensionLengths, setDimensions, setIndependentArrayImag, setIndependentArrayReal, setIndependentLabels, setIndependentTriplet, setIndependentTriplet, setLabels, setTitle, subtract
containerSize, dataExists, deleteFromContainer, getDataContainer, getFromContainer, getSequenceNumber, insertIntoContainer, inspectDataContainer, setDataContainer, setSequenceNumber
public double[] data
A synonym for the array stored in the Hashtable dataContainer and accessed by method getDataReal.
public double samplingFrequency
A synonym for samplingRate.
public SampleSet()
public SampleSet(double sf, int samples)
sf
- The sampling frequency in Hzsamples
- The number of samplesGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
,
Triplet
public SampleSet(double sf, int samples, boolean allocateMem)
sf
- The sampling frequency in Hzsamples
- The number of samplesallocateMem
- if true, allocates the memory for the arrayGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
,
Triplet
public SampleSet(double[] samplingTimes)
samplingTimes
- The sampling times arrayGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
public SampleSet(double sf, int samples, double acquisitionTime)
sf
- The sampling frequency in Hzsamples
- The number of samplesacquisitionTime
- The time of the first sample, in secondsGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
,
Triplet
public SampleSet(double[] samplingTimes, double acquisitionTime)
samplingTimes
- The sampling times array, in secondsacquisitionTime
- The time of the first sample, in secondsGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
public SampleSet(double sf, double[] d)
sf
- The sampling frequency in Hzd
- The sampled dataTriplet
public SampleSet(double[] samplingTimes, double[] d)
samplingTimes
- The sampling times array in secondsd
- The sampled datapublic SampleSet(double sf, double[] d, double acquisitionTime)
sf
- The sampling frequency in Hzd
- The sampled dataacquisitionTime
- The time of the first sample, in secondsTriplet
public SampleSet(double[] samplingTimes, double[] d, double acquisitionTime)
samplingTimes
- The sampling times in secondsd
- The sampled dataacquisitionTime
- The time of the first sample, in secondspublic SampleSet(double sf, double[] dr, double[] di)
sf
- The sampling frequencydr
- The real part of the sampled datadi
- The imaginary part of the sampled dataTriplet
public SampleSet(double[] samplingTimes, double[] dr, double[] di)
samplingTimes
- The sampling times arraydr
- The real part of the sampled datadi
- The imaginary part of the sampled datapublic SampleSet(double sf, double[] dr, double[] di, double acquisitionTime)
sf
- The sampling frequencydr
- The real part of the sampled datadi
- The imaginary part of the sampled dataacquisitionTime
- The time of the first sample, in secondsTriplet
public SampleSet(double[] samplingTimes, double[] dr, double[] di, double acquisitionTime)
samplingTimes
- The sampling timesdr
- The real part of the sampled datadi
- The imaginary part of the sampled dataacquisitionTime
- The time of the first sample, in secondspublic SampleSet(ComplexSampleSet css, boolean copy)
css
- The input data setcopy
- True if the new data are to be copied from the old, false if passed by referencepublic SampleSet(ComplexSampleSet css)
css
- The input data setpublic void setDefaultAxisLabelling()
setDefaultAxisLabelling
in class GraphType
public double getSamplingRate()
getSamplingRate
in interface Signal
public void setSamplingRate(double r)
setSamplingRate
in interface Signal
r
- The sampling ratepublic double getAcquisitionTime()
getAcquisitionTime
in interface Signal
public void setAcquisitionTime(double t)
setAcquisitionTime
in interface Signal
t
- The acquisition time in secondspublic double samplingFrequency()
public void setSamplingFrequency(double s)
s
- The new sampling frequency in Hzpublic int samples()
public void interpolateZeros(int factor, boolean before)
interpolateZeros
in class VectorType
factor
- The number of zeros per data point to be insertedbefore
- True if the zeros go before each point, false if afterpublic TrianaType copyMe()
To override, the programmer should not invoke the super.copyMe method. Instead, create an object of the current type and call methods copyData and copyParameters. If these have been written correctly, then they will do the copying. The code should createTool, for type YourType:
YourType y = null; try { y = (YourType)getClass().newInstance(); y.copyData( this ); y.copyParameters( this ); y.setLegend( this.getLegend() ); } catch (IllegalAccessException ee) { System.out.println("Illegal Access: " + ee.getMessage()); } catch (InstantiationException ee) { System.out.println("Couldn't be instantiated: " + ee.getMessage()); } return y;
The copied object's data should be identical to the original. The method here modifies only one item: a String indicating that the object was created as a copy is added to the description StringVector.
copyMe
in class VectorType
protected void copyParameters(TrianaType source)
In SampleSet, only the parameters samplingRate, acquisitionTime, and uniformlySampled need to be copied. The obsolete parameter samplingFrequency is generated automatically when the other parameters are copied and set.
This must be overridden by any subclass that defines new parameters. The overriding method should invoke its super method. It should use the set... and get... methods for the parameters in question. This method is protected so that it cannot be called except by objects that inherit from this one. It is called by copyMe.
copyParameters
in class GraphType
source
- Data object that contains the data to be copied.public void outputToStream(java.io.PrintWriter dos) throws java.io.IOException
This method must be overridden in every subclass that defines new data or parameters. The overriding method should first call<
super.outputToStream(dos)to get output from superior classes, and then new parameters defined for the current subclass must be output. Moreover, subclasses that first dimension their data arrays must explicitly transfer these data arrays.
outputToStream
in interface AsciiComm
outputToStream
in class GraphType
dos
- The data output streamjava.io.IOException
public void inputFromStream(java.io.BufferedReader dis) throws java.io.IOException
This method must be overridden in every subclass that defines new data or parameters. The overriding method should first call
super.inputFromStream(dis)to get input from superior classes, and then new parameters defined for the current subclass must be input. Moreover, subclasses that first dimension their data arrays must explicitly transfer these data arrays.
inputFromStream
in interface AsciiComm
inputFromStream
in class GraphType
dis
- The data input streamjava.io.IOException
public boolean isCompatible(TrianaType obj)
In SampleSet, this method first tests for compatibility with superior classes, and then (if the input object is a SampleSet) tests that the input has the same sampling rate as the current object.
Classes derived from this should over-ride this method with further tests as appropriate. The over-riding method should normally have the first lines
boolean test = super.isCompatible( obj );followed by other tests. If other types not subclassed from GraphType or Const should be allowed to be compatible then other tests must be implemented.
isCompatible
in class VectorType
obj
- The data object to be compared with the current onepublic boolean equals(TrianaType obj)
This method must be over-ridden in derived types. In a derived type called xxx the method should begin
if ( !( obj instanceof xxx ) ) return false; if ( !isCompatible( obj ) ) return false;followed by tests that are specific to type xxx (testing its own parameters) and then as a last line
return super.equals( obj );This line invokes the other equals methods up the chain to GraphType. Each superior object tests its own parameters.
obj
- The object being testedprotected void updateObsoletePointers()
updateObsoletePointers
in class VectorType