Skip to content

Commit a9004b8

Browse files
authored
Merge pull request flexcompute#1170 from flexcompute/pre/2.5
2.5 branch
2 parents f60bf47 + 46ecef4 commit a9004b8

File tree

163 files changed

+23220
-17119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+23220
-17119
lines changed

.github/workflows/run_tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ jobs:
1515
runs-on: ${{ matrix.platform }}
1616
strategy:
1717
matrix:
18-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
18+
python-version: ['3.8', '3.9', '3.10', '3.11']
1919
platform: [ubuntu-latest, macos-latest, windows-latest]
20-
exclude:
21-
- platform: macos-latest
22-
python-version: '3.7'
2320
steps:
2421
- uses: actions/checkout@v1
2522
- name: Set up Python ${{ matrix.python-version }}

CHANGELOG.md

Lines changed: 80 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,74 @@ All notable changes to this project will be documented in this file.
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6-
76
## [Unreleased]
87

8+
## [2.5.0] - 2023-12-13
9+
10+
### Added
11+
- Ability to mix regular mediums and geometries with differentiable analogues in `JaxStructure`. Enables support for shape optimization with dispersive mediums. New classes `JaxStructureStaticGeometry` and `JaxStructureStaticMedium` accept regular `Tidy3D` geometry and medium classes, respectively.
12+
- Warning if nonlinear mediums are used in an `adjoint` simulation. In this case, the gradients will not be accurate, but may be approximately correct if the nonlinearity is weak.
13+
- Validator for surface field projection monitors that warns if projecting backwards relative to the monitor's normal direction.
14+
- Validator for field projection monitors when far field approximation is enabled but the projection distance is small relative to the near field domain.
15+
- Ability to manually specify a medium through which to project fields, when using field projection monitors.
16+
- Added support for two-photon absorption via `TwoPhotonAbsorption` class. Added `KerrNonlinearity` that implements Kerr effect without third-harmonic generation.
17+
- Can create `PoleResidue` from LO-TO form via `PoleResidue.from_lo_to`.
18+
- Added `TriangularGridDataset` and `TehrahedralGridDataset` for storing and manipulating unstructured data.
19+
- Support for an anisotropic medium containing PEC components.
20+
- `SimulationData.mnt_data_from_file()` method to load only a single monitor data object from a simulation data `.hdf5` file.
21+
- `_hash_self` to base model, uses `hashlib` to hash a Tidy3D component the same way every session.
22+
- `ComponentModeler.plot_sim_eps()` method to plot the simulation permittivity and ports.
23+
- Support for 2D PEC materials.
24+
- Ability to downsample recorded near fields to speed up server-side far field projections.
25+
- `FieldData.apply_phase(phase)` to multiply field data by a phase.
26+
- Optional `phase` argument to `SimulationData.plot_field` that applies a phase to complex-valued fields.
27+
- Ability to window near fields for spatial filtering of far fields for both client- and server-side field projections.
28+
- Support for multiple frequencies in `output_monitors` in `adjoint` plugin.
29+
- GDSII export functions `to_gds_file`, `to_gds`, `to_gdspy`, and `to_gdstk` to `Simulation`, `Structure`, and `Geometry`.
30+
- `verbose` argument to `estimate_cost` and `real_cost` functions such that the cost is logged if `verbose==True` (default). Additional helpful messages may also be logged.
31+
- Support for space-time modulation of permittivity and electric conductivity via `ModulationSpec` class. The modulation function must be separable in space and time. Modulations with user-supplied distributions in space and harmonic modulation in time are supported.
32+
- `Geometry.intersections_tilted_plane` calculates intersections with any plane, not only axis-aligned ones.
33+
- `Transformed` class to support geometry transformations.
34+
- Methods `Geometry.translated`, `Geometry.scaled`, and `Geometry.rotated` can be used to create transformed copies of any geometry.
35+
- Time zone in webAPI logging output.
36+
- Class `Scene` consisting of a background medium and structures for easier drafting and visualization of simulation setups as well as transferring such information between different simulations.
37+
- Solver for thermal simulation (see `HeatSimulation` and related classes).
38+
- Specification of material thermal properties in medium classes through an optional field `.heat_spec`.
39+
40+
### Changed
41+
- Credit cost for remote mode solver has been modified to be defined in advance based on the mode solver details. Previously, the cost was based on elapsed runtime. On average, there should be little difference in the cost.
42+
- Mode solves that are part of an FDTD simulation (i.e. for mode sources and monitors) are now charged at the same flex credit cost as a corresponding standalone mode solver call.
43+
- Any `FreqMonitor.freqs` or `Source.source_time.freq0` smaller than `1e5` now raise an error as this must be incorrect setup that is outside the Tidy3D intended range (note default frequency is `Hz`).
44+
- When using complex fields (e.g. with Bloch boundaries), FluxTimeMonitor and frequency-domain fields (including derived quantities like flux) now only use the real part of the time-domain electric field.
45+
- Indent for the json string of Tidy3D models has been changed to `None` when used internally; kept as `indent=4` for writing to `json` and `yaml` files.
46+
- API for specifying one or more nonlinear models via `NonlinearSpec.models`.
47+
- `freqs` and `direction` are optional in `ModeSolver` methods converting to monitor and source, respectively. If not supplied, uses the values from the `ModeSolver` instance calling the method.
48+
- Removed spurious ``-1`` factor in field amplitudes injected by field sources in some cases. The injected ``E``-field should now exactly match the analytic, mode, or custom fields that the source is expected to inject, both in the forward and in the backward direction.
49+
- Restriction on the maximum memory that a monitor would need internally during the solver run, even if the final monitor data is smaller.
50+
- Restriction on the maximum size of mode solver data produced by a `ModeSolver` server call.
51+
- Updated versions of `boto3`, `requests`, and `click`.
52+
- python 3.7 no longer tested nor supported.
53+
- Removed warning that monitors now have `colocate=True` by default.
54+
- If `PML` or any absorbing boundary condition is used along a direction where the `Simulation` size is zero, an error will be raised, rather than just a warning.
55+
- Remove warning that monitors now have `colocate=True` by default.
56+
- Internal refactor of Web API functionality.
57+
- `Geometry.from_gds` doesn't create unnecessary groups of single elements.
58+
59+
### Fixed
60+
- Fixed energy leakage in TFSF when using complex fields.
61+
- Fixed the duplication of log messages in Jupyter when `set_logging_file` is used.
62+
- If input to circular filters in adjoint have size smaller than the diameter, instead of erroring, warn user and truncate the filter kernel accordingly.
63+
- When writing the json string of a model to an `hdf5` file, the string is split into chunks if it has more than a set (very large) number of characters. This fixes potential error if the string size is more than 4GB.
64+
- Proper equality checking between `Tidy3dBaseModel` instances, which takes `DataArray` values and coords into account and handles `np.ndarray` types.
65+
- Correctly set the contour length scale when exporting 2D (or 1D) structures with custom medium to GDSII.
66+
- Improved error handling if file can not be downloaded from server.
67+
- Fix for detection of file extensions for file names with dots.
68+
- Restrict to `matplotlib` >= 3.5, avoiding bug in plotting `CustomMedium`.
69+
- Fixes `ComponentModeler` batch file being different in different sessions by use of deterministic hash function for computing batch filename.
70+
- Can pass `kwargs` to `ComponentModeler.plot_sim()` to use in `Simulation.plot()`.
71+
- Ensure that mode solver fields are returned in single precision if `ModeSolver.ModeSpec.precision == "single"`.
72+
- If there are no adjoint sources for a simulation involved in an objective function, make a mock source with zero amplitude and warn user.
73+
974
## [2.4.3] - 2023-10-16
1075

