ifw-daq 3.1.0
IFW Data Acquisition modules
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions
daq::fits Namespace Reference

Namespaces

namespace  constants
 
namespace  v1
 Versioned namespace of sorting functions in case standard evolves but instruments want to freeze.
 

Classes

struct  BasicKeyword
 A type safe version of LiteralKeyword that consist of the three basic components of a FITS keyword keyword record: name, value and optional comment. More...
 
struct  BasicKeywordBase
 Non template base class that is purely used to avoid type-deduction issues of ValueType. More...
 
class  CfitsioError
 Represents errors from cfitsio. More...
 
struct  EsoKeywordTraits
 
class  InvalidKeyword
 Indicates keyword is invalid for some reason. More...
 
class  KeywordFormatter
 Formats keyword against e.g. More...
 
struct  KeywordNameView
 
class  LiteralKeyword
 Represents the literal 80-character FITS keyword record. More...
 
class  MemoryFitsFile
 In-memory FITS file. More...
 
class  StandardKeywordFormatter
 Formats according to built-in rules without any dictionaries. More...
 
class  UnknownKeyword
 Indicates keyword is unknown and cannot be formatted. More...
 
struct  ValueKeywordTraits
 

Typedefs

using UniqueFitsFile = std::unique_ptr< fitsfile, void(*)(fitsfile *) noexcept >
 Defines unique ownership type to cfitsio fitsfile.
 
using ValueKeyword = BasicKeyword< ValueKeywordTraits >
 Standard FITS value keyword.
 
using EsoKeyword = BasicKeyword< EsoKeywordTraits >
 ESO hiearchical keyword.
 
using KeywordVariant = std::variant< ValueKeyword, EsoKeyword, LiteralKeyword >
 The different variants of keywords that are supported.
 
using TypedKeywordVariant = std::variant< ValueKeyword, EsoKeyword >
 Subset of value-typed keywords.
 
using KeywordVector = std::vector< KeywordVariant >
 Vector of keywords.
 

Enumerations

enum class  HduType : int { Image = IMAGE_HDU , Ascii = ASCII_TBL , Binary = BINARY_TBL }
 
enum class  OpenMode : uint8_t { ReadOnly , ReadWrite }
 
enum  KeywordType : std::uint8_t { Value , Eso , Commentary }
 Type of FITS keyword. More...
 
enum class  KeywordClass : int {
  Structure = TYP_STRUC_KEY , Compression = TYP_CMPRS_KEY , Scale = TYP_SCAL_KEY , Null = TYP_NULL_KEY ,
  Dim = TYP_DIM_KEY , Range = TYP_RANG_KEY , Unit = TYP_UNIT_KEY , Disp = TYP_DISP_KEY ,
  HduId = TYP_HDUID_KEY , Checksum = TYP_CKSUM_KEY , Wcs = TYP_WCS_KEY , RefSys = TYP_REFSYS_KEY ,
  Comment = TYP_COMM_KEY , Continue = TYP_CONT_KEY , User = TYP_USER_KEY
}
 Fits keyword type. More...
 
enum class  ConflictPolicy { Replace , Skip }
 

Functions

std::ostream & operator<< (std::ostream &os, HduType hdu_type)
 Format HduType hdu_type to os.
 
void SelectHduNum (fitsfile *ptr, int hdu_num)
 Select current HDU number.
 
void DefaultClose (fitsfile *ptr) noexcept
 Default close function that is used by UniqueFitsFile as a deleter.
 
void InitPrimaryHduEmpty (fitsfile *ptr)
 Initializes an empty FITS file with an empty primary HDU (no keywords)
 
void InitPrimaryHduNoImage (fitsfile *ptr)
 Initializes an empty FITS file with a primary HDU.
 
UniqueFitsFile CreateEmpty (char const *filename)
 Creates empty FITS file using fits_create_file and returns a pointer with a deleter that will close the file.
 
UniqueFitsFile Open (char const *filename, OpenMode mode)
 Open file.
 
std::vector< LiteralKeywordReadKeywords (fitsfile *ptr, int hdu_num)
 Read keywords from HDU identifed by absolute position hdu_num.
 
