pynbody.sph.kernels.create_kernel#
- pynbody.sph.kernels.create_kernel(spec) KernelBase[source]#
Create a kernel object from a string specification, a type, an existing kernel object, or a None
This function is used to create a kernel object from a variety of input types. It is used by the framework to allow the user flexibility in specifying the kernel type.
If the input is a string, it is assumed to be the name of a kernel class, and an object of that class is created. You can use the name of the class with or without the ‘Kernel’ suffix, and the case is ignored. For example, ‘WendlandC2Kernel’, ‘wendlandc2’, and ‘WendlandC2’ all return a WendlandC2Kernel instance.
If the input is a subclass of KernelBase, it is assumed to be a kernel object, and is returned as is.
If the input is None, a default kernel is created and returned.
- Returns:
A kernel object
- Return type: