diff --git a/doc/docs/Installation.md b/doc/docs/Installation.md index bcea9f512..e691e62c8 100644 --- a/doc/docs/Installation.md +++ b/doc/docs/Installation.md @@ -39,7 +39,7 @@ This creates an environment called "mp" (you can name this anything you like) wi Next, we need to activate the environment before we can start using it. ```bash -source activate mp +conda activate mp ``` Now, `python -c 'import meep'` should work, and you can try running some of the examples in the `meep/python/examples` directory. @@ -50,7 +50,7 @@ Installing parallel PyMeep follows the same pattern, but the package is called ` ```bash conda create -n pmp -c chogan -c conda-forge pymeep-parallel -source activate pmp +conda activate pmp ``` The environment includes `mpi4py`, so you can run an MPI job with 4 processes like this: @@ -61,6 +61,11 @@ mpirun -np 4 python .py If you run into issues, make sure your `PYTHONPATH` environment variable is unset. +**Note:** If you experience crashes when using `matplotlib` on macOS, try importing `meep` before importing `matplotlib`. In addition add the following line to your `~/.matplotlib/matplotlibrc` file to force the `TkAgg` backend: +``` +backend: TkAgg +``` + **Note:** For pymeep-parallel on macOS, a [bug](https://github.com/open-mpi/ompi/issues/2956) in openmpi requires that the environment variable `TMPDIR` be set to a short path like `/tmp`. Without this workaround, you may see errors similar to this: ```bash diff --git a/python/examples/mpb_data_analysis.py b/python/examples/mpb_data_analysis.py index 7b2cf8fd6..4a338aab5 100644 --- a/python/examples/mpb_data_analysis.py +++ b/python/examples/mpb_data_analysis.py @@ -2,20 +2,19 @@ import os import sys -import matplotlib.pyplot as plt import numpy as np import meep as mp +import matplotlib.pyplot as plt from meep import mpb examples_dir = os.path.realpath(os.path.dirname(__file__)) sys.path.insert(0, examples_dir) -# Import the ModeSolver from the mpb_tri_rods.py example -from mpb_tri_rods import ms as tr_ms -from mpb_diamond import ms as d_ms - def tri_rods(): + # Import the ModeSolver defined in the mpb_tri_rods.py example + from mpb_tri_rods import ms as tr_ms + efields = [] # Band function to collect the efields @@ -57,6 +56,9 @@ def get_efields(tr_ms, band): def diamond(): + # Import the ModeSolver from the mpb_diamond.py example + from mpb_diamond import ms as d_ms + dpwr = [] def get_dpwr(ms, band):