Repository navigation
Conversation
|
Don't forget milestone & labels :) |
|
I'm actually 👎 to this. That is, I see the current behavior as a feature, not a bug (although I'm open to being convinced). My reasoning is that this (along with other places like |
|
Why should you not be able to get the separation on the sky in a NoFrame? Requiring a frame always in this case leads to the also-undesirable situation of people just inserting an arbitrary frame into data in order to get the function to do something. I.e. imagine you are given a catalog of object coordinates and but not the frame and you want to find nearby pairs. To get this to work the user needs to invent a frame when that information is not actually relevant to the problem. Then let's say they pickle the coordinates object and hand it off to their collaborator, who unwittingly assumes that the specified frame is actually correct. My other argument is that this software is primarily aimed at research astronomers and you can assume some basic competency about astronomy. I think that the person who will be entirely unaware of coordinate frames will be the same one who will just blindly add |
|
Hmm, I see your point about users "inventing" frames @taldcroft ... But my point isn't so much that we can ever hope to catch things like that, but rather that this way we force the user to at least think about it a little, even if long enough to decide "eh, it doesn't matter". I'm thinking with that, more people will say "Well, it is in fact ICRS, I was just too lazy to type that... but now I will." I think it might be useful to get another opinion on this, though - perhaps @astrofrog? |
|
I re-milestoned this for 0.4.1. Perhaps it's best to hash this out after the 0.4 release and decide if it's a bug or a feature. |
|
Fair point - definitely easier to turn this on in the future than go the other way! |
|
It's a feature! I was about to file a feature request asking for this to work: SkyCoord(0, 0, unit='deg').separation(SkyCoord(10, 20, unit='deg'))I'm using this in a simple generic spherical geometry calculation. |
|
There's no spherical geometry code in Astropy besides |
|
@cdeil - I guess I see your point here... There's not necessarily another way to do this easily, and sometimes you just want it done. The problem here is that there's an essential tension here between "we want users to actually think about what they mean" and "we want to make things as easy and fast to do as possible". One of our goals (or perhaps it's mainly my goal) is to prevent the sorts of mistakes that come from people playing fast-and-loose with these sorts of definitions. |
|
Another option to consider, and that I'd be willing to put in for 0.4 if @cdeil and @taldcroft are ok with it: instead of raising an exception, have this (and similar usage in |
|
@eteq I'm 👎 on generating a warning ... then I'll have to suppress it in my code, which is more complicated than adding a dummy |
|
@cdeil - oh, maybe I'm misunderstanding the complaint: are you saying that you'd be fine with something like: SkyCoord(0*u.deg, 0*u.deg, frame='sphere').separation(SkyCoord(10*u.deg, 20*u.deg, frame='sphere'))? I'm perfectly fine with an explicit "generic" frame. My concern is about situations like this: |
|
I'd prefer the default But if you don't want that, then yes, writing |
|
@eteq - I've already weighed in but I just want to reiterate the general Python dogma of treating users as adults and even more, research astronomers who understand at a solid level the idea of coordinate frames . There are a thousand ways to get the wrong answer with astropy. Some one can fit an unreasonable model to data but we don't purposely make it difficult to do the simplest thing like fit a line. But that is just my view. |
That's my point: I know a lot of research astronomers who do not understand the many subtleties here (I have done multiple surveys, both of the "walking down the hall" variety and the "ask people at conferences" sort). I also disagree that this is "general Python dogma" - after all, the zen (which is about as dogmatic as it gets) clearly says "Explicit is better than implicit" and "Errors should never pass silently". Exactly how much that applies here is subjective, but I see those as telling us not to do this. But of course it's also true that "Practicality beats purity", and that's the issue at hand. All that said, I could accept caving on this, as I would in fact use it myself in a lot of science code... But I would like to hear at least a couple more viewpoints from other people who have considered the arguments here. |
|
@astrofrog @mhvk @adrn @Cadair - waiting for your 👍 or 👎 votes on whether to accept this PR to allow computing the separation or matching between two or more |
|
I put this back to 0.4 for the moment because it is still in consideration for inclusion. |
|
Well, this is a controversial feature for sure :) My vote is to allow this, but (as @eteq suggested) emitting a warning pointing out that the coordinates are assumed to be in the same frame. This seems like a compromise. Note that as for all warnings, this will only appear the first time, so it's not like it will clutter up users' terminal. We could always take another vote later for whether or not to keep the warning for 1.0, once people are using the new astropy.coordinates. |
|
I'm really 👎 on warnings like this for the reason @cdeil mentioned, because suppressing warnings is much more pain and confusing than supply a dummy frame name. (I don't know off the top of my head how to suppress a particular warning for a particular line of code, is there some context manager to do this? Probably, but using astropy in an "endorsed" manner shouldn't require this sophistication). |
|
Hmm, this is a tough one. Overall, I'm 👎 as I think this is correct behaviour, though I do see that we want to allow the use cases mentioned. I don't really like the warning route to "half" allow it: things are either OK or they are not. The reason I think it should generally not be allowed comes in part from comparing to other places in
I see several options:
p.s. I don't think this should hold up 0.4. |
|
I think I'm tilting towards 👍 to the warning idea, particularly with @astrofrog's
Having recently been using some of this stuff for science work, I've noticed myself sometimes using But I still have my initial concern that if we silently default to this, users will mis-use it, because they will try to use it like software they've used before, which generally is not nearly as advanced as this in terms of explicit frames. So that's why I like the warning: it forces them to think about it because they see the message once, but after that they can ignore it. We do this in other parts of Astropy, and it's exactly what warnings were designed for in python. Telling people "this will run, but it may not behave the way you think it will behave".
|
|
Oh, and re: @mhvk's options:
I don't think we should do this, because the problem described here applies for all convinience methods on
Just as you say, I don't think there's a way to reasonably do this because the idea of "same object" is ambiguous
This could work, but I prefer a slightly different version of this that occurred to me right now - lets call this "4.": in #2629 we discussed (and I think agreed on) the idea of a generic |
|
I'm 👎 on the warning idea. My current use case for this is a PSF class where I want to do sky distance calculations to evaluate a PSF model in any sky frame in affiliated package library code, not an end-user script. Either simply allowing this as @taldcroft and I want or any of the methods proposed above to explicitly declare "I want to use from astropy.tests.helper import catch_warnings
from astropy.coordinates import PotentiallyIllegalFrameWarning
with catch_warnings(PotentiallyIllegalFrameWarning):
offset = SkyCoord(0, 0, unit='radian').separation(SkyCoord(lon, lat, unit='radian'))
return psf.eval(offset)IMO raising warnings for correct and common usage patterns is a bit silly and extra arguments to declare explicitly what I want to do (if really needed for "end-user safety") are better. But I'm starting to repeat myself, so I'll shut up now and if this doesn't go in Astropy 0.4 I'll just use |
|
Intuitively, I don't think |
|
Separations are the use-case I'm thinking of, and it's quite common to have catalog data with coordinates where the exact frame really doesn't matter. You just want to know how many close pairs there are in this catalog. Or you've measured the positions of a bunch of Chandra X-ray jet knots using DS9, typed those into the computer and now want to know the separations. As I argued before, I think it is actually worse to force people into the habit of assigning a dummy frame so they can get on with their research, because then you've trained people to invent information to get around this issue. @eteq hopes that people will do the right thing and dig through the paper or Chandra documentation to find the actual reference frame, but I think that most astronomers in this situation will just put in 'icrs' and move on. |
|
I think @astrofrog is right that the use cases mentioned all involve using Though this does bring me back to my option (1), that the representation classes should be able to calculate separations. In that case, one could use these directly (appropriate in @cdeil's example and @taldcroft's Chandra one) or, if one were still to use Which basically means that you let the user decide whether s/he is confident the coordinates are in the same system, perhaps not too differently from the user being able to do A small advantage of this approach is that it would also simplify the implementation of |
|
We have two cars, and one is a Japanese car that is designed with simplicity in mind, and the other is from a German company known for performance. The Japanese car has a button on the door that you can push to lock the doors. This is a common operation, it works great, and I use it all the time. The Germans instead were fearful that users would accidentally lock themselves out of the car, so they made it actually impossible to lock the car without getting your keys out of your pocket. My plea is to be less fearful for users, less pedantic, and just let everyone do the simple and obvious thing. The suggestions so far (warnings or coercing into a special representation) all require googling or carefully reading the docs to use effectively. I just want software that is basically obvious for the simple things, even if it means trusting users to not lock themselves outside the car. |
|
Hmm, perhaps there it should be possible to use |
That seems to be going way beyond the original idea, which can be restated as "Every astropy frame shall have an identity transform to itself". I think this is a much more limited concept than a frame that has an identity transform to every other frame. When we implement proper coordinate equalities this could lead to nice transitivity paradoxes with a = b = c but a != c. |
|
Since it seems there are strong opinions on both sides, and just to see if this would be an acceptable solution, what if we assume instead that if no frame is given in
The advantage is, if the user really doesn't care, things will work, and if they care, they will notice in the No one opposed making |
|
👍 to @astrofrog's suggestion to put a default |
|
I'm fine with an Do still feel the representations should be able to calculate separations, but that's for a different PR. |
|
👍 to @astrofrog's suggestion. I believe |
|
@eteq - I think we just need your opinion about defaulting to |
|
@astrofrog et al. - I don't like this too much for the reasons I gave above about users mis-using this frame... But @taldcroft has a fair point that users will probably just do this anyway, which is worse because then it seems like it should be ICRS. And anyway, it's clear I'm in the minority, so I'm willing to just accept that defaulting to (@taldcroft - apparently I like German-style cars? Oddly, my car is a Toyota... I'll have to look at Volkswagen next time 😉) |
|
Oh, and it might make sense for me to just add this as part of finalizing #2629 , as it might conflict. But it might not, so if @taldcroft gets to doing this before, it would probably also work to modify this PR. |
|
@eteq - btw, if you want me to work on this (from current master I guess), I can. Even though the actual code changes will be pretty trivial, I suspect this change will have a moderately large footprint in tests and docs. Nothing tricky, just grinding. |
|
@taldcroft - I have now this implemented in 8ed4d01 of #2629 |
In particular this allows computing sky separation for NoFrame coordinates.