Skip to content
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

Reproject.jl slower than Astropy's reproject #16

Closed
jmbhughes opened this issue Sep 26, 2024 · 3 comments
Closed

Reproject.jl slower than Astropy's reproject #16

jmbhughes opened this issue Sep 26, 2024 · 3 comments

Comments

@jmbhughes
Copy link
Contributor

Hi!

I noticed the Julia implementation was slower than the Python implementation. I was curious if you had any insight as to why this might be.

The following Julia code takes 38 seconds to run on my laptop:

using Reproject, FITSIO
using Dates

start = now()
input_data = FITS("gc_msx_e.fits")
output_projection = FITS("gc_2mass_k.fits")

for i in 1:10
    result = reproject(input_data, output_projection, shape_out = (1000,1000), order = 2, hdu_in = 1, hdu_out = 1)
end

stop = now()

println(stop - start)

The equivalent Python code takes 3 seconds:

import reproject
from astropy.io import fits
from astropy.wcs import WCS
import time

start = time.time()
input_data = fits.open("gc_msx_e.fits")
output_data = fits.open("gc_2mass_k.fits")
output_projection = WCS(output_data[0].header)

for _ in range(10):
    result = reproject.reproject_interp(input_data, output_projection, shape_out = (1000, 1000), 
                                        hdu_in=0, order='biquadratic')
stop = time.time()

print(stop - start)

I'm very new to Julia so I'm trying to learn and may be missing something obvious. Thanks!

@giordano
Copy link
Member

To set expectations clear, this package hasn't got much love lately, and while it was initially created for AstroImages.jl, that package doesn't use Reproject.jl anymore, so it's unlikely it'll get much more attention or further improvements.

@jmbhughes
Copy link
Contributor Author

Okay thanks for letting me know.

@giordano
Copy link
Member

giordano commented Sep 27, 2024

Sorry, I forgot to add a couple of comments more:

  • if you have concrete improvements, like Fixes typos and dead link #15, they may still be accepted, just don't expect others to resolve open issues
  • to answer your question about why this code is much slower than the corresponding python code, it has been a long time since I last looked at this code, but it was probably not particularly optimised for performance, so extra memory allocations or type-instabilities may be around. Per the point above, if anyone is willing to fix those, they're more than welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants