Vector3 in Meep in Python

拥有回忆 提交于 2020-01-02 23:14:45

问题


I'm getting 'module' object has no attribute 'Vector3' error in my simple python code.

This is rightAngle.py file

import meep as mp
import math

cell = mp.Vector3(16, 8, 0)
geometry = [mp.Bloack(mp.Vector3(1e20, 1, 1e20),
                      center = mp.Vector3(0, 0),
                      material = mp.Medium(epsilon = 12))]
sources = [mp.Source(mp.ContinuousSource(frequency = 0.15),
                     component = mp.Ez,
                     center = mp.Vector3(-7, 0))]
pml_layers = [mp.PML(1.0)]
resolution = 10

Compling using:

python rightAngle.py >& rightAngle.out

And getting this output:

Traceback (most recent call last):
  File "rightAngle.py", line 4, in <module>
    cell = mp.Vector3(16, 8, 0)
AttributeError: 'module' object has no attribute 'Vector3'

All I'm doing is copy and pasting given code from this fairly reliable source but getting error in Vector3 object.

Python version:

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2

I don't know what I'm missing?

Meep Documentation: https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/


回答1:


Got the same problem while trying to use it on Ubuntu 16.04.

What worked for me was installing Anaconda for python 2.7 and create their recommended environment using:

conda create -n mp -c chogan -c defaults -c conda-forge pymeep

No Vector3 problem after that.



来源:https://stackoverflow.com/questions/46867259/vector3-in-meep-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!