Skip to content

Repository files navigation

FitsCore

MIT LicenseSwift 5.3LanguageSwift

A native Swift library to read and write FITS files

Description

FITSCore is a pure Swift library to read, manipulate and write files conforming to the FITS 4.0 file format, commonly used to store astronomical data.

The aim is to implement a modern, native Swift library to utilize the full computing power of modern apple hardware. In particuary, I was seeking for a simple solution to read, render & review FITS files on an iPad.

FITSCore is the plattform independend base library. It compiles and runs on iOS / iPadOS / macCatalys as well as on Linux. Therefore the featureset is quite limited as the standard libraries on linux currently do not provide a lot of convenience for image generation. A deeper integration into the iOS enviornment and standard libaries is provided via the FITSKit library.

FITSCoreFITSCoreFITSCore
FITSCoreFITSKitFITSTool
Fits file format read & writeImage rendering & manipulationCommand line tool
macOS, iOS & LinuxiOS / macCatalystLinux

Features

  • Read & Write FITS 4.0 files
    • Reading files
    • Write Files
  • FITS Extensions
    • Image Extensions
    • ASCII Table Extensions
    • Binary Table
  • Native code
    • Swift 5.3
    • Compiles for macCatalyst
    • Compiles for iPadOS
    • Compiles for Linux

Getting started

Package Manager

With the swift package manager, add the library to your dependencies

dependencies:[.package(url:"https://github.com/brampf/fitscore.git", from:"0.1.0")]

then simply add the FITS import to your target

.target(name:"YourApp", dependencies:["FITS"])

Documentation

TL;DR

Reading FITS Files

import FITS
/// Parste a FITS File
letfits=FitsFile.read(from:URL("/path/to/some/fits/file"))

Working with vector data

import FITS
// Fetch the whole image data
letimage:Data= fits.prime.data(naxis:1, dimension:0)
// Fetch the read channel from the primary HDU
letred:Data= fits.prime.data(naxis:3, dimension:0)

Tests

There are various test cases implemented to verify compability with a variiety of real word examples of FITS files

License

MIT license; see LICENSE. (c) 2020

Releases

Used by

Contributors

Languages