Hi Nathan,

Thanks for your help. Compiling from source and changing the sphere size did the trick.

I still can't seem to get the plots I want, though. I want three lines -- star, gas, and dark matter density as a function of radius. I tried building up a list of labels and profiles using yt.create_profile(sp, 'radius', field) and doing yt.ProfilePlot.from_profiles(profiles, labels=labels), but at the end I only end up with one line (dark matter, which is presumably the last field iterated through). I tried stepping through the code in IPython and it seems it's writing three plots (one for each field) when I only want one (with three fields). 

I also tried  yt.create_profile(sp, 'radius', fields=fields.values()) and passing that to  yt.ProfilePlot.from_profiles(), and I got the same issue. Same with yt.ProfilePlot(sp, 'radius', fields.values()) -- three plots are saved, each one overwriting the previous. Any ideas?

Thanks,

Rasmi

On Mon, May 23, 2016 at 6:01 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Rasmi,

Once I adjust the size of the sphere object you're using to be a bit large (in my case I made it 10 Mpc instead of 30 kpc), I'm able to run your script without errors. If I use 30 kpc, the script errors out since the sphere isn't big enough to accumulate values from more than a single cell in your simulation.

I'm running the latest development version of yt - there were some issues related to profiles that were fixed relative to yt 3.2.3 in the development version - so I'd suggest switching to the development branch until yt 3.3 is released.

There is documentation on how to switch to the development version of yt here:


If you're using anaconda, you may find using the conda nightly builds to be easier:


Hope that's helpful,

Nathan


On Mon, May 23, 2016 at 3:50 PM, Rasmi Elasmar <re2300@columbia.edu> wrote:
I tried fooling around with the test data (the Enzo cosmology datasets in particular) and couldn't find one that gave me a reasonable number of halos. This is obnoxious, but here's a ~3.5gb archive of the data I've been using (with halo catalog and test script). If that's not useful, let me know!


Rasmi

On Mon, May 23, 2016 at 2:41 PM, Nathan Goldbaum <nathan12343@gmail.com> wrote:
Hi Rasmi,

Is there any chance you can make a small test script that triggers the error you're seeing, using one of the public test datasets on yt-project.org/data? There are several Enzo datasets there that should be usable.

That will make it much easier for one of us to reproduce the error you're seeing.

-Nathan

On Mon, May 23, 2016 at 1:36 PM, Rasmi Elasmar <re2300@columbia.edu> wrote:
Hi all,

I'm using yt 3.2.3. I've created some derived fields (specifically 'dark_matter' and 'stars'), and I'm trying to plot radial profiles of ('gas', 'density'), ('deposit', 'dark_matter_density'), and ('deposit', 'stars_density'). I'm using yt.create_profile(sphere, 'radius', field) (where field is one of the above) and appending each of those profiles to a list called profiles. Those are created fine, and accessing profile[1].field_units (for example) gives '{('deposit', 'stars_density'): g/cm**3}', which is what I expect. 

The issue occurs when I call yt.ProfilePlot.from_profiles(profiles, labels=labels) -- I get an error in profile_plotter.py when accessing profile.field_units on a profile:
Traceback (most recent call last):
  File "/work/03330/tg826294/applications/scripts/halo_profiles.py", line 50, in <module>
    plot = yt.ProfilePlot.from_profiles(profiles, labels=labels)
  File "/work/03330/tg826294/applications/pythonenv/lib/python2.7/site-packages/yt/visualization/profile_plotter.py", line 415, in from_profiles
    return cls._initialize_instance(obj, profiles, labels, plot_specs, y_log)
  File "/work/03330/tg826294/applications/pythonenv/lib/python2.7/site-packages/yt/visualization/profile_plotter.py", line 365, in _initialize_instance
    obj._setup_plots()
  File "/work/03330/tg826294/applications/pythonenv/lib/python2.7/site-packages/yt/visualization/profile_plotter.py", line 339, in _setup_plots
    xtitle, ytitle = self._get_field_title(fname, profile)
  File "/work/03330/tg826294/applications/pythonenv/lib/python2.7/site-packages/yt/visualization/profile_plotter.py", line 633, in _get_field_title
    y_unit = profile.field_units[field_y]
KeyError: ('gas', 'density')

I tried explicitly passing the units in yt.create_profile(sphere, 'radius', field, units={field: units[field]}) (where units is a dictionary and units[field] gives 'g/cm**3'), but I still get the error. I also tried adding the units to ds.field_units, and that didn't help either.

You can see my code here.

I also tried creating all the profiles at once with:
profile = yt.Profile1D(sp, 'radius', 32, minimum, maximum, True, weight_field=None)
profile.add_values(fields.values())

But everything was 0, and I got errors with other approaches (I can detail them if you're curious, but I think the yt.ProfilePlot.from_profiles() is probably the best approach, right?).

Any ideas? Thanks for your help!

Rasmi

_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org



_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org



_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org



_______________________________________________
yt-dev mailing list
yt-dev@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org