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-9190: Cleanup pybind11 remaining code #14

Merged
merged 1 commit into from Apr 6, 2017
Merged

Conversation

pschella
Copy link

No description provided.

@pschella pschella force-pushed the tickets/DM-9190 branch 4 times, most recently from 8c72604 to 5d50c96 Compare March 25, 2017 15:53
Copy link
Contributor

@r-owen r-owen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK. A few minor requests for cleanup to make flake8 happier.

import lsst.pex.exceptions
from .radialProfile import RadialProfile
from .multiShapeletBasis import MultiShapeletBasis
from .shapeletFunction import ShapeletFunction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider cleaning up two pre-existing issues:

try:
    import pickle as pickle
except ImportError:
    import pickle

should be simplified to import pickle (I am guessing futurize made this bit of silliness).

standard_library.install_aliases()

needs a # noqa to make flake8 happy.

Also as a heads up: this plotSuite is almost certainly broken because y is not defined when first used. I filed DM-9976 about it.

class ShapeletFunction:
def __reduce__(self):
return (ShapeletFunction, (self.getOrder(), self.getBasisType(),
self.getEllipse(), self.getCoefficients()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and all other new xContinued.py functions contain trivial flake8 errors; please clean them up:

  • a flake8 complaint about redefining the class; I assume a # noqa F811 will be required to quell this warning.
  • add an extra blank line before @continueclass
  • remove the extra blank line at the end (a final carriage return is wanted, but not two of them)
    autopep8 will clean up the last two items.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said...would it make any sense to turn this into C++ code? Or is that just too much work for right now (since this ticket is huge). Perhaps consider filing a ticket to define __reduce__ in C++ pretty much everywhere? It seems a shame to add this whole subdirectory structure when C++ could do the job.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible. But probably not worth it for now. We eventually need some utility code for that I think.

class RadialProfile:
def evaluate(self, r):
if isinstance(r, np.ndarray):
return self._evaluate(r.ravel()).reshape(r.shape)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that Python accepts n-dimensional data and C++ does not. But presumably we rely on that. Pity the C++ isn't more flexible so we could skip this. I realize a lambda function could handle this, but that would take significantly more code than we have here.

# Without this fails with: TypeError: lsst.shapelet.constants.BasisTypeEnum.__new__(
# lsst.shapelet.constants.BasisTypeEnum) is not safe, use object.__new__()
def __reduce__(self):
return (BasisTypeEnum, (int(self), ))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea if this is still needed? (I'm not sure how old the note is)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is (unfortunately) still needed.

@pschella pschella merged commit 20b541e into master Apr 6, 2017
@ktlim ktlim deleted the tickets/DM-9190 branch August 25, 2018 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants