Skip to content

Commit

Permalink
Rename addImage->createCcdImage
Browse files Browse the repository at this point in the history
We have to create the ccdImage before we can add it to the list, and a
reviewer suggested this would make that clearer.
  • Loading branch information
parejkoj committed May 1, 2018
1 parent d1de1ba commit 9b47467
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 25 deletions.
11 changes: 6 additions & 5 deletions include/lsst/jointcal/Associations.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ class Associations {
* @param[in] ccd The ccd identifier
* @param[in] control The JointcalControl object
*/
void addImage(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);
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);

//! incrementaly builds a merged catalog of all image catalogs
void associateCatalogs(const double matchCutInArcsec = 0, const bool useFittedList = false,
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/jointcal/MeasuredStar.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class MeasuredStar : public BaseStar {

/****** MeasuredStarList */

//! A list of MeasuredStar. They are usually filled in Associations::AddImage
//! A list of MeasuredStar. They are usually filled in Associations::createCcdImage
class MeasuredStarList : public StarList<MeasuredStar> {
public:
MeasuredStarList(){};
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/jointcal/associations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void declareAssociations(py::module &mod) {
cls.def("nCcdImagesValidForFit", &Associations::nCcdImagesValidForFit);
cls.def("nFittedStarsWithAssociatedRefStar", &Associations::nFittedStarsWithAssociatedRefStar);

cls.def("addImage", &Associations::addImage);
cls.def("createCcdImage", &Associations::createCcdImage);
cls.def("prepareFittedStars", &Associations::prepareFittedStars);

cls.def("getCcdImageList", &Associations::getCcdImageList, py::return_value_policy::reference_internal);
Expand Down
12 changes: 10 additions & 2 deletions python/lsst/jointcal/jointcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,16 @@ def _build_ccdImage(self, dataRef, associations, jointcalControl):
self.log.warn("No sources selected in visit %s ccd %s", visit, ccdId)
else:
self.log.info("%d sources selected in visit %d ccd %d", len(goodSrc.sourceCat), visit, ccdId)
associations.addImage(goodSrc.sourceCat, tanWcs, visitInfo, bbox, filterName, photoCalib, detector,
visit, ccdId, jointcalControl)
associations.createCcdImage(goodSrc.sourceCat,
tanWcs,
visitInfo,
bbox,
filterName,
photoCalib,
detector,
visit,
ccdId,
jointcalControl)

Result = collections.namedtuple('Result_from_build_CcdImage', ('wcs', 'key', 'filter'))
Key = collections.namedtuple('Key', ('visit', 'ccd'))
Expand Down
13 changes: 7 additions & 6 deletions src/Associations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ const double JanskyToMaggy = 3631.0;
namespace lsst {
namespace jointcal {

void Associations::addImage(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) {
void Associations::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) {
auto ccdImage = std::make_shared<CcdImage>(catalog, wcs, visitInfo, bbox, filter, photoCalib, detector,
visit, ccd, control.sourceFluxField);
ccdImageList.push_back(ccdImage);
Expand Down
20 changes: 10 additions & 10 deletions tests/test_astrometryModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ def setUp(self):
photoCalib = lsst.afw.image.PhotoCalib(100.0, 1.0)

self.catalogs.append(goodSrc)
self.associations.addImage(goodSrc,
wcs,
visitInfo,
bbox,
filterName,
photoCalib,
detector,
visit,
ccdId,
jointcalControl)
self.associations.createCcdImage(goodSrc,
wcs,
visitInfo,
bbox,
filterName,
photoCalib,
detector,
visit,
ccdId,
jointcalControl)

# Have to set the common tangent point so projectionHandler can use skyToCTP.
self.associations.computeCommonTangentPoint()
Expand Down

0 comments on commit 9b47467

Please sign in to comment.