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.)
Related
So I'm experimenting with some different techniques to find where a curve rises and falls.The elbow and knee points as I think they are called.
The plot looks like below and has multiple rises and falls:
Now the current method I have it using scipy to find the most prominent troughs:
df['smooth'] = df['xy'].rolling(120).mean()
troughs = find_peaks(-df['smooth'], distance=240, prominence=1)[0]
This works well for most cases, as shown here:
However, it's not perfect and sometimes the start/stop points are not close enough to the desired point (the purple point is 40 seconds behind where it should be), and this is causing me problems:
Some more context: These graphs can look very different from each other, some have steady baselines over time, and others have rising / falling baselines over time. I've tried some knee/elbow packages to no avail.
Is there a better way to do this? To a human its very obvious where each of these curves begins to rise and gets back to a baseline. Hopefully there is some sort of mathematical expression which can be used.
Would appreciate any direction / tips to try out thanks!
Naively we could just look for moments in the curve where the derivative goes from positive to negative or from negative to positive but then the slightest change in direction would trigger a peak detection. So the problem is actually not that trivial and that is why functions such as 'find_peaks' exist in Scipy.
I would thus recommend you to play around with the different parameters until you get something that satisfies you. You can look up their definitions and explanations on the docs of the 'find_peaks' function.
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.
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.
maybe somebody knows something, since I am not able to find anything that makes sense to me.
I have a dataset positions (lon, lat) and I want to snap them to the nearest road and calculate the distance between them.
So far I discovered OSM, however I can't find a working example on how to use the API using python.
If any of you could help, I am thankful for ever little detail.
Will try to find it out by myself in the meantime and publish the answer if successful (couldn't find any similar question so maybe it will help someone in the future)
Welcome! OSM is a wonderful resource, but is essentially a raw dataset that you have to download and do your own processing on. There are a number of ways to do this, if you need a relatively small extract of the data (as opposed to the full planet file) the Overpass API is the place to look. Overpass turbo (docs) is a useful tool to help with this API.
Once you have the road network data you need, you can use a library like Shapely to snap your points to the road network geometry, and then either calculate the distance between them (if you need "as the crow flies" distance), or split the road geometry by the snapped points and calculate the length of the line. If you need real-world distance that takes the curvature of the earth into consideration (as opposed to the distance as it appears on a projected map), you can use something like Geopy.
You may also want to look into the Map Matching API from Mapbox (full disclosure, I work there), which takes a set of coordinates, snaps them to the road network, and returns the snapped geometry as well as information about the route, including distance.
You might use KDTree of sklearn for this. You fill an array with coordinates of candidate roads (I downloaded this from openstreetmap). Then use KDTree to make a tree of this array. Finally, use KDTree.query(your_point, k=1) to get the nearest point of the tree (which is the nearest node of the coordinate roads). Since searching the tree is very fast (essentially log(N) for N points that form the tree), you can query lots of points.
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!