yt.analysis_modules.halo_analysis.enzofof_merger_tree module
Dear all: Recently, I try to get the merger-tree for my Enzo simulation. The halo catalogs can be obtained by HaloCatalog or FOFHaloFinder correctly. But it will be wrong when I use these halo lists and catalogs to get their merger tree. Here is my code and the Error-message: Code: ts = yt.load("DD????/DD????") for ds in ts: halo_list = FOFHaloFinder(ds) i = int(ds.basename[2:]) halo_list.write_out("FOF/groups_%05i.txt" % i) halo_list.write_particle_lists("FOF/particles_%05i" % i) mt = EnzoFOFMergerTree(external_FOF=False) for i in range(20): mt.build_tree(i) mt.save_halo_evolution('halos.h5') for i in range(20): plot_halo_evolution('halos.h5', i) Error Message: TypeError: '<' not supported between instances of 'str' and 'int'. This error is from the commander of mt.build_tree(i), for the other commanders can work well. I try to figure it out and check the yt code, but it still show me this wrong message. Hopefully for your help! Xiaoli Lian
Can you share the full traceback you see along with the error message?
On Wed, May 9, 2018 at 9:07 PM
Dear all: Recently, I try to get the merger-tree for my Enzo simulation. The halo catalogs can be obtained by HaloCatalog or FOFHaloFinder correctly. But it will be wrong when I use these halo lists and catalogs to get their merger tree. Here is my code and the Error-message: Code: ts = yt.load("DD????/DD????") for ds in ts: halo_list = FOFHaloFinder(ds) i = int(ds.basename[2:]) halo_list.write_out("FOF/groups_%05i.txt" % i) halo_list.write_particle_lists("FOF/particles_%05i" % i) mt = EnzoFOFMergerTree(external_FOF=False) for i in range(20): mt.build_tree(i) mt.save_halo_evolution('halos.h5') for i in range(20): plot_halo_evolution('halos.h5', i) Error Message: TypeError: '<' not supported between instances of 'str' and 'int'. This error is from the commander of mt.build_tree(i), for the other commanders can work well. I try to figure it out and check the yt code, but it still show me this wrong message. Hopefully for your help! Xiaoli Lian _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Here is the whole traceback: Traceback (most recent call last): File "./merger-tree.py", line 27, in <module> mt.build_tree(i) File "/home/xllian/.local/lib/python3.6/site-packages/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py", line 404, in build_tree max_children)] File "/home/xllian/.local/lib/python3.6/site-packages/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py", line 229, in __init__ sorted_keys = sorted(tree.relationships[output_num][halo_id].keys()) TypeError: '<' not supported between instances of 'str' and 'int' Thank you for your reply!
Did you find out what is wrong about this, I tried to find out the difference of .key() in python2 and python3, but it doesn't work well eight.
We are mostly on US time, so I doubt anyone has had a chance to look since
you replied to my question last night.
It’s not immediately obvious what the problem is just from looking at the
traceback or your script.
Somehow ints and strings are being mixed as the keys to a dict. This is a
problem when we try to sort the keys, since comparisons aren’t allowed
between those two types in Python3.
Is there any chance you can reproduce this issue using one of the public
test datasets at yt-project.org/data? If so, please reply with a copy of
the full test script that one of us can copy/paste and run locally. That
will make it easier for one of us to debug the issue you’ve run into on our
local system.
Failing that you can share one of your datasets using the “yt upload”
command line tool. Just create a tarball containing a dataset, do “yt
upload file.tar.gz”, and then share the link that prints out when the
upload finishes. This requires sharing the data publicly, so if you’re not
comfortable with that don’t do it.
Best,
Nathan
On Thu, May 10, 2018 at 8:00 AM
Did you find out what is wrong about this, I tried to find out the difference of .key() in python2 and python3, but it doesn't work well eight. _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Thanks for your help, and I will try your advice. And I will learn to use the 'yt upload', for I don't konw this before.
I tried my code using the public dataset in yt named "Enzo_64" downloaded from yt web. And I got the same error like: Traceback (most recent call last): File "./merger-tree.py", line 27, in <module> mt.build_tree(i) File "/mnt/ddnfs/data_users/xllian/software/yt/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py", line 404, in build_tree max_children)] File "/mnt/ddnfs/data_users/xllian/software/yt/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py", line 229, in __init__ sorted_keys = sorted(tree.relationships[output_num][halo_id].keys()) TypeError: '<' not supported between instances of 'str' and 'int' And my code is like: #!/usr/bin/env python3 import yt import matplotlib.pyplot as plt from yt.analysis_modules.halo_analysis.api import HaloCatalog from yt.data_objects.particle_filters import add_particle_filter from yt.analysis_modules.halo_finding.halo_objects import FOFHaloFinder from yt.analysis_modules.halo_analysis.enzofof_merger_tree import EnzoFOFMergerTree from yt.analysis_modules.halo_analysis.enzofof_merger_tree import find_halo_relationships from yt.analysis_modules.halo_analysis.enzofof_merger_tree import grab_FOF_halo_info_internal from yt.analysis_modules.halo_analysis.enzofof_merger_tree import plot_halo_evolution ts = yt.load('DD00??/data00??') for ds in ts: halo_list = FOFHaloFinder(ds, link=0.16, dm_only=False, ptype="all") i = int(ds.basename[4:]) halo_list.write_out("FOF/groups_%05i.txt" % i) halo_list.write_particle_lists("FOF/particles_%05i" % i) mt = EnzoFOFMergerTree(external_FOF = False) for i in range(20): mt.build_tree(i) mt.save_halo_evolution("halos.h5") for i in range(20): plot_halo_evolution("halos.h5",i) plt.savefig("%d.png" % i)
I had some time to look at this this afternoon and came up with the
following pull request:
https://github.com/yt-project/yt/pull/1779
If you'd like you could try running your script again on your real data
with that pull request applied. To do so you'll need to build yt from the
git repo:
$ pip uninstall yt
$ git clone https://github.com/yt-project/yt
$ cd yt
$ git fetch https://github.com/ngoldbaum/yt enzo-fof-fix
$ git checkout enzo-fof-fix
$ pip install -e .
That first step might really need to be "conda uninstall yt" if you use
conda to manage your python installation.
If that works for you or if you run into issues I'd appreciate it if you
could comment on the pull request either way.
Hope that's helpful,
Nathan
On Thu, May 10, 2018 at 9:17 PM
I tried my code using the public dataset in yt named "Enzo_64" downloaded from yt web. And I got the same error like: Traceback (most recent call last): File "./merger-tree.py", line 27, in <module> mt.build_tree(i) File "/mnt/ddnfs/data_users/xllian/software/yt/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py", line 404, in build_tree max_children)] File "/mnt/ddnfs/data_users/xllian/software/yt/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py", line 229, in __init__ sorted_keys = sorted(tree.relationships[output_num][halo_id].keys()) TypeError: '<' not supported between instances of 'str' and 'int'
And my code is like: #!/usr/bin/env python3
import yt import matplotlib.pyplot as plt from yt.analysis_modules.halo_analysis.api import HaloCatalog from yt.data_objects.particle_filters import add_particle_filter from yt.analysis_modules.halo_finding.halo_objects import FOFHaloFinder from yt.analysis_modules.halo_analysis.enzofof_merger_tree import EnzoFOFMergerTree from yt.analysis_modules.halo_analysis.enzofof_merger_tree import find_halo_relationships from yt.analysis_modules.halo_analysis.enzofof_merger_tree import grab_FOF_halo_info_internal from yt.analysis_modules.halo_analysis.enzofof_merger_tree import plot_halo_evolution
ts = yt.load('DD00??/data00??')
for ds in ts: halo_list = FOFHaloFinder(ds, link=0.16, dm_only=False, ptype="all") i = int(ds.basename[4:]) halo_list.write_out("FOF/groups_%05i.txt" % i) halo_list.write_particle_lists("FOF/particles_%05i" % i)
mt = EnzoFOFMergerTree(external_FOF = False) for i in range(20): mt.build_tree(i) mt.save_halo_evolution("halos.h5") for i in range(20): plot_halo_evolution("halos.h5",i) plt.savefig("%d.png" % i) _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
I reinstall my yt in your method, all the steps can work well except the one "git checkout enzo-fof-fix". And the error message is -- error: pathspec 'enzo-fof-fix' did not match any file(s) known to git. Then I just change this command like"git checkout .", and all the install can be finished. But I receive the same error as before when running my script. I have no ideal what's wrong with your method.
Apologies, I should have double-checked that my instructions would work in
a fresh clone of yt.
I'm pretty sure this will work correctly:
$ git fetch https://github.com/ngoldbaum/yt enzo-fof-fix:enzo-fof-fix
$ git checkout enzo-fof-fix
-Nathan
On Mon, May 14, 2018 at 6:14 AM
I reinstall my yt in your method, all the steps can work well except the one "git checkout enzo-fof-fix". And the error message is -- error: pathspec 'enzo-fof-fix' did not match any file(s) known to git. Then I just change this command like"git checkout .", and all the install can be finished. But I receive the same error as before when running my script. I have no ideal what's wrong with your method. _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (2)
-
lianxiaoli87@sjtu.edu.cn
-
Nathan Goldbaum