[yt-users] phaseplot set zlim

Stephanie Tonnesen stonnes at gmail.com
Tue Mar 28 10:48:13 PDT 2017


Sure.  It is pretty ugly, let me try to clean it up a little bit...

Okay, so for the first one, without the mass cut, diska and diskb were set
in the commented out lines and there was no disk2a or disk3b.  The plot
commands were all the same.  The rest of the code is just setting the
loop.  Let me know if you want the whole code.

Here it is:

i =0
while i < len(loop):
    ds =
yt.load("/data001/stonnes/BPr16vs30arccw/DD"+loop[i]+"/BPr16vs30arccw"+loop[i])

    disk2 = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(5,"kpc"))
    disk3 = ds.disk([0.5,0.5,0.5],[0,0,-1.0],(40,"kpc"),(10,"kpc"))

    disk2a = disk2.cut_region(["obj['Metal_Density']/obj['density'] > 0.5"])
    diska = disk2a.cut_region(["obj['cell_mass'] > 1e36"])
    #diska = disk2.cut_region(["obj['Metal_Density']/obj['density'] > 0.5"])

    disk3b = disk3.cut_region(["obj['Metal_Density']/obj['density'] > 0.5"])
    diskb = disk3b.cut_region(["obj['cell_mass'] > 1e36"])
    #diskb = disk3.cut_region(["obj['Metal_Density']/obj['density'] > 0.5"])


    plot2 =
yt.PhasePlot(diska,"density","temperature",["cell_mass"],weight_field=None)
    plot2.set_zlim('cell_mass',1e36,5e42)
    plot2.save('BPr16vs30arccw'+loop[i]+'_5kpc_mcut')

    plot2 =
yt.PhasePlot(diskb,"density","temperature",["cell_mass"],weight_field=None)
    plot2.set_zlim('cell_mass',1e36,5e42)
    plot2.save('BPr16vs30arccw'+loop[i]+'_10kpc_mcut')

    i = i+1

--
Dr. Stephanie Tonnesen
Alvin E. Nashman Postdoctoral Fellow
Carnegie Observatories, Pasadena, CA
stonnes at gmail.com

