public class ComplexSampleSet extends VectorType implements AsciiComm, Signal
SampleSet
,
ComplexSpectrum
,
Signal
,
VectorType
,
Serialized FormModifier and Type | Field and Description |
---|---|
double[] |
imag
(Parameter that is kept for consistency with previous versions, but which is obsolete.
|
double[] |
real
(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 |
---|
ComplexSampleSet()
Creates an empty ComplexSampleSet.
|
ComplexSampleSet(double[] samplingTimes)
Creates a new ComplexSampleSet with given sampling times.
|
ComplexSampleSet(double[] samplingTimes,
double acquisitionTime)
Creates a new ComplexSampleSet with the given sampling times and data acquisition time.
|
ComplexSampleSet(double[] samplingTimes,
double[] dr,
double[] di)
Creates a new ComplexSampleSet with the given sampling times and arrays containing the sampled data.
|
ComplexSampleSet(double[] samplingTimes,
double[] dr,
double[] di,
double acquisitionTime)
Creates a new ComplexSampleSet with the given sampling times, data arrays, and data acquisition time.
|
ComplexSampleSet(double sf,
double[] dr,
double[] di)
Creates a new ComplexSampleSet with a certain sampling frequency and arrays containing the sampled data.
|
ComplexSampleSet(double sf,
double[] dr,
double[] di,
double acquisitionTime)
Creates a new ComplexSampleSet with a certain sampling frequency, the arrays of sampled data, and the acquisition
time of the first sample.
|
ComplexSampleSet(double sf,
int samples)
Creates a new ComplexSampleSet with a certain sampling frequency and number of samples.
|
ComplexSampleSet(double sf,
int samples,
double acquisitionTime)
Creates a new ComplexSampleSet with a certain sampling frequency, number of samples, and data acquisition time.
|
ComplexSampleSet(SampleSet ss)
Creates a ComplexSampleSet from a (real) SampleSet by setting the imaginary part of the data to zero.
|
ComplexSampleSet(SampleSet ss,
boolean copy)
Creates a ComplexSampleSet from a (real) SampleSet by setting the imaginary part of the data to zero.
|
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 ComplexSampleSet.
|
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[] real
Synonym for the array stored in the Hashtable dataContainer and accessed by getDataReal(). Constructors identify this pointer with the array held in dataContainer; setData() is overridden to do this identification as well.
public double[] imag
Synonym for the array stored in the Hashtable dataContainer and accessed by getDataImag(). Constructors identify this pointer with the array held in dataContainer; setData() is overridden to do this identification as well.
public double samplingFrequency
Synonym for samplingRate. It is kept up-to-date by method updateObsoletePointers below.
public ComplexSampleSet()
public ComplexSampleSet(double sf, int samples)
sf
- The sampling frequencysamples
- The number of samplesGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
,
Triplet
public ComplexSampleSet(double[] samplingTimes)
samplingTimes
- The sampling times arrayGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
,
Triplet
public ComplexSampleSet(double sf, int samples, double acquisitionTime)
sf
- The sampling frequencysamples
- The number of samplesacquisitionTime
- The time of the first sample, in secondsGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
,
Triplet
public ComplexSampleSet(double[] samplingTimes, double acquisitionTime)
samplingTimes
- The sampling times arrayacquisitionTime
- The time of the first sample, in secondsGraphType.setDataArrayReal(java.lang.Object, int)
,
VectorType.initialiseData()
public ComplexSampleSet(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 ComplexSampleSet(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 ComplexSampleSet(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 ComplexSampleSet(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 ComplexSampleSet(SampleSet ss, boolean copy)
ss
- The input data setcopy
- True if the new data are to be a copy of the old, false if passed by referencepublic ComplexSampleSet(SampleSet ss)
ss
- 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 timepublic double samplingFrequency()
public void setSamplingFrequency(double s)
s
- The new sampling frequencypublic 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 ComplexSpectrum, the new parameters are resolution, highestFrequency, twoSided, narrow, nFull. The obsolete parameters samplingFrequency and frequencyResolution are 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 ComplexSampleSet, the method first tests that the input object is compatible with superior classes, and then (if it is a ComplexSampleSet) it tests if it 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