std::vector< LiteralKeywordReadKeywords (fitsfile *ptr, HduType type, std::string_view name, std::optional< int > version)
 
void DeleteAllKeywords (fitsfile *ptr, int hdu_num)
 Delete all keywords from HDU.
 
void MakeHduSpace (fitsfile *ptr, int hdu_num, std::size_t additional_keys)
 
void WriteKeywords (fitsfile *ptr, int hdu_num, std::vector< LiteralKeyword > const &keywords, std::optional< ssize_t > *remaining_size=nullptr)
 Write keywords to HDU identified by number hdu_num.
 
void WriteChecksum (fitsfile *ptr, int hdu_num)
 Write or update checksum keywords DATASUM and CHECKSUM to HDU specified by hdu_num.
 
std::vector< LiteralKeywordReadKeywords (fitsfile *ptr, std::string_view name, std::optional< int > version=std::nullopt)
 Read keywords from HDU identifed by EXTNAME and EXTVER keywords.
 
std::vector< KeywordVariantParseJsonKeywords (char const *keywords)
 Parse and return FITS keywords.
 
std::vector< KeywordVariantParseJsonKeywords (nlohmann::json const &keywords, nlohmann::json_pointer< nlohmann::json > const &=nlohmann::json_pointer< nlohmann::json >("/"))
 Parse and return FITS keywords.
 
nlohmann::json SerializeJsonKeywordValue (BasicKeywordBase::ValueType const &value)
 SerializeJsons the keyword value variant to JSON.
 
nlohmann::json SerializeJsonKeyword (KeywordVariant const &keyword)
 SerializeJsons keyword to JSON.
 
nlohmann::json SerializeJsonKeywords (std::vector< KeywordVariant > const &keywords)
 SerializeJsons keyword to JSON.
 
bool operator== (KeywordNameView lhs, KeywordNameView rhs) noexcept
 
bool operator!= (KeywordNameView lhs, KeywordNameView rhs) noexcept
 
auto operator== (LiteralKeyword::Components const &lhs, LiteralKeyword::Components const &rhs) noexcept -> bool
 
auto operator!= (LiteralKeyword::Components const &lhs, LiteralKeyword::Components const &rhs) noexcept -> bool
 
bool operator< (LiteralKeyword const &, LiteralKeyword const &) noexcept
 Sort by logical keyword name (not DICD sort)
 
bool operator== (LiteralKeyword const &lhs, LiteralKeyword const &rhs) noexcept
 Compares equally if keyword record in lhs is the same as rhs (char for char).
 
bool operator!= (LiteralKeyword const &, LiteralKeyword const &) noexcept
 Compares inequally if keyword record in lhs is not the same as rhs (char for char).
 
std::ostream & operator<< (std::ostream &os, LiteralKeyword const &kw)
 
bool operator< (LiteralKeyword const &, EsoKeyword const &) noexcept
 Keyword sorting function.
 
bool operator< (LiteralKeyword const &, ValueKeyword const &) noexcept
 Keyword sorting function.
 
bool operator< (ValueKeyword const &, EsoKeyword const &) noexcept
 Keyword sorting function.
 
bool operator< (ValueKeyword const &, LiteralKeyword const &) noexcept
 Keyword sorting function.
 
bool operator< (EsoKeyword const &, ValueKeyword const &) noexcept
 Keyword sorting function.
 
bool operator< (EsoKeyword const &, LiteralKeyword const &) noexcept
 Keyword sorting function.
 
template<class Trait >
std::ostream & operator<< (std::ostream &os, BasicKeyword< Trait > const &kw)
 
template<class Trait >
std::ostream & operator<< (std::ostream &os, BasicKeywordBase::ValueType const &kw)
 
std::ostream & operator<< (std::ostream &os, KeywordVariant const &kw)
 Ostream formatting of keywords.
 
constexpr KeywordNameView GetKeywordName (EsoKeyword const &keyword) noexcept
 Get keyword name from keyword.
 
constexpr KeywordNameView GetKeywordName (ValueKeyword const &keyword) noexcept
 
constexpr KeywordNameView GetKeywordName (KeywordVariant const &keyword) noexcept
 Get keyword name from keyword variant.
 
KeywordClass GetKeywordClass (std::string_view name)
 Get keyword class.
 
