uk.ac.starlink.splat.data
Class NDFSpecDataImpl

java.lang.Object
  extended by uk.ac.starlink.splat.data.AbstractSpecDataImpl
      extended by uk.ac.starlink.splat.data.NDFSpecDataImpl
All Implemented Interfaces:
Serializable, FITSHeaderSource, SpecDataImpl

public class NDFSpecDataImpl
extends AbstractSpecDataImpl
implements FITSHeaderSource

NDFSpecDataImpl - implementation of SpecDataImpl to access NDF spectra.

See Also:
"The Bridge Design Pattern", Serialized Form

Field Summary
protected  String fullName
          Original specification of NDF.
protected  nom.tam.fits.Header header
          Reference to the FITS headers.
protected  NDFJ theNDF
          Reference to NDFJ object for accessing the NDF.
 
Fields inherited from class uk.ac.starlink.splat.data.AbstractSpecDataImpl
dataLabel, dataUnits, parentImpl
 
Constructor Summary
NDFSpecDataImpl(String fileName)
          Constructor - open a NDF by file name.
NDFSpecDataImpl(String fileName, SpecData source)
          Constructor.
 
Method Summary
protected  void createTempClone(SpecData source)
          Create an temporary NDF that is a clone of an existing spectrum.
protected  void finalize()
          Finalise object.
 uk.ac.starlink.ast.FrameSet getAst()
          Return reference to NDF AST frameset.
 double[] getData()
          Return a copy of the spectrum data values.
 double[] getDataErrors()
          Return a copy of the spectrum data errors.
 String getDataFormat()
          Return the data format.
 int[] getDims()
          Return the NDF shape.
 nom.tam.fits.Header getFitsHeaders()
          Return any FITS headers in the NDF as proper FITS header.
 String getFullName()
          Return the full name of the NDF.
 String getProperty(String key)
          Return a keyed value from the NDF character components or FITS headers.
 String getShortName()
          Return a symbolic name.
 NDFJ getTempCopy()
          Return a copy of this NDF.
protected  void open(String fileName)
          Open an NDF.
 void save()
          Save the spectrum to disk-file.
 
Methods inherited from class uk.ac.starlink.splat.data.AbstractSpecDataImpl
getColumnNames, getCoordinateColumnName, getDataColumnName, getDataErrorColumnName, getDataLabel, getDataUnits, getParentImpl, isFITSHeaderSource, setCoordinateColumnName, setDataColumnName, setDataErrorColumnName, setDataLabel, setDataUnits, setParentImpl
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theNDF

protected NDFJ theNDF
Reference to NDFJ object for accessing the NDF.


fullName

protected String fullName
Original specification of NDF.


header

protected nom.tam.fits.Header header
Reference to the FITS headers.

Constructor Detail

NDFSpecDataImpl

public NDFSpecDataImpl(String fileName)
                throws SplatException
Constructor - open a NDF by file name.

Throws:
SplatException

NDFSpecDataImpl

public NDFSpecDataImpl(String fileName,
                       SpecData source)
                throws SplatException
Constructor. Initialise this spectrum by cloning the content of another spectrum (usual starting point for saving).

Throws:
SplatException
Method Detail

getData

public double[] getData()
Return a copy of the spectrum data values.

Specified by:
getData in interface SpecDataImpl
Specified by:
getData in class AbstractSpecDataImpl

getDataErrors

public double[] getDataErrors()
Return a copy of the spectrum data errors.

Specified by:
getDataErrors in interface SpecDataImpl
Specified by:
getDataErrors in class AbstractSpecDataImpl

getDims

public int[] getDims()
Return the NDF shape.

Specified by:
getDims in interface SpecDataImpl
Specified by:
getDims in class AbstractSpecDataImpl

getShortName

public String getShortName()
Return a symbolic name.

Specified by:
getShortName in interface SpecDataImpl
Specified by:
getShortName in class AbstractSpecDataImpl

getFullName

public String getFullName()
Return the full name of the NDF.

Specified by:
getFullName in interface SpecDataImpl
Specified by:
getFullName in class AbstractSpecDataImpl

getAst

public uk.ac.starlink.ast.FrameSet getAst()
Return reference to NDF AST frameset.

Specified by:
getAst in interface SpecDataImpl
Specified by:
getAst in class AbstractSpecDataImpl

getDataFormat

public String getDataFormat()
Return the data format.

Specified by:
getDataFormat in interface SpecDataImpl
Specified by:
getDataFormat in class AbstractSpecDataImpl

save

public void save()
          throws SplatException
Save the spectrum to disk-file. Assumes that the spectrum hasn't already been saved and is resident in a temporary NDF. TODO: deal with situation when above isn't true.

Specified by:
save in interface SpecDataImpl
Specified by:
save in class AbstractSpecDataImpl
Throws:
SplatException

getProperty

public String getProperty(String key)
Return a keyed value from the NDF character components or FITS headers. Returns "" if not found.

Specified by:
getProperty in interface SpecDataImpl
Overrides:
getProperty in class AbstractSpecDataImpl

getFitsHeaders

public nom.tam.fits.Header getFitsHeaders()
Return any FITS headers in the NDF as proper FITS header.

Specified by:
getFitsHeaders in interface FITSHeaderSource

finalize

protected void finalize()
                 throws Throwable
Finalise object. Free any resources associated with member variables (not much to do here, NDFJ class frees AST frameset and annuls NDF).

Overrides:
finalize in class Object
Throws:
Throwable

open

protected void open(String fileName)
             throws SplatException
Open an NDF.

Parameters:
fileName - file name of the NDF.
Throws:
SplatException

getTempCopy

public NDFJ getTempCopy()
Return a copy of this NDF.


createTempClone

protected void createTempClone(SpecData source)
                        throws SplatException
Create an temporary NDF that is a clone of an existing spectrum. If this is an NDF then it is used as a template, otherwise a new NDF is created.

Throws:
SplatException


Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.