2D Profile Plots for User Defined Fields

Hello, I have an hdf5 data file from FLASH which I analyze through yt. I use the yt_createprofile function to make a 2D profile plot of density and temperature as mentioned on the website: import yt
ds = yt.load("some_hdf5_data") dd = ds.all_data() center = ds.arr([64.0, 64.0, 64.0], 'code_length') rvir = ds.quan(1, "pc") sph = ds.sphere(center, rvir)
profile = yt.create_profile(sph, ['density', 'temperature'], n_bins=[128, 128], fields=['cell_mass'], weight_field=None) plot = yt.PhasePlot.from_profile(profile) plot.save()
However, I would also like to make a plot of the number density. Say, I define numdens = dd['density']/1.67e-24 How can I use 'numdens' to plot the same profile plot?

You’ll need to define your own field in the yt field system, see:
http://yt-project.org/doc/developing/creating_derived_fields.html
On Sun, Jan 13, 2019 at 7:40 AM piyush.suneet@gmail.com wrote:
Hello, I have an hdf5 data file from FLASH which I analyze through yt. I use the yt_createprofile function to make a 2D profile plot of density and temperature as mentioned on the website: import yt
ds = yt.load("some_hdf5_data") dd = ds.all_data() center = ds.arr([64.0, 64.0, 64.0], 'code_length') rvir = ds.quan(1, "pc") sph = ds.sphere(center, rvir)
profile = yt.create_profile(sph, ['density', 'temperature'], n_bins=[128, 128], fields=['cell_mass'], weight_field=None) plot = yt.PhasePlot.from_profile(profile) plot.save()
However, I would also like to make a plot of the number density. Say, I define numdens = dd['density']/1.67e-24 How can I use 'numdens' to plot the same profile plot? _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org

Hi Nathan,
Thank you for directing me to this webpage. I was able to create the derived field that I wanted .
Cheers, Piyush
participants (2)
-
Nathan Goldbaum
-
piyush.suneet@gmail.com