Class FitsHeader
The cards of one FITS header, in order, with typed lookups by keyword. Long string values continued over CONTINUE
cards are joined into one card.
public sealed class FitsHeader : IReadOnlyList<FitsCard>, IReadOnlyCollection<FitsCard>, IEnumerable<FitsCard>, IEnumerable
- Inheritance
-
FitsHeader
- 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
FitsHeader(IEnumerable<FitsCard>)
Creates a header of the given cards.
public FitsHeader(IEnumerable<FitsCard> cards)
Parameters
cardsIEnumerable<FitsCard>The cards, in order.
Exceptions
- ArgumentNullException
cardsis null.
Properties
Count
Gets the number of cards.
public int Count { get; }
Property Value
this[int]
Gets a card by its place.
public FitsCard this[int index] { get; }
Parameters
indexintThe place, from 0.
Property Value
- FitsCard
The card.
Methods
Contains(string)
Returns whether a card has the keyword.
public bool Contains(string keyword)
Parameters
keywordstringThe keyword, in any case.
Returns
- bool
Whether it is there.
Find(string)
Returns the first card with the keyword, or null.
public FitsCard? Find(string keyword)
Parameters
keywordstringThe keyword, in any case.
Returns
GetEnumerator()
Returns the cards in order.
public IEnumerator<FitsCard> GetEnumerator()
Returns
- IEnumerator<FitsCard>
The enumerator.
GetInteger(string)
Returns a keyword's integer value, or null when it is missing or not an integer.
public long? GetInteger(string keyword)
Parameters
keywordstringThe keyword.
Returns
- long?
The value.
GetLogical(string)
Returns a keyword's logical value, or null when it is missing or not logical.
public bool? GetLogical(string keyword)
Parameters
keywordstringThe keyword.
Returns
- bool?
The value.
GetReal(string)
Returns a keyword's number value, integer or real, or null when it is missing or not a number.
public double? GetReal(string keyword)
Parameters
keywordstringThe keyword.
Returns
- double?
The value.
GetString(string)
Returns a keyword's string value, or null when it is missing or not a string.
public string? GetString(string keyword)
Parameters
keywordstringThe keyword.
Returns
- string
The value.