AnalysisPipeline.add_recipe(function, *args, **kwargs)[source]

Add a recipe to the AnalysisPipeline.

An recipe is a function that accepts an AnalysisPipeline and adds a series of operations with calls to add_operation. This is a way of creating a shortcut for a series of operations.

  • function (callable) – A function accepting an AnalysisPipeline object.
  • *args (positional arguments) – Any additional positional arguments to be provided to the funciton.
  • **kwargs (keyword arguments) – Any keyword arguments to be provided to the function.


>>> def print_field_value(node, field):
...     print (f"Node {node} has {field} of {node[field]}.")
>>> def print_many_things(pipeline, fields):
...    for field in fields:
...        pipeline.add_operation(print_field_value, field)
>>> ap = ytree.AnalysisPipeline()
>>> ap.add_recipe(print_many_things, ["mass", "virial_radius"])