How to find Planet Position using skyfield - python

I want to find planet position using skyfield in the form of
Ecliptic longitude,latitude, speed and distance in geocentric

You will probably want to go ahead and read the Skyfield documentation — have you made it very far yet, or are you still at the beginning? One of its earliest sections is its Examples:
https://rhodesmill.org/skyfield/examples.html
By searching that web page for concepts you are interested in, you can sometimes skip reading the full documentation — for example, try searching for the phrase “ecliptic longitude” and you’ll find an example where it’s computed for the Moon.

I'm not sure that you realize that you're asking a very difficult question. The motions of the planets are not simple ellipses. How much precision do you need? Are you asking for a program that will work for this year, for this decade, for this century?
A good introduction can be found here. For more information, you really need to take a course on planetary dynamics. I believe that NASA has some Fortran code (the SPICE kernel) that is used for their spacecraft.

Related

Astroquery JPL Horizons Python

I'd like to ask if anyone knows how can i get list of all objects that are in the Solar system. I mean all planets and their natural satellites. Or first 400 objects that are the closest to the barycenter of the solar system. The only thing i can get are planets and not exactly planets but their barycenters, so these aren't even correct coordinates.
So my husband is a planetary astronomer who studies moons of the outer planets (and Pluto). I thought he'd be able to tell me the answer right off. His response was "It's complicated, there is no central repository."
Most astronomers use the SPICE Toolkit and its Python wrapper. This toolkit has built within it databases for many of the objects that astronomers are interested it.
You can also find the ephemeris of most bodies at JPL Horizons. He has only used it to get one ephemeris at a time, but it may have the ability to generate multiple ephemerides.
Information about minor planets (Pluto, Ceres, Pallus, etc) can be found at the Minor Planet Center.

Calculate the sub-solar point on the moon Skyfield

I am following these instructions on measuring crater height in my own moon images: http://www.astro.ex.ac.uk/obs/experiments/lunar/script.html
They require me to calculate the sub-Earth and sub-Solar points on the Moon when the image was taken.
Is there a way to do this in Skyfield? I can only find reference to this being done for sub-Solar points on the Earth using pyephem.
The Skyfield documentation describes getting the lunar longitude and latitude of the sub-Earth point here:
https://rhodesmill.org/skyfield/planetary.html#computing-lunar-libration
It looks like if instead of (earth - moon) you also did the same thing but with the difference (sun - moon), you would get the sub-solar point on the Moon. I’d suggest trying each of those out, and seeing if the values you get back match example values from some other authority you could check against to make sure you're getting values that mean the same thing.
(And, if that approach works, let me know by responding here with a comment, and I'll update the documentation to add a heading to that page of the docs that explicitly mentions the word “sub-Earth point” or “sub-solar point” — since I don’t think the word “libration” makes it obvious to folks needing sub-points that the section will answer their question.)

Locational triangulation

I have data about 10 points in a 2D map, I know the location of points 1,2 and 3. I also know the distance between point 1,2 and 3 to all other points.
I know that cell phone uses distance from gsm towers to locate their location. I wish to use similar approach to locate points 3-10. How can I implement such a solution with python? Which libraries can I use?
Thank you for all help
First, solve the math. Make a drawing. You will find that you can use two points and their distance to reduce the possible points to just two, the third one will only be needed to disambiguate between the two. Putting the whole into Python should be easy then.
Note that I'm not going to spell this out completely for you, because it is customary to not spoil other programmers the experience of doing their own homework, doing research etc. If you have something that you have a problem with, then ask specific questions and demonstrate some effort on your side first.

Using Python to output a category-based graph

I'm looking to create a survey program in Python that outputs the results of a series of questions into a few broad categories. As an example, I'm looking for something specifically along the lines of:
The idea is that the survey will give you a score between 3 and -3 and you lean towards one category or the other, depending on whether you scored positively or negatively.
Now, my idea is to manually use PIL to:
Iterate through appropriate category names and draw them
Draw the associated lines
Draw the rectangles according to score.
Also, it's worth mentioning that I'm trying to keep this as flexible as possible; we might add or remove categories at a later stage and I'd like to keep it so it would take minimal programming effort to do (as I likely will not be the one maintaining this in the future).
I suppose what my question would be is... does anyone know of any packages that might do this nicely? Or perhaps have any other suggestions or ideas? I didn't see anything suitable off of matplotlib. Admittedly, however, my expertise in graphing with Python is not extensive by any means!
Thanks for any ideas you might have!

Python graph like windirstat?

I'm interested in using python to make diagrams representing the size of values based on the size of squares (and optionally their colour). Basically I'm looking for a way to make overviews of a bunch of values like the good old program windirstat does with hard-drive usage (it basically makes a big square representing your harddrive and then smaller squares making up the area inside of it representing different programs, the bigger the square the larger the file, colour indicates the type of file). I'm fairly familiar with matplotlib, and I don't think it's possible to do something like this with it. Is there any other python package that would help? Any suggestions for something more low level if it's not? I guess I could do it manually if I could find a way to draw the boxes programatically (I don't really care about the format, but the option to export SVG as well as PNG would be nice).
Ultimately, it would be nice to have it be interactive like windirstat is, where if you were to hover over a particular square you get more information on it, and if you clicked on it maybe you'd go in and see the makeup of that particular square. I'm only familiar with wxpython for GUI stuff, not sure if it could be used for something like this. For now I'd be happy with just outputting them though.
Thanks a lot!
Alex
Edit:
Thanks guys, both your answers helped a lot.
You're looking for Treemapping algorithms. Once implemented, you can transform the output (which should be rectangles) into plotting commands to anything that can draw layered rectangles.
Edit:
More links and information:
If you don't mind reading papers, the browser-based d3 library provides for 'squarified' treemaps (js implementation). They reference this paper by Bruls, Huizing, and van Wijk. (This is also citation 3 on the wikipedia article)
I'd search on the algorithms listed on the linked Wikipedia article. For instance, they also link to this article, which describes an algorithm for "mixed treemaps". The paper also includes some interesting portions at the end describing transformations into other-than-rectangular shapes.
Squarified certainly appears to be the most common variety around. The above links should give you enough to work towards a solution or, even, directly port the d3 implementation. However, the cost of grokking d3's model (which is something like a declarative form of jQuery) may be somewhat high. At first glance, though, the implementation appears relatively straightforward.
Squaremap does this. I haven't used it (I only know it from RunSnakeRun) and its documentation is severely lacking, but it seems to work.

Categories