八度不适用于Symbols软件包

时间:2020-11-05 14:11:33

标签: python-3.x pip octave sympy

当我尝试使用“ syms”功能运行某些文件时,出现此错误:

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "<stdin>", line 12, in octoutput_drv
  File "<stdin>", line 55, in octoutput
  File "/home/vitorfrois/.local/lib/python3.8/site-packages/sympy/__init__.py", line 677, in __getattr__
    return getattr(self.mod, name)
AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
error: Python exception: AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
    occurred while copying variables to Python.
    Try "sympref reset" and repeat your command?
    (consider filing an issue at https://github.com/cbm755/octsympy/issues)
error: called from
    pycall_sympy__ at line 191 column 5
    valid_sym_assumptions at line 38 column 10
    assumptions at line 82 column 7
    syms at line 97 column 13
    StubCurto_Pit1OC at line 86 column 1

我已经尝试过“ sympref reset”并重复我的命令。然后,我收到另一个错误:


importing sympy.core.compatibility with 'from sympy import *' has been
deprecated since SymPy 1.6. Use import sympy.core.compatibility
instead. See https://github.com/sympy/sympy/issues/18245 for more
info.

  self.Warn(
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 12, in octoutput_drv
  File "<stdin>", line 54, in octoutput
  File "<stdin>", line 55, in octoutput
  File "/home/vitorfrois/.local/lib/python3.8/site-packages/sympy/__init__.py", line 677, in __getattr__
    return getattr(self.mod, name)
AttributeError: module 'sympy.core.compatibility' has no attribute 'integer_types'
Waiting...............no output so far

error: ipc_popen2: something wrong? timed out starting python
error: called from
    python_ipc_popen2 at line 101 column 7
    python_ipc_driver at line 62 column 15
    pycall_sympy__ at line 163 column 11
    valid_sym_assumptions at line 38 column 10
    assumptions at line 82 column 7
    syms at line 97 column 13
    StubCurto_Pit1OC at line 86 column 1

这是输入功能

[dstub,lstub] = StubCurto_Pit1OC('StubCurto','Perm_r',1,'Freq',25e6,'ZLinha',50,'ZCarga',50 + 1j*75);

这是我正在使用的八度文件(“ syms”部分在第86行)

function [dstub,lstub]=StubCurto_Pit1OC(varargin)
warning off
c = 299792458;
if strcmp(varargin{2},'Perm_r') && strcmp(varargin{4},'Freq')
    eps_r = varargin{3};
    f = varargin{5};
else
    error('ENTRAR COM VALORES DE PERMISSIVIDADE EL�TRICA RELATIVA E FREQU�NCIA')
end
vp = c/sqrt(eps_r);% vp % Velocidade 
Lambda = vp/f;     % Comprimrnto de onda
display('Comprimento de Onda Lambda (m)'),display(Lambda)
Beta = 2*pi/Lambda;
d = 0:1e-4:Lambda/4; % Dist�ncia da Imped�ncia na linha � carga

if strcmp(varargin{1},'StubCurto')
    CH1 = 1;
end
switch CH1
    %--------------------------LINHA
    case 1
Zo = varargin{7};
ZL = varargin{9};
[Z_d] = (Zo*((ZL + 1j*Zo.*tan(Beta.*d))./(Zo+1j*ZL.*tan(Beta.*d))))/Zo;

Y_d =1./Z_d; % Y_d = Admit�ncia na linha � dist�ncia d da carga

Re_Y = real(Y_d); % Parte real de Y_d

figure,plot(d,Re_Y,'linewidth',3); grid on
title('Real da Admit�ncia da LINHA  f(dist�ncia � carga) (1/Ohm)');
xlabel('d  (m)');ylabel('Y(d) (1/Ohm)');

Im_Y = imag(Y_d); % Parte imagin�ria de Y_d

figure, plot(d,Im_Y,'linewidth',3); grid on
title('Imagin�rio da Admit�ncia da LINHA  f(dist�ncia � carga) (1/Ohm)');
xlabel('d  (m)');ylabel('jY(d) (1/Ohm)');
 
Zin_Y = 1./(-1j.*Im_Y).*Zo; % Imped�ncia do STUB em fun��o da Admit�ncia
lstubv  = (atan(Zin_Y./(1j*Zo)))./Beta; % Comprimento do STUB
lstubv = abs(lstubv);
figure, plot(Im_Y,lstubv,'linewidth',3); grid on
title('Comprimento do STUB f(Y_d imagin�ria de Y_d) (1/Ohm)');
xlabel('Yin (1/Ohm');ylabel('l (m))');

k=0;
for ct=1:1:size(d)
   if Re_Y(ct)==1 
        k = ct;
   end
   if .900000<= Re_Y(ct) && Re_Y <= 1.00001
        k = ct;
   end
end
if k==0
  k = find(abs(Re_Y-1) < 1e-4);
end
k
cont = isempty(k);
if cont == 1
    display('Real Y_d < 1');display('   ')
    error('n�o � poss�vel casar as imped�ncias com STUB')
end   
x = (ceil(mean(k)));% x
dstub = x*1e-4;
D_Lam_Stub = (double(dstub/Lambda));
display('Dist�ncia do stub � carga em comprimentos de onda (Lambda)');
display(D_Lam_Stub);

display('Dist�ncia do stub � carga (m)')
display(dstub)

Imstub = Im_Y(x);
Zin = 1/(-1j*Imstub)*Zo;
syms l
[lstub] = abs(double((solve(Zin - 1j*Zo*tan(Beta*l),l))));
L_Lam_Stub = (double(lstub/Lambda));
display('Comprimento do stub em curto em comprimentos de onda (Lambda)');
display(L_Lam_Stub)
display('Comprimento do stub em curto (m)'),display(lstub)
end
end

帮我解决syms pkg问题,以便我可以运行该功能而没有任何问题

0 个答案:

没有答案