bool NameEquals (KeywordVariant const &lhs, KeywordVariant const &rhs) noexcept
 Compare logical keyword names of keyword of the same type.
 
void UpdateKeywords (KeywordVector &to, KeywordVector const &from, ConflictPolicy policy=ConflictPolicy::Replace)
 Updates to with keywords from from.
 
void InsertKeywords (KeywordVector &keywords, KeywordVector::iterator position, KeywordVector::const_iterator from_first, KeywordVector::const_iterator from_last)
 Insert keywords.
 
auto FormatFitsValue (KeywordNameView name, BasicKeywordBase::ValueType const &value) -> std::string
 Format keyword value using built-in rules such that it can be used as a component when formatting a complete keyword record.
 
auto UntypedFormat (KeywordNameView name, std::string_view value, std::string_view comment) -> LiteralKeyword
 Untyped formatting where value already has been formatted correctly.
 
std::vector< KeywordVariantParseJsonKeywords (Json const &keywords, JsonPointer const &breadcrumb)
 
bool operator< (KeywordNameView lhs, KeywordNameView rhs) noexcept
 
template std::ostream & operator<<< EsoKeywordTraits > (std::ostream &os, BasicKeyword< EsoKeywordTraits > const &kw)
 
template std::ostream & operator<<< ValueKeywordTraits > (std::ostream &os, BasicKeyword< ValueKeywordTraits > const &kw)
 
std::ostream & operator<< (std::ostream &os, BasicKeywordBase::ValueType const &kw)
 
Format keyword using default formatting rules.
Parameters
keywordKeyword to format.
Exceptions
std::invalid_argumenton failure.
LiteralKeyword Format (KeywordVariant const &keyword)
 
LiteralKeyword Format (ValueKeyword const &keyword)
 
LiteralKeyword Format (EsoKeyword const &keyword)
 
LiteralKeyword Format (LiteralKeyword::Components const &keyword)
 

Typedef Documentation

◆ EsoKeyword

ESO hiearchical keyword.

Definition at line 346 of file keyword.hpp.

◆ KeywordVariant

The different variants of keywords that are supported.

Definition at line 409 of file keyword.hpp.

◆ KeywordVector

using daq::fits::KeywordVector = typedef std::vector<KeywordVariant>

Vector of keywords.

Definition at line 423 of file keyword.hpp.

◆ TypedKeywordVariant

using daq::fits::TypedKeywordVariant = typedef std::variant<ValueKeyword, EsoKeyword>

Subset of value-typed keywords.

Definition at line 416 of file keyword.hpp.

◆ UniqueFitsFile

using daq::fits::UniqueFitsFile = typedef std::unique_ptr<fitsfile, void (*)(fitsfile*) noexcept>

Defines unique ownership type to cfitsio fitsfile.

Definition at line 39 of file cfitsio.hpp.

◆ ValueKeyword

Standard FITS value keyword.

Definition at line 339 of file keyword.hpp.

Enumeration Type Documentation

◆ ConflictPolicy

enum class daq::fits::ConflictPolicy
strong
Enumerator
Replace 

Replace keyword that conflicts.

Skip 

Skip keyword that conflicts.

Definition at line 472 of file keyword.hpp.

◆ HduType

enum class daq::fits::HduType : int
strong
Enumerator
Image 
Ascii 
Binary 

Definition at line 21 of file cfitsio.hpp.

◆ KeywordClass

enum class daq::fits::KeywordClass : int
strong

Fits keyword type.

See https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/c_user/node52.html#ffdtyp

Enumerator
Structure 
Compression 
Scale 
Null 
Dim 
Range 
Unit 
Disp 
HduId 
Checksum 
Wcs 
RefSys 
Comment 
Continue 
User 

Definition at line 93 of file keyword.hpp.

◆ KeywordType

enum daq::fits::KeywordType : std::uint8_t

Type of FITS keyword.

FITS standard define two types: Value keywords and Commentary keywords.

ESO conventions adds a third "ESO hiearchical keyword" which is strictly speaking a Commentary keyword with keyword name "HIERARCH".

Enumerator
Value 

A value keyword.

Eso 

An ESO hiearchical keyword.

Commentary 

