[yt-users] cut_region: can I make an expression dimensionless?

Nathan Goldbaum nathan12343 at gmail.com
Fri Jan 16 16:56:41 PST 2015


On Wed, Jan 14, 2015 at 9:03 AM, Stuart Levy <salevy at illinois.edu> wrote:

> 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:
>
>    cr = ds.cut_region( dd, ["obj['z']-(obj['x']**2 +
> obj['y']**2)/(2.0*obj['z'].uq) < 0.78*obj['z'].uq"])
>
> Neato!
>
>
> 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.
>

That's right, cut_regions are implemented at a relatively high level, and
will not be terribly memory efficient.  I think a low-level cut_region
selector would be a really cool, useful project.


>
> On 1/14/15 10:26 AM, Stuart Levy wrote:
>
>> Hello yt people,
>>
>> 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
>>
>>     ds.cut_region(dd, "obj['z'] - (obj['x']**2 + obj['y']**2)/2.0 < 0.78")
>>
> er, correction - cut_region()'s 2nd arg is a [] list of strings rather
> than a string, so I'd tried
>
>           ds.cut_region(dd, ["obj['z'] - (obj['x']**2 + obj['y']**2)/2.0 <
> 0.78"])
>
>
>> But this runs afoul of the unit-checking - obj['z'] doesn't have the same
>> units as obj['x']**2.
>>
>> 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?
>>
>
> _______________________________________________
> 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/20150116/03db364b/attachment.html>


More information about the yt-users mailing list