ifw-daq
3.0.0-pre2
IFW Data Acquisition modules
|
Namespaces | |
constants | |
v1 | |
Versioned namespace of sorting functions in case standard evolves but instruments want to freeze. | |
Classes | |
class | MemoryFitsFile |
In-memory FITS file. More... | |
class | CfitsioError |
Represents errors from cfitsio. More... | |
struct | KeywordNameView |
class | LiteralKeyword |
Represents the literal 80-character FITS keyword record. More... | |
struct | BasicKeywordBase |
Non template base class that is purely used to avoid type-deduction issues of ValueType. More... | |
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 | ValueKeywordTraits |
struct | EsoKeywordTraits |
Typedefs | |
using | UniqueFitsFile = std::unique_ptr< fitsfile, void(*)(fitsfile *) noexcept > |
Defines unique ownership type to cfitsio fitsfile. More... | |
using | ValueKeyword = BasicKeyword< ValueKeywordTraits > |
Standard FITS value keyword. More... | |
using | EsoKeyword = BasicKeyword< EsoKeywordTraits > |
ESO hiearchical keyword. More... | |
using | KeywordVariant = std::variant< ValueKeyword, EsoKeyword, LiteralKeyword > |
The different variants of keywords that are supported. More... | |
using | TypedKeywordVariant = std::variant< ValueKeyword, EsoKeyword > |
Subset of value-typed keywords. More... | |
using | KeywordVector = std::vector< KeywordVariant > |
Vector of keywords. More... | |
Enumerations | |
enum class | HduType : int { Image = IMAGE_HDU , Ascii = ASCII_TBL , Binary = BINARY_TBL } |
enum class | OpenMode : uint8_t { ReadOnly , ReadWrite } |
enum | KeywordType : 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 | |||||
void | SelectHduNum (fitsfile *ptr, int hdu_num) | ||||
Select current HDU number. More... | |||||
void | DefaultClose (fitsfile *ptr) noexcept | ||||
Default close function that is used by UniqueFitsFile as a deleter. More... | |||||
void | InitPrimaryHduEmpty (fitsfile *ptr) | ||||
Initializes an empty FITS file with an empty primary HDU (no keywords) More... | |||||
void | InitPrimaryHduNoImage (fitsfile *ptr) | ||||
Initializes an empty FITS file with a primary HDU. More... | |||||
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. More... | |||||
UniqueFitsFile | Open (char const *filename, OpenMode mode) | ||||
Open file. More... | |||||
std::vector< LiteralKeyword > | ReadKeywords (fitsfile *ptr, int hdu_num) | ||||
Read keywords from HDU identifed by absolute position hdu_num. More... | |||||
std::vector< LiteralKeyword > | ReadKeywords (fitsfile *ptr, HduType type, std::string_view name, std::optional< int > version) | ||||
void | DeleteAllKeywords (fitsfile *ptr, int hdu_num) | ||||
Delete all keywords from HDU. More... | |||||
void | MakeHduSpace (fitsfile *ptr, int hdu_num, 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. More... | |||||
void | WriteChecksum (fitsfile *ptr, int hdu_num) | ||||
Write or update checksum keywords DATASUM and CHECKSUM to HDU specified by hdu_num. More... | |||||
std::vector< LiteralKeyword > | ReadKeywords (fitsfile *ptr, std::string_view name, std::optional< int > version=std::nullopt) | ||||
Read keywords from HDU identifed by EXTNAME and EXTVER keywords. More... | |||||
std::vector< KeywordVariant > | ParseJsonKeywords (char const *keywords) | ||||
Parse and return FITS keywords. More... | |||||
std::vector< KeywordVariant > | ParseJsonKeywords (nlohmann::json const &keywords, nlohmann::json_pointer< nlohmann::json > const &=nlohmann::json_pointer< nlohmann::json >()) | ||||
Parse and return FITS keywords. More... | |||||
nlohmann::json | SerializeJsonKeywordValue (BasicKeywordBase::ValueType const &value) | ||||
SerializeJsons the keyword value variant to JSON. More... | |||||
nlohmann::json | SerializeJsonKeyword (KeywordVariant const &keyword) | ||||
SerializeJsons keyword to JSON. More... | |||||
nlohmann::json | SerializeJsonKeywords (std::vector< KeywordVariant > const &keywords) | ||||
SerializeJsons keyword to JSON. More... | |||||
bool | operator== (KeywordNameView lhs, KeywordNameView rhs) noexcept | ||||
bool | operator!= (KeywordNameView lhs, KeywordNameView rhs) noexcept | ||||
bool | operator< (LiteralKeyword const &, LiteralKeyword const &) noexcept | ||||
Sort by logical keyword name (not DICD sort) More... | |||||
bool | operator== (LiteralKeyword const &lhs, LiteralKeyword const &rhs) noexcept | ||||
Compares equally if keyword record in lhs is the same as rhs (char for char). More... | |||||
bool | operator!= (LiteralKeyword const &, LiteralKeyword const &) noexcept | ||||
Compares inequally if keyword record in lhs is not the same as rhs (char for char). More... | |||||
std::ostream & | operator<< (std::ostream &os, LiteralKeyword const &kw) | ||||
bool | operator< (LiteralKeyword const &, EsoKeyword const &) noexcept | ||||
Keyword sorting function. More... | |||||
bool | operator< (LiteralKeyword const &, ValueKeyword const &) noexcept | ||||
Keyword sorting function. More... | |||||
bool | operator< (ValueKeyword const &, EsoKeyword const &) noexcept | ||||
Keyword sorting function. More... | |||||
bool | operator< (ValueKeyword const &, LiteralKeyword const &) noexcept | ||||
Keyword sorting function. More... | |||||
bool | operator< (EsoKeyword const &, ValueKeyword const &) noexcept | ||||
Keyword sorting function. More... | |||||
bool | operator< (EsoKeyword const &, LiteralKeyword const &) noexcept | ||||
Keyword sorting function. More... | |||||
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. More... | |||||
constexpr KeywordNameView | GetKeywordName (EsoKeyword const &keyword) noexcept | ||||
Get keyword name from keyword. More... | |||||
constexpr KeywordNameView | GetKeywordName (ValueKeyword const &keyword) noexcept | ||||
constexpr KeywordNameView | GetKeywordName (KeywordVariant const &keyword) noexcept | ||||
Get keyword name from keyword variant. More... | |||||
KeywordClass | GetKeywordClass (std::string_view name) | ||||
Get keyword class. More... | |||||
bool | NameEquals (KeywordVariant const &lhs, KeywordVariant const &rhs) noexcept | ||||
Compare logical keyword names of keyword of the same type. More... | |||||
void | UpdateKeywords (KeywordVector &to, KeywordVector const &from, ConflictPolicy policy=ConflictPolicy::Replace) | ||||
Updates to with keywords from from. More... | |||||
void | InsertKeywords (KeywordVector &keywords, KeywordVector::iterator position, KeywordVector::const_iterator from_first, KeywordVector::const_iterator from_last) | ||||
Insert keywords. More... | |||||
std::vector< KeywordVariant > | ParseJsonKeywords (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) | ||||
Format keyword using default formatting rules. | |||||
| |||||
LiteralKeyword | Format (KeywordVariant const &keyword) | ||||
LiteralKeyword | Format (ValueKeyword const &keyword) | ||||
LiteralKeyword | Format (EsoKeyword const &keyword) | ||||
LiteralKeyword | Format (LiteralKeyword::Components const &keyword) | ||||
using daq::fits::EsoKeyword = typedef BasicKeyword<EsoKeywordTraits> |
ESO hiearchical keyword.
Definition at line 337 of file keyword.hpp.
using daq::fits::KeywordVariant = typedef std::variant<ValueKeyword, EsoKeyword, LiteralKeyword> |
The different variants of keywords that are supported.
Definition at line 400 of file keyword.hpp.
using daq::fits::KeywordVector = typedef std::vector<KeywordVariant> |
Vector of keywords.
Definition at line 414 of file keyword.hpp.
using daq::fits::TypedKeywordVariant = typedef std::variant<ValueKeyword, EsoKeyword> |
Subset of value-typed keywords.
Definition at line 407 of file keyword.hpp.
using daq::fits::UniqueFitsFile = typedef std::unique_ptr<fitsfile, void (*)(fitsfile*) noexcept> |
Defines unique ownership type to cfitsio fitsfile.
Definition at line 33 of file cfitsio.hpp.
using daq::fits::ValueKeyword = typedef BasicKeyword<ValueKeywordTraits> |
Standard FITS value keyword.
Definition at line 330 of file keyword.hpp.
|
strong |
Enumerator | |
---|---|
Replace | Replace keyword that conflicts. |
Skip | Skip keyword that conflicts. |
Definition at line 463 of file keyword.hpp.
|
strong |
Enumerator | |
---|---|
Image | |
Ascii | |
Binary |
Definition at line 19 of file cfitsio.hpp.
|
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 89 of file keyword.hpp.
enum daq::fits::KeywordType : 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 64 of file keyword.hpp.
|
strong |
Enumerator | |
---|---|
ReadOnly | |
ReadWrite |
Definition at line 26 of file cfitsio.hpp.
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 158 of file cfitsio.cpp.
|
noexcept |
Default close function that is used by UniqueFitsFile as a deleter.
Definition at line 100 of file cfitsio.cpp.
void daq::fits::DeleteAllKeywords | ( | fitsfile * | ptr, |
int | hdu_num | ||
) |
Delete all keywords from HDU.
ptr | FITS file to delete keywords from. |
hdu_num | HDU number. HDU numbers are 1-indexed, so primary HDU is 1. |
CfitsioError | on error. |
Definition at line 209 of file cfitsio.cpp.
LiteralKeyword daq::fits::Format | ( | EsoKeyword const & | keyword | ) |
Definition at line 592 of file keyword.cpp.
LiteralKeyword daq::fits::Format | ( | KeywordVariant const & | keyword | ) |
Definition at line 626 of file keyword.cpp.
LiteralKeyword daq::fits::Format | ( | LiteralKeyword::Components const & | keyword | ) |
Definition at line 609 of file keyword.cpp.
LiteralKeyword daq::fits::Format | ( | ValueKeyword const & | keyword | ) |
Definition at line 600 of file keyword.cpp.
KeywordClass daq::fits::GetKeywordClass | ( | std::string_view | name | ) |
Get keyword class.
name | Keyword name. |
Definition at line 490 of file keyword.cpp.
|
constexprnoexcept |
Get keyword name from keyword.
keyword | Keyword to query. |
Definition at line 427 of file keyword.hpp.
|
constexprnoexcept |
Get keyword name from keyword variant.
keyword | Keyword to query. |
Definition at line 439 of file keyword.hpp.
|
constexprnoexcept |
Definition at line 431 of file keyword.hpp.
void daq::fits::InitPrimaryHduEmpty | ( | fitsfile * | ptr | ) |
Initializes an empty FITS file with an empty primary HDU (no keywords)
ptr | Valid FITS file. |
CfitsioError | on error. |
Definition at line 112 of file cfitsio.cpp.
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:
ptr | Valid FITS file. |
CfitsioError | on error. |
Definition at line 125 of file cfitsio.cpp.
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.
position | Insert position that must lie within range (to_first, to_last] |
to_first | Start of range to consider when deleting duplicate keywords. |
to_last | End of range to consider when deleting duplicate keywords. |
from_first | Range to insert from. |
from_last | Range to insert from. |
from | Keywords to update from. |
Definition at line 570 of file keyword.cpp.
void daq::fits::MakeHduSpace | ( | fitsfile * | ptr, |
int | hdu_num, | ||
size_t | additional_keys | ||
) |
Definition at line 229 of file cfitsio.cpp.
|
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.
lhs | value to compare |
rhs | value to compare |
Definition at line 478 of file keyword.cpp.
UniqueFitsFile daq::fits::Open | ( | char const * | filename, |
OpenMode | mode | ||
) |
Open file.
filename | Path to file to open. |
mode | File open mode. |
CfitsioError | on errors. |
Definition at line 168 of file cfitsio.cpp.
|
noexcept |
Definition at line 359 of file keyword.cpp.
|
noexcept |
Compares inequally if keyword record in lhs is not the same as rhs (char for char).
Definition at line 428 of file keyword.cpp.
|
noexcept |
Keyword sorting function.
Definition at line 518 of file keyword.cpp.
|
noexcept |
Keyword sorting function.
Definition at line 515 of file keyword.cpp.
|
noexcept |
Definition at line 351 of file keyword.cpp.
|
noexcept |
Keyword sorting function.
Definition at line 500 of file keyword.cpp.
|
noexcept |
Sort by logical keyword name (not DICD sort)
Definition at line 420 of file keyword.cpp.
|
noexcept |
Keyword sorting function.
Definition at line 504 of file keyword.cpp.
|
noexcept |
Keyword sorting function.
Definition at line 507 of file keyword.cpp.
|
noexcept |
Keyword sorting function.
Definition at line 511 of file keyword.cpp.
std::ostream & daq::fits::operator<< | ( | std::ostream & | os, |
BasicKeyword< Trait > const & | kw | ||
) |
Definition at line 539 of file keyword.cpp.
std::ostream & daq::fits::operator<< | ( | std::ostream & | os, |
BasicKeywordBase::ValueType const & | kw | ||
) |
Definition at line 522 of file keyword.cpp.
std::ostream & daq::fits::operator<< | ( | std::ostream & | os, |
KeywordVariant const & | kw | ||
) |
Ostream formatting of keywords.
Definition at line 549 of file keyword.cpp.
std::ostream & daq::fits::operator<< | ( | std::ostream & | os, |
LiteralKeyword const & | kw | ||
) |
Definition at line 432 of file keyword.cpp.
template std::ostream& daq::fits::operator<<< EsoKeywordTraits > | ( | std::ostream & | os, |
BasicKeyword< EsoKeywordTraits > const & | kw | ||
) |
template std::ostream& daq::fits::operator<<< ValueKeywordTraits > | ( | std::ostream & | os, |
BasicKeyword< ValueKeywordTraits > const & | kw | ||
) |
|
noexcept |
Definition at line 355 of file keyword.cpp.
|
noexcept |
Compares equally if keyword record in lhs is the same as rhs (char for char).
Definition at line 424 of file keyword.cpp.
std::vector< KeywordVariant > daq::fits::ParseJsonKeywords | ( | char const * | keywords | ) |
Parse and return FITS keywords.
Example string:
keywords | JSON encoded string of keywords |
std::invalid_argument | on schema validation error. |
nlohmann::json::exception | on JSON parsing error. |
std::vector<KeywordVariant> daq::fits::ParseJsonKeywords | ( | Json const & | keywords, |
JsonPointer const & | breadcrumb | ||
) |
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.
keywords | JSON object containing FITS keywords. |
std::invalid_argument | on schema validation error. |
std::vector<LiteralKeyword> daq::fits::ReadKeywords | ( | fitsfile * | ptr, |
HduType | type, | ||
std::string_view | name, | ||
std::optional< int > | version | ||
) |
Definition at line 188 of file cfitsio.cpp.
std::vector< LiteralKeyword > daq::fits::ReadKeywords | ( | fitsfile * | ptr, |
int | hdu_num | ||
) |
Read keywords from HDU identifed by absolute position hdu_num.
ptr | FITS file to read from. |
hdu_num | HDU number. HDU numbers are 1-indexed, so primary HDU is 1. |
CfitsioError | on error. |
Definition at line 181 of file cfitsio.cpp.
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.
ptr | FITS file to read from. |
name | HDU extension name as identified by EXTNAME keyword. |
version | HDU extension version as identified by EXTVER keyword. If version is not provided the EXTVER will be ignored when looking up extension. |
CfitsioError | on error. |
void daq::fits::SelectHduNum | ( | fitsfile * | ptr, |
int | hdu_num | ||
) |
Select current HDU number.
hdu_num | HDU number starting with primary HDU == 1. |
Definition at line 89 of file cfitsio.cpp.
nlohmann::json daq::fits::SerializeJsonKeyword | ( | KeywordVariant const & | keyword | ) |
nlohmann::json daq::fits::SerializeJsonKeywords | ( | std::vector< KeywordVariant > const & | keywords | ) |
nlohmann::json daq::fits::SerializeJsonKeywordValue | ( | BasicKeywordBase::ValueType const & | value | ) |
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.
to | Keywords to update to. |
from | Keywords to update from. |
policy | Determines what to do for a keyword conflict. |
Definition at line 554 of file keyword.cpp.
void daq::fits::WriteChecksum | ( | fitsfile * | ptr, |
int | hdu_num | ||
) |
Write or update checksum keywords DATASUM and CHECKSUM to HDU specified by hdu_num.
hdu_num | HDU to calculate and update checksum keywords for if necessary. |
CfitsioError | on error. |
Definition at line 283 of file cfitsio.cpp.
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.
ptr | FITS file to write to. | |
hdu_num | HDU number. HDU numbers are 1-indexed, so primary HDU is 1. | |
keywords | Keywords to write. | |
[out] | remaining_size | optional 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. |
CfitsioError | on error. |
Definition at line 247 of file cfitsio.cpp.