A commentary keyword, which are keywords that do not fall into the previous categories.

Definition at line 68 of file keyword.hpp.

◆ OpenMode

enum class daq::fits::OpenMode : uint8_t
strong
Enumerator
ReadOnly 
ReadWrite 

Definition at line 32 of file cfitsio.hpp.

Function Documentation

◆ CreateEmpty()

UniqueFitsFile daq::fits::CreateEmpty ( char const *  filename)

Creates empty FITS file using fits_create_file and returns a pointer with a deleter that will close the file.

Definition at line 177 of file cfitsio.cpp.

◆ DefaultClose()

void daq::fits::DefaultClose ( fitsfile *  ptr)
noexcept

Default close function that is used by UniqueFitsFile as a deleter.

Definition at line 119 of file cfitsio.cpp.

◆ DeleteAllKeywords()

void daq::fits::DeleteAllKeywords ( fitsfile *  ptr,
int  hdu_num 
)

Delete all keywords from HDU.

Parameters
ptrFITS file to delete keywords from.
hdu_numHDU number. HDU numbers are 1-indexed, so primary HDU is 1.
Exceptions
CfitsioErroron error.

Definition at line 228 of file cfitsio.cpp.

◆ Format() [1/4]

LiteralKeyword daq::fits::Format ( EsoKeyword const &  keyword)

Definition at line 750 of file keyword.cpp.

◆ Format() [2/4]

LiteralKeyword daq::fits::Format ( KeywordVariant const &  keyword)

Definition at line 782 of file keyword.cpp.

◆ Format() [3/4]

LiteralKeyword daq::fits::Format ( LiteralKeyword::Components const &  keyword)

Definition at line 766 of file keyword.cpp.

◆ Format() [4/4]

LiteralKeyword daq::fits::Format ( ValueKeyword const &  keyword)

Definition at line 758 of file keyword.cpp.

◆ FormatFitsValue()

std::string daq::fits::FormatFitsValue ( KeywordNameView  name,
BasicKeywordBase::ValueType const &  value 
) -> std::string

Format keyword value using built-in rules such that it can be used as a component when formatting a complete keyword record.

Parameters
nameKeyword name, used to determine special handling of e.g. the XTENSION keyword.
valueValue to format.
Returns
Formatted value. Strings are escaped.

Definition at line 717 of file keyword.cpp.

◆ GetKeywordClass()

KeywordClass daq::fits::GetKeywordClass ( std::string_view  name)

Get keyword class.

Parameters
nameKeyword name.
Returns
keyword class.

Definition at line 615 of file keyword.cpp.

◆ GetKeywordName() [1/3]

constexpr KeywordNameView daq::fits::GetKeywordName ( EsoKeyword const &  keyword)
constexprnoexcept

Get keyword name from keyword.

Parameters
keywordKeyword to query.

Definition at line 436 of file keyword.hpp.

◆ GetKeywordName() [2/3]

constexpr KeywordNameView daq::fits::GetKeywordName ( KeywordVariant const &  keyword)
constexprnoexcept

Get keyword name from keyword variant.

Parameters
keywordKeyword to query.

Definition at line 448 of file keyword.hpp.

◆ GetKeywordName() [3/3]

constexpr KeywordNameView daq::fits::GetKeywordName ( ValueKeyword const &  keyword)
constexprnoexcept

Definition at line 440 of file keyword.hpp.

◆ InitPrimaryHduEmpty()

void daq::fits::InitPrimaryHduEmpty ( fitsfile *  ptr)

Initializes an empty FITS file with an empty primary HDU (no keywords)

Precondition
ptr != nullptr
Parameters
ptrValid FITS file.
Exceptions
CfitsioErroron error.

Definition at line 131 of file cfitsio.cpp.

◆ InitPrimaryHduNoImage()

void daq::fits::InitPrimaryHduNoImage ( fitsfile *  ptr)

Initializes an empty FITS file with a primary HDU.

Mandatory keywords are set and primary HDU added if necessary.

Mandatory keywords are initialized as:

  • SIMPLE = T
  • BITPIX = 8
  • NAXIS = 0
Precondition
ptr != nullptr
Parameters
ptrValid FITS file.
Exceptions
CfitsioErroron error.

