|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectspv.spectrum.factory.AbstractFileFactoryModule
public abstract class AbstractFileFactoryModule
Abstract superclass of all instrument-specific factory modules.
| Field Summary | |
|---|---|
protected static java.lang.String |
BIN_NUMBER_UNITS
|
protected static java.lang.String |
C_BACK
|
static java.lang.String |
C_DATA
|
protected static java.lang.String |
C_DQ
|
static java.lang.String |
C_ERROR
|
static java.lang.String |
C_FLUX
|
protected static java.lang.String |
C_GROSS
|
protected static java.lang.String |
C_NELEM
|
protected static java.lang.String |
C_NET
|
protected static java.lang.String |
C_SPORDER
|
static java.lang.String |
C_WAVELENGTH
|
| Constructor Summary | |
|---|---|
AbstractFileFactoryModule()
|
|
| Method Summary | |
|---|---|
void |
addSSAPParameters(Spectrum sp,
SpectrumSpecification ss)
Adds SSAP parameters to the spectrum meta parameter list. |
protected void |
buildExtentMetaParameters(Spectrum sp)
Populate meta parameters with extent values. |
protected void |
buildLocationMetaParameters(Spectrum sp)
Populate meta parameters with location values. |
protected SingleSpectrum |
buildSingleSpectrum(SingleSpectrum sp,
java.lang.String name,
SpectrumSpecification ss,
SpectrumHeader hdr,
double[] wave,
XUnits waveu,
double[] flux,
YUnits fluxu,
double[] error,
YUnits erroru,
int[] dq,
DQBits dqbits)
Builds a SingleSpectrum instance. |
protected SingleSpectrum |
buildSingleSpectrum(SingleSpectrum sp,
java.lang.String name,
SpectrumSpecification ss,
SpectrumHeader hdr,
double[] wave,
XUnits waveu,
java.lang.String wavename,
double[] flux,
YUnits fluxu,
java.lang.String fluxname,
double[] error,
YUnits erroru,
java.lang.String errorname,
int[] dq,
DQBits dqbits)
Builds a SingleSpectrum instance. |
protected SingleSpectrum |
buildSingleSpectrum(SingleSpectrum sp,
java.lang.String name,
SpectrumSpecification ss,
SpectrumHeader hdr,
double[] wave,
XUnits waveu,
java.lang.String wavename,
double[] flux,
YUnits fluxu,
java.lang.String fluxname,
double[] error,
YUnits erroru,
java.lang.String errorname,
int[] dq,
DQBits dqbits,
java.lang.String emptyArrayErrorMessage)
Builds a SingleSpectrum instance. |
protected void |
buildSpectralExtentMetaParameter(Spectrum sp)
Populate meta parameters with spectral extent taken directly from the wavelength array. |
protected void |
buildTimeExtentMetaParameter(Spectrum sp,
java.lang.String keyword)
Populate meta parameters with time extent. |
protected YUnits |
fixIntensityUnits(YUnits units)
|
protected void |
getGenericMetaParameter(Spectrum sp)
Populate meta parameters with generic info. |
protected void |
getInstrumentPositionMetaParameter(Spectrum sp,
java.lang.String ra,
java.lang.String dec)
Populate meta parameters with instrument position. |
protected void |
getPositionMetaParameter(Spectrum sp,
java.lang.String ra,
java.lang.String dec)
Populate meta parameters with object position. |
protected void |
getTimeMetaParameter(Spectrum sp,
java.lang.String start,
java.lang.String end)
Populate meta parameters with observation time. |
protected java.lang.String |
getUnits(nom.tam.fits.TableHDU hdu,
java.lang.String colname)
The JavaFITS library has a kludgy way of retrieving the physical units from a table column. |
protected java.net.URL |
getURL(java.lang.String filename)
Returns the URL given a file name. |
protected boolean |
isFullD(double[] array)
Returns true if array is not empty. |
protected boolean |
isFullI(int[] array)
Returns true if array is not empty. |
protected boolean |
isTwoD(FitsFileAttributes ffa)
Checks if a binary table carries arrays, or is a flat 2-D table. |
abstract boolean |
isValidInstrument(FitsFileAttributes ffa)
Tests if a file contains spectra from a specific instrument. |
abstract FileDescriptor |
makeFileDescriptor(java.lang.String filename,
nom.tam.fits.Fits fits)
Creates a FileDescriptor object. |
abstract Spectrum |
makeSpectrum(SpectrumSpecification ss,
nom.tam.fits.Fits fits)
Creates a Spectrum object. |
abstract SpectrumSpecification |
makeSpectrumSpecification(java.net.URL url,
nom.tam.fits.Fits fits)
Returns a SpectrumSpecification object of the
appropriate sub-type, given a completely specified file name. |
protected void |
maskAll(Spectrum sp)
Masks all anomalies in the input spectrum. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String C_FLUX
public static final java.lang.String C_DATA
public static final java.lang.String C_ERROR
public static final java.lang.String C_WAVELENGTH
protected static final java.lang.String C_SPORDER
protected static final java.lang.String C_NELEM
protected static final java.lang.String C_GROSS
protected static final java.lang.String C_BACK
protected static final java.lang.String C_NET
protected static final java.lang.String C_DQ
protected static final java.lang.String BIN_NUMBER_UNITS
| Constructor Detail |
|---|
public AbstractFileFactoryModule()
| Method Detail |
|---|
public abstract Spectrum makeSpectrum(SpectrumSpecification ss,
nom.tam.fits.Fits fits)
throws nom.tam.fits.FitsException,
java.io.IOException,
SpectrumException
Spectrum object.
makeSpectrum in interface SpectrumFileFactoryModuless - the spectrum specificationfits - the associated Fits object, or
null if any
java.io.IOException
nom.tam.fits.FitsException
SpectrumException
public abstract SpectrumSpecification makeSpectrumSpecification(java.net.URL url,
nom.tam.fits.Fits fits)
throws nom.tam.fits.FitsException,
java.io.IOException
SpectrumSpecification object of the
appropriate sub-type, given a completely specified file name.
makeSpectrumSpecification in interface SpectrumFileFactoryModuleurl - the URL with the file name complete will all
specifications necessary to locate a valid spectrum,
such as FITS extension, row selector, image section, etc.fits - the associated Fits object, or
null if any
SpectrumSpecification object
of the appropriate sub-type
java.io.IOException
nom.tam.fits.FitsException
public abstract FileDescriptor makeFileDescriptor(java.lang.String filename,
nom.tam.fits.Fits fits)
throws nom.tam.fits.FitsException,
java.io.IOException,
SpectrumException
FileDescriptor object. The file name
cannot have any constructs such as FITS extension specifiers,
row/column selectors or image sections.
makeFileDescriptor in interface SpectrumFileFactoryModulefilename - the file namefits - the associated Fits object, or
null if any
FileDescripto object
of the appropriate sub-type
java.io.IOException
nom.tam.fits.FitsException
SpectrumException
public abstract boolean isValidInstrument(FitsFileAttributes ffa)
throws nom.tam.fits.FitsException,
java.io.IOException
isValidInstrument in interface SpectrumFileFactoryModuleffa - attributes of the FITS file
true if the file matches the
instrument, false otherwise.
nom.tam.fits.FitsException
java.io.IOException
public void addSSAPParameters(Spectrum sp,
SpectrumSpecification ss)
addSSAPParameters in interface SpectrumFileFactoryModulesp - the spectrum to be updatedss - the spectrum specification holding SSAP parameters
protected SingleSpectrum buildSingleSpectrum(SingleSpectrum sp,
java.lang.String name,
SpectrumSpecification ss,
SpectrumHeader hdr,
double[] wave,
XUnits waveu,
double[] flux,
YUnits fluxu,
double[] error,
YUnits erroru,
int[] dq,
DQBits dqbits)
throws SpectrumException
SingleSpectrum instance. The wavelength and
flux array get their standard names.
sp - the empty instance to be builtname - the namess - the spectrum specificationhdr - the headerwave - the wavelenth arraywaveu - the units associated with the wavelength arrayflux - the flux arrayfluxu - the units associated with the flux arrayerror - the error arrayerroru - the units associated with the error arraydq - the data quality arraydqbits - the DQBits object associated with the dq array
SingleSpectrum instance
SpectrumException
protected SingleSpectrum buildSingleSpectrum(SingleSpectrum sp,
java.lang.String name,
SpectrumSpecification ss,
SpectrumHeader hdr,
double[] wave,
XUnits waveu,
java.lang.String wavename,
double[] flux,
YUnits fluxu,
java.lang.String fluxname,
double[] error,
YUnits erroru,
java.lang.String errorname,
int[] dq,
DQBits dqbits)
throws SpectrumException
SingleSpectrum instance.
sp - the empty instance to be builtname - the spectrum namess - the spectrum specificationhdr - the headerwave - the wavelenth arraywaveu - the units associated with the wavelength arraywavename - the name of the wavelength arrayflux - the flux arrayfluxu - the units associated with the flux arrayfluxname - the name of the flux arrayerror - the error arrayerroru - the units associated with the error arrayerrorname - the name of the error arraydq - the data quality arraydqbits - the DQBits object associated with the dq array
SingleSpectrum instance
SpectrumException
protected SingleSpectrum buildSingleSpectrum(SingleSpectrum sp,
java.lang.String name,
SpectrumSpecification ss,
SpectrumHeader hdr,
double[] wave,
XUnits waveu,
java.lang.String wavename,
double[] flux,
YUnits fluxu,
java.lang.String fluxname,
double[] error,
YUnits erroru,
java.lang.String errorname,
int[] dq,
DQBits dqbits,
java.lang.String emptyArrayErrorMessage)
throws SpectrumException
SingleSpectrum instance.
This method includes a check for very long spectra. With more than 20,000 or so data points, plotting becomes painfully slow (bug in GeneralPath Java2D class). This method inserts data break points in the input arrays in case the input arrays exceed a given size.
sp - the empty instance to be builtname - the spectrum namess - the spectrum specificationhdr - the headerwave - the wavelenth arraywaveu - the units associated with the wavelength arraywavename - the name of the wavelength arrayflux - the flux arrayfluxu - the units associated with the flux arrayfluxname - the name of the flux arrayerror - the error arrayerroru - the units associated with the error arrayerrorname - the name of the error arraydq - the data quality arraydqbits - the DQBits object associated with the dq arrayemptyArrayErrorMessage - error message for empty ydata array condition
SingleSpectrum instance
SpectrumExceptionprotected YUnits fixIntensityUnits(YUnits units)
protected java.lang.String getUnits(nom.tam.fits.TableHDU hdu,
java.lang.String colname)
hdu - the HDU that contains the tablecolname - the column name
protected boolean isFullD(double[] array)
true if array is not empty. Empty array
is signaled by all its elements having the same stored value.
true if array is not emptyprotected boolean isFullI(int[] array)
true if array is not empty. Empty array
is signaled by all its elements having the same stored value.
true if array is not emptyprotected java.net.URL getURL(java.lang.String filename)
filename - the file name
protected void maskAll(Spectrum sp)
sp - the spectrum to be masked
protected boolean isTwoD(FitsFileAttributes ffa)
throws nom.tam.fits.FitsException,
java.io.IOException
ffa - the file attributes object
true if no array columns exist
nom.tam.fits.FitsException
java.io.IOExceptionprotected void getGenericMetaParameter(Spectrum sp)
sp - spectrum whose meta parameters are to be updated
protected void getPositionMetaParameter(Spectrum sp,
java.lang.String ra,
java.lang.String dec)
This method populates both the nominal and the instrument positions.
Subclasses should call explictly method getInstrumentPositionMetaParameter
if different header keywords are used for each one.
sp - spectrum whose meta parameters are to be updatedra - R.A. keyword in headerdec - DEC keyword in header
protected void getInstrumentPositionMetaParameter(Spectrum sp,
java.lang.String ra,
java.lang.String dec)
sp - spectrum whose meta parameters are to be updatedra - R.A. keyword in headerdec - DEC keyword in header
protected void getTimeMetaParameter(Spectrum sp,
java.lang.String start,
java.lang.String end)
sp - the spectrum whose meta parameters are to be updatedstart - the header keyword with start timeend - the header keyword with end timeprotected void buildSpectralExtentMetaParameter(Spectrum sp)
sp - the spectrum whose meta parameters are to be updated
protected void buildTimeExtentMetaParameter(Spectrum sp,
java.lang.String keyword)
sp - the spectrum whose meta parameters are to be updatedkeyword - the header keyword with the exposure timeprotected void buildLocationMetaParameters(Spectrum sp)
sp - the spectrum whose meta parameters are to be updatedprotected void buildExtentMetaParameters(Spectrum sp)
sp - the spectrum whose meta parameters are to be updated
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||