I noticed when running some verification tests on #76, that if you call the scale method on a spectrum with a number of events that is not a float, there is a chance all _data can be set to zero e.g.:
as you can see all become zero as python is doing integer division, where num_decays is much less than self._num_decays. But if I cast num_decays as a float, all goes as expected:
The solution should be quite simple, either we cast num_decays as a float (as above) or raise a TypeError if you supply a value for num_decays that is not of float type.
I noticed when running some verification tests on #76, that if you call the
scale
method on a spectrum with a number of events that is not a float, there is a chance all_data
can be set to zero e.g.:yields:
Debugging the code, within the
scale
method:as you can see all become zero as python is doing integer division, where
num_decays
is much less thanself._num_decays
. But if I castnum_decays
as a float, all goes as expected:The solution should be quite simple, either we cast
num_decays
as a float (as above) or raise aTypeError
if you supply a value fornum_decays
that is not of float type.