HaloCatalog.
add_callback
(callback, *args, **kwargs)[source]¶Add a callback to the halo catalog action list.
A callback is a function that accepts and operates on a Halo object and does not return anything. Callbacks must exist within the callback_registry. Give additional args and kwargs to be passed to the callback here.
Parameters: | callback : string
|
---|
Examples
>>> # Here, a callback is defined and added to the registry.
>>> def _say_something(halo, message):
... my_id = halo.quantities['particle_identifier']
... print "Halo %d: here is a message - %s." % (my_id, message)
>>> add_callback("hello_world", _say_something)
>>> # Now this callback is accessible to the HaloCatalog object
>>> hc.add_callback("hello_world", "this is my message")