[yt-dev] particle filter example

Matthew Turk matthewturk at gmail.com
Mon Dec 2 07:41:51 PST 2013


That looks like a failure to convert correctly.  What goes on during
instantiation is that for each particle type, the function
_setup_particle_type is called on EnzoStaticOutput.  Then the
_setup_particle_fields from enzo/fields.py gets called, which should
set the "particle_mass" function to convert based on Density * cm**3.
(Note that we now -- in _read_particle_fields -- multiply by the
grid.dds.prod, so it doesn't need that anywhere else anymore.)

Can you check what pf._get_field_info("DarkMatter", "particle_mass")
has for its _convert_function ?  It should be a function called
_convertParticleMass.

I have to go for a few hours, but I can look at an E3 dataset when I get back.

-Matt

On Mon, Dec 2, 2013 at 10:33 AM, Britton Smith <brittonsmith at gmail.com> wrote:
> I am getting this with just "DarkMatter" and "CenOstriker", which are not
> exactly filters (or maybe they are), but the particle types as they are
> stored on disk by Enzo-3.0.
>
>
> On Mon, Dec 2, 2013 at 3:30 PM, Matthew Turk <matthewturk at gmail.com> wrote:
>>
>> On Mon, Dec 2, 2013 at 10:29 AM, Britton Smith <brittonsmith at gmail.com>
>> wrote:
>> > Hi Matt,
>> >
>> > Thanks, that's very helpful.
>> >
>> > I have an additional question.  When I do:
>> > ad = pf.h.all_data()
>> > ad['particle_mass'] or
>> > ad['all', 'particle_mass']
>> >
>> > I get numbers that are ~1e44, which sounds about right if it's in grams.
>> > However, when I do:
>> > ad['DarkMatter', 'particle_mass']
>> >
>> > I get numbers that are ~1e-5, which I am guessing is the unconverted
>> > particle_mass straight out of the file.  How can get the filtered
>> > particles
>> > in proper units as well?
>> >
>>
>> Hm, that looks like a bug to me.  What's your filter look like, so I
>> can reproduce this here?
>>
>> > Thanks again,
>> > Britton
>> >
>> >
>> > On Mon, Dec 2, 2013 at 3:21 PM, Matthew Turk <matthewturk at gmail.com>
>> > wrote:
>> >>
>> >> Hey Britton,
>> >>
>> >> On Mon, Dec 2, 2013 at 10:15 AM, Britton Smith <brittonsmith at gmail.com>
>> >> wrote:
>> >> > Hi all,
>> >> >
>> >> > Can someone point me to an example (docs, notebooks, emails,
>> >> > whatever)
>> >> > of
>> >> > defining a custom particle filter for yt-3.0?  I'm trying to do this
>> >> > and
>> >> > I
>> >> > know I've seen discussion of this before, but I can't find where.
>> >> >
>> >>
>> >> Yup.  Here's an example:
>> >>
>> >>
>> >>
>> >> http://nbviewer.ipython.org/url/hub.yt-project.org/notebooks/534fd19b933e4a3fa002db91f58fb817.ipynb
>> >>
>> >> Looks like the nbviewer is down though.
>> >>
>> >> Sorry I haven't done much documenting of this.  Particle filters and
>> >> particle unions are two really cool things that are currently only in
>> >> example form.  Here's another example of how to define one:
>> >>
>> >>
>> >>
>> >> https://bitbucket.org/mornkr/agora-analysis-script/src/1200830cd1e8d7dc60f66c8f1dc7c09764ca3276/script-Flagship-DM.py?at=default#cl-33
>> >>
>> >> and you have to add this by name to each pf you open up:
>> >>
>> >>
>> >>
>> >> https://bitbucket.org/mornkr/agora-analysis-script/src/1200830cd1e8d7dc60f66c8f1dc7c09764ca3276/script-Flagship-DM.py?at=default#cl-57
>> >>
>> >> Note that you have to specify *all* the required filtering fields in
>> >> the constructor for the function.
>> >>
>> >> -Matt
>> >>
>> >> > Thanks,
>> >> > Britton
>> >> >
>> >> > _______________________________________________
>> >> > yt-dev mailing list
>> >> > yt-dev at lists.spacepope.org
>> >> > http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>> >> >
>> >> _______________________________________________
>> >> yt-dev mailing list
>> >> yt-dev at lists.spacepope.org
>> >> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>> >
>> >
>> >
>> > _______________________________________________
>> > yt-dev mailing list
>> > yt-dev at lists.spacepope.org
>> > http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>> >
>> _______________________________________________
>> yt-dev mailing list
>> yt-dev at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
>
>
> _______________________________________________
> yt-dev mailing list
> yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>



More information about the yt-dev mailing list