Skip to content

Validating that bend_radius is strictly larger than half the mode plane size #2371

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

Closed
wants to merge 1 commit into from

Conversation

momchil-flex
Copy link
Collaborator

The case when the two are equal could actually be particularly problematic as the bend center lies on a grid point, which is a singularity in our coordinate transformation.

So maybe I should even leave a bit of buffer extra?

@weiliangjin2021
Copy link
Collaborator

as for extra buffer, you mean
np.abs(mode_spec.bend_radius) <= plane.size[radial_ax] / 2 * (1-FP_EPS)

weiliangjin2021
weiliangjin2021 previously approved these changes Apr 9, 2025
@momchil-flex
Copy link
Collaborator Author

Yeah something like that, I'm also wondering if it should even be larger than FP_EPS though. Basically in the trasnform here, the jacobian has a division by zero if the radius lies on a grid coordinate (either primal or dual). So to avoid some very large values, might be better to require it to be even a bit further away.

@weiliangjin2021
Copy link
Collaborator

The safest is probably to use those np.nextafter (e.g. in this function

def increment_float(val: float, sign) -> float:
"""Applies a small positive or negative shift as though `val` is a 32bit float
using numpy.nextafter, but additionally handles some corner cases.
"""
from @dmarek-flex )

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

Successfully merging this pull request may close these issues.

2 participants