- syncopy.show(data, squeeze=True, **kwargs)[source]#
Show (partial) contents of Syncopy object
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.
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.
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
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.
arr – A (selection) of data retrieved from the data input object.
- Return type
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
AnalogDatawith 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.
generate_artificial_data()to create a synthetic
>>> 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: array([1.0871, 0.7267, 0.2816, ..., 1.0273, 0.893 , 0.7226], dtype=float32)
Note that this is equivalent to
To preserve singleton dimensions use
>>> adata.show(channel='channel02', squeeze=False) Out: array([[1.0871], [0.7267], [0.2816], ..., [1.0273], [0.893 ], [0.7226]], dtype=float32)
Create a new Syncopy object from a selection