FITSReader 1.4.1

dotnet add package FITSReader --version 1.4.1
                    
NuGet\Install-Package FITSReader -Version 1.4.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FITSReader" Version="1.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FITSReader" Version="1.4.1" />
                    
Directory.Packages.props
<PackageReference Include="FITSReader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FITSReader --version 1.4.1
                    
#r "nuget: FITSReader, 1.4.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FITSReader@1.4.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FITSReader&version=1.4.1
                    
Install as a Cake Addin
#tool nuget:?package=FITSReader&version=1.4.1
                    
Install as a Cake Tool

<font size="8">FITSReader</font>

<font size="5">Library that parses FITS image files according to NASA's FITS standard version 4.0 and provides methods to extract metadata, raw data, and normalized byte arrays that can be used to display FITS data as images.</font>

FITS File Overview

A Flexible Image Transport System (FITS) file is the standard archival data format for astronomical data sets.

Each FITS file contains one or more Header Data Units (HDUs). An HDU contains metadata (aka a header) about the data contained within the HDU. Each HDU optionally contains an array of data values immediately following the metadata.

See the official NASA documentation for more in-depth details about the format.

Library Overview

FITSFile

Terms and Abbreviations

  • FITS - Flexible Image Transport System.
  • HDU - Header Data Unit - A FITS file contains one or more HDUs that include metadata and optional data values.
  • Header - Contains metadata about the image such as size, datatype, exposure settings, etc. All HDUs must have a header.
  • Data Unit - Optional array of data values for an HDU.
  • Normalizer - Used to convert HDU values into byte arrays that can be used for imaging.

Main Components

  • FITSFile parses a FITS file and provides references to all of the HDUs within the file.
  • FITSHeader contains methods to read header metadata and retrieve values from its associated data unit.
  • FITSData contains basic info about the data unit such as mean, standard deviation, and basic image metadata. FITSHeader returns an IFITSData object which does not 'know' what type of data it contains. If you need the actual values, you will need to cast the data to the appropriate FITSData<T> type. (See usage example)
  • Normalizer Generates a byte array of normalized values for a given min and max value. See below for list of supported data types.

Usage

  1. Get a reference to a FITS file. (Synchronous methods available as well)
    var fileName = "ibzda1020_drz.fits";
    var fitsFile = await FITSFile.ReadFileAsync(fileName);
    
  2. Find an interesting HDU. In this example we are looking for the first HDU that uses single-precision float data.
    var header = fileFile.Headers.Find(header => header.DataType == FITSDataType.SingleFloat);
    
  3. Get the HDU's data. the FITSData object is cast to handle float values because that matches the data type of the HDU.
    var data = (FITSData<float>)header.Data;
    
  4. Create a normalizer for the parsed data values which can be used to linearly normalize the data to byte values.
    var normalizer = new FloatLinearNormalizer(data.Values);
    
  5. Set the normalizer to the desired min and max values. For example if we set min to 0 and max to 100, the values 0, 50, and 100 will normalize to 0, 127, and 255 respectively.
    normalizer.Min = data.Mean - data.StdDev;
    normalizer.Max = data.Mean + data.StdDev;
    
  6. Get the normalized bytes that can then be used to generate an image from the HDU.
    var normalized = normalizer.Normalize();
    

Install

Stable Version

Find the latest stable version at nuget.org

Preview Version

Follow the instructions here to connect to the FITSPreview nuget feed.

Source

Code

Source code can be found on Azure DevOps. The following instructions assume you are using Git.

  1. git clone https://MikeWestbrook@dev.azure.com/MikeWestbrook/FITS/_git/FITS
  2. Open the Reader C# project with Visual Studio 2022

Release

Build Status

Supported Data Types

FITS data supports many data types from single bytes to IEEE double-precision floating points. FITSReader supports the following data types. All supported data types will eventually be supported.

  • IEEE single-precision floating point
  • Char or single byte data
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.1 323 3/10/2023
1.4.0 240 3/7/2023
1.3.9 242 3/5/2023
1.3.8 280 2/23/2023
1.3.7 278 2/12/2023
1.3.6 290 2/12/2023
1.3.5 285 2/12/2023
1.3.4 295 2/5/2023
1.3.3 321 2/5/2023
1.3.2 290 2/5/2023
1.3.1 295 2/5/2023
1.3.0 301 2/5/2023
1.2.3 298 2/5/2023
1.2.2 293 2/5/2023
1.2.0 306 2/5/2023
1.1.0 331 1/24/2023
1.0.22 336 1/11/2023
1.0.21 323 1/7/2023
1.0.20 323 1/6/2023