spv.spectrum
Interface Spectrum

All Superinterfaces:
java.lang.Cloneable, java.util.Observer
All Known Subinterfaces:
SEDSpectrum
All Known Implementing Classes:
AbstractSpectrum, ComparisonSpectrum, CompositeSpectrum, EchelleSpectrum, FittedSpectrum, MultiSegmentSpectrum, PhotometrySpectrum, PlottableEchelleSpectrum, PlottableFittedSpectrum, PlottableMultiStyleSpectrum, PlottablePhotometrySpectrum, PlottableRangeSpectrum, PlottableRectifiedSpectrum, PlottableSEDFittedSpectrum, PlottableSEDSegmentedSpectrum, PlottableSegmentedSpectrum, PlottableSpectrum, RangeSpectrum, RectifiedSpectrum, SEDFittedSpectrum, SEDMultiSegmentSpectrum, SingleSpectrum, SpectrumDecorator

public interface Spectrum
extends java.util.Observer, java.lang.Cloneable


Field Summary
static java.lang.String REST_SUFFIX
           
 
Method Summary
 void addMetaParameter(java.lang.String utype, MetaParameter parameter)
          Adds a meta parameter.
 void addMetaParameter(java.lang.String utype, java.lang.String value)
          Adds a meta parameter.
 void addMetaParameter(java.lang.String utype, java.lang.String value, java.lang.String units)
          Adds a meta parameter.
 void addObserver(java.util.Observer ob)
          Adds and observer to an observable.
 void addRadialVelocity(RadialVelocity rv)
          Add a radial velocity object.
 void addSpectrum(java.lang.Object spid, Spectrum sp)
          Adds a Spectrum instance to this object.
 java.lang.Object clone()
          Creates a clone copy of this object.
 void deleteObserver(java.util.Observer ob)
          Deletes an observer from an observable.
 void enableNotifications(boolean notify)
          Enables/disables notifications to listeners.
 java.util.List explodeSpectrum()
          Returns a list with all internal Spectrum instances in this.
 DQBits[] getArrayDQBits()
          Returns the list of supported DQ bits in each element of the composite.
 int[] getArrayDQMask()
          Gets the current DQ mask value in each element of the composite.
 double getAverageDispersion()
          Returns the average dispersion.
 double getAverageValue()
          Gets the average value obtained in the last integration operation.
 Spectrum getChild()
          Gets the child spectrum.
 int[] getDQ()
          Returns an array with all DQ flags stored in the currently selected array.
 DQBits getDQBits()
          Returns the list of supported DQ bits in this object.
 java.util.Enumeration getDQList()
          Returns an Enumeration with the String objects that identify the data quality arrays stored in this object.
 int getDQMask()
          Gets the current DQ mask value.
 double[] getErrors()
          Returns an array with all errors stored in the currently selected array.
 double getExtremumPosition()
          Gets the extremum position obtained in the last integration operation.
 double getFluxWeightedPosition()
          Gets the flux weighted position obtained in the last integration operation.
 double getFluxWeightedPositionError()
          Gets the error associated with the flux weighted position obtained in the last integration operation.
 SpectrumHeader getHeader()
          Returns the SpectrumHeader associated with this spectrum.
 double getIntegralError()
          Gets the error of the integral obtained in the last integration operation.
 int getIntegrationBins()
          Gets the number of bins used in the last integration operation.
 java.util.Enumeration getIntensityList()
          Returns an Enumeration with the String objects that identify the intensity arrays stored in this object.
 double getMaxWavelength()
          Returns the maximum wavelength.
 java.util.Map getMetaParameters()
          Gets the meta parameters.
 double getMinWavelength()
          Returns the minimum wavelength.
 java.lang.String getName()
          Returns the spectrum's name.
 int getNBins()
          Returns the total number of bins in this spectrum.
 DataTableModel getNewTableModel()
          Returns a new table model that represents the spectrum contents.
 int getNumberOfSpectra()
          Returns the number of spectra (leaves) in the composite.
 Units getOriginalUnits()
          Returns the original Units associated with the selected intensity array in this spectrum.
 Units getOriginalWavelengthUnits()
          Returns the original Units associated with the wavelength array in this spectrum.
 java.util.List getRadialVelocities()
          Gets a list of all available radial velocity objects.
 double[] getRestWavelengths()
          Returns an array with rest wavelength values.
 java.lang.String getSelectedDQID()
          Gets the current DQ array ID.
 java.lang.String getSelectedIntensityID()
          Gets the current intensity array ID.
 RadialVelocity getSelectedRadialVelocity()
          Gets the currently selected radial velocity object.
 double getSigma()
          Gets the standard deviation obtained in the last integration operation.
 Spectrum getSpectrum(java.lang.Object spid)
          Returns the specified Spectrum object.
 java.util.Enumeration getSpectrumList()
          Returns an Enumeration with the id objetcs of the Spectrum instances stored in this object.
 java.util.List getSpectrumListAsList()
          Returns a List with the id objetcs of the Spectrum instances stored in this object.
 DataTableModel getTableModel()
          Returns a table model that represents the spectrum contents.
 java.lang.String getTag()
          Returns the tag associated with this spectrum.
 java.lang.String getTargetName()
          Returns the target name.
 Units getUnits()
          Returns the Units associated with the selected intensity array in this spectrum.
 double[] getValues()
          Returns an array with all values stored in the currently selected array.
 java.lang.String getWavelengthID()
          Gets the wavelength ID.
 double[] getWavelengths()
          Returns an array with all raw wavelength values stored in this spectrum.
 Units getWavelengthUnits()
          Returns the Units associated with the wavelength array in this spectrum.
 double getX(double wavelength)
          Returns the (fractional) bin number corresponding to the wavelength.
 void initializeParametersFromMap(java.util.Map map)
          Initializes spectrum parameters from map.
 double integrate(double w1, double w2)
          Integrate the selected array between given wavelengths.
 boolean isEquallySpaced()
          Is the wavelength array equally spaced ?
 boolean isEvenlySampled()
          Is the wavelength array evenly sampled ?
 boolean isMultiSegment()
          Is spectrum multi-segment?
 boolean isNormalizable()
          Checks if the spectrum instance is bormalizable.
 boolean isRestWavelengths()
          Gets the rest wavelengths flag.
 boolean isSpectrogram()
          Is spectrum a spectrogram?
 void maskAll()
          Sets all DQ masks.
 void normalize(double wave, double flux, Units ounits)
          Normalize the selected flux array to the given value.
 void process(Command command)
          Executes a process encapsulated inside a Command object.
 void removeMetaParameter(java.lang.String utype)
          Removes a meta parameter.
 void removeRadialVelocity(RadialVelocity rv)
          Remove a radial velocity object.
 void removeSpectrum(java.lang.Object spid)
          Removes a Spectrum instance from this object.
 void renormalize(double wave, double flux, java.lang.Object spid)
          Renormalize the selected flux array to the new (wave,flux) point.
 void reorderWavelengths()
          If wavelength array is arranged in decreasing wavelength order, reorder it and all other arrays in increasing wavelength order.
 void resetArraySelection()
          Resets array selection.
 void saveAsSED(java.lang.String filename)
          Saves spectrum as a SED document.
 void saveSpectrumParameters(com.sun.xml.tree.XmlDocument document, com.sun.xml.tree.ElementNode parent)
          Saves spectrum parameters in a XML file.
 void selectDQ(java.lang.String arrayid)
          Selects DQ array.
 void selectIntensity(java.lang.String arrayid)
          Selects intensity array.
 void selectRadialVelocity(RadialVelocity rv)
          Selects a radial velocity object.
 void setChild(Spectrum child)
          Sets a reference to a child spectrum, that is, a different instance of Spectrum that was derived from this instance.
 void setDQBits(DQBits dqbits)
          Stores a copy of the DQBits/code> object.
 void setDQMask(int mask)
          Sets the DQ mask value used in subsequent data retrieval operations.
 void setDQMasks(int[] masks)
          Sets the DQ masks into each element of the composite.
 void setHeader(SpectrumHeader header)
          Stores a copy of the SpectrumHeader object.
 void setMultiSegment(boolean multi_segment)
          Sets the multi-segment flag.
 void setName(java.lang.String name)
          Sets the spectrum's name.
 void setNormalizable(boolean normalizable)
          Sets the normalizable state of the spectrum.
 void setRestWavelengthsFlag(boolean flag)
          Sets a flag that tells that rest wavelengths are to be gotten from this spectrum.
 void setSpectrogram(boolean spectrogram)
          Sets the spectrogram mode.
 void setTargetName(java.lang.String targetName)
          Sets the target name.
 void setUnits(Units units)
          Stores physical units in the currently selected intensity array.
 void setWavelengthID(java.lang.String waveid)
          Sets the wavelength ID.
 void setWavelengths(double[] wavelengths)
          Sets a new wavelength array.
 void setWavelengthUnits(Units units)
          Stores wavelength current physical units.
 boolean supportsRadialVelocity()
          Returns true for spectral data that can be represented in a rest wavelength frame.
 
Methods inherited from interface java.util.Observer
update
 

Field Detail

REST_SUFFIX

static final java.lang.String REST_SUFFIX
See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Returns the spectrum's name.

Returns:
the spectrum's name

getTag

java.lang.String getTag()
Returns the tag associated with this spectrum.

A tag is an auxiliary string used for internal identification purposes.

Returns:
the tag

isSpectrogram

boolean isSpectrogram()
Is spectrum a spectrogram?

Returns:
true if spectrum is a spectrogram

setSpectrogram

void setSpectrogram(boolean spectrogram)
Sets the spectrogram mode.

Parameters:
spectrogram - the spectrogram mode

getTargetName

java.lang.String getTargetName()
Returns the target name.

Returns:
the target name

setTargetName

void setTargetName(java.lang.String targetName)
Sets the target name.

Parameters:
targetName - the target name

getHeader

SpectrumHeader getHeader()
Returns the SpectrumHeader associated with this spectrum.

Returns:
a reference to the header stored in this object

getDQBits

DQBits getDQBits()
Returns the list of supported DQ bits in this object.

Returns:
list of supported DQ bits in this object

getArrayDQBits

DQBits[] getArrayDQBits()
Returns the list of supported DQ bits in each element of the composite.

Returns:
list of supported DQ bits in each element of the composite

