A pure MoonBit FITS astronomy data parser, validator, and toolkit.
moon check --deny-warn
moon test --deny-warn
moon run cmd/mainmoon run cmd/preflight-js --target js -- conformance/fixtures/test64bit1.fitmoon run cmd/preflight-js --target js -- --check-sample conformance/fixtures/test64bit1.fitmoon run cmd/table-demo-js --target js -- table-demo.fits
fitscheck --compliance --ignore-missing table-demo.fits
fitsverify table-demo.fitspub(all) struct BinaryTable {
columns : Array[TableColumn]
row_length : Int
row_count : Int
data_offset : Int
heap_offset : Int
heap_length : Int
} derive(Eq, Debug)pub(all) enum FitsError {
Truncated(Int, Int, Int)
NonAscii(Int, Byte)
InvalidKeyword(Int, String)
InvalidCard(Int, String)
MissingEnd(Int)
InvalidPadding(Int, Byte)
MissingKeyword(String)
InvalidInteger(String, String)
InvalidLogical(String, String)
InvalidString(String, String)
InvalidRequiredOrder(Int, String, String)
UnsupportedBitpix(Int)
InvalidAxis(Int, Int)
InvalidParameter(String, Int)
SizeOverflow(String)
NotImageHdu(Int)
UnsupportedIntegerBitpix(Int)
UnsupportedFloatingBitpix(Int)
UnsupportedImageLayout(Int)
InvalidReal(String, String)
CardTooLong(Int, Int)
InvalidSampleCount(Int, Int)
PixelOutOfRange(Int, Int64, Int)
BlankOutOfRange(Int64, Int)
FloatingPixelOverflow(Int, Int)
InvalidDataLength(Int, Int)
NotBinaryTable(Int)
UnsupportedTableFormat(String, String)
InvalidTableRowWidth(Int, Int)
TableRowOutOfRange(Int, Int)
InvalidTableRowCount(Int, Int)
InvalidTableCellCount(Int, Int)
InvalidTableCell(Int, String)
InvalidHeapDescriptor(Int, Int, String)
} derive(Eq, Debug)pub(all) struct Hdu {
index : Int
kind : HduKind
header : Header
image : ImageLayout?
data_offset : Int
data_length : Int
next_hdu_offset : Int
} derive(Eq, Debug)pub(all) struct TableColumn {
index : Int
name : String?
format : String
repeat : Int
offset : Int
width : Int
kind : TableColumnKind
max_elements : Int?
} derive(Eq, Debug)pub(all) enum TableColumnKind {
Ascii
Logical
Bit
UnsignedByte
Int16
Int32
Int64
Float32
Float64
Variable32(TableColumnKind)
Variable64(TableColumnKind)
} derive(Eq, Debug)fn decode_binary_row(data : Bytes, table : BinaryTable, row_index : Int) -> Result[Array[TableValue], FitsError]fn encode_binary_rows(table : BinaryTable, rows : Array[Array[TableValue]]) -> Result[Bytes, FitsError]fn encode_binary_table_data(table : BinaryTable, rows : Array[Array[TableValue]]) -> Result[Bytes, FitsError]fn encode_binary_table_extension(fields : Array[TableField], rows : Array[Array[TableValue]]) -> Result[Bytes, FitsError]test {
let extension = @moonastrofits.encode_binary_table_extension(
[{ name: Some("FLUX"), format: "1E", }],
[[@moonastrofits.Reals([1.5])]],
).unwrap()
assert_eq(extension.length(), 5760)
}Install
Download zipA pure MoonBit FITS astronomy data parser, validator, and toolkit.