Class FitsCard
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
KeywordstringThe keyword, upper case, at most 8 characters (longer ones are
HIERARCHkeywords).ValueobjectThe value.
CommentstringThe comment, or the text of a
COMMENTorHISTORYcard.
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
Keyword
The keyword, upper case, at most 8 characters (longer ones are HIERARCH keywords).
public string Keyword { get; init; }
Property Value
Value
The value.
public object? Value { get; init; }
Property Value
Methods
ToString()
Returns the card as FITS writes it: KEYWORD = value / comment.
public override string ToString()
Returns
- string
The card's text.