Definition at line 144 of file cfitsio.cpp.

◆ InsertKeywords()

void daq::fits::InsertKeywords ( KeywordVector keywords,
KeywordVector::iterator  position,
KeywordVector::const_iterator  from_first,
KeywordVector::const_iterator  from_last 
)

Insert keywords.

Conflicting keywords are deleted from the current position.

Parameters
positionInsert position that must lie within range (to_first, to_last]
to_firstStart of range to consider when deleting duplicate keywords.
to_lastEnd of range to consider when deleting duplicate keywords.
from_firstRange to insert from.
from_lastRange to insert from.
fromKeywords to update from.

Definition at line 695 of file keyword.cpp.

◆ MakeHduSpace()

void daq::fits::MakeHduSpace ( fitsfile *  ptr,
int  hdu_num,
std::size_t  additional_keys 
)

Definition at line 248 of file cfitsio.cpp.

◆ NameEquals()

bool daq::fits::NameEquals ( KeywordVariant const &  lhs,
KeywordVariant const &  rhs 
)
noexcept

Compare logical keyword names of keyword of the same type.

Comparing names only is useful to e.g. look up keyword by name, to modify it.

Parameters
lhsvalue to compare
rhsvalue to compare
Returns
true iff lhs and rhs are the same type and their name property compares equal.

Definition at line 606 of file keyword.cpp.

◆ Open()

UniqueFitsFile daq::fits::Open ( char const *  filename,
OpenMode  mode 
)

Open file.

Parameters
filenamePath to file to open.
modeFile open mode.
Exceptions
CfitsioErroron errors.

Definition at line 187 of file cfitsio.cpp.

◆ operator!=() [1/3]

bool daq::fits::operator!= ( KeywordNameView  lhs,
KeywordNameView  rhs 
)
noexcept
Returns
true if keyword type and names are not equal.

Definition at line 476 of file keyword.cpp.

◆ operator!=() [2/3]

bool daq::fits::operator!= ( LiteralKeyword const &  lhs,
LiteralKeyword const &  rhs 
)
noexcept

Compares inequally if keyword record in lhs is not the same as rhs (char for char).

Definition at line 545 of file keyword.cpp.

◆ operator!=() [3/3]

auto daq::fits::operator!= ( LiteralKeyword::Components const &  lhs,
LiteralKeyword::Components const &  rhs 
) -> bool
noexcept

Definition at line 560 of file keyword.cpp.

◆ operator<() [1/8]

bool daq::fits::operator< ( EsoKeyword const &  lhs,
LiteralKeyword const &  rhs 
)
noexcept

Keyword sorting function.

Definition at line 643 of file keyword.cpp.

◆ operator<() [2/8]

bool daq::fits::operator< ( EsoKeyword const &  lhs,
ValueKeyword const &  rhs 
)
noexcept

Keyword sorting function.

Definition at line 640 of file keyword.cpp.

◆ operator<() [3/8]

bool daq::fits::operator< ( KeywordNameView  lhs,
KeywordNameView  rhs 
)
noexcept

Definition at line 468 of file keyword.cpp.

◆ operator<() [4/8]

bool daq::fits::operator< ( LiteralKeyword const &  lhs,
EsoKeyword const &  rhs 
)
noexcept

Keyword sorting function.

Definition at line 625 of file keyword.cpp.

◆ operator<() [5/8]

bool daq::fits::operator< ( LiteralKeyword const &  lhs,
LiteralKeyword const &  rhs 
)
noexcept

Sort by logical keyword name (not DICD sort)

Definition at line 537 of file keyword.cpp.

◆ operator<() [6/8]

bool daq::fits::operator< ( LiteralKeyword const &  lhs,
ValueKeyword const &  rhs 
)
noexcept

Keyword sorting function.

Definition at line 629 of file keyword.cpp.

◆ operator<() [7/8]

bool daq::fits::operator< ( ValueKeyword const &  lhs,
EsoKeyword const &  rhs 
)
noexcept

Keyword sorting function.

Definition at line 632 of file keyword.cpp.

◆ operator<() [8/8]

bool daq::fits::operator< ( ValueKeyword const &  lhs,
LiteralKeyword const &  rhs 
)
noexcept

