cfitsio

package module
v0.0.0-...-ef692a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2021 License: BSD-2-Clause Imports: 11 Imported by: 0

README

cfitsio

Build Status

Naive CGo bindings for FITSIO.

Installation

$ go get github.com/astrogo/cfitsio

You, of course, need the C library CFITSIO installed and available through pkg-config.

Documentation

http://godoc.org/github.com/astrogo/cfitsio

Example

import fits "github.com/astrogo/cfitsio"

func dumpFitsTable(fname string) {
	f, err := fits.Open(fname, fits.ReadOnly)
	if err != nil {
		panic(err)
	}
	defer f.Close()

	// get the second HDU
	table := f.HDU(1).(*fits.Table)
	nrows := table.NumRows()
    rows, err := table.Read(0, nrows)
    if err != nil {
        panic(err)
    }
    defer rows.Close()
	for rows.Next() {
        var x, y float64
        var id int64
        err = rows.Scan(&id, &x, &y)
        if err != nil {
            panic(err)
        }
        fmt.Printf(">>> %v %v %v\n", id, x, y)
	}
    err = rows.Err()
    if err != nil { panic(err) }
    
    // using a struct
    xx := struct{
        Id int     `fits:"ID"`
        X  float64 `fits:"x"`
        Y  float64 `fits:"y"`
    }{}
    // using a map
    yy := make(map[string]interface{})
    
    rows, err = table.Read(0, nrows)
    if err != nil {
        panic(err)
    }
    defer rows.Close()
	for rows.Next() {
        err = rows.Scan(&xx)
        if err != nil {
            panic(err)
        }
        fmt.Printf(">>> %v\n", xx)

        err = rows.Scan(&yy)
        if err != nil {
            panic(err)
        }
        fmt.Printf(">>> %v\n", yy)
	}
    err = rows.Err()
    if err != nil { panic(err) }
    
}

TODO

  • [DONE] add support for writing tables from structs
  • [DONE] add support for writing tables from maps
  • [DONE] add support for variable length array
  • provide benchmarks wrt CFITSIO

Contribute

astrogo/cfitsio is released under the BSD-3 license. Please send a pull request to astrogo/license, adding yourself to the AUTHORS and/or CONTRIBUTORS files.

Documentation

Overview

Package cfitsio is a wrapper around the CFITSIO library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyHDU

func CopyHDU(dst, src *File, morekeys int) error

CopyHDU copies the current HDU from the FITS file associated with infptr and append it to the end of the FITS file associated with outfptr. Space may be reserved for MOREKEYS additional keywords in the output header.

func CopyTable

func CopyTable(dst, src *Table) error

CopyTable copies all the rows from src into dst.

func CopyTableRange

func CopyTableRange(dst, src *Table, beg, end int64) error

CopyTableRange copies the rows interval [beg,end) from src into dst

func Version

func Version() float32

Version returns the revision number of the CFITSIO library. The revision number will be incremented with each new release of CFITSIO.

func WriteHDU

func WriteHDU(w io.Writer, src *File) error

WriteHDU writes the current HDU in the input FITS file to the output FILE stream (e.g. stdout).

Types

type Card

type Card struct {
	Name    string
	Value   interface{}
	Comment string
}

Card is a record block (meta data) in a Header.

type Column

type Column struct {
	Name    string  // column name, corresponding to “TTYPE“ keyword
	Format  string  // column format, corresponding to “TFORM“ keyword
	Unit    string  // column unit, corresponding to “TUNIT“ keyword
	Null    string  // null value, corresponding to “TNULL“ keyword
	Bscale  float64 // bscale value, corresponding to “TSCAL“ keyword
	Bzero   float64 // bzero value, corresponding to “TZERO“ keyword
	Display string  // display format, corresponding to “TDISP“ keyword
	Dim     []int64 // column dimension corresponding to “TDIM“ keyword
	Start   int64   // column starting position, corresponding to “TBCOL“ keyword
	Type    TypeCode
	Len     int   // repeat. if <= 1: scalar
	Value   Value // value at current row
}

Column represents a column in a FITS table

