Repository navigation
Finishing up CartesianRepresentationFrameAttribute - #5253
Conversation
|
I think this makes sense. Whilst I avoided this in #5207, in retrospect I don't know why. In principle it adds more API changes but I think that almost all third-party uses of This is slightly off topic, but the code here makes me wonder if there a reason that |
Or why one cannot add different instances or multiply them with a quantity... I've been thinking about that as well, but wasn't sure whether it would be useful (beyond being neat); I guess here are some real use cases! (But for another PR... Maybe raise it as an issue for now?) |
b6d0ce0 to
456e7f8
Compare
|
Rebased. Also one small change: in comparing representations, I think |
| ValueError | ||
| If the input is not valid for this attribute. | ||
| """ | ||
| if (isinstance(value, list) and np.all([v == 0 for v in value]) and |
There was a problem hiding this comment.
Why use np.all on a list comprehension? Isn't it possible to use all(v == 0 for v in value) here?
Another alternative would be not any() or not np.any without the comprehension.
There was a problem hiding this comment.
Agreed, should have caught that too.
|
@eteq -- with the shape-changing PR depending on this, I'd really like to get this in, so that I don't have to keep rebasing. The only outstanding issue was whether or not to deprecate; my sense remains not to bother, in which case it is ready as is (especially now that @MSeifert04 provided further review). Any objections? |
| # first set up the astrometry context for ICRS<->GCRS | ||
| pv = np.array([gcrs_frame.obsgeoloc.value, | ||
| gcrs_frame.obsgeovel.value]) | ||
| pv = np.array([gcrs_frame.obsgeoloc.xyz.value, |
There was a problem hiding this comment.
This is mostly a stylistic question: These 5 lines are repeated 3 times in this file. Maybe it would be worthwile to create a helper function?
There was a problem hiding this comment.
Yes, I think it would. There will probably be changes to this code to fix #4942 in the near future and that PR would be the obvious place to address this.
There was a problem hiding this comment.
I think I'd also tend to leave this to when we have implemented velocities in coordinates more generally, in which case this part will change anyway.
|
|
||
| def __eq__(self, other): | ||
| """ | ||
| Check for equality with another representation. |
There was a problem hiding this comment.
The point about the equality being the same shape as the representation should be mentioned here (although also see my comment inline).
Actually, this point should maybe even be added to the narrative docs, because it's behavior that is not really like anything else (it's sensible, but by no means obvious).
|
@mhvk - OK, I thought about the backwards compatibility question a bit (and had a quick discussion with @astrofrog) and concluded that you're probably right that the effort/payoff ratio for trying to have a deprecation period is probably not worth it. I tried to search for cases of obsgeoloc being used "in the wild" (i.e. on github) and only found a few small examples so I think this is mostly safe. That said, given that we're going to do without the deprecation warning, I think we do want to make it a bit clearer in the docs how to work around this change. I'll issue a PR against @mhvk's branch shortly with what I have in mind. There's another backwards compatibility problem I'm realizing, though: the change to make and the original conclusion was "we should leave it to users to decide what they think equality means". Of course we could change that... But perhaps that's best done as its own PR? Or is it necessary to include it here? |
|
Oh, and this absolutely can't go in 1.2.2 if it's going to make a substansive change like this without a deprecation warning. Similarly with the |
|
Oh, actually, I guess this is supposed to include a fix for 1.2 via #5207? Hmm... it's really quite drastically against policy to make API-breaking changes between major versions without a very compelling reason. Is there any chance to make just the |
|
@eteq - The bug fix was for allowing multi-D On |
In the process, added equality check for representations.
Plus quite a few pep8 changes.
2397919 to
3f69b82
Compare
|
OK, I merged in the "what's new" change, moved other change-log entries to 1.3, and removed the ability to do comparisons between representations. I do think we eventually want to have that, but it seems better done in the context of #5255. |
|
OK, cool, I think this is great, then. Travis is still running, but assuming it passes I think this is good to go! I actually do see the value of the |
|
OK, travis now passed, so merging! Thanks for the reviews, everyone! |
…hanges in astropy 1.3 in astropy/astropy#5253
This is a replacement for #5207 which also lets
EarthLocation.get_gcrs_posvelreturnCartesianRepresentationobjects. I also squashed all the commits from @StuartLittlefair and rebased on master.@eteq - what do you think about deprecation? Since this stuff was only introduced in 1.2, and it is fairly doubtful the underlying routines are used outside of astropy already, my sense would be to just go for it...