HI Sean,

I couldn't tell from what was posted exactly what you tried, but the following worked for me:

    ad = ds.all_data()
    density_bins = ds.arr(np.logspace(-33, -24, 10), 'g/cm**3')
    p = yt.create_profile(ad, ['density'], 'cell_mass', weight_field=None,
                          override_bins={'density': density_bins})

This could use some more documentation.

Britton

On Thu, May 7, 2020 at 9:27 AM Sean Larkin <seanfrancislarkin@gmail.com> wrote:
Hey Britton,

That was the issue, works exactly as intended now. I just have one other question about the override_bins part. I am currently making 3 different profiles, one for the gas, one for the darkmatter, and one for the stars. It seems like even with the same sphere object in yt, they use different bins. In order to make the bins between each profile the same, I have tried adding the dict asked for, but I am unsure of the proper formatting of this. I have tried a couple of different configurations, like the one posted below, but keep running into errors. I was unable to find anything in the documentation about such formatting for these types of dicts, do you know where such information is posted?

Here is one dict I tried, as well as the error message.

{(9, 26.321025738981803), (8, 23.39646732353938), (44, 128.6805702794666), (24, 70.18940197061814), (21, 61.41572672429087), (15, 43.86837623163633), (47, 137.45424552579385), (50, 146.22792077212114), (19, 55.566609893406024), (2, 5.849116830884845), (6, 17.547350492654534), (32, 93.58586929415752), (18, 52.642051477963605), (22, 64.3402851397333), (1, 2.9245584154424225), (7, 20.47190890809696), (28, 81.88763563238784), (36, 105.28410295592721), ('stars', 'particle_radius'), (29, 84.81219404783025), (37, 108.20866137136963), (41, 119.90689503313934), (43, 125.75601186402417), (35, 102.35954454048479), (38, 111.13321978681205), (25, 73.11396038606057), (49, 143.3033623566787), (20, 58.49116830884846), (0, 0.0), (45, 131.605128694909), (31, 90.6613108787151), (39, 114.05777820225448), (23, 67.26484355517572), (34, 99.43498612504237), (42, 122.83145344858174), (33, 96.51042770959995), (17, 49.717493062521186), (12, 35.09470098530907), (14, 40.94381781619392), (4, 11.69823366176969), (27, 78.96307721694541), (30, 87.73675246327267), (40, 116.98233661769692), (3, 8.773675246327267), (5, 14.622792077212114), (11, 32.17014256986665), (13, 38.019259400751494), (46, 134.52968711035143), (16, 46.79293464707876), (10, 29.24558415442423), (26, 76.03851880150299), (48, 140.37880394123627)}
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-a7f92b976f9a> in <module>
     27 
     28 rp_stars = yt.create_profile(sp, ('stars', 'particle_radius'), [('stars', 'particle_mass')], accumulation = True,
---> 29                              units = {('stars', 'particle_radius'): 'kpc', ('stars', 'particle_mass'): 'Msun'}, weight_field=None, override_bins=bins_dict)
     30 
     31 rp_darkmatter = yt.create_profile(sp, ('darkmatter', 'particle_radius'), [('darkmatter', 'particle_mass')], accumulation = True,

~/anaconda3/lib/python3.7/site-packages/yt/data_objects/profiles.py in create_profile(data_source, bin_fields, fields, n_bins, extrema, logs, units, weight_field, accumulation, fractional, deposition, override_bins)
   1058     extrema = sanitize_field_tuple_keys(extrema, data_source)
   1059     logs = sanitize_field_tuple_keys(logs, data_source)
-> 1060     override_bins = sanitize_field_tuple_keys(override_bins, data_source)
   1061 
   1062     if any(is_pfield) and not all(is_pfield):

~/anaconda3/lib/python3.7/site-packages/yt/data_objects/profiles.py in sanitize_field_tuple_keys(input_dict, data_source)
    960         dummy = {}
    961         for item in input_dict:
--> 962             dummy[data_source._determine_fields(item)[0]] = input_dict[item]
    963         return dummy
    964     else:

TypeError: 'set' object is not subscriptable
_______________________________________________
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org
https://mail.python.org/mailman3/lists/yt-users.python.org/
Member address: brittonsmith@gmail.com