getDQMask

int getDQMask()
Gets the current DQ mask value.

Returns:
the current DQ mask value

getArrayDQMask

int[] getArrayDQMask()
Gets the current DQ mask value in each element of the composite.

Returns:
the current DQ mask value in each element of the composite

getNBins

int getNBins()
Returns the total number of bins in this spectrum.

Returns:
the total number of bins stored in this object

getSelectedRadialVelocity

RadialVelocity getSelectedRadialVelocity()
Gets the currently selected radial velocity object.

Returns:
the currently selected radial velocity object

getRadialVelocities

java.util.List getRadialVelocities()
Gets a list of all available radial velocity objects.

Returns:
a list of all available radial velocity objects

selectRadialVelocity

void selectRadialVelocity(RadialVelocity rv)
Selects a radial velocity object.

Parameters:
rv - the radial velocity to be selected

getTableModel

DataTableModel getTableModel()
Returns a table model that represents the spectrum contents.

Returns:
a table model that represents the spectrum contents

getNewTableModel

DataTableModel getNewTableModel()
Returns a new table model that represents the spectrum contents.

This method should be used when changes in the internal spectrum contents took place.

Returns:
a table model that represents the spectrum contents

integrate

double integrate(double w1,
                 double w2)
Integrate the selected array between given wavelengths.

Parameters:
w1 - wavelength limit for integration, in standard units
w2 - wavelength limit for integration, in standard units
Returns:
the integral of the elected array between w1 and w2

