jsky.navigator
Class NavigatorFITSTable

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by jsky.catalog.MemoryCatalog
              extended by jsky.catalog.skycat.SkycatTable
                  extended by jsky.navigator.NavigatorFITSTable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.table.TableModel, Catalog, QueryResult, TableQueryResult, Saveable, SaveableAsHTML

public class NavigatorFITSTable
extends SkycatTable

Used to read and write FITS binary tables and store catalog query results as FITS tables. This class is the bridge between the catalog classes and the FITS I/O library.

Version:
$Revision: 1.2 $
Author:
Allan Brighton
See Also:
Serialized Form

Field Summary
protected static java.lang.String CATINFO
          Name of a FITS binary table containing skycat style catalog configuration information.
protected static java.lang.String[] CATINFO_COLUMNS
          Table column headings for the CATINFO table (corresponds to the fields in a skycat catalog config file)
protected static int NUM_CATINFO_COLUMNS
          Number of columns in the CATINFO table
 
Fields inherited from class jsky.catalog.MemoryCatalog
DEC_COL, EQUINOX, ID_COL, RA_COL, SYMBOL, X_COL, Y_COL
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Fields inherited from interface jsky.catalog.Catalog
ARCHIVE, CATALOG, DIRECTORY, IMAGE_SERVER, LOCAL, NAME_SERVER
 
Constructor Summary
NavigatorFITSTable(java.lang.String filename, nom.tam.fits.Fits fits, int hduIndex)
          Initialize from the given FITS HDU
NavigatorFITSTable(java.lang.String filename, nom.tam.fits.Fits fits, nom.tam.fits.TableHDU hdu)
          Initialize from the given FITS HDU
 
Method Summary
protected static void deleteTable(nom.tam.fits.Fits fits, java.lang.String name)
          Delete the named FITS table from the given Fits Object.
protected static nom.tam.fits.BinaryTableHDU findBinaryTableHDU(nom.tam.fits.Fits fits, java.lang.String name)
          Look for a binary table with the given name and return it if found, otherwise null.
protected  SkycatConfigEntry findConfigEntry(nom.tam.fits.Fits fits)
          Look for a skycat catalog configuration entry for this table in another FITS table in the given Fits object with the name "CATINFO".
protected static int findConfigEntryRow(nom.tam.fits.BinaryTableHDU hdu, java.lang.String name)
          Return index of the row in the given binary table who's first element contains the given string, or -1 if not found.
protected static NavigatorFITSTable findTable(java.lang.String filename, nom.tam.fits.Fits fits, java.lang.String name)
          Find the named FITS binary table, make a NavigatorFITSTable out of it and return it.
static NavigatorFITSTable getFitsTable(java.lang.String filename)
          Return a FITS table for the given filename.
 nom.tam.fits.Header getHeader()
          Returns a reference to the FITS header for the table
protected static nom.tam.fits.TableHDU getTableHDU(nom.tam.fits.Fits fits, int hduIndex)
          Return the object for the given HDU index.
protected static void plotTable(java.lang.String filename, nom.tam.fits.Fits fits, Navigator navigator, java.lang.String name)
          Plot the named binary table on the image.
static void plotTables(java.lang.String filename, nom.tam.fits.Fits fits, Navigator navigator)
          Check for any catalog tables saved as FITS binary tables and plot the ones found on the image.
static NavigatorFITSTable saveWithImage(java.lang.String filename, nom.tam.fits.Fits fits, TableQueryResult table)
          Save the given table as a binary FITS table in the given Fits object and return a NavigatorFITSTable object for the new table.
protected static void updateCatInfo(nom.tam.fits.Fits fits, TableQueryResult table, java.lang.String name)
          Add (or update) a FITS table named CATINFO with catalog configuration information for the given catalog.
 
Methods inherited from class jsky.catalog.skycat.SkycatTable
_saveProperties, checkProperties, getCatalog, getConfigEntry, main, makeQueryResult, setConfigEntry
 
Methods inherited from class jsky.catalog.MemoryCatalog
_checkColumnClass, _init, _initColumnClasses, _initFields, _parseHeading, _parseItem, _parseProperty, _parseRow, _saveHeader, clone, compareRow, getColumnClass, getColumnDesc, getColumnIdentifiers, getColumnIndex, getColumnName, getCoordinates, getDescription, getDocURL, getFields, getFilename, getId, getName, getNumColumns, getNumParams, getParamDesc, getParamDesc, getParent, getPath, getProperties, getProperty, getQueryArgs, getRowCoordinates, getTitle, getType, getValueAt, getWCSCenter, hasCol, hasCoordinates, isCellEditable, isImageServer, isLocal, isMore, isReadOnly, makeColumnIdentifiers, print, query, saveAs, saveAs, saveAsHTML, setCatalog, setColumnClasses, setColumnClasses, setColumnIdentifiers, setDescription, setDocURL, setFields, setFilename, setId, setMore, setName, setParent, setProperties, setProperty, setQueryArgs, setReadOnly, setRegionArgs, setRowCoordinates, setTitle, sort, toString
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jsky.catalog.TableQueryResult
getDataVector
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnCount, getRowCount, getValueAt, removeTableModelListener, setValueAt
 

Field Detail

CATINFO

protected static final java.lang.String CATINFO
Name of a FITS binary table containing skycat style catalog configuration information.

See Also:
Constant Field Values

CATINFO_COLUMNS

protected static final java.lang.String[] CATINFO_COLUMNS
Table column headings for the CATINFO table (corresponds to the fields in a skycat catalog config file)


NUM_CATINFO_COLUMNS

protected static final int NUM_CATINFO_COLUMNS
Number of columns in the CATINFO table

Constructor Detail

NavigatorFITSTable

public NavigatorFITSTable(java.lang.String filename,
                          nom.tam.fits.Fits fits,
                          nom.tam.fits.TableHDU hdu)
                   throws nom.tam.fits.FitsException
Initialize from the given FITS HDU

Parameters:
filename - The name of the FITS file
fits - object to use for FITS I/O
hdu - the HDU containing the FITS table
Throws:
nom.tam.fits.FitsException

NavigatorFITSTable

public NavigatorFITSTable(java.lang.String filename,
                          nom.tam.fits.Fits fits,
                          int hduIndex)
                   throws java.io.IOException,
                          nom.tam.fits.FitsException
Initialize from the given FITS HDU

Parameters:
filename - The name of the FITS file
fits - object to use for FITS I/O
hduIndex - the index of the HDU containing the FITS table
Throws:
java.io.IOException
nom.tam.fits.FitsException
Method Detail

getHeader

public nom.tam.fits.Header getHeader()
Returns a reference to the FITS header for the table


getFitsTable

public static NavigatorFITSTable getFitsTable(java.lang.String filename)
                                       throws nom.tam.fits.FitsException,
                                              java.io.IOException
Return a FITS table for the given filename.

Parameters:
filename - The name of a FITS file containing a FITS table as the first HDU
Returns:
the NavigatorFITSTable object containing the table data
Throws:
nom.tam.fits.FitsException - if there is a problem with the FITS format
java.io.IOException - if there is a problem reading the file
java.lang.IllegalArgumentException - if not a FITS table

getTableHDU

protected static nom.tam.fits.TableHDU getTableHDU(nom.tam.fits.Fits fits,
                                                   int hduIndex)
                                            throws java.io.IOException,
                                                   nom.tam.fits.FitsException
Return the object for the given HDU index.

Parameters:
fits - object to use for FITS I/O
hduIndex - the index of the HDU containing the FITS table
Throws:
java.io.IOException
nom.tam.fits.FitsException

findConfigEntry

protected SkycatConfigEntry findConfigEntry(nom.tam.fits.Fits fits)
                                     throws nom.tam.fits.FitsException,
                                            java.io.IOException
Look for a skycat catalog configuration entry for this table in another FITS table in the given Fits object with the name "CATINFO".

Parameters:
fits - object to use for FITS I/O
Returns:
a skycat config entry for this table, or null if not found
Throws:
nom.tam.fits.FitsException
java.io.IOException

