Skip to content

Commit

Permalink
Resolve overflow error. Fixes ratt-ru#96
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolteno committed Dec 16, 2024
1 parent 76e53cc commit 0b967b9
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions tricolour/flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -1170,13 +1170,7 @@ def sum_threshold_flagger(vis, flags, outlier_nsigma=4.5,
freq_chunks = freq_chunks
average_freq = _as_min_dtype(average_freq)

# BUG the following code is a terrible idea if nchan is on a dtype size boundary because adding
# anything to this will wrap. e.g.
# >>> x = np.array(255, np.uint8)
# >>> y = np.array(1, np.uint8)
# >>> x + y
# 0
# >>>
# Casting to int fixes an overflow error...
averaged_channels = (int(nchan) + int(average_freq) - 1) // int(average_freq)

# Set up frequency chunks
Expand Down

0 comments on commit 0b967b9

Please sign in to comment.