_______________________________________________Hi,I am trying to create a filter for the field and apply it to a data in the following way:def density_threshold(field, data):
dens=data["gas", "density"].in_units('H/cm**3')
dens[dens < 50] = 0
return dens
ds.add_field(name=("gas", "density_threshold"), function=density_threshold, units="H/cm**3")
dd_1_c=ds.r[((com_x_1.value-1), "kpc"):((com_x_1.value+1), "kpc"),((com_y_1.value-1), "kpc"):((com_y_1.value+1), "kpc"),:]m_1_c=dd_1_c[("density_threshold", "cell_mass")].in_units('Msun')But cannot find the field:Traceback (most recent call last):
File "inflows-dense.py", line 68, in <module>
m_1_c=dd_1_c[("density_threshold", "cell_mass")].in_units('Msun')
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/data_objects/data_containers.py", line 274, in __getitem__
f = self._determine_fields([key])[0]
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/data_objects/data_containers.py", line 1121, in _determine_fields
finfo = self.ds._get_field_info(ftype, fname)
File "/home/samvad/yt-conda/lib/python3.6/site-packages/yt/data_objects/static_output.py", line 753, in _get_field_info
raise YTFieldNotFound((ftype, fname), self)
yt.utilities.exceptions.YTFieldNotFound: Could not find field '('density_threshold', 'cell_mass')' in info_00019.Is this not how the field data is to be accessed? Thanks in advance
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org