Closed kuochuanpan closed 6 years ago
I'm able to reproduce this issue. Thank you for the report.
This is happening because my_field2
is not returning data of the correct shape. yt fields should always return data of the same shape as the fields that are passed into it, but my_field2
includes a boolean condition that drops some data.
Can you explain a little more what you are ultimately trying to do with my_field2
? Perhaps what you really want to do is add more conditions to your cut_region
?
We should probably not allow people to write fields like my_field2
since it breaks a basic assumption we are making about the shapes of data returned by yt field functions.
Thank you very much for your help. Actually what I want to do can be all done in the cut_region
but my original region has a physical meaning (in my case, region not including the neutron star) and might be used to other quantities. The filter in my_field also has physical meaning. In practice, I could define more conditions in the cut_region
and that should work but why my_field2
works in ds.all_data()
?
The fact that ad['my_field2']
worked without raising an error is probably a bug in yt. Right now we don't do much in terms of validating that yt field functions return data with shapes that make sense, given the assumptions that exist elsewhere in yt.
I'm going to try to synthesize this discussion into another issue about validating the shapes of returned data from user-defined fields, at which point I will close this issue.
Thank you very much! Then I will just use cut_region
in my problem.
Closed in favor of #2057
Bug report
yt version: 3.5.dev0 (python3) data: FLASH data :
sedov_hdf5_chk_0003
I want to cut out some region to speed up the calculation but found that yt will assume my data has particles but I am not using any particles in my data set.
Bug summary
See the below code example to reproduce the bug.
my_field
works but if I add some filter inmy_filed2
then it crashed. However,my_field2
works withall_data()
but not with cut_region.Code for reproduction
I could reproduce this bug with the public sedov3d data set.
Actual outcome
Expected outcome
Version Information