Class ncsa.horizon.coordinates.FITSCoordMetadata
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ncsa.horizon.coordinates.FITSCoordMetadata

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----ncsa.horizon.util.Metadata
                           |
                           +----ncsa.horizon.coordinates.CoordMetadata
                                   |
                                   +----ncsa.horizon.coordinates.FITSCoordMetadata

public class FITSCoordMetadata
extends CoordMetadata
a Metadata class for loading coordinate metadata from a FITS image file.

This class provides a variety of methods that makes it easy load FITS metadata with the correct type. As the are loaded, they are converted values and types defined by the horizon schema so that they can be used by the horizon coordinate classes.

One should note that the FITS metadata format/schema uses the convention of numbering axes beginning with 1, in contrast to the horizon schema which numbers axes beginning with 0. Methods in this class that take an axis number as an argument assume the FITS convention (subtracting 1 from the input value when converting to the horizon schema).

The majority of methods provided by this class give the user a way of saving individual metadata values; these are methods like setNAXIS() and setCTYPE(). It also provides a few methods for parsing out FITS headers for coordinate-related data. These include scanHeaderLine() which parses a single line from the header, and scanHeader for parsing an entire header from an input stream. The modernize() method is used for converting depricated FITS keywords into their current alternatives. Finally, after the metadata list is fully loaded, one can use the createCoordSys() method to create the CoordinateSystem object the metadata describe.


Variable Index

 o defaultDecFormatter
 o defaultLinearFormatter
 o defaultRAFormatter

Constructor Index

 o FITSCoordMetadata()
Construct a CoordMetadata list for a FITS image
 o FITSCoordMetadata(int)
Creates an empty metadatum list with specified defaults.
 o FITSCoordMetadata(int, Metadata)
Creates an metadatum list for a coordinate system with naxes axes
 o FITSCoordMetadata(Metadata)
Creates an empty metadatum list with specified defaults.

Method Index

 o createCoordSys()
create the coordinate system described by this metadata set.
 o createCoordSys(Metadata)
create the coordinate system described by a metadata set.
 o FITSkeyval(String)
return the value portion of a key-value pair from FITS header line.
 o getIdentityPCMatrix(int)
return a Metavector object containing a PCMatrix whose values are equal to 1 on the diagonal and 0 otherwise.
 o getLONLATName(char)
return the name horizon gives to various kinds of longitude and latitude based on the first letter of the CTYPE string.
 o getNAXIS()
return the value of FITS keyword NAXIS, the number of axes in the dataset
 o getNAXIS(Metadata)
return the value of FITS keyword NAXIS, the number of axes in the dataset
 o main(String[])
 o modernize()
convert deprecated metadata into their modern alternatives.
 o modernize(Metadata)
convert deprecated metadata into their modern alternatives.
 o parseAfterDash(String)
return the string appearing after one or more dashes in a string
 o scanHeader(InputStream)
scan FITS header and loads all the data recognized as pertaining to the coordinate system.
 o scanHeader(Metadata, InputStream)
scan FITS header and loads all the data recognized as pertaining to the coordinate system.
 o scanHeaderCard(Metadata, String)
scan an 80-character line of a FITS header and load the data in the metadata list if it is recognized as pertaining to the coordinate system.
 o scanHeaderCard(String)
scan an 80-character line of a FITS header and load the data in this metadata list if it is recognized as pertaining to the coordinate system.
 o setCDELT(int, double)
insert a voxel width into this metadata list
 o setCDELT(Metadata, int, double)
insert a voxel width into a metadata list
 o setCROTA(int, double)
insert an axis rotation into this metadata list; since the CROTA keyword is being phased out in favor of a PC Matrix, one should run modernize() on the metadata list after all metadata are loaded if this method was called.
 o setCROTA(Metadata, int, double)
insert an axis rotation into a metadata list; since the CROTA keyword is being phased out in favor of a PC Matrix, one should run modernize() on the metadata list after all metadata are loaded if this method was called.
 o setCRPIX(int, double)
insert an axis reference data position into this metadata list
 o setCRPIX(Metadata, int, double)
insert an axis reference data position into a metadata list
 o setCRVAL(int, double)
insert an axis reference value into this metadata list
 o setCRVAL(Metadata, int, double)
