Skip to content

Make rmsimage.__call__ >2x faster if adaptive_rms_box = True - #568

Closed
AlexKurek wants to merge 2 commits into
lofar-astron:masterfrom
AlexKurek:Make-rmsimage-call-2x-faster
Closed

AlexKurek wants to merge 2 commits into
lofar-astron:masterfrom
AlexKurek:Make-rmsimage-call-2x-faster

Conversation

@AlexKurek

@AlexKurek AlexKurek commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Every 10-sigma island is matched against the bright-source peaks by locating its peak (np.nanargmax) and computing np.hypot against each bright peak. Although almost all islands are far from any bright source.

Fix

  • Store bright-source peaks once in bright_xy
  • Skip an island early if no bright peak lies within peak_match_tol pixels of its bounding box
  • Compute distances with one np.hypot
  • Name the 2.5 px tolerance peak_match_tol

Before:

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        5  253.784   50.757  446.185   89.237 /home/akurek/miniconda3/envs/pybdsf_3_15/lib/python3.15/site-packages/bdsf/rmsimage.py:134(__call__)

After:

        5   28.082    5.616  210.888   42.178 /home/akurek/miniconda3/envs/pybdsf_3_15/lib/python3.15/site-packages/bdsf/rmsimage.py:134(__call__)

The whole PyBDSF run should be ~10% faster.

@AlexKurek AlexKurek changed the title Make rmsimage __call__ ~2x faster is adaptive_rms_box=True Make rmsimage __call__ >2x faster is adaptive_rms_box=True Nov 7, 2026
@AlexKurek AlexKurek changed the title Make rmsimage __call__ >2x faster is adaptive_rms_box=True Make rmsimage.__call__ >2x faster if adaptive_rms_box = True Nov 7, 2026
@AlexKurek

Copy link
Copy Markdown
Contributor Author

Im sorry, this will influence the results of wavelets. Closing.

@AlexKurek AlexKurek closed this Nov 10, 2026
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

Successfully merging this pull request may close these issues.

1 participant