Versions in this module Expand all Collapse all v1 v1.2.1 Apr 14, 2026 Changes in this version + func ReadFrame(path string) (pix []float32, width, height int, err error) + func ReadFrameRGB(path string) (r, g, b []float32, width, height int, err error) + func WriteMono(path string, pix []float32, width, height int) error + func WriteRGB(path string, r, g, b []float32, width, height int) error v1.2.0 Apr 12, 2026 Changes in this version + func ReadFloat32(h HDU) ([]float32, error) v1.1.0 Apr 9, 2026 v1.0.4 Apr 9, 2026 v1.0.3 Apr 6, 2026 v1.0.2 Apr 6, 2026 v1.0.1 Apr 6, 2026 v1.0.0 Apr 6, 2026 Changes in this version + var ErrEmptyFile = errors.New("fits: empty file") + var ErrKeyNotFound = errors.New("fits: key not found") + var ErrNotFITS = errors.New("fits: not a FITS file") + var ErrNotImageCompatible = errors.New("fits: not image.Image-compatible") + var ErrNotImageHDU = errors.New("fits: not an image HDU") + var ErrRandomGroups = errors.New("fits: random-groups HDUs not supported") + var ErrReadOnly = errors.New("fits: file is read-only") + var ErrShapeMismatch = errors.New("fits: shape mismatch") + var ErrTypeMismatch = errors.New("fits: type mismatch") + var FloatGrayModel color.Model = floatGrayModel + func CanConvert[T Numeric](h *ImageHDU) bool + func Decode(r io.Reader) (image.Image, error) + func DecodeConfig(r io.Reader) (image.Config, error) + func EditFile(path string, fn func(in *File, out *Writer) error) error + func EditFileContext(ctx context.Context, path string, fn func(in *File, out *Writer) error) error + func OverwritePixels[T Numeric](h *ImageHDU, data []T) error + func ReadASCIIColumn[T ColumnValue](t *ASCIITableHDU, col int) ([]T, error) + func ReadColumn[T ColumnValue](t *BinaryTableHDU, col int) ([]T, error) + func ReadPixelsCompressedContext[T Numeric](ctx context.Context, h *CompressedImageHDU) ([]T, error) + func ReadPixelsCompressed[T Numeric](h *CompressedImageHDU) ([]T, error) + func ReadPixelsContext[T Numeric](ctx context.Context, h *ImageHDU) ([]T, error) + func ReadPixelsMasked[T Numeric](h *ImageHDU) ([]T, []bool, error) + func ReadPixels[T Numeric](h *ImageHDU) ([]T, error) + func ReadSubset[T Numeric](h *ImageHDU, lower, upper, stride []int64) ([]T, error) + func ReadVectorColumn[T Numeric](t *BinaryTableHDU, col int) ([]T, error) + func VerifyChecksum(h HDU) error + func WriteChecksum(h HDU) (dataSum, checkSum uint32, err error) + type ASCIITableHDU struct + func (*ASCIITableHDU) Compressed() bool + func (*ASCIITableHDU) CompressionType() string + func (h *ASCIITableHDU) ColumnByName(name string) (Column, bool) + func (h *ASCIITableHDU) Columns() ([]Column, error) + func (h *ASCIITableHDU) Header() *header.Header + func (h *ASCIITableHDU) Index() int + func (h *ASCIITableHDU) NumRows() int64 + func (h *ASCIITableHDU) Type() HDUType + type BinaryTableHDU struct + func AppendBinaryTable(f *File, hdr *header.Header, cols []ColumnData) (*BinaryTableHDU, error) + func (*BinaryTableHDU) Compressed() bool + func (*BinaryTableHDU) CompressionType() string + func (h *BinaryTableHDU) ColumnByName(name string) (Column, bool) + func (h *BinaryTableHDU) ColumnIndex(name string) int + func (h *BinaryTableHDU) Columns() ([]Column, error) + func (h *BinaryTableHDU) Header() *header.Header + func (h *BinaryTableHDU) Index() int + func (h *BinaryTableHDU) NumRows() int64 + func (h *BinaryTableHDU) RowBytes(row int64) ([]byte, error) + func (h *BinaryTableHDU) Type() HDUType + type Column struct + Dim []int64 + Display string + Index int + Name string + Null any + Repeat int64 + Scale float64 + TForm string + Type ColumnType + Unit string + Zero float64 + type ColumnData struct + DataBool []bool + DataFloat32 []float32 + DataFloat64 []float64 + DataInt16 []int16 + DataInt32 []int32 + DataInt64 []int64 + DataString []string + DataUint8 []uint8 + DataVarFloat32 [][]float32 + DataVarFloat64 [][]float64 + DataVarInt16 [][]int16 + DataVarInt32 [][]int32 + DataVarInt64 [][]int64 + DataVarUint8 [][]uint8 + Dim []int64 + Display string + Name string + TForm string + Unit string + type ColumnType int + const ColBit + const ColByte + const ColComplex128 + const ColComplex64 + const ColFloat32 + const ColFloat64 + const ColInt16 + const ColInt32 + const ColInt64 + const ColLogical + const ColString + const ColVarArray + type ColumnValue interface + type CompressFloatOptions struct + Algorithm compress.Algorithm + BlockSize int + DitherMethod compress.DitherMethod + NullValue float32 + Nullcheck bool + QLevel float32 + TileShape []int64 + ZDither0 int + type CompressOptions struct + Algorithm compress.Algorithm + BlockSize int + HCompressScale int + TileShape []int64 + ZDither0 int + type CompressedImageHDU struct + func AppendCompressedFloat32Image(f *File, hdr *header.Header, shape []int64, data []float32, ...) (*CompressedImageHDU, error) + func AppendCompressedImage[T Numeric](f *File, hdr *header.Header, shape []int64, data []T, opts CompressOptions) (*CompressedImageHDU, error) + func (h *CompressedImageHDU) BITPIX() int + func (h *CompressedImageHDU) BSCALE() float64 + func (h *CompressedImageHDU) BZERO() float64 + func (h *CompressedImageHDU) Compressed() bool + func (h *CompressedImageHDU) CompressionType() string + func (h *CompressedImageHDU) Header() *header.Header + func (h *CompressedImageHDU) Index() int + func (h *CompressedImageHDU) NAXIS() int + func (h *CompressedImageHDU) Shape() []int64 + func (h *CompressedImageHDU) Type() HDUType + type ErrMissingRequiredKeyword struct + HDU int + Keyword string + func (e *ErrMissingRequiredKeyword) Error() string + type ErrTruncatedData struct + Expected int64 + Got int64 + HDU int + func (e *ErrTruncatedData) Error() string + type ErrUnterminatedHeader struct + BytesScanned int64 + HDU int + func (e *ErrUnterminatedHeader) Error() string + type File struct + func Create(name string) (*File, error) + func CreateContext(ctx context.Context, name string) (*File, error) + func CreateWriter(rws io.ReadWriteSeeker) (*File, error) + func Open(name string) (*File, error) + func OpenContext(ctx context.Context, name string) (*File, error) + func OpenForEdit(name string) (*File, error) + func OpenForEditContext(ctx context.Context, name string) (*File, error) + func OpenReadAll(r io.Reader) (*File, error) + func OpenReader(r io.ReadSeeker) (*File, error) + func (f *File) Close() error + func (f *File) CloseAndFlush() error + func (f *File) CopyTo(w io.Writer) error + func (f *File) Flush() error + func (f *File) HDU(i int) (HDU, error) + func (f *File) HDUByName(name string) (HDU, error) + func (f *File) Mode() Mode + func (f *File) Name() string + func (f *File) NumHDU() int + func (f *File) Primary() (*ImageHDU, error) + type FloatColor struct + V float32 + func (c FloatColor) RGBA() (r, g, b, a uint32) + type FloatGray struct + Pix []float32 + Rect image.Rectangle + Stride int + func (f *FloatGray) At(x, y int) color.Color + func (f *FloatGray) Bounds() image.Rectangle + func (f *FloatGray) ColorModel() color.Model + type HDU interface + Compressed func() bool + CompressionType func() string + Header func() *header.Header + Index func() int + Type func() HDUType + type HDUType int + const TypeASCIITable + const TypeBinaryTable + const TypeImage + func (t HDUType) String() string + type ImageHDU struct + func AppendImage[T Numeric](f *File, hdr *header.Header, shape []int64, data []T) (*ImageHDU, error) + func WriteImage[T Numeric](dst WriteTarget, hdr *header.Header, shape []int64, data []T) (*ImageHDU, error) + func (*ImageHDU) Compressed() bool + func (*ImageHDU) CompressionType() string + func (h *ImageHDU) AsImage() (image.Image, error) + func (h *ImageHDU) BITPIX() int + func (h *ImageHDU) BSCALE() float64 + func (h *ImageHDU) BZERO() float64 + func (h *ImageHDU) Header() *header.Header + func (h *ImageHDU) Index() int + func (h *ImageHDU) NAXIS() int + func (h *ImageHDU) Shape() []int64 + func (h *ImageHDU) Type() HDUType + type KeyNotFoundError struct + HDU int + Key string + func (e *KeyNotFoundError) Error() string + func (e *KeyNotFoundError) Is(target error) bool + type Mode int + const ModeCreate + const ModeEdit + const ModeRead + type Numeric interface + type TypeMismatchError struct + BITPIX int + Lossy bool + Requested string + func (e *TypeMismatchError) Error() string + func (e *TypeMismatchError) Is(target error) bool + type VarColumn struct + func ReadVarColumn[T Numeric](t *BinaryTableHDU, col int) (*VarColumn[T], error) + func (v *VarColumn[T]) At(row int) []T + func (v *VarColumn[T]) Len() int + func (v *VarColumn[T]) Raw() (values []T, offsets []int64) + func (v *VarColumn[T]) Rows() iter.Seq2[int, []T] + type WriteTarget interface + type Writer struct + func (w *Writer) CopyHDU(h HDU) error + func (w *Writer) CopyHDUWithHeader(h HDU, hdr *header.Header) error + func (w *Writer) SkipHDU(h HDU) error