Tools for Developing Syncopy

The following is a collection of routines, decorators and classes that constitute the basic building blocks of Syncopy. Syncopy’s entire source-code is built using following a modular structure where basic building blocks are written (and tested) once and then re-used throughout the entire package.

Input Parsing and Error Checking

syncopy.shared.parsers.array_parser(var[, …])

Parse array-like objects

syncopy.shared.parsers.data_parser(data[, …])

Docstring

syncopy.shared.parsers.filename_parser(filename)

Extract information from Syncopy file and folder names

syncopy.shared.parsers.io_parser(fs_loc[, …])

Parse file-system location strings for reading/writing files/directories

syncopy.shared.parsers.scalar_parser(var[, …])

Parse scalars

Decorators

syncopy.shared.kwarg_decorators.unwrap_cfg(func)

Decorator that unwraps cfg “structure” in metafunction call

syncopy.shared.kwarg_decorators.unwrap_select(func)

Decorator for handling in-place data selections via select keyword

syncopy.shared.kwarg_decorators.unwrap_io(func)

Decorator for handling parallel execution of a computeFunction()

syncopy.shared.kwarg_decorators.detect_parallel_client(func)

Decorator for handling parallelization via parallel keyword/client detection

Writing A New Analysis Routine

Any analysis routine that operates on Syncopy data is always structured in three (hierarchical) parts:

  1. A numerical function based only on NumPy/SciPy that works on a numpy.ndarray and returns a numpy.ndarray.

  2. A wrapper class that handles output initialization, potential parallelization and post-computation cleanup. The class should be based on the abstract class syncopy.shared.computational_routine.ComputationalRoutine

  3. Another wrapping metafunction handling method selection, parameterization and error checking is then provided for user interaction.

An example of this type of structure is the multi-taper fourier analysis. The corresponding stages here are

  1. Numerical function: syncopy.specest.mtmfft.mtmfft()

  2. Wrapper class: syncopy.specest.mtmfft.MultiTaperFFT

  3. Metafunction: syncopy.freqanalysis()

../_images/ComputationalRoutine.png

For a detailed walk-through explaining the intricacies of writing an analysis routine, please refer to the Design Guide: Syncopy Compute Classes.