Hi Yan-Hua, This definitely looks like a bug. Could you provide the full stack trace of the issue? Best, Corentin On 04/08/2021 17:45, Yan-Hua Chen wrote:
Hi yt-dev,
When I run a simple yt code, I run into the error message"ValueError: byte must be in range(0, 256) " It was happen at "yt\data_objects\static_output.py", line 249, in unique_identifier,name_as_bytes =bytearray(map(ord, self.parameter_filename)), and then I went to the source code to see what happen. Although I tried to find the problem, I had no idea why the array would become so large. I used ramses to produce the outputfile,info_00001.txt. Here is my code:
import yt import numpy as np import matplotlib.pyplot as plt
# loading the snapshot ds = yt.load("info_00001.txt") ##it is ramses output ad = ds.all_data()
# reading particle positions and velocities into numpy arrays pos = ad['particle_position'] vel = ad['particle_velocity']
# visualizing particle positions (ugly way) plt.scatter(pos[:,0], pos[:,1], s=0.001) plt.savefig('simple_visualization.png')
# writing particle positions to a csv file, which can be read # into datashader f = open('pos.csv', 'w') f.write('x_col,y_col,z_col\n') for i in pos: f.write('%f,%f,%f\n' % (i[0], i[1], i[2])) _______________________________________________ yt-dev mailing list -- yt-dev@python.org To unsubscribe send an email to yt-dev-leave@python.org https://mail.python.org/mailman3/lists/yt-dev.python.org/ Member address: corentin.cadiou@iap.fr
-- Dr. Corentin Cadiou Post Doctoral Research Assistant Cosmoparticle Initiative Hub, desk 27 University College London (UCL) Gower St, Bloomsbury, London WC1E 6BT mobile: +33.6.43.18.66.83