lsst.afw  16.0-43-gaa65a4573+2
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | List of all members
lsst::afw::image::Calib Class Reference

Describe an exposure's calibration. More...

#include <Calib.h>

Inheritance diagram for lsst::afw::image::Calib:
lsst::afw::table::io::PersistableFacade< Calib > lsst::afw::table::io::Persistable

Public Member Functions

 Calib () noexcept
 ctor More...
 
 Calib (double fluxMag0)
 ctor from a given fluxMagnitude zero point More...
 
 Calib (std::vector< std::shared_ptr< Calib const >> const &calibs)
 ctor from a vector of Calibs More...
 
 Calib (std::shared_ptr< lsst::daf::base::PropertySet const >)
 ctor More...
 
 Calib (Calib const &) noexcept
 
 Calib (Calib &&) noexcept
 
Calib & operator= (Calib const &) noexcept
 
Calib & operator= (Calib &&) noexcept
 
 ~Calib () noexcept override
 
void setFluxMag0 (double fluxMag0, double fluxMag0Err=0.0)
 Set the flux of a zero-magnitude object. More...
 
void setFluxMag0 (std::pair< double, double > fluxMag0AndErr)
 
std::pair< double, double > getFluxMag0 () const
 Return the flux, and error in flux, of a zero-magnitude object. More...
 
double getFlux (double const mag) const
 Return a flux (in ADUs) given a magnitude. More...
 
std::pair< double, double > getFlux (double const mag, double const magErr) const
 Return a flux and flux error (in ADUs) given a magnitude and magnitude error. More...
 
ndarray::Array< double, 1 > getFlux (ndarray::Array< double const, 1 > const &mag) const
 
std::pair< ndarray::Array< double, 1 >, ndarray::Array< double, 1 > > getFlux (ndarray::Array< double const, 1 > const &mag, ndarray::Array< double const, 1 > const &magErr) const
 
double getMagnitude (double const flux) const
 Return a magnitude given a flux. More...
 
std::pair< double, double > getMagnitude (double const flux, double const fluxErr) const
 Return a magnitude and magnitude error given a flux and flux error. More...
 
ndarray::Array< double, 1 > getMagnitude (ndarray::Array< double const, 1 > const &flux) const
 
std::pair< ndarray::Array< double, 1 >, ndarray::Array< double, 1 > > getMagnitude (ndarray::Array< double const, 1 > const &flux, ndarray::Array< double const, 1 > const &fluxErr) const
 
bool operator== (Calib const &rhs) const noexcept
 Are two Calibs identical? More...
 
bool operator!= (Calib const &rhs) const noexcept
 
Calib & operator*= (double const scale)
 
Calib & operator/= (double const scale)
 
bool isPersistable () const noexcept override
 Return true if this particular object can be persisted using afw::table::io. More...
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object. More...
 

Static Public Member Functions

static void setThrowOnNegativeFlux (bool raiseException) noexcept
 Set whether Calib should throw an exception when asked to convert a flux to a magnitude. More...
 
static bool getThrowOnNegativeFlux () noexcept
 Tell me whether Calib will throw an exception if asked to convert a flux to a magnitude. More...
 
static std::shared_ptr< Calib > readFits (fits::Fits &fitsfile)
 Read an object from an already open FITS object. More...
 
static std::shared_ptr< Calib > readFits (std::string const &fileName, int hdu=fits::DEFAULT_HDU)
 Read an object from a regular FITS file. More...
 
static std::shared_ptr< Calib > readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU)
 Read an object from a FITS file in memory. More...
 
static std::shared_ptr< Calib > dynamicCast (std::shared_ptr< Persistable > const &ptr)
 Dynamically cast a shared_ptr. More...
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

Protected Member Functions

std::string getPersistenceName () const override
 Return the unique name used to persist this object and look up its factory. More...
 
void write (OutputArchiveHandle &handle) const override
 Write the object to one or more catalogs. More...
 
virtual std::string getPythonModule () const
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More...
 

Detailed Description

Describe an exposure's calibration.

Definition at line 95 of file Calib.h.

Member Typedef Documentation

◆ OutputArchiveHandle

typedef io::OutputArchiveHandle lsst::afw::table::io::Persistable::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

Constructor & Destructor Documentation

◆ Calib() [1/6]

lsst::afw::image::Calib::Calib ( )
explicitnoexcept

ctor

Definition at line 105 of file Calib.cc.

◆ Calib() [2/6]

