DOC: avoid iteration for light travel time of lots of objects
See original GitHub issueIn our user survey, @stargaser mentioned they had issues at ZTF when calculating light travel times for tens of thousands of sources in a degree patch of the sky. It might be worth a section in the performance area of the Time
documentation comparing run times of the following approaches:
import numpy as np
import astropy.coordinates as coord
import astropy.units as u
from astropy.time import Time
ra = np.random.normal(0.0, 1.0, 50000)
dec = np.random.normal(0.0, 1.0, 50000)
coos = coord.SkyCoord(ra, dec, unit=u.deg)
observatory = coord.EarthLocation.of_site('lapalma')
%time time.light_travel_time(coos, location=observatory)
CPU times: user 56 ms, sys: 3.21 ms, total: 59.2 ms
Wall time: 58.2 ms
<TimeDelta object: scale='tdb' format='jd' value=[ 0.00497521 0.00495056 0.00497048 ..., 0.00499594 0.0049838
0.00502038]>
%time ltts = [time.light_travel_time(coo, location=coos.location) for coo in coos]
CPU times: user 16min 45s, sys: 5.08 s, total: 16min 50s
Wall time: 16min 58s
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Time travel is possible – but only if you have an object with ...
Time travel is possible – but only if you have an object with infinite mass. The concept of time travel has always captured...
Read more >How to iterate over a JavaScript object? - Stack Overflow
I want to use a for loop to get its properties. And I want to iterate it in parts (not all object properties...
Read more >Light travel time toward and away from a massive object
Gravitation is caused by diffrence in time frames plus curved space due to the distance between the 2 masses (in this case between...
Read more >If we travel at the speed of light, does time stop? What ... - Quora
First of all, an object with some mass can never reach the speed of light as it's inertial mass will keep increasing and...
Read more >for...in - JavaScript | MDN - MDN Web Docs
Description. The loop will iterate over all enumerable properties of the object itself and those the object inherits from its prototype chain ( ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Gotcha, ok thanks!
I think it is still open, as @SG004’s PR #8461 dealing with the issue has been closed by a bot.