25#include <pybind11/pybind11.h>
26#include <pybind11/complex.h>
27#include <pybind11/stl.h>
33using namespace pybind11::literals;
40 py::class_<FoundValue<T>> cls(mod, (
"FoundValue" + suffix).c_str());
42 cls.def(py::init<bool, T const &>(),
"found"_a,
"value"_a);
49 py::module::import(
"astshim.channel");
51 py::enum_<FitsKeyState>(mod,
"FitsKeyState")
57 py::enum_<CardType>(mod,
"CardType")
71 wrapFoundValue<std::string>(mod,
"S");
72 wrapFoundValue<std::complex<double>>(mod,
"CF");
73 wrapFoundValue<double>(mod,
"F");
74 wrapFoundValue<int>(mod,
"I");
75 wrapFoundValue<bool>(mod,
"L");
78 py::class_<FitsChan, std::shared_ptr<FitsChan>, Channel> cls(mod,
"FitsChan");
80 cls.def(py::init<Stream &, std::string const &>(),
"stream"_a,
"options"_a =
"");
120 cls.def(
"setFitsCF", &
FitsChan::setFitsCF,
"name"_a,
"value"_a,
"comment"_a =
"",
"overwrite"_a =
false);
122 cls.def(
"setFitsCN", &
FitsChan::setFitsCN,
"name"_a,
"value"_a,
"comment"_a =
"",
"overwrite"_a =
false);
123 cls.def(
"setFitsF", &
FitsChan::setFitsF,
"name"_a,
"value"_a,
"comment"_a =
"",
"overwrite"_a =
false);
124 cls.def(
"setFitsI", &
FitsChan::setFitsI,
"name"_a,
"value"_a,
"comment"_a =
"",
"overwrite"_a =
false);
125 cls.def(
"setFitsL", &
FitsChan::setFitsL,
"name"_a,
"value"_a,
"comment"_a =
"",
"overwrite"_a =
false);
126 cls.def(
"setFitsS", &
FitsChan::setFitsS,
"name"_a,
"value"_a,
"comment"_a =
"",
"overwrite"_a =
false);
127 cls.def(
"setFitsU", &
FitsChan::setFitsU,
"name"_a,
"comment"_a =
"",
"overwrite"_a =
false);
bool getDefB1950() const
Get DefB1950: use FK4 B1950 as default equatorial coordinates?
int getNKey() const
Get Nkey: the number of unique keywords.
bool getCDMatrix() const
Get CDMatrix: use CDi_j keywords to represent pixel scaling, rotation, etc?
std::shared_ptr< KeyMap > getTables() const
std::string getCardComm() const
Get CardComm: the comment of the current card.
void setFitsF(std::string const &name, double value, std::string const &comment="", bool overwrite=false)
Create a new card of type double, possibly overwriting the current card.
void setIwc(bool iwcs)
Set Iwc: add a Frame describing Intermediate World Coords?
std::string getWarnings() const
Get Warnings attribute, which controls the issuing of warnings about selected conditions when an Obje...
void setFitsDigits(int digits)
Set FitsDigits: digits of precision for floating-point FITS values.
FitsKeyState testFits(std::string const &name="") const
Determine if a card is present, and if so, whether it has a value.
std::vector< std::string > getAllCardNames()
Get the name of all cards, in order, starting from the first card.
int getPolyTan() const
Get PolyTan: use PVi_m keywords to define distorted TAN projection?
FoundValue< std::string > findFits(std::string const &name, bool inc)
Search for a card in a FitsChan by keyword.
FoundValue< std::string > getFitsS(std::string const &name="", std::string defval="") const
Get the value of a string card.
void retainFits()
Keep the current card when an Object is read that uses the card.
std::string getEncoding() const
Get Encoding: the encoding system to use when AST Objects are stored as FITS header cards in a FitsCh...
void setFitsS(std::string const &name, std::string value, std::string const &comment="", bool overwrite=false)
Create a new card of type string, possibly overwriting the current card.
void setFitsI(std::string const &name, int value, std::string const &comment="", bool overwrite=false)
Create a new card of type int, possibly overwriting the current card.
void setCard(int ind)
Set Card: the index of the current card, where 1 is the first card.
void putFits(std::string const &card, bool overwrite)
Store a FITS header card in a FitsChan.
FoundValue< bool > getFitsL(std::string const &name="", bool defval=false) const
Get the value of a bool card.
void purgeWcs()
Delete all cards in a FitsChan that relate to any of the recognised WCS encodings.
std::string getFitsAxisOrder() const
Get FitsAxisOrder: the order for the WCS axes in any new FITS-WCS headers created using Channel::writ...
int getCard() const
Get Card: the index of the current card, where 1 is the first card.
void showFits() const
Write all the cards in the channel to standard output.
void clearCard()
Rewind the card index to the beginning.
void setCarLin(bool cdMatrix)
Set CarLin: ignore spherical rotations on CAR projections?
void setFitsAxisOrder(std::string const &order)
Set FitsAxisOrder: the order for the WCS axes in any new FITS-WCS headers created using Channel::writ...
std::string getAllWarnings() const
Get AllWarnings: a space separated list of all the conditions names recognized by the Warnings attrib...
void setClean(bool clean)
Set Clean: remove cards used whilst reading even if an error occurs?
bool getSipOK() const
Get SipOK: use Spitzer Space Telescope keywords to define distortion?
bool getSipReplace() const
Get SipReplace: ignore inverse SIP coefficients (replacing them with fit coefficients or an iterative...
std::string getCardName() const
Get CardName: the keyword name of the current card.
void readFits()
Read cards from the source and store them in the FitsChan.
void putCards(std::string const &cards)
Replace all FITS header cards.
void setFitsCN(std::string const &name, std::string value, std::string const &comment="", bool overwrite=false)
Create a new "CONTINUE" card, possibly overwriting the current card.
void setPolyTan(int polytan)
Set PolyTan: use PVi_m keywords to define distorted TAN projection?
FoundValue< int > getFitsI(std::string const &name="", int defval=0) const
Get the value of a int card.
void setFitsCM(std::string const &comment, bool overwrite=false)
Create a new comment card, possibly overwriting the current card.
CardType getCardType() const
Get CardType: data type of the current FITS card.
bool getCarLin() const
Get CarLin: ignore spherical rotations on CAR projections?
int getTabOK() const
Get TabOK: should the FITS "-TAB" algorithm be recognised?
void setFitsTol(double tol)
Set FitsTol: Tolerance used for writing a FrameSet using a foreign encoding.
bool getIwc() const
Get Iwc: add a Frame describing Intermediate World Coords?
void setWarnings(std::string const &warnings)
Set Warnings attribute, which controls the issuing of warnings about selected conditions when an Obje...
void writeFits()
Write out all cards currently in the channel and clear the channel.
int getNCard() const
Get NCard: the number of cards.
int getFitsDigits() const
Get FitsDigits: digits of precision for floating-point FITS values.
FoundValue< std::complex< double > > getFitsCF(std::string const &name="", std::complex< double > defval={0, 0}) const
Get the value of a complex double card.
void setTabOK(int tabOK)
Set TabOK: should the FITS "-TAB" algorithm be recognised?
FoundValue< double > getFitsF(std::string const &name="", double defval=0) const
Get the value of a double card.
void setSipReplace(bool replace)
Set SipReplace: ignore inverse SIP coefficients (replacing them with fit coefficients or an iterative...
void setFitsU(std::string const &name, std::string const &comment="", bool overwrite=false)
Create a new card with an undefined value, possibly overwriting the current card.
bool getClean() const
Get Clean: remove cards used whilst reading even if an error occurs?
void emptyFits()
Delete all cards and associated information from a FitsChan.
void setFitsL(std::string const &name, bool value, std::string const &comment="", bool overwrite=false)
Create a new card of type bool, possibly overwriting the current card.
void setSipOK(bool sipOK)
Set SipOK: use Spitzer Space Telescope keywords to define distortion?
FoundValue< std::string > getFitsCN(std::string const &name="", std::string defval="") const
Get the value of a CONTINUE card.
void setEncoding(std::string const &encoding)
Set Encoding: the encoding system to use when AST Objects are stored as FITS header cards in a FitsCh...
void setCDMatrix(bool cdMatrix)
Get CDMatrix: Use CDi_j keywords to represent pixel scaling, rotation, etc?
void delFits()
Delete the current FITS card.
double getFitsTol() const
Get FitsTol: Tolerance used for writing a FrameSet using a foreign encoding.
void setFitsCF(std::string const &name, std::complex< double > value, std::string const &comment="", bool overwrite=false)
Create a new card of type std::complex<double>, possibly overwriting the current card.
void setDefB1950(bool defB1950)
Set DefB1950: use FK4 B1950 as default equatorial coordinates?
T value
The found value; ignore if found is false.
bool found
Was the value found?
AST wrapper classes and functions.
@ NOTYPE
card does not exist (card number invalid)
@ COMPLEXI
complex integer
@ COMPLEXF
complex floating point
@ COMMENT
card is a comment-style card with no "=" (COMMENT, HISTORY, ...)
@ NOVALUE
keyword is present, but has no value
@ PRESENT
keyword is present and has a value
@ ABSENT
keyword is not present
PYBIND11_MODULE(_cameraGeom, mod)