Skip to content

Commit ecf2fd6

Browse files
committed
Do not raise DeprecationWarning on calling DataArray.values during automatic differentiation
1 parent 5452e3f commit ecf2fd6

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515
- `CustomMedium` design regions require far less data when performing inverse design by reducing adjoint field monitor size for dims with one pixel.
16+
- Calling `.values` on `DataArray` no longer raises a `DeprecationWarning` during automatic differentiation
1617

1718
### Fixed
1819
- Regression in local field projection leading to incorrect results for `far_field_approx=True`.

tidy3d/components/data/data_array.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import annotations
44

5-
import warnings
65
from abc import ABC
76
from typing import Any, Dict, List, Mapping, Union
87

@@ -220,15 +219,7 @@ def values(self):
220219
np.ndarray
221220
The values of the DataArray.
222221
"""
223-
if isbox(self.data):
224-
warnings.warn(
225-
"'DataArray.values' for automatic differentiation is deprecated, "
226-
"please use 'DataArray.data' instead.",
227-
DeprecationWarning,
228-
stacklevel=2,
229-
)
230-
return self.data
231-
return super().values
222+
return self.data if isbox(self.data) else super().values
232223

233224
@values.setter
234225
def values(self, value: Any) -> None:

0 commit comments

Comments
 (0)