On Tue, Mar 28, 2017 at 9:53 AM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> Hmm, that is strange, I didn't notice that earlier. It might be a bug? I'd
> need to take a closer look at it. Is there any chance you can share the
> script you used to make those two plots?
>
> On Tue, Mar 28, 2017 at 11:40 AM, Stephanie Tonnesen <stonnes at gmail.com>
> wrote:
>
>> Awesome!  This looks like exactly what I want to do, thanks!
>>
>> But here was my problem with the histograms--the gap made sense, just
>> like you said.  What was really strange was that more of the histogram bins
>> were yellow in the "mcut" histogram--which has less mass to work with!  So
>> why did cutting out the low mass gas make more of the histogram have higher
>> masses (the yellow)?  This isn't dire, I am just wondering so I can
>> understand better how the code works.
>>
>> Thanks,
>> Stephanie
>>
>>
>> --
>> Dr. Stephanie Tonnesen
>> Alvin E. Nashman Postdoctoral Fellow
>> Carnegie Observatories, Pasadena, CA
>> stonnes at gmail.com
>>
>> On Tue, Mar 28, 2017 at 6:39 AM, Nathan Goldbaum <nathan12343 at gmail.com>
>> wrote:
>>
>>> Ah sorry, I gave you bad advice in my initial e-mail.
>>>
>>> The cut_region selects individual cells in your simulation that have
>>> masses greater than the cutoff you chose. However that's not what the
>>> profile is giving you. It's showing you regions in density-temperature
>>> parameter space, with each box in this parameter space getting
>>> contributions from several zones in your simulation. The reason your
>>> PhasePlot made from the cut_region has "holes" you weren't expecting is
>>> that those regions are the ones preferentially filled by low-mass zones in
>>> your simulation.
>>>
>>> To get the plot you want you're going to need to mask out the 2D profile
>>> PhasePlot uses to create the 2D histogram plot. The most straightforward
>>> way to do this is to create the profile object manually using
>>> create_profile, tweak it by zeroing out histogram bins that don't contain
>>> enough mass, and then create a PhasePlot from the profile object using
>>> PhasePlot.from_profile.
>>>
>>> Here's a worked example showing how to do this:
>>>
>>> https://gist.github.com/3a2afd006be4d1918f28d98ef2a1e077
>>>
>>> Again, apologies for giving you bad advice on this issue initially, hope
>>> this example helps.
>>>
>>> -Nathan
>>>
>>> On Tue, Mar 28, 2017 at 1:32 AM Stephanie Tonnesen <stonnes at gmail.com>
>>> wrote:
>>>
>>> Just to be clear, I *do* have weight_field=none set.
>>>
>>>
>>>
>>> --
>>> Dr. Stephanie Tonnesen
>>> Alvin E. Nashman Postdoctoral Fellow
>>> Carnegie Observatories, Pasadena, CA
>>> stonnes at gmail.com
>>>
>>> On Mon, Mar 27, 2017 at 11:29 PM, Stephanie Tonnesen <stonnes at gmail.com>
>>> wrote:
>>>
>>> Hi Nathan and yt-users,
>>>
>>> So I used the cut_region to only select cells with cell_mass > 1e36, and
>>> got a surprising plot (I think).  I am attaching both 2d profiles here for
>>> comparison.  I am not surprised that there are unfilled regions of the
>>> figure--those may have been filled with cells that had less than 1e36 g,
>>> although the positions are a bit strange.  What I find really surprising is
>>> that so much more of the figure that has the mass cut is yellow--shoudn't
>>> there be equal or less mass than when I am not making a cut?
>>>
>>> Thanks,
>>> Stephanie
>>>
>>>
>>> --
>>> Dr. Stephanie Tonnesen
>>> Alvin E. Nashman Postdoctoral Fellow
>>> Carnegie Observatories, Pasadena, CA
>>> stonnes at gmail.com
>>>
>>> On Sun, Mar 26, 2017 at 6:38 PM, Stephanie Tonnesen <stonnes at gmail.com>
>>> wrote:
>>>
>>> Hi Nathan,
>>>
>>> Thanks!  I was hoping there was a way to do this within the plotting
>>> commands, but that will definitely work.
>>>
>>> Stephanie
>>>
>>> On Sun, Mar 26, 2017 at 4:21 PM Nathan Goldbaum <nathan12343 at gmail.com>
>>> wrote:
>>>
>>> Hi Stephanie,
>>>
>>> One way to do this would be to create the PhasePlot using a cut_region
>>> data object. If you're already using another data object to construct your
>>> phase plot, the cut_region could be passed to the other data object via the
>>> data_source keyword argument.
>>>
>>> Nathan
>>>
>>> On Sun, Mar 26, 2017 at 4:24 PM Stephanie Tonnesen <stonnes at gmail.com>
>>> wrote:
>>>
>>> Hi yt-users,
>>>
>>> I am trying to make some nice looking phaseplots, and want to set the
>>> mass range that I show in the figure.  I use set_zlim and instead of only
>>> showing the cells that call into that mass range, it just changes the color
>>> coding.  You can see the attached for what I am talking about.  Is there a
>>> way to have phaseplot only show me the cells that have "cell_mass" larger
>>> that 1e36 (or whatever I happen to set)?
>>>
>>> Thanks!
>>>
>>> Stephanie
>>>
>>> --
>>> Dr. Stephanie Tonnesen
>>> Alvin E. Nashman Postdoctoral Fellow
>>> Carnegie Observatories, Pasadena, CA
>>> stonnes at gmail.com
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>> --
>>> --
>>> Dr. Stephanie Tonnesen
>>> Alvin E. Nashman Postdoctoral Fellow
>>> Carnegie Observatories, Pasadena, CA
>>> stonnes at gmail.com
>>>
>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170328/3b59297c/attachment-0001.htm>


More information about the yt-users mailing list