BlueBrain / morph-tool

https://morph-tool.readthedocs.org/
GNU Lesser General Public License v3.0
8 stars 7 forks source link

Fix resampling duplicate point because of numerical imprecision #58

Closed eleftherioszisis closed 3 years ago

eleftherioszisis commented 3 years ago

@arnaudon encountered an issue when resampling neuronal morphologies where the two last resampled points were identical.

This was due to the numerical imprecision of the cumulative values in np.arange(dl, total_length, dl). In some cases, due to the numerical error of the summation, the value total_length was returned at the end of the array.

To fix this the arrange is converted to np.arange(1, n_segments) * dl to avoid such errors and ensure that the correct size is always created.

arnaudon commented 3 years ago

@asanin-epfl , could you help merging this? Thanks!