LSSTApplications  11.0-22-g33de520,13.0+153,14.0+52,14.0+57,14.0-1-g013352c+36,14.0-1-g13ef843+9,14.0-1-g4b114ac+14,14.0-1-g7257b6a+12,14.0-1-g8b7e855+51,14.0-13-g7a60b79+2,14.0-14-g87d16e8+10,14.0-14-gbf7a6f8a,14.0-17-g4f4ea82+5,14.0-2-g319577b+11,14.0-2-ga5af9b6+10,14.0-22-gc48c03f+3,14.0-3-g20413be+3,14.0-46-g76222d5f+3,14.0-47-g0a51fac97,14.0-5-g744ff5f+2,14.0-5-g86eb1bd+31,14.0-6-gd5b81a9+6,14.0-6-ge2c9487+42,14.0-8-g7f6dd6b+6,14.0-8-gb81b6e9+4,14.0-9-g11010eb,14.0-9-g330837b+5
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
lsst::afw::image::XYTransformFromWcsPair Class Reference

XYTransformFromWcsPair: An XYTransform obtained by putting two Wcs objects "back to back". More...

#include <Wcs.h>

Inheritance diagram for lsst::afw::image::XYTransformFromWcsPair:
lsst::afw::geom::XYTransform lsst::daf::base::Citizen

Public Types

typedef afw::geom::Point2D Point2D
 
typedef afw::geom::AffineTransform AffineTransform
 
enum  { magicSentinel = 0xdeadbeef }
 
typedef unsigned long memId
 Type of the block's ID. More...
 
typedef memId(* memNewCallback) (const memId cid)
 A function used to register a callback. More...
 
typedef memId(* memCallback) (const Citizen *ptr)
 

Public Member Functions

 XYTransformFromWcsPair (std::shared_ptr< Wcs const > dst, std::shared_ptr< Wcs const > src)
 
virtual ~XYTransformFromWcsPair ()
 
virtual std::shared_ptr< afw::geom::XYTransforminvert () const
 returns a "deep inverse" in this sense that the forward+inverse transforms do not share state default implementation; subclass may override More...
 
virtual std::shared_ptr< afw::geom::XYTransformclone () const
 The following methods are needed to devirtualize the XYTransform parent class. More...
 
virtual Point2D forwardTransform (Point2D const &pixel) const
 virtuals for forward and reverse transforms More...
 
virtual Point2D reverseTransform (Point2D const &pixel) const
 
virtual AffineTransform linearizeForwardTransform (Point2D const &point) const
 linearized forward and reversed transforms More...
 
virtual AffineTransform linearizeReverseTransform (Point2D const &point) const
 default implementation; subclass may override More...
 
std::string repr () const
 Return a string representation of a Citizen. More...
 
void markPersistent (void)
 Mark a Citizen as persistent and not destroyed until process end. More...
 
memId getId () const
 Return the Citizen's ID. More...
 

Static Public Member Functions

static bool hasBeenCorrupted ()
 Check all allocated blocks for corruption. More...
 
static memId getNextMemId ()
 Return the memId of the next object to be allocated. More...
 
static int init ()
 Called once when the memory system is being initialised. More...
 
Census

Provide a list of current Citizens

static int census (int, memId startingMemId=0)
 How many active Citizens are there? More...
 
static void census (std::ostream &stream, memId startingMemId=0)
 Print a list of all active Citizens to stream, sorted by ID. More...
 
static const std::vector< const Citizen * > * census ()
 Return a (newly allocated) std::vector of active Citizens sorted by ID. More...
 
callbackIDs

Set callback Ids.

The old Id is returned

static memId setNewCallbackId (memId id)
 Call the NewCallback when block is allocated. More...
 
static memId setDeleteCallbackId (memId id)
 Call the current DeleteCallback when block is deleted. More...
 
callbacks

Set the New/Delete callback functions; in each case the previously installed callback is returned.

These callback functions return a value which is Added to the previously registered id.

