jkrogager / VoigtFit

Python code to fit absorption lines semi-interactively
http://voigtfit.readthedocs.io/
MIT License
28 stars 12 forks source link

Non-integer indexing #30

Closed jamienoss closed 4 years ago

jamienoss commented 4 years ago

Hi,

The following code is a bug https://github.com/jkrogager/VoigtFit/blob/master/VoigtFit/regions.py#L228:

...
i0 = self.kernel.shape[0]/self.kernel_nsub/2
...

This needs to be an int, so you either need to round and cast, just cast, or use integer division - I'm not sure which as I don't know what this is doing and thus whether it matters. E.g., i0 = self.kernel.shape[0]//self.kernel_nsub//2

jkrogager commented 4 years ago

Hi,

Thanks a lot for catching that. I'm still getting used to Python 3 and I see that some issues escaped my 2 to 3 conversion. It should indeed be integer division for both.

Cheers, JK

James Noss wrote on 07/05/2020 21.10:

Hi,

The following code is a bug https://github.com/jkrogager/VoigtFit/blob/master/VoigtFit/regions.py#L228:

... i0= self.kernel.shape[0]/self.kernel_nsub/2 ...

This needs to be an |int|, so you either need to round and cast, just cast, or use integer division - I'm not sure which as I don't know what this is doing and thus whether it matters. E.g., |i0 = self.kernel.shape[0]//self.kernel_nsub//2|

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jkrogager/VoigtFit/issues/30, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRH6CIEMRECUZS756WY7JDRQMBQTANCNFSM4M3SVLCA.