ytree.analysis.analysis_pipeline.AnalysisPipeline.add_operation
- AnalysisPipeline.add_operation(function, *args, always_do=False, **kwargs)[source]
Add an operation to the AnalysisPipeline.
An operation is a function that minimally takes in a target object and performs some actions on or with it. This function may alter the object’s state, attach attributes, write out data, etc. Operations are used to create a pipeline of actions performed in sequence on a list of objects, such as all halos in a merger tree. The function can, optionally, return True or False to act as a filter, determining if the rest of the pipeline should be carried out (if True) or if the pipeline should stop and move on to the next object (if False).
- Parameters:
function (callable) – The function to be called for each node/halo.
*args (positional arguments) – Any additional positional arguments to be provided to the funciton.
always_do (optional, bool) – If True, always perform this operation even if a prior filter has returned False. This can be used to add house cleaning operations that should always be run. Default: False
**kwargs (keyword arguments) – Any keyword arguments to be provided to the function.