The default callback functions are called default{New,Delete}Callback; you may want to set a break point in these callbacks from your favourite debugger

static memNewCallback setNewCallback (memNewCallback func)
 Set the NewCallback function. More...
 
static memCallback setDeleteCallback (memCallback func)
 Set the DeleteCallback function. More...
 
static memCallback setCorruptionCallback (memCallback func)
 Set the CorruptionCallback function. More...
 

Protected Attributes

std::shared_ptr< Wcs const > _dst
 
std::shared_ptr< Wcs const > _src
 
bool const _isSameSkySystem
 

Detailed Description

XYTransformFromWcsPair: An XYTransform obtained by putting two Wcs objects "back to back".

Deprecated:
Deprecated in 14.0. Will be removed in 15.0; it is superseded by geom::makeWcsPairTransform.

Eventually there will be an XYTransform subclass which represents a camera distortion. For now we can get a SIP camera distortion in a clunky way, by using an XYTransformFromWcsPair with a SIP-distorted TanWcs and an undistorted Wcs.

Definition at line 508 of file Wcs.h.

Member Typedef Documentation

◆ AffineTransform

Definition at line 52 of file XYTransform.h.

◆ memCallback

typedef memId(* lsst::daf::base::Citizen::memCallback) (const Citizen *ptr)
inherited

Definition at line 59 of file Citizen.h.

◆ memId

typedef unsigned long lsst::daf::base::Citizen::memId
inherited

Type of the block's ID.

Definition at line 56 of file Citizen.h.

◆ memNewCallback

typedef memId(* lsst::daf::base::Citizen::memNewCallback) (const memId cid)
inherited

A function used to register a callback.

Definition at line 58 of file Citizen.h.

◆ Point2D

Definition at line 51 of file XYTransform.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
magicSentinel 

Definition at line 86 of file Citizen.h.

Constructor & Destructor Documentation

◆ XYTransformFromWcsPair()

lsst::afw::image::XYTransformFromWcsPair::XYTransformFromWcsPair ( std::shared_ptr< Wcs const >  dst,
std::shared_ptr< Wcs const >  src 
)

Definition at line 1167 of file Wcs.cc.

1168  : XYTransform(), _dst(dst), _src(src), _isSameSkySystem(dst->isSameSkySystem(*src)) {}
std::shared_ptr< Wcs const > _dst
Definition: Wcs.h:521
std::shared_ptr< Wcs const > _src
Definition: Wcs.h:522

◆ ~XYTransformFromWcsPair()

virtual lsst::afw::image::XYTransformFromWcsPair::~XYTransformFromWcsPair ( )
inlinevirtual

Definition at line 511 of file Wcs.h.

511 {}

Member Function Documentation

◆ census() [1/3]

int lsst::daf::base::Citizen::census ( int  ,
memId  startingMemId = 0 
)
staticinherited

How many active Citizens are there?

Parameters
startingMemIdDon't print Citizens with lower IDs

Definition at line 267 of file Citizen.cc.

270  {
271  if (startingMemId == 0) { // easy
272  ReadGuard guard(citizenLock);
273  return _activeCitizens.size();
274  }
275 
276  int n = 0;
277  ReadGuard guard(citizenLock);
278  for (table::iterator cur = _activeCitizens.begin();
279  cur != _activeCitizens.end(); cur++) {
280  if (cur->first->_CitizenId >= startingMemId) {
281  n++;
282  }
283  }
284 
285  return n;
286 }
T end(T... args)
static table _activeCitizens
Definition: Citizen.h:102
T size(T... args)
T begin(T... args)

◆ census() [2/3]

void lsst::daf::base::Citizen::census ( std::ostream stream,
memId  startingMemId = 0 
)
staticinherited

Print a list of all active Citizens to stream, sorted by ID.

Parameters
streamstream to print to
startingMemIdDon't print Citizens with lower IDs

Definition at line 290 of file Citizen.cc.

293  {
294  ReadGuard guard(citizenLock);
295 
297 
298  for (std::vector<Citizen const *>::const_iterator citizen = leaks->begin(), end = leaks->end();
299  citizen != end; ++citizen) {
300  if ((*citizen)->getId() >= startingMemId) {
301  stream << (*citizen)->repr() << "\n";
302  }
303  }
304 }
int end
STL class.
STL class.
T begin(T... args)
static const std::vector< const Citizen * > * census()
Return a (newly allocated) std::vector of active Citizens sorted by ID.
Definition: Citizen.cc:322

◆ census() [3/3]

std::vector< dafBase::Citizen const * > const * lsst::daf::base::Citizen::census ( )
staticinherited

Return a (newly allocated) std::vector of active Citizens sorted by ID.

You are responsible for deleting it; or you can say std::unique_ptr<std::vector<Citizen const*> const> leaks(Citizen::census()); and not bother (that becomes std::unique_ptr in C++11)

Definition at line 322 of file Citizen.cc.

322  {
325  ReadGuard guard(citizenLock);
326  vec->reserve(_activeCitizens.size());
327 
328  for (table::iterator cur = _activeCitizens.begin();
329  cur != _activeCitizens.end(); cur++) {
330  vec->push_back(dynamic_cast<Citizen const*>(cur->first));
331  }
332 
333  std::sort(vec->begin(), vec->end(), cmpId);
334 
335  return vec;
336 }
T end(T... args)
static table _activeCitizens
Definition: Citizen.h:102
T push_back(T... args)
T size(T... args)
STL class.
T begin(T... args)
T sort(T... args)
T reserve(T... args)

◆ clone()

std::shared_ptr< geom::XYTransform > lsst::afw::image::XYTransformFromWcsPair::clone ( void  ) const
virtual

The following methods are needed to devirtualize the XYTransform parent class.

Implements lsst::afw::geom::XYTransform.

Definition at line 1170 of file Wcs.cc.

1170  {
1171  return std::make_shared<XYTransformFromWcsPair>(_dst->clone(), _src->clone());
1172 }
std::shared_ptr< Wcs const > _dst
Definition: Wcs.h:521
std::shared_ptr< Wcs const > _src
Definition: Wcs.h:522

◆ forwardTransform()

geom::Point2D lsst::afw::image::XYTransformFromWcsPair::forwardTransform ( Point2D const &  point) const
virtual

virtuals for forward and reverse transforms

These routines are responsible for throwing exceptions if the 'point' arg is outside the domain of the transform.

Implements lsst::afw::geom::XYTransform.

Definition at line 1174 of file Wcs.cc.

1174  {
1175  if (_isSameSkySystem) {
1176  // high performance branch; no coordinate conversion required
1177  afw::geom::Angle sky0, sky1;
1178  _src->pixelToSky(pixel[0], pixel[1], sky0, sky1);
1179  return _dst->skyToPixel(sky0, sky1);
1180  } else {
1181  std::shared_ptr<afw::coord::Coord const> coordPtr{_src->pixelToSky(pixel)};
1182  return _dst->skyToPixel(*coordPtr);
1183  }
1184 }
lsst::afw::geom::Angle Angle
Definition: misc.h:36
std::shared_ptr< Wcs const > _dst
Definition: Wcs.h:521
table::PointKey< int > pixel
std::shared_ptr< Wcs const > _src
Definition: Wcs.h:522

◆ getId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getId ( ) const
inherited

Return the Citizen's ID.

Definition at line 224 of file Citizen.cc.

224  {
225  return _CitizenId;
226 }

◆ getNextMemId()

dafBase::Citizen::memId lsst::daf::base::Citizen::getNextMemId ( )
staticinherited

Return the memId of the next object to be allocated.

Definition at line 229 of file Citizen.cc.

229  {
230  return _nextMemId();
231 }
static memId _nextMemId(void)
Return the memId of the next object to be allocated.
Definition: Citizen.cc:234

◆ hasBeenCorrupted()

bool lsst::daf::base::Citizen::hasBeenCorrupted ( )
staticinherited