insert an axis reference value into a metadata list
 o setCTYPE(int, String)
insert the name and type information into this metadata list
 o setCTYPE(Metadata, int, String)
insert the name and type information into a metadata list
 o setEPOCH(Metadata, String)
insert the value of the EPOCH keyword into a metadata list
 o setEPOCH(String)
insert the value of the EPOCH keyword into this metadata list
 o setEQUINOX(Metadata, String)
insert the value of the EQUINOX keyword into a metadata list
 o setEQUINOX(String)
insert the value of the EQUINOX keyword into this metadata list
 o setLATPOLE(double)
insert the value of FITS keyword LATPOLE into this metadata list
 o setLATPOLE(Metadata, double)
a the value of FITS keyword LATPOLE into a metadata list
 o setLONGPOLE(double)
insert the value of FITS keyword LONGPOLE into this metadata list
 o setLONGPOLE(Metadata, double)
a the value of FITS keyword LONGPOLE into a metadata list
 o setNAXIS(int)
insert the number of axes into this metadata list
 o setNAXIS(Metadata, int)
insert the number of axes into a metadata list
 o setPCMatrix(double[])
insert a PC matrix into this metadata list
 o setPCMatrix(int, int, double)
insert an element of the PC matrix into a metadata list.
 o setPCMatrix(Metadata, double[])
insert a PC matrix into a metadata list
 o setPCMatrix(Metadata, int, int, double)
insert an element of the PC matrix into a metadata list.
 o setPROJP(double[])
insert an array of projection parameters in this metadata list
 o setPROJP(int, double)
insert an element of the array of projection parameters
 o setPROJP(Metadata, double[])
insert an array of projection parameters in a metadata list
 o setPROJP(Metadata, int, double)
insert an element of the array of projection parameters
 o setRADECSYS(Metadata, String)
insert the value of the RADECSYS keyword into a metadata list
 o setRADECSYS(String)
insert the value of the RADECSYS keyword into this metadata list
 o setVeloStandard(int, String)
set the value of the velocity standard in use for specific axis
 o setVeloStandard(Metadata, int, String)
set the value of the velocity standard in use for specific axis
 o setVeloStandard(Metadata, String)
set the value of the default velocity standard for the entire coordinate system
 o setVeloStandard(String)
set the value of the default velocity standard for the entire coordinate system

Variables

 o defaultRAFormatter
  public final static AxisPosFormatter defaultRAFormatter
 o defaultDecFormatter
  public final static AxisPosFormatter defaultDecFormatter
 o defaultLinearFormatter
  public final static AxisPosFormatter defaultLinearFormatter

Constructors

 o FITSCoordMetadata
  public FITSCoordMetadata()
Construct a CoordMetadata list for a FITS image
 o FITSCoordMetadata
  public FITSCoordMetadata(int naxes,
                           Metadata defaults) throws ArrayIndexOutOfBoundsException
Creates an metadatum list for a coordinate system with naxes axes
Parameters:
naxes - the number of axes in the coordinate system
defaults - the defaults (can be null)
 o FITSCoordMetadata
  public FITSCoordMetadata(int naxes) throws ArrayIndexOutOfBoundsException
Creates an empty metadatum list with specified defaults.
Parameters:
defaults - the defaults
 o FITSCoordMetadata
  public FITSCoordMetadata(Metadata defaults) throws ArrayIndexOutOfBoundsException
Creates an empty metadatum list with specified defaults.
Parameters:
defaults - the defaults

Methods

 o getNAXIS
  public static int getNAXIS(Metadata md)
return the value of FITS keyword NAXIS, the number of axes in the dataset
Parameters:
md - the metadata list to search
 o getNAXIS
  public int getNAXIS()
return the value of FITS keyword NAXIS, the number of axes in the dataset
 o setNAXIS
  public static void setNAXIS(Metadata md,
                              int nax)
insert the number of axes into a metadata list
Parameters:
md - the Metadata list to insert value into
nax - the value of the NAXIS keyword
 o setNAXIS
  public void setNAXIS(int nax)
insert the number of axes into this metadata list
Parameters:
nax - the value of the NAXIS keyword
 o setCTYPE
  public static void setCTYPE(Metadata md,
                              int axis,
                              String in)
