Question: file format recognition for GAMER
Dear all, 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? 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 : ) Sincerely, Hsi-Yu
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
Dear Kacper and Nathan, Thank you very much for the prompt and helpful suggestions!! I'll follow the suggestions and try to visualize the GAMER data. Thanks! Sincerely, Hsi-Yu ----- Original Message ----- From: Kacper Kowalik To: yt-dev@lists.spacepope.org Sent: Monday, October 29, 2012 4:16 PM Subject: Re: [yt-dev] Question: file format recognition for GAMER _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
Hi Hsi-Yu, To add on to what Kacper said, you'll probably find this wiki entry useful: https://bitbucket.org/yt_analysis/yt/wiki/AddingSupportForANewCode -Nathan On 10/29/12 1:00 AM, Hsi-Yu Schive wrote:
Dear all, 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? 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 : ) Sincerely, Hsi-Yu
_______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
participants (3)
-
Hsi-Yu Schive
-
Kacper Kowalik
-
Nathan Goldbaum