我试图了解我遇到的问题,但我无法完全理解为什么会出现这些错误,特别是因为这个错误表明我认为是误报。我知道它与这条线有关:for file in glob.glob('puredef_hdf5_chk_000000')
但我不确定它可能是什么。
import yt
import glob
for file in glob.glob('puredef_hdf5_chk_000000')
ds=yt.load(file)
#########################################
slc= yt.ProjectionPlot(ds,'theta','density')
slc= yt.SlicePlot(0.25,p_size=15.0,col="Pink")
slc.set_cmap('density',('Blues'))
slc.annotate_particles(0.25,p_size=12.0,col='Red')
slc.save('tr')
#########################################
# This
#slc = yt.SlicePlot(ds,"theta", ["density"])
#slc.set_cmap("density","Blues")
#slc.annotate_particles(0.25, p_size=12.0, col="Red")
#slc.save('tr')
##########################################
p = yt.ProjectionPlot(ds,"theta","density",center='m',width=(10, 'Mpc'))
p.annotate_particles((10,'Mpc'))
p.save('tr')
############################################################
#p = yt.ParticlePlot(ds, 'particle_position_x', 'particle_position_y', 'particle_dens')
#or
#p = yt.ParticlePlot(ds, 'particle_position_cylindrical_radius', 'particle_position_cylindrical_theta', 'particle_dens')
# Above is for axi-symmetric
#p.set_ylim(-2.5e10,3.5e10)
#p.set_xlim(1e10,3.5e10)
#p.set_zlim('particle_dens', 1e1, 1e13) #fixed the density axis
#p.save()
######################################################
#ad = ds.all_data()
#print(ad['particle_position_y'])
######################################################
runfile('C:/Users/rocke/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/richard/new 1.py', wdir='C:/Users/rocke/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs/home/richard')
File "C:\Users\rocke\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\home\richard\new 1.py", line 4
for file in glob.glob('puredef_hdf5_chk_000000')
^
SyntaxError: invalid syntax