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 weights and axis parameters to vonmisesmle
#14533
Add weights and axis parameters to vonmisesmle
#14533
Conversation
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to Astropy 👋 and congratulations on your first pull request! 🎉
A project member will respond to you as soon as possible; in the meantime, please have a look over the Checklist for Contributed Code and make sure you've addressed as many of the questions there as possible.
If you feel that this pull request has not been responded to in a timely manner, please send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail feedback@astropy.org.
Thanks, you might also be interested in the discussions at #13749 |
e2552ea
to
ddff666
Compare
docs/changes/stats/14533.feature.rst
Outdated
@@ -0,0 +1,3 @@ | |||
This pull request is to address the lack of "weights" and "axis" parameters on the circstats function ``vonmisesmle``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rephrase the change log text to the tone of what you want user to know about the changes when they read the release change log. They would not care it was from a pull request. Feel free to look at existing change log texts for examples. Thanks!
ddff666
to
4c6172f
Compare
Thanks for directing me to #13749. Indeed, could be interesting taking the best of both packages in the long run. Particularly I could certainly not work without weighing my arrays (hence the PR ;)). Also if you guys decide on adapting the kappa estimation using the scipy method it should be straight forward with the weights and axis params. Also, tell me if I can still improve this PR in some way :) |
docs/changes/stats/14533.feature.rst
Outdated
- The "axis" parameter allows fast computation using N-D numpy arrays. | ||
- The "weights" parameter is very convenient when using data with binned angles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these supposed to be bullet points? @saimn , does towncrier render bullets properly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I should have put a line between the paragraph and the bullet points. I don't know about towncrier, but if it handles .rst it should handle bullet points?
I can delete these two points all around. If the user knows how to use the weights and axis for the rest of the module, they will understand the idea of the change?
Up to you, I can either remove them or add the line between paragraph and bullet points
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, I finally deleted the bullet points as they were not adding much to the change log indeed.
4c6172f
to
4e9886e
Compare
@FelipeCybis , sorry for the delay. Coverage is still complaining but the log is too old now, so I cannot see if the coverage upload failed or is it because of something else. Could you please rebase? @larrybradley , are you able to review this before feature freeze? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @FelipeCybis. LGTM, with one minor requested change.
Use ``_length`` to compute the generalized sample length - This change will allow weighted vonmisesmle and the use of the ``axis`` parameter in the correct way Add test to use axis and weights parameters in `vonmisesmle` Update astropy/stats/circstats.py Add @larrybradley requested change Co-authored-by: Larry Bradley <larry.bradley@gmail.com>
6de305e
to
47ab1c3
Compare
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
data = np.array( | ||
[ | ||
[ | ||
3.3699057, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like black
overdid it a little but this is what would make the precommit bot happy. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like this formatting. We could manually reformat and turn off black (fmt: off
), but let's just get this in before the freeze.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @FelipeCybis
Thanks, all! |
Add weights and axis parameters to
vonmisesmle
This pull request is to address the lack of "weights" and "axis" parameters on the
circstats
functionvonmisesmle
.The "axis" parameter that existed but was not actually being used allows for fast usage of 2D numpy arrays.
The "weights" parameter is very convenient since it is very common to have data for binned angles.
The appropriate tests were added to
test_circstats.test_vonmisesmle
in 4c6172f, but here is a minimum example using scipy's vonmises PDF:Or for 2D arrays:
Fixes # There is not opened issue, since it is an enhancement.