Data types

Sympathy stores data internally as a few different data types. Learning how to use the APIs for those data types is essential when writing your own nodes or when using the F(x) nodes.

For a basic introduction to data types, see Data types.

Built in Types

The following builtin container types are available.

The built in types are all subclasses of sygroup, for API level description, see the following section.

Base class reference

class sygroup(container_type)

Abstract base class for builtin types.

create()

Return a new sygroup, not connected to any file. The same container type is used for the new sygroup.

source(other, shallow=False):

Fill with elements from other sygroup.

__copy__():

Return a shallow copy.

__deepcopy__(memo=None):

Return a deep copy.

Methods and fields that are not documented can be considered internal and should not be used in third party nodes.

Built in TypeAliases

The following builtin type aliases.

The built in type-aliases are all subclasses TypeAlias, for API level description, see the following section.

Base class reference

class sympathy.api.typeutil.TypeAlias(fileobj=None, data=None, filename=None, mode='r', scheme='hdf5', source=None, managed=False, import_links=False)[source]

Base for implementing custom sympathy types. Data serialization is performed through self._data which is setup by __init__ and contains the storage level representation of the data.

If the object introduces additional instance fields, __deepcopy__ and sync likely have to be re-implemented. Carefully, read the relevant docstrings.

Do not implement __init__, instead implement init.

__deepcopy__(memo=None)[source]

Return new TypeAlias object that does not share references with self.

Must be re-implemented by subclasses that introduce additional fields to ensure that the fields are copied to the returned object.

classmethod icon()[source]

Return full path to svg icon.

init()[source]

Perform any initialization, such as, defining local fields.

names(kind=None, fields=None, **kwargs)[source]

Return data related to names of some kind. In fact, names can go beyond finding names and find for example types.

Useful if this type has some kind of names that would be useful in adjust_parameters.

Parameters
  • kind (str) – The kind of names your are interested in.

  • fields (str or [str]) – The fields you would like to include in the result. For example, name and type.

Returns

Normally, containing scalar elements if fields is scalar and tuple of multiple such elements when fields is list.

Return type

list or iterator

source(other, shallow=False)[source]

Update self with the data from other, discarding any previous state in self.

Parameters
  • other (type of self) – Object used as the source for (to update) self.

  • shallow (bool) –

    When shallow is True a deepcopy of other will be avoided to improve performance, shallow=True must only be used in operations that do not modify other.

    When shallow is False the result should be similar to performing the shallow=True with a deepcopy of other so that no modifications of either self or other, after the source operation, can affect the other object.

sync()[source]

Synchronize data fields that are kept in memory to self._data.

Called before data is written to disk and must be re-implemented by subclasses that introduce additional fields to ensure that the fields will be written through self._data.

classmethod viewer()[source]

Return viewer class, which must be a subclass of sympathy.api.typeutil.ViewerBase

Methods and fields that are not documented can be considered internal and should not be used in third party nodes.