Skip to content

Commit

Permalink
⬆️ Looser 2.0 numpy functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
daquinteroflex committed Oct 30, 2024
1 parent 2c9ae23 commit 0640c8f
Show file tree
Hide file tree
Showing 6 changed files with 1,053 additions and 1,007 deletions.
2 changes: 1 addition & 1 deletion docs/notebooks
Submodule notebooks updated 86 files
+1 −5 AdjointPlugin0Quickstart.ipynb
+3 −8 AdjointPlugin10YBranchLevelSet.ipynb
+2 −2 AdjointPlugin2GradientChecking.ipynb
+3 −3 AdjointPlugin3InverseDesign.ipynb
+3 −3 AdjointPlugin4MultiObjective.ipynb
+3 −3 AdjointPlugin5BoundaryGradients.ipynb
+3 −3 AdjointPlugin6GratingCoupler.ipynb
+1 −1 AdjointPlugin7Metalens.ipynb
+2 −2 AdjointPlugin8WaveguideBend.ipynb
+2 −2 AdjointPlugin9WDM.ipynb
+2 −6 Autograd0Quickstart.ipynb
+1 −7 Autograd10YBranchLevelSet.ipynb
+313 −693 Autograd13Metasurface.ipynb
+12 −34 Autograd15Antenna.ipynb
+16 −28 Autograd16BilayerCoupler.ipynb
+10 −33 Autograd17BandPassFilter.ipynb
+0 −1,784 Autograd18TopologyBend.ipynb
+0 −8,435 Autograd19ApodizedCoupler.ipynb
+4 −4 Autograd1Intro.ipynb
+18 −20 Autograd3InverseDesign.ipynb
+2 −9 Autograd5BoundaryGradients.ipynb
+49 −53 Autograd6GratingCoupler.ipynb
+2 −8 Autograd7Metalens.ipynb
+3 −9 Autograd8WaveguideBend.ipynb
+8 −13 Autograd9WDM.ipynb
+1,719 −236 Bandstructure.ipynb
+1,051 −0 CircularlyPolarizedPatchAntenna.ipynb
+1 −2 CoupledLineBandpassFilter.ipynb
+89 −398 EMESolver.ipynb
+2 −2 GeometryTransformations.ipynb
+2 −3 IntegratedVivaldiAntenna.ipynb
+125 −125 MetalOxideSunscreen.ipynb
+2,550 −121 MidIRMetalens.ipynb
+0 −1,389 MultipoleExpansion.ipynb
+2 −2 NanobeamCavity.ipynb
+2 −2 NonHermitianMetagratings.ipynb
+2 −2 ParticleSwarmOptimizedPBS.ipynb
+1 −2 PhotonicCrystalWaveguidePolarizationFilter.ipynb
+4 −11 Primer.ipynb
+0 −26 README.md
+40 −106 StartHere.ipynb
+1 −1 UnstructuredData.ipynb
+123 −592 VortexMetasurface.ipynb
+1 −2 WaveguideGratingAntenna.ipynb
+0 −3 docs/basics/index.rst
+0 −3 docs/case_studies/fiber.rst
+0 −1 docs/case_studies/index.rst
+0 −3 docs/case_studies/lenses.rst
+0 −4 docs/case_studies/metamaterials_gratings_periodic.rst
+2 −4 docs/case_studies/microwave.rst
+0 −3 docs/case_studies/nanophotonics.rst
+0 −3 docs/case_studies/photonic_crystals.rst
+0 −3 docs/case_studies/photonic_opt.rst
+0 −3 docs/case_studies/pic.rst
+0 −4 docs/case_studies/pic_active.rst
+0 −3 docs/case_studies/scattering_far_field.rst
+2 −7 docs/features/adjoint.rst
+0 −3 docs/features/advanced.rst
+2 −8 docs/features/autograd.rst
+0 −3 docs/features/data_visualisation.rst
+1 −4 docs/features/eme.rst
+0 −3 docs/features/grid.rst
+0 −3 docs/features/heat.rst
+1 −1 docs/features/index.rst
+0 −3 docs/features/medium.rst
+0 −3 docs/features/microwave.rst
+0 −3 docs/features/mode.rst
+0 −3 docs/features/parameter_sweep.rst
+0 −3 docs/features/resonance.rst
+0 −3 docs/features/scattering_matrix.rst
+0 −3 docs/features/sources.rst
+0 −3 docs/features/structures.rst
+0 −1 docs/features/symmetry.rst
+ img/adjoint_15.png
+ img/adjoint_16.png
+ img/adjoint_17.png
+ img/adjoint_18.png
+ img/apodized_grating_feature_image_autograd.png
+ img/circularly_polarized_patch_antenna.png
+ img/errorAnalysisME.png
+ img/multipoleExpansion.png
+ misc/invdes_bend.gds
+0 −101 misc/mie_electric_dipole
+0 −101 misc/mie_electric_quadrupole
+0 −101 misc/mie_magnetic_dipole
+0 −101 misc/mie_magnetic_quadrupole
2,018 changes: 1,020 additions & 998 deletions poetry.lock

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ importlib-metadata = ">=6.0.0"
h5netcdf = "1.0.2"
h5py = "^3.0.0"
rich = "^13.0"
numpy = "<2"
numpy = "*"
matplotlib = "*"
shapely = "^2.0"
pandas = "<=2.2.1"
pandas = "*"
pydantic = "^2.0"
PyYAML = "*"
dask = "*"
toml = "*"
autograd = "1.6.2"
autograd = ">=1.7.0"
scipy = "*"
### NOT CORE
boto3 = "^1.28.0"
Expand Down Expand Up @@ -65,11 +65,11 @@ tox = { version = "*", optional = true }
gdspy = { version = "*", optional = true }

# gdstk
gdstk = { version = ">=0.9.49, <0.9.52", optional = true }
gdstk = { version = ">=0.9.49", optional = true }

# jax
jaxlib = { version = "0.4.25", source = "jaxsource", optional = true }
jax = { version = "0.4.25", extras = [
jaxlib = { version = ">=0.4.25", source = "jaxsource", optional = true }
jax = { version = ">=0.4.25", extras = [
"cpu",
], source = "jaxsource", optional = true }

Expand Down Expand Up @@ -199,6 +199,7 @@ jax = ["jaxlib", "jax"]
scikit-rf = ["scikit-rf"]
trimesh = ["trimesh", "networkx", "rtree"]
vtk = ["vtk"]
ruff = ["ruff"]

[tool.poetry.scripts]
tidy3d = "tidy3d.web.cli:tidy3d_cli"
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def cartesian_to_unstructured(

shape = np.shape(XYZ[0])

XYZp = XYZ.copy()
XYZp = np.array(XYZ).copy()
rng = np.random.default_rng(seed=seed)

x_pert = (1 - 2 * rng.random(shape)) * pert
Expand Down
23 changes: 23 additions & 0 deletions tidy3d/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,26 @@ def _fn(*args, **kwargs):
return fn(*args, **kwargs)

return _fn


def get_numpy_major_version(module=np):
"""
Extracts the major version of the installed numpy accordingly.
Parameters
----------
module : module
The module to extract the version from. Default is numpy.
Returns
-------
int
The major version of the module.
"""
# Get the version of the module
module_version = module.__version__

# Extract the major version number
major_version = int(module_version.split(".")[0])

return major_version

0 comments on commit 0640c8f

Please sign in to comment.