insert the name and type information into a metadata list
Parameters:
md - the Metadata list to insert value into
axis - the axis number (first axis is 1)
in - the value of the CTYPE keyword
 o setCTYPE
  public void setCTYPE(int axis,
                       String in)
insert the name and type information into this metadata list
Parameters:
axis - the axis number (first axis is 1)
in - the value of the CTYPE keyword
 o getLONLATName
  protected static String getLONLATName(char c)
return the name horizon gives to various kinds of longitude and latitude based on the first letter of the CTYPE string. This method assumes that the CTYPE is of the form "xLON-..." or "xLAT-...", where x is one of { G, E, H, S }.
 o parseAfterDash
  public static String parseAfterDash(String ctype)
return the string appearing after one or more dashes in a string
Parameters:
ctype - the string to parse, usually the value of the CTYPE keyword
 o setCRVAL
  public static void setCRVAL(Metadata md,
                              int axis,
                              double in)
insert an axis reference value into a metadata list
Parameters:
md - the Metadata list to insert value into
axis - the axis number (first axis is 1)
in - the value of the CRVAL keyword
 o setCRVAL
  public void setCRVAL(int axis,
                       double in)
insert an axis reference value into this metadata list
Parameters:
axis - the axis number (first axis is 1)
in - the value of the CRVAL keyword
 o setCRPIX
  public static void setCRPIX(Metadata md,
                              int axis,
                              double in)
insert an axis reference data position into a metadata list
Parameters:
md - the Metadata list to insert value into
axis - the axis number (first axis is 1)
in - the value of the CRPIX keyword
 o setCRPIX
  public void setCRPIX(int axis,
                       double in)
insert an axis reference data position into this metadata list
Parameters:
axis - the axis number (first axis is 1)
in - the value of the CRPIX keyword
 o setCDELT
  public static void setCDELT(Metadata md,
                              int axis,
                              double in)
insert a voxel width into a metadata list
Parameters:
md - the Metadata list to insert value into
axis - the axis number (first axis is 1)
in - the value of the CDELT keyword
 o setCDELT
  public void setCDELT(int axis,
                       double in)
insert a voxel width into this metadata list
Parameters:
axis - the axis number (first axis is 1)
in - the value of the CDELT keyword
 o setCROTA
  public static void setCROTA(Metadata md,
                              int axis,
                              double in)
insert an axis rotation into a metadata list; since the CROTA keyword is being phased out in favor of a PC Matrix, one should run modernize() on the metadata list after all metadata are loaded if this method was called.
Parameters:
md - the Metadata list to insert value into
axis - the axis the standard is associated with
in - the value of the CROTA keyword
 o setCROTA
  public void setCROTA(int axis,
                       double in)
insert an axis rotation into this metadata list; since the CROTA keyword is being phased out in favor of a PC Matrix, one should run modernize() on the metadata list after all metadata are loaded if this method was called.
Parameters:
md - the Metadata list to insert value into
axis - the axis the standard is associated with
in - the value of the CROTA keyword
 o setVeloStandard
  public static void setVeloStandard(Metadata md,
                                     int axis,
                                     String in)
set the value of the velocity standard in use for specific axis
Parameters:
md - the Metadata list to insert value into
axis - the axis the standard is associated with
in - the code for the standard; e.g. "LSR", "HEL", "OBS".
 o setVeloStandard
  public void setVeloStandard(int axis,
                              String in)
set the value of the velocity standard in use for specific axis
Parameters:
axis - the axis the standard is associated with
in - the code for the standard; e.g. "LSR", "HEL", "OBS".
 o setVeloStandard
  public static void setVeloStandard(Metadata md,
                                     String in)
set the value of the default velocity standard for the entire coordinate system
Parameters:
md - the Metadata list to insert value into
in - the code for the standard; e.g. "LSR", "HEL", "OBS".
 o setVeloStandard
  public void setVeloStandard(String in)
set the value of the default velocity standard for the entire coordinate system
Parameters:
in - the code for the standard; e.g. "LSR", "HEL", "OBS".
 o setLONGPOLE
  public static void setLONGPOLE(Metadata md,
                                 double longpole)
