lsst.afw  14.0-38-g278b05818
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 ()
 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...
 
void setFluxMag0 (double fluxMag0, double fluxMag0Sigma=0.0)
 Set the flux of a zero-magnitude object. More...
 
void setFluxMag0 (std::pair< double, double > fluxMag0AndSigma)
 
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
 Are two Calibs identical? More...
 
bool operator!= (Calib const &rhs) const
 
Calib & operator*= (double const scale)
 
Calib & operator/= (double const scale)
 
bool isPersistable () const
 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)
 Set whether Calib should throw an exception when asked to convert a flux to a magnitude. More...
 
static bool getThrowOnNegativeFlux ()
 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...
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

Protected Member Functions

virtual std::string getPersistenceName () const
 Return the unique name used to persist this object and look up its factory. More...
 
virtual void write (OutputArchiveHandle &handle) const
 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 96 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/4]

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

ctor

Definition at line 101 of file Calib.cc.

◆ Calib() [2/4]

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

ctor from a given fluxMagnitude zero point

Definition at line 102 of file Calib.cc.

◆ Calib() [3/4]

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 103 of file Calib.cc.

◆ Calib() [4/4]

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

ctor

Definition at line 128 of file Calib.cc.

Member Function Documentation

◆ 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 226 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 241 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 230 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 248 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 182 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 274 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 282 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 294 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 315 of file Calib.cc.

◆ getPersistenceName()

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

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 418 of file Calib.cc.

◆ getPythonModule()

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

◆ getThrowOnNegativeFlux()

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

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

Definition at line 147 of file Calib.cc.

◆ isPersistable()

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

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

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

Definition at line 202 of file Calib.h.

◆ operator!=()

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

Definition at line 194 of file Calib.h.

◆ operator*=()

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

Definition at line 430 of file Calib.cc.

◆ operator/=()

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

Definition at line 197 of file Calib.h.

◆ operator==()

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

Are two Calibs identical?

Note
Maybe this should be an approximate comparison

Definition at line 169 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 181 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 192 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 203 of file Persistable.h.

◆ setFluxMag0() [1/2]

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

Set the flux of a zero-magnitude object.

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

Definition at line 173 of file Calib.cc.

◆ setFluxMag0() [2/2]

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

Definition at line 177 of file Calib.cc.

◆ setThrowOnNegativeFlux()

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

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 145 of file Calib.cc.

◆ write()

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

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 420 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.

◆ 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.

◆ 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.

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