Table of Contents

Class FitsCard

Namespace
Egami.Formats.Extended.Fits
Assembly
Egami.Formats.Extended.dll

One header card: a keyword, its value and its comment. The value is a string, a bool, a long, a double, or null for a card without one (COMMENT, HISTORY, a blank keyword). A value the reader does not type, such as a complex number, is kept as its text.

public sealed record FitsCard : IEquatable<FitsCard>
Inheritance
FitsCard
Implements
Inherited Members

Examples

// FitsFile lists every HDU with its header, tables included, and reads an image's values in file order.
FitsFile file = FitsFile.Load("m51.fits");
foreach (FitsHdu hdu in file.Hdus)
{
    Console.WriteLine($"HDU {hdu.Index}: {hdu.Kind}, {string.Join(" × ", hdu.Axes)}");
}

FitsHdu image = file.FirstImage!;
double exposure = image.Header.GetReal("EXPTIME") ?? 0;
double[] counts = file.ReadValues(image);
using Raster<GrayF32> plane = file.ReadPlane(image);

Constructors

FitsCard(string, object?, string?)

One header card: a keyword, its value and its comment. The value is a string, a bool, a long, a double, or null for a card without one (COMMENT, HISTORY, a blank keyword). A value the reader does not type, such as a complex number, is kept as its text.

public FitsCard(string Keyword, object? Value, string? Comment = null)

Parameters

Keyword string

The keyword, upper case, at most 8 characters (longer ones are HIERARCH keywords).

Value object

The value.

Comment string

The comment, or the text of a COMMENT or HISTORY card.

Examples

// FitsFile lists every HDU with its header, tables included, and reads an image's values in file order.
FitsFile file = FitsFile.Load("m51.fits");
foreach (FitsHdu hdu in file.Hdus)
{
    Console.WriteLine($"HDU {hdu.Index}: {hdu.Kind}, {string.Join(" × ", hdu.Axes)}");
}

FitsHdu image = file.FirstImage!;
double exposure = image.Header.GetReal("EXPTIME") ?? 0;
double[] counts = file.ReadValues(image);
using Raster<GrayF32> plane = file.ReadPlane(image);

Properties

Comment

The comment, or the text of a COMMENT or HISTORY card.

public string? Comment { get; init; }

Property Value

string

Keyword

The keyword, upper case, at most 8 characters (longer ones are HIERARCH keywords).

public string Keyword { get; init; }

Property Value

string

Value

The value.

public object? Value { get; init; }

Property Value

object

Methods

ToString()

Returns the card as FITS writes it: KEYWORD = value / comment.

public override string ToString()

Returns

string

The card's text.