[yt-dev] Need help to create new frontend

Matthew Turk matthewturk at gmail.com
Thu Sep 17 21:14:17 PDT 2015


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20150917/7989396b/attachment.html>


More information about the yt-dev mailing list