Skip to content

remove C as cgs base but also add CGS electric units - #4355

Merged
eteq merged 2 commits into
astropy:masterfrom
eteq:fixish-4354
Dec 2, 2015
Merged

eteq merged 2 commits into
astropy:masterfrom
eteq:fixish-4354

Conversation

@eteq

@eteq eteq commented Nov 29, 2015

Copy link
Copy Markdown
Member

This closes #4354 by removing C as a cgs base (which was incorrect) while at the same time adding the CGS ESU/EMU charge and current as distinct physical types. This fixes #4354 by changing it so that this behavior happens:

>>> u.debye.decompose(bases=u.cgs.bases)
UnitConversionError: Unit A can not be decomposed into the requested bases

Which is now more consistent with the behavior that happens when you try to convert CGS E&M units to their SI equivalents:

>>> u.statcoulomb.to(u.coulomb)
UnitConversionError: 'Fr' (electrical charge (ESU)) and 'C' (electrical charge) are not convertible

And that's what we want, because the different CGS E&M systems actually have really different physical interpretations. The relevant wikipedia arcticle section is good for background on this for any looking at this that isn't particularly up on their E&M.

@eteq

eteq commented Nov 29, 2015

Copy link
Copy Markdown
Member Author

Oh, and I'm marking it for 1.1 as it's probably fair to consider this a bug (i.e. #4345).

@mhvk

mhvk commented Dec 1, 2015

Copy link
Copy Markdown
Contributor

+1. I realise I actually don't know how cgs works in this respect (and maybe I should see this just as another reason to stick to SI!), but would it, at least in principle, be possible to pick a given system and then allow conversion? I.e., something like

with u.set_em_system(u.cgs.emu):
    ...

and within this system charge per second would correspond to the relevant current?

@eteq

eteq commented Dec 1, 2015

Copy link
Copy Markdown
Member Author

@mhvk - yes, actually that's probably a much better approach. I'd say that's definitely in the realm of "new feature", though, so maybe make a new issue for that and tenatively slate it for 1.2? (And we can merge this now for 1.1)

The one catch is that then you have to figure out how to deal with the constants... Right now it's basically taken as "you can't do direct SI-to-cgs E&M conversions of the constants themselves so as to not make assumptions". That could be made cleverer... Or just left as-is and assumed that the user has to actually use the right constants in the right places.

@mhvk

mhvk commented Dec 1, 2015

Copy link
Copy Markdown
Contributor

Agreed to keep it separate -- see #4359.

@mhvk

mhvk commented Dec 1, 2015

Copy link
Copy Markdown
Contributor

p.s. The appveyor test seems spurious -- yet another one of these VOtable failures.

@eteq

eteq commented Dec 1, 2015

Copy link
Copy Markdown
Member Author

Agreed - I think the test are indeed passing in reality. If this is OK with @astrofrog I think we can go ahead and merge it (and backport to 1.1)

@astrofrog

Copy link
Copy Markdown
Member

Looks good to me, I've restarted AppVeyor to check

@embray

embray commented Dec 2, 2015

Copy link
Copy Markdown
Member

I think this is fine--it was a mistake to have C in the cgs bases.

@eteq

eteq commented Dec 2, 2015

Copy link
Copy Markdown
Member Author

OK, appveyor is now happy, will merge and backport.

eteq added a commit that referenced this pull request Dec 2, 2015
remove C as cgs base but also add CGS electric units
@eteq
eteq merged commit acd2f47 into astropy:master Dec 2, 2015
@eteq
eteq deleted the fixish-4354 branch December 2, 2015 21:44
eteq added a commit that referenced this pull request Dec 2, 2015
remove C as cgs base but also add CGS electric units
@eteq

eteq commented Dec 2, 2015

Copy link
Copy Markdown
Member Author

backported to 1.1.x in c87aaa8

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Electric charge base unit in cgs should not be Coulomb

4 participants