Skip to content

Use converters in Quantity ufuncs instead of just scaling (closes #2496) - #3586

Merged
mdboom merged 4 commits into
astropy:masterfrom
mhvk:quantity-scale-to-scaler
Mar 23, 2015
Merged

mdboom merged 4 commits into
astropy:masterfrom
mhvk:quantity-scale-to-scaler

Conversation

@mhvk

@mhvk mhvk commented Mar 12, 2015

Copy link
Copy Markdown
Contributor

In ufunc evaluations, quantities are converted to the correct unit by multiplying with a constant. This is correct in most cases, but not if an equivalency like u.doppler is in place, which can not be described by a single scale factor. As a result, with such equivalencies in place, the code is wrong (see #2496). Here, the ufunc mechanism is replaced such that instead of a constant scale factor, one uses an actual unit converter function -- this was in fact already used to calculate the scale factor, so should not lead to any slowdown.
cc @mdboom, @astrofrog

@embray

embray commented Mar 12, 2015

Copy link
Copy Markdown
Member

I'm not sure what went wrong the the AppVeyor build, but I've restarted it to see if there's any better luck.

@embray

embray commented Mar 12, 2015

Copy link
Copy Markdown
Member

Argh, same problem still. It looks like it's failing to download miniconda--it gets a 403 (forbidden) when it tries to. Not sure why though since when I try to download from the same URL locally it works fine?

@mhvk

mhvk commented Mar 12, 2015

Copy link
Copy Markdown
Contributor Author

Very odd. Also, what happened to travis? (thanks for adding labels, etc.)

@embray

embray commented Mar 12, 2015

Copy link
Copy Markdown
Member

Huh. What did happen to Travis?

@mhvk

mhvk commented Mar 12, 2015

Copy link
Copy Markdown
Contributor Author

I'll rebase and push up again...

@mhvk
mhvk force-pushed the quantity-scale-to-scaler branch from 25542dd to 8d877b6 Compare March 12, 2015 17:13
@mdboom

mdboom commented Mar 12, 2015

Copy link
Copy Markdown
Contributor

Haven't looked through with a fine-toothed comb, but I get what you're doing here and a huge 👍 to the idea.

@mhvk

mhvk commented Mar 18, 2015

Copy link
Copy Markdown
Contributor Author

@astrofrog, @mdboom, @embray -- I think this is all OK, and it does pass the very extensive test suite, but it would be great to get a detailed review just to be sure.

@mdboom

mdboom commented Mar 18, 2015

Copy link
Copy Markdown
Contributor

Looks fine to me on reading.

@mhvk

mhvk commented Mar 20, 2015

Copy link
Copy Markdown
Contributor Author

@mdboom - are you happy with this? If so, do merge so I can rebase the __numpy_ufunc__ work on it.

mdboom added a commit that referenced this pull request Mar 23, 2015
Use converters in Quantity ufuncs instead of just scaling (closes #2496)
@mdboom
mdboom merged commit 5871e22 into astropy:master Mar 23, 2015
@mhvk
mhvk deleted the quantity-scale-to-scaler branch March 23, 2015 01:01
mdboom added a commit that referenced this pull request Apr 13, 2015
Use converters in Quantity ufuncs instead of just scaling (closes #2496)
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.

3 participants