Using 'density' method for smooth() function

Hi all,
I'm trying to use the 'density' method for the smooth() function (which points to the class SmoothedDensityEstimate), but I can't find any documentation about how to use the 'density' method of smooth (i.e. what fields, index fields, etc. I should feed it.) Could someone give me an example of how this method should be used? I'm using yt 3.6 with FLASH particle data. The link to the SmoothedDensityEstimate class code is https://github.com/yt-project/yt/blob/6befef2bc0427250fd62395962599be41b193e....
Thanks, Camryn

Hi Camryn,
Good question. This is generally used internally, but it can be called externally with the right work. Usually, fields are set up that have the field type "deposit", so things like, ("deposit", "all_density") would be a density deposition of the "all" particle type. This should still work for FLASH datasets. But, if you want to set it up yourself, you can take a look at how it's done in yt/fields/particle_fields.py in the particle_deposition_functions function, which accepts a particle type, the name of the coordinates for that particle type, the name of the mass field for that particle type, and the field registry (ds.field_info) to insert the fields into.
Let us know if that helps!
-Matt
On Mon, Aug 3, 2020 at 8:35 AM clp3ef@virginia.edu wrote:
Hi all,
I'm trying to use the 'density' method for the smooth() function (which points to the class SmoothedDensityEstimate), but I can't find any documentation about how to use the 'density' method of smooth (i.e. what fields, index fields, etc. I should feed it.) Could someone give me an example of how this method should be used? I'm using yt 3.6 with FLASH particle data. The link to the SmoothedDensityEstimate class code is https://github.com/yt-project/yt/blob/6befef2bc0427250fd62395962599be41b193e... .
Thanks, Camryn _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: matthewturk@gmail.com

Hi Matthew,
Thanks for the info! Unfortunately, when I try the input ptype = 'passive_part' #custom particle type pos = data[ptype, 'particle_position'] pmass = data[ptype, 'passive_mass'] d = data.smooth(pos, fields=[pmass], method='density') I get a segmentation fault inside data.smooth().
I've used yt's particle deposition functions often with FLASH data and they've worked well, but I need to smooth my particles over more cells than the CIC deposit method is able to. I was hoping to use the 'density' function of smooth() since add_volume_weighted_smoothed_field requires particle density as an input, a field which I don't have, but the 'density' method does not.
Camryn

Hi Camryn,
Hmm, good point. OK, so, I need to think this over, but my guess is that you could still make this work without having to modify any Cython code. If you hop onto slack we might be able to work through it with faster iteration.
On Thu, Aug 6, 2020 at 9:28 AM clp3ef@virginia.edu wrote:
Hi Matthew,
Thanks for the info! Unfortunately, when I try the input ptype = 'passive_part' #custom particle type pos = data[ptype, 'particle_position'] pmass = data[ptype, 'passive_mass'] d = data.smooth(pos, fields=[pmass], method='density') I get a segmentation fault inside data.smooth().
I've used yt's particle deposition functions often with FLASH data and they've worked well, but I need to smooth my particles over more cells than the CIC deposit method is able to. I was hoping to use the 'density' function of smooth() since add_volume_weighted_smoothed_field requires particle density as an input, a field which I don't have, but the 'density' method does not.
Camryn _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org https://mail.python.org/mailman3/lists/yt-users.python.org/ Member address: matthewturk@gmail.com
participants (2)
-
clp3ef@virginia.edu
-
Matthew Turk