我正在制作一个常量列表,其中一个常量与结构化数组完全相同。该值用于另一个产生一些问题的常量。
path =' / users / unsername / Desktop / untitled folder / python files / MSII_phasespace /'
os.chdir( path )
data = np.load('msii_phasespace.npy',mmap_mode='r')
# data.size: 167197
# data.shape: (167197,)
# data.dtype: dtype([('x', '<f4'), ('y', '<f4'), ('z', '<f4'),
# ('velx', '<f4'), ('vely', '<f4'), ('velz', '<f4'), ('m200', '<f4')])
## Constants
# Assuming the mean density is close to the critical density of the universe
rho_m = 3.3e-14 # kg km^-3
# rho_0 = 0.27 * 10**((-1)*26) km m^-3 // current density
M = data[:] # kg // Mass of dark matter haloes
R = ((3*M)/((rho_m)*4*(np.pi))**(1.0/3.0) # Km // Radius of sphere
# k = 0.001 # Mpc h^-1 // Wave Dispersion relation
k = (0.02) # Mpc^-1 // Current best normalization scale
delt_c = 1.686 # Critical overdensity of spherical collapse.
h = 73 # km s^-1 Mpc^-1 // Hubbles Constant in the simulation
e = 2.718281 # Eulers number
T_CMB = 2.725 # k // Temperature of present Cosmic Microwave Background
Omega_m = 0.27 # Mass density of current time by WMAP, z = 0
保持R显示之后的值,例如k和delt_c有Invalid Syntax
错误。当我消除R值时,它会删除所有错误。我怎样才能解决这个问题?我认为主要罪魁祸首是M = data[:]
值
答案 0 :(得分:1)
您错过了定义n*i
的行中的结束括号。取代
M
带
((3*M)/((rho_m)*4*(np.pi))**(1.0/3.0)