-
Notifications
You must be signed in to change notification settings - Fork 120
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
planet coordinate systems (moving observer to another planet) ? #48
Comments
Unfortunately not. The underlying astronomy library beneath PyEphem only works for Earth. If you want to do computations from other planets, try the Skyfield library that I am writing to replace PyEphem. At the moment it can do half of what you need: it can tell you the direction in which Venus lies from Jupiter, through a call like:
Unfortunately this right ascension and declination will be relative to Earth's equator (more or less — more strictly speaking, they will be ICRS coordinates) and not relative to Jupiter's equator. To predict where Venus's position would lie for a Jovian observer, we would have to find a model for Jupiter that predicts where its axis is pointing each day. What is the end result you are trying to compute, if I may ask? That will let me figure out if Skyfield will soon provide you with a way there! |
It seems sky field will rock! especially for folks like me, the non-experts. I have found a nasa link that can move observer to another planet. The end result I'm targeting, is to find the dates (in a given range) when any planet crosses other planet's equator. If I don't have a choice, I will grab slowly the ephemeris from nasa horizons, and compile this list of dates manually. |
Why "slowly"? On Sun, 3 Aug 2014, Michael wrote:
|
Slowly in the sense that there are 45 pairs of planets? (45,if im correct) And for each pair i have to generate ephemeris for a range of dates. Slow process. |
OK. I thought you would download the positions and tilts of each planet It's 45 if there are 10 planets, so I'm guessing you're adding 2 to the You might want to look at their mail interface and my: https://github.com/barrycarter/bcapps/blob/master/bc-email-horizons.pl for some scripting. Or, I'm bored and can script it for you (no charge) if On Sun, 3 Aug 2014, Michael wrote:
|
@barrycarter I was aware of mail interface, but I didn't take it into consideration well, if you are bored, and want to do something about it :P there are enough hurricanes or major weather reports in this range, i believe then, the pairs, written as (observer location, target body) then then until pluto (but I guess, seeing from pluto, all inner planets are crossing its equator kind of the same time) meanwhile I will get into mail possibility |
Michael, email or google talk me at carter.barry@gmail.com. This doesn't seem difficult, but I want to check a couple of details with you. Brandon, if you prefer, we can keep the conversation here, but I wasn't sure it was relevant. |
Just for fun, and as part of my never-doing-what-I-say campaign, As I sort of expected, Jupiter's axis, like Earth's is fixed with Earth's axis, with a tilt of ~23.5 degrees, points (roughly) to http://simbad.u-strasbg.fr/simbad/sim-id?Ident=HIP+87179 This star has a declination of 64N 46' on Earth, and 89N 32' on With a little work, we could refine this information and use it |
It turns out there's a table of "pole positions": http://en.wikipedia.org/wiki/Poles_of_astronomical_bodies and individual planet/satellite pages also list this. On: http://en.wikipedia.org/wiki/Jupiter it's under "north pole right ascension" and "north pole declination". Assuming these are relatively fixed, combining this with a coordinate transform should solve the problem? |
Have you consider JPLs NAIF/SPICE? Its Achilles heel for complex tasks is kernel (data) management and it is yet another steep learning curve to climb, but once you have it in your toolbox it is extremely powerful. For simple stuff like the original post in this thread I think there is a one- or few-call solution, and even the kernel management would be pretty easy. It is what the planetary remote sensing community uses for science and operations, and there is a decent and functional, if informal and slightly incomplete, Python interface (https://github.com/rca/PySPICE). |
@barrycarter, I was about to ask you about that list of poles! I will see whether Skyfield can use those pole coordinates to determine where in Jupiter's sky another planet is, and then you could extent that solution out to other planets. If I come up with a solution I will post it here. |
@ifmihai, NAIF/SPICE has a Geometry Finder suite of tools, one of which is for solving the exact problem from your original post: http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/gfposc_c.html The example section finds times when the Sun is in a particular geometry relative to the Earth's body-fixed frame. Replace SUN and EARTH with VENUS and JUPITER in the assignments, and Example 3 is your original request exactly. A couple dozen C statements for variable declarations and setup, one call to actually solve the problem (determine times when Venus crosses Jupiter's equator), and a few dozen lines for output. Plus the kernel management which is not tough for this problem. SPICE has a steep learning curve; let me know if you want to pursue this. |
I agree with @barrycarter that probably only a rotation or two is necessary, given the pole direction on the Wikipedia page, to get an approximate position for a Jovian coordinate system. But without a way to generate a correct coordinate to aim for, I have no idea whether I have rotated in the right direction or the wrong one for this first try using Skyfield: # From Jupiter, observe the position of Venus
from skyfield.api import JulianDate, venus, jupiter
from skyfield.functions import rot_x, rot_z
from skyfield.positionlib import to_polar
from skyfield.units import Angle, Distance
jd = JulianDate(utc=(2014, 8, 5))
xyz = jupiter(jd).observe(venus).position.AU
# The resulting ICRS x,y,z coordinates need to be rotated to directions
# relative to Jupiter's equator and pole. (These rotations are probably
# backwards. Or maybe even just wrong. Can someone generate some
# coordinates using another tool to double-check?)
jpole_ra = Angle(degrees=268.06)
jpole_dec = Angle(degrees=64.50)
W = (rot_z(-jpole_ra.radians)).dot(rot_x(-jpole_dec.radians))
xyz2 = (W).dot(xyz)
d, theta, phi = to_polar(xyz2)
print 'Jupiter declination?', Angle(radians=theta)
print 'Jupiter HA?', Angle(radians=phi, preference='hours')
print Distance(AU=d) This all strikes me as a bit clunky, but I think it is because Skyfield has no idea yet about the coordinate systems of other planets — so we are having to do the rotations, and change to polar coordinates, out in the open whereas normally it would occur under the covers if you were asking about a traditional Earth-based coordinate system. |
Brandon,
Actually, I believe Horizons will do this (as the OP discovered). You can !$$SOF and you will get back the attached (so my example above is for reference
|
NAIF/SPICE solution: 82 Venus crossings of the Jupiter equator between 1901 and 2100; one-second resolution; currently uses DE-430 and JUP-310 ephemerides and IAU Jupiter frame; trivially translatable to almost any other observer/target bodies. Took me an hour and a half to write; about thirty lines of code. |
@drbitboy SPICE is very nice indeed. Powerful even though a little steep learning curve. Thank you for pointing it out and for python example code. Lots to crunch, but its a great tool, the only one apparently for now. @barrycarter if stellarium and spice can move observer to other planets, can we get the method out of their code? |
@barrycarter Observing one planet from another is a single line of code in Skyfield. Here, for example, is the Skyfield code to generate the first position from your HORIZONS result:
The problem is that these two coordinates are not a sufficient answer for this question, because they are ICRS coordinates which measure angles relative to the Earth’s equator and poles. The question is about whether we can express these same coordinates relative to the equator and poles of the planet from which we are observing. That is what, you will see, I was trying to do with the pair of rotations in my sample code above. I did click through all of the HORIZONS features last night, and did not find any ability to use local coordinate systems like “the dynamical reference system of Jupiter” or anything — so my guess is that HORIZONS cannot do this calculation. @drbitboy Thank you, I will take a look at these results! |
Did you try the frame IAU_JUPITER with Horizons? I haven't been there in a while, I am just guessing. Using SPICE code is probably an all or nothing proposition; either you put it under the hood of your app, or you encapsulate it in a web app (i.e. I think it's integrated into Horizons for some functions), or you don't use it. The real beauty of SPICE is that, since the 1980s, it has separated the code (functions) from data: S - spacecraft ephemeris; It's an objected oriented toolkit originally written in FORTRAN. And the documentation is outstanding; here is one of my favorites: C |
@brandon-rhodes this is the web GUI interface to SPICE I did a search for declination == 0, it would be interesting to see if SPICE is different than horizon (I doubt it) |
@brandon-rhodes Did you see a "Reference plane [eclip, frame, body ]" option in your clicking through the Horizons features last night? I was able to coax the Horizons telnet interface (port 6775) to put Venus in the Jupiter frame (I think; the results eyeball-agree to within a minute of the SPICE result for the 2014 equator crossing): https://github.com/drbitboy/vj/blob/master/horizons.md I used python and the expect module to extract data from the Horizons telnet interface in PySPICE (see the test code), and I once wrote a VBA script to fill out an eXcel spreadsheet via the same route. |
Here is the answer. The Python code in the following notebook solves the original question for Jupiter and Venus. Given the other planets’ pole orientations as given in the Wikipedia article cited above, it could do so for any planet pairing. It took me a few tries to get the rotations in the right direction; I think they are correct now. You will see that the zero crossings now agree to very good approximation to the SPICE predictions @drbitboy offered above: http://nbviewer.ipython.org/gist/brandon-rhodes/60503689abeef7fc099c Thank you VERY much, @drbitboy — without your having solved the problem in SPICE, I would have had no way to find and verify the correct rotation directions to convert into Jovian coordinates! I suspect that the SPICE solution is superior since it is presumably approximating the Jovian pole progression over the eons, and is thus more accurate than the rough point-in-time figures given in the Wikipedia. In the future the operation might be even simpler in Skyfield, without requiring these extra imports and manual rotations, but for now this is the best approach. |
And, no, I had not heard of William Foster before — PyEphem users doing astrology before have, I gather, been using systems that only use the relative positions of other planets to Earth rather than positing that planet-to-planet relationships not involving the Earth could influence events here. |
On Horizons, you need to choose vectors for [Ephemeris type], then in the [Table settings](the scalpels go on the left, with the pitchforks. Igor! Igor!) you can select the option for body-fixed coordinates. |
@drbitboy — And there I had gone, clicking through all of the options under "Ephemeris Type: OBSERVER" thinking that I had exhausted the possibilities! Thank you for the detailed diagram. The HORIZONS web interface can indeed produce this result. |
This is like the experienced coder sitting behind the newbie who just read the emacs or vi manual, and the newbie does something and the coder says "Hey! How did you do that?" There are just too many options on this blasted interwebnet thingy. |
@brandon-rhodes Here is the list for venus, jupiter, with reference IAU_JUPITER, from 1950 to 2020. This is copy paste, columns being: 1 @brandon-rhodes I doubt Foster was into astrology. When a men refuses to give away his method, I believe he is beyond (usual crap) astrology. Personally, I don't care, I want to test as I was intrigued by the person and his ways. @drbitboy emacs/vi image was funny :P |
@ifmihai I am glad you now have the list of events you were looking for, hopefully together with a good way to produce them in the future for the planets you are interested in! And I am happy to see that your list includes the third zero-crossing in late 2009 that SPICE missed, but that is clearly visible in the graph from my notebook: http://nbviewer.ipython.org/gist/brandon-rhodes/60503689abeef7fc099c Since PyEphem itself will never be capable of a calculation like this because of the limitations of the underlying C library, I am going to go ahead and close this issue. Good luck! |
Here's a solution to the OP's question that I'm particularly Example: find when Mercury crosses Jupiter's equator. Wikipedia tells us Jupiter's north pole points to 268.057 degrees Converting this to rectangular coordinates (with an arbitrary [-0.0145987218963993, -0.430326550289791, 0.902555226805917] Jupiter's equator is the plane perpendicular to this vector going Thus, when Jupiter is at [jx, jy, jz], the plane of Jupiter's -0.0145987218963993_(x-jx) + -0.430326550289791_(y-jy) + Thus, if Mercury is at [mx, my, mz], we are checking if: -0.0145987218963993_(mx-jx) + -0.430326550289791_(my-jy) + I tested using this program: for t in range (2456876,2456876+1000): and looking at the results visually. Two crossings I found: ALPHA 2457004 [-392992.70703286] ALPHA 2457040 [ 472299.13722086] which correspond to "2014-12-12 12:00:00" and "2015-01-17 Of course, you should really be using a binary search, further |
@brandon-rhodes It turns out a rotation is not sufficient because there are an infinite number of rotations that will map a given RA/DEC to the north pole. However, any of these rotations will yield the same declination. So, you can use a rotation to find the declination, which technically answers the OP's question :) |
Will skyfield include IAU_JUPITER and other planetary reference frames? |
@barrycarter sounds good (but i dont understand the details). But +1 for IAU_planet reference systems. As these reference systems i used with webgeocalc and they gave(apparently) accurate results. |
I have opened an issue on Skyfield and will add that feature — thanks for the idea! |
Brandon, going back over old items; I may get an opportunity to use SPICE for astrological calculation. What crossing in 2009 did SPICE miss? I set the step size to 10d, so it certainly is possible, but I see three in my results here. |
Comparing your list with the short list in my code: http://nbviewer.jupyter.org/gist/brandon-rhodes/60503689abeef7fc099c it's the 2009-08 crossing that's not marked on my graph as a SPICE-detected crossing. I can't now decide, all these years later, whether I was cutting and pasting from a SPICE result set of my own (or someone else's besides yours), or whether I made a cut and paste error that left 2009-08 out. So unless we find new evidence, let's assume that the error was mine, and that SPICE in fact found that crossing! |
I'm new to pyephem.
I searched the docs, and it appears it's not possible, at least for now.
would it be possible to move the observer to another planet?
I'm interested right now mostly in calculating declination of venus (for example) as seen from jupiter (for example)
Declination => find moments when venus crosses jupiter's equator
The problem is I'm not a physics guy, or an advanced math guy, so I try to find a library to be able to do this
Any help or insight on this?
The text was updated successfully, but these errors were encountered: