Fix docstring and add error check for get_internal_function
@@ -121,16 +121,12 @@ class ClTracer(object):
Args:
cosmo (:obj:`Cosmology`): Cosmology object.
- function (:obj:`str`): Specifies which function to evaluate. Must be one of the types specified in the `function_types` dict in `cls.py`.
- a (:obj: float or array-like): list of scale factors at which to evaluate the function.
- specified. Must be one of the types specified in the
- `tracer_types` dict in `cls.py`.
- has_rsd (bool, optional): Flag for whether the tracer has a
- redshift-space distortion term. Defaults to False.
- has_magnification (bool, optional): Flag for whether the tracer has
- a magnification term. Defaults to False.
- has_intrinsic_alignment (bool, optional): Flag for whether the
- tracer has an intrinsic alignment term. Defaults to False.
+ function (:obj:`str`): Specifies which function to evaluate. Must
+ be one of the types specified in the `pyccl.cls.function_types`
+ dictionary.
+ a (:obj: float or array-like): list of scale factors at which to
+ evaluate the function.
+
Returns:
Array of function values at the input scale factors.
"""
@@ -141,6 +137,12 @@ class ClTracer(object):
# Access CCL_ClTracer objects
clt = self.cltracer
+ # Check that specified function type exists
+ if function not in function_types.keys():
+ raise KeyError("Internal function type '%s' not recognized."
+ % function)
+
+ # Check input types
status = 0
is_scalar = False
if isinstance(a, float):
@@ -154,12 +156,11 @@ class ClTracer(object):
aarr = a
na = len(a)
- farr,status=lib.clt_fa_vec(cosmo,self.cltracer,function_types[function],aarr,na,status)
+ # Evaluate function
+ farr, status = lib.clt_fa_vec(cosmo, self.cltracer,
+ function_types[function], aarr, na, status)
check(status, cosmo_in)
- if is_scalar :
- return farr[0]
- else :
- return farr
+ return farr[0] if is_scalar else return farr
def __del__(self):
"""Free memory associated with CCL_ClTracer object.
