diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml
index f1b70960f..9a1c19b5b 100644
--- a/.github/workflows/build-ci.yml
+++ b/.github/workflows/build-ci.yml
@@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: [3.6, 3.9]
+ python-version: [3.7, '3.10']
enable-mpi: [false, true]
steps:
@@ -126,8 +126,8 @@ jobs:
run: pip install -r python/requirements.txt
- name: Install coverage
- if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
- run: pip install coverage==4.5.4
+ if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.7 }}
+ run: pip install coverage
- name: Install mpi4py
if: ${{ matrix.enable-mpi && steps.cache.outputs.cache-hit != true }}
@@ -140,7 +140,7 @@ jobs:
echo "MEEP_VERSION=${MEEP_VERSION}" >> $GITHUB_ENV
- name: Run configure with OpenMP
- if: ${{ !(matrix.enable-mpi == false && matrix.python-version == 3.6) && !(matrix.enable-mpi == true && matrix.python-version == 3.9) }}
+ if: ${{ !(matrix.enable-mpi == false && matrix.python-version == 3.7) && !(matrix.enable-mpi == true && matrix.python-version == 3.10) }}
run: |
mkdir -p build &&
pushd build &&
@@ -148,11 +148,11 @@ jobs:
popd
- name: Run configure with coverage
- if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
+ if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.7 }}
run: ./configure --enable-maintainer-mode --with-coverage --prefix=${HOME}/local --with-libctl=${HOME}/local/share/libctl ${MPICONF}
- name: Run configure with single-precision floating point and swig threads
- if: ${{ matrix.enable-mpi == true && matrix.python-version == 3.9 }}
+ if: ${{ matrix.enable-mpi == true && matrix.python-version == 3.10 }}
run: |
mkdir -p build &&
pushd build &&
@@ -160,46 +160,47 @@ jobs:
popd
- name: Run make
- if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
+ if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.7 }}
run: make ${MKCHECKFLAGS}
- name: Run make check
- if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
+ if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.7 }}
run: |
pushd python/ &&
- make ${MKCHECKFLAGS} check &&
+ { make ${MKCHECKFLAGS} check || cat test-suite.log; } &&
popd
- name: Run make distcheck
- if: ${{ !(matrix.enable-mpi == false && matrix.python-version == 3.6) }}
+ if: ${{ !(matrix.enable-mpi == false && matrix.python-version == 3.7) }}
run: |
pushd build &&
make ${MKCHECKFLAGS} distcheck DISTCHECK_CONFIGURE_FLAGS="--with-libctl=${HOME}/local/share/libctl ${MPICONF}" &&
popd
- name: Generate coverage report
- if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
+ if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.7 }}
run: |
pushd python/ &&
+ coverage combine -a &&
coverage report -i &&
coverage xml -i &&
popd
- name: Upload coverage to Codecov
- if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.6 }}
+ if: ${{ matrix.enable-mpi == false && matrix.python-version == 3.7 }}
uses: codecov/codecov-action@v1
with:
files: ${{ github.workspace }}/python/coverage.xml
- name: Archive C++ test logs
- if: ${{ failure() && !(matrix.enable-mpi == false && matrix.python-version == 3.6) }}
+ if: ${{ failure() && !(matrix.enable-mpi == false && matrix.python-version == 3.7) }}
uses: actions/upload-artifact@v2
with:
name: cpp-tests-mpi-${{ matrix.enable-mpi }}-log
path: ${{ github.workspace }}/build/meep-${{ env.MEEP_VERSION }}/_build/sub/tests/test-suite.log
- name: Archive Python test logs
- if: ${{ failure() && !(matrix.enable-mpi == false && matrix.python-version == 3.6) }}
+ if: ${{ failure() && !(matrix.enable-mpi == false && matrix.python-version == 3.7) }}
uses: actions/upload-artifact@v2
with:
name: py${{ matrix.python-version }}-tests-mpi-${{ matrix.enable-mpi }}-log
diff --git a/doc/docs/Python_User_Interface.md b/doc/docs/Python_User_Interface.md
index 4cc513a75..69dd01938 100644
--- a/doc/docs/Python_User_Interface.md
+++ b/doc/docs/Python_User_Interface.md
@@ -87,40 +87,40 @@ control various parameters of the Meep computation.
```python
def __init__(self,
- cell_size: Union[meep.geom.Vector3, Tuple[float, ...], Tuple[int, ...], NoneType] = None,
- resolution: float = None,
- geometry: Optional[List[meep.geom.GeometricObject]] = None,
- sources: Optional[List[meep.source.Source]] = None,
- eps_averaging: bool = True,
- dimensions: int = 3,
- boundary_layers: Optional[List[meep.simulation.PML]] = None,
- symmetries: Optional[List[meep.simulation.Symmetry]] = None,
- force_complex_fields: bool = False,
- default_material: meep.geom.Medium = Medium(),
- m: float = 0,
- k_point: Union[meep.geom.Vector3, Tuple[float, ...], Tuple[int, ...], bool] = False,
- kz_2d: str = 'complex',
- extra_materials: Optional[List[meep.geom.Medium]] = None,
- material_function: Optional[Callable[[Union[meep.geom.Vector3, Tuple[float, ...], Tuple[int, ...]]], meep.geom.Medium]] = None,
- epsilon_func: Optional[Callable[[Union[meep.geom.Vector3, Tuple[float, ...], Tuple[int, ...]]], float]] = None,
- epsilon_input_file: str = '',
- progress_interval: float = 4,
- subpixel_tol: float = 0.0001,
- subpixel_maxeval: int = 100000,
- loop_tile_base_db: int = 0,
- loop_tile_base_eh: int = 0,
- ensure_periodicity: bool = True,
- num_chunks: int = 0,
- Courant: float = 0.5,
- accurate_fields_near_cylorigin: bool = False,
- filename_prefix: Optional[str] = None,
- output_volume: Optional[meep.simulation.Volume] = None,
- output_single_precision: bool = False,
- geometry_center: Union[meep.geom.Vector3, Tuple[float, ...], Tuple[int, ...]] = Vector3<0.0, 0.0, 0.0>,
- force_all_components: bool = False,
- split_chunks_evenly: bool = True,
- chunk_layout=None,
- collect_stats: bool = False):
+ cell_size: 'Optional[Vector3Type]' = None,
+ resolution: 'float' = None,
+ geometry: 'Optional[List[GeometricObject]]' = None,
+ sources: 'Optional[List[Source]]' = None,
+ eps_averaging: 'bool' = True,
+ dimensions: 'int' = 3,
+ boundary_layers: 'Optional[List[PML]]' = None,
+ symmetries: 'Optional[List[Symmetry]]' = None,
+ force_complex_fields: 'bool' = False,
+ default_material: 'Medium' = Medium(),
+ m: 'float' = 0,
+ k_point: 'Union[Vector3Type, bool]' = False,
+ kz_2d: 'str' = 'complex',
+ extra_materials: 'Optional[List[Medium]]' = None,
+ material_function: 'Optional[Callable[[Vector3Type], Medium]]' = None,
+ epsilon_func: 'Optional[Callable[[Vector3Type], float]]' = None,
+ epsilon_input_file: 'str' = '',
+ progress_interval: 'float' = 4,
+ subpixel_tol: 'float' = 0.0001,
+ subpixel_maxeval: 'int' = 100000,
+ loop_tile_base_db: 'int' = 0,
+ loop_tile_base_eh: 'int' = 0,
+ ensure_periodicity: 'bool' = True,
+ num_chunks: 'int' = 0,
+ Courant: 'float' = 0.5,
+ accurate_fields_near_cylorigin: 'bool' = False,
+ filename_prefix: 'Optional[str]' = None,
+ output_volume: 'Optional[Volume]' = None,
+ output_single_precision: 'bool' = False,
+ geometry_center: 'Vector3Type' = Vector3<0.0, 0.0, 0.0>,
+ force_all_components: 'bool' = False,
+ split_chunks_evenly: 'bool' = True,
+ chunk_layout: 'Optional[str, Simulation, BinaryPartition]' = None,
+ collect_stats: 'bool' = False):
```
diff --git a/python/Makefile.am b/python/Makefile.am
index cac075de8..6a73c67bc 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -95,7 +95,7 @@ TESTS = \
$(WVG_SRC_TEST)
if WITH_COVERAGE
- PY_LOG_COMPILER = coverage run -a --source=$(top_srcdir)/python/meep --omit=$(top_srcdir)/python/tests/*,$(top_srcdir)/python/examples/*,$(top_srcdir)/python/meep/materials.py
+ PY_LOG_COMPILER = coverage run -p --source=$(top_srcdir)/python/meep --omit=$(top_srcdir)/python/tests/*,$(top_srcdir)/python/examples/*,$(top_srcdir)/python/meep/materials.py
else
PY_LOG_COMPILER = $(RUNCODE) $(PYTHON)
endif
diff --git a/python/geom.py b/python/geom.py
index e115916ae..dc49db02c 100755
--- a/python/geom.py
+++ b/python/geom.py
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import division
-
import functools
import math
import numbers
diff --git a/python/mpb_data.py b/python/mpb_data.py
index 3e2d47d1b..87ffadd92 100644
--- a/python/mpb_data.py
+++ b/python/mpb_data.py
@@ -1,8 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import division
-
import math
-
import numpy as np
import meep as mp
from . import map_data
diff --git a/python/simulation.py b/python/simulation.py
index 126f05db2..0b7d59a03 100644
--- a/python/simulation.py
+++ b/python/simulation.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import division, print_function
+from __future__ import annotations
from typing import Callable, List, Tuple, Union, Optional
@@ -170,7 +170,7 @@ def p(self):
return self._p
DefaultPMLProfile = lambda u: u * u
-Vector3Type = Union[Vector3, Tuple[float, ...], Tuple[int, ...]]
+Vector3Type = Union[Vector3, Tuple[float, ...]]
class PML(object):
"""
@@ -968,7 +968,7 @@ def __init__(self,
geometry_center: Vector3Type = Vector3(),
force_all_components: bool = False,
split_chunks_evenly: bool = True,
- chunk_layout = None,
+ chunk_layout: Optional[str, Simulation, BinaryPartition] = None,
collect_stats: bool = False):
"""
All `Simulation` attributes are described in further detail below. In brackets
diff --git a/python/solver.py b/python/solver.py
index 3d94e0b66..89d05f7be 100644
--- a/python/solver.py
+++ b/python/solver.py
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import division, print_function
-
import functools
import math
import os
diff --git a/python/source.py b/python/source.py
index 15b809901..7df7b34cf 100644
--- a/python/source.py
+++ b/python/source.py
@@ -1,8 +1,5 @@
# -*- coding: utf-8 -*-
-from __future__ import division
-
import warnings
-
import meep as mp
from meep.geom import Vector3, check_nonnegative
diff --git a/python/tests/test_absorber_1d.py b/python/tests/test_absorber_1d.py
index d03ef8e7b..b8c9690ce 100644
--- a/python/tests/test_absorber_1d.py
+++ b/python/tests/test_absorber_1d.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
from meep.materials import Al
diff --git a/python/tests/test_antenna_radiation.py b/python/tests/test_antenna_radiation.py
index 9aec952de..3eeca002c 100644
--- a/python/tests/test_antenna_radiation.py
+++ b/python/tests/test_antenna_radiation.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import meep as mp
import math
import numpy as np
diff --git a/python/tests/test_binary_grating.py b/python/tests/test_binary_grating.py
index b082c140c..380c719e9 100644
--- a/python/tests/test_binary_grating.py
+++ b/python/tests/test_binary_grating.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
import math
@@ -9,7 +7,7 @@
class TestEigCoeffs(unittest.TestCase):
def run_binary_grating_oblique(self, theta):
-
+
resolution = 30 # pixels/um
dpml = 1.0 # PML thickness
@@ -25,7 +23,7 @@ def run_binary_grating_oblique(self, theta):
cell_size = mp.Vector3(sx,sy,0)
# replace anisotropic PML with isotropic Absorber to attenuate parallel-directed fields of oblique source
- abs_layers = [mp.Absorber(thickness=dpml,direction=mp.X)]
+ abs_layers = [mp.Absorber(thickness=dpml,direction=mp.X)]
wvl = 0.5 # center wavelength
fcen = 1/wvl # center frequency
@@ -46,7 +44,7 @@ def run_binary_grating_oblique(self, theta):
k = mp.Vector3(0,0,0)
symmetries = [mp.Mirror(mp.Y)]
eig_parity += mp.EVEN_Y
-
+
def pw_amp(k,x0):
def _pw_amp(x):
return cmath.exp(1j*2*math.pi*k.dot(x+x0))
@@ -71,7 +69,7 @@ def _pw_amp(x):
refl_flux = sim.add_flux(fcen, 0, 1, mp.FluxRegion(center=refl_pt, size=mp.Vector3(0,sy,0)))
sim.run(until_after_sources=100)
-
+
input_flux = mp.get_fluxes(refl_flux)
input_flux_data = sim.get_flux_data(refl_flux)
diff --git a/python/tests/test_cyl_ellipsoid.py b/python/tests/test_cyl_ellipsoid.py
index 68cc86fa4..330cfb8da 100644
--- a/python/tests/test_cyl_ellipsoid.py
+++ b/python/tests/test_cyl_ellipsoid.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
diff --git a/python/tests/test_diffracted_planewave.py b/python/tests/test_diffracted_planewave.py
index ad001abd0..3e1c8057a 100644
--- a/python/tests/test_diffracted_planewave.py
+++ b/python/tests/test_diffracted_planewave.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
import math
diff --git a/python/tests/test_faraday_rotation.py b/python/tests/test_faraday_rotation.py
index 73485758c..7c0f337a2 100644
--- a/python/tests/test_faraday_rotation.py
+++ b/python/tests/test_faraday_rotation.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import numpy as np
import meep as mp
diff --git a/python/tests/test_fragment_stats.py b/python/tests/test_fragment_stats.py
index 8b53b660b..61055ab22 100644
--- a/python/tests/test_fragment_stats.py
+++ b/python/tests/test_fragment_stats.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
diff --git a/python/tests/test_gaussianbeam.py b/python/tests/test_gaussianbeam.py
index 9595f6e03..862543e7e 100644
--- a/python/tests/test_gaussianbeam.py
+++ b/python/tests/test_gaussianbeam.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
import math
diff --git a/python/tests/test_kdom.py b/python/tests/test_kdom.py
index 301ec9f54..0711831c1 100644
--- a/python/tests/test_kdom.py
+++ b/python/tests/test_kdom.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
import math
@@ -30,7 +28,7 @@ def run_kdom(self, theta, num_band):
k = mp.Vector3(0,0,0)
eig_parity += mp.EVEN_Y
symmetries = [mp.Mirror(mp.Y)]
-
+
sim = mp.Simulation(resolution=resolution,
cell_size=cell_size,
k_point=k,
diff --git a/python/tests/test_material_dispersion.py b/python/tests/test_material_dispersion.py
index 6726aa809..220df72c1 100644
--- a/python/tests/test_material_dispersion.py
+++ b/python/tests/test_material_dispersion.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import numpy as np
import meep as mp
diff --git a/python/tests/test_medium_evaluations.py b/python/tests/test_medium_evaluations.py
index 226426e32..0d74bd93c 100644
--- a/python/tests/test_medium_evaluations.py
+++ b/python/tests/test_medium_evaluations.py
@@ -3,12 +3,10 @@
# Checks materials with lorentizian, drude, and non uniform diagonals.
# The extracted values are compared against actual datapoints pulled from
# refractiveindex.info.
-# TODO:
+# TODO:
# * check materials with off diagonal components
# * check magnetic profiles
-from __future__ import division
-
import unittest
import meep as mp
import numpy as np
diff --git a/python/tests/test_mpb.py b/python/tests/test_mpb.py
index ef6e3a4c4..8dacbfe9a 100644
--- a/python/tests/test_mpb.py
+++ b/python/tests/test_mpb.py
@@ -1,5 +1,3 @@
-from __future__ import division, print_function
-
import glob
import math
import os
diff --git a/python/tests/test_oblique_source.py b/python/tests/test_oblique_source.py
index bbcd994d0..edf0042a0 100644
--- a/python/tests/test_oblique_source.py
+++ b/python/tests/test_oblique_source.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import meep as mp
import math
import unittest
diff --git a/python/tests/test_physical.py b/python/tests/test_physical.py
index 6eb2831be..08b745a89 100644
--- a/python/tests/test_physical.py
+++ b/python/tests/test_physical.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
diff --git a/python/tests/test_prism.py b/python/tests/test_prism.py
index cc9f12d21..a66f32b5c 100644
--- a/python/tests/test_prism.py
+++ b/python/tests/test_prism.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import os
import unittest
import numpy as np
diff --git a/python/tests/test_ring.py b/python/tests/test_ring.py
index f9f9817ff..7970f23dc 100644
--- a/python/tests/test_ring.py
+++ b/python/tests/test_ring.py
@@ -1,7 +1,5 @@
# Python port of meep/examples/ring.ctl
# Calculating 2d ring-resonator modes, from the Meep tutorial.
-from __future__ import division
-
import unittest
import meep as mp
diff --git a/python/tests/test_ring_cyl.py b/python/tests/test_ring_cyl.py
index dec776920..a6ec6c27d 100644
--- a/python/tests/test_ring_cyl.py
+++ b/python/tests/test_ring_cyl.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
from utils import ApproxComparisonTestCase
diff --git a/python/tests/test_source.py b/python/tests/test_source.py
index abab7a564..ce397adcc 100644
--- a/python/tests/test_source.py
+++ b/python/tests/test_source.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import math
import os
import unittest
diff --git a/python/tests/test_special_kz.py b/python/tests/test_special_kz.py
index 03611550f..ab119c8c3 100644
--- a/python/tests/test_special_kz.py
+++ b/python/tests/test_special_kz.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import meep as mp
import cmath
diff --git a/python/tests/test_visualization.py b/python/tests/test_visualization.py
index 1b030716e..064e50635 100644
--- a/python/tests/test_visualization.py
+++ b/python/tests/test_visualization.py
@@ -1,12 +1,9 @@
-
-# visualization.py - Tests the visualization module. Checks 2D
+# visualization.py - Tests the visualization module. Checks 2D
# plotting of a waveguide with several sources, monitors, and
# boundary conditions. Checks for subdomain plots.
#
# Also tests the animation run function, mp4 output, jshtml output, and git output.
-from __future__ import division
-
import unittest
from subprocess import call
diff --git a/python/tests/test_wvg_src.py b/python/tests/test_wvg_src.py
index bb2cea549..e4b636398 100644
--- a/python/tests/test_wvg_src.py
+++ b/python/tests/test_wvg_src.py
@@ -1,5 +1,3 @@
-from __future__ import division
-
import unittest
import sys
diff --git a/python/verbosity_mgr.py b/python/verbosity_mgr.py
index 41a991faf..5b9fcc686 100644
--- a/python/verbosity_mgr.py
+++ b/python/verbosity_mgr.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import absolute_import, print_function
class Verbosity(object):