show

syncopy.show(data, squeeze=True, **kwargs)[source]

Show (partial) contents of Syncopy object

Usage Notice

Syncopy uses HDF5 files as on-disk backing device for data storage. This allows working with larger-than-memory data-sets by streaming only relevant subsets of data from disk on demand without excessive RAM use. However, using show() this mechanism is bypassed and the requested data subset is loaded into memory at once. Thus, inadvertent usage of show() on a large data object can lead to memory overflow or even out-of-memory errors.

Usage Summary

Data selectors for showing subsets of Syncopy data objects follow the syntax of selectdata(). Please refer to selectdata() for a list of valid data selectors for respective Syncopy data objects.

Parameters:
  • data (Syncopy data object) – As for subset-selection via selectdata(), the type of data determines which keywords can be used. Some keywords are only valid for certain types of Syncopy objects, e.g., “freqs” is not a valid selector for an AnalogData object.

  • squeeze (bool) – If True (default) any singleton dimensions are removed from the output array, i.e., the shape of the returned array does not contain ones (e.g., arr.shape = (2,) not arr.shape = (1,2,1,1)).

  • **kwargs (keywords) – Valid data selectors (e.g., trials, channels, toi etc.). Please refer to selectdata() for a full list of available data selectors.

Returns:

arr – A (selection) of data retrieved from the data input object.

Return type:

NumPy nd-array

Notes

This routine represents a convenience function for quickly inspecting the contents of Syncopy objects. It is always possible to manually access an object’s numerical data by indexing the underlying HDF5 dataset: data.data[idx]. The dimension labels of the dataset are encoded in data.dimord, e.g., if data is a AnalogData with data.dimord being [‘time’, ‘channel’] and data.data.shape is (15000, 16), then data.data[:, 3] returns the contents of the fourth channel across all time points.

Examples

Use generate_artificial_data() to create a synthetic syncopy.AnalogData object.

>>> from syncopy.tests.misc import generate_artificial_data
>>> adata = generate_artificial_data(nTrials=10, nChannels=32)

Show the contents of ‘channel02’ across all trials:

>>> spy.show(adata, channel='channel02')
Syncopy <show> INFO: Showing all times 10 trials
Out[2]: array([1.0871, 0.7267, 0.2816, ..., 1.0273, 0.893 , 0.7226], dtype=float32)

Note that this is equivalent to

>>> adata.show(channel='channel02')

To preserve singleton dimensions use squeeze=False:

>>> adata.show(channel='channel02', squeeze=False)
Out[3]:
array([[1.0871],
       [0.7267],
       [0.2816],
       ...,
       [1.0273],
       [0.893 ],
       [0.7226]], dtype=float32)

See also

syncopy.selectdata()

Create a new Syncopy object from a selection