예제 #1
0
 def bias_model(self, val):
     if not isinstance(val, str) and not issubclass_(val, bias.Bias):
         raise ValueError("bias_model must be a subclass of bias.Bias")
     elif isinstance(val, str):
         return get_model_(val, "halomod.bias")
     else:
         return val
예제 #2
0
 def halo_concentration_model(self, val):
     """A halo_concentration-mass relation"""
     if not isinstance(val, str) and not issubclass_(val, CMRelation):
         raise ValueError("halo_concentration_model must be a subclass of halo_concentration.CMRelation")
     elif isinstance(val, str):
         return get_model_(val, "halomod.concentration")
     else:
         return val
예제 #3
0
 def hod_model(self, val):
     """:class:`~hod.HOD` class"""
     if not isinstance(val, str) and not issubclass_(val, hod.HOD):
         raise ValueError("hod_model must be a subclass of hod.HOD")
     elif isinstance(val, str):
         return get_model_(val, "halomod.hod")
     else:
         return val
예제 #4
0
 def halo_profile_model(self, val):
     """The halo density halo_profile model"""
     if not isinstance(val, str) and not issubclass_(val, profiles.Profile):
         raise ValueError("halo_profile_model must be a subclass of profiles.Profile")
     elif isinstance(val, str):
         return get_model_(val, "halomod.profiles")
     else:
         return val
예제 #5
0
 def cross_hod_model(self, val):
     if not isinstance(val, str) and not np.issubclass_(val, HODCross):
         raise ValueError(
             "cross_hod_model must be a subclass of cross_correlations.HODCross"
         )
     elif isinstance(val, str):
         return get_model_(val, "")
     else:
         return val
예제 #6
0
    def exclusion_model(self, val):
        """A string identifier for the type of halo exclusion used (or None)"""
        if val is None:
            val = "NoExclusion"

        if issubclass_(val, Exclusion):
            return val
        else:
            return get_model_(val, "halomod.halo_exclusion")
예제 #7
0
 def sd_bias_model(self, val):
     if not isinstance(val, str) and not issubclass_(val, bias.ScaleDepBias) and val is not None:
         raise ValueError("scale_dependenent_bias must be a subclass of bias.ScaleDepBias")
     elif isinstance(val, str):
         model = get_model_(val, "halomod.bias")
         if not issubclass_(model, bias.ScaleDepBias):
             raise ValueError("scale_dependenent_bias must be a subclass of bias.ScaleDepBias")
         return model
     return val
예제 #8
0
    def exclusion_model(self, val):
        """A string identifier for the type of halo exclusion used (or None)"""
        if val is None:
            val = "NoExclusion"

        if issubclass_(val, Exclusion):
            return val
        else:
            return get_model_(val, "halomod.halo_exclusion")
예제 #9
0
    def profile_model(self, val):
        """The halo density profile model"""
        if not isinstance(val, basestring) and not issubclass_(val, profiles.Profile):
            raise ValueError("profile_model must be a subclass of profiles.Profile")

        if isinstance(val, basestring):
            return get_model_(val, "halomod.profiles")
        else:
            return val