Keyword sorting function.

Definition at line 636 of file keyword.cpp.

◆ operator<<() [1/6]

template<class Trait >
std::ostream & daq::fits::operator<< ( std::ostream &  os,
BasicKeyword< Trait > const &  kw 
)

Definition at line 664 of file keyword.cpp.

◆ operator<<() [2/6]

template<class Trait >
std::ostream & daq::fits::operator<< ( std::ostream &  os,
BasicKeywordBase::ValueType const &  kw 
)

◆ operator<<() [3/6]

std::ostream & daq::fits::operator<< ( std::ostream &  os,
BasicKeywordBase::ValueType const &  kw 
)

Definition at line 647 of file keyword.cpp.

◆ operator<<() [4/6]

std::ostream & daq::fits::operator<< ( std::ostream &  os,
HduType  hdu_type 
)

Format HduType hdu_type to os.

Definition at line 56 of file cfitsio.cpp.

◆ operator<<() [5/6]

std::ostream & daq::fits::operator<< ( std::ostream &  os,
KeywordVariant const &  kw 
)

Ostream formatting of keywords.

Definition at line 674 of file keyword.cpp.

◆ operator<<() [6/6]

std::ostream & daq::fits::operator<< ( std::ostream &  os,
LiteralKeyword const &  kw 
)

Definition at line 549 of file keyword.cpp.

◆ operator<<< EsoKeywordTraits >()

template std::ostream & daq::fits::operator<<< EsoKeywordTraits > ( std::ostream &  os,
BasicKeyword< EsoKeywordTraits > const &  kw 
)

◆ operator<<< ValueKeywordTraits >()

template std::ostream & daq::fits::operator<<< ValueKeywordTraits > ( std::ostream &  os,
BasicKeyword< ValueKeywordTraits > const &  kw 
)

◆ operator==() [1/3]

bool daq::fits::operator== ( KeywordNameView  lhs,
KeywordNameView  rhs 
)
noexcept
Returns
true if keyword type and names are equal.

Definition at line 472 of file keyword.cpp.

◆ operator==() [2/3]

bool daq::fits::operator== ( LiteralKeyword const &  lhs,
LiteralKeyword const &  rhs 
)
noexcept

Compares equally if keyword record in lhs is the same as rhs (char for char).

Definition at line 541 of file keyword.cpp.

◆ operator==() [3/3]

auto daq::fits::operator== ( LiteralKeyword::Components const &  lhs,
LiteralKeyword::Components const &  rhs 
) -> bool
noexcept

Definition at line 554 of file keyword.cpp.

◆ ParseJsonKeywords() [1/3]

std::vector< KeywordVariant > daq::fits::ParseJsonKeywords ( char const *  keywords)

Parse and return FITS keywords.

Example string:

auto keywords = R"([
{
"type":"valueKeyword",
"name":"OBJECT",
"value":"OBJECT,SKY"
},
...
]");
auto res = ParseJsonKeywords(keywords);
Parameters
keywordsJSON encoded string of keywords
Exceptions
std::invalid_argumenton schema validation error.
nlohmann::json::exceptionon JSON parsing error.

Definition at line 124 of file json.cpp.

◆ ParseJsonKeywords() [2/3]

std::vector< KeywordVariant > daq::fits::ParseJsonKeywords ( Json const &  keywords,
JsonPointer const &  breadcrumb 
)

Definition at line 130 of file json.cpp.

◆ ParseJsonKeywords() [3/3]

std::vector< KeywordVariant > daq::fits::ParseJsonKeywords ( nlohmann::json const &  keywords,
nlohmann::json_pointer< nlohmann::json > const &  = nlohmann::json_pointer< nlohmann::json >("/") 
)

Parse and return FITS keywords.

Parameters
keywordsJSON object containing FITS keywords.
Exceptions
std::invalid_argumenton schema validation error.

◆ ReadKeywords() [1/3]

std::vector< LiteralKeyword > daq::fits::ReadKeywords ( fitsfile *  ptr,
HduType  type,
std::string_view  name,
std::optional< int >  version 
)

Definition at line 207 of file cfitsio.cpp.

◆ ReadKeywords() [2/3]

