fits-parse-0.0.1: Parse FITS files

Copyright(c) Zac Slade 2018
LicenseBSD2
Maintainerkrakrjak@gmail.com
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Data.Fits

Contents

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 Axis payload.

Constructors

HeaderDataUnit 

Fields

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.

Instances
Default HeaderData Source # 
Instance details

Defined in Data.Fits

Methods

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.

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
Show BitPixFormat 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

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

Value of SIMPLE=T in the header. supported

NonConformant

Value of SIMPLE=F in the header. unsupported

data Axis Source #

Axis represents a single NAXIS record.

Constructors

Axis 

Fields

Instances
Default Axis Source #

The default instance for Axis is NAXIS=0 with zero elements.

Instance details

Defined in Data.Fits

Methods

def :: 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).

Constructors

NullString

The NULL character string (e.g. AUTHOR=)

EmptyString

An empty string (e.g. AUTHOR="")

DataString

Plain ASCII data

Instances
Show StringType Source # 
Instance details

Defined in Data.Fits

data StringValue Source #

A StringValue is a type paired with a possible value.

Constructors

StringValue 

Fields

Instances
Show StringValue Source # 
Instance details

Defined in Data.Fits

Default StringValue Source #

The default instance of StringValue is an undefined string with no text.

Instance details

Defined in Data.Fits

Methods

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.

Constructors

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

Constructors

Positive

HDU positive number value

Negative

HDU negative number value

Zero

HDU numeric value is zero, could be positive or negative

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.

Constructors

NumberValue 

Fields

Instances
Default NumberValue Source #

The default instance for NumberValue is a 32-bit integer of zero with no imaginary or exponent parts.

Instance details

Defined in Data.Fits

Methods

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.