Question about YT Filter Part

Hi, everyone!
I met trouble when I used YT-fliter part.
At first, I have tried exclude_ function, however, it said that there is no such an attribute. The version of my YT is 3.5.0, I donnot know if it is because of the old version. Here is the error info: ------------------------------------------------------------------------------------------------------------------------------- File "vorfield.py", line 85, in <module> vort_ds=ds.exclude_inside(('boxlib','vort_z'),-1e3,1e3)
P000 yt : [ERROR ] 2022-01-26 17:34:53,155 AttributeError: 'BoxlibDataset' object has no attribute 'exclude_inside' application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0
--------------------------------------------------------------------------------------------------------------------------------
Then I tried cut_region function, however, it said that some argument is lost and I donnot know why. Here is the error info: --------------------------------------------------------------------------------------------------------------------------------------------- File "vorfield.py", line 82, in <module> vort_ds = ds.cut_region(['(obj["boxlib", "vort_z"] > 1e3)'])
P000 yt : [ERROR ] 2022-01-26 17:07:37,086 TypeError: __init__() missing 1 required positional argument: 'conditionals' application called MPI_Abort(MPI_COMM_WORLD, 1) - process 0 ----------------------------------------------------------------------------------------------------------------------------------------------
I will be appreciate if anybody can help me!
Thank all!
He Yifeng

Hello!
I'm not sure about exclude_inside, but when using cut_region, you have to specify a selection object. So either use cut_region hanging off of the selection as follows:
import yt ds = yt.load("Enzo_64/DD0042/data0042") ad = ds.all_data() hot_ad = ad.cut_region(['obj["gas", "temperature"] > 1e6'])
OR, if using cut_region off the dataset object (as you are doing), you need to also provide the selection object as the first argument, followed by the conditionals:
ad = ds.all_data() hot_ad = ds.cut_region(ad, ['obj["gas", "temperature"] > 1e6'])
Hope that helps!
Best,
Chris
participants (2)
-
Chris Havlin
-
贺一峰