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

Add Planar2d model #5456

Merged
merged 1 commit into from
Nov 11, 2016
Merged

Add Planar2d model #5456

merged 1 commit into from
Nov 11, 2016

Conversation

gkanarek
Copy link
Contributor

@gkanarek gkanarek commented Nov 3, 2016

While one can use a 1st-degree Polynomial2D to represent a plane, there should be a Planar2D functional model to parallel the Linear1D functional model.

Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -67,6 +67,8 @@ New Features
- Added the injection of EntryPoints into astropy.modeling.fitting if
they inherit from Fitters class. [#5241]

- Added ``Planar2D`` functional model.
Copy link
Member

Choose a reason for hiding this comment

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

You need to include this PR number in the change log. See other entries for formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah ok, thanks.


See Also
--------
Linear1D
Copy link
Member

Choose a reason for hiding this comment

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

Also include Polynomial2D here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can include Polynomial2D here, yes.

@@ -786,6 +786,53 @@ def inverse(self):
return self.__class__(slope=new_slope, intercept=new_intercept)


class Planar2D(Fittable2DModel):
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this just a special case of Polynomial2D? So, should it really subclass Polynomial2D and belong in polynomial.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If so, why isn't the same done with Linear1D? It's in the same spirit as that one.

Copy link
Member

Choose a reason for hiding this comment

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

Good question. I dig back at the history at notice that Linear1D was added pretty early via #1203 as part of some other refactoring. So probably could have but did not happen.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe @nden can comment more on this. If subclassing Polynomial2D has no other added benefits, then this is probably okay as-is.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's simpler if it does not inherit from Polynomial2D which does more computations because it's general.

@pllim
Copy link
Member

pllim commented Nov 3, 2016

Ping @nden and @eteq

@pllim pllim added this to the v1.3.0 milestone Nov 3, 2016
@nden
Copy link
Contributor

nden commented Nov 3, 2016

This looks good to me! 👍 on merging when tests pass.

@pllim
Copy link
Member

pllim commented Nov 4, 2016

Tests passed. I will let someone else merge because if it's up to me, I would have asked for squashing...

@gkanarek
Copy link
Contributor Author

gkanarek commented Nov 5, 2016

@pllim - what's "squashing"?

Also, do I need to do anything about the changelog conflict?

@nden
Copy link
Contributor

nden commented Nov 5, 2016

@gkanarek You need to resolve the conflict in CHANGES.rst by rebasing. If you perform an interactive rebase you can squash the commits (basically make it look as if there was only, for example one commit). The command to do an interactive rebase is

git fetch astropy master
git rebase -i astropy/master <your-branch>`

An editor window will open with a list of all commits. Mark the ones you want to squash with s and the ones you want to be visible with p. After you close the window another one will open with a list of commit messages for each commit. Comment out the ones you don't want.

Sounds like a lot but it's not that bad. See also the help for rebase.

You can use a 1st-degree Polynomial2D as a plane, but this is intuitive and easy to recognize.
@pllim
Copy link
Member

pllim commented Nov 11, 2016

I rebased and squashed this PR. I'll merge when tests pass.

@pllim pllim merged commit df489c5 into astropy:master Nov 11, 2016
@gkanarek
Copy link
Contributor Author

Oh thank you - I hadn't had a chance to do this yet!

@gkanarek gkanarek deleted the add-plane2d-model branch November 11, 2016 16:46
@pllim
Copy link
Member

pllim commented Nov 11, 2016

No problem. This helped me to finally figure out how to use the new "maintainer take over" GitHub feature. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants