Skip to content

Commit

Permalink
fix obvious code defects, modernize C++
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Wittgen committed Mar 31, 2022
1 parent 65d8d5e commit e05ac81
Show file tree
Hide file tree
Showing 55 changed files with 312 additions and 293 deletions.
25 changes: 13 additions & 12 deletions include/lsst/jointcal/Associations.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
#ifndef LSST_JOINTCAL_ASSOCIATIONS_H
#define LSST_JOINTCAL_ASSOCIATIONS_H

#include <string>
#include <iostream>
#include <list>
#include <string>
#include <utility>

#include "lsst/afw/table/Source.h"
#include "lsst/afw/geom/SkyWcs.h"
Expand Down Expand Up @@ -80,8 +81,8 @@ class Associations {
* @param imageList A pre-built ccdImage list.
* @param epoch The julian epoch year to which all proper motion corrections should be made.
*/
Associations(CcdImageList const &imageList, double epoch = 0)
: ccdImageList(imageList),
Associations(CcdImageList imageList, double epoch = 0)
: ccdImageList(std::move(imageList)),
_commonTangentPoint(Point(std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::quiet_NaN())),
_maxMeasuredStars(0),
Expand Down Expand Up @@ -133,20 +134,20 @@ class Associations {
* @param[in] ccd The ccd identifier
* @param[in] control The JointcalControl object
*/
void createCcdImage(afw::table::SourceCatalog &catalog, std::shared_ptr<lsst::afw::geom::SkyWcs> wcs,
std::shared_ptr<lsst::afw::image::VisitInfo> visitInfo, lsst::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);
void createCcdImage(afw::table::SourceCatalog &catalog, const std::shared_ptr<lsst::afw::geom::SkyWcs>& wcs,
const std::shared_ptr<lsst::afw::image::VisitInfo>& visitInfo, const lsst::geom::Box2I &bbox,
const std::string &filter, const std::shared_ptr<afw::image::PhotoCalib>& photoCalib,
const std::shared_ptr<afw::cameraGeom::Detector>& detector, int visit, int ccd,
const lsst::jointcal::JointcalControl &control);

/**
* Add a pre-constructed ccdImage to the ccdImageList.
*/
void addCcdImage(std::shared_ptr<CcdImage> const ccdImage) { ccdImageList.push_back(ccdImage); }
void addCcdImage(std::shared_ptr<CcdImage> const& ccdImage) { ccdImageList.push_back(ccdImage); }

//! incrementaly builds a merged catalog of all image catalogs
void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
const bool enlargeFittedList = true);
void associateCatalogs(double matchCutInArcsec = 0, bool useFittedList = false,
bool enlargeFittedList = true);

/**
* @brief Collect stars from an external reference catalog and associate them with fittedStars.
Expand Down Expand Up @@ -239,7 +240,7 @@ class Associations {

// Julian Epoch Year (e.g. 2000.0 for J2000)
// Common epoch of all of the ccdImages, typically computed externally via astropy and then set.
double _epoch;
double _epoch{};
};

} // namespace jointcal
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/jointcal/AstrometryFit.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class AstrometryFit : public FitterBase {
void saveChi2RefContributions(std::string const &filename) const override;

private:
bool _fittingDistortions, _fittingPos, _fittingPM;
bool _fittingDistortions{}, _fittingPos{}, _fittingPM{};
std::shared_ptr<AstrometryModel> _astrometryModel;

double _epoch; // epoch to correct proper motion/parallax to (Julian Epoch year, e.g. J2000.0)
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/jointcal/AstrometryMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class AstrometryMapping {
virtual void print(std::ostream &out) const = 0;

//!
virtual ~AstrometryMapping(){};
virtual ~AstrometryMapping() = default;;
};

inline std::ostream &operator<<(std::ostream &stream, AstrometryMapping const &mapping) {
Expand Down
7 changes: 4 additions & 3 deletions include/lsst/jointcal/AstrometryModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
#ifndef LSST_JOINTCAL_ASTROMETRY_MODEL_H
#define LSST_JOINTCAL_ASTROMETRY_MODEL_H

#include <iostream>
#include "memory"
#include <iostream>
#include <utility>

#include "lsst/log/Log.h"

Expand All @@ -49,7 +50,7 @@ class AstrometryTransform;
*/
class AstrometryModel {
public:
AstrometryModel(LOG_LOGGER log) : _log(log) {}
AstrometryModel(LOG_LOGGER log) : _log(std::move(log)) {}

/// Return the number of parameters in the mapping of CcdImage
std::size_t getNpar(CcdImage const &ccdImage) const { return findMapping(ccdImage)->getNpar(); }
Expand Down Expand Up @@ -99,7 +100,7 @@ class AstrometryModel {
*/
virtual void print(std::ostream &out) const = 0;

virtual ~AstrometryModel(){};
virtual ~AstrometryModel() = default;;

/**
* Return true if this is a "reasonable" model.
Expand Down

0 comments on commit e05ac81

Please sign in to comment.