gov.nist.microanalysis.EPQLibrary
Class SpectrumMath

java.lang.Object
  extended by gov.nist.microanalysis.EPQLibrary.BaseSpectrum
      extended by gov.nist.microanalysis.EPQLibrary.DerivedSpectrum
          extended by gov.nist.microanalysis.EPQLibrary.SpectrumMath
All Implemented Interfaces:
ISpectrumData, java.lang.Comparable

public class SpectrumMath
extends DerivedSpectrum

SpectrumMath makes it easy to add or subtract a multiple of the counts in one spectrum from another spectrum. Good for creating sum spectra or residual spectra.

Copyright: Pursuant to title 17 Section 105 of the United States Code this software is not subject to copyright protection and is in the public domain

Institution: National Institute of Standards and Technology

Version:
1.0
Author:
nritchie

Field Summary
 
Fields inherited from class gov.nist.microanalysis.EPQLibrary.DerivedSpectrum
mSource
 
Fields inherited from class gov.nist.microanalysis.EPQLibrary.BaseSpectrum
mHashCode, NULL_HASH, NullSpectrum
 
Constructor Summary
SpectrumMath(ISpectrumData src)
          Constructs a SpectrumMath
 
Method Summary
 void add(ISpectrumData src, double k)
          add - Add k times counts in the specified spectrum into the sum spectrum.
 double getCounts(int i)
          getCounts - Return the counts in the i-th channel
 void subtract(ISpectrumData src, double k)
          add - Subtract k times the counts from the specified spectrum from the sum spectrum.
 
Methods inherited from class gov.nist.microanalysis.EPQLibrary.DerivedSpectrum
equals, getBaseSpectrum, getChannelCount, getChannelWidth, getProperties, getZeroOffset, isAlreadyDerivedFrom, isDerivedFrom
 
Methods inherited from class gov.nist.microanalysis.EPQLibrary.BaseSpectrum
compareTo, hashCode, initializeSpectrumIndex, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SpectrumMath

public SpectrumMath(ISpectrumData src)
Constructs a SpectrumMath

Parameters:
src -
Method Detail

add

public void add(ISpectrumData src,
                double k)
add - Add k times counts in the specified spectrum into the sum spectrum.

Parameters:
src - ISpectrumData
k - double

subtract

public void subtract(ISpectrumData src,
                     double k)
add - Subtract k times the counts from the specified spectrum from the sum spectrum.

Parameters:
src - ISpectrumData
k -

getCounts

public double getCounts(int i)
Description copied from interface: ISpectrumData
getCounts - Return the counts in the i-th channel

Returns:
double