Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-14834: Use pybind11's native Eigen wrapping instead of ndarray EigenView #89

Merged
merged 2 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions python/lsst/ip/diffim/basisLists.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include "pybind11/pybind11.h"
#include "pybind11/eigen.h"
#include "pybind11/stl.h"

#include <Eigen/Core>
Expand Down
1 change: 1 addition & 0 deletions python/lsst/ip/diffim/detail/buildSingleKernelVisitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include "pybind11/pybind11.h"
#include "pybind11/eigen.h"
#include "pybind11/stl.h"

#include <memory>
Expand Down
1 change: 1 addition & 0 deletions python/lsst/ip/diffim/detail/kernelPca.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include "pybind11/pybind11.h"
#include "pybind11/eigen.h"
#include "pybind11/stl.h"

#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/ip/diffim/imageSubtract.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include "pybind11/pybind11.h"
#include "pybind11/eigen.h"

#include "Eigen/Core"
#include "ndarray/pybind11.h"

#include "lsst/afw/image/Image.h"
Expand Down
1 change: 1 addition & 0 deletions python/lsst/ip/diffim/kernelCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include "pybind11/pybind11.h"
#include "pybind11/eigen.h"
#include "pybind11/stl.h"

#include "Eigen/Core"
Expand Down
1 change: 1 addition & 0 deletions python/lsst/ip/diffim/kernelSolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* see <https://www.lsstcorp.org/LegalNotices/>.
*/
#include "pybind11/pybind11.h"
#include "pybind11/eigen.h"

#include <memory>

Expand Down
10 changes: 5 additions & 5 deletions src/KernelSolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,22 @@ namespace diffim {
ndarray::Array<int, 1, 1> maskArray =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(maskArray, finalMask.getArray(), templateImage.getXY0());
auto maskEigen = maskArray.asEigen();
auto maskEigen = ndarray::asEigenMatrix(maskArray);

ndarray::Array<InputT, 1, 1> arrayTemplate =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayTemplate, templateImage.getArray(), templateImage.getXY0());
auto eigenTemplate0 = arrayTemplate.asEigen();
auto eigenTemplate0 = ndarray::asEigenMatrix(arrayTemplate);

ndarray::Array<InputT, 1, 1> arrayScience =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayScience, scienceImage.getArray(), scienceImage.getXY0());
auto eigenScience0 = arrayScience.asEigen();
auto eigenScience0 = ndarray::asEigenMatrix(arrayScience);

ndarray::Array<afwImage::VariancePixel, 1, 1> arrayVariance =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayVariance, varianceEstimate.getArray(), varianceEstimate.getXY0());
auto eigenVariance0 = arrayVariance.asEigen();
auto eigenVariance0 = ndarray::asEigenMatrix(arrayVariance);

int nGood = 0;
for (int i = 0; i < maskEigen.size(); i++) {
Expand Down Expand Up @@ -619,7 +619,7 @@ namespace diffim {
ndarray::Array<InputT, 1, 1> arrayC =
ndarray::allocate(ndarray::makeVector(fullFp->getArea()));
fullFp->getSpans()->flatten(arrayC, cimage.getArray(), cimage.getXY0());
auto eigenC0 = arrayC.asEigen();
auto eigenC0 = ndarray::asEigenMatrix(arrayC);

Eigen::VectorXd eigenC(nGood);
int nUsed = 0;
Expand Down