-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
SkyCoord slow to import #5222
Comments
@sdjohnson-astro Which version of astropy do you use? The import time was sped up for astropy 1.2 but it's still not as fast as numpy/scipy. See also #4598. |
I am using Astropy version 1.2.1 Thanks for the super fast reply! |
Like @MSeifert04 said, there is already a related issue like this. What if you simply do |
|
If you are feeling adventurous, you can profile the offending import statement and post some results here. See https://docs.python.org/3/library/profile.html |
And to make sure that this is not already solved since the release, you can also try the |
@sdjohnson-astro - can you test |
Just for convenience these import times can be tested from the command line with |
Interesting. Using the latest |
@astrofrog , |
Thanks for the tip. @astrofrog importing astropy.units takes 0.8 seconds on my laptop. I don't know enough about astropy to make much of the profiling results at first glance. The profile results are attached if anyone wants to take a look. I will try out the latest |
@pllim The first time python encounteres new |
@sdjohnson-astro , thanks for the log. But it is hard to diagnose without full path to the filenames, and would be nice to sort them by |
@pllim A version sorted by cumulative time is attached. I am not sure how to get the full path to filenames with cProfile. Is there an option in the documentation that I am missing? Thanks! |
Thanks, @sdjohnson-astro . I think the listed filenames are unique enough that we don't need the full path. From your log:
Maybe @eteq or @taldcroft wish to chime in? |
@pllim Importing |
@sdjohnson-astro , thanks for checking! I see |
I ran the following with the current python -X importtime -c "from astropy.coordinates import SkyCoord"
python -X importtime -c "import numpy" The difference in the reported times was roughly a factor of 3, much less than the more than an order of magnitude difference reported in this issue. I haven't bothered looking up any commits that might have contributed towards faster importing, but it does seem like this issue is no longer relevant. |
This is a blast from the past! Yes, my understanding is that a decent amount of effort went into speeding things up under the hood some time ago.
…-----------------------------------
Sean D. Johnson (he/him)
Assistant Professor & LSA Collegiate Fellow
Department of Astronomy
University of Michigan
***@***.***
On Nov 15, 2022, at 6:07 PM, Eero Vaher ***@***.***> wrote:
I ran the following with the current astropy development version (0e379d8 <0e379d8>):
python -X importtime -c "from astropy.coordinates import SkyCoord"
python -X importtime -c "import numpy"
The difference in the reported times was roughly a factor of 3, much less than the more than an order of magnitude difference reported in this issue. I haven't bothered looking up any commits that might have contributed towards faster importing, but it does seem like this issue is no longer relevant.
—
Reply to this email directly, view it on GitHub <#5222 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AE7MYXOARGQZNDUM5PQROHLWIQJRRANCNFSM4CL2K7OQ>.
You are receiving this because you were mentioned.
|
Hi humans 👋 - this issue was labeled as Close? approximately 6 hours ago. If you think this issue should not be closed, a maintainer should remove the Close? label - otherwise, I will close this issue in 7 days. If you believe I commented on this issue incorrectly, please report this here |
I'm going to close this issue as per my previous message, but if you feel that this issue should stay open, then feel free to re-open and remove the Close? label. If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here |
I recently wrote a few command line tools for converting coordinates but found that they are noticeably slow to run. The runtime is dominated by importing SkyCoord from astropy.coordinates which takes nearly 2 seconds (for reference, this is a new installation of astroconda running on my MacBook Pro retina w/ 2.7 GHz i7 processor, 16 GB of ram, and an SSD). For comparison, imports from standard libraries such as numpy or UnivariateSpline from scipy.interpolate takes ~0.15 seconds. Is there any way to speed up the import of SkyCoord?
The text was updated successfully, but these errors were encountered: