python code to calculate halo level properties in mocks and survey data