Type Conversions
The following tables give the correspondances between CFITSIO "types", the BITPIX keyword and Julia types.
CFITSIO Types
| CODE | CFITSIO | Julia |
|---|---|---|
| int | Cint | |
| long | Clong | |
| LONGLONG | Int64 |
FITS BITPIX
| CODE | CFITSIO | Julia |
|---|---|---|
| 8 | BYTE_IMG | UInt8 |
| 16 | SHORT_IMG | Int16 |
| 32 | LONG_IMG | Int32 |
| 64 | LONGLONG_IMG | Int64 |
| -32 | FLOAT_IMG | Float32 |
| -64 | DOUBLE_IMG | Float64 |
CFITSIO Aliases
| CODE | CFITSIO | Julia | Comments |
|---|---|---|---|
| 10 | SBYTE_IMG | Int8 | written as: BITPIX = 8, BSCALE = 1, BZERO = -128 |
| 20 | USHORT_IMG | UInt16 | written as: BITPIX = 16, BSCALE = 1, BZERO = 32768 |
| 40 | LONG_IMG | UInt32 | written as: BITPIX = 32, BSCALE = 1, BZERO = 2147483648 |
| 80 | ULONGLONG_IMG | UInt64 | written as: BITPIX = 64, BSCALE = 1, BZERO = 9223372036854775808 |
FITS Table Data Types
| CODE | CFITSIO | Julia |
|---|---|---|
| 1 | TBIT | |
| 11 | TBYTE | Cuchar, UInt8 |
| 12 | TSBYTE | Cchar, Int8 |
| 14 | TLOGICAL | Bool |
| 16 | TSTRING | String |
| 20 | TUSHORT | Cushort |
| 21 | TSHORT | Cshort |
| 30 | TUINT | Cuint |
| 31 | TINT | Cint |
| 40 | TULONG | Culong |
| 41 | TLONG | Clong |
| 42 | TFLOAT | Cfloat |
| 80 | TULONGLONG | UInt64 |
| 81 | TLONGLONG | Int64 |
| 82 | TDOUBLE | Cdouble |
| 83 | TCOMPLEX | Complex{Cfloat} |
| 163 | TDBLCOMPLEX | Complex{Cdouble} |
CFITSIO.bitpix_from_type — Functionbitpix_from_type(::Type)::CintReturn the FITS BITPIX code for the given Julia type
Example
julia> CFITSIO.bitpix_from_type(Int64)
64See also type_from_bitpix
CFITSIO.type_from_bitpix — Functiontype_from_bitpix(::Integer)::TypeReturn the Julia type from the FITS BITPIX code
Example
julia> CFITSIO.type_from_bitpix(64)
Int64See also bitpix_from_type
CFITSIO.cfitsio_typecode — Functioncfitsio_typecode(::Type)::CintReturn the CFITSIO type code for the given Julia type.
Example
julia> CFITSIO.cfitsio_typecode(Int64)
81