<div dir="ltr"><div>Hmmm, the "&" operator seems to work here!  I was having trouble using it, possibly with an earlier version of yt, which is why I went to chaining at all...<br><br></div><div>Thanks,<br></div><div>Stephanie<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div><div><font face="garamond,serif">--<br>Dr. Stephanie Tonnesen<br></font></div><font face="garamond,serif">Alvin E. Nashman Postdoctoral Fellow<br></font></div><font face="garamond,serif">Carnegie Observatories, Pasadena, CA<br></font></div><font face="garamond,serif"><a href="mailto:stonnes@gmail.com" target="_blank">stonnes@gmail.com</a><br></font></div></div></div>
<br><div class="gmail_quote">On Thu, Oct 8, 2015 at 9:26 AM, Kacper Kowalik <span dir="ltr"><<a href="mailto:xarthisius.kk@gmail.com" target="_blank">xarthisius.kk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 10/07/2015 07:24 PM, Stephanie Tonnesen wrote:<br>
> Hi Nathan and all,<br>
><br>
> I have pasted a code that shows my problem using the isolated galaxy<br>
> output.  You will have to change the line of code that reads in the<br>
> isolated galaxy output, but otherwise it should run for anyone.  See the<br>
> madness yourself!!!<br>
><br>
> <a href="http://paste.yt-project.org/show/5943/" rel="noreferrer" target="_blank">http://paste.yt-project.org/show/5943/</a><br>
><br>
> Thanks again,<br>
> Stephanie<br>
<br>
</span>Hi Stephanie,<br>
while we investigate possible issue with cut_region chaining could you<br>
try using single 'cut_region' call? You can create single mask using<br>
binary operators e.g.:<br>
<br>
r4 = ds.cut_region(["<br>
   (obj['Metal_Density']/obj['density'] > 0.33) &<br>
   (obj['x'].in_units('kpc') < 2.0) &<br>
   (obj['z'].in_units('kpc') >= 0.0)<br>
"])<br>
<br>
Cheers,<br>
Kacper<br>
<div class="HOEnZb"><div class="h5"><br>
> --<br>
> Dr. Stephanie Tonnesen<br>
> Alvin E. Nashman Postdoctoral Fellow<br>
> Carnegie Observatories, Pasadena, CA<br>
> <a href="mailto:stonnes@gmail.com">stonnes@gmail.com</a><br>
><br>
> On Wed, Oct 7, 2015 at 4:33 PM, Stephanie Tonnesen <<a href="mailto:stonnes@gmail.com">stonnes@gmail.com</a>><br>
> wrote:<br>
><br>
>> Hi Nathan,<br>
>><br>
>> Thanks for the quick response!  I will see if I can reproduce this on a<br>
>> test dataset.<br>
>><br>
>> Different is the confusing part to me.  These all should be selecting<br>
>> exactly the same region.  If P3 and P4 are trying to select a region from<br>
>> ds.all_data() instead of ds.disk() then all three should be different.<br>
>> Another strange thing, if I select x > 65 kpc (only the top half of the<br>
>> cylinder, then the volume is 3.7384e-4, half of the values that don't seem<br>
>> right to me!<br>
>><br>
>> If I do<br>
>> r4c = ds.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>> then the volume doesnt change, is 7.4768e-4<br>
>><br>
>> If I do:<br>
>> r4 = ds.all_data()<br>
>> r4c = r4.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>> then the volume is, as it should be, 0.3<br>
>><br>
>> *I think that something going wrong when I have more than one cut_region<br>
>> command.*  If I do:<br>
>><br>
>> r3 = ds.disk([0.5,0.5,0.5],[-1,0,0],(4,"kpc"),(2,"kpc"))<br>
>> r3c = r3.cut_region(["(obj['x'].in_units('kpc') > 60.0)"])<br>
>>  or<br>
>> r2 = ds.disk([0.5,0.5,0.5],[-1,0,0],(4,"kpc"),(2,"kpc"))<br>
>> r2c = r2.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>><br>
>> then the volume is 9.346e-5, as it should be.<br>
>><br>
>> But when I put those together:<br>
>><br>
>> r3 = ds.disk([0.5,0.5,0.5],[-1,0,0],(4,"kpc"),(2,"kpc"))<br>
>> r3r = r3.cut_region(["(obj['x'].in_units('kpc') > 60.0)"])<br>
>> r3c = r3r.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>><br>
>> the volume is 7.4768e-4 again!<br>
>><br>
>> And when I do this:<br>
>> r4 = ds.all_data()<br>
>> r4r = r4.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>> r4c = r4r.cut_region(["(obj['z'].in_units('kpc') > 0.0)"])<br>
>><br>
>> I get 2.4467, which is more than my box size.<br>
>><br>
>> --<br>
>> Dr. Stephanie Tonnesen<br>
>> Alvin E. Nashman Postdoctoral Fellow<br>
>> Carnegie Observatories, Pasadena, CA<br>
>> <a href="mailto:stonnes@gmail.com">stonnes@gmail.com</a><br>
>><br>
>> On Wed, Oct 7, 2015 at 3:30 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>><br>
>> wrote:<br>
>><br>
>>> Hi Stephanie,<br>
>>><br>
>>> I'm not sure off-hand why this is happening.<br>
>>><br>
>>> It may help one of us to be able to reproduce and understand what you're<br>
>>> seeing if you can phrase your question in the form of an example that one<br>
>>> of can run locally. This would make use of one of the test datasets on<br>
>>> <a href="http://yt-project.org/data" rel="noreferrer" target="_blank">yt-project.org/data</a>, and a full script that we can run locally pasted to<br>
>>> <a href="http://paste.yt-project.org/data" rel="noreferrer" target="_blank">paste.yt-project.org/data</a><br>
>>><br>
>>> Finally, just to clarify, the confusion is that the volumes of P3 and P4<br>
>>> are *bigger* than P2 and identical?<br>
>>><br>
>>> It might be the case that the derived quantity infrastructure is somehow<br>
>>> selecting the data as if it were selecting from ds.all_data() instead of<br>
>>> your disk selector.  Can you try computing what the total volume of cells<br>
>>> in a data object constructed by applying cut_regions on ds.all_data()<br>
>>> instead of ds.disk()?<br>
>>><br>
>>> -Nathan<br>
>>><br>
>>> On Wed, Oct 7, 2015 at 5:21 PM, Stephanie Tonnesen <<a href="mailto:stonnes@gmail.com">stonnes@gmail.com</a>><br>
>>> wrote:<br>
>>><br>
>>>> Dear yt-users,<br>
>>>><br>
>>>> I am running<br>
>>>><br>
>>>> Version = 3.2-dev<br>
>>>> Changeset = dc2467c4eae7 (yt) tip<br>
>>>><br>
>>>> I have been fiddling around with cut_region in a disk region and have<br>
>>>> gotten really confused.  I was initially trying to see whether defining a<br>
>>>> disk region such that the cylinder height was on the x-axis changed how I<br>
>>>> need to make a cut in the cylinder height.  Anyway, as I was fiddling with<br>
>>>> these cuts I found that if I made a "spatial" cut (rather than a different<br>
>>>> variable cut) I was getting different volumes.  Let me show you:<br>
>>>><br>
>>>> small bit of background:  the whole box is 130 kpc across, so 0.5 0.5<br>
>>>> 0.5 is 65 65 65 kpc.  Also, I am cutting and pasting bits here so the<br>
>>>> indentation is off.<br>
>>>><br>
>>>> ds =<br>
>>>> yt.load("/data/stonnes/dwarf_nowind_lowmassgal_bigtracer/DD"+loop[i]+"/DD44sMBhn25now"+loop[i])<br>
>>>><br>
>>>> r2 = ds.disk([0.5,0.5,0.5],[-1,0,0],(4,"kpc"),(2,"kpc"))<br>
>>>>     r2c = r2.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>>>><br>
>>>>     r3 = ds.disk([0.5,0.5,0.5],[-1,0,0],(4,"kpc"),(2,"kpc"))<br>
>>>>     r3r = r3.cut_region(["(obj['x'].in_units('kpc') > 63.0)"])<br>
>>>>     r3r = r3r.cut_region(["(obj['x'].in_units('kpc') < 67.0)"])<br>
>>>>     r3c = r3r.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>>>><br>
>>>>     r4 = ds.disk([0.5,0.5,0.5],[-1,0,0],(4,"kpc"),(2,"kpc"))<br>
>>>>     r4r = r4.cut_region(["(obj['x'].in_units('kpc') > 61.)"])<br>
>>>>     r4c = r4r.cut_region(["obj['Metal_Density']/obj['density'] > 0.33"])<br>
>>>><br>
>>>>  P2 =<br>
>>>> np.append(P2,r2c.quantities.total_quantity([("index","cell_volume")]))<br>
>>>>  P3 =<br>
>>>> np.append(P3,r3c.quantities.total_quantity([("index","cell_volume")]))<br>
>>>>  P4 =<br>
>>>> np.append(P4,r4c.quantities.total_quantity([("index","cell_volume")]))<br>
>>>><br>
>>>> P2 volume is 9.346e-5 : within 2% of my calculation for the volume I<br>
>>>> should be getting<br>
>>>> P3 volume is 7.4768e-4<br>
>>>> P4 volume is 7.4768e-4<br>
>>>><br>
>>>> When I print out the x- y- and z- maxes and mins, they are the same for<br>
>>>> each of the selected regions.<br>
>>>> (By doing this:<br>
>>>> m2 = np.append(m2,r2c.quantities.extrema([("index","z")])[0])<br>
>>>> rho2 = np.append(rho2,r2c.quantities.extrema([("index","z")])[1])<br>
>>>><br>
>>>> )<br>
>>>><br>
>>>> Can anyone help me figure out/tell me what is going on here?<br>
>>>><br>
>>>> Thanks!<br>
>>>> Stephanie<br>
>>>><br>
>>>> --<br>
>>>> Dr. Stephanie Tonnesen<br>
>>>> Alvin E. Nashman Postdoctoral Fellow<br>
>>>> Carnegie Observatories, Pasadena, CA<br>
>>>> <a href="mailto:stonnes@gmail.com">stonnes@gmail.com</a><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> yt-users mailing list<br>
>>>> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>>>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
>>>><br>
>>>><br>
>>><br>
>>> _______________________________________________<br>
>>> yt-users mailing list<br>
>>> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
>>> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
>>><br>
>>><br>
>><br>
><br>
><br>
><br>
> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
<br>
<br>
</div></div><br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>