[yt-dev] Need help to create new frontend

Grassinger, Daniel d.grassinger at hzdr.de
Fri Sep 18 08:01:16 PDT 2015


Hi Matt,

thank you for your advice. Actually my code works so far as I can plot all of 
my Fluid fields.

But my file format also contains two different kinds of particles. For me it 
seems that the functions "_read_particle_fields" and "_read_particle_coords" 
in "io.py" are not called. (I don't exactly know how "yield" works).

Also i want to ask in witch part of the code is defined that a field is a 
particle field or fluid field.

Thank you for your help.

-Daniel

Am Thu, 17 Sep 2015 23:14:17 -0500 schrieb Matthew Turk 
<matthewturk at gmail.com>:
> Hi Daniel,
> 
> Thanks for writing -- glad to hear you've had some success with writing
> your frontend!
> 
> The io.py file could be better documented, and I will use this email as the
> basis for such documentation at my earliest ability.  The io.py file is
> where the IOHandler is defined; there are a handful of methods to
> implement, depending on the specific type of indexing system your data
> uses.  If it is grid-based, then this is relatively simple (although
> implementing more advanced things like caching and the like requires a bit
> more effort) and it can simply be this:
> 
> class MyIOHandler(BaseIOHandler):
>    _dataset_type = "my_dataset_type"
>    def _read_particle_coords(self, chunks, ptf):
>        # ptf is a dict, where the keys are the particle types, and the
> values are the fields to read
>        # this routine must yield a tuple of the form (ptype_name,
> (x_coords, y_coords, z_coords))
> 
>    def _read_particle_fields(self, chunks, ptf, selector):
>        # this routine is similar to the above, but it yields a selected
> set of particles -- for instance, using selector.select_points on the x,y,z
> coordinate arrays.
>        # This must yield a tuple of the form ((ptype_name, field_name),
> data_array)
> 
>    def _read_fluid_selection(self, chunks, selector, fields, size):
>        # this routine reads mesh values from disk.  The routine *returns*
> a dictionary of the form {field: value} for each field, and it uses the
> selectors in the chunks.gobjs to choose which values to mask.
> 
> The FLASH frontend is relatively short and good to use as a reference for
> this, and I'd suggest checking it out.  I hope that this has helped, and
> let us know if you run into anything else!
> 
> -Matt
> 
> On Wed, Sep 16, 2015 at 9:59 AM, Grassinger, Daniel <d.grassinger at hzdr.de>
> wrote:
> 
>> Hi developers,
>>
>> I make an internship at a German reasearcher institute. My job is to write
>> a frontend for yt to load a special kind of HDF5 files. Most parts of the
>> code are are working now. So the yt.load() function create a dataset
>> without throwing errors.
>>
>> But I have still some erros when I wand to make a plot.
>> The reason is I have problems with the code in the io.py.
>>
>> Can you please help me with further explanation of the class in io.py.
>>
>>
>> Thank you for helping.
>>
>>
>> Daniel Grassinger
>> _______________________________________________
>> 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