| 1 | from neo.core.baseneo import BaseNeo |
|---|
| 2 | |
|---|
| 3 | class RecordingChannelGroup(BaseNeo): |
|---|
| 4 | """ |
|---|
| 5 | A container for associated :py:class:`RecordingChannel` objects. It is |
|---|
| 6 | useful for grouping channels that share something in common: for instance, |
|---|
| 7 | the channels on a tetrode. |
|---|
| 8 | |
|---|
| 9 | *Usage*:: |
|---|
| 10 | |
|---|
| 11 | # Create a new RecordingChannelGroup and add to current block |
|---|
| 12 | rcg = RecordingChannelGroup(channel_names=['ch1', 'ch2', 'ch3']) |
|---|
| 13 | rcg.channel_indexes = [1, 2, 3] |
|---|
| 14 | block.recordingchannelgroups.append(rcg) |
|---|
| 15 | |
|---|
| 16 | rc1 = RecordingChannel(index=1) |
|---|
| 17 | rcg.recordingchannels.append(rc) |
|---|
| 18 | rc2 = RecordingChannel(index=2) |
|---|
| 19 | rcg.recordingchannels.append(rc) |
|---|
| 20 | rc3 = RecordingChannel(index=3) |
|---|
| 21 | rcg.recordingchannels.append(rc) |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | *Required attributes*: |
|---|
| 25 | None |
|---|
| 26 | |
|---|
| 27 | *Recommended attributes*: |
|---|
| 28 | :channel_names: List of strings naming each channel |
|---|
| 29 | :channel_indexes: List of integer indexes of each channel |
|---|
| 30 | :name: string |
|---|
| 31 | :description: string |
|---|
| 32 | :file_origin: string |
|---|
| 33 | |
|---|
| 34 | *Container of*: |
|---|
| 35 | :py:class:`RecordingChannel` |
|---|
| 36 | :py:class:`AnalogSignalArray` |
|---|
| 37 | """ |
|---|
| 38 | def __init__(self, channel_names=None, channel_indexes=None, name=None, |
|---|
| 39 | description=None, file_origin=None, **annotations): |
|---|
| 40 | """Initialize a new RecordingChannelGroup.""" |
|---|
| 41 | # Inherited initialization |
|---|
| 42 | # Sets universally recommended attributes, and places all others |
|---|
| 43 | # in annotations |
|---|
| 44 | BaseNeo.__init__(self, name=name, file_origin=file_origin, |
|---|
| 45 | description=description, **annotations) |
|---|
| 46 | |
|---|
| 47 | # Defaults |
|---|
| 48 | if channel_indexes is None: |
|---|
| 49 | channel_indexes = [] |
|---|
| 50 | if channel_names is None: |
|---|
| 51 | channel_names = [] |
|---|
| 52 | |
|---|
| 53 | # Store recommended attributes |
|---|
| 54 | self.channel_names = channel_names |
|---|
| 55 | self.channel_indexes = channel_indexes |
|---|
| 56 | |
|---|
| 57 | # Initialize containers for child objects |
|---|
| 58 | self.analogsignalarrays = [ ] |
|---|
| 59 | self.recordingchannels = [ ] |
|---|
| 60 | |
|---|