Copyright | (c) Zac Slade 2018 |
---|---|
License | BSD2 |
Maintainer | krakrjak@gmail.com |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Definitions for the data types needed to parse an HDU in a FITS block.
Synopsis
- parsePix :: Int -> BitPixFormat -> ByteString -> IO [Pix]
- pixsUnwrapI :: BitPixFormat -> [Pix] -> [Int]
- pixsUnwrapD :: BitPixFormat -> [Pix] -> [Double]
- data HeaderDataUnit = HeaderDataUnit {}
- data HeaderData = HeaderData {
- simpleFormat :: SimpleFormat
- bitPixFormat :: BitPixFormat
- axes :: [Axis]
- objectIdentifier :: StringValue
- observationDate :: StringValue
- originIdentifier :: StringValue
- telescopeIdentifier :: StringValue
- instrumentIdentifier :: StringValue
- observerIdentifier :: StringValue
- authorIdentifier :: StringValue
- referenceString :: StringValue
- data BitPixFormat
- data Pix
- data SimpleFormat
- data Axis = Axis {
- axisNumber :: Int
- axisElementCount :: Int
- data StringType
- data StringValue = StringValue {}
- data NumberType
- data NumberModifier
- data NumberValue = NumberValue {}
- isBitPixInt :: BitPixFormat -> Bool
- isBitPixFloat :: BitPixFormat -> Bool
- bitPixToWordSize :: BitPixFormat -> Natural
- hduRecordLength :: Int
- hduMaxRecords :: Int
- hduBlockSize :: Int
Data payload functions
parsePix :: Int -> BitPixFormat -> ByteString -> IO [Pix] Source #
This is the main low-level function which parses the data portion of an HDU. You need and element count, a format and a bytestring. The resulting list is produced in column-row major order as specified in the standard.
pixsUnwrapI :: BitPixFormat -> [Pix] -> [Int] Source #
Remove the Pix wrapper for integer Pix
lists.
pixsUnwrapD :: BitPixFormat -> [Pix] -> [Double] Source #
Main data types
data HeaderDataUnit Source #
The HeaderDataUnit
is the full HDU. Both the header information is
encoded alongside the Axis
payload.
HeaderDataUnit | |
|
data HeaderData Source #
The header part of the HDU is vital carrying not only authorship
metadata, but also specifying how to make sense of the binary payload
that starts 2,880 bytes after the start of the HeaderData
.
HeaderData | |
|
Instances
Default HeaderData Source # | |
Defined in Data.Fits def :: HeaderData # |
data BitPixFormat Source #
The BitPixFormat
is the nitty gritty of how the Axis
data is layed
out in the file. The standard recognizes six formats: unsigned 8 bit
integer, two's complement binary integers at 16, 32, and 64 bits along
with 32 and 64 bit IEEE floating point formats.
EightBitInt | BITPIX = 8; unsigned binary integer of 8 bits |
SixteenBitInt | BITPIX = 16; two's complement binary integer of 16 bits |
ThirtyTwoBitInt | BITPIX = 32; two's complement binary integer of 32 bits |
SixtyFourBitInt | BITPIX = 64; two's complement binary integer of 64 bits |
ThirtyTwoBitFloat | BITPIX = -32; IEEE single precision floating point of 32 bits |
SixtyFourBitFloat | BITPIX = -64; IEEE double precision floating point of 64 bits |
Instances
Show BitPixFormat Source # | |
Defined in Data.Fits showsPrec :: Int -> BitPixFormat -> ShowS # show :: BitPixFormat -> String # showList :: [BitPixFormat] -> ShowS # |
Following BitPixFormat
we have a tag for integer and floating point
values. We box them up to ease parsing.
Header Data Types
data SimpleFormat Source #
The standard defines two possible values for the SIMPLE keyword, T and
F. The T refers to a Conformant
format while F refers to
a NonConformant
format. At this time only the Conformant
, T, format
is supported.
Conformant | Value of SIMPLE=T in the header. supported |
NonConformant | Value of SIMPLE=F in the header. unsupported |
Axis
represents a single NAXIS record.
Axis | |
|
data StringType Source #
There are many types of strings defined in the FITS documentation. Refered to as "character string(s)" in the documentation, they can be null, empty, undefined, or contain characters (printable ASCII only).
NullString | The NULL character string (e.g. AUTHOR=) |
EmptyString | An empty string (e.g. AUTHOR="") |
DataString | Plain ASCII data |
Instances
Show StringType Source # | |
Defined in Data.Fits showsPrec :: Int -> StringType -> ShowS # show :: StringType -> String # showList :: [StringType] -> ShowS # |
data StringValue Source #
A StringValue
is a type paired with a possible value.
StringValue | |
|
Instances
Show StringValue Source # | |
Defined in Data.Fits showsPrec :: Int -> StringValue -> ShowS # show :: StringValue -> String # showList :: [StringValue] -> ShowS # | |
Default StringValue Source # | The default instance of |
Defined in Data.Fits def :: StringValue # |
data NumberType Source #
The FITS standard allows for the encoding of unsigned integers, signed integers, real numbers, and complex numbers. They are always ASCII encoded. See 5.2 of the standard for more details.
IntegerType | HDU ASCII encoded integer number |
RealType | HDU ASCII encoded real number |
ComplexType | HDU ASCII encoded complex number |
data NumberModifier Source #
Utility data type to help with the ASCII representation of numbers
data NumberValue Source #
NumberValue
contains an encoded numeric record from a data field.
This data type still needs to be converted into more useful Haskell data
types.
NumberValue | |
|
Instances
Default NumberValue Source # | The default instance for |
Defined in Data.Fits def :: NumberValue # |
Utility
isBitPixInt :: BitPixFormat -> Bool Source #
This utility functions quickly lets you know if you are dealing with integer data.
isBitPixFloat :: BitPixFormat -> Bool Source #
This utility functions quickly lets you know if you are dealing with floating point data.
bitPixToWordSize :: BitPixFormat -> Natural Source #
This utility function can be used to get the word count for data in an HDU.
Constants
hduRecordLength :: Int Source #
A single record in the HDU is an eighty byte word.
hduMaxRecords :: Int Source #
The maximum amount of eighty byte records is thirty-six per the standard.
hduBlockSize :: Int Source #
The size of an HDU block is fixed at thirty-six eighty byte words. In other words 2,880 bytes. These blocks are padded with zeros to this boundary.