Skip to content

Commit

Permalink
Fix TypeError: No loop matching the specified signature and casting w…
Browse files Browse the repository at this point in the history
…as found for ufunc true_divide

This error happens when sx is an integer array. The output array in y_fit /= sx_peak_flux is an integer array, but np.divide computes a float.
  • Loading branch information
nicocardiel committed Feb 19, 2021
1 parent dc9902e commit 70cc429
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion numina/array/wavecalib/peaks_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def refine_peaks_spectrum(sx, ixpeaks, nwinwidth, method=None,
# it is important to create a copy in the next instruction in
# order to avoid modifying the original array when normalizing
# the data to be fitted
y_fit = np.copy(sx[j1:j2])
y_fit = np.copy(sx[j1:j2].astype(float))
sx_peak_flux = y_fit.max()
if sx_peak_flux != 0:
y_fit /= sx_peak_flux # normalize to maximum value
Expand Down

0 comments on commit 70cc429

Please sign in to comment.