You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regarding "Trigonometry and bitwise identity" in the comments: I tried without this and there were numerical differences at 4. decimal place and beyond.
The reason will be displayed to describe this comment to others. Learn more.
Looks good, though it's unclear to me how much speed improvement this will give for the whole (not just this function). Maybe @darafferty would like to double check?
These are the results from cProfile, so: ncalls tottime percall cumtime percall filename:lineno(function)
21.837 - 9.663 = ~12 seconds for 1.5 GB FITS file on Xeon 6238R CPU. This is not much, but I assume that much larger files are being processed in surveys etc.
...let me explain a bit more on this. ncalls shows, that this function is called 400k times, so vectorising the calls could be beneficial. However, this only makes sense when the function itself has been optimised as much as possible. Therefore, optimising a helper function can open the way to optimising the function that calls it. tottime shows how much time is spent withing the function, not including numpy, scipy etc. cumtime shows a total time the function takes in a PyBDSF run.
You can also use line_profiler (output in attachemnt): import line_profiler
decorator for the function you want to profile: @line_profiler.profile
Run: LINE_PROFILE=1 python run_pybdsf.py
See output: python -m line_profiler -rtmz profile_output.lprof
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For 1.5 GB FITS the function is >2x faster.
before:
400452 2.451 0.000 21.837 0.000 /home/akurek/miniconda3/envs/pybdsf_3_14/lib/python3.14/site-packages/bdsf/readimage.py:585(pixdist2angdist)after:
400452 2.103 0.000 9.663 0.000 /home/akurek/miniconda3/envs/pybdsf_3_14/lib/python3.14/site-packages/bdsf/readimage.py:585(pixdist2angdist).gaul files are identical.
Regarding "Trigonometry and bitwise identity" in the comments: I tried without this and there were numerical differences at 4. decimal place and beyond.