lsst::afw::image::Calib::Calib ( double  fluxMag0)
explicit

ctor from a given fluxMagnitude zero point

Definition at line 106 of file Calib.cc.

◆ Calib() [3/6]

lsst::afw::image::Calib::Calib ( std::vector< std::shared_ptr< Calib const >> const &  calibs)
explicit

ctor from a vector of Calibs

Parameters
calibsSet of calibs to be merged
Note
All the input calibs must have the same zeropoint; throw InvalidParameterError if this isn't true

Definition at line 107 of file Calib.cc.

◆ Calib() [4/6]

lsst::afw::image::Calib::Calib ( std::shared_ptr< lsst::daf::base::PropertySet const >  metadata)
explicit

ctor

Definition at line 132 of file Calib.cc.

◆ Calib() [5/6]

lsst::afw::image::Calib::Calib ( Calib const &  )
defaultnoexcept

◆ Calib() [6/6]

lsst::afw::image::Calib::Calib ( Calib &&  )
defaultnoexcept

◆ ~Calib()

lsst::afw::image::Calib::~Calib ( )
overridedefaultnoexcept

Member Function Documentation

◆ dynamicCast()

Dynamically cast a shared_ptr.

Dynamically cast a shared pointer and raise on failure.

You must provide an explicit template instantiation in the .cc file for each class that inherits from PersistableFacade. Designed to work around RTTI issues on macOS with hidden symbols;

Exceptions
lsst::pex::exceptions::LogicErrorif the cast fails

param[in] ptr The pointer to be cast.

Returns
The cast pointer.
Exceptions
lsst::pex::exceptions::TypeErrorIf the dynamic cast fails.

Definition at line 18 of file Persistable.cc.

◆ getFlux() [1/4]

double lsst::afw::image::Calib::getFlux ( double const  mag) const

Return a flux (in ADUs) given a magnitude.

Parameters
magthe magnitude of the object

Definition at line 236 of file Calib.cc.

◆ getFlux() [2/4]

std::pair< double, double > lsst::afw::image::Calib::getFlux ( double const  mag,
double const  magErr 
) const

Return a flux and flux error (in ADUs) given a magnitude and magnitude error.

Assumes that the errors are small and uncorrelated.

Parameters
magthe magnitude of the object
magErrthe error in the magnitude

Definition at line 251 of file Calib.cc.

◆ getFlux() [3/4]

ndarray::Array< double, 1 > lsst::afw::image::Calib::getFlux ( ndarray::Array< double const, 1 > const &  mag) const

Definition at line 240 of file Calib.cc.

◆ getFlux() [4/4]

std::pair< ndarray::Array< double, 1 >, ndarray::Array< double, 1 > > lsst::afw::image::Calib::getFlux ( ndarray::Array< double const, 1 > const &  mag,
ndarray::Array< double const, 1 > const &  magErr 
) const

Definition at line 258 of file Calib.cc.

◆ getFluxMag0()

std::pair< double, double > lsst::afw::image::Calib::getFluxMag0 ( ) const

Return the flux, and error in flux, of a zero-magnitude object.

Definition at line 192 of file Calib.cc.

◆ getMagnitude() [1/4]

double lsst::afw::image::Calib::getMagnitude ( double const  flux) const

Return a magnitude given a flux.

Parameters
fluxthe measured flux of the object (ADUs)

Definition at line 284 of file Calib.cc.

◆ getMagnitude() [2/4]

std::pair< double, double > lsst::afw::image::Calib::getMagnitude ( double const  flux,
double const  fluxErr 
) const

Return a magnitude and magnitude error given a flux and flux error.

Parameters
fluxthe measured flux of the object (ADUs)
fluxErrthe error in the measured flux (ADUs)

Definition at line 292 of file Calib.cc.

◆ getMagnitude() [3/4]

ndarray::Array< double, 1 > lsst::afw::image::Calib::getMagnitude ( ndarray::Array< double const, 1 > const &  flux) const

Definition at line 304 of file Calib.cc.

◆ getMagnitude() [4/4]

std::pair< ndarray::Array< double, 1 >, ndarray::Array< double, 1 > > lsst::afw::image::Calib::getMagnitude ( ndarray::Array< double const, 1 > const &  flux,
ndarray::Array< double const, 1 > const &  fluxErr 
) const

Definition at line 325 of file Calib.cc.

◆ getPersistenceName()

std::string lsst::afw::image::Calib::getPersistenceName ( ) const
overrideprotectedvirtual