type Error

type Error int

Error is a CFITSIO error status code

var (
	CREATE_DISK_FILE  Error = C.CREATE_DISK_FILE
	OPEN_DISK_FILE    Error = C.OPEN_DISK_FILE
	SKIP_TABLE        Error = C.SKIP_TABLE
	SKIP_IMAGE        Error = C.SKIP_IMAGE
	SKIP_NULL_PRIMARY Error = C.SKIP_NULL_PRIMARY
	USE_MEM_BUFF      Error = C.USE_MEM_BUFF
	OVERFLOW_ERR      Error = C.OVERFLOW_ERR
	PREPEND_PRIMARY   Error = C.PREPEND_PRIMARY
	SAME_FILE         Error = C.SAME_FILE
	TOO_MANY_FILES    Error = C.TOO_MANY_FILES
	FILE_NOT_OPENED   Error = C.FILE_NOT_OPENED
	FILE_NOT_CREATED  Error = C.FILE_NOT_CREATED
	WRITE_ERROR       Error = C.WRITE_ERROR
	END_OF_FILE       Error = C.END_OF_FILE
	READ_ERROR        Error = C.READ_ERROR
	FILE_NOT_CLOSED   Error = C.FILE_NOT_CLOSED
	ARRAY_TOO_BIG     Error = C.ARRAY_TOO_BIG
	READONLY_FILE     Error = C.READONLY_FILE
	MEMORY_ALLOCATION Error = C.MEMORY_ALLOCATION
	BAD_FILEPTR       Error = C.BAD_FILEPTR
	NULL_INPUT_PTR    Error = C.NULL_INPUT_PTR
	SEEK_ERROR        Error = C.SEEK_ERROR

	BAD_URL_PREFIX     Error = C.BAD_URL_PREFIX
	TOO_MANY_DRIVERS   Error = C.TOO_MANY_DRIVERS
	DRIVER_INIT_FAILED Error = C.DRIVER_INIT_FAILED
	NO_MATCHING_DRIVER Error = C.NO_MATCHING_DRIVER
	URL_PARSE_ERROR    Error = C.URL_PARSE_ERROR
	RANGE_PARSE_ERROR  Error = C.RANGE_PARSE_ERROR

	SHARED_ERRBASE  Error = C.SHARED_ERRBASE
	SHARED_BADARG   Error = C.SHARED_BADARG
	SHARED_NULPTR   Error = C.SHARED_NULPTR
	SHARED_TABFULL  Error = C.SHARED_TABFULL
	SHARED_NOTINIT  Error = C.SHARED_NOTINIT
	SHARED_IPCERR   Error = C.SHARED_IPCERR
	SHARED_NOMEM    Error = C.SHARED_NOMEM
	SHARED_AGAIN    Error = C.SHARED_AGAIN
	SHARED_NOFILE   Error = C.SHARED_NOFILE
	SHARED_NORESIZE Error = C.SHARED_NORESIZE

	HEADER_NOT_EMPTY Error = C.HEADER_NOT_EMPTY
	KEY_NO_EXIST     Error = C.KEY_NO_EXIST
	KEY_OUT_BOUNDS   Error = C.KEY_OUT_BOUNDS
	VALUE_UNDEFINED  Error = C.VALUE_UNDEFINED
	NO_QUOTE         Error = C.NO_QUOTE
	BAD_INDEX_KEY    Error = C.BAD_INDEX_KEY
	BAD_KEYCHAR      Error = C.BAD_KEYCHAR
	BAD_ORDER        Error = C.BAD_ORDER
	NOT_POS_INT      Error = C.NOT_POS_INT
	NO_END           Error = C.NO_END
	BAD_BITPIX       Error = C.BAD_BITPIX
	BAD_NAXIS        Error = C.BAD_NAXIS
	BAD_NAXES        Error = C.BAD_NAXES
	BAD_PCOUNT       Error = C.BAD_PCOUNT
	BAD_GCOUNT       Error = C.BAD_GCOUNT
	BAD_TFIELDS      Error = C.BAD_TFIELDS
	NEG_WIDTH        Error = C.NEG_WIDTH
	NEG_ROWS         Error = C.NEG_ROWS
	COL_NOT_FOUND    Error = C.COL_NOT_FOUND
	BAD_SIMPLE       Error = C.BAD_SIMPLE
	NO_SIMPLE        Error = C.NO_SIMPLE
	NO_BITPIX        Error = C.NO_BITPIX
	NO_NAXIS         Error = C.NO_NAXIS
	NO_NAXES         Error = C.NO_NAXES
	NO_XTENSION      Error = C.NO_XTENSION
	NOT_ATABLE       Error = C.NOT_ATABLE
	NOT_BTABLE       Error = C.NOT_BTABLE
	NO_PCOUNT        Error = C.NO_PCOUNT
	NO_GCOUNT        Error = C.NO_GCOUNT
	NO_TFIELDS       Error = C.NO_TFIELDS
	NO_TBCOL         Error = C.NO_TBCOL
	NO_TFORM         Error = C.NO_TFORM
	NOT_IMAGE        Error = C.NOT_IMAGE
	BAD_TBCOL        Error = C.BAD_TBCOL
	NOT_TABLE        Error = C.NOT_TABLE
	COL_TOO_WIDE     Error = C.COL_TOO_WIDE
	COL_NOT_UNIQUE   Error = C.COL_NOT_UNIQUE
	BAD_ROW_WIDTH    Error = C.BAD_ROW_WIDTH
	UNKNOWN_EXT      Error = C.UNKNOWN_EXT
	UNKNOWN_REC      Error = C.UNKNOWN_REC
	END_JUNK         Error = C.END_JUNK
	BAD_HEADER_FILL  Error = C.BAD_HEADER_FILL
	BAD_DATA_FILL    Error = C.BAD_DATA_FILL
	BAD_TFORM        Error = C.BAD_TFORM
	BAD_TFORM_DTYPE  Error = C.BAD_TFORM_DTYPE
	BAD_TDIM         Error = C.BAD_TDIM
	BAD_HEAP_PTR     Error = C.BAD_HEAP_PTR

	BAD_HDU_NUM       Error = C.BAD_HDU_NUM
	BAD_COL_NUM       Error = C.BAD_COL_NUM
	NEG_FILE_POS      Error = C.NEG_FILE_POS
	NEG_BYTES         Error = C.NEG_BYTES
	BAD_ROW_NUM       Error = C.BAD_ROW_NUM
	BAD_ELEM_NUM      Error = C.BAD_ELEM_NUM
	NOT_ASCII_COL     Error = C.NOT_ASCII_COL
	NOT_LOGICAL_COL   Error = C.NOT_LOGICAL_COL
	BAD_ATABLE_FORMAT Error = C.BAD_ATABLE_FORMAT
	BAD_BTABLE_FORMAT Error = C.BAD_BTABLE_FORMAT
	NO_NULL           Error = C.NO_NULL
	NOT_VARI_LEN      Error = C.NOT_VARI_LEN
	BAD_DIMEN         Error = C.BAD_DIMEN
	BAD_PIX_NUM       Error = C.BAD_PIX_NUM
	ZERO_SCALE        Error = C.ZERO_SCALE
	NEG_AXIS          Error = C.NEG_AXIS

	NOT_GROUP_TABLE       Error = C.NOT_GROUP_TABLE
	HDU_ALREADY_MEMBER    Error = C.HDU_ALREADY_MEMBER
	MEMBER_NOT_FOUND      Error = C.MEMBER_NOT_FOUND
	GROUP_NOT_FOUND       Error = C.GROUP_NOT_FOUND
	BAD_GROUP_ID          Error = C.BAD_GROUP_ID
	TOO_MANY_HDUS_TRACKED Error = C.TOO_MANY_HDUS_TRACKED
	HDU_ALREADY_TRACKED   Error = C.HDU_ALREADY_TRACKED
	BAD_OPTION            Error = C.BAD_OPTION
	IDENTICAL_POINTERS    Error = C.IDENTICAL_POINTERS
	BAD_GROUP_ATTACH      Error = C.BAD_GROUP_ATTACH
	BAD_GROUP_DETACH      Error = C.BAD_GROUP_DETACH

	BAD_I2C        Error = C.BAD_I2C
	BAD_F2C        Error = C.BAD_F2C
	BAD_INTKEY     Error = C.BAD_INTKEY
	BAD_LOGICALKEY Error = C.BAD_LOGICALKEY
	BAD_FLOATKEY   Error = C.BAD_FLOATKEY
	BAD_DOUBLEKEY  Error = C.BAD_DOUBLEKEY
	BAD_C2I        Error = C.BAD_C2I
	BAD_C2F        Error = C.BAD_C2F
	BAD_C2D        Error = C.BAD_C2D
	BAD_DATATYPE   Error = C.BAD_DATATYPE
	BAD_DECIM      Error = C.BAD_DECIM
	NUM_OVERFLOW   Error = C.NUM_OVERFLOW

	DATA_COMPRESSION_ERR   Error = C.DATA_COMPRESSION_ERR
	DATA_DECOMPRESSION_ERR Error = C.DATA_DECOMPRESSION_ERR
	NO_COMPRESSED_TILE     Error = C.NO_COMPRESSED_TILE

	BAD_DATE Error = C.BAD_DATE

	PARSE_SYNTAX_ERR Error = C.PARSE_SYNTAX_ERR
	PARSE_BAD_TYPE   Error = C.PARSE_BAD_TYPE
	PARSE_LRG_VECTOR Error = C.PARSE_LRG_VECTOR
	PARSE_NO_OUTPUT  Error = C.PARSE_NO_OUTPUT
	PARSE_BAD_COL    Error = C.PARSE_BAD_COL
	PARSE_BAD_OUTPUT Error = C.PARSE_BAD_OUTPUT

	ANGLE_TOO_BIG  Error = C.ANGLE_TOO_BIG
	BAD_WCS_VAL    Error = C.BAD_WCS_VAL
	WCS_ERROR      Error = C.WCS_ERROR
	BAD_WCS_PROJ   Error = C.BAD_WCS_PROJ
	NO_WCS_KEY     Error = C.NO_WCS_KEY
	APPROX_WCS_KEY Error = C.APPROX_WCS_KEY

	NO_CLOSE_ERROR Error = C.NO_CLOSE_ERROR

	/*------- following error codes are used in the grparser.c file -----------*/
	NGP_ERRBASE           Error = C.NGP_ERRBASE
	NGP_OK                Error = C.NGP_OK
	NGP_NO_MEMORY         Error = C.NGP_NO_MEMORY
	NGP_READ_ERR          Error = C.NGP_READ_ERR
	NGP_NUL_PTR           Error = C.NGP_NUL_PTR
	NGP_EMPTY_CURLINE     Error = C.NGP_EMPTY_CURLINE
	NGP_UNREAD_QUEUE_FULL Error = C.NGP_UNREAD_QUEUE_FULL
	NGP_INC_NESTING       Error = C.NGP_INC_NESTING
	NGP_ERR_FOPEN         Error = C.NGP_ERR_FOPEN
	NGP_EOF               Error = C.NGP_EOF
	NGP_BAD_ARG           Error = C.NGP_BAD_ARG
	NGP_TOKEN_NOT_EXPECT  Error = C.NGP_TOKEN_NOT_EXPECT
)

