Dear yt-users,

Hi, I want to ask you about phase plot. Some days ago, I asked how to sum up different datasets to make one profile plot, and it worked fine. This time, I tried to do the same thing in phase plot, but it did not work fine. Could you help me find out what the problem is?

(inside for loop):
     profile_medium = yt.create_profile(
             data_source=medium_region,
             bin_fields=["density", "temperature"],
             fields=["cell_mass"],
             n_bins=[128, 128],
             units=dict(),
             logs=dict(),
             weight_field=None,
             extrema=dict(density=(1e-30, 1e-20), temperature=(1e1, 1e8))
          )
     plot_med = yt.ProfilePlot.from_profiles(profile_medium)
     profile_med = plot_med.profiles[0]
     profiles_sum_med = profiles_sum_med + profile_med["cell_mass"]
    

my_data_med = {"density": profile_med.x,   
           "temperature": profile_med.y, 
              "cell_mass": profiles_sum_med}
fake_ds_med = {"current_time": yt.YTQuantity(10, "Myr")} 
yt.save_as_dataset(fake_ds_med, "phaseplots_med_all.h5", my_data_med)

ds = yt.load("phaseplots_med_all.h5")
ad = ds.data

profile = yt.create_profile(ad,
                            ["density", "temperature"],
                            n_bins=[128, 128],
                            fields=["cell_mass"], 
                            weight_field=None, 
                            extrema=dict(density=(1e-30, 1e-20), temperature=(1e1, 1e8))
                           )

and I got this error:

could not broadcast input array from shape (128,128) into shape (128)

Sincerely,
Y.T.

2017-10-26 16:15 GMT-04:00 tyuta <y0u1t1a5.t@gmail.com>:
Hi Suoqing Ji,

Thanks! I'll try that.

2017-10-26 15:59 GMT-04:00 Suoqing Ji <suoqing@physics.ucsb.edu>:
Hi t yuta,

What you can do is to get the data as numpy array directly from the profiles you’ve generated, and sum them up by yourself. You can follow the last example at: http://yt-project.org/docs/dev/visualizing/plots.html#d-profile-plots

For each dataset, you can have one profile:
profile = plot.profiles[0]

Then you can sum up profile[‘cell_mass'] over different datasets, and plot it against profile.x

Best wishes,
Suoqing Ji
Ph.D Candidate
Department of Physics
University of California, Santa Barbara

On Oct 26, 2017, 12:51 PM -0700, tyuta <y0u1t1a5.t@gmail.com>, wrote:
Dear yt-users,

Hi, I want to ask you about profile plot. I'm analyzing Enzo data, and I'm trying to plot metallicity-cellmass of different 12 datasets into one curve. I can plot 12 curves on one image, but that's not what I want. Does anyone know some good way, or links to documentation?
I've attached the 12-curve plot. I want to sum up all the curves to get one curve.

Thanks,
Y.T.埋め込み画像 2
_______________________________________________
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