Repository navigation
Conversation
|
I still kind of feel iffy about the inconsistency of this... I would still prefer to be able to I'll see if I can some up with something illustrating what I'm thinking, if it will even work. |
|
By the way, I'm getting two test failures in the cosmology package with this PR: I'm on scipy 0.10.1. The second one looks like just a slight fp error, and should be using |
|
+1 to this w/ @iguananaut's suggestion of having these work as While this allows usage like |
|
I've included a commit that @iguananaut wrote which implements his suggestions. I agree with his comment in the commit message that |
|
@iguananaut - do you want to try and implement the fix to make it so |
|
@astrofrog Thanks for pulling my suggestions--I'm glad it seems to work out. As for overriding the operators, I think it would make sense for Thoughts? |
There was a problem hiding this comment.
Suppose we also modified the ConstantDefinition class so that the .em attribute is None or a string representing the EM system. Then we wouldn't have to rely on this hackery like parsing the variable name to get the system. The variables should probably still use the name they have anyways, but this would still be a little more explicit.
There was a problem hiding this comment.
That sounds like a good plan!
|
@iguananaut - I like your suggestion of checking if |
|
@iguananaut - do you plan to try implementing this, or should I do it? (I may have a little time this evening) |
|
Yeah, that is a bit of a pain but I don't know if I see a better way :/ I suppose hypothetically I could write a metaclass that does this automatically :) |
|
@iguananaut - one of my ideas was to create a new class called e.g. |
|
@iguananaut - so just to make sure, are you going to try tackling this, or shall I try later if I get the chance? |
|
I'll go ahead and give it a try and send you a PR. |
|
@iguananaut - thanks! |
|
@iguananaut - just to check, are you still planning on doing this? If we get something that works nicely, I suggest we just go with it and do the release candidate, and there's always time to tweak things slightly. I think there's general agreement that this would be a good way to have the EM constants work. |
|
I'll give it a shot in a few. I'm having second thoughts about calling this a "release candidate". Maybe "beta" would be better since there are still too many loose ends I think. "rc" should be reserved for something closer to done, but where there might still be a few bugs to fix up. |
|
|
|
As I start hacking on this several questions come up regarding the consistency of this implementation. First off, right now So what should it be in these cases? I think maybe |
|
I think |
|
@astrofrog I think that makes sense -- thanks for working on this @iguananaut! |
|
@iguananaut - just to check, have you had a chance to work on this more? I think we should try and get this settled and back-ported into 2.0.x (and also fix #603 at the same time). |
|
Huh. I wrote a long comment a couple weeks ago when I was looking into this that appears to have disappeared?! In that comment I wrote that it would make more sense to tackle this after #579 is merged in. I wonder what happened there... maybe I never actually posted it. |
|
@astrofrog I'm seeing now your idea behind an Maybe instead we could flip things around a bit--go back to using the Now you |
|
Actually, I have yet another idea that's sort of a synthesis of everything I described above. Let's see if it works... |
|
I've almost got this working, but I need to step away for a little bit and focus on getting beta 2 out. We might want to push this to 0.2.1 if my solution ends up being too destructive (in the meantime we can certainly accept what we already have as a temporary solution). |
|
@astrofrog @iguananaut - I think we want this in 0.2 ... it's a pretty major change with a variety of subtle consequences, so it would be better to finalize what we want. |
|
So I guess it depends if we're willing to either do a beta 3 or merge this without a beta. |
|
I've merged #540 to make sure that whatever happens, we at least have a description of the current behavior. I think there's no point in delaying beta 2 for this if you think it'll take a while longer, but if we do include it in 0.2 in the end, we should do a release candidate to make sure it all works fine (and then do the final release very shortly after). |
|
+1 to @astrofrog 's suggestion here of not delaying beta 2 for this, but still getting it in 0.2 . We probably don't generally want major changes between beta 2 and RC, but since we're planning explicitly for this one, its fine. |
|
@iguananaut @astrofrog - now that beta 2 is out, how do we want to proceed? @iguananaut, are you still working on the largish change you mentioned above? |
|
Yeah, sorry, I really went down the rabbit hole with this but I think I've almost got it. Basically where I'm at is that a Constant instance may or may not have a 'system' attached to it. If it has a 'system' attached it has a value and unit in the appropriate system. If it does not have a system attached to it, it will basically use the 'default' system (i.e. the first system it was defined with, usually SI) unless the systems in which the constant is defined use incompatible units. Then trying to combine a constant with other values without specifying a system will result in a There's still also a special How does that all sound? |
|
Seems reasonably sound to me, @iguananaut ... and is that a fresh branch, or does it build off of this. Specifically, does it preserve the change that you can just do |
|
@iguananaut - that sounds fine to me! Feel free to open a PR against my branch, or open a new PR (either way is fine). I'll +1 @eteq's comment that for most cases, the user should now have to care about these internal aspects. |
|
Right--they should be able to import a constant directly from (Note: This means one can manually define a dimensionless version of G, which will cause all instances of G to become dimensionally ambiguous. That may or may not be a problem--I don't know.) |
|
@iguananaut - I'm not sure I understand your last comment, but it will be easier to see once the code is ready (maybe you can provide an example once it is). |
…e, and then uses e.si, e.gauss, e.esu (e.gauss and e.esu in this case are equivalent). e.cgs raises an exception. e still combines with other quantities using its SI value in Coulombs by default, though we could (and perhaps should) modify it to raise an exception by default if a specific system is not used.
|
@iguananaut - shall we try and finalize this this week? I've rebased this branch in case you want to add your changes to it, but feel free to also open an alternative PR instead. If we think it's going to take a while to get something stable, then I propose we postpone 0.3, since we are so close to releasing 0.2! |
|
I would be strongly in favor of getting this in for 0.2 (i.,e., end of this week). I think it would be very irritating to users to require |
|
@eteq - note that this PR already implements |
|
There's a failing test and the docs need updating, but in terms of API, I don't think things would change too much with @iguananaut's changes - here's the current behavior: It's not perfect, in that |
|
My thing is almost done. I'm out sick today, but tomorrow I'll try to push it. It's built on top of this PR and has many similarities from the user's perspective at least. |
|
@iguananaut - ok, thanks! (and get better soon!) |
|
@iguananaut - do you need me to rebase this? (I merged in #740, which I think is causing the conflict) |
|
Uhh...not just yet. I have my own branch of this that I've already rebased several times. I'll probably make a separate PR once it's closer to done (my task for the rest of today I hope). |
|
Ok, great! I'll leave it as is, and a separate PR probably makes sense anyway. |
|
We close this without merging if #745 gets merged, right? |
|
@eteq - yes, that's correct. |
|
And this can be closed! Yay! \o/ |
Remove mention of LTS in navbar
This implements a simple API for astropy.constants that doesn't separate the SI and cgs constants explicitly. Instead, EM constants have different versions indicated by suffices (
e_si,e_esu,e_gaussian) and these cannot be converted tocgsorSIvia the attribute notation: