Python中Meep中的Vector3

2024-05-07 20:37:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我在简单的python代码中遇到了'module' object has no attribute 'Vector3'错误。在

这是rightAngle.py文件

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

编译使用:

^{pr2}$

得到这个输出:

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'

我所做的就是从这个相当可靠的source复制并粘贴给定的代码,但是在Vector3对象中得到错误。在

Python版本:

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

我不知道我错过了什么?在

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


Tags: 文件no代码pyimportobject错误cell