<div dir="ltr"><div dir="ltr" class="gmail_msg">Hi again,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Thanks again for helping me Britton.</div><div class="gmail_msg">That actually made a difference. Unfortunately I now get a RuntimeError from </div><div class="gmail_msg">hc = HaloCatalog(data_ds=ds, halo_ds=ds_halo)</div><br><div class="gmail_msg">RuntimeError: HaloCatalog quantity must be a registered function or a field of a known type.<br><br></div><div class="gmail_msg">Best,<br></div><div class="gmail_msg">Andreas Ellewsen<br></div><div class="gmail_msg"><br><br></div></div><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Fri, 3 Mar 2017 at 19:16 Britton Smith <<a href="mailto:brittonsmith@gmail.com" class="gmail_msg" target="_blank">brittonsmith@gmail.com</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Hi Andreas,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I forgot about the constraints of the naming conventions for halo catalog files. They need to be named in the following convention:</div><div class="gmail_msg"><prefix>.<integer>.h5</div><div class="gmail_msg">where the integer should start at 0. That integer is in case your catalog is split over multiple files. In examining the code, I can see that it counts the number of files by basically doing glob(<prefix>*h5), so if you've got a file named test.h5 and test.0.h5 in the same directory, it will fool the code into thinking there should be test.0.h5 and test.1.h5. This is clearly a bit of a silly shortcoming of this approach, and I will submit a pull request to make this more intelligent. In the mean time, I think you can fix this by making sure that there is only one file, test.0.h5 in the directory.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Let me know if that doesn't fix it.</div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Britton</div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg">On Fri, Mar 3, 2017 at 6:28 AM, Thor Andreas Seiff Ellewsen <span dir="ltr" class="gmail_msg"><<a href="mailto:tellewsen@gmail.com" class="gmail_msg" target="_blank">tellewsen@gmail.com</a>></span> wrote:<br class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div dir="ltr" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Hi again.</div><div dir="ltr" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Thank for helping me Britton!</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I think I've gotten the halo catalog saved to file now, but I'm having problems loading it using HaloCatalog.</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I've used the code you provided, and everything seems to be going fine until I try loading the catalog.</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">If I try this:</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">save_as_dataset(ds,'test.h5', data, field_types=ftypes, extra_attrs=extra_attrs)</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">ds_halo = load('test.h5')<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">hc = HaloCatalog(data_ds=ds, halos_ds=ds_halo)<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="gmail_msg"></div></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">This returns</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">IOError: Unable to open file (Unable to open file: name = '.0.h5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I tried using </div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">save_as_dataset(ds,'test.0.h5', data, field_types=ftypes, extra_attrs=extra_attrs)<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">ds_halo = load('test.0.h5')</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">hc = HaloCatalog(data_ds=ds, halos_ds=ds_halo)</div></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">instead, but then I get<br class="gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="gmail_msg"></div></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">IOError: Unable to open file (Unable to open file: name = 'test.1.h5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)</div><div class="gmail_msg"><br class="gmail_msg"></div></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">It seems it's trying to open more than one file for some reason?</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Did I misunderstand something?</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I've uploaded the code again to <a href="http://paste.yt-project.org/show/7062/" class="gmail_msg" target="_blank">http://paste.yt-project.org/show/7062/</a></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Best,</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Andreas Ellewsen</div></div><div class="gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409h5 gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div dir="ltr" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">On Thu, 2 Mar 2017 at 19:37 Britton Smith <<a href="mailto:brittonsmith@gmail.com" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">brittonsmith@gmail.com</a>> wrote:<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><blockquote class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Hi Andreas,<div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I think all this can be done very cleanly using yt's halo analysis toolkit. I'd be happy to help you with this.</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Documentation for the halo analysis, also called the HaloCatalog, is here:</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><a href="http://yt-project.org/docs/dev/analyzing/analysis_modules/halo_catalogs.html#halo-catalog-analysis" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">http://yt-project.org/docs/dev/analyzing/analysis_modules/halo_catalogs.html#halo-catalog-analysis</a><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">The HaloCatalog works with the simulation snapshot and the halo finder output in tandem to run a pipeline of analysis that you define. yt comes with a number of functions out of the box for doing profiling, etc, including scaling of profiles to r_vir.</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Before that, you will need to convert your halo finder output into a form that yt can read in using yt.load. This should be relatively straightforward. I've sketched out how to do this here:</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><a href="http://paste.yt-project.org/show/7061/" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">http://paste.yt-project.org/show/7061/</a><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">The code snippet there assumes some of the variables you've got in the script you posted.</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">There may be some hiccups still, but I'm happy to work with you to get it going. Once that works, you should be able to use the HaloCatalog as documented to do the rest, but feel free to ask any other questions you might have.</div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Britton</div></div><div class="gmail_extra m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div></div><div class="gmail_extra m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">On Wed, Mar 1, 2017 at 5:16 AM, Thor Andreas Seiff Ellewsen <span dir="ltr" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><<a href="mailto:tellewsen@gmail.com" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">tellewsen@gmail.com</a>></span> wrote:<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div></div><div class="gmail_extra m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><blockquote class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Hi everyone.<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div>I'm currently working on making temperature and density profiles from some ramses simulations.<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I'd like to make these profiles the average radial profile of the halos in the simulation.<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I think the included rockstar in yt supports this in some form, but my halo catalog is made using AHF and then imported from an ascii file.<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">To do this I need help with two things:<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">The first one is how to scale the radius of each profile to the corresponding virial radius.<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">The other is how to actually average all these profiles.<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Is this something that can be done?<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">I will be trying to compare the resulting profile with the same for different simulations in the end, but I don't expect to have any big problems with that.<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">The code I'm currently using for this can be found at <br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><a href="http://paste.yt-project.org/show/7058/" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">http://paste.yt-project.org/show/7058/</a><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Best,<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div><div class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">Andreas Ellewsen<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div></div>
<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></blockquote></div></div><div class="gmail_extra m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><div class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"><blockquote class="gmail_quote m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">_______________________________________________<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
yt-users mailing list<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
<a href="mailto:yt-users@lists.spacepope.org" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">yt-users@lists.spacepope.org</a><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></blockquote></div><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg"></div>
_______________________________________________<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
yt-users mailing list<br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
<a href="mailto:yt-users@lists.spacepope.org" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">yt-users@lists.spacepope.org</a><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class="m_4207535260054391558m_-3552537250508506409m_7109324586509489322gmail_msg gmail_msg">
</blockquote></div></div></div></div>
<br class="gmail_msg">_______________________________________________<br class="gmail_msg">
yt-users mailing list<br class="gmail_msg">
<a href="mailto:yt-users@lists.spacepope.org" class="gmail_msg" target="_blank">yt-users@lists.spacepope.org</a><br class="gmail_msg">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class="gmail_msg">
<br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div>
_______________________________________________<br class="gmail_msg">
yt-users mailing list<br class="gmail_msg">
<a href="mailto:yt-users@lists.spacepope.org" class="gmail_msg" target="_blank">yt-users@lists.spacepope.org</a><br class="gmail_msg">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br class="gmail_msg">
</blockquote></div></div>