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-14625: Fix ndarray compiler warnings #18

Merged
merged 5 commits into from
Jun 8, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ _build.*
config.log
.sconf_temp
.cache
.pytest_cache
pytest_session.txt
.coverage
*.o
*.os
*.so
Expand Down
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sudo: false
language: python
matrix:
include:
- python: '3.6'
install:
- pip install flake8
script: flake8
1 change: 1 addition & 0 deletions examples/shapeletBases.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ def main():
processBasis(laguerreBasis, x, y)
pyplot.show()


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions examples/shapeletConvolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def main():
plotShapeletFunction(pyplot.subplot(1, 3, 3), fC, x, y)
pyplot.show()


if __name__ == "__main__":
numpy.set_printoptions(suppress=True)
main()
6 changes: 0 additions & 6 deletions examples/timeModels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include <pybind11/pybind11.h>
//#include <pybind11/stl.h>
#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet.h"
Expand Down Expand Up @@ -82,11 +81,6 @@ void buildModelsD(
PYBIND11_PLUGIN(_timeModels) {
py::module mod("_timeModels", "");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

mod.def("buildModelsF", buildModelsF);
mod.def("buildModelsD", buildModelsD);

Expand Down
1 change: 1 addition & 0 deletions examples/timeModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ def main():
(res2.ru_stime - res1.ru_stime) / factor
))


if __name__ == "__main__":
main()
6 changes: 0 additions & 6 deletions python/lsst/shapelet/basisEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/BasisEvaluator.h"
Expand All @@ -37,11 +36,6 @@ PYBIND11_PLUGIN(basisEvaluator) {

py::module mod("basisEvaluator");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<BasisEvaluator, std::shared_ptr<BasisEvaluator>> clsBasisEvaluator(mod, "BasisEvaluator");

/* Constructors */
Expand Down
6 changes: 0 additions & 6 deletions python/lsst/shapelet/gaussHermiteConvolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/GaussHermiteConvolution.h"
Expand All @@ -36,11 +35,6 @@ namespace shapelet {
PYBIND11_PLUGIN(gaussHermiteConvolution) {
py::module mod("gaussHermiteConvolution");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<GaussHermiteConvolution, std::shared_ptr<GaussHermiteConvolution>> clsGaussHermiteConvolution(
mod, "GaussHermiteConvolution");

Expand Down
6 changes: 0 additions & 6 deletions python/lsst/shapelet/gaussHermiteProjection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/GaussHermiteProjection.h"
Expand All @@ -36,11 +35,6 @@ PYBIND11_PLUGIN(gaussHermiteProjection) {
py::module::import("lsst.afw.geom");
py::module mod("gaussHermiteProjection");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<GaussHermiteProjection, std::shared_ptr<GaussHermiteProjection>> clsGaussHermiteProjection(
mod, "GaussHermiteProjection");

Expand Down
6 changes: 0 additions & 6 deletions python/lsst/shapelet/hermiteTransformMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/HermiteTransformMatrix.h"
Expand All @@ -37,11 +36,6 @@ PYBIND11_PLUGIN(hermiteTransformMatrix) {

py::module mod("hermiteTransformMatrix");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<HermiteTransformMatrix, std::shared_ptr<HermiteTransformMatrix>> clsHermiteTransformMatrix(
mod, "HermiteTransformMatrix");

Expand Down
6 changes: 0 additions & 6 deletions python/lsst/shapelet/matrixBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/MatrixBuilder.h"
Expand Down Expand Up @@ -131,11 +130,6 @@ PYBIND11_PLUGIN(matrixBuilder) {
py::module::import("lsst.afw.geom");
py::module mod("matrixBuilder");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

declareMatrixBuilderTemplates<float>(mod, "F");
declareMatrixBuilderTemplates<double>(mod, "D");

Expand Down
6 changes: 0 additions & 6 deletions python/lsst/shapelet/multiShapeletBasis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/MultiShapeletBasis.h"
Expand All @@ -35,11 +34,6 @@ namespace shapelet {
PYBIND11_PLUGIN(multiShapeletBasis) {
py::module mod("multiShapeletBasis");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<MultiShapeletBasisComponent, std::shared_ptr<MultiShapeletBasisComponent>>
clsMultiShapeletBasisComponent(mod, "MultiShapeletBasisComponent");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "pybind11/pybind11.h"
#include "pybind11/stl.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/MultiShapeletFunction.h"
Expand Down Expand Up @@ -98,11 +97,6 @@ PYBIND11_PLUGIN(multiShapeletFunction) {

py::module mod("multiShapeletFunction");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<MultiShapeletFunction, std::shared_ptr<MultiShapeletFunction>> clsMultiShapeletFunction(
mod, "MultiShapeletFunction");
py::class_<MultiShapeletFunctionEvaluator, std::shared_ptr<MultiShapeletFunctionEvaluator>>
Expand Down
6 changes: 0 additions & 6 deletions python/lsst/shapelet/radialProfile/radialProfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/RadialProfile.h"
Expand All @@ -35,11 +34,6 @@ namespace shapelet {
PYBIND11_PLUGIN(radialProfile) {
py::module mod("radialProfile");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<RadialProfile, std::shared_ptr<RadialProfile>> clsRadialProfile(mod, "RadialProfile");

clsRadialProfile.def_static("get", &RadialProfile::get, py::return_value_policy::reference);
Expand Down
6 changes: 0 additions & 6 deletions python/lsst/shapelet/shapeletFunction/shapeletFunction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
#include "pybind11/pybind11.h"

#include "numpy/arrayobject.h"
#include "ndarray/pybind11.h"

#include "lsst/shapelet/ShapeletFunction.h"
Expand All @@ -38,11 +37,6 @@ PYBIND11_PLUGIN(shapeletFunction) {

py::module mod("shapeletFunction");

if (_import_array() < 0) {
PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import");
return nullptr;
}

py::class_<ShapeletFunction, std::shared_ptr<ShapeletFunction>> clsShapeletFunction(mod,
"ShapeletFunction");

Expand Down
2 changes: 2 additions & 0 deletions python/lsst/shapelet/tractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def registerRadialProfiles():
matrix = numpy.array([[amplitude / ShapeletFunction.FLUX_FACTOR]], dtype=float)
basis.addComponent(radius, 0, matrix)
profile.registerBasis(basis, nComponents, maxRadius)


# We register all the profiles at module import time, to allow C++ code to access all available profiles
# without having to later call Python code to unpickle them.
registerRadialProfiles()
Expand Down
2 changes: 1 addition & 1 deletion tests/SConscript
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- python -*-
from lsst.sconsUtils import scripts
scripts.BasicSConscript.tests()
scripts.BasicSConscript.tests(pyList=[])
1 change: 1 addition & 0 deletions tests/data/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,6 @@ def main():
f3.draw(image, dx=1.0)
image.write("gaussians.fits")


if __name__ == "__main__":
main()