normalize

void normalize(double wave,
               double flux,
               Units ounits)
Normalize the selected flux array to the given value.

Parameters:
wave - the wavelength were to normalize
flux - the resulting flux density at that wavelength
ounits - the original units to be associated with the new flux, or null if none.

renormalize

void renormalize(double wave,
                 double flux,
                 java.lang.Object spid)
Renormalize the selected flux array to the new (wave,flux) point.

Parameters:
wave - the reference wavelength
flux - the new flux at the reference wavelength
spid - the spectrum identification object. If non-null, the method should act on the specified element only.

getIntegralError

double getIntegralError()
Gets the error of the integral obtained in the last integration operation.

Returns:
the error of the integral obtained in the last integration operation

getAverageValue

double getAverageValue()
Gets the average value obtained in the last integration operation.

Returns:
the average value obtained in the last integration operation

getSigma

double getSigma()
Gets the standard deviation obtained in the last integration operation.

Returns:
the standard deviation obtained in the last integration operation

getFluxWeightedPosition

double getFluxWeightedPosition()
Gets the flux weighted position obtained in the last integration operation.

Returns:
the flux weighted position obtained in the last integration operation

getFluxWeightedPositionError

double getFluxWeightedPositionError()
Gets the error associated with the flux weighted position obtained in the last integration operation.

Returns:
the error associated with the flux weighted position

getExtremumPosition

double getExtremumPosition()
Gets the extremum position obtained in the last integration operation.

Returns:
the extremum position obtained in the last integration operation

getIntegrationBins

int getIntegrationBins()
Gets the number of bins used in the last integration operation.

Returns:
the number of bins used in the last integration operation

getIntensityList

java.util.Enumeration getIntensityList()
Returns an Enumeration with the String objects that identify the intensity arrays stored in this object.

Returns:
the list with String instances

getDQList

java.util.Enumeration getDQList()
Returns an Enumeration with the String objects that identify the data quality arrays stored in this object.

Returns:
the list with String instances

getUnits

Units getUnits()
Returns the Units associated with the selected intensity array in this spectrum.

Returns:
a reference to a Units instance

getWavelengthUnits

Units getWavelengthUnits()
Returns the Units associated with the wavelength array in this spectrum.

Returns:
a reference to a Units instance

getOriginalUnits

Units getOriginalUnits()
Returns the original Units associated with the selected intensity array in this spectrum.

Returns:
a reference to a Units instance

getOriginalWavelengthUnits

Units getOriginalWavelengthUnits()
Returns the original Units associated with the wavelength array in this spectrum.

Returns:
a reference to a Units instance

getSpectrumList

java.util.Enumeration getSpectrumList()
Returns an Enumeration with the id objetcs of the Spectrum instances stored in this object.

Returns:
the list with Spectrum instances

getSpectrumListAsList

java.util.List getSpectrumListAsList()
Returns a List with the id objetcs of the Spectrum instances stored in this object.

This method was introduced for efficiency purposes.

Returns:
the list with Spectrum instances

getNumberOfSpectra

int getNumberOfSpectra()
Returns the number of spectra (leaves) in the composite.

Returns:
the number of spectra in the composite

explodeSpectrum

java.util.List explodeSpectrum()
Returns a list with all internal Spectrum instances in this.

Returns:
a list with all internal Spectrum instances in this

getSpectrum

Spectrum getSpectrum(java.lang.Object spid)
Returns the specified Spectrum object.

Parameters:
spid - the spectrum identification object
Returns:
the Spectrum instance

getWavelengths

double[] getWavelengths()
Returns an array with all raw wavelength values stored in this spectrum.

Returns:
the reference to the array with wavelength values.

getRestWavelengths

double[] getRestWavelengths()
Returns an array with rest wavelength values.

Returns:
an array with rest wavelength values.

setRestWavelengthsFlag

void setRestWavelengthsFlag(boolean flag)
Sets a flag that tells that rest wavelengths are to be gotten from this spectrum.