std::vector< LiteralKeyword > daq::fits::ReadKeywords ( fitsfile *  ptr,
int  hdu_num 
)

Read keywords from HDU identifed by absolute position hdu_num.

Parameters
ptrFITS file to read from.
hdu_numHDU number. HDU numbers are 1-indexed, so primary HDU is 1.
Exceptions
CfitsioErroron error.

Definition at line 200 of file cfitsio.cpp.

◆ ReadKeywords() [3/3]

std::vector< LiteralKeyword > daq::fits::ReadKeywords ( fitsfile *  ptr,
std::string_view  name,
std::optional< int >  version = std::nullopt 
)

Read keywords from HDU identifed by EXTNAME and EXTVER keywords.

Parameters
ptrFITS file to read from.
nameHDU extension name as identified by EXTNAME keyword.
versionHDU extension version as identified by EXTVER keyword. If version is not provided the EXTVER will be ignored when looking up extension.
Exceptions
CfitsioErroron error.

◆ SelectHduNum()

void daq::fits::SelectHduNum ( fitsfile *  ptr,
int  hdu_num 
)

Select current HDU number.

Parameters
hdu_numHDU number starting with primary HDU == 1.

Definition at line 108 of file cfitsio.cpp.

◆ SerializeJsonKeyword()

nlohmann::json daq::fits::SerializeJsonKeyword ( KeywordVariant const &  keyword)

SerializeJsons keyword to JSON.

Parameters
keywordkeyword to serialize.
Returns
JSON object.

Definition at line 170 of file json.cpp.

◆ SerializeJsonKeywords()

nlohmann::json daq::fits::SerializeJsonKeywords ( std::vector< KeywordVariant > const &  keywords)

SerializeJsons keyword to JSON.

Parameters
keywordskeywords to serialize.
Returns
JSON array of keywords.

Definition at line 200 of file json.cpp.

◆ SerializeJsonKeywordValue()

nlohmann::json daq::fits::SerializeJsonKeywordValue ( BasicKeywordBase::ValueType const &  value)

SerializeJsons the keyword value variant to JSON.

Parameters
valueValue to serialize.
Returns
JSON value.

Definition at line 166 of file json.cpp.

◆ UntypedFormat()

LiteralKeyword daq::fits::UntypedFormat ( KeywordNameView  name,
std::string_view  value,
std::string_view  comment 
) -> LiteralKeyword

Untyped formatting where value already has been formatted correctly.

No validation of value is made.

Parameters
nameLogical keyword name & type.
valueformatted FITS keyword value.
commentComment which may be empty.
Returns
formatted keyword record.

Definition at line 817 of file keyword.cpp.

◆ UpdateKeywords()

void daq::fits::UpdateKeywords ( KeywordVector to,
KeywordVector const &  from,
ConflictPolicy  policy = ConflictPolicy::Replace 
)

Updates to with keywords from from.

New keywords are inserted at the end. Existing keywords will be updated with new value if keyword type and name is the same.

Parameters
toKeywords to update to.
fromKeywords to update from.
policyDetermines what to do for a keyword conflict.

Definition at line 679 of file keyword.cpp.

◆ WriteChecksum()

void daq::fits::WriteChecksum ( fitsfile *  ptr,
int  hdu_num 
)

Write or update checksum keywords DATASUM and CHECKSUM to HDU specified by hdu_num.

Parameters
hdu_numHDU to calculate and update checksum keywords for if necessary.
Exceptions
CfitsioErroron error.

Definition at line 302 of file cfitsio.cpp.

◆ WriteKeywords()

void daq::fits::WriteKeywords ( fitsfile *  ptr,
int  hdu_num,
std::vector< LiteralKeyword > const &  keywords,
std::optional< ssize_t > *  remaining_size = nullptr 
)

Write keywords to HDU identified by number hdu_num.

Parameters
ptrFITS file to write to.
hdu_numHDU number. HDU numbers are 1-indexed, so primary HDU is 1.
keywordsKeywords to write.
[out]remaining_sizeoptional parameter that is updated with remaining size in HDU before any allocations. If this number is negative it means the HDU required to be allocated with an associated performance penalty.
Exceptions
CfitsioErroron error.

Definition at line 266 of file cfitsio.cpp.