findConfigEntryRow

protected static int findConfigEntryRow(nom.tam.fits.BinaryTableHDU hdu,
                                        java.lang.String name)
                                 throws nom.tam.fits.FitsException
Return index of the row in the given binary table who's first element contains the given string, or -1 if not found.

Throws:
nom.tam.fits.FitsException

findBinaryTableHDU

protected static nom.tam.fits.BinaryTableHDU findBinaryTableHDU(nom.tam.fits.Fits fits,
                                                                java.lang.String name)
                                                         throws nom.tam.fits.FitsException,
                                                                java.io.IOException
Look for a binary table with the given name and return it if found, otherwise null.

Parameters:
fits - object to use for FITS I/O
Returns:
a FITS binary table, or null if not found
Throws:
nom.tam.fits.FitsException
java.io.IOException

saveWithImage

public static NavigatorFITSTable saveWithImage(java.lang.String filename,
                                               nom.tam.fits.Fits fits,
                                               TableQueryResult table)
                                        throws nom.tam.fits.FitsException,
                                               java.io.IOException
Save the given table as a binary FITS table in the given Fits object and return a NavigatorFITSTable object for the new table.

If the table is an instance of SkycatTable, the catalog configuration information is also saved in a separate table named CATINFO.

Parameters:
filename - The name of the FITS file
fits - object to use for FITS I/O
table - contains the table data
Returns:
a NavigatorFITSTable object for the new table
Throws:
nom.tam.fits.FitsException
java.io.IOException

deleteTable

protected static void deleteTable(nom.tam.fits.Fits fits,
                                  java.lang.String name)
                           throws nom.tam.fits.FitsException,
                                  java.io.IOException
Delete the named FITS table from the given Fits Object.

Parameters:
fits - object to use for FITS I/O
name - the name of the table
Throws:
nom.tam.fits.FitsException
java.io.IOException

updateCatInfo

protected static void updateCatInfo(nom.tam.fits.Fits fits,
                                    TableQueryResult table,
                                    java.lang.String name)
                             throws nom.tam.fits.FitsException,
                                    java.io.IOException
Add (or update) a FITS table named CATINFO with catalog configuration information for the given catalog. Note: This method only supports tables derived from SkycatTable.

Parameters:
fits - object to use for FITS I/O
table - contains the table data
name - the name to give the FITS table
Throws:
nom.tam.fits.FitsException
java.io.IOException

plotTables

public static void plotTables(java.lang.String filename,
                              nom.tam.fits.Fits fits,
                              Navigator navigator)
                       throws nom.tam.fits.FitsException,
                              java.io.IOException
Check for any catalog tables saved as FITS binary tables and plot the ones found on the image. Each catalog table should have an entry in the CATINFO FITS table, which describes how to plot it.

Parameters:
filename - The name of the FITS file
fits - object to use for FITS I/O
navigator - window object managing the table display and plotting
Throws:
nom.tam.fits.FitsException
java.io.IOException

plotTable

protected static void plotTable(java.lang.String filename,
                                nom.tam.fits.Fits fits,
                                Navigator navigator,
                                java.lang.String name)
                         throws nom.tam.fits.FitsException,
                                java.io.IOException
Plot the named binary table on the image.

Parameters:
filename - The name of the FITS file
fits - object to use for FITS I/O
navigator - window object managing the table display and plotting
name - the name of the table to plot (FITS keyword EXTNAME)
Throws:
nom.tam.fits.FitsException
java.io.IOException

findTable

protected static NavigatorFITSTable findTable(java.lang.String filename,
                                              nom.tam.fits.Fits fits,
                                              java.lang.String name)
                                       throws nom.tam.fits.FitsException,
                                              java.io.IOException
Find the named FITS binary table, make a NavigatorFITSTable out of it and return it.

Parameters:
filename - The name of the FITS file
fits - object to use for FITS I/O
name - the name of the table to plot (FITS keyword EXTNAME)
Throws:
nom.tam.fits.FitsException
java.io.IOException