DMelt:IO/7 YAML File Format

From HandWiki

YAML file format

DataMelt includes library to handle YAML data format. The YAML format is described in YAML web page. The included Java implementation is based on SnakeYAML. The Java API can be found in SnakeYAML API SnakeYAML API.

DMelt supports writing and reading YAML files using the class. It keeps data in the form key-values. Most DMelt arrays and histograms are supported,

The YAML files can hold many Java and Python object in a form of simple text files. This is useful for exchange of data between different programming languages. The files are typically smaller then similar XML files since no tags is used. This feature makes YAML files attractive to keep numeric data.



You can also write lists, maps (dictionaries) to external files in arbitrary order. Then you can read such text files back, creating Java lists (Python lists) on the fly. Also, objects such as P1D, histograms (H1D) are supported.

This is an example of parsing YAML string messages:

This is an example:

from import *
# reading  yaml file

Let us consider how to store multi-dimensional data and histograms in the YAML files.