Skip to content

Commit ffb8a36

Browse files
authored
Merge pull request #166 from transientskp/Fix_165
Fix spurious Numba error
2 parents 590ae60 + f688135 commit ffb8a36

1 file changed

Lines changed: 29 additions & 28 deletions

File tree

sourcefinder/extract.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from .config import Conf, ImgConf
1919
from .gaussian import gaussian
2020

21-
np.seterr(divide="raise", invalid="raise")
21+
np.seterr(divide="raise", over="raise", invalid="raise")
2222

2323
try:
2424
import ndimage
@@ -2308,33 +2308,34 @@ def source_measurements_vectorised(
23082308
# So we will add a dummy array with shape corresponding
23092309
# to the output array (moments_of_sources), as (useless) input
23102310
# array. In this way Numba can infer the shape of the output array.
2311-
measuring.moments_enhanced(
2312-
sources,
2313-
noises,
2314-
chunk_positions,
2315-
xpositions,
2316-
ypositions,
2317-
minimum_widths,
2318-
npixs,
2319-
thresholds,
2320-
local_noise_levels,
2321-
maxposs,
2322-
maxis,
2323-
fudge_max_pix_factor,
2324-
np.array(beam),
2325-
beamsize,
2326-
conf.image.force_beam,
2327-
np.array(correlation_lengths),
2328-
conf.image.clean_bias_error,
2329-
conf.image.frac_flux_cal_error,
2330-
Gaussian_islands,
2331-
Gaussian_residuals,
2332-
dummy,
2333-
moments_of_sources,
2334-
sig,
2335-
chisq,
2336-
reduced_chisq,
2337-
)
2311+
with np.errstate(invalid="ignore"):
2312+
measuring.moments_enhanced(
2313+
sources,
2314+
noises,
2315+
chunk_positions,
2316+
xpositions,
2317+
ypositions,
2318+
minimum_widths,
2319+
npixs,
2320+
thresholds,
2321+
local_noise_levels,
2322+
maxposs,
2323+
maxis,
2324+
fudge_max_pix_factor,
2325+
np.array(beam),
2326+
beamsize,
2327+
conf.image.force_beam,
2328+
np.array(correlation_lengths),
2329+
conf.image.clean_bias_error,
2330+
conf.image.frac_flux_cal_error,
2331+
Gaussian_islands,
2332+
Gaussian_residuals,
2333+
dummy,
2334+
moments_of_sources,
2335+
sig,
2336+
chisq,
2337+
reduced_chisq,
2338+
)
23382339

23392340
barycentric_pixel_positions = moments_of_sources[:, 0, 2:4]
23402341
# Convert the barycentric positions to celestial_coordinates.

0 commit comments

Comments
 (0)