LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
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 namespace jointcal = lsst::jointcal;
50 
51 namespace {
52 LOG_LOGGER _log = LOG_GET("jointcal.Associations");
53 }
54 
55 namespace lsst {
56 namespace jointcal {
57 
64  lsst::jointcal::JointcalControl const &control) {
65  auto ccdImage = std::make_shared<CcdImage>(catalog, wcs, visitInfo, bbox, filter, photoCalib, detector,
66  visit, ccd, control.sourceFluxField);
67  ccdImageList.push_back(ccdImage);
68  LOGLS_DEBUG(_log, "Catalog " << ccdImage->getName() << " has " << ccdImage->getWholeCatalog().size()
69  << " objects.");
70 }
71 
74  centers.reserve(ccdImageList.size());
75  for (auto const &ccdImage : ccdImageList) {
76  centers.push_back(ccdImage->getBoresightRaDec());
77  }
78  auto commonTangentPoint = afw::geom::averageSpherePoint(centers);
79  LOGLS_DEBUG(_log, "Using common tangent point: " << commonTangentPoint.getPosition(afw::geom::degrees));
80  setCommonTangentPoint(commonTangentPoint.getPosition(afw::geom::degrees));
81 }
82 
84  _commonTangentPoint = Point(commonTangentPoint.getX(), commonTangentPoint.getY()); // a jointcal::Point
85  for (auto &ccdImage : ccdImageList) ccdImage->setCommonTangentPoint(_commonTangentPoint);
86 }
87 
88 void Associations::associateCatalogs(const double matchCutInArcSec, const bool useFittedList,
89  const bool enlargeFittedList) {
90  // clear reference stars
91  refStarList.clear();
92 
93  // clear measurement counts and associations to refstars, but keep fittedStars themselves.
94  for (auto &item : fittedStarList) {
95  item->clearBeforeAssoc();
96  }
97  // clear fitted stars
98  if (!useFittedList) fittedStarList.clear();
99 
100  for (auto &ccdImage : ccdImageList) {
101  std::shared_ptr<AstrometryTransform> toCommonTangentPlane = ccdImage->getPixelToCommonTangentPlane();
102 
103  // Clear the catalog to fit and copy the whole catalog into it.
104  // This allows reassociating from scratch after a fit.
105  ccdImage->resetCatalogForFit();
106  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
107 
108  // Associate with previous lists.
109  /* To speed up the match (more precisely the contruction of the FastFinder), select in the
110  fittedStarList the objects that are within reach of the current ccdImage */
111  Frame ccdImageFrameCPT = toCommonTangentPlane->apply(ccdImage->getImageFrame(), false);
112  ccdImageFrameCPT = ccdImageFrameCPT.rescale(1.10); // add 10 % margin.
113  // We cannot use FittedStarList::ExtractInFrame, because it does an actual copy, which we don't want
114  // here: we want the pointers in the StarMatch to refer to fittedStarList elements.
115  FittedStarList toMatch;
116 
117  for (auto const &fittedStar : fittedStarList) {
118  if (ccdImageFrameCPT.inFrame(*fittedStar)) {
119  toMatch.push_back(fittedStar);
120  }
121  }
122 
123  // divide by 3600 because coordinates in CTP are in degrees.
124  auto starMatchList = listMatchCollect(Measured2Base(catalog), Fitted2Base(toMatch),
125  toCommonTangentPlane.get(), matchCutInArcSec / 3600.);
126 
127  /* should check what this removeAmbiguities does... */
128  LOGLS_DEBUG(_log, "Measured-to-Fitted matches before removing ambiguities " << starMatchList->size());
129  starMatchList->removeAmbiguities(*toCommonTangentPlane);
130  LOGLS_DEBUG(_log, "Measured-to-Fitted matches after removing ambiguities " << starMatchList->size());
131 
132  // Associate MeasuredStar -> FittedStar using the surviving matches.
133 
134  int matchedCount = 0;
135  for (auto const &starMatch : *starMatchList) {
136  auto bs = starMatch.s1;
137  auto ms_const = std::dynamic_pointer_cast<const MeasuredStar>(bs);
138  auto ms = std::const_pointer_cast<MeasuredStar>(ms_const);
139  auto bs2 = starMatch.s2;
140  auto fs_const = std::dynamic_pointer_cast<const FittedStar>(bs2);
141  auto fs = std::const_pointer_cast<FittedStar>(fs_const);
142  ms->setFittedStar(fs);
143  matchedCount++;
144  }
145  LOGLS_INFO(_log, "Matched " << matchedCount << " objects in " << ccdImage->getName());
146 
147  // add unmatched objets to FittedStarList
148  int unMatchedCount = 0;
149  for (auto const &mstar : catalog) {
150  // to check if it was matched, just check if it has a fittedStar Pointer assigned
151  if (mstar->getFittedStar()) continue;
152  if (enlargeFittedList) {
153  auto fs = std::make_shared<FittedStar>(*mstar);
154  // transform coordinates to CommonTangentPlane
155  toCommonTangentPlane->transformPosAndErrors(*fs, *fs);
156  fittedStarList.push_back(fs);
157  mstar->setFittedStar(fs);
158  }
159  unMatchedCount++;
160  }
161  LOGLS_INFO(_log, "Unmatched objects: " << unMatchedCount);
162  } // end of loop on CcdImages
163 
164  // !!!!!!!!!!!!!!!!!
165  // TODO: DO WE REALLY NEED THIS???
166  // Why do we need to do this, instead of directly computing them in normalizeFittedStars?
167  // What makes the magnitudes special here?
168  // !!!!!!!!!!!!!!!!!
169  // assignMags();
170 }
171 
173  std::string const &fluxField, bool rejectBadFluxes) {
174  if (refCat.size() == 0) {
176  " reference catalog is empty : stop here "));
177  }
178 
179  afw::table::CoordKey coordKey = refCat.getSchema()["coord"];
180  auto fluxKey = refCat.getSchema().find<double>(fluxField).key;
181  // Don't blow up if the reference catalog doesn't contain errors.
182  afw::table::Key<double> fluxErrKey;
183  try {
184  fluxErrKey = refCat.getSchema().find<double>(fluxField + "Err").key;
185  } catch (pex::exceptions::NotFoundError &) {
186  LOGLS_WARN(_log, "Flux error field ("
187  << fluxField << "Err"
188  << ") not found in reference catalog. Not using ref flux errors.");
189  }
190 
191  refStarList.clear();
192  for (size_t i = 0; i < refCat.size(); i++) {
193  auto const &record = refCat.get(i);
194 
195  auto coord = record->get(coordKey);
196  double flux = record->get(fluxKey);
197  double fluxErr;
198  if (fluxErrKey.isValid()) {
199  fluxErr = record->get(fluxErrKey);
200  } else {
202  }
203  double ra = lsst::afw::geom::radToDeg(coord.getLongitude());
204  double dec = lsst::afw::geom::radToDeg(coord.getLatitude());
205  auto star = std::make_shared<RefStar>(ra, dec, flux, fluxErr);
206 
207  // TODO DM-10826: RefCats aren't guaranteed to have position errors.
208  // TODO: Need to devise a way to check whether the refCat has position errors
209  // TODO: and use them instead, if available.
210  // cook up errors: 100 mas per cooordinate
211  star->vx = std::pow(0.1 / 3600 / cos(coord.getLatitude()), 2);
212  star->vy = std::pow(0.1 / 3600, 2);
213  star->vxy = 0.;
214 
215  // Reject sources with non-finite fluxes and flux errors, and fluxErr=0 (which gives chi2=inf).
216  if (rejectBadFluxes && (!std::isfinite(flux) || !std::isfinite(fluxErr) || fluxErr <= 0)) continue;
217  refStarList.push_back(star);
218  }
219 
220  // project on CTP (i.e. RaDec2CTP), in degrees
221  AstrometryTransformLinear identity;
222  TanRaDecToPixel raDecToCommonTangentPlane(identity, _commonTangentPoint);
223 
224  associateRefStars(matchCut.asArcseconds(), &raDecToCommonTangentPlane);
225 }
226 
228  // compute the frame on the CTP that contains all input images
229  Frame tangentPlaneFrame;
230 
231  for (auto const &ccdImage : ccdImageList) {
232  Frame CTPFrame = ccdImage->getPixelToCommonTangentPlane()->apply(ccdImage->getImageFrame(), false);
233  if (tangentPlaneFrame.getArea() == 0)
234  tangentPlaneFrame = CTPFrame;
235  else
236  tangentPlaneFrame += CTPFrame;
237  }
238 
239  // convert tangent plane coordinates to RaDec:
240  AstrometryTransformLinear identity;
241  TanPixelToRaDec commonTangentPlaneToRaDec(identity, _commonTangentPoint);
242  Frame raDecFrame = commonTangentPlaneToRaDec.apply(tangentPlaneFrame, false);
243 
244  lsst::afw::geom::Point<double> min(raDecFrame.xMin, raDecFrame.yMin);
245  lsst::afw::geom::Point<double> max(raDecFrame.xMax, raDecFrame.yMax);
246  lsst::afw::geom::Box2D box(min, max);
247 
248  return box;
249 }
250 
251 void Associations::associateRefStars(double matchCutInArcSec, const AstrometryTransform *transform) {
252  // associate with FittedStars
253  // 3600 because coordinates are in degrees (in CTP).
254  auto starMatchList = listMatchCollect(Ref2Base(refStarList), Fitted2Base(fittedStarList), transform,
255  matchCutInArcSec / 3600.);
256 
257  LOGLS_DEBUG(_log, "Refcat matches before removing ambiguities " << starMatchList->size());
258  starMatchList->removeAmbiguities(*transform);
259  LOGLS_DEBUG(_log, "Refcat matches after removing ambiguities " << starMatchList->size());
260 
261  // actually associate things
262  for (auto const &starMatch : *starMatchList) {
263  const BaseStar &bs = *starMatch.s1;
264  const RefStar &rs_const = dynamic_cast<const RefStar &>(bs);
265  RefStar &rs = const_cast<RefStar &>(rs_const);
266  const BaseStar &bs2 = *starMatch.s2;
267  const FittedStar &fs_const = dynamic_cast<const FittedStar &>(bs2);
268  FittedStar &fs = const_cast<FittedStar &>(fs_const);
269  // rs->setFittedStar(*fs);
270  fs.setRefStar(&rs);
271  }
272 
273  LOGLS_INFO(_log,
274  "Associated " << starMatchList->size() << " reference stars among " << refStarList.size());
275 }
276 
277 void Associations::prepareFittedStars(int minMeasurements) {
278  selectFittedStars(minMeasurements);
279  normalizeFittedStars();
280 }
281 
282 void Associations::selectFittedStars(int minMeasurements) {
283  LOGLS_INFO(_log, "Fitted stars before measurement # cut: " << fittedStarList.size());
284 
285  // first pass: remove objects that have less than a certain number of measurements.
286  for (auto const &ccdImage : ccdImageList) {
287  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
288  // Iteration happens internal to the loop, as we may delete measuredStars from catalog.
289  for (MeasuredStarIterator mi = catalog.begin(); mi != catalog.end();) {
290  MeasuredStar &mstar = **mi;
291 
292  auto fittedStar = mstar.getFittedStar();
293  // measuredStar has no fittedStar: move on.
294  if (fittedStar == nullptr) {
295  ++mi;
296  continue;
297  }
298 
299  // keep FittedStars which either have a minimum number of
300  // measurements, or are matched to a RefStar
301  if (!fittedStar->getRefStar() && fittedStar->getMeasurementCount() < minMeasurements) {
302  fittedStar->getMeasurementCount()--;
303  mi = catalog.erase(mi); // mi now points to the next measuredStar.
304  } else {
305  ++mi;
306  }
307  } // end loop on objects in catalog
308  } // end loop on catalogs
309 
310  // now FittedStars with less than minMeasurements should have zero measurementCount.
311  for (FittedStarIterator fi = fittedStarList.begin(); fi != fittedStarList.end();) {
312  if ((*fi)->getMeasurementCount() == 0) {
313  fi = fittedStarList.erase(fi);
314  } else {
315  ++fi;
316  }
317  }
318 
319  LOGLS_INFO(_log, "Fitted stars after measurement # cut: " << fittedStarList.size());
320 }
321 
322 void Associations::normalizeFittedStars() const {
323  // Clear positions in order to take the average of the measuredStars.
324  for (auto &fittedStar : fittedStarList) {
325  fittedStar->x = 0.0;
326  fittedStar->y = 0.0;
327  fittedStar->setFlux(0.0);
328  fittedStar->getMag() = 0.0;
329  }
330 
331  // Iterate over measuredStars to add their values into their fittedStars
332  for (auto const &ccdImage : ccdImageList) {
333  std::shared_ptr<AstrometryTransform> toCommonTangentPlane = ccdImage->getPixelToCommonTangentPlane();
334  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
335  for (auto &mi : catalog) {
336  auto fittedStar = mi->getFittedStar();
337  if (fittedStar == nullptr)
338  throw(LSST_EXCEPT(
340  "All measuredStars must have a fittedStar: did you call selectFittedStars()?"));
341  auto point = toCommonTangentPlane->apply(*mi);
342  fittedStar->x += point.x;
343  fittedStar->y += point.y;
344  fittedStar->getFlux() += mi->getFlux();
345  }
346  }
347 
348  for (auto &fi : fittedStarList) {
349  auto measurementCount = fi->getMeasurementCount();
350  fi->x /= measurementCount;
351  fi->y /= measurementCount;
352  fi->getFlux() /= measurementCount;
353  fi->getMag() = utils::nanojanskyToABMagnitude(fi->getFlux());
354  }
355 }
356 
357 void Associations::assignMags() {
358  for (auto const &ccdImage : ccdImageList) {
359  MeasuredStarList &catalog = ccdImage->getCatalogForFit();
360  for (auto const &mstar : catalog) {
361  auto fstar = mstar->getFittedStar();
362  if (!fstar) continue;
363  fstar->addMagMeasurement(mstar->getMag(), mstar->getMagWeight());
364  }
365  }
366 }
367 
369  // By default, Associations::fittedStarList is expressed on the Associations::commonTangentPlane.
370  // For AstrometryFit, we need it on the sky.
371  if (!fittedStarList.inTangentPlaneCoordinates) {
372  LOGLS_WARN(_log,
373  "DeprojectFittedStars: Fitted stars are already in sidereal coordinates, nothing done ");
374  return;
375  }
376 
377  TanPixelToRaDec ctp2Sky(AstrometryTransformLinear(), getCommonTangentPoint());
378  fittedStarList.applyTransform(ctp2Sky);
379  fittedStarList.inTangentPlaneCoordinates = false;
380 }
381 
383  return std::count_if(ccdImageList.begin(), ccdImageList.end(), [](std::shared_ptr<CcdImage> const &item) {
384  return item->getCatalogForFit().size() > 0;
385  });
386 }
387 
389  size_t count = 0;
390  for (auto const &fittedStar : fittedStarList) {
391  if ((fittedStar != nullptr) & (fittedStar->getRefStar() != nullptr)) count++;
392  }
393  return count;
394 }
395 
396 #ifdef TODO
397 void Associations::collectMCStars(int realization) {
398  CcdImageIterator I;
399  StarMatchIterator smI;
400 
401  for (I = ccdImageList.begin(); I != ccdImageList.end(); I++) {
402  CcdImage &ccdImage = **I;
403  string dbimdir = ccdImage.Dir();
404  string mctruth = dbimdir + "/mc/mctruth.list";
405 
406  if (realization >= 0) {
407  stringstream sstrm;
408  sstrm << dbimdir << "/mc/mctruth_" << realization << ".list";
409  mctruth = sstrm.str();
410  }
411 
413  MeasuredStarList &catalog = ccdImage.getCatalogForFit();
414 
415  // BaseStarWithErrorList mctruthlist(mctruth);
416  DicStarList mctruthlist(mctruth);
417  auto starMatchList =
418  listMatchCollect(Measured2Base(catalog), Dic2Base(mctruthlist), &gti, 1. /* pixel ? */);
419  if (starMatchList)
420  for (smI = starMatchList->begin(); smI != starMatchList->end(); smI++) {
421  StarMatch &sm = *smI;
422  BaseStar *bs = sm.s1;
423  MeasuredStar *mstar = dynamic_cast<MeasuredStar *>(bs);
424  bs = sm.s2;
425  DicStar *dstar = dynamic_cast<DicStar *>(bs);
426  std::unique_ptr<BaseStarWithError> mcstar(new BaseStarWithError(*bs));
427  mcstar->GetMCInfo().iflux = dstar->getval("iflux");
428  mcstar->GetMCInfo().tflux = dstar->getval("sflux");
429  /*
430  mstar->SetMCTruth(mcstar);
431  mstar->SetMCMeas(mcstar);
432  */
433  }
434  else
435  LOGLS_FATAL(_log, "CollectMCStars Unable to match MCTruth w/ catalog!");
436  }
437 }
438 
439 void Associations::setFittedStarColors(std::string dicStarListName, std::string color,
440  double matchCutArcSec) {
441  // decode color string in case it is x-y
442  size_t pos_minus = color.find('-');
443  bool compute_diff = (pos_minus != string::npos);
444  std::string c1, c2;
445  c1 = color.substr(0, pos_minus); // if pos_minus == npos, means "up to the end"
446  if (compute_diff) c2 = color.substr(pos_minus + 1, string::npos);
447  DicStarList cList(dicStarListName);
448  if (!cList.HasKey(c1))
449  throw(GastroException("Associations::SetFittedstarColors : " + dicStarListName +
450  " misses a key named \"" + c1 + "\""));
451  if (compute_diff && !cList.HasKey(c2))
452  throw(GastroException("Associations::SetFittedstarColors : " + dicStarListName +
453  " misses a key named \"" + c2 + "\""));
454  // we associate in some tangent plane. The reference catalog is expressed on the sky,
455  // but FittedStar's may be still in this tangent plane.
456  BaseStarList &l1 = (BaseStarList &)fittedStarList;
458  TanRaDecToPixel proj(AstrometryTransformLinear(), getCommonTangentPoint());
459  // project or not ?
460  AstrometryTransform *id_or_proj = &proj;
461  if (fittedStarList.inTangentPlaneCoordinates) id_or_proj = &id;
462  // The color List is to be projected:
463  TStarList projected_cList((BaseStarList &)cList, proj);
464  // Associate
465  auto starMatchList = listMatchCollect(Fitted2Base(fittedStarList), (const BaseStarList &)projected_cList,
466  id_or_proj, matchCutArcSec / 3600);
467 
468  LOGLS_INFO(_log, "Matched " << starMatchList->size() << '/' << fittedStarList.size()
469  << " FittedStars to color catalog");
470  // Evaluate and assign colors.
471  for (auto i = starMatchList->begin(); i != starMatchList->end(); ++i) {
472  BaseStar *s1 = i->s1;
473  FittedStar *fs = dynamic_cast<FittedStar *>(s1);
474  BaseStar *s2 = i->s2;
475  const TStar *ts = dynamic_cast<const TStar *>(s2);
476  const DicStar *ds = dynamic_cast<const DicStar *>(ts->get_original());
477  fs->color = ds->getval(c1);
478  if (compute_diff) fs->color -= ds->getval(c2);
479  }
480 }
481 
482 #endif /* TODO */
483 } // namespace jointcal
484 } // namespace lsst
#define LOGLS_WARN(logger, message)
Log a warn-level message using an iostream-based interface.
Definition: Log.h:633
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:68
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
A floating-point coordinate rectangle geometry.
Definition: Box.h:294
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.
double xMin
coordinate of boundary.
Definition: Frame.h:41
T end(T... args)
table::Key< int > id
Definition: Detector.cc:163
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
int min
void associateCatalogs(const double matchCutInArcsec=0, const bool useFittedList=false, const bool enlargeFittedList=true)
incrementaly builds a merged catalog of all image catalogs
Definition: Associations.cc:88
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
double cos(Angle const &a)
Definition: Angle.h:103
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.
void collectRefStars(afw::table::SimpleCatalog &refCat, afw::geom::Angle matchCut, std::string const &fluxField, bool rejectBadFluxes=false)
Collect stars from an external reference catalog and associate them with fittedStars.
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:72
FittedStarList::iterator FittedStarIterator
Definition: FittedStar.h:131
T erase(T... args)
A list of FittedStar s. Such a list is typically constructed by Associations.
Definition: FittedStar.h:122
T str(T... args)
This one is the Tangent Plane (called gnomonic) projection (from celestial sphere to tangent plane) ...
int max
T isfinite(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:166
constexpr double asArcseconds() const noexcept
Return an Angle&#39;s value in arcseconds.
Definition: Angle.h:178
T count_if(T... args)
#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:83
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:58
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
const lsst::afw::geom::Box2D getRaDecBBox()
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:446
std::shared_ptr< const BaseStar > s1
Definition: StarMatch.h:62
Reports invalid arguments.
Definition: Runtime.h:66
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" ;
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
An integer coordinate rectangle.
Definition: Box.h:54
The objects which have been measured several times.
Definition: FittedStar.h:60
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