Skip to content

Commit

Permalink
clang-format pass
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Oct 18, 2024
1 parent 9e9e0a5 commit e5a4e9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions python/lsst/afw/image/_photoCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ void declarePhotoCalib(lsst::cpputils::python::WrapperCollection &wrappers) {

/* Members - nanojansky */
cls.def("instFluxToNanojansky",
(double (PhotoCalib::*)(double, lsst::geom::Point<double, 2> const &) const) &
(double(PhotoCalib::*)(double, lsst::geom::Point<double, 2> const &) const) &
PhotoCalib::instFluxToNanojansky,
"instFlux"_a, "point"_a);
cls.def("instFluxToNanojansky",
(double (PhotoCalib::*)(double) const) & PhotoCalib::instFluxToNanojansky,
(double(PhotoCalib::*)(double) const) & PhotoCalib::instFluxToNanojansky,
"instFlux"_a);

cls.def("instFluxToNanojansky",
Expand All @@ -109,18 +109,18 @@ void declarePhotoCalib(lsst::cpputils::python::WrapperCollection &wrappers) {
"sourceCatalog"_a, "instFluxField"_a);

cls.def("instFluxToNanojansky",
(void (PhotoCalib::*)(afw::table::SourceCatalog &, std::string const &,
std::string const &) const) &
(void(PhotoCalib::*)(afw::table::SourceCatalog &, std::string const &,
std::string const &) const) &
PhotoCalib::instFluxToNanojansky,
"sourceCatalog"_a, "instFluxField"_a, "outField"_a);

/* Members - magnitudes */
cls.def("instFluxToMagnitude",
(double (PhotoCalib::*)(double, lsst::geom::Point<double, 2> const &) const) &
(double(PhotoCalib::*)(double, lsst::geom::Point<double, 2> const &) const) &
PhotoCalib::instFluxToMagnitude,
"instFlux"_a, "point"_a);
cls.def("instFluxToMagnitude",
(double (PhotoCalib::*)(double) const) & PhotoCalib::instFluxToMagnitude,
(double(PhotoCalib::*)(double) const) & PhotoCalib::instFluxToMagnitude,
"instFlux"_a);

cls.def("instFluxToMagnitude",
Expand All @@ -145,8 +145,8 @@ void declarePhotoCalib(lsst::cpputils::python::WrapperCollection &wrappers) {
"sourceCatalog"_a, "instFluxField"_a);

cls.def("instFluxToMagnitude",
(void (PhotoCalib::*)(afw::table::SourceCatalog &, std::string const &,
std::string const &) const) &
(void(PhotoCalib::*)(afw::table::SourceCatalog &, std::string const &,
std::string const &) const) &
PhotoCalib::instFluxToMagnitude,
"sourceCatalog"_a, "instFluxField"_a, "outField"_a);

Expand Down
14 changes: 8 additions & 6 deletions src/image/PhotoCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ int const SERIALIZATION_VERSION = 1;

double toNanojansky(double instFlux, double scale) { return instFlux * scale; }

double toMagnitude(double instFlux, double scale) { return cpputils::nanojanskyToABMagnitude(instFlux * scale); }
double toMagnitude(double instFlux, double scale) {
return cpputils::nanojanskyToABMagnitude(instFlux * scale);
}

double toInstFluxFromMagnitude(double magnitude, double scale) {
// Note: flux[nJy] / scale = instFlux[counts]
Expand Down Expand Up @@ -446,8 +448,8 @@ class PhotoCalibSchema {

class PhotoCalibFactory : public table::io::PersistableFactory {
public:
std::shared_ptr<table::io::Persistable>
read(InputArchive const &archive, CatalogVector const &catalogs) const override {
std::shared_ptr<table::io::Persistable> read(InputArchive const &archive,
CatalogVector const &catalogs) const override {
table::BaseRecord const &record = catalogs.front().front();
PhotoCalibSchema const &keys = PhotoCalibSchema::get();
int version = getVersion(record);
Expand Down Expand Up @@ -529,7 +531,7 @@ class CalibFactory : public table::io::PersistableFactory {
int tableVersion = 1;
try {
catalogs.front().getSchema().find<double>(EXPTIME_FIELD_NAME);
} catch (pex::exceptions::NotFoundError const&) {
} catch (pex::exceptions::NotFoundError const &) {
tableVersion = CALIB_TABLE_CURRENT_VERSION;
}

Expand All @@ -540,8 +542,8 @@ class CalibFactory : public table::io::PersistableFactory {
table::BaseRecord const &record = catalogs.front().front();

double calibration = cpputils::referenceFlux / record.get(keys.fluxMag0);
double calibrationErr =
cpputils::referenceFlux * record.get(keys.fluxMag0Err) / std::pow(record.get(keys.fluxMag0), 2);
double calibrationErr = cpputils::referenceFlux * record.get(keys.fluxMag0Err) /
std::pow(record.get(keys.fluxMag0), 2);
return std::make_shared<PhotoCalib>(calibration, calibrationErr);
}

Expand Down

0 comments on commit e5a4e9a

Please sign in to comment.