Skip to content

Numpy deprecation issue #30

@quasars100

Description

@quasars100

Hi all,

When trying to run FASTPT, I got this error with the following codes:

fpt=FASTPT(k_emu,to_do=['all'],low_extrap=-5,high_extrap=3,n_pad=int(0.5*len(k_emu)))

AttributeError Traceback (most recent call last)
Cell In[83], line 1
----> 1 fpt=FASTPT(k_emu,to_do=['all'],low_extrap=-5,high_extrap=3,n_pad=int(0.5*len(k_emu)))

File /opt/homebrew/lib/python3.10/site-packages/fastpt/FASTPT.py:249, in FASTPT.init(self, k, nu, to_do, param_mat, low_extrap, high_extrap, n_pad, verbose)
246 self.X_cleft = scalar_stuff(p_mat, nu, self.N, self.m, self.eta_m, self.l, self.tau_l)
248 if self.IA_tt_do:
--> 249 hE_tab, hB_tab = IA_tt()
250 p_mat_E = hE_tab[:, [0, 1, 5, 6, 7, 8, 9]]
251 p_mat_B = hB_tab[:, [0, 1, 5, 6, 7, 8, 9]]

File /opt/homebrew/lib/python3.10/site-packages/fastpt/IA_tt.py:31, in IA_tt()
29 tableE=np.zeros(10,dtype=float)
30 for i in range(l_mat_E.shape[0]):
---> 31 xE=J_table(l_mat_E[i])
32 tableE=np.row_stack((tableE,xE))
34 tableB=np.zeros(10,dtype=float)

File /opt/homebrew/lib/python3.10/site-packages/fastpt/J_table.py:53, in J_table(params)
51 for J2 in J2_range:
52 for Jk in Jk_range:
---> 53 B = coeff_B(l1,l2,l,J1,J2,Jk)
54 if (B!=0):
55 #x=np.array([alpha,beta,l1,l2,l,J1,J2,Jk,A,B],dtype=float)
56 x=np.array([alpha,beta,l1,l2,l,J1,J2,Jk,A,B],dtype=object)

File /opt/homebrew/lib/python3.10/site-packages/fastpt/J_table.py:28, in coeff_B(l1, l2, l, J1, J2, Jk)
26 if ((J1+l2+l)%2==0)&((l1+J2+l)%2==0)&((l1+l2+Jk)%2==0):
27 PF=(-1)(l+(J1+J2+Jk)/2) * (2J1+1)(2J2+1)(2*Jk+1) / pi3
---> 28 result=PF *three_j(np.array([J1,l2,l]),np.array([0,0,0]) )
29 *three_j(np.array([l1,J2,l]),np.array([0,0,0]) )
30 *three_j(np.array([l1,l2,Jk]),np.array([0,0,0]) )
31 *three_j(np.array([J1,J2,Jk]),np.array([0,0,0]) )
32 *six_j(np.array([J1,J2,Jk,l1,l2,l]) )
33 else:
34 result = 0

File /opt/homebrew/lib/python3.10/site-packages/fastpt/Wigner_symbols.py:64, in three_j(j, m)
60 if m_1 + m_2 + m_3 != 0:
61 return 0
---> 64 PF= np.int((-1) ** int(j_1 - j_2 - m_3))
65 M=-m_3;
67 a1 = j_1 + j_2 - j_3

File /opt/homebrew/lib/python3.10/site-packages/numpy/init.py:305, in getattr(attr)
300 warnings.warn(
301 f"In the future np.{attr} will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in former_attrs:
--> 305 raise AttributeError(former_attrs[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full numpy.testing namespace
313 if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Is there a quick way to fix this? (It seems the current FASTPT module is incompatible with the latest numpy version).
Thank you so much for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions