fits-parse-0.3.4: Parse FITS files
Copyright(c) Zac Slade 2023
LicenseBSD2
Maintainerkrakrjak@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Fits

Description

Definitions for the data types needed to parse an HDU in a FITS block.

Synopsis

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 #

Remove the Pix wrapper for floating point Pix lists.

Main data types

data HeaderDataUnit Source #

The HeaderDataUnit is the full HDU. Both the header information is encoded alongside the data payload.

Constructors

HeaderDataUnit 

Fields

Instances

Instances details
Show HeaderDataUnit Source # 
Instance details

Defined in Data.Fits

data Pix Source #

Following BitPixFormat we have a tag for integer and floating point values. We box them up to ease parsing.

Constructors

PB Int 
PI16 Int 
PI32 Int 
PI64 Int 
PF Double 
PD Double 

Header Data Types

newtype Header 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.

Constructors

Header 

Instances

Instances details
Show Header Source # 
Instance details

Defined in Data.Fits

Eq Header Source # 
Instance details

Defined in Data.Fits

Methods

(==) :: Header -> Header -> Bool #

(/=) :: Header -> Header -> Bool #

data Extension Source #

Constructors

Primary

Any header data unit can use the primary format. The first MUST be Primary. This is equivalent to having no extension

Image

An encoded image. PCOUNT and GCOUNT are required but irrelevant

BinTable

A Binary table. PCOUNT is the number of bytes that follow the data in the heap

Fields

Instances

Instances details
Show Extension Source # 
Instance details

Defined in Data.Fits

Eq Extension Source # 
Instance details

Defined in Data.Fits

newtype Keyword Source #

The Text wrapper for HDU the keyword data for lines of the form: KEYWORD=VALUE

Constructors

Keyword Text 

Instances

Instances details
IsString Keyword Source # 
Instance details

Defined in Data.Fits

Methods

fromString :: String -> Keyword #

Show Keyword Source # 
Instance details

Defined in Data.Fits

Eq Keyword Source # 
Instance details

Defined in Data.Fits

Methods

(==) :: Keyword -> Keyword -> Bool #

(/=) :: Keyword -> Keyword -> Bool #

Ord Keyword Source # 
Instance details

Defined in Data.Fits

data Value Source #

Value datatype for discriminating valid FITS KEYWORD=VALUE types in an HDU.

Instances

Instances details
Show Value Source # 
Instance details

Defined in Data.Fits

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Eq Value Source # 
Instance details

Defined in Data.Fits

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

data LogicalConstant Source #

Direct encoding of a Bool for parsing Value

Constructors

T 
F 

Instances

Instances details
Show LogicalConstant Source # 
Instance details

Defined in Data.Fits

Eq LogicalConstant Source # 
Instance details

Defined in Data.Fits

data Dimensions Source #

When we load a header, we parse the BITPIX and NAXIS(N) keywords so we - can know how long the data array is

Constructors

Dimensions 

Instances

Instances details
Show Dimensions Source # 
Instance details

Defined in Data.Fits

Eq Dimensions Source # 
Instance details

Defined in Data.Fits

newtype Comment Source #

Constructors

Comment Text 

Instances

Instances details
IsString Comment Source # 
Instance details

Defined in Data.Fits

Methods

fromString :: String -> Comment #

Show Comment Source # 
Instance details

Defined in Data.Fits

Eq Comment Source # 
Instance details

Defined in Data.Fits

Methods

(==) :: Comment -> Comment -> Bool #

(/=) :: Comment -> Comment -> Bool #

Ord Comment Source # 
Instance details

Defined in Data.Fits

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.

Constructors

Conformant 
NonConformant 

Instances

Instances details
Show SimpleFormat Source #

Value of SIMPLE=T in the header. supported NonConformat ^ Value of SIMPLE=F in the header. unsupported

Instance details

Defined in Data.Fits

Eq SimpleFormat Source # 
Instance details

Defined in Data.Fits

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.

Constructors

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

Instances details
Show BitPixFormat Source # 
Instance details

Defined in Data.Fits

Eq BitPixFormat Source # 
Instance details

Defined in Data.Fits

type Axes = [Int] Source #

Axes represents the combination of NAXIS + NAXISn. The spec supports up to 999 axes

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 -> Int Source #

This utility function can be used to get the word count for data in an HDU.

bitPixToByteSize :: BitPixFormat -> Int Source #

This utility function can be used to get the size in bytes of the - format.

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.