Check all allocated blocks for corruption.

Definition at line 353 of file Citizen.cc.

353  {
354  ReadGuard guard(citizenLock);
355  for (table::iterator cur = _activeCitizens.begin();
356  cur != _activeCitizens.end(); cur++) {
357  if (cur->first->_hasBeenCorrupted()) {
358  return true;
359  }
360  }
361  for (table::iterator cur = _persistentCitizens.begin();
362  cur != _persistentCitizens.end(); cur++) {
363  if (cur->first->_hasBeenCorrupted()) {
364  return true;
365  }
366  }
367 
368  return false;
369 }
T end(T... args)
static table _activeCitizens
Definition: Citizen.h:102
static table _persistentCitizens
Definition: Citizen.h:103
T begin(T... args)

◆ init()

int lsst::daf::base::Citizen::init ( )
staticinherited

Called once when the memory system is being initialised.

Definition at line 214 of file Citizen.cc.

214  {
215  volatile int dummy = 1;
216  return dummy;
217 }

◆ invert()

std::shared_ptr< geom::XYTransform > lsst::afw::image::XYTransformFromWcsPair::invert ( ) const
virtual

returns a "deep inverse" in this sense that the forward+inverse transforms do not share state default implementation; subclass may override

Reimplemented from lsst::afw::geom::XYTransform.

Definition at line 1198 of file Wcs.cc.

1198  {
1199  // just swap src, dst
1200  return std::make_shared<XYTransformFromWcsPair>(_src, _dst);
1201 }
std::shared_ptr< Wcs const > _dst
Definition: Wcs.h:521
std::shared_ptr< Wcs const > _src
Definition: Wcs.h:522

◆ linearizeForwardTransform()

virtual AffineTransform lsst::afw::geom::XYTransform::linearizeForwardTransform ( Point2D const &  point) const
virtualinherited

linearized forward and reversed transforms

Deprecated:
Deprecated in 14.0. Will be removed in 15.0; it is superseded by geom::linearizeTransform.

These are virtual but not pure virtual; there is a default implementation which calls forwardTransform() or reverseTransform() and takes finite differences with step size equal to one.

The following should always be satisfied for an arbitrary Point2D p (and analogously for the reverse transform) this->forwardTransform(p) == this->linearizeForwardTransform(p)(p);default implementation; subclass may override

Reimplemented in lsst::afw::geom::RadialXYTransform, lsst::afw::geom::AffineXYTransform, lsst::afw::geom::MultiXYTransform, lsst::afw::geom::InvertedXYTransform, and lsst::afw::geom::IdentityXYTransform.

◆ linearizeReverseTransform()

virtual AffineTransform lsst::afw::geom::XYTransform::linearizeReverseTransform ( Point2D const &  point) const
virtualinherited

◆ markPersistent()

void lsst::daf::base::Citizen::markPersistent ( void  )
inherited

Mark a Citizen as persistent and not destroyed until process end.

Definition at line 254 of file Citizen.cc.

254  {
255  WriteGuard guard(citizenLock);
256  _persistentCitizens[this] = _activeCitizens[this];
257  _activeCitizens.erase(this);
258 }
static table _activeCitizens
Definition: Citizen.h:102
T erase(T... args)
static table _persistentCitizens
Definition: Citizen.h:103

◆ repr()

std::string lsst::daf::base::Citizen::repr ( ) const
inherited

Return a string representation of a Citizen.

Definition at line 245 of file Citizen.cc.

245  {
246  return boost::str(boost::format("%d: %08x %s")
247  % _CitizenId
248  % this
250  );
251 }
std::string demangleType(std::string const _typeName)
Definition: Demangle.cc:113
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:134
const char * _typeName
Definition: Citizen.h:94

◆ reverseTransform()

geom::Point2D lsst::afw::image::XYTransformFromWcsPair::reverseTransform ( Point2D const &  pixel) const
virtual

Implements lsst::afw::geom::XYTransform.

Definition at line 1186 of file Wcs.cc.

1186  {
1187  if (_isSameSkySystem) {
1188  // high performance branch; no coordinate conversion required
1189  afw::geom::Angle sky0, sky1;
1190  _dst->pixelToSky(pixel[0], pixel[1], sky0, sky1);
1191  return _src->skyToPixel(sky0, sky1);
1192  } else {
1193  std::shared_ptr<afw::coord::Coord const> coordPtr{_dst->pixelToSky(pixel)};
1194  return _src->skyToPixel(*coordPtr);
1195  }
1196 }
lsst::afw::geom::Angle Angle
Definition: misc.h:36
std::shared_ptr< Wcs const > _dst
Definition: Wcs.h:521
table::PointKey< int > pixel
std::shared_ptr< Wcs const > _src
Definition: Wcs.h:522

◆ setCorruptionCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setCorruptionCallback ( Citizen::memCallback  func)
staticinherited

Set the CorruptionCallback function.

Parameters
funcfunction be called when block is found to be corrupted

Definition at line 432 of file Citizen.cc.

434  {
436  _corruptionCallback = func;
437 
438  return old;
439 }
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:59
static memCallback _corruptionCallback
Definition: Citizen.h:113

◆ setDeleteCallback()

dafBase::Citizen::memCallback lsst::daf::base::Citizen::setDeleteCallback ( Citizen::memCallback  func)
staticinherited

Set the DeleteCallback function.

Parameters
funcfunction be called when desired block is deleted

Definition at line 422 of file Citizen.cc.

424  {
426  _deleteCallback = func;
427 
428  return old;
429 }
static memCallback _deleteCallback
Definition: Citizen.h:112
memId(* memCallback)(const Citizen *ptr)
Definition: Citizen.h:59

◆ setDeleteCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setDeleteCallbackId ( Citizen::memId  id)
staticinherited

Call the current DeleteCallback when block is deleted.

Parameters
idDesired ID

Definition at line 387 of file Citizen.cc.

389  {
390  WriteGuard guard(citizenLock);
391  Citizen::memId oldId = _deleteId;
392  _deleteId = id;
393 
394  return oldId;
395 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:56
int id
Definition: CR.cc:155
static memId _deleteId
Definition: Citizen.h:109

◆ setNewCallback()

dafBase::Citizen::memNewCallback lsst::daf::base::Citizen::setNewCallback ( Citizen::memNewCallback  func)
staticinherited

Set the NewCallback function.

Parameters
funcThe new function to be called when a designated block is allocated

Definition at line 412 of file Citizen.cc.

414  {
416  _newCallback = func;
417 
418  return old;
419 }
memId(* memNewCallback)(const memId cid)
A function used to register a callback.
Definition: Citizen.h:58
static memNewCallback _newCallback
Definition: Citizen.h:111

◆ setNewCallbackId()

dafBase::Citizen::memId lsst::daf::base::Citizen::setNewCallbackId ( Citizen::memId  id)
staticinherited

Call the NewCallback when block is allocated.

Parameters
idDesired ID

Definition at line 376 of file Citizen.cc.

378  {
379  WriteGuard guard(citizenLock);
380  Citizen::memId oldId = _newId;
381  _newId = id;
382 
383  return oldId;
384 }
unsigned long memId
Type of the block&#39;s ID.
Definition: Citizen.h:56
static memId _newId
Definition: Citizen.h:108
int id
Definition: CR.cc:155

Member Data Documentation

◆ _dst

std::shared_ptr<Wcs const> lsst::afw::image::XYTransformFromWcsPair::_dst
protected

Definition at line 521 of file Wcs.h.

◆ _isSameSkySystem

bool const lsst::afw::image::XYTransformFromWcsPair::_isSameSkySystem
protected

Definition at line 523 of file Wcs.h.

◆ _src

std::shared_ptr<Wcs const> lsst::afw::image::XYTransformFromWcsPair::_src
protected

Definition at line 522 of file Wcs.h.


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