Waveform Class
The waveform class provides a place
to store a pulse. This pulse can then be retrived in various formats;
various pulse attributes can be returned; and peaks occuring on the pulse
can be found. To get started, one must construct a waveform object.
Here is an example of code that would do that:
Waveform myWaveform = new Waveform( pulse );
In the above example, pulse could be an array of doubles, shorts, or
bytes. One of those must be provided though, as a Waveform object
cannot be created without a pulse. New pulses can be added to the
same myWaveform object using:
myWaveform.setData( secondPulse )
Again, secondPulse must be an array of doubles, shorts, or bytes. This
method will overwrite any pulse already in myWaveform, and delete any analysis
values it holds.
Now that you've created myWaveform and have a pulse
stored in it, what can you do with it. First off, you can query the
object for the pulse back:
myWaveform.getPulse(); - returns double[]
myWaveform.getShortPulse(); - returns short[]
myWaveform.getBytePulse(); - returns byte[]
Any of the three above methods could be used to get the pulse that is
currently stored in the myWaveform object. Be aware!! Since the
pulse is strored in an array of doubles, there may be problems casting those
doubles to shorts or bytes. Make sure that your data does not exceed
the short or byte limits when using those methods, as your pulse will return
with wrapping.
There are also some convenience classes that allow you
to manipulate the pulse inside a waveform:
myWaveform.subtract( someWaveform ); - subtracts someWaveform from myWaveform's
pulse
myWaveform.add( someWaveform ); - adds someWaveform to myWaveform's pulse
myWaveform.scale( scaler ); - multiplies each tick in myWaveform's pulse
by the given scaler ( a double )
Keep in mind, that after calling these methods, further calls to any get
methods ( ie. getMaxVoltage() or getBaseline(). see below for details
) will return different results. Another convenience method simply
returns the number of ticks in the stored pulse:
myWaveform.length();
Results from get methods will not be changed by calling this method.
Various analysis algorithms can be carried out on
pulses that are entered into myWaveform. The following values about
the pulses entered into Waveform objects can be returned:
maximum voltage - using getMaxVoltage() or getMaxVoltage(
int algorithm )
error on the maximum voltage - using getMaxVoltageError()
or getMaxVoltageError( int algorithm )
baseline - using getBaseline() or getBaseline( int algorithm
)
error on the baseline - using getBaselineError() or
getBaselineError( int algorithm ) ( more information on
the int algorithm located on the algorithm
information page, accessible from the main page ).
pedestal RMS - using getPedestalRMS()
error on the pedestal RMS - using getPedestalRMSError()
Each of the above methods will return a double corresponding to the queried
value. See the main page for more information about how these values
are calculated and about the integer sent as an arguement to some of the
methods.
Finally, the Waveform class is capable of finding
peaks that appear on the inputted pulse. These peaks are then stored
in seperate instances of a Peak class. The only way to create
a Peak object is through a Waveform object. This is done by calling:
myWaveform.getPeaks();
This method will return a Vector ( see package java.util ) that contains
Peak objects corresponding to the pulse entered into the myWaveform object.
This method does throw a NoPeakException if no Peaks are found. Once
a program has this vector, the Peak objects can be accesssed and worked
with. More information about working with the Peak class can be obtained
from the Waveform Analysis Package front page.