[yt-dev] Issue #933: linear bins in create_profile crash (yt_analysis/yt)

Stephanie Tonnesen issues-reply at bitbucket.org
Tue Nov 4 15:48:04 PST 2014


New issue 933: linear bins in create_profile crash
https://bitbucket.org/yt_analysis/yt/issue/933/linear-bins-in-create_profile-crash

Stephanie Tonnesen:

I am trying to make a profile of column density vs radius of a galaxy disk using create_profile.  I would like linear bins, but cannot make it work.  After some back-and-forth, Nathan Goldbaum thinks that it is a bug.  Here is the code, using the RamPressureStripping available data.  

import yt
units_override = {"length_unit":(26,"kpc"),"time_unit":(3.086e14,"s"),"mass_unit":(5.165e39,"g")}
ds = yt.load("Downloads/RamPressureStripping/id0/rps.0062.vtk",
             units_override=units_override)
alld = ds.all_data()
gal = alld.cut_region("obj['density'] > 1.01e-25")
logs = {('index', 'cylindrical_r'): False}
profile = yt.create_profile(gal,
                            [('index', 'cylindrical_r')],          # the bin field
                            [('gas', 'cell_mass')],  # profile field
                            weight_field=None, n_bins=17,logs=logs)
coldens = profile["gas","cell_mass"]/1.6733e-24
coldens[0] = coldens[0]/(3.14159*profile.x[0]*profile.x[0])
i = 1
while i < len(coldens):
    coldens[i] = coldens[i]/((3.14159*profile.x[i]*profile.x[i]) - (3.14159*profile.x[i-1]*profile.x[i-1]))
    i = i+1
mp.plot(profile.x/3.086e21,coldens)
mp.show()
print profile.x





More information about the yt-dev mailing list