1176
### Added
@@ -58,7 +123,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
58123
- Bug in adjoint plugin when `JaxBox` is less than 1 grid cell thick.
59124
- Bug in `adjoint` plugin where `JaxSimulation.structures` did not accept structures containing `td.PolySlab`.
60125

61-
62126
## [2.4.0] - 2023-9-11
63127

64128
### Added
@@ -71,7 +135,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
71135
Specifically, non-dispersive and dispersive mediums with heat and/or charge perturbation models can be defined through classes `PerturbationMedium` and `PerturbationPoleResidue`,
72136
where perturbations to each parameter is specified using class `ParameterPerturbation`.
73137
A convenience function `Simulation.perturbed_mediums_copy` is added to class `Simulation` which applies heat and/or charge fields to mediums containing perturbation models.
74-
- Added `hlim` and `vlim` kwargs to `Simulation.plot()` and `Simulation.plot_eps()` for setting horizontal and veritcal plot limits.
138+
- Added `hlim` and `vlim` kwargs to `Simulation.plot()` and `Simulation.plot_eps()` for setting horizontal and vertical plot limits.
75139
- Added support for chi3 nonlinearity via `NonlinearSusceptibility` class.
76140
- Spatial downsampling allowed in ``PermittivityMonitor`` through the ``interval_space`` argument.
77141
- `ClipOperation` geometry type allows the construction of complex geometries through boolean operations.
@@ -268,7 +332,7 @@ that the fields match exactly except for a ``pi`` phase shift. This interpretati
268332
- `JaxCustomMedium` accepts a maximum of 250,000 grid cells to avoid slow server-side processing.
269333
- `PolySlab.inside` now uses `matplotlib.path.contains_points`.
270334
- `JaxCustomMedium` accepts a maximum of 250,000 grid cells.
271-
- Logging messages are supressed and summarized to avoid repetitions.
335+
- Logging messages are suppressed and summarized to avoid repetitions.
272336

273337
### Fixed
274338
- Log messages provide the correct caller origin (file name and line number).
@@ -367,7 +431,7 @@ that the fields match exactly except for a ``pi`` phase shift. This interpretati
367431
- Validate `slab_bounds` for `PolySlab`.
368432

369433
### Changed
370-
- Tidy3D account authentication done solely through API key. Migration option offered for useres with old username / password authentication.
434+
- Tidy3D account authentication done solely through API key. Migration option offered for users with old username / password authentication.
371435
- `export_matlib_to_file` in `material_library` exports material's full name in addition to abbreviation.
372436
- Simpler progress bars for `run_async`.
373437
- Medium property `n_cfl` added to adjust time step size according to CFL condition.
@@ -509,7 +573,7 @@ method for computing the overlap integral over two sets of frequency-domain fiel
509573

510574
### Changed
511575
- Minimum flex unit charge reduced from `0.1` to `0.025`.
512-
- Default courant factor was changed from `0.9` to `0.99`.
576+
- Default Courant factor was changed from `0.9` to `0.99`.
513577
- A point dipole source placed on a symmetry plane now always has twice the amplitude of the same source in a simulation without the
514578
symmetry plane, as expected by continuity with the case when the dipole is slightly off the symmetry plane, in which case
515579
there are effectively two dipoles, the original one and its mirror image. Previously, the amplitude was only doubled for dipoles polarized normal
@@ -597,7 +661,7 @@ which fields are to be projected is now determined automatically based on the me
597661

598662
### Added
599663
- New classes of near-to-far monitors for server-side computation of the near field to far field projection.
600-
- Option to exlude `DataArray` Fields from a `Tidy3dBaseModel` json.
664+
- Option to exclude `DataArray` Fields from a `Tidy3dBaseModel` json.
601665
- Option to save/load all models to/from `hdf5` format.
602666
- Option to load base models without validation.
603667
- Support negative sidewall angle for slanted `PolySlab`-s.
@@ -607,7 +671,7 @@ which fields are to be projected is now determined automatically based on the me
607671
### Fixed
608672
- Raise a more meaningful error if login failed after `MAX_ATTEMPTS`.
609673
- Environment login credentials set to `""` are now ignored and credentials stored to file are still looked for.
610-
- Improved subpixel coefficients computation around sharp edges, cornes, and three-structure intersections.
674+
- Improved subpixel coefficients computation around sharp edges, corners, and three-structure intersections.
611675

612676
### Changed
613677
- Major refactor of the way data structures are used internally.
@@ -649,7 +713,7 @@ which fields are to be projected is now determined automatically based on the me
649713
## [1.4.1] - 2022-6-13
650714

651715
### Fixed
652-
- Bug in plotting polarization of a nomral incidence source for some `angle_phi`.
716+
- Bug in plotting polarization of a normal incidence source for some `angle_phi`.
653717
- Bloch vector values required to be real rather than complex.
654718
- Web security mitigation.
655719

@@ -664,9 +728,9 @@ which fields are to be projected is now determined automatically based on the me
664728

665729
### Added
666730
- Bloch periodic boundary conditions, enabling modeling of angled plane wave.
667-
- `GeometryGroup` object to associate several `Geometry` intances in a single `Structure` leading to improved performance for many objects.
731+
- `GeometryGroup` object to associate several `Geometry` instances in a single `Structure` leading to improved performance for many objects.
668732
- Ability to uniquely specify boundary conditions on all 6 `Simulation` boundaries.
669-
- Options in field montitors for spatial downsampling and evaluation at yee grid centers.
733+
- Options in field monitors for spatial downsampling and evaluation at Yee grid centers.
670734
- `BatchData.load()` can load the data for a batch directly from a directory.
671735
- Utility for updating `Simulation` objects from old versions of `Tidy3d` to current version.
672736
- Explicit `web.` functions for downloading only `simulation.json` and `tidy3d.log` files.
@@ -676,7 +740,7 @@ which fields are to be projected is now determined automatically based on the me
676740
- Uses `shapely` instead of `gdspy` to merge polygons from a gds cell.
677741
- `ComponentModeler` (S matrix tool) stores the `Batch` rather than the `BatchData`.
678742
- Custom caching of properties to speed up subsequent calculations.
679-
- Tidy3d configuration now done through setting attributes of `tidy3d.config` object.
743+
- Tidy3D configuration now done through setting attributes of `tidy3d.config` object.
680744

