Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Alec Hammond committed Dec 15, 2023
1 parent a8b221e commit 16702c5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/adjoint/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ def gray_indicator(x):
"""
return npa.mean(4 * x.flatten() * (1 - x.flatten())) * 100


def hybrid_levelset(
x: ArrayLikeType,
beta: float,
Expand Down Expand Up @@ -1147,7 +1148,7 @@ def hybrid_levelset(
periodic. Default is None (all axes are non-periodic).
Returns:
The projected and smoothed output.
Example:
>>> Lx = 2
>>> Ly = 2
Expand Down Expand Up @@ -1196,7 +1197,8 @@ def hybrid_levelset(
# with array-based AD tracers, apparently. See here:
# https://github.com/google/jax/issues/1052#issuecomment-5140833520
fill_factor = npa.where(
(d <= pixel_radius) & (npa.abs(d / pixel_radius) <= 1), # domain of arccos() and sqrt()
(d <= pixel_radius)
& (npa.abs(d / pixel_radius) <= 1), # domain of arccos() and sqrt()
(1 / (npa.pi * pixel_radius**2))
* (
pixel_radius**2
Expand Down Expand Up @@ -1242,4 +1244,4 @@ def hybrid_levelset(
npa.abs(d) > pixel_radius,
x_projected,
(1 - fill_factor) * x_minus_eff + (fill_factor) * x_plus_eff,
)
)

0 comments on commit 16702c5

Please sign in to comment.