Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimizealpha does not converge for alphas >= 4 #18

Open
Dapid opened this issue Nov 25, 2020 · 1 comment
Open

optimizealpha does not converge for alphas >= 4 #18

Dapid opened this issue Nov 25, 2020 · 1 comment

Comments

@Dapid
Copy link

Dapid commented Nov 25, 2020

  • Alpha Shape Toolbox version: 1.1
  • Python version: 3.7
  • Operating System: Fedora 32

Description

optimizealpha fails when the optimal alpha is a bit big. In my particular case, upper and lower values are:

lower = 4.5 
upper = np.nextafter(lower, 9)
print((upper - lower) > numpy.finfo(float).eps * 2 )         
True                                                                                                                           

The middle point is identical to lower, so the model never converges below the threshold.

Solutions:

I see two ways of solving the problem:

  • Compute the right eps for the current value range: 2 * np.finfo(float).eps * lower, or more accurately, np.finfo(float).eps * 2 ** math.floor(1 + math.log2(lower)) ,
  • Allow the user to specify their own threshold.

The first case is better suited to the current code, but getting alpha to within machine precision may not always be necessary.

@jazzathoth
Copy link

I am having similar trouble with latitude longitude data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants