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.
-
defaultDecFormatter
-
-
defaultLinearFormatter
-
-
defaultRAFormatter
-
-
FITSCoordMetadata()
- Construct a CoordMetadata list for a FITS image
-
FITSCoordMetadata(int)
- Creates an empty metadatum list with specified defaults.
-
FITSCoordMetadata(int, Metadata)
- Creates an metadatum list for a coordinate system with naxes axes
-
FITSCoordMetadata(Metadata)
- Creates an empty metadatum list with specified defaults.
-
createCoordSys()
- create the coordinate system described by this metadata set.
-
createCoordSys(Metadata)
- create the coordinate system described by a metadata set.
-
FITSkeyval(String)
- return the value portion of a key-value pair from FITS header line.
-
getIdentityPCMatrix(int)
- return a Metavector object containing a PCMatrix whose values
are equal to 1 on the diagonal and 0 otherwise.
-
getLONLATName(char)
- return the name horizon gives to various kinds of longitude and
latitude based on the first letter of the CTYPE string.
-
getNAXIS()
- return the value of FITS keyword NAXIS, the number of axes in the
dataset
-
getNAXIS(Metadata)
- return the value of FITS keyword NAXIS, the number of axes in the
dataset
-
main(String[])
-
-
modernize()
- convert deprecated metadata into their modern alternatives.
-
modernize(Metadata)
- convert deprecated metadata into their modern alternatives.
-
parseAfterDash(String)
- return the string appearing after one or more dashes in a string
-
scanHeader(InputStream)
- scan FITS header and loads all the data recognized as pertaining to
the coordinate system.
-
scanHeader(Metadata, InputStream)
- scan FITS header and loads all the data recognized as pertaining to
the coordinate system.
-
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.
-
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.
-
setCDELT(int, double)
- insert a voxel width into this metadata list
-
setCDELT(Metadata, int, double)
- insert a voxel width into a metadata list
-
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.
-
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.
-
setCRPIX(int, double)
- insert an axis reference data position into this metadata list
-
setCRPIX(Metadata, int, double)
- insert an axis reference data position into a metadata list
-
setCRVAL(int, double)
- insert an axis reference value into this metadata list
-
setCRVAL(Metadata, int, double)
- insert an axis reference value into a metadata list
-
setCTYPE(int, String)
- insert the name and type information into this metadata list
-
setCTYPE(Metadata, int, String)
- insert the name and type information into a metadata list
-
setEPOCH(Metadata, String)
- insert the value of the EPOCH keyword into a metadata list
-
setEPOCH(String)
- insert the value of the EPOCH keyword into this metadata list
-
setEQUINOX(Metadata, String)
- insert the value of the EQUINOX keyword into a metadata list
-
setEQUINOX(String)
- insert the value of the EQUINOX keyword into this metadata list
-
setLATPOLE(double)
- insert the value of FITS keyword LATPOLE into this metadata list
-
setLATPOLE(Metadata, double)
- a the value of FITS keyword LATPOLE into a metadata list
-
setLONGPOLE(double)
- insert the value of FITS keyword LONGPOLE into this metadata list
-
setLONGPOLE(Metadata, double)
- a the value of FITS keyword LONGPOLE into a metadata list
-
setNAXIS(int)
- insert the number of axes into this metadata list
-
setNAXIS(Metadata, int)
- insert the number of axes into a metadata list
-
setPCMatrix(double[])
- insert a PC matrix into this metadata list
-
setPCMatrix(int, int, double)
- insert an element of the PC matrix into a metadata list.
-
setPCMatrix(Metadata, double[])
- insert a PC matrix into a metadata list
-
setPCMatrix(Metadata, int, int, double)
- insert an element of the PC matrix into a metadata list.
-
setPROJP(double[])
- insert an array of projection parameters in this metadata list
-
setPROJP(int, double)
- insert an element of the array of projection parameters
-
setPROJP(Metadata, double[])
- insert an array of projection parameters in a metadata list
-
setPROJP(Metadata, int, double)
- insert an element of the array of projection parameters
-
setRADECSYS(Metadata, String)
- insert the value of the RADECSYS keyword into a metadata list
-
setRADECSYS(String)
- insert the value of the RADECSYS keyword into this metadata list
-
setVeloStandard(int, String)
- set the value of the velocity standard in use for specific axis
-
setVeloStandard(Metadata, int, String)
- set the value of the velocity standard in use for specific axis
-
setVeloStandard(Metadata, String)
- set the value of the default velocity standard for the entire
coordinate system
-
setVeloStandard(String)
- set the value of the default velocity standard for the entire
coordinate system
defaultRAFormatter
public final static AxisPosFormatter defaultRAFormatter
defaultDecFormatter
public final static AxisPosFormatter defaultDecFormatter
defaultLinearFormatter
public final static AxisPosFormatter defaultLinearFormatter
FITSCoordMetadata
public FITSCoordMetadata()
- Construct a CoordMetadata list for a FITS image
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)
FITSCoordMetadata
public FITSCoordMetadata(int naxes) throws ArrayIndexOutOfBoundsException
- Creates an empty metadatum list with specified defaults.
- Parameters:
- defaults - the defaults
FITSCoordMetadata
public FITSCoordMetadata(Metadata defaults) throws ArrayIndexOutOfBoundsException
- Creates an empty metadatum list with specified defaults.
- Parameters:
- defaults - the defaults
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
getNAXIS
public int getNAXIS()
- return the value of FITS keyword NAXIS, the number of axes in the
dataset
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
setNAXIS
public void setNAXIS(int nax)
- insert the number of axes into this metadata list
- Parameters:
- nax - the value of the NAXIS keyword
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
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
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 }.
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
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
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
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
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
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
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
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
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
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".
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".
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".
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".
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
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
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
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
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
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
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
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
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.
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
setPROJP
public void setPROJP(double in[])
- insert an array of projection parameters in this metadata list
- Parameters:
- in - an array containing the projection parameters
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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.
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index