[yt-dev] Question: file format recognition for GAMER
Kacper Kowalik
xarthisius.kk at gmail.com
Mon Oct 29 01:16:23 PDT 2012
On 10/29/2012 09:00 AM, Hsi-Yu Schive wrote:
> Dear all,
>
Hi Hsi-Yu!
> I have two simple questions about adding support of GAMER in yt.
>
> 1. How does YT distinguish between data generated from different codes?
> For example, if I want to do something like
>
> pf = load( "GAMER_Data0000" )
>
> to load the GAMER data, how to make YT realize that it is GAMER output instead of, for example, Enzo or FLASH data?
> What kind of information I should provide in the "frontends/gamer/XXX.py" scripts and the GAMER output file "GAMER_Data0000"
> in order to achieve that?
That can be achieved by defining _is_valid classmethod in
frontends/gamer/data_structures.py. It's enough to check for just one
feature (like attribute name) that discerns your format from all the
others and 'return True else pass' if it's found.
>
> 2. After I implement all routines in the "frontends/gamer/XXX/py" scripts, how to recompile YT so that I could test
> whether the GAMER data can be loaded and analyzed successfully? From the information on the "How to Develop yt" website,
> it seems that I should try:
>
> cd $YT_DEST/src/yt-hg/
> python setup.py develop
>
> I was wondering whether that's exactly what I should do to test the new scripts?
> Thanks in advance for any help : )
After you set up all routines in frontends/gamer make sure you import
them in yt/mods.py:
from yt.frontends.gamer.api import \
...all_your_methods...
Doing 'setup.py develop' will create links in proper places of your root
filesystem, so whenever you'll run yt it will be actually using working
copy of your repository. That's handy cause most of the changes will
instantaneously be ready to use, and no "recompilation" will be needed.
The fastest way to check if frontend actually works would be to run:
yt stats GAMER_Data0000
If it shows basic statistics like time, physical domain sizes, datasets
then you got it right ;-)
Cheers,
Kacper
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/attachments/20121029/5ee0b30b/attachment.sig>
More information about the yt-dev
mailing list