Parameters:
flag - a flag that tells that rest wavelengths are to be gotten from this spectrum

isRestWavelengths

boolean isRestWavelengths()
Gets the rest wavelengths flag.

Returns:
the rest wavelength flag

isNormalizable

boolean isNormalizable()
Checks if the spectrum instance is bormalizable.

Returns:
returns true if the spectrum is normalizable

setNormalizable

void setNormalizable(boolean normalizable)
Sets the normalizable state of the spectrum.

Parameters:
normalizable - the normalizable state of the spectrum

getX

double getX(double wavelength)
Returns the (fractional) bin number corresponding to the wavelength.

Note that the concept only applies if the wavelengths are monotonically sorted. If not, this method may deliver bogus results.

Returns:
the (fractional) bin number corresponding to the wavelength

getMinWavelength

double getMinWavelength()
Returns the minimum wavelength.

Returns:
the minimum wavelength.

getMaxWavelength

double getMaxWavelength()
Returns the maximum wavelength.

Returns:
the maximum wavelength.

getAverageDispersion

double getAverageDispersion()
Returns the average dispersion.

Returns:
the average dispersion

getValues

double[] getValues()
Returns an array with all values stored in the currently selected array.

Returns:
the reference to the array with wavelength values.

getErrors

double[] getErrors()
Returns an array with all errors stored in the currently selected array.

Returns:
the reference to the array with errors values.

getDQ

int[] getDQ()
Returns an array with all DQ flags stored in the currently selected array.

Returns:
the reference to the array with DQ values.

isMultiSegment

boolean isMultiSegment()
Is spectrum multi-segment?

This flag does *NOT* overlap with spectrum types that have internal structure. It is designed to tell to external software (such as a graphics library) taht the spectrum must be depicted explictly with a multi-segment glyph.

Returns:
true if the spectrum must be depicted has a multi-segment entity.

setMultiSegment

void setMultiSegment(boolean multi_segment)
Sets the multi-segment flag.

Parameters:
multi_segment - the multi-segment flag

isEvenlySampled

boolean isEvenlySampled()
Is the wavelength array evenly sampled ?

Returns:
true if the wavelength array returned by this object is more or less evenly sampled.

isEquallySpaced

boolean isEquallySpaced()
Is the wavelength array equally spaced ?

Returns:
true if the wavelength array returned by this object is sampled with a uniform step.

getWavelengthID

java.lang.String getWavelengthID()
Gets the wavelength ID.

Returns:
the wavelength ID

setWavelengthID

void setWavelengthID(java.lang.String waveid)
Sets the wavelength ID.

Parameters:
waveid - the wavelength ID

setWavelengths

void setWavelengths(double[] wavelengths)
                    throws SpectrumException
Sets a new wavelength array.

This method causes the entire spectrum to be resanpled at the new wavelength values.

Parameters:
wavelengths - the new wavelength array
Throws:
SpectrumException - if the provided array is not compatible with the existing wavelength array

setName

void setName(java.lang.String name)
Sets the spectrum's name.

Parameters:
name - the spectrum's name

setHeader

void setHeader(SpectrumHeader header)
Stores a copy of the SpectrumHeader object.

Parameters:
header - the object to be stored

setDQBits

void setDQBits(DQBits dqbits)
Stores a copy of the DQBits/code> object.

Parameters:
dqbits - the object to be stored

setDQMask

void setDQMask(int mask)
Sets the DQ mask value used in subsequent data retrieval operations.

Parameters:
mask - the DQ mask value

setDQMasks

void setDQMasks(int[] masks)
Sets the DQ masks into each element of the composite.

Parameters:
masks - array with the DQ masks

maskAll

void maskAll()
Sets all DQ masks.


getSelectedIntensityID

java.lang.String getSelectedIntensityID()
Gets the current intensity array ID.

Returns:
the current intensity array ID

getSelectedDQID

java.lang.String getSelectedDQID()
Gets the current DQ array ID.

Returns:
the current intensity array ID

selectIntensity

void selectIntensity(java.lang.String arrayid)
Selects intensity array. Once an array is selected, all array-dependent methods act on the selected array only.

Parameters:
arrayid - the array identification

selectDQ

void selectDQ(java.lang.String arrayid)
Selects DQ array. Once an array is selected, all array-dependent methods act on the selected array only.

Parameters:
arrayid - the array identification

resetArraySelection

void resetArraySelection()
Resets array selection.


setUnits

void setUnits(Units units)
Stores physical units in the currently selected intensity array.

Parameters:
units - the physical units to be stored as current

setWavelengthUnits

void setWavelengthUnits(Units units)
Stores wavelength current physical units.

Parameters:
units - the physical units to be stored as current

enableNotifications

void enableNotifications(boolean notify)
Enables/disables notifications to listeners.

Parameters:
notify - true if notifications are to be enabled, false otherwise.

process

void process(Command command)
Executes a process encapsulated inside a Command object.

Parameters:
command - the command object that encapsulates the processor algorithm

reorderWavelengths

void reorderWavelengths()
If wavelength array is arranged in decreasing wavelength order, reorder it and all other arrays in increasing wavelength order.


addRadialVelocity

void addRadialVelocity(RadialVelocity rv)
Add a radial velocity object.

Parameters:
rv - a radial velocity object

removeRadialVelocity

void removeRadialVelocity(RadialVelocity rv)
Remove a radial velocity object.

Parameters:
rv - a radial velocity object

initializeParametersFromMap

void initializeParametersFromMap(java.util.Map map)
Initializes spectrum parameters from map.

Parameters:
map - the map

saveSpectrumParameters

void saveSpectrumParameters(com.sun.xml.tree.XmlDocument document,
                            com.sun.xml.tree.ElementNode parent)
Saves spectrum parameters in a XML file.

Parameters:
document - the DOM document
parent - the parent node

saveAsSED

void saveAsSED(java.lang.String filename)
Saves spectrum as a SED document.

Parameters:
filename - the SED file name

getMetaParameters

java.util.Map getMetaParameters()
Gets the meta parameters.

Returns:
a map with the meta parameters

addMetaParameter

void addMetaParameter(java.lang.String utype,
                      java.lang.String value)
Adds a meta parameter.

Parameters:
utype - the utype
value - the value

addMetaParameter

void addMetaParameter(java.lang.String utype,
                      java.lang.String value,
                      java.lang.String units)
Adds a meta parameter.

Parameters:
utype - the utype
value - the value
units - the units

addMetaParameter

void addMetaParameter(java.lang.String utype,
                      MetaParameter parameter)
Adds a meta parameter.

Parameters:
utype - the utype
parameter - the parameter

removeMetaParameter

void removeMetaParameter(java.lang.String utype)
Removes a meta parameter.

Parameters:
utype - the utype

supportsRadialVelocity

boolean supportsRadialVelocity()
Returns true for spectral data that can be represented in a rest wavelength frame.

Returns:
true for spectral data that can be represented in a rest wavelength frame

setChild

void setChild(Spectrum child)
Sets a reference to a child spectrum, that is, a different instance of Spectrum that was derived from this instance.

Parameters:
child - the child spectrum

getChild

Spectrum getChild()
Gets the child spectrum.

Returns:
the child spectrum

addSpectrum

void addSpectrum(java.lang.Object spid,
                 Spectrum sp)
Adds a Spectrum instance to this object.

Parameters:
spid - the identification
sp - the Spectrum instance to be added

removeSpectrum

void removeSpectrum(java.lang.Object spid)
Removes a Spectrum instance from this object.

Parameters:
spid - the identification

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a clone copy of this object.

Throws:
java.lang.CloneNotSupportedException

addObserver

void addObserver(java.util.Observer ob)
Adds and observer to an observable.


deleteObserver

void deleteObserver(java.util.Observer ob)
Deletes an observer from an observable.