func (Error) Error

func (err Error) Error() string

type File

type File struct {
	// contains filtered or unexported fields
}

File is a handle to a FITS file

func Create

func Create(fname string) (File, error)

Create creates and opens a new empty output FITS file.

func Open

func Open(fname string, mode Mode) (File, error)

Open an existing FITS file Open will create HDU values, loading the Header part but leaving the Data part on disk.

func (*File) CHDU

func (f *File) CHDU() HDU

CHDU returns the current HDU

func (*File) Close

func (f *File) Close() error

Close closes a previously opened FITS file.

func (*File) Copy

func (f *File) Copy(out *File, previous, current, following bool) error

Copy all or part of the HDUs in the FITS file associated with infptr and append them to the end of the FITS file associated with outfptr. If 'previous' is true, then any HDUs preceding the current HDU in the input file will be copied to the output file. Similarly, 'current' and 'following' determine whether the current HDU, and/or any following HDUs in the input file will be copied to the output file. Thus, if all 3 parameters are true, then the entire input file will be copied. On exit, the current HDU in the input file will be unchanged, and the last HDU in the output file will be the current HDU.

func (*File) Delete

func (f *File) Delete() error

Delete closes a previously opened FITS file and also DELETES the file.

func (*File) HDU

func (f *File) HDU(i int) HDU

