Hey Nathan,

So currently there’s no way to save the profile and read it in later with this working? (The profile takes approximately forever to generate, so iterating on plotting while not in iPython is currently a p.i.t.a.)

—Molly


On August 29, 2016 at 2:37:56 PM, Nathan Goldbaum (nathan12343@gmail.com) wrote:

Hi Molly,

I think this is a bug in yt - the issue is that the field_info associated with the original profile object is not being saved to the profile dataset.

I've filed this issue here:


For now, you should be able to create a PhasePlot using the profile object you created from the original dataset:

    nhT_prof_new = yt.create_profile(sph, [('gas', 'H_number_density'),('gas','temperature')], fields='cell_mass',
                                                          extrema=extrema,fractional=True, n_bins=6)
    plot = yt.PhasePlot.from_profile(nht_prof_new)

-Nathan

On Mon, Aug 29, 2016 at 12:45 PM, Molly Peeples <molly@stsci.edu> wrote:
Hi folks,

I’m trying to construct and save a 2d profile container to make a phase plot. Here’s what I have:

nhT_prof_new = yt.create_profile(sph, [('gas', 'H_number_density'),('gas','temperature')], fields='cell_mass', extrema=extrema,fractional=True, n_bins=6)

nhT_prof_new.save_as_dataset()

prof_ds = yt.load("snap_047_z000p000_Profile2D.h5")


(just using a small number of bins for now to play with…)

In [115]: prof_ds.data["temperature"]

     ...: prof_ds.data["H_number_density"]

     ...: prof_ds.data["cell_mass"]

     ...: 

Out[115]: 

YTArray([[ 0.01685665,  0.0405085 ,  0.03575519,  0.03091732,  0.02552936,

         0.0230379 ],

       [ 0.03770747,  0.05441198,  0.04859202,  0.03285325,  0.02385346,

         0.04674817],

       [ 0.03022001,  0.05150457,  0.03591368,  0.01974481,  0.01052408,

         0.00331175],

       [ 0.04278126,  0.01889035,  0.0177686 ,  0.01644028,  0.01598129,

         0.00578262],

       [ 0.05010083,  0.06573628,  0.04247398,  0.03914208,  0.        ,

         0.        ],

       [ 0.        ,  0.11691224,  0.        ,  0.        ,  0.        ,

         0.        ]]) dimensionless


but when I try to create a PhasePlot:

In [116]: p = yt.PhasePlot(prof_ds.data, "H_number_density", "temperature","cell_mass",weight_field=None)

     ...: 

---------------------------------------------------------------------------

KeyError                                  Traceback (most recent call last)

<ipython-input-116-37b81d75b563> in <module>()

----> 1 p = yt.PhasePlot(prof_ds.data,"H_number_density", "temperature","cell_mass",weight_field=None)


/Users/molly/anaconda2/envs/astroconda/lib/python2.7/site-packages/yt/visualization/profile_plotter.pyc in __init__(self, data_source, x_field, y_field, z_fields, weight_field, x_bins, y_bins, accumulation, fractional, fontsize, figure_size)

    756 

    757         type(self)._initialize_instance(self, data_source, profile, fontsize,

--> 758                                         figure_size)

    759 

    760     @classmethod


/Users/molly/anaconda2/envs/astroconda/lib/python2.7/site-packages/yt/visualization/profile_plotter.pyc in _initialize_instance(cls, obj, data_source, profile, fontsize, figure_size)

    773         obj.profile = profile

    774         super(PhasePlot, obj).__init__(data_source, figure_size, fontsize)

--> 775         obj._setup_plots()

    776         obj._initfinished = True

    777         return obj


/Users/molly/anaconda2/envs/astroconda/lib/python2.7/site-packages/yt/visualization/profile_plotter.pyc in _setup_plots(self)

    854                     cax = self.plots[f].cax

    855 

--> 856             x_scale, y_scale, z_scale = self._get_field_log(f, self.profile)

    857             x_title, y_title, z_title = self._get_field_title(f, self.profile)

    858 


/Users/molly/anaconda2/envs/astroconda/lib/python2.7/site-packages/yt/visualization/profile_plotter.pyc in _get_field_log(self, field_z, profile)

    813 

    814     def _get_field_log(self, field_z, profile):

--> 815         zfi = profile.field_info[field_z]

    816         if self.x_log is None:

    817             x_log = profile.x_log


KeyError: ('data', 'cell_mass')




Suggestions?
—Molly

_______________________________________________
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