LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Associations.cc
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * This file is part of jointcal.
4  *
5  * Developed for the LSST Data Management System.
6  * This product includes software developed by the LSST Project
7  * (https://www.lsst.org).
8  * See the COPYRIGHT file at the top-level directory of this distribution
9  * for details of code ownership.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
25 #include <cmath>
26 #include <iostream>
27 #include <limits>
28 #include <sstream>
29 
30 #include "lsst/log/Log.h"
32 #include "lsst/jointcal/CcdImage.h"
35 #include "lsst/jointcal/Frame.h"
36 #include "lsst/jointcal/FatPoint.h"
39 
40 #include "lsst/afw/image/Image.h"
43 
44 #include "lsst/pex/exceptions.h"
45 #include "lsst/afw/geom/Box.h"
46 #include "lsst/afw/geom/Point.h"
47 #include "lsst/afw/image/Calib.h"
48 
49 #include "lsst/sphgeom/LonLat.h"
50 #include "lsst/sphgeom/Circle.h"
52 
53 namespace jointcal = lsst::jointcal;
54 
55 namespace {
56 LOG_LOGGER _log = LOG_GET("jointcal.Associations");
57 }
58 
59 namespace lsst {
60 namespace jointcal {
61 
68  lsst::jointcal::JointcalControl const &control) {
69  auto ccdImage = std::make_shared<CcdImage>(catalog, wcs, visitInfo, bbox, filter, photoCalib, detector,
70  visit, ccd, control.sourceFluxField);
71  ccdImageList.push_back(ccdImage);
72  LOGLS_DEBUG(_log, "Catalog " << ccdImage->getName() << " has " << ccdImage->getWholeCatalog().size()
73  << " objects.");
74 }
75 
78  centers.reserve(ccdImageList.size());
79  for (auto const &ccdImage : ccdImageList) {
80  centers.push_back(ccdImage->getBoresightRaDec());
81  }
82  auto commonTangentPoint = afw::geom::averageSpherePoint(centers);
83  LOGLS_DEBUG(_log, "Using common tangent point: " << commonTangentPoint.getPosition(afw::geom::degrees));
84  setCommonTangentPoint(commonTangentPoint.getPosition(afw::geom::degrees));
85 }
86 
88  _commonTangentPoint = Point(commonTangentPoint.getX(), commonTangentPoint.getY()); // a jointcal::Point
89  for (auto &ccdImage : ccdImageList) ccdImage->setCommonTangentPoint(_commonTangentPoint);
90 }
91 
93  // Compute the frame on the common tangent plane that contains all input images.
94  Frame tangentPlaneFrame;
95 
96  for (auto const &ccdImage : ccdImageList) {
97  Frame CTPFrame = ccdImage->getPixelToCommonTangentPlane()->apply(ccdImage->getImageFrame(), false);
98  if (tangentPlaneFrame.getArea() == 0)
99  tangentPlaneFrame = CTPFrame;
100  else
101  tangentPlaneFrame += CTPFrame;
102  }
103 
104  // Convert tangent plane coordinates to RaDec.
105  AstrometryTransformLinear identity;
106  TanPixelToRaDec commonTangentPlaneToRaDec(identity, _commonTangentPoint);
107  Frame raDecFrame = commonTangentPlaneToRaDec.apply(tangentPlaneFrame, false);
108 
110  points.reserve(4);
111  // raDecFrame is in on-sky (RA,Dec) degrees stored as an x/y box:
112  // the on-sky bounding box it represents is given by the corners of that box.
113  points.emplace_back(sphgeom::LonLat::fromDegrees(raDecFrame.xMin, raDecFrame.yMin));
114  points.emplace_back(sphgeom::LonLat::fromDegrees(raDecFrame.xMax, raDecFrame.yMin));
115  points.emplace_back(sphgeom::LonLat::fromDegrees(raDecFrame.xMin, raDecFrame.yMax));
116  points.emplace_back(sphgeom::LonLat::fromDegrees(raDecFrame.xMax, raDecFrame.yMax));
117 
118  return sphgeom::ConvexPolygon::convexHull(points).getBoundingCircle();
119 }
120 
121 void Associations::associateCatalogs(const double matchCutInArcSec, const bool useFittedList,
122  const bool enlargeFittedList) {
123  // clear reference stars
124  refStarList.clear();
125 
126  // clear measurement counts and associations to refstars, but keep fittedStars themselves.
127  for (auto &item : fittedStarList) {
128  item->clearBeforeAssoc();
129  }
130  // clear fitted stars
131  if (!useFittedList) fittedStarList.clear();
132 
133  for (auto &ccdImage : ccdImageList) {
134  std::shared_ptr<AstrometryTransform> toCommonTangentPlane = ccdImage->getPixelToCommonTangentPlane();
135 
136  // Clear the catalog to fit and copy the whole catalog into it.
137  // This allows reassociating from scratch after a fit.
138  ccdImage->resetCatalogForFit();
139  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
140 
141  // Associate with previous lists.
142  /* To speed up the match (more precisely the contruction of the FastFinder), select in the
143  fittedStarList the objects that are within reach of the current ccdImage */
144  Frame ccdImageFrameCPT = toCommonTangentPlane->apply(ccdImage->getImageFrame(), false);
145  ccdImageFrameCPT = ccdImageFrameCPT.rescale(1.10); // add 10 % margin.
146  // We cannot use FittedStarList::ExtractInFrame, because it does an actual copy, which we don't want
147  // here: we want the pointers in the StarMatch to refer to fittedStarList elements.
148  FittedStarList toMatch;
149 
150  for (auto const &fittedStar : fittedStarList) {
151  if (ccdImageFrameCPT.inFrame(*fittedStar)) {
152  toMatch.push_back(fittedStar);
153  }
154  }
155 
156  // divide by 3600 because coordinates in CTP are in degrees.
157  auto starMatchList = listMatchCollect(Measured2Base(catalog), Fitted2Base(toMatch),
158  toCommonTangentPlane.get(), matchCutInArcSec / 3600.);
159 
160  /* should check what this removeAmbiguities does... */
161  LOGLS_DEBUG(_log, "Measured-to-Fitted matches before removing ambiguities " << starMatchList->size());
162  starMatchList->removeAmbiguities(*toCommonTangentPlane);
163  LOGLS_DEBUG(_log, "Measured-to-Fitted matches after removing ambiguities " << starMatchList->size());
164 
165  // Associate MeasuredStar -> FittedStar using the surviving matches.
166 
167  int matchedCount = 0;
168  for (auto const &starMatch : *starMatchList) {
169  auto bs = starMatch.s1;
170  auto ms_const = std::dynamic_pointer_cast<const MeasuredStar>(bs);
171  auto ms = std::const_pointer_cast<MeasuredStar>(ms_const);
172  auto bs2 = starMatch.s2;
173  auto fs_const = std::dynamic_pointer_cast<const FittedStar>(bs2);
174  auto fs = std::const_pointer_cast<FittedStar>(fs_const);
175  ms->setFittedStar(fs);
176  matchedCount++;
177  }
178  LOGLS_INFO(_log, "Matched " << matchedCount << " objects in " << ccdImage->getName());
179 
180  // add unmatched objets to FittedStarList
181  int unMatchedCount = 0;
182  for (auto const &mstar : catalog) {
183  // to check if it was matched, just check if it has a fittedStar Pointer assigned
184  if (mstar->getFittedStar()) continue;
185  if (enlargeFittedList) {
186  auto fs = std::make_shared<FittedStar>(*mstar);
187  // transform coordinates to CommonTangentPlane
188  toCommonTangentPlane->transformPosAndErrors(*fs, *fs);
189  fittedStarList.push_back(fs);
190  mstar->setFittedStar(fs);
191  }
192  unMatchedCount++;
193  }
194  LOGLS_INFO(_log, "Unmatched objects: " << unMatchedCount);
195  } // end of loop on CcdImages
196 
197  // !!!!!!!!!!!!!!!!!
198  // TODO: DO WE REALLY NEED THIS???
199  // Why do we need to do this, instead of directly computing them in normalizeFittedStars?
200  // What makes the magnitudes special here?
201  // !!!!!!!!!!!!!!!!!
202  // assignMags();
203 }
204 
206  std::string const &fluxField, float refCoordinateErr,
207  bool rejectBadFluxes) {
208  if (refCat.size() == 0) {
210  " reference catalog is empty : stop here "));
211  }
212 
213  afw::table::CoordKey coordKey = refCat.getSchema()["coord"];
214  // Handle reference catalogs that don't have position errors.
215  afw::table::Key<float> raErrKey;
216  afw::table::Key<float> decErrKey;
217  if (std::isnan(refCoordinateErr)) {
218  raErrKey = refCat.getSchema()["coord_raErr"];
219  decErrKey = refCat.getSchema()["coord_decErr"];
220  }
221 
222  auto fluxKey = refCat.getSchema().find<double>(fluxField).key;
223  // Handle reference catalogs that don't have flux errors.
224  afw::table::Key<double> fluxErrKey;
225  try {
226  fluxErrKey = refCat.getSchema().find<double>(fluxField + "Err").key;
227  } catch (pex::exceptions::NotFoundError &) {
228  LOGLS_WARN(_log, "Flux error field ("
229  << fluxField << "Err"
230  << ") not found in reference catalog. Not using ref flux errors.");
231  }
232 
233  refStarList.clear();
234  for (size_t i = 0; i < refCat.size(); i++) {
235  auto const &record = refCat.get(i);
236 
237  auto coord = record->get(coordKey);
238  double flux = record->get(fluxKey);
239  double fluxErr;
240  if (fluxErrKey.isValid()) {
241  fluxErr = record->get(fluxErrKey);
242  } else {
244  }
245  double ra = lsst::afw::geom::radToDeg(coord.getLongitude());
246  double dec = lsst::afw::geom::radToDeg(coord.getLatitude());
247  auto star = std::make_shared<RefStar>(ra, dec, flux, fluxErr);
248 
249  if (std::isnan(refCoordinateErr)) {
250  star->vx = record->get(raErrKey);
251  star->vy = record->get(decErrKey);
252  } else {
253  // Compute and use the fake errors
254  star->vx = std::pow(refCoordinateErr / 1000. / 3600. / std::cos(coord.getLatitude()), 2);
255  star->vy = std::pow(refCoordinateErr / 1000. / 3600., 2);
256  }
257  // TODO: cook up a covariance as none of our current refcats have it
258  star->vxy = 0.;
259 
260  // Reject sources with non-finite fluxes and flux errors, and fluxErr=0 (which gives chi2=inf).
261  if (rejectBadFluxes && (!std::isfinite(flux) || !std::isfinite(fluxErr) || fluxErr <= 0)) continue;
262  refStarList.push_back(star);
263  }
264 
265  // project on CTP (i.e. RaDec2CTP), in degrees
266  AstrometryTransformLinear identity;
267  TanRaDecToPixel raDecToCommonTangentPlane(identity, _commonTangentPoint);
268 
269  associateRefStars(matchCut.asArcseconds(), &raDecToCommonTangentPlane);
270 }
271 
272 void Associations::associateRefStars(double matchCutInArcSec, const AstrometryTransform *transform) {
273  // associate with FittedStars
274  // 3600 because coordinates are in degrees (in CTP).
275  auto starMatchList = listMatchCollect(Ref2Base(refStarList), Fitted2Base(fittedStarList), transform,
276  matchCutInArcSec / 3600.);
277 
278  LOGLS_DEBUG(_log, "Refcat matches before removing ambiguities " << starMatchList->size());
279  starMatchList->removeAmbiguities(*transform);
280  LOGLS_DEBUG(_log, "Refcat matches after removing ambiguities " << starMatchList->size());
281 
282  // actually associate things
283  for (auto const &starMatch : *starMatchList) {
284  const BaseStar &bs = *starMatch.s1;
285  const RefStar &rs_const = dynamic_cast<const RefStar &>(bs);
286  RefStar &rs = const_cast<RefStar &>(rs_const);
287  const BaseStar &bs2 = *starMatch.s2;
288  const FittedStar &fs_const = dynamic_cast<const FittedStar &>(bs2);
289  FittedStar &fs = const_cast<FittedStar &>(fs_const);
290  // rs->setFittedStar(*fs);
291  fs.setRefStar(&rs);
292  }
293 
294  LOGLS_INFO(_log,
295  "Associated " << starMatchList->size() << " reference stars among " << refStarList.size());
296 }
297 
298 void Associations::prepareFittedStars(int minMeasurements) {
299  selectFittedStars(minMeasurements);
300  normalizeFittedStars();
301 }
302 
303 void Associations::selectFittedStars(int minMeasurements) {
304  LOGLS_INFO(_log, "Fitted stars before measurement # cut: " << fittedStarList.size());
305 
306  int totalMeasured = 0, validMeasured = 0;
307 
308  // first pass: remove objects that have less than a certain number of measurements.
309  for (auto const &ccdImage : ccdImageList) {
310  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
311  // Iteration happens internal to the loop, as we may delete measuredStars from catalog.
312  for (MeasuredStarIterator mi = catalog.begin(); mi != catalog.end();) {
313  MeasuredStar &mstar = **mi;
314  ++totalMeasured;
315 
316  auto fittedStar = mstar.getFittedStar();
317  // measuredStar has no fittedStar: move on.
318  if (fittedStar == nullptr) {
319  ++mi;
320  continue;
321  }
322 
323  // keep FittedStars which either have a minimum number of
324  // measurements, or are matched to a RefStar
325  if (!fittedStar->getRefStar() && fittedStar->getMeasurementCount() < minMeasurements) {
326  fittedStar->getMeasurementCount()--;
327  mi = catalog.erase(mi); // mi now points to the next measuredStar.
328  } else {
329  ++validMeasured;
330  ++mi;
331  }
332  } // end loop on objects in catalog
333  } // end loop on catalogs
334 
335  // now FittedStars with less than minMeasurements should have zero measurementCount.
336  for (FittedStarIterator fi = fittedStarList.begin(); fi != fittedStarList.end();) {
337  if ((*fi)->getMeasurementCount() == 0) {
338  fi = fittedStarList.erase(fi);
339  } else {
340  ++fi;
341  }
342  }
343 
344  LOGLS_INFO(_log, "Fitted stars after measurement # cut: " << fittedStarList.size());
345  LOGLS_INFO(_log, "Total, valid number of Measured stars: " << totalMeasured << ", " << validMeasured);
346 }
347 
348 void Associations::normalizeFittedStars() const {
349  // Clear positions in order to take the average of the measuredStars.
350  for (auto &fittedStar : fittedStarList) {
351  fittedStar->x = 0.0;
352  fittedStar->y = 0.0;
353  fittedStar->setFlux(0.0);
354  fittedStar->getMag() = 0.0;
355  }
356 
357  // Iterate over measuredStars to add their values into their fittedStars
358  for (auto const &ccdImage : ccdImageList) {
359  std::shared_ptr<AstrometryTransform> toCommonTangentPlane = ccdImage->getPixelToCommonTangentPlane();
360  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
361  for (auto &mi : catalog) {
362  auto fittedStar = mi->getFittedStar();
363  if (fittedStar == nullptr)
364  throw(LSST_EXCEPT(
366  "All measuredStars must have a fittedStar: did you call selectFittedStars()?"));
367  auto point = toCommonTangentPlane->apply(*mi);
368  fittedStar->x += point.x;
369  fittedStar->y += point.y;
370  fittedStar->getFlux() += mi->getFlux();
371  }
372  }
373 
374  for (auto &fi : fittedStarList) {
375  auto measurementCount = fi->getMeasurementCount();
376  fi->x /= measurementCount;
377  fi->y /= measurementCount;
378  fi->getFlux() /= measurementCount;
379  fi->getMag() = utils::nanojanskyToABMagnitude(fi->getFlux());
380  }
381 }
382 
383 void Associations::assignMags() {
384  for (auto const &ccdImage : ccdImageList) {
385  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
386  for (auto const &mstar : catalog) {
387  auto fstar = mstar->getFittedStar();
388  if (!fstar) continue;
389  fstar->addMagMeasurement(mstar->getMag(), mstar->getMagWeight());
390  }
391  }
392 }
393 
395  // By default, Associations::fittedStarList is expressed on the Associations::commonTangentPlane.
396  // For AstrometryFit, we need it on the sky.
397  if (!fittedStarList.inTangentPlaneCoordinates) {
398  LOGLS_WARN(_log,
399  "DeprojectFittedStars: Fitted stars are already in sidereal coordinates, nothing done ");
400  return;
401  }
402 
403  TanPixelToRaDec ctp2Sky(AstrometryTransformLinear(), getCommonTangentPoint());
404  fittedStarList.applyTransform(ctp2Sky);
405  fittedStarList.inTangentPlaneCoordinates = false;
406 }
407 
409  return std::count_if(ccdImageList.begin(), ccdImageList.end(), [](std::shared_ptr<CcdImage> const &item) {
410  return item->getCatalogForFit().size() > 0;
411  });
412 }
413 
415  size_t count = 0;
416  for (auto const &fittedStar : fittedStarList) {
417  if ((fittedStar != nullptr) & (fittedStar->getRefStar() != nullptr)) count++;
418  }
419  return count;
420 }
421 
422 #ifdef TODO
423 void Associations::collectMCStars(int realization) {
424  CcdImageIterator I;
425  StarMatchIterator smI;
426 
427  for (I = ccdImageList.begin(); I != ccdImageList.end(); I++) {
428  CcdImage &ccdImage = **I;
429  string dbimdir = ccdImage.Dir();
430  string mctruth = dbimdir + "/mc/mctruth.list";
431 
432  if (realization >= 0) {
433  stringstream sstrm;
434  sstrm << dbimdir << "/mc/mctruth_" << realization << ".list";
435  mctruth = sstrm.str();
436  }
437 
439  MeasuredStarList &catalog = ccdImage.getCatalogForFit();
440 
441  // BaseStarWithErrorList mctruthlist(mctruth);
442  DicStarList mctruthlist(mctruth);
443  auto starMatchList =
444  listMatchCollect(Measured2Base(catalog), Dic2Base(mctruthlist), &gti, 1. /* pixel ? */);
445  if (starMatchList)
446  for (smI = starMatchList->begin(); smI != starMatchList->end(); smI++) {
447  StarMatch &sm = *smI;
448  BaseStar *bs = sm.s1;
449  MeasuredStar *mstar = dynamic_cast<MeasuredStar *>(bs);
450  bs = sm.s2;
451  DicStar *dstar = dynamic_cast<DicStar *>(bs);
452  std::unique_ptr<BaseStarWithError> mcstar(new BaseStarWithError(*bs));
453  mcstar->GetMCInfo().iflux = dstar->getval("iflux");
454  mcstar->GetMCInfo().tflux = dstar->getval("sflux");
455  /*
456  mstar->SetMCTruth(mcstar);
457  mstar->SetMCMeas(mcstar);
458  */
459  }
460  else
461  LOGLS_FATAL(_log, "CollectMCStars Unable to match MCTruth w/ catalog!");
462  }
463 }
464 
465 void Associations::setFittedStarColors(std::string dicStarListName, std::string color,
466  double matchCutArcSec) {
467  // decode color string in case it is x-y
468  size_t pos_minus = color.find('-');
469  bool compute_diff = (pos_minus != string::npos);
470  std::string c1, c2;
471  c1 = color.substr(0, pos_minus); // if pos_minus == npos, means "up to the end"
472  if (compute_diff) c2 = color.substr(pos_minus + 1, string::npos);
473  DicStarList cList(dicStarListName);
474  if (!cList.HasKey(c1))
475  throw(GastroException("Associations::SetFittedstarColors : " + dicStarListName +
476  " misses a key named \"" + c1 + "\""));
477  if (compute_diff && !cList.HasKey(c2))
478  throw(GastroException("Associations::SetFittedstarColors : " + dicStarListName +
479  " misses a key named \"" + c2 + "\""));
480  // we associate in some tangent plane. The reference catalog is expressed on the sky,
481  // but FittedStar's may be still in this tangent plane.
482  BaseStarList &l1 = (BaseStarList &)fittedStarList;
484  TanRaDecToPixel proj(AstrometryTransformLinear(), getCommonTangentPoint());
485  // project or not ?
486  AstrometryTransform *id_or_proj = &proj;
487  if (fittedStarList.inTangentPlaneCoordinates) id_or_proj = &id;
488  // The color List is to be projected:
489  TStarList projected_cList((BaseStarList &)cList, proj);
490  // Associate
491  auto starMatchList = listMatchCollect(Fitted2Base(fittedStarList), (const BaseStarList &)projected_cList,
492  id_or_proj, matchCutArcSec / 3600);
493 
494  LOGLS_INFO(_log, "Matched " << starMatchList->size() << '/' << fittedStarList.size()
495  << " FittedStars to color catalog");
496  // Evaluate and assign colors.
497  for (auto i = starMatchList->begin(); i != starMatchList->end(); ++i) {
498  BaseStar *s1 = i->s1;
499  FittedStar *fs = dynamic_cast<FittedStar *>(s1);
500  BaseStar *s2 = i->s2;
501  const TStar *ts = dynamic_cast<const TStar *>(s2);
502  const DicStar *ds = dynamic_cast<const DicStar *>(ts->get_original());
503  fs->color = ds->getval(c1);
504  if (compute_diff) fs->color -= ds->getval(c2);
505  }
506 }
507 
508 #endif /* TODO */
509 } // namespace jointcal
510 } // namespace lsst
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
Definition: Log.h:633
This file declares a class for representing circular regions on the unit sphere.
Objects used as position anchors, typically USNO stars.
Definition: RefStar.h:39
The transformation that handles pixels to sideral transformations (Gnomonic, possibly with polynomial...
int nCcdImagesValidForFit() const
return the number of CcdImages with non-empty catalogs to-be-fit.
#define LOG_LOGGER
Definition: Log.h:688
Key< int > visitInfo
Definition: Exposure.cc:70
MeasuredStarList::iterator MeasuredStarIterator
Definition: MeasuredStar.h:154
A hanger for star associations.
Definition: StarMatch.h:54
implements the linear transformations (6 real coefficients).
A point in a plane.
Definition: Point.h:36
double getArea() const
Definition: Frame.cc:118
constexpr double radToDeg(double x) noexcept
Definition: Angle.h:52
void apply(const double xIn, const double yIn, double &xOut, double &yOut) const
Transform pixels to ICRS RA, Dec in degrees.
void collectRefStars(afw::table::SimpleCatalog &refCat, afw::geom::Angle matchCut, std::string const &fluxField, float refCoordinateErr, bool rejectBadFluxes=false)
Collect stars from an external reference catalog and associate them with fittedStars.
double xMin
coordinate of boundary.
Definition: Frame.h:41
T end(T... args)
Key< int > photoCalib
Definition: Exposure.cc:67
table::Key< int > id
Definition: Detector.cc:166
Schema getSchema() const
Return the schema associated with the catalog&#39;s table.
Definition: Catalog.h:117
std::unique_ptr< StarMatchList > listMatchCollect(const BaseStarList &list1, const BaseStarList &list2, const AstrometryTransform *guess, const double maxDist)
assembles star matches.
Definition: ListMatch.cc:569
double dec
Definition: Match.cc:41
A class representing an angle.
Definition: Angle.h:127
void associateCatalogs(const double matchCutInArcsec=0, const bool useFittedList=false, const bool enlargeFittedList=true)
incrementaly builds a merged catalog of all image catalogs
A list of MeasuredStar. They are usually filled in Associations::createCcdImage.
Definition: MeasuredStar.h:146
table::Key< table::Array< std::uint8_t > > wcs
Definition: SkyWcs.cc:71
Frame rescale(const double factor) const
rescale it. The center does not move.
Definition: Frame.cc:110
STL class.
LSST DM logging module built on log4cxx.
pairs of points
The base class for handling stars. Used by all matching routines.
Definition: BaseStar.h:50
void prepareFittedStars(int minMeasurements)
Set the color field of FittedStar &#39;s from a colored catalog.
size_t nFittedStarsWithAssociatedRefStar() const
Return the number of fittedStars that have an associated refStar.
Reports attempts to access elements using an invalid key.
Definition: Runtime.h:151
T push_back(T... args)
std::lists of Stars.
Definition: StarList.h:58
rectangle with sides parallel to axes.
Definition: Frame.h:38
#define LOGLS_DEBUG(logger, message)
Log a debug-level message using an iostream-based interface.
Definition: Log.h:593
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
Definition: Schema.cc:656
AngleUnit constexpr degrees
constant with units of degrees
Definition: Angle.h:109
A base class for image defects.
void setRefStar(const RefStar *_refStar)
Set the astrometric reference star associated with this star.
Definition: FittedStar.cc:46
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:63
void computeCommonTangentPoint()
Sets a shared tangent point for all ccdImages, using the mean of the centers of all ccdImages...
Definition: Associations.cc:76
FittedStarList::iterator FittedStarIterator
Definition: FittedStar.h:132
T erase(T... args)
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:123
T str(T... args)
This one is the Tangent Plane (called gnomonic) projection (from celestial sphere to tangent plane) ...
T isfinite(T... args)
T cos(T... args)
objects measured on actual images.
Definition: MeasuredStar.h:46
table::Key< int > detector
T dynamic_pointer_cast(T... args)
::std::list< StarMatch >::iterator StarMatchIterator
Definition: StarMatch.h:133
void deprojectFittedStars()
Sends back the fitted stars coordinates on the sky FittedStarsList::inTangentPlaneCoordinates keeps t...
table::Box2IKey bbox
Definition: Detector.cc:169
constexpr double asArcseconds() const noexcept
Return an Angle&#39;s value in arcseconds.
Definition: Angle.h:178
T count_if(T... args)
Circle is a circular region on the unit sphere that contains its boundary.
Definition: Circle.h:46
#define LOGLS_INFO(logger, message)
Log a info-level message using an iostream-based interface.
Definition: Log.h:613
void setCommonTangentPoint(lsst::afw::geom::Point2D const &commonTangentPoint)
Sets a shared tangent point for all ccdImages.
Definition: Associations.cc:87
A do-nothing transformation. It anyway has dummy routines to mimick a AstrometryTransform.
T get(T... args)
bool inFrame(double x, double y) const
inside?
Definition: Frame.cc:120
T find(T... args)
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
double nanojanskyToABMagnitude(double flux)
Convert a flux in nanojansky to AB magnitude.
Definition: Magnitude.cc:30
void createCcdImage(afw::table::SourceCatalog &catalog, std::shared_ptr< lsst::afw::geom::SkyWcs > wcs, std::shared_ptr< lsst::afw::image::VisitInfo > visitInfo, lsst::afw::geom::Box2I const &bbox, std::string const &filter, std::shared_ptr< afw::image::PhotoCalib > photoCalib, std::shared_ptr< afw::cameraGeom::Detector > detector, int visit, int ccd, lsst::jointcal::JointcalControl const &control)
Create a ccdImage from an exposure catalog and metadata, and add it to the list.
Definition: Associations.cc:62
STL class.
STL class.
a virtual (interface) class for geometric transformations.
T begin(T... args)
Key< U > key
Definition: Schema.cc:281
T pow(T... args)
MeasuredStarList const & getCatalogForFit() const
Gets the catalog to be used for fitting, which may have been cleaned-up.
Definition: CcdImage.h:94
Combinatorial searches for linear transformations to go from list1 to list2.
BaseStarList & Fitted2Base(FittedStarList &This)
Definition: FittedStar.cc:64
std::shared_ptr< const BaseStar > s2
Definition: StarMatch.h:62
BaseStarList & Measured2Base(MeasuredStarList &This)
Definition: MeasuredStar.cc:58
std::shared_ptr< RecordT > const get(size_type i) const
Return a pointer to the record at index i.
Definition: Catalog.h:459
std::shared_ptr< const BaseStar > s1
Definition: StarMatch.h:62
Reports invalid arguments.
Definition: Runtime.h:66
T isnan(T... args)
T substr(T... args)
size_type size() const
Return the number of elements in the catalog.
Definition: Catalog.h:408
std::string sourceFluxField
"name of flux field in source catalog" ;
lsst::sphgeom::Circle computeBoundingCircle() const
Return the bounding circle in on-sky (RA, Dec) coordinates containing all CcdImages.
Definition: Associations.cc:92
T quiet_NaN(T... args)
#define LOGLS_FATAL(logger, message)
Log a fatal-level message using an iostream-based interface.
Definition: Log.h:673
Handler of an actual image from a single CCD.
Definition: CcdImage.h:64
#define LOG_GET(logger)
Returns a Log object associated with logger.
Definition: Log.h:75
std::shared_ptr< FittedStar > getFittedStar() const
Definition: MeasuredStar.h:113
This file declares a class for representing convex polygons with great circle edges on the unit spher...
An integer coordinate rectangle.
Definition: Box.h:54
This file contains a class representing spherical coordinates.
The objects which have been measured several times.
Definition: FittedStar.h:61
SpherePoint averageSpherePoint(std::vector< SpherePoint > const &coords)
Return the average of a list of coordinates.
Definition: SpherePoint.cc:235
T reserve(T... args)
A FunctorKey used to get or set celestial coordinates from a pair of lsst::geom::Angle keys...
Definition: aggregates.h:210
Reports errors that are due to events beyond the control of the program.
Definition: Runtime.h:104
BaseStarList & Ref2Base(RefStarList &This)
Definition: RefStar.cc:34
T emplace_back(T... args)