spv.spectrum.factory.GHRSFOS
Class GHRSFOSAbstractFactoryModule

java.lang.Object
  extended by spv.spectrum.factory.AbstractFileFactoryModule
      extended by spv.spectrum.factory.ImageAbstractFactoryModule
          extended by spv.spectrum.factory.GHRSFOS.GHRSFOSAbstractFactoryModule
All Implemented Interfaces:
SpectrumFileFactoryModule
Direct Known Subclasses:
FOSFactoryModule, GHRSFactoryModule

public abstract class GHRSFOSAbstractFactoryModule
extends ImageAbstractFactoryModule

This class supports the ingestion of spectra from GHRS and FOS files. Since their share an almost identical format, we use two subclasses to handle the (small) differences.

Version:
1.0 - 26Mar02, 1.1 - 04Nov02
Author:
Ivo Busko (Space Telescope Science Institute)

Field Summary
 
Fields inherited from class spv.spectrum.factory.AbstractFileFactoryModule
BIN_NUMBER_UNITS, C_BACK, C_DATA, C_DQ, C_ERROR, C_FLUX, C_GROSS, C_NELEM, C_NET, C_SPORDER, C_WAVELENGTH
 
Constructor Summary
GHRSFOSAbstractFactoryModule()
           
 
Method Summary
protected abstract  java.lang.String getInstrumentKeyword()
          Gets the value of the INSTRUMENT FITS keyword associated with the particular instrument at hand.
 boolean isValidInstrument(FitsFileAttributes ffa)
          Tests if a file contains a GHRS or FOS spectrum.
 FileDescriptor makeFileDescriptor(java.lang.String filename, nom.tam.fits.Fits fits)
          Creates a FileDescriptor object.
 Spectrum makeSpectrum(SpectrumSpecification ss, nom.tam.fits.Fits fits)
          Creates a Spectrum object.
 SpectrumSpecification makeSpectrumSpecification(java.net.URL url, nom.tam.fits.Fits fits)
          Returns a SpectrumSpecification object.
protected abstract  int[] readDQ(nom.tam.fits.ImageHDU im_hdu, int[] group)
          Reads a DQ array from a image HDU.
protected abstract  double[] readWavelengths(nom.tam.fits.ImageHDU im_hdu, int[] group)
          Reads a wavelength array from a image HDU.
 
Methods inherited from class spv.spectrum.factory.ImageAbstractFactoryModule
generateWavelengths, getXUnitsFromHeader, getYUnitsFromHeader, readFloat, readFloat, readFromDoubleArray, readFromFloatArray, readFromIntArray
 
Methods inherited from class spv.spectrum.factory.AbstractFileFactoryModule
addSSAPParameters, buildExtentMetaParameters, buildLocationMetaParameters, buildSingleSpectrum, buildSingleSpectrum, buildSingleSpectrum, buildSpectralExtentMetaParameter, buildTimeExtentMetaParameter, fixIntensityUnits, getGenericMetaParameter, getInstrumentPositionMetaParameter, getPositionMetaParameter, getTimeMetaParameter, getUnits, getURL, isFullD, isFullI, isTwoD, maskAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GHRSFOSAbstractFactoryModule

public GHRSFOSAbstractFactoryModule()
Method Detail

makeSpectrum

public Spectrum makeSpectrum(SpectrumSpecification ss,
                             nom.tam.fits.Fits fits)
                      throws java.lang.ArrayIndexOutOfBoundsException,
                             nom.tam.fits.FitsException,
                             java.io.IOException,
                             SpectrumException
Creates a Spectrum object.

Specified by:
makeSpectrum in interface SpectrumFileFactoryModule
Specified by:
makeSpectrum in class AbstractFileFactoryModule
Parameters:
ss - the spectrum specification
fits - the associated Fits object, or null if any
Returns:
a SingleSpectrum object
Throws:
nom.tam.fits.FitsException - IOException
java.io.IOException
java.lang.ArrayIndexOutOfBoundsException
SpectrumException

makeSpectrumSpecification

public SpectrumSpecification makeSpectrumSpecification(java.net.URL url,
                                                       nom.tam.fits.Fits fits)
                                                throws nom.tam.fits.FitsException,
                                                       java.io.IOException
Returns a SpectrumSpecification object.

Specified by:
makeSpectrumSpecification in interface SpectrumFileFactoryModule
Specified by:
makeSpectrumSpecification in class AbstractFileFactoryModule
Parameters:
url - the URL with the file name complete will all specifications necessary to locate a valid spectrum, such as FITS extension, image section, etc.
fits - the associated Fits object, or null if any
Returns:
the SpectrumSpecification object
Throws:
java.io.IOException
nom.tam.fits.FitsException

makeFileDescriptor

public FileDescriptor makeFileDescriptor(java.lang.String filename,
                                         nom.tam.fits.Fits fits)
                                  throws nom.tam.fits.FitsException,
                                         java.io.IOException
Creates a FileDescriptor object.

Specified by:
makeFileDescriptor in interface SpectrumFileFactoryModule
Specified by:
makeFileDescriptor in class AbstractFileFactoryModule
Parameters:
filename - the file name
fits - the associated Fits object, or null if any
Returns:
the FileDescripto object
Throws:
java.io.IOException
nom.tam.fits.FitsException

isValidInstrument

public boolean isValidInstrument(FitsFileAttributes ffa)
                          throws nom.tam.fits.FitsException,
                                 java.io.IOException
Tests if a file contains a GHRS or FOS spectrum.

Specified by:
isValidInstrument in interface SpectrumFileFactoryModule
Specified by:
isValidInstrument in class AbstractFileFactoryModule
Parameters:
ffa - attributes of the FITS file
Returns:
true if the file matches the instrument, false otherwise.
Throws:
nom.tam.fits.FitsException
java.io.IOException

readDQ

protected abstract int[] readDQ(nom.tam.fits.ImageHDU im_hdu,
                                int[] group)
Reads a DQ array from a image HDU.

Parameters:
im_hdu - the HDU
group - the group
Returns:
the DQ array

readWavelengths

protected abstract double[] readWavelengths(nom.tam.fits.ImageHDU im_hdu,
                                            int[] group)
Reads a wavelength array from a image HDU.

Parameters:
im_hdu - the HDU
group - the group
Returns:
the wavelength array

getInstrumentKeyword

protected abstract java.lang.String getInstrumentKeyword()
Gets the value of the INSTRUMENT FITS keyword associated with the particular instrument at hand.

Returns:
the value of the INSTRUMENT FITS keyword