Dear yt users,Hi, I have a question on derived field. I want to define "Dark Matter cell mass", which can be defined by (Dark matter density) * (cell_volume). To check that "Dark Matter cell mass" defined well, I also tried to define "my_cell_mass", which should give the same value as the default 'cell_mass', but it gave me an error, and I don't have any idea what the problem is. Could you help me with the problem?I'm working on Enzo data.Here is my python code (I'm sorry that it's lengthy):import ytfrom yt.data_objects.particle_filters import add_particle_filter def stars(pfilter, data):filter = data[(pfilter.filtered_type, "particle_type")] == 2return filterdef DMparticles(pfilter, data):filter = data[(pfilter.filtered_type, "particle_type")] == 1return filteradd_particle_filter("stars", function=stars, filtered_type='io',requires=["particle_type"])add_particle_filter("DMparticles", function=DMparticles, filtered_type='io', requires=["particle_type"]) def only_DM(field, data):return data['deposit','DMparticles_density'] def DM_in_cell_mass(field, data):return (data['only_DM_Density']*data['cell_volume']) def my_cell_mass(field, data):return (data['density']*data['cell_volume']) ds_all=yt.load("/.../redshift00??") ds_all.add_particle_filter('stars') ds_all.add_particle_filter('DMparticles') ds_all.add_field(("gas", "only_DM_Density"), units="g/cm**3", function=only_DM)ds_all.add_field(("gas", "DM_in_cell_mass"), units="g", function=DM_in_cell_mass)ds_all.add_field(("gas", "my_cell_mass"), units="g", function=my_cell_mass)sp = ds_all.sphere([centerx, centery, centerz], ((somevalue), "kpc"))sp['cell_volume']YTArray([ 4.44089210e-16, 4.44089210e-16, 4.44089210e-16, ..., 6.93889390e-18, 6.93889390e-18, 6.93889390e-18]) code_length**3sp[('gas', 'my_cell_mass')]YTFieldNotFound: Could not find field '('gas', 'my_cell_mass')' in redshift00??.
Best,Y.T.
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope. org