681745
## [1.3.3] - 2022-5-18
682746

@@ -711,7 +775,7 @@ which fields are to be projected is now determined automatically based on the me
711775

712776
### Changed
713777

714-
- The `copy()` method of Tidy3d components is deep by default.
778+
- The `copy()` method of Tidy3D components is deep by default.
715779
- Maximum allowed number of distinct materials is now 65530.
716780

717781
### Fixed
@@ -771,7 +835,7 @@ which fields are to be projected is now determined automatically based on the me
771835

772836
- `webapi` functions now only authenticate when needed.
773837
- Credentials storing folder only created when needed.
774-
- Added maximum number of attemtps in authentication.
838+
- Added maximum number of attempts in authentication.
775839
- Made plotly plotting faster.
776840
- Cached Simulation.medium and Simulation.medium_map computation.
777841

@@ -975,7 +1039,8 @@ which fields are to be projected is now determined automatically based on the me
9751039
- Job and Batch classes for better simulation handling (eventually to fully replace webapi functions).
9761040
- A large number of small improvements and bug fixes.
9771041

978-
[Unreleased]: https://github.com/flexcompute/tidy3d/compare/v2.4.3...develop
1042+
[Unreleased]: https://github.com/flexcompute/tidy3d/compare/v2.5.0...develop
1043+
[2.5.0]: https://github.com/flexcompute/tidy3d/compare/v2.4.3...v2.5.0
9791044
[2.4.3]: https://github.com/flexcompute/tidy3d/compare/v2.4.2...v2.4.3
9801045
[2.4.2]: https://github.com/flexcompute/tidy3d/compare/v2.4.1...v2.4.2
9811046
[2.4.1]: https://github.com/flexcompute/tidy3d/compare/v2.4.0...v2.4.1

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ include requirements/gdspy.txt
88
include requirements/gdstk.txt
99
include requirements/dev.txt
1010
include requirements/trimesh.txt
11+
include requirements/vtk.txt
1112
include tidy3d/web/cacert.pem

requirements/basic.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ importlib-metadata>=6.0.0
66
h5netcdf==1.0.2
77
h5py>=3.0.0
88
rich<12.6.0 # note: rich >= 12.6 adds double progressbars
9-
matplotlib
9+
matplotlib>=3.5
1010
shapely>=2.0
1111
pydantic==2.*
1212
PyYAML

requirements/dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
-r gdspy.txt
66
-r jax.txt
77
-r trimesh.txt
8+
-r vtk.txt
89

910
# required for development
1011
pre-commit

requirements/vtk.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# vtk
2+
3+
vtk<=9.2.6
4+

requirements/web.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# to use the web interface (needed to run tasks)
22

3-
boto3==1.23.1
4-
requests
3+
boto3==1.28.*
4+
requests==2.31.*
55
pyjwt
6-
click==8.0.3
6+
click==8.1.*
77
responses

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def read_requirements(req_file: str):
3333
gdstk_required = read_requirements("requirements/gdstk.txt")
3434
gdspy_required = read_requirements("requirements/gdspy.txt")
3535
trimesh_required = read_requirements("requirements/trimesh.txt")
36+
vtk_required = read_requirements("requirements/vtk.txt")
3637
core_required = read_requirements("requirements/core.txt")
3738
core_required += basic_required + web_required
3839
dev_required = read_requirements("requirements/dev.txt")
@@ -64,14 +65,15 @@ def create_config_folder():
6465
],
6566
packages=setuptools.find_packages(),
6667
include_package_data=True,
67-
python_requires=">=3.7",
68+
python_requires=">=3.8",
6869
install_requires=core_required,
6970
extras_require={
7071
"dev": dev_required,
7172
"jax": jax_required,
7273
"gdspy": gdspy_required,
7374
"gdstk": gdstk_required,
7475
"trimesh": trimesh_required,
76+
"vtk": vtk_required,
7577
},
7678
entry_points={
7779
"console_scripts": [

test_local.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ ruff check tidy3d
66

77
pytest -rA tests/
88

9+
# test no vtk available (must be done separately from other tests to reload tidy3d from scratch)
10+
pytest -rA tests/test_data/_test_datasets_no_vtk.py
11+
912
pytest --doctest-modules tidy3d/components

0 commit comments

Comments
 (0)