<div dir="ltr">Hi Stuart,<div><br></div><div>Actually the more I look at this, the more I think it's probably quite easy to turn this into a data selector itself, avoiding the need for a cut region.  Should be straightforward to add it to selection_routines and selection_data_containers and have it work out of the box.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 16, 2015 at 6:20 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Jan 14, 2015 at 11:03 AM, Stuart Levy <span dir="ltr"><<a href="mailto:salevy@illinois.edu" target="_blank">salevy@illinois.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Using one of Sam's past e-mails to answer my own question, it at least syntactically works to use the '.uq' unit-quantity attribute of a YT object to get something that has the units of the object, so e.g. 0.78 * obj['x'].uq is 0.78 in x's length units.  So it actually seems to work to say:<br>
<br>
   cr = ds.cut_region( dd, ["obj['z']-(obj['x']**2 + obj['y']**2)/(2.0*obj['z'].uq) < 0.78*obj['z'].uq"])<br>
<br>
Neato!<br>
<br>
<br>
As it turns out, I'll look for another lower-level way to do this - with the above cut_region applied, 32GB of RAM isn't enough to process a single data field of about 512^3, and it takes several minutes of CPU time even to start.    But it's good to know that the above is possible.</blockquote><div><br></div></span><div>Glad you kind of got it working ... this is kind of ridiculous that it takes so much, though.  What I think could cut it dowen considerably is to reduce the numebr of sequential numpy operations; right now it's computing them and storing temporary arrays like crazy.  Unfortunately I don't know how one might do this with the current setup of cut_region.</div><div><br></div><div>Perhaps one way would be to make a derived field that is each component, and inside it do each operation inline, then apply the conditional there?</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
<br>
On 1/14/15 10:26 AM, Stuart Levy wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello yt people,<br>
<br>
I'm hoping to write a cut_region expression that (a) depends on position and (b) does it in a nonlinear way - I'd like to do a sort of paraboloidal cut, like<br>
<br>
    ds.cut_region(dd, "obj['z'] - (obj['x']**2 + obj['y']**2)/2.0 < 0.78")<br>
</blockquote></span>
er, correction - cut_region()'s 2nd arg is a [] list of strings rather than a string, so I'd tried<div><div><br>
<br>
          ds.cut_region(dd, ["obj['z'] - (obj['x']**2 + obj['y']**2)/2.0 < 0.78"])<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
But this runs afoul of the unit-checking - obj['z'] doesn't have the same units as obj['x']**2.<br>
<br>
Somehow I either need to cast all the obj[] terms to be dimensionless ("trust me, I promise it's right"), or else give dimensions of length to the constants.   Should there be a way to do either one?<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/<u></u>listinfo.cgi/yt-users-<u></u>spacepope.org</a><br>
</div></div></blockquote></span></div><br></div></div>
</blockquote></div><br></div>