Skip to content

Add imag/real wrappers. - #41

Merged
ddale merged 3 commits into
python-quantities:masterfrom
dopplershift:master
Dec 11, 2016
Merged

ddale merged 3 commits into
python-quantities:masterfrom
dopplershift:master

Conversation

@dopplershift

Copy link
Copy Markdown
Contributor

The main part of this PR is to add real and imag wrappers, that check and apply proper units. I've also included a fix to the quantitizer decorator, which was mistakenly adding a call to simplified.

@jgosmann

Copy link
Copy Markdown

Today I also stumbled over the missing passed parameters on the wrapped methods amin() and amax(). A merge would be appreciated.

@mikofski

Copy link
Copy Markdown

I just picked up on this too, opened ticket #69

@mikofski

Copy link
Copy Markdown

min and amin also have the same issue

@burnpanck

Copy link
Copy Markdown
Contributor

Note that your fix of the out parameter is flawed: While the returned Quantity will indeed share data with the array passed to out, if the units of the value passed to out are off, it will actually hold wrong values. Thus, if the out parameter is used just to avoid the memory allocation, then your fix is fine; If you actually want the data to be placed in that array, your fix fails silently.
See my PR #87, which fixes both the out and axis parameters more thoroughly.

@ddale

ddale commented Dec 16, 2015

Copy link
Copy Markdown
Member

Sorry for neglecting quantities for so long. If you can incorporate @burnpanck's fix, and add a unit test, I will merge.

This allows easily writing setter methods for them so that we can handle
units on set.
@dopplershift

Copy link
Copy Markdown
Contributor Author

Ok, well two of the commits (adding squeeze and fixing some wrapped methods) are no longer needed. I've updated the PR to reflect what's left. I'll also add tests for what I'm proposing.

@dopplershift dopplershift changed the title Fix wrapping some numpy array methods Add imag/real attributes. Feb 10, 2016
@dopplershift dopplershift changed the title Add imag/real attributes. Add imag/real wrappers. Feb 10, 2016
@dopplershift

Copy link
Copy Markdown
Contributor Author

Done. I didn't add tests for quantitizer because I'm not really sure how to start (and I don't remember what I was doing when I hit the problems.) The fix is trivially correct, though.

@ddale
ddale merged commit 7b45fb0 into python-quantities:master Dec 11, 2016
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.

5 participants