I brought the extra stuff from 1064 to here, so that we keep the other PR as clean as possible, and this PR also defines a library-level control to turn on/off the custom __eq__ methods, just as we had with the __repr__ methods.
Old Description
The main change this PR introduces, is to make mass_def an optional argument in HMCalculator because if mass_function and halo_bias are passed as instances (rather than str) we can just use their own mass_def. We can do that because some lines below we enforce that all mass_defs are equal.
So an HMCalculator can be instantiated in one of the following ways:
## From strings
# hmc way 1
hmc = ccl.halos.HMCalculator(mass_function="Tinker10", halo_bias="Tinker10", mass_def="200c")
## From instances
# Initialize instances
# instances way 1
mdef = ccl.halos.MassDef200c()
hmf = ccl.halos.MassFunctionTinker10(mass_def=mdef) # mass_def can also be a string
hbf = ccl.halos.HaloBiasTinker10(mass_def=mdef) # mass_def can also be a string
# instances way 2
hmf = ccl.halos.MassFunc.from_name("Tinker10")(mass_def="200c") # mass_def can also be an instance
hbf = ccl.halos.HaloBias.from_name("Tinker10")(mass_def="200c") # mass_def can also be an instance
# instances way 3
hmf = ccl.halos.MassFunc.create_instance("Tinker10", mass_def="200c") # mass_def can also be an instance
hbf = ccl.halos.HaloBias.create_instance("Tinker10", mass_def="200c") # mass_def can also be an instance
# hmc way 2
hmc = ccl.halos.HMCalculator(mass_function=hmf, halo_bias=hbf, mass_def=mdef)
# hmc way 3
hmc = ccl.halos.HMCalculator(mass_function=hmf, halo_bias=hbf)
This is a rebased copy of 1065.
I brought the extra stuff from 1064 to here, so that we keep the other PR as clean as possible, and this PR also defines a library-level control to turn on/off the custom
__eq__
methods, just as we had with the__repr__
methods.Old Description
The main change this PR introduces, is to make
mass_def
an optional argument inHMCalculator
because ifmass_function
andhalo_bias
are passed as instances (rather than str) we can just use their ownmass_def
. We can do that because some lines below we enforce that allmass_def
s are equal. So anHMCalculator
can be instantiated in one of the following ways: