|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgov.nist.microanalysis.EPQLibrary.SpectrumUtils
public final class SpectrumUtils
A set of utilities for handling common ISpectrumData related operations.
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
Company: National Institute of Standards and Technology
| Field Summary | |
|---|---|
static double |
E_MnKa
E_MnKa - The energy of the Mn Ka line in eV. |
| Constructor Summary | |
|---|---|
SpectrumUtils()
|
|
| Method Summary | |
|---|---|
static EditableSpectrum |
addNoiseToSpectrum(ISpectrumData src,
double k)
Creates a new spectrum from the specified source spectrum by adding Poissonian simulated counting statistic noise. |
static boolean |
areCompatible(ISpectrumData sd1,
ISpectrumData sd2)
areCompatible - Are the channel count, channel width and zero offset on these two spectra equal? |
static double |
avgCounts(ISpectrumData sd)
avgCounts - Returns the average number of counts over all channels |
static double |
avgEnergyForChannel(ISpectrumData sd,
int ch)
|
static int |
bound(ISpectrumData sd,
int ch)
bound - Returns ch bounded so that it exists on the interval 0 to sd.getChannelCount()-1. |
static int |
channelForEnergy(ISpectrumData sd,
double e)
channelForEnergy - Returns the index of the channel which contains the specified channel. |
static double |
dotProduct(ISpectrumData spec1,
ISpectrumData spec2)
dotProduct - Returns the dot product of the channels of each specified spectrum. |
static double |
DuaneHuntLimit(ISpectrumData spec)
DuaneHuntLimit - Returns an estimate of the Duane-Hunt limit in eV. |
static double[] |
energyArray(ISpectrumData sd)
energyArray - Creates an array of doubles representing the energy axis. |
static double |
energyToWavelength(double energy)
energyToWavelength - Converts energy to wavelength |
static double |
fwhmToGaussianWidth(double fwhm)
fwhmToGaussianWidth - Converts between full width-half maximum and Gaussian width. |
static double |
gaussian(double dE,
double sigma)
gaussian - Computes the Gaussian function. |
static double |
getBeamEnergy(ISpectrumData sd)
getBeamEnergy - Returns the nominal beam energy for the specified spectrum. |
static double |
getFWHMAtMnKA(ISpectrumData src,
double def)
getFWHMAtMnKA - Extracts the FWHM at MnKa from the SpectrumProperties associated with the source ISpectrumData. |
static double |
integrate(ISpectrumData sd,
double minE,
double maxE)
Integrate the counts between minE and maxE taking into account the partial channels when minE and maxE don't exactly match channel boundaries. |
static double |
linewidth_eV(double e,
double fwhmAtE0,
double e0)
linewidth_eV - The line width measured by a SiLi detector depends upon the energy of the line. |
static double |
linewidth(double e,
double fwhmAtE0,
double e0)
linewidth - The line width measured by a SiLi detector depends upon the energy of the line. |
static int |
maxChannel(ISpectrumData sd)
maxChannel - Returns the highest channel that has the maximum count value. |
static double |
maxEnergyForChannel(ISpectrumData sd,
int ch)
|
static int |
minChannel(ISpectrumData sd)
minChannel - Returns the highest channel that has the minimum count value. |
static double |
minEnergyForChannel(ISpectrumData sd,
int ch)
energyForChannel - Compute the energy of the specified channel. |
static ISpectrumData[] |
partition(ISpectrumData src,
int nParts)
Randomly subdivides the src spectrum into nParts different spectra. |
static java.lang.String |
spectrumDataToText(ISpectrumData sd,
double eLow,
double eHigh,
boolean withEnergies)
spectrumDataToText - Convert the spectral data in the specified energy range into a String desscribing the raw channel data. |
static java.lang.String |
spectrumPropertiesToText(SpectrumProperties sp)
spectrumPropertiesToText - Converts a SpectrumProperties object into a String containing a property per line. |
static EditableSpectrum |
subSampleSpectrum(ISpectrumData sd,
double liveTime)
Create a new ISpectrumData object containing a spectrum derived from the specified spectrum. |
static double |
sumCounts(ISpectrumData sd,
int minCh,
int maxCh)
sumCounts - Returns the number of counts in the channels in the range [minCh, maxCh) |
static java.awt.Color |
toColor(ISpectrumData spec)
toColor - Converts a spectrum to a color in a manner that is inspired by the way our eyes convert multiple wavelengths into three signals. |
static double[] |
toDoubleArray(ISpectrumData spec)
toDoubleArray - Returns the spectrum channel data as an array of doubles. |
static java.awt.image.BufferedImage |
toImage(ISpectrumData spec,
int height)
toImage - Displays the spectrum as a grey-scale bitmap. |
static int[] |
toIntArray(ISpectrumData spec)
toIntArray - Returns the spectrum channel data as an array of int. |
static double |
totalCounts(ISpectrumData sd)
totalCounts - Returns the number of counts in all channels |
static void |
verifyCompatibility(ISpectrumData sd1,
ISpectrumData sd2)
verifyCompatibility - Verifys that two spectra are compatible. |
static double |
wavelengthToEnergy(double wavelength)
wavelengthToEnergy - Converts wavelength to energy |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double E_MnKa
| Constructor Detail |
|---|
public SpectrumUtils()
| Method Detail |
|---|
public static boolean areCompatible(ISpectrumData sd1,
ISpectrumData sd2)
sd1 - ISpectrumDatasd2 - ISpectrumData
public static void verifyCompatibility(ISpectrumData sd1,
ISpectrumData sd2)
throws EPQException
sd1 - ISpectrumDatasd2 - ISpectrumData
EPQException
public static int channelForEnergy(ISpectrumData sd,
double e)
sd - ISpectrumDatae - double - the energy in eV
public static double minEnergyForChannel(ISpectrumData sd,
int ch)
sd - ISpectrumDatach - int - the channel index
public static double avgEnergyForChannel(ISpectrumData sd,
int ch)
public static double maxEnergyForChannel(ISpectrumData sd,
int ch)
public static int bound(ISpectrumData sd,
int ch)
sd - ISpectrumDatach - int
public static double linewidth(double e,
double fwhmAtE0,
double e0)
e - double - In JoulesfwhmAtE0 - double - In Joulese0 - double - In Joules
public static double linewidth_eV(double e,
double fwhmAtE0,
double e0)
e - double - In eVfwhmAtE0 - double - In eVe0 - double - In eV
public static double fwhmToGaussianWidth(double fwhm)
fwhm - double
public static double gaussian(double dE,
double sigma)
dE - double -sigma - double - Gaussian width
public static int maxChannel(ISpectrumData sd)
sd - ISpectrumData
public static int minChannel(ISpectrumData sd)
sd - ISpectrumData
public static double sumCounts(ISpectrumData sd,
int minCh,
int maxCh)
sd - ISpectrumDataminCh - intmaxCh - int
public static double integrate(ISpectrumData sd,
double minE,
double maxE)
sd - minE - maxE -
public static double totalCounts(ISpectrumData sd)
sd - ISpectrumData
public static double avgCounts(ISpectrumData sd)
sd - ISpectrumData
public static double getBeamEnergy(ISpectrumData sd)
sd - ISpectrumData
public static double getFWHMAtMnKA(ISpectrumData src,
double def)
src - ISpectrumDatadef - double - The default value (in eV)
public static double dotProduct(ISpectrumData spec1,
ISpectrumData spec2)
spec1 - ISpectrumDataspec2 - ISpectrumData
public static double[] toDoubleArray(ISpectrumData spec)
spec -
public static int[] toIntArray(ISpectrumData spec)
spec -
public static double[] energyArray(ISpectrumData sd)
sd - A spectrum
public static java.awt.Color toColor(ISpectrumData spec)
spec -
public static java.awt.image.BufferedImage toImage(ISpectrumData spec,
int height)
spec - height -
public static double energyToWavelength(double energy)
energy - Joules
public static double wavelengthToEnergy(double wavelength)
wavelength - - Meters
public static java.lang.String spectrumDataToText(ISpectrumData sd,
double eLow,
double eHigh,
boolean withEnergies)
sd - - The spectrum dataeLow - - In eVeHigh - - In eVwithEnergies - - Should the string contain the energy for each bin
public static java.lang.String spectrumPropertiesToText(SpectrumProperties sp)
sp - The SpectrumProperties object
public static double DuaneHuntLimit(ISpectrumData spec)
spec -
public static EditableSpectrum subSampleSpectrum(ISpectrumData sd,
double liveTime)
throws EPQException
Create a new ISpectrumData object containing a spectrum derived from the specified spectrum. The specified spectrum must have the SpectrumProperties.LiveTime property defined and the argument liveTime must be less than or equal to the numeric value in SpectrumProperties.LiveTime
The strategy used by this method is not particularly CPU efficient but seems to be strictly statistically rigorous. Randomly assign a time to each x-ray event. If the time is less than liveTime then accept the event; otherwise reject it. This mechanims scales perfectly from infinitesimal acquisition times all the way to the full source spectrum live time.
sd - liveTime -
EPQException - If SpectrumProperties.LiveTime not defined or if
liveTime too large.
public static EditableSpectrum addNoiseToSpectrum(ISpectrumData src,
double k)
src - The source spectrumk - A multipler used to linearly rescale the source spectrum data
public static ISpectrumData[] partition(ISpectrumData src,
int nParts)
Randomly subdivides the src spectrum into nParts different spectra. The counts in src are randomly assigned to the resulting spectra. This method is interesting because the resulting spectra are similar in character to the src spectrum at 1.0/nParts of the acquisition live time.
Consider if you partition a spectrum into 4 parts. If each of these parts remains in the same class as the source spectrum then the source spectrum is likely to be firmly within the class. However if one or more of the subdivided spectra are not in same class then it is likely the final spectrum is close to the edge of the class.
src - The source spectrumnParts - The number of spectra into which to subdivide the source
spectrum
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||