KeyError: 'LanleicaipiaoItem does not support field: qih_ao'
时间: 2024-05-29 14:12:09 浏览: 7
This error is caused when trying to access a field in a Scrapy item that does not exist. In this case, it seems that the field "qih_ao" is not defined in the "LanleicaipiaoItem" item.
To fix this error, you need to make sure that the field "qih_ao" is defined in your item class. You can define it by adding the following line to your "LanleicaipiaoItem" class:
qih_ao = scrapy.Field()
Make sure to replace "qih_ao" with the actual name of the field you want to define. Once you have defined the field, you should be able to access it without getting the KeyError.
相关问题
matlab夫琅禾费衍射3d
以下是使用MATLAB进行夫琅禾费衍射的3D代码示例:
```matlab
% 定义夫琅禾费衍射函数
function [E_out, x_out, y_out] = fraunhofer_diffraction(E_in, lambda, L, dx)
[M, N] = size(E_in);
x = (-N/2 : N/2-1) * dx;
y = (-M/2 : M/2-1) * dx;
[X, Y] = meshgrid(x, y);
k = 2*pi / lambda;
E_out = zeros(M, N);
for i = 1:M
for j = 1:N
r = sqrt((X(i,j)^2) + (Y(i,j)^2) + (L^2));
E_out(i,j) = (exp(1i*k*r) / r^2) * E_in(i,j);
end
end
x_out = x;
y_out = y;
```
接下来,我们将使用此函数来计算夫琅禾费衍射的3D图形。首先,我们将创建一个输入光场(即在物体平面上的光场):
```matlab
% 创建物体平面上的光场
N = 100;
M = 100;
dx = 10e-6;
lambda = 632.8e-9;
x = (-N/2 : N/2-1) * dx;
y = (-M/2 : M/2-1) * dx;
[X, Y] = meshgrid(x, y);
E_in = zeros(M, N);
E_in(30:70, 30:70) = 1; % 创建一个正方形孔
% 显示物体平面上的光场
figure;
imagesc(x*1e6, y*1e6, abs(E_in));
axis image;
colormap gray;
xlabel('x (\mum)');
ylabel('y (\mum)');
title('Input field');
```
现在,我们将使用上面的函数来计算夫琅禾费衍射:
```matlab
% 计算夫琅禾费衍射
L = 1;
[E_out, x_out, y_out] = fraunhofer_diffraction(E_in, lambda, L, dx);
% 显示夫琅禾费衍射结果
figure;
surf(x_out*1e6, y_out*1e6, abs(E_out));
shading interp;
colormap jet;
xlabel('x (\mum)');
ylabel('y (\mum)');
zlabel('Intensity');
title('Fraunhofer diffraction');
```
这将产生以下3D图形:
![3D Fraunhofer diffraction](https://i.imgur.com/Kq6qIh6.png)
在这个例子中,我们创建了一个正方形孔,并计算了它的夫琅禾费衍射。结果是一个圆形的衍射斑图,由于我们只考虑了一个平面波,因此没有出现任何衍射图案。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)