SWIFTSIM / velociraptor-python

Python tools for using velociraptor catalogues, with SWIFT integration
GNU Lesser General Public License v3.0
0 stars 8 forks source link

Added mask for centrals and satellites to the catalogue. #75

Closed bwvdnbro closed 2 years ago

bwvdnbro commented 2 years ago

As requested in #74, this adds a convenience mask for centrals and satellites to the catalogue. It's not very pretty, but it does the job.

JBorrow commented 2 years ago

Hmm I definitely do not like this, patching into the load function is dodgy as maybe internal APIs used the VelociraptorCatalogue object directly somewhere.

Can you add centrals and satellites as properties?

@property
def centrals(self):
  if hasattr(self.structure_type, "structuretype"):
    return self.structure_type.structuretype == 10
  else
    return np.s_[:]

@property
def satellites(self):
  if hasattr(self.structure_type, "structuretype"):
    return self.structure_type.structuretype != 10
  else
    return np.s_[:]
bwvdnbro commented 2 years ago

Done. That is a lot cleaner indeed.