Could not construct treePath from basePath = './Illustris-3/output/'

Weston Schwartz
  • 3 Jun '23

Hi Dylan,

I'm trying to work through the Illustris-3 example but have gotten stuck at the 'Merger Trees' section. I've downloaded the correct files and I believe I have placed them in the correct spot. When I run the lines:

>>> fields = ['SubhaloMass','SubfindID','SnapNum']
>>> start = 100
>>> for i in range(start,start+5):
>>>     tree = il.sublink.loadTree(basePath,135,GroupFirstSub[i],fields=fields,onlyMPB=True)
>>>     plt.plot(tree['SnapNum'],tree['SubhaloMass'],'-')
>>> plt.yscale('log')
>>> plt.xlabel('Snapshot Number')
>>> plt.ylabel('Total Subhalo Mass [code units]')

I am greeted by this error message:

ValueError                                Traceback (most recent call last)
Cell In[13], line 5
      3 start = 100
      4 for i in range(start,start+5):
----> 5     tree = il.sublink.loadTree(basePath,135,GroupFirstSub[i],fields=fields,onlyMPB=True)
      6     plt.plot(tree['SnapNum'],tree['SubhaloMass'],'-')
      7 plt.yscale('log')

File ~\illustris_python\sublink.py:114, in loadTree(basePath, snapNum, id, fields, onlyMPB, onlyMDB, treeName, cache)
    111 if isinstance(fields, six.string_types):
    112     fields = [fields]
--> 114 offsets = subLinkOffsets(basePath, treeName, cache)
    116 # find the tree file chunk containing this row
    117 rowOffsets = rowStart - offsets

File ~\illustris_python\sublink.py:89, in subLinkOffsets(basePath, treeName, cache)
     86 offsets = np.zeros(numTreeFiles, dtype='int64')
     88 for i in range(numTreeFiles-1):
---> 89     with h5py.File(treePath(basePath, treeName, i), 'r') as f:
     90         offsets[i+1] = offsets[i] + f['SubhaloID'].shape[0]
     92 if type(cache) is dict:

File ~\illustris_python\sublink.py:33, in treePath(basePath, treeName, chunkNum)
     30 if len(glob.glob(_path)):
     31     return _path
---> 33 raise ValueError("Could not construct treePath from basePath = '{}'".format(basePath))

ValueError: Could not construct treePath from basePath = './Illustris-3/output/'

I've been able to successfully complete the example thus far, this is the only part I'm stuck at. Any ideas of how to tackle this problem? Let me know what more info you need to help. Thanks in advanced.

Best,
Weston

Dylan Nelson
  • 5 Jun '23

This message is just saying it couldn't find the tree files you downloaded.

What is basePath and where did you put the trees? If you look at the top of the illustris_python/sublink.py file, you will see it searches a few places, including basePath/tress/SubLink/ and basePath/../postprocessing/trees/SubLink/ which are our two typical conventions.

Weston Schwartz
  • 5 Jun '23

My basePath is ./Illustris-3/output/ and my tree files are in basePath/trees/SubLink/

Weston Schwartz
  • 5 Jun '23

My basePath is ./Illustris-3/output/ and my tree files are in basePath/trees/SubLink/

Dylan Nelson
  • 6 Jun '23

You could add some print statements to treePath() to understand where it's looking, and what is going wrong, or just play with the path a bit more.

Weston Schwartz
  • 6 Jun '23

Sounds good. I appcreciate the help

  • Page 1 of 1