Return the unique name used to persist this object and look up its factory.

Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 428 of file Calib.cc.

◆ getPythonModule()

std::string lsst::afw::table::io::Persistable::getPythonModule ( ) const
protectedvirtualinherited

◆ getThrowOnNegativeFlux()

bool lsst::afw::image::Calib::getThrowOnNegativeFlux ( )
staticnoexcept

Tell me whether Calib will throw an exception if asked to convert a flux to a magnitude.

Definition at line 151 of file Calib.cc.

◆ isPersistable()

bool lsst::afw::image::Calib::isPersistable ( ) const
inlineoverridevirtualnoexcept

Return true if this particular object can be persisted using afw::table::io.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 207 of file Calib.h.

◆ operator!=()

bool lsst::afw::image::Calib::operator!= ( Calib const &  rhs) const
inlinenoexcept

Definition at line 199 of file Calib.h.

◆ operator*=()

Calib & lsst::afw::image::Calib::operator*= ( double const  scale)

Definition at line 440 of file Calib.cc.

◆ operator/=()

Calib& lsst::afw::image::Calib::operator/= ( double const  scale)
inline

Definition at line 202 of file Calib.h.

◆ operator=() [1/2]

Calib & lsst::afw::image::Calib::operator= ( Calib const &  )
defaultnoexcept

◆ operator=() [2/2]

Calib & lsst::afw::image::Calib::operator= ( Calib &&  )
defaultnoexcept

◆ operator==()

bool lsst::afw::image::Calib::operator== ( Calib const &  rhs) const
noexcept

Are two Calibs identical?

Note
Maybe this should be an approximate comparison

Definition at line 179 of file Calib.cc.

◆ readFits() [1/3]

static std::shared_ptr<Calib > lsst::afw::table::io::PersistableFacade< Calib >::readFits ( fits::Fits &  fitsfile)
inlinestaticinherited

Read an object from an already open FITS object.

Parameters
[in]fitsfileFITS object to read from, already positioned at the desired HDU.

Definition at line 183 of file Persistable.h.

◆ readFits() [2/3]

static std::shared_ptr<Calib > lsst::afw::table::io::PersistableFacade< Calib >::readFits ( std::string const &  fileName,
int  hdu = fits::DEFAULT_HDU 
)
inlinestaticinherited

Read an object from a regular FITS file.

Parameters
[in]fileNameName of the file to read.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 194 of file Persistable.h.

◆ readFits() [3/3]

static std::shared_ptr<Calib > lsst::afw::table::io::PersistableFacade< Calib >::readFits ( fits::MemFileManager &  manager,
int  hdu = fits::DEFAULT_HDU 
)
inlinestaticinherited

Read an object from a FITS file in memory.

Parameters
[in]managerManager for the memory to read from.
[in]hduHDU to read, where 0 is the primary. The special value of afw::fits::DEFAULT_HDU skips the primary HDU if it is empty.

Definition at line 205 of file Persistable.h.

◆ setFluxMag0() [1/2]

void lsst::afw::image::Calib::setFluxMag0 ( double  fluxMag0,
double  fluxMag0Err = 0.0 
)

Set the flux of a zero-magnitude object.

Parameters
fluxMag0The flux in question (ADUs)
fluxMag0ErrThe error in the flux (ADUs)

Definition at line 183 of file Calib.cc.

◆ setFluxMag0() [2/2]

void lsst::afw::image::Calib::setFluxMag0 ( std::pair< double, double >  fluxMag0AndErr)
Parameters
fluxMag0AndErrThe flux and error (ADUs)

Definition at line 187 of file Calib.cc.

◆ setThrowOnNegativeFlux()

void lsst::afw::image::Calib::setThrowOnNegativeFlux ( bool  raiseException)
staticnoexcept

Set whether Calib should throw an exception when asked to convert a flux to a magnitude.

Parameters
raiseExceptionShould the exception be raised?

Definition at line 149 of file Calib.cc.

◆ write()

void lsst::afw::image::Calib::write ( OutputArchiveHandle &  handle) const
overrideprotectedvirtual

Write the object to one or more catalogs.

The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 430 of file Calib.cc.

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const &  fileName,
std::string const &  mode = "w" 
) const
inherited

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 24 of file Persistable.cc.

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager &  manager,
std::string const &  mode = "w" 
) const
inherited

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 29 of file Persistable.cc.

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits &  fitsfile) const
inherited

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file Persistable.cc.


The documentation for this class was generated from the following files: