Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of bounds IndexError when using dark matter to create a fuzzy match catalog #711

Open
quantumplative opened this issue Mar 27, 2023 · 2 comments

Comments

@quantumplative
Copy link

Using the template below will help us reproduce your problem, which is an essential first step in helping or improving the code. Feel free to customise the template if you are used to raising bug reports, but be sure that you give us enough information to start investigating.

Describe the bug
~/anaconda3/lib/python3.8/site-packages/pynbody/bridge/init.py in fuzzy_match_catalog(self, min_index, max_index, threshold, groups_1, groups_2, use_family, only_family)
123 """
124
--> 125 transfer_matrix = self.catalog_transfer_matrix(min_index,max_index,groups_1,groups_2,use_family,only_family)
126
127 output = [[]]*min_index

~/anaconda3/lib/python3.8/site-packages/pynbody/bridge/init.py in catalog_transfer_matrix(self, min_index, max_index, groups_1, groups_2, use_family, only_family)
183
184 g1 = groups_1.get_group_array(family=only_family)[restriction_start_indices]
--> 185 g2 = groups_2.get_group_array(family=only_family)[restriction_end_indices]
186
187 if max_index is None:

IndexError: index 168398453 is out of bounds for axis 0 with size 168398453

To Reproduce
import pynbody
s = pynbody.load('sim1.00xxxx')
s.physical_units()
h = s.halos()
s2 = pynbody.load('sim2.00xxxx')
s2.physical_units()
h2 = s2.halos()
b = s2.bridge(s)
cat = b.fuzzy_match_catalog(only_family=pynbody.family.dm)

Preferably reproduce the bug using pynbody's own test data (as used by the tutorials, and downloadable at http://star.ucl.ac.uk/~app/testdata.tar.gz). If this impossible, provide us a pointer to another file that we can use to reproduce the problem.

See file h148_bridge.tar.gz attached.

Expected behaviour or result
For each halo in sim1, a list of possible identifications in sim2, along with the fraction of dark matter particles in common between the two.

Setup (please complete the following information):

  • OS: Linux-3.10.0-1160.45.1.el7.x86_64-x86_64-with-glibc2.10
  • Python version: 3.8.5
  • Numpy version: 1.24.2
  • Pynbody version: 1.3.1

Additional context
The IndexError is produced when trying to match halos using dark matter between two different simulations (e.g. s = pynbody.load('h148.cosmo50PLK.6144g3HbwK1BH.004096'); s2 = pynbody.load('h148.cosmo50cvdXsec.6144.004096')) and when trying to match halos with dark matter between two different outputs from the same simulation (e.g. s = pynbody.load('h148.cosmo50PLK.6144g3HbwK1BH.004096'); s2 = pynbody.load('h148.cosmo50PLK.6144g3HbwK1BH.003456'))

@apontzen
Copy link
Member

Unfortunately the tar file reported being corrupted once I downloaded it on my machine (probably just to do with the large size)

However, I think what's going on here is roughly that:

  • use_family is actually the parameter you want
  • only_family was introduced by @mtremmel here 8e9b0c1 and is a memory-saving thing but I think it only makes sense when used together with use_family

I made a clarification in this PR and made only_family automatically activate use_family: #715

@mtremmel would be good to get your input on this in case I am breaking something you meant to do

@apontzen
Copy link
Member

@mtremmel ping to check whether you are happy with #715 so that I can go ahead and merge if it's ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants