Documentation
¶
Overview ¶
Package fits reads the images and binary tables in FITS files as the FITS Standard 4.0 describes them, and refuses the rest. It reads a header's cards, an image's pixels a row at a time, a table's cells a few thousand rows at a time, and where an image lies on the sky.
The image is the primary array or an `IMAGE` extension. Its pixels are any of the six types the standard allows. They are scaled by `BSCALE` and `BZERO`, and `BLANK` is read as no value.
The table is the first `BINTABLE` extension. A column is read when it holds one value a row: a logical, an integer of one to eight bytes, a single or double float, or text. `TSCAL` and `TZERO` scale the numbers.
An image or a table is also opened by the `EXTNAME` of its HDU.
A column of many numbers a row is read whole by Row.Floats, in the shape its `TDIM` gives. The one-value readers refuse it.
An integer equal to its column's `TNULL`, and a float that is not a number, are read as no value. A `TNULL` on a float column is ignored: archives write one on every column, and a float's null is not a number whatever the card says.
Where it lies on the sky is read from the world coordinate cards. The projections read are TAN and CAR, in equatorial or galactic coordinates. A TAN projection with `-SIP` in its `CTYPE` is read with its distortion polynomials, and an alternate system by its key letter.
Anything else is refused, and each refusal says why in words.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Column ¶ added in v0.0.7
type Column struct {
// contains filtered or unexported fields
}
Column is one column of a binary table: its name and unit as the header gives them, the kind of value it holds, how many a row, and where it lies in a row.
func (Column) Count ¶ added in v0.0.7
Count is how many values a row holds in the column: one, or more in a column of many, which Row.Floats reads. Text is one value however many characters it holds.
func (Column) Dims ¶ added in v0.0.10
Dims is the shape of a cell's values, from the column's TDIM: the length of each axis, the first axis the one that runs fastest in the row, as Row.Floats gives the values. A column with no TDIM has one axis of all its values. A text column's axes are in characters.
func (Column) Kind ¶ added in v0.0.7
Kind is the letter of the column's TFORM: what each value is and how many bytes it takes, L, B, I, J, K, E, D or A.
type Frame ¶
type Frame string
Frame is the coordinates an image's axes are in.
const ( // Equatorial is right ascension and declination, ICRS. FK5 at the // J2000 equinox is read as ICRS: the two differ by tens of // milliarcseconds, far below any pixel here. Equatorial Frame = "equatorial" // Galactic is galactic longitude and latitude. Galactic Frame = "galactic" )
The frames an image may be in.
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header is a header's cards by keyword. Each value is kept as its card writes it, with its comment taken off.
func ReadHeader ¶
ReadHeader is the header at the front of a reader, read a block at a time to its END card. Headers that end before their END card are refused.
func (*Header) Integer ¶ added in v0.0.7
Integer is a keyword's value as a whole number, read whole: one too large for a float to hold is read exactly. It refuses a value that is not a whole number.
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image is a two-dimensional image in a FITS file. Its rows are read as they are asked for.
func Open ¶
Open is the first two-dimensional image in a file: the primary array or an IMAGE extension. HDUs that hold no image are stepped over. Tables and empty primaries are such. Files with no image are refused.
func OpenNamed ¶ added in v0.0.10
OpenNamed is the two-dimensional image in the HDU whose EXTNAME is a name: the primary array or an IMAGE extension. The first HDU of the name is the one taken. It refuses a name no HDU has, saying the names there are, and an HDU of that name that holds no image.
func (*Image) Row ¶
Row is the values of one row. The first row is the bottom one, as the standard counts them. Each is BZERO more than BSCALE times the stored value. Stored BLANKs are NaN, and so are floats that are not a number.
func (*Image) SkyAlternate ¶ added in v0.0.10
SkyAlternate is where the image's alternate world coordinate system of a key lies on the sky. See SkyOfAlternate.
type Row ¶ added in v0.0.7
type Row struct {
// contains filtered or unexported fields
}
Row is one row of a table, counted from none. It is read from the file when a cell of it is asked for. It refuses a row the table does not have.
func (Row) Float ¶ added in v0.0.7
Float is a cell's value as a number, scaled by the column's TSCAL and TZERO. A float that is not a number, and an integer equal to the column's TNULL, read as not a number. It refuses a column of text or of logical values, and a column of many values a row.
func (Row) Floats ¶ added in v0.0.10
Floats is the values of a cell as numbers, in the order the row stores them, each scaled as Float scales it and each not a number as Float reads it. A column of one value gives one. It refuses a column of text or of logical values. Dims is their shape.
func (Row) Int ¶ added in v0.0.7
Int is a cell's value as a whole number, unscaled, and whether it is one: false for the column's TNULL. It refuses a column that holds no integers, and a column of many values a row.
type Sky ¶
type Sky struct {
// contains filtered or unexported fields
}
Sky is where an image's pixels lie on the sky: a projection about a reference point, and the matrix that turns pixels into degrees.
func SkyOf ¶
SkyOf is where a header says its image lies on the sky. It refuses a projection or a frame it does not read, and axes not in degrees.
It refuses a CAR grid not about the equator and a pole moved from where the projection puts it. It refuses an equinox other than J2000 and a pixel matrix with no inverse.
A TAN projection whose CTYPE ends in -SIP is read with its SIP distortion polynomials, A and B before the pixel matrix, as Shupe and others 2005 give them.
func SkyOfAlternate ¶ added in v0.0.10
SkyOfAlternate is where an alternate world coordinate system of a header lies on the sky. The key is one capital letter, A to Z, and each card of the system ends in it: CRPIX1A, CTYPE1A, CD1_1A and the rest. The primary system is SkyOf's, and is not touched.
It refuses what SkyOf refuses, a key that is not a capital letter, and a system with no cards under the key. It refuses -SIP under a key, since the paper does not address alternate keys.
func (*Sky) Inverts ¶ added in v0.0.10
Inverts is whether Pixel can find a pixel. It is false for a SIP header with no AP and BP coefficients: the paper gives the sky to pixel direction only by those, and this package does not iterate the A and B polynomials to find it.
func (*Sky) Pixel ¶
Pixel is the pixel at a longitude and latitude, in degrees in the image's frame. seen is false for a place a tangent projection cannot show: on the far half of the sky from its centre.
With SIP it is the pixel by the AP and BP polynomials, which the paper calls an approximation: a pixel taken to the sky and back lands near where it started, not on it. seen is false when the header has none.
type Table ¶ added in v0.0.7
type Table struct {
// contains filtered or unexported fields
}
Table is a binary table extension in a FITS file: columns of numbers and text in rows of one width, read as they are asked for, a few thousand rows at a time.
func OpenTable ¶ added in v0.0.7
OpenTable is the first binary table in a file. HDUs that hold no table are stepped over: the primary array, images, and anything else the standard sizes. Files with no table are refused, and so is a table whose columns this package does not read.
func OpenTableNamed ¶ added in v0.0.10
OpenTableNamed is the binary table in the HDU whose EXTNAME is a name. The first HDU of the name is the one taken. It refuses a name no HDU has, saying the names there are, and an HDU of that name that is no binary table.
func (*Table) Column ¶ added in v0.0.7
Column is the column of a name. It refuses a name the table lacks.