Skip to content

Commit

Permalink
fix box gradients < 3d
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflex committed Jul 4, 2024
1 parent a85eb02 commit 0b875ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Errors in `PolySlab` when using autograd differentiation with non-zero `sidewall_angle` and `dilation`.
- Error in `EMESimulationData.smatrix_in_basis` when using older versions of xarray.
- Support for automatic differentiation with respect to `.eps_inf` and `.poles` contained in dispersive mediums `td.PoleResidue` and `td.CustomPoleResidue`.
- Gradients for `Box` objects when simulation size is < 3D.

## [2.7.0] - 2024-06-17

Expand Down
4 changes: 3 additions & 1 deletion tidy3d/components/autograd/derivative_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def integrate_within_bounds(arr: xr.DataArray, dims: list[str], bounds: Bound) -

# uses trapezoidal rule
# https://docs.xarray.dev/en/stable/generated/xarray.DataArray.integrate.html
return _arr.integrate(coord=dims)

dims_integrate = [dim for dim in dims if len(_arr.coords[dim]) > 1]
return _arr.integrate(coord=dims_integrate)


__all__ = [
Expand Down

0 comments on commit 0b875ae

Please sign in to comment.