a the value of FITS keyword LONGPOLE into a metadata list
Parameters:
md - the Metadata list to insert value into
in - value of the FITS keyword LONGPOLE
 o setLONGPOLE
  public void setLONGPOLE(double longpole)
insert the value of FITS keyword LONGPOLE into this metadata list
Parameters:
in - value of the FITS keyword LONGPOLE
 o setLATPOLE
  public static void setLATPOLE(Metadata md,
                                double latpole)
a the value of FITS keyword LATPOLE into a metadata list
Parameters:
md - the Metadata list to insert value into
in - value of the FITS keyword LATPOLE
 o setLATPOLE
  public void setLATPOLE(double latpole)
insert the value of FITS keyword LATPOLE into this metadata list
Parameters:
in - value of the FITS keyword LATPOLE
 o setPCMatrix
  public static void setPCMatrix(Metadata md,
                                 double in[])
insert a PC matrix into a metadata list
Parameters:
md - the Metadata list to insert value into
in - an array of NAXISxNAXIS elements, in order of (PC001001, PC001002, ..., PC002001, PC002002, ...)
Throws: IllegalArgumentException
if in.length is not a perfect square
 o setPCMatrix
  public void setPCMatrix(double in[])
insert a PC matrix into this metadata list
Parameters:
in - an array of NAXISxNAXIS elements, in order of (PC001001, PC001002, ..., PC002001, PC002002, ...)
Throws: IllegalArgumentException
if in.length is not a perfect square
 o setPCMatrix
  public static void setPCMatrix(Metadata md,
                                 int i,
                                 int j,
                                 double in)
insert an element of the PC matrix into a metadata list. The proper number of axes should be set before calling this method
Parameters:
md - the Metadata list to insert value into
i - the matrix row; e.g. 3 for PC003002
j - the matrix column; e.g. 2 for PC003002
in - the PC matrix element
Throws: ArrayIndexOutOfBoundsException
i or j < 1 or > NAXIS
 o setPCMatrix
  public void setPCMatrix(int i,
                          int j,
                          double in)
insert an element of the PC matrix into a metadata list. The proper number of axes should be set before calling this method
Parameters:
i - the matrix row; e.g. 3 for PC003002
j - the matrix column; e.g. 2 for PC003002
in - the PC matrix element
Throws: ArrayIndexOutOfBoundsException
i or j < 1 or > NAXIS
 o getIdentityPCMatrix
  public static Metavector getIdentityPCMatrix(int n)
return a Metavector object containing a PCMatrix whose values are equal to 1 on the diagonal and 0 otherwise.
Parameters:
n - the dimensionality of the matrix; output matrix will be n x n in size.
 o setPROJP
  public static void setPROJP(Metadata md,
                              double in[])
insert an array of projection parameters in a metadata list
Parameters:
md - the Metadata list to insert value into
in - an array containing the projection parameters
 o setPROJP
  public void setPROJP(double in[])
insert an array of projection parameters in this metadata list
Parameters:
in - an array containing the projection parameters
 o setPROJP
  public static void setPROJP(Metadata md,
                              int i,
                              double in) throws ArrayIndexOutOfBoundsException
insert an element of the array of projection parameters
Parameters:
md - the Metadata list to insert value into
i - the array element to insert; e.g. 3 for PROJP3
in - the value of the parameter
Throws: ArrayIndexOutOfBoundsException
i < 1
 o setPROJP
  public void setPROJP(int i,
                       double in)
insert an element of the array of projection parameters
Parameters:
md - the Metadata list to insert value into
i - the array element to insert; e.g. 3 for PROJP3
in - the value of the parameter
Throws: ArrayIndexOutOfBoundsException
i < 1
 o setRADECSYS
  public static void setRADECSYS(Metadata md,
                                 String in)
insert the value of the RADECSYS keyword into a metadata list
Parameters:
md - the Metadata list to insert value into
in - the value of the RADECSYS keyword
 o setRADECSYS
  public void setRADECSYS(String in)
insert the value of the RADECSYS keyword into this metadata list
Parameters:
md - the Metadata list to insert value into
in - the value of the RADECSYS keyword
 o setEQUINOX
  public static void setEQUINOX(Metadata md,
                                String in)
insert the value of the EQUINOX keyword into a metadata list
Parameters:
md - the Metadata list to insert value into
in - the value of the EQUINOX keyword
 o setEQUINOX
  public void setEQUINOX(String in)
