On Thu, Jul 6, 2017 at 11:44 PM, Stephanie Tonnesen <stonnes@gmail.com> wrote:Hi all,I am trying to write a bunch of information from a gas-only single enzo output to a file for colleagues to read. I don't think they are familiar with HDF5, so I am hoping to write to a fits file. What I want to put in the file is the x,y,z coordinates, the x,y,z velocity, and the total energy of the gas--which is a user-defined function in my case. Ideally I also only want to include gas that has a tracer fraction of some value.so basically I have something like:ds = yt.load("file")galgas = ds.cut_region(["obj['Metal_Density']/obj['density'] > 0.1"])To get the x, y, z position:x = galgas['x']y = galgas['y']z = galgas['z']And the velocity:vx = galgas['velocity_x']vy = galgas['velocity_y']vz = galgas['velocity_z']And your tnermal energy derived field:te = galgas['your_te_field']These will all be YTArrays. You can convert these to astropy quantities by doing:vx = vx.to_astropy()Or you could convert them to ndarrays:vx = np.array(vx)And then you could use astropy.io.fits to make a fits file from these arrays.-Nathancan I just create an array of the fields I want from galgas?Thanks,Stephaniestonnes@gmail.comCarnegie Observatories, Pasadena, CA--Alvin E. Nashman Postdoctoral Fellow
Dr. Stephanie Tonnesen______________________________________________________________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org