Parser

Experiment Parser

This module contains functions for parsing experiments.

sideeye.parser.experiment.parse(experiment_file: str, region_file: str, config: sideeye.config.Configuration = <sideeye.config.Configuration object>) → sideeye.data.experiment.Experiment

Given a DA1 file and region file, and config file, parse an Experiment. If config is not provided, default config will be used.

Parameters:
  • experiment_file (str) – Name of DA1 or ASC file.
  • region_file – Name of region file (.cnt, .reg, or .txt).
  • config (Configuration) – Configuration.

ASC Parser

A parser for .ASC files.

sideeye.parser.asc.parse(asc_file: str, items: Dict[str, Dict[str, sideeye.data.item.Item]], config: sideeye.config.ASCParsingConfig = <sideeye.config.ASCParsingConfig object>)

Parses a .ASC file into an Experiment object.

Parameters:
  • asc_file (string) – Path to .ASC file.
  • items (Dict[str, Dict[str, Item]]) – List of items in experiments.
  • config (ASCParsingConfig) – Configuration for .ASC parsing.

DA1 Parser

A file parser for DA1 data files.

sideeye.parser.da1.parse(filename: str, items: Dict[str, Dict[str, sideeye.data.item.Item]], config: sideeye.config.Configuration = <sideeye.config.Configuration object>, da1_type: str = None) → sideeye.data.experiment.Experiment

Parses DA1-like files into sideeye Experiment objects, given column positions.

Parameters:
  • filename (str) – DA1 file.
  • items (Dict[ItemNum, Dict[Condition, Item]]) – List of items in the experiment.
  • da1_type (str) – Type of DA1 file - timdrop, robodoc, or None for any other type.

Region Parser

A file parser for region data files.

sideeye.parser.region.textfile(filename: str, verbose: int = 0) → Dict[str, Dict[str, sideeye.data.item.Item]]

A parser for a region text file, with regions separated by / and lines within an item separated by \n. \n is ignored in counting the length of a region.

Each line should contain one Item, with the item number, followed by a space or tab (\t), the item condition, another space or tab, and the region string.

For example: 1    2   This is item one /condition two.\n/There are two lines /and four regions.

sideeye.parser.region.file(filename: str, config: sideeye.config.Configuration = <sideeye.config.Configuration object>, verbose: int = 0) → Dict[str, Dict[str, sideeye.data.item.Item]]

Parses a .reg or .cnt file into a dictionary of sideeye Item objects.

Parameters:
  • filename (str) – Region filename.
  • config (Configuration) – Configuration.
sideeye.parser.region.text(region_string: str) → List[sideeye.data.region.Region]

A parser for region strings, with regions separated by /.

Single-line Example: This is region 1/ This is region 2/ This is region 3/ This is region 4.

Multi-line Example: This is region 1/ This is region 2/ This is

region 3/ This is region 4.