HDU returns the i-th HDU

func (*File) HDUNum

func (f *File) HDUNum() int

HDUNum returns the number of the current HDU (CHDU) in the FITS file (where the primary array = 1). This function returns the HDU number rather than a status value. Note: 0-based index

func (*File) HDUType

func (f *File) HDUType() (HDUType, error)

HDUType returns the type of the current HDU in the FITS file. The possible values for hdutype are: IMAGE_HDU, ASCII_TBL, or BINARY_TBL.

func (*File) HDUs

func (f *File) HDUs() []HDU

HDUs returns the list of all Header-Data Unit blocks in the file

func (*File) Mode

func (f *File) Mode() (Mode, error)

Mode returns the mode of a FITS file (ReadOnly or ReadWrite)

func (*File) Name

func (f *File) Name() (string, error)

Name returns the name of a FITS file

func (*File) NumHDUs

func (f *File) NumHDUs() (int, error)

NumHDUs returns the total number of HDUs in the FITS file. This returns the number of completely defined HDUs in the file. If a new HDU has just been added to the FITS file, then that last HDU will only be counted if it has been closed, or if data has been written to the HDU. The current HDU remains unchanged by this routine.

func (*File) SeekHDU

func (f *File) SeekHDU(hdu int, whence int) error

SeekHDU moves to a different HDU in the file, according to whence: 0 means relative to origin of the file, 1 means relative to current position.

