{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 4: The Pype class\n", "\n", "The previous tutorial showed how the `Pype` class operates in comparison to just calling the functions in pure Python. You can make the most of the pype function when using configuration files that are customized to your specific needs or workflow. \n", "\n", "A selection of templates for configuration files to be used by the `Pype` class can be found in the [template section of the docs](https://www.phenopype.org/docs/templates/). They can be freely modified, but need to adhere YAML specifications (see below). Also check the [phenopype gallery](https://www.phenopype.org/gallery/) for inspiration and additional templates.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
See also:
\n", "\n", "\n", "* [phenopype docs: Pype-API](https://www.phenopype.org/docs/api/pype/)\n", "* [phenopype docs: YAML resources](https://www.phenopype.org/docs/resources/yaml/).\n", " \n", "
\n", "YAML syntax
\n", " \n", "**Here are the most important rules for YAML syntax (in phenopype and in general):**\n", "\n", "- **indentation rules:**\n", "\t- 0 spaces + hyphen + space for modules\n", "\t- 4 spaces + hyphen + space in front of functions \n", "\t- 8 spaces in front of arguments\n", " \n", "- **separation rules:**\n", " - modules and functions with arguments are followed by a colon (`:`) and a new line\n", " - functions without specified arguments don't need a colon \n", " - arguments are followed by a colon, a space and then the value\n", " \n", "- modules and functions can be emtpy (see`- draw_mask` above), but function arguments *cannot* be emtpy (e.g. `overwrite:` needs to be `true` or `false`)\n", " \n", "- as per Python syntax, optional function arguments can, but don't have to be specified and the functions will just run on default values\n", " \n", "- functions can be added multiple times, but sometimes their output may be overwtritten (e.g. `- threshold` makes sense only once, but `- blur` may be used in multiple locations)\n", " \n", "