Thanks!  I was not familiar with the converting to arrays step, looks very straightforward. 

Best,
Stephanie

On Thu, Jul 6, 2017 at 9:56 PM Nathan Goldbaum <nathan12343@gmail.com> wrote:
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.

-Nathan
 

can I just create an array of the fields I want from galgas?

Thanks,
Stephanie

--
Dr. Stephanie Tonnesen
Alvin E. Nashman Postdoctoral Fellow
Carnegie Observatories, Pasadena, CA
stonnes@gmail.com

_______________________________________________
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
--
--
Dr. Stephanie Tonnesen
Alvin E. Nashman Postdoctoral Fellow
Carnegie Observatories, Pasadena, CA
stonnes@gmail.com