func (*File) SeekHDUByName

func (f *File) SeekHDUByName(hdu HDUType, extname string, extvers int) error

SeekHDUByName moves to a different HDU in the file

func (*File) UrlType

func (f *File) UrlType() (string, error)

UrlType returns the type of a FITS file (e.g. ftp:// or file://)

type HDU

type HDU interface {
	Close() error
	Header() Header
	Type() HDUType
	Name() string
	Version() int
	Data(data interface{}) error
}

HDU represents a "Header-Data Unit" block

func NewPrimaryHDU

func NewPrimaryHDU(f *File, hdr Header) (HDU, error)

NewPrimaryHDU creates a new PrimaryHDU with Header hdr in File f. It returns an error if f already has a Primary HDU.

type HDUType

type HDUType int

HDUType is the type of a "Header-Data Unit" (IMAGE_HDU, ASCII_TBL or BINARY_TBL)

const (
	IMAGE_HDU  HDUType = C.IMAGE_HDU  // Primary Array or IMAGE HDU
	ASCII_TBL  HDUType = C.ASCII_TBL  // ASCII table HDU
	BINARY_TBL HDUType = C.BINARY_TBL // Binary table HDU
	ANY_HDU    HDUType = C.ANY_HDU    // matches any HDU type
)

func (HDUType) String

func (hdu HDUType) String() string
type Header struct {
	// contains filtered or unexported fields
}

func NewDefaultHeader

func NewDefaultHeader() Header

NewDefaultHeader creates a Header with CFITSIO default Cards, of type IMAGE_HDU and bitpix=8, no axes.

func NewHeader

func NewHeader(cards []Card, htype HDUType, bitpix int64, axes []int64) Header

NewHeader creates a Header from a set of Cards, HDUType, bitpix and axes.

func (*Header) AddComment

func (h *Header) AddComment(v string)

func (*Header) AddHistory

func (h *Header) AddHistory(v string)

func (*Header) Append

func (h *Header) Append(cards ...Card) *Header

Append appends a set of Cards to this Header

func (*Header) Axes

func (h *Header) Axes() []int64

Axes returns the axes for this Header.

func (*Header) Bitpix

func (h *Header) Bitpix() int64

Bitpix returns the bitpix value.

func (*Header) Clear

func (h *Header) Clear()

Clear resets the Header to the default state.

func (*Header) Comment

func (h *Header) Comment() string

Comment returns the whole comment string for this Header.

func (*Header) Get

func (h *Header) Get(n string) *Card

Get returns the Card with name n or nil if it doesn't exist.

func (*Header) History

func (h *Header) History() string

History returns the whole history string for this Header.

func (*Header) Index

func (h *Header) Index(n string) int

Index returns the index of the Card with name n, or -1 if it doesn't exist

func (*Header) Keys

func (h *Header) Keys() []string

Keys returns the name of all the Cards of this Header.

func (*Header) Set

func (h *Header) Set(n string, v interface{}, comment string)

Set modifies the value and comment of a Card with name n.

type ImageHDU

type ImageHDU struct {
	// contains filtered or unexported fields
}

ImageHDU is a Header-Data-Unit extension holding an image as data payload.

func (*ImageHDU) Close

func (hdu *ImageHDU) Close() error

Close closes this HDU, cleaning up cycles for the proper garbage collection.

func (*ImageHDU) Data

func (hdu *ImageHDU) Data(data interface{}) error

Data loads the image data associated with this HDU into data, which should be a pointer to a slice []T. cfitsio will return an error if the image payload can not be converted into Ts. It panics if data isn't addressable.

func (*ImageHDU) Header

func (hdu *ImageHDU) Header() Header

Header returns the Header part of this "Header Data-Unit" block.

func (*ImageHDU) Name

func (hdu *ImageHDU) Name() string

Name returns the value of the 'EXTNAME' Card (or "" if none)

func (*ImageHDU) Type

func (hdu *ImageHDU) Type() HDUType

Type returns the HDUType for this HDU.

func (*ImageHDU) Version

func (hdu *ImageHDU) Version() int

Version returns the value of the 'EXTVER' Card (or 1 if none)

func (*ImageHDU) Write

func (hdu *ImageHDU) Write(data interface{}) error

Write writes the image to disk data should be a pointer to a slice []T.

type Mode

type Mode int
const (
	ReadOnly  Mode = C.READONLY
	ReadWrite Mode = C.READWRITE
)

type PrimaryHDU

type PrimaryHDU struct {
	ImageHDU
}

PrimaryHDU is the primary HDU

func (*PrimaryHDU) Name

func (hdu *PrimaryHDU) Name() string

Name returns the value of the 'EXTNAME' Card (or "PRIMARY" if none)

func (*PrimaryHDU) Version

func (hdu *PrimaryHDU) Version() int

Version returns the value of the 'EXTVER' Card (or 1 if none)

type Rows

type Rows struct {
	// contains filtered or unexported fields
}

Rows is the result of a query on a FITS Table. Its cursors starts before the first row of the result set. Use Next to advance through the rows:

rows, err := table.Read(0, -1)
...
for rows.Next() {
    var id int
    var x float64
    err = rows.Scan(&id, &x)
    ...
}
err = rows.Err() // get any error encountered during iteration
...

func (*Rows) Close

func (rows *Rows) Close() error

Close closes the Rows, preventing further enumeration. Close is idempotent and does not affect the result of Err.

func (*Rows) Err

func (rows *Rows) Err() error

Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.

func (*Rows) Next

func (rows *Rows) Next() bool

Next prepares the next result row for reading with the Scan method. It returns true on success, false if there is no next result row. Every call to Scan, even the first one, must be preceded by a call to Next.

func (*Rows) Scan

func (rows *Rows) Scan(args ...interface{}) error

Scan copies the columns in the current row into the values pointed at by dest.

type Table

type Table struct {
	// contains filtered or unexported fields
}

func NewTable

func NewTable(f *File, name string, cols []Column, hdutype HDUType) (*Table, error)

NewTable creates a new table in the given FITS file

func NewTableFrom

func NewTableFrom(f *File, name string, v Value, hdutype HDUType) (*Table, error)

NewTableFrom creates a new table in the given FITS file, using the struct v as schema

func (*Table) Close

func (hdu *Table) Close() error

func (*Table) Col

func (hdu *Table) Col(i int) *Column

func (*Table) Cols

func (hdu *Table) Cols() []Column

func (*Table) Data

func (hdu *Table) Data(interface{}) error

func (*Table) Header

func (hdu *Table) Header() Header

func (*Table) Index

func (hdu *Table) Index(n string) int

Index returns the index of the first column with name `n` or -1

func (*Table) Name

func (hdu *Table) Name() string

func (*Table) NumCols

func (hdu *Table) NumCols() int

func (*Table) NumRows

func (hdu *Table) NumRows() int64

func (*Table) Read

func (hdu *Table) Read(beg, end int64) (*Rows, error)

Read reads rows over the range [beg, end) and returns the corresponding iterator. if end > maxrows, the iteration will stop at maxrows ReadRange has the same semantics than a `for i=0; i < max; i++ {...}` loop

func (*Table) ReadRange

func (hdu *Table) ReadRange(beg, end, inc int64) (*Rows, error)

ReadRange reads rows over the range [beg, end) and returns the corresponding iterator. if end > maxrows, the iteration will stop at maxrows ReadRange has the same semantics than a `for i=0; i < max; i+=inc {...}` loop

func (*Table) Type

func (hdu *Table) Type() HDUType

func (*Table) Version

func (hdu *Table) Version() int

func (*Table) Write

func (hdu *Table) Write(args ...interface{}) error

Write writes a row to the table

type TypeCode

type TypeCode int
const (
	TBIT        TypeCode = C.TBIT /* codes for FITS table data types */
	TBYTE       TypeCode = C.TBYTE
	TSBYTE      TypeCode = C.TSBYTE
	TLOGICAL    TypeCode = C.TLOGICAL
	TSTRING     TypeCode = C.TSTRING
	TUSHORT     TypeCode = C.TUSHORT
	TSHORT      TypeCode = C.TSHORT
	TUINT       TypeCode = C.TUINT
	TINT        TypeCode = C.TINT
	TULONG      TypeCode = C.TULONG
	TLONG       TypeCode = C.TLONG
	TINT32BIT   TypeCode = C.TINT32BIT /* used when returning datatype of a column */
	TFLOAT      TypeCode = C.TFLOAT
	TLONGLONG   TypeCode = C.TLONGLONG
	TDOUBLE     TypeCode = C.TDOUBLE
	TCOMPLEX    TypeCode = C.TCOMPLEX
	TDBLCOMPLEX TypeCode = C.TDBLCOMPLEX

	// variable length arrays
	TVLABIT        TypeCode = -C.TBIT /* codes for FITS table data types */
	TVLABYTE       TypeCode = -C.TBYTE
	TVLASBYTE      TypeCode = -C.TSBYTE
	TVLALOGICAL    TypeCode = -C.TLOGICAL
	TVLASTRING     TypeCode = -C.TSTRING
	TVLAUSHORT     TypeCode = -C.TUSHORT
	TVLASHORT      TypeCode = -C.TSHORT
	TVLAUINT       TypeCode = -C.TUINT
	TVLAINT        TypeCode = -C.TINT
	TVLAULONG      TypeCode = -C.TULONG
	TVLALONG       TypeCode = -C.TLONG
	TVLAINT32BIT   TypeCode = -C.TINT32BIT /* used when returning datatype of a column */
	TVLAFLOAT      TypeCode = -C.TFLOAT
	TVLALONGLONG   TypeCode = -C.TLONGLONG
	TVLADOUBLE     TypeCode = -C.TDOUBLE
	TVLACOMPLEX    TypeCode = -C.TCOMPLEX
	TVLADBLCOMPLEX TypeCode = -C.TDBLCOMPLEX
)

func (TypeCode) String

func (tc TypeCode) String() string

type Value

type Value interface{}

Value is a value in a FITS table

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL