-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Sidereal time #1418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sidereal time #1418
Conversation
|
Thought I might as well continue anyway, now including all simpler models that ERFA/SOFA provide, and also allowing the calculation of local time. For the latter, I had to change the internal use of One issue I have is that I do not know how to test this. I found one on-line SOFA application [1], but it seems not functional. Any suggestions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I completely understand why you did this, it's a bit awkward that you have to copy-and-paste these docs from ERFA. More worrisome is that the ERFA function might get updated, causing this to no longer be valid. We should probably consider how we might go about extracting the documentation strings and compile-time and inserting them into the function then. That may be the realm of a separate PR, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
The |
astropy/time/core.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be spelled out as greewich_mean_sidereal_time. GMST is a pretty unfamiliar acronym.
|
@eteq - first some answers to two small comments -- keeping them out-of-code since they are not specific to the current commits:
For whether to move Note that the location is given in the initialiser: for full precision, All this being said, we do need an earth-location class! But time and location are interdependent, as neither is properly defined without the other (at least to VLBI accuracies, where continental drift matters). My suggestion for now would be to simply enable getting local sidereal time through both. Perhaps you can make a PR for what you had to astropy itself rather than to this PR? On the new class: While I think basing it on |
|
@mhvk - first on the two small items
This leads to another question, though: should the precession stuff really be in As for where which is the right lat/lon to use? The On the new class: that was sort of a base-line idea, actually, not necessarily complete. It will all make much more sense once the IAU2000 ICRS <-> ITRS transformation are implemented (next on the So how about this as a temporary middle-ground: leave |
|
@mhvk - I have a suggestion for you to consider here: perhaps you should de-scope this PR to only include greenwich sidereal time. That shouldn't be particular controversial and we could merge it pretty quickly within the 0.3 timeline (e.g., by the end of the coming week). Then we can visit LST for the next version, but in the meantime anyone who wants to can at least access GST. If you're willing to do this, I think there's only two major items:
|
|
@eteq - I would like to have @taldcroft have a look first. I don't mind if it is beyond 0.3 |
|
@mhvk - agreed that @taldcroft's input would be useful here, but I think it would be nice to have the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eteq - Is there precedent (here or in numpy) for bundling kwargs like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slightly debatable whether these count as "exactly the same type" since they end up as attributes with different types, but I agree that they are close enough that it makes sense here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree this is fine as-used here. In the future we probably want to replace it with a class for earth locations, anyway, so it's probably not worth worrying too much.
|
And @taldcroft , what do you think about the plan above to reduce this to just the greenwich part? I agree with @mhvk that this shouldn't go in for 0.3 if it has the LST, but greenwich shouldn't be any issue because it doesn't require location information... |
|
@eteq - I agree with the plan to reduce to the Greenwich bits for this PR in 0.3. |
|
@mhvk - could you rebase this and address @eteq and @taldcroft's comments? |
|
@astrofrog - I think this should be postponed to 0.3.1. While I can easily do the practical items, I'm still not convinced about the requested name changes and the necessity to drop local sidereal time pending a still-to-be-implemented Earth coordinate class. Furthermore, I really would like there to be a proper test of the implementation, against a known-correct implementation, and this also needs an update to the documentation. |
|
@mhvk - note that that actually means it has to be postponed to 0.4/1.0, as the 0.3.x series is only bug/docs fixes, no added features. I still think we should put in the greenwich stuff only, but I probably won't have time to do it myself by Friday. And I see your point that its important there be tests for this, so it will have to be triaged if you don't think you can get to it by then. Also, just to be clear, |
|
@astrofrog - as I indicated above, I neither agree with @eteq's comments, nor think this PR is complete, so just postpone. |
|
@mhvk - this looks fine to me, but my voice shouldn't be too loud since I don't actually ever use sidereal time. ;-) For instance is |
In most of the cases I used sidereal time, the difference was not relevant. But then, for many cases when people use @eteq - do you think the above proposal(s) address your concerns? |
|
Yes, this plan looks great to me. I also agree that requiring a type is good for now - as you say @mhvk, I think it doesn't matter in most cases, but when it does, often assumptions are made. So forcing people to think about it is a good thing. If we get a lot of complaints we can always add in a default in a later release. A few suggestions that are just improvements to this main idea:
That is, no floats are allowed, because of the unit ambiguity, and we can get greenwich in now, as it is an IAU standard above and beyond other observatories, and this lets us deal separately with implementing other observatory locations (I like @taldcroft's idea here, but it is tied up with the So this would adjust @taldcroft's example to usage like: |
|
@eteq, @taldcroft - OK, it seems like we converged; I do like this substantially better! I think I also got (al)most all of the other comments, including, most importantly, reproducing the test cases in |
|
@taldcroft, @eteq - I now rebased and also updated the documentation (including the time-scale figure). Let me know what you think. |
Also changed internal use of lon, lat: swapped order in call sequence to match convention (and coordinates), made default None, so that error can be raised if an local sidereal time is requested, and used Longitude/Latitude for them so that they can be defined much more easily.
|
@taldcroft, @eteq - I rebased sidereal time again, and fixed the few documentation issues that were preventing a clean pass from travis. Let me know what you think of the approach (and the documentation). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to add sidereal_time to __all__ here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sidereal_time remains a method, not a class, so why? Did you meant the SIDEREAL_TIME_MODELS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right - I was thinking it was a function. see my comment at the bottom about this (so this change depends on the function/method choice)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, nevermind - I was going to suggest changing it to a function, but after thinking about it a bit more, I think it's fine as-is.
|
My comments above are fairly minor, so once they're addressed I think this is set as far as I'm concerned. |
|
@eteq - thanks for the comments. One question related to using Is there a policy for this? I personally prefer keeping things separate, if only to avoid circular imports, but units is becoming such a basic package that I perhaps should not worry. If you think units should just be imported, I'll do a separate PR on that, as there are also several instances where |
|
First, regarding @mhvk's question on the As for circular imports, we've been using units at the top-level of a lot of subpackages, just as you said- we already had to do some tricks with this to make |
|
@eteq - OK, that makes sense. I'll go ahead and make a separate PR where I pull units out. I think with that this PR is ready to merge, correct? |
|
As far as I'm concerned it looks good. @taldcroft, do you have anything to add, or should we go ahead and merge this? |
|
@eteq, @taldcroft - the follow-up changes for putting units up front are ready [1]; I'll rebase and make it a PR once this is merged. |
|
Looks OK to me. |
|
Following comments by @astrofrog elsewhere, I added a PR number to |
|
As always, thanks @mhvk! |
Now that #1145 is (̶n̶e̶a̶r̶l̶y̶)̶ in, calculating sidereal time becomes simple. With this PR,
yields
This uses
Gmst06fromerfa, but there are quite a few other methods, relying on different precession models. Before continuing, I hoped to get some input on what sofa methods should be exposed (and on whether my implementation inTimeis a good one). For greenwich apparent sidereal time, there are even more methods, since one also has different nutation models (and, for full precision, one might need the IERS tables again).p̶.̶s̶.̶ ̶ ̶I̶'̶l̶l̶ ̶r̶e̶b̶a̶s̶e̶ ̶o̶n̶c̶e̶ ̶#̶1̶1̶4̶5̶ ̶i̶s̶ ̶m̶e̶r̶g̶e̶d̶,̶ ̶s̶o̶ ̶t̶h̶e̶r̶e̶ ̶i̶s̶ ̶l̶e̶s̶s̶ ̶t̶o̶ ̶l̶o̶o̶k̶ ̶a̶t̶;̶ ̶f̶o̶r̶ ̶n̶o̶w̶,̶ ̶j̶u̶s̶t̶ ̶c̶h̶e̶c̶k̶ ̶ mhvk@bb40638 EDIT: rebased