public abstract class AbstractWavelength1D extends AbstractScienceObjectNode implements Wavelength1DModel
This code was originally developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project for Next Generation Space Telescope (NGST).
AbstractScienceObject.EventMonitor
Modifier and Type | Field and Description |
---|---|
protected String |
fFluxUnits |
static String |
MAXWAVELENGTH_PROPERTY |
static String |
MINWAVELENGTH_PROPERTY |
static String |
NUMPOINTS_PROPERTY |
cloneIndent
DATA_SOURCE_PROPERTY, MORE_DATA_PROPERTY
NAME_PROPERTY, PENDING_PROPERTY, VALID_PROPERTY
Constructor and Description |
---|
AbstractWavelength1D() |
AbstractWavelength1D(String name) |
Modifier and Type | Method and Description |
---|---|
protected double |
calcArea(double xl,
double xr,
double yl,
double yr,
boolean interpolate)
Calculates the area under a curve of rectangle define by lower left and upper right
coordinates.
|
protected double |
calculateArea(double[] wlArray,
double[] dataArray,
Wavelength minWl,
Wavelength maxWl,
boolean interpolate) |
double |
getArea()
Calls getArea(true);
|
double |
getArea(boolean interpolate)
Returns the area "under the curve" of the model from the specified
minimum to maximum wavelengths.
|
double |
getArea(Wavelength minWl,
Wavelength maxWl)
use getArea( minwavelength, maxwavelength, interpolate) instead
|
double |
getArea(Wavelength minWl,
Wavelength maxWl,
boolean interpolate)
Returns the area "under the curve" of the model from the specified
minimum to maximum wavelengths.
|
String |
getFluxUnits()
returns the units string for the data values in the model.
|
protected int |
getIndexOf(double wl,
double[] wlArray)
Looks up the index of a specified wavelength in the dataset to have a
wavelength greater/equal to specified wavelength.
|
protected int |
getIndexOf(double targetWl,
double[] wlArray,
boolean exactOnly)
Looks up the index of a specified wavelength in the dataset to have a wavelength greater/equal to
specified wavelength (as a double).
|
protected int |
getIndexOf(Wavelength wl,
double[] wlArray)
Looks up the index of a specified wavelength in the dataset to have a wavelength greater/equal to
specified wavelength.
|
protected int |
getIndexOf(Wavelength wl,
double[] wlArray,
boolean exactOnly)
Looks up the index of a specified wavelength in the dataset to have a wavelength greater/equal to
specified wavelength.
|
boolean |
isEditable()
Default implementation: returns false
|
void |
setFluxUnits(String units)
a DUMMY implementation: Saves the string but does NOTHING with it.
|
void |
setValue(Wavelength inWl,
double newVal)
default implementation, does nothing
|
double[] |
toArrayData(double[] wllist)
Default implementation for returning an array of data values for
a specified set of wavelength values.
|
double[] |
toArrayWavelengths(Wavelength minWL,
Wavelength maxWL,
int nPts)
passes current default wavelength units down into the real workhorse
|
addChild, clone, equals, getChildren, getDataSource, indexOfChild, initializeTransients, isHolding, isMoreDataAvailable, isPending, isUpToDate, isValid, namedClone, processUpdates, removeAllChildren, removeChild, repeat, replaceChild, replaceObject, requestMoreData, retrieveMoreData, saveAsText, saveAsText, setDataSource, setHolding, setMoreDataAvailable, setPending, setTracing, setUpdatesPending, update
addEventMonitor, addPropertyChangeListener, areNamesEqual, clearAllListeners, compareTo, createDefaultName, firePropertyChange, firePropertyChange, fireReplaceObject, fireReplaceObject, fireReplaceObject, fireVetoableChange, fireVetoableChange, getException, getLabel, getName, getObjectIdString, getObjectIdString, getParent, isTracing, notifyEventMonitors, propertyChange, removeEventMonitor, removePropertyChangeListener, replaceObjectNYI, setException, setName, setParent, setTraceAll, toString, writeDebug, writeError
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, getNumPoints, getValue, removePropertyChangeListener, toArrayData, toArrayWavelengths
addChild, getChildren, getDataSource, isMoreDataAvailable, isPending, removeAllChildren, removeChild, replaceChild, requestMoreData, retrieveMoreData, setDataSource, setMoreDataAvailable
clearAllListeners, clone, firePropertyChange, getException, getLabel, getName, getParent, isHolding, isTracing, isValid, setException, setHolding, setName, setParent, setTracing
replaceObject
propertyChange
public static final String NUMPOINTS_PROPERTY
public static final String MINWAVELENGTH_PROPERTY
public static final String MAXWAVELENGTH_PROPERTY
protected String fFluxUnits
public AbstractWavelength1D()
public AbstractWavelength1D(String name)
public double getArea()
getArea
in interface Wavelength1DModel
public double getArea(Wavelength minWl, Wavelength maxWl)
getArea
in interface Wavelength1DModel
public double getArea(boolean interpolate)
getArea
in interface Wavelength1DModel
interpolate,
- when true, the data points are treated as points
on a curve and the area calculation uses linear interpolation between
points. When false, the data points are treated as "bins" with no
interpolation between points.public double getArea(Wavelength minWl, Wavelength maxWl, boolean interpolate)
getArea
in interface Wavelength1DModel
minWl
- the starting wavelength for areamaxWl
- the maximum wavelength for calculations.interpolate
- When true, the data points are treated as points
on a curve and the area calculation uses linear interpolation between
points. When false, the data points are treated as "bins" with no
interpolation between points.
This method may be overridden by subclasses (such as Wavelength1DArray) to create a more efficient array of wavelengths and data values to pass to the main calculateArea() method
protected double calculateArea(double[] wlArray, double[] dataArray, Wavelength minWl, Wavelength maxWl, boolean interpolate)
wlArray
- array of doubles representing the wavelength valueswl
- minWl
- the starting wavelength for areamaxWl
- the maximum wavelength for calculations.interpolate
- When true, the data points are treated as points
on a curve and the area calculation uses linear interpolation between
points. When false, the data points are treated as "bins" with no
interpolation between points.protected double calcArea(double xl, double xr, double yl, double yr, boolean interpolate)
protected int getIndexOf(Wavelength wl, double[] wlArray)
Note: this implementation assumes that the wavelength points are monotonically increasing.
targetWL
- is a target Wavelength in the default units of the datasetwlArray
- is the array of wavelength in double units in which to lockexactOnly
- when true only exact wavelength matches will be returned, when
false the index of first wavelength >= target will be returned.
search is done on a binary basis for efficiencyprotected int getIndexOf(double wl, double[] wlArray)
wl
- is a target Wavelength as a double value in the default units of the datasetwlArray
- is the array of wavelength in double units in which to lockprotected int getIndexOf(Wavelength wl, double[] wlArray, boolean exactOnly)
targetWL
- is a target Wavelength in the default units of the datasetwlArray
- is the array of wavelength in double units in which to lockexactOnly
- when true only exact wavelength matches will be returned, when
false the index of first wavelength >= target will be returned.
search is done on a binary basis for efficiencyprotected int getIndexOf(double targetWl, double[] wlArray, boolean exactOnly)
targetWL
- is a double of the wavelength in the default units of the datasetwlArray
- is the array of wavelength in which to lockexactOnly
- when true only exact wavelength matches will be returned, when
false the index of first wavelength >= target will be returned.
search is done on a binary basis for efficiencypublic boolean isEditable()
isEditable
in interface Wavelength1DModel
public void setValue(Wavelength inWl, double newVal)
setValue
in interface Wavelength1DModel
public double[] toArrayWavelengths(Wavelength minWL, Wavelength maxWL, int nPts)
toArrayWavelengths
in interface Wavelength1DModel
public double[] toArrayData(double[] wllist)
Note: subclasses may be able to override this "brute force" implementation with less resource-intensive implementation
toArrayData
in interface Wavelength1DModel
public void setFluxUnits(String units) throws UnitsNotSupportedException
setFluxUnits
in interface Wavelength1DModel
UnitsNotSupportedException
public String getFluxUnits()
Wavelength1DModel
getFluxUnits
in interface Wavelength1DModel
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.