Empty return warning in sublink.py

Jonathan Mack
  • 17 Jun '17

The 2016-09-16 update to sublink.py added the following warning message: 'Warning, empty return. Subhalo [id] at snapNum [snapNum] not in tree.' My code uses sublink.py to traverse every subhalo in every tree, and appeared to work correctly when I used a previous version of sublink.py. Now that I've upgraded to the latest version of the file, however, though my code still apparently gives the same output, I receive this warning once every approximately 50 trees. Is this a warning with which I should be concerned? Does anyone know why it was added?

Thanks in advance for any insight.

Dylan Nelson
  • 21 Jun '17

Hi Jonathan,

You can of course comment out this print statement (I do this). It is just to remind people that they need to handle the None return case, for when the requested subhalo is not in the tree. If you are processing every single subhalo then yes it is to be expected that some will not be in the tree, and you should receive this message.

Jonathan Mack
  • 4
  • 25 Jun '17


Thanks for your reply. To clarify my original question, I'm attempting to analyze (so therefore need to load) every snapNum 135-rooted tree in a simulation run. Here's how I implemented that:

numSubhalos = il.groupcat.loadHeader(basePath, 135)
for i in range(numSubhalos)
  il.sublink.loadTree(basePath, 135, i)

Am I understanding correctly, then, that the warning prints if and only if there's a snapNum 135 subhalo not associated with any tree? If so, is there a better way for me to load the contents of every tree with root at snapNum 135 than what I'm doing, perhaps (since I want to load entire trees and not subtrees, so may not need offsets) without requiring the use of loadHeader and the group catalogs?



Dylan Nelson
  • 25 Jun '17

What you're doing seems all fine. You could of course write a new function loadAllTrees() and optimize this, to e.g. load/calculate the offset files only once. The only benefit would be efficiency, if this is currently a bottleneck for you.

Jonathan Mack
  • 25 Jun '17

Understood. Thanks!

  • Page 1 of 1