insert the value of the EQUINOX keyword into this metadata list
Parameters:
md - the Metadata list to insert value into
in - the value of the EQUINOX keyword
 o setEPOCH
  public static void setEPOCH(Metadata md,
                              String in)
insert the value of the EPOCH keyword into a metadata list
Parameters:
md - the Metadata list to insert value into
in - the value of the EPOCH keyword
 o setEPOCH
  public void setEPOCH(String in)
insert the value of the EPOCH keyword into this metadata list
Parameters:
md - the Metadata list to insert value into
in - the value of the EPOCH keyword
 o modernize
  public static void modernize(Metadata md)
convert deprecated metadata into their modern alternatives. Currently, this includes converting CROTAi values into a PC matrix and converting the NCP projection to SIN. Note that if NCP is found to be the projection type, any previously existing projection parameters will be overriden. On the other hand, if both a PC matrix and CROTA values are found, the PC matrix will not be overriden unless it is found to be of the wrong dimensionality (i.e. != NAXIS^2).
Parameters:
md - the Metadata list to be updated
 o modernize
  public void modernize()
convert deprecated metadata into their modern alternatives. Currently, this includes converting CROTAi values into a PC matrix and converting the NCP projection to SIN. Note that if NCP is found to be the projection type, any previously existing projection parameters will be overriden. On the other hand, if both a PC matrix and CROTA values are found, the PC matrix will not be overriden unless it is found to be of the wrong dimensionality (i.e. != NAXIS^2).
Parameters:
md - the Metadata list to be updated
 o scanHeaderCard
  public static String scanHeaderCard(Metadata md,
                                      String line)
scan an 80-character line of a FITS header and load the data in the metadata list if it is recognized as pertaining to the coordinate system. The input line need not be strictly 80 characters long, as long as it contains the contents of only one FITS header card. The card is allowed to end in characters indicating the end of a line (i.e. \n, \r, \m\r). Since the line may have contained a deprecated FITS keyword, it is a good idea to run modernize on the metadata list after all metadata have been loaded.
Parameters:
md - the Metadata list to insert value into
line - the FITS header line
Returns:
String the keyword that was extracted, or null data was not saved to the metadata list
 o scanHeaderCard
  public String scanHeaderCard(String card)
scan an 80-character line of a FITS header and load the data in this metadata list if it is recognized as pertaining to the coordinate system. The input line need not be strictly 80 characters long, as long as it contains the contents of only one FITS header card. The card is allowed to end in characters indicating the end of a line (i.e. \n, \r, \m\r). Since the line may have contained a deprecated FITS keyword, it is a good idea to run modernize on the metadata list after all metadata have been loaded.
Parameters:
card - the FITS header line
Returns:
String the keyword that was extracted, or null data was not saved to the metadata list
 o scanHeader
  public static int scanHeader(Metadata md,
                               InputStream header) throws IOException
scan FITS header and loads all the data recognized as pertaining to the coordinate system. Note that this method will run modernize() on the metadata list after all the data have been loaded.
Parameters:
md - the Metadata list to insert value into
header - the stream containing the header
Returns:
int the number of lines recognized as containing needed data
 o scanHeader
  public int scanHeader(InputStream header) throws IOException
scan FITS header and loads all the data recognized as pertaining to the coordinate system. Note that this method will run modernize() on the metadata list after all the data have been loaded.
Parameters:
header - the stream containing the header
Returns:
int the number of lines recognized as containing needed data
 o FITSkeyval
  public static String FITSkeyval(String line)
return the value portion of a key-value pair from FITS header line. If the value is a string, the quotes will be removed.
 o createCoordSys
  public static CoordinateSystem createCoordSys(Metadata md) throws IllegalTransformException
create the coordinate system described by a metadata set. Currently, the real type of the returned system is ncsa.horizon.coordinates.systems.SphLinCoordinateSystem.
Parameters:
md - the Metadata describing the system
 o createCoordSys
  public CoordinateSystem createCoordSys() throws IllegalTransformException
create the coordinate system described by this metadata set. Currently, the real type of the returned system is ncsa.horizon.coordinates.systems.